@tsparticles/nuxt3 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 +56 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +34 -0
- package/package.json +46 -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,56 @@
|
|
|
1
|
+
[](https://particles.js.org)
|
|
2
|
+
|
|
3
|
+
# @tsparticles/nuxt3
|
|
4
|
+
|
|
5
|
+
Nuxt module for [@tsparticles/vue3](https://www.npmjs.com/package/@tsparticles/vue3) with client-side registration only.
|
|
6
|
+
|
|
7
|
+
This package does not enforce `slim`/`full` presets. The app controls what to load in its own `registerParticles` function.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add @tsparticles/nuxt3 @tsparticles/vue3 @tsparticles/engine
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
Add the module in `nuxt.config.ts`:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { defineNuxtConfig } from "nuxt/config";
|
|
21
|
+
|
|
22
|
+
export default defineNuxtConfig({
|
|
23
|
+
modules: ["@tsparticles/nuxt3"],
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Create `utils/particlesInit.ts`:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import type { Engine } from "@tsparticles/engine";
|
|
31
|
+
|
|
32
|
+
export async function registerParticles(engine: Engine): Promise<void> {
|
|
33
|
+
const [{ loadSlim }] = await Promise.all([import("@tsparticles/slim")]);
|
|
34
|
+
|
|
35
|
+
await loadSlim(engine);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The module loads `~/utils/particlesInit` by default. You can customize it:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { defineNuxtConfig } from "nuxt/config";
|
|
43
|
+
|
|
44
|
+
export default defineNuxtConfig({
|
|
45
|
+
modules: ["@tsparticles/nuxt3"],
|
|
46
|
+
tsparticles: {
|
|
47
|
+
initPath: "~/particles/customInit",
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Notes
|
|
53
|
+
|
|
54
|
+
- The module registers `@tsparticles/vue3` only on the client.
|
|
55
|
+
- Required export in the init file: `registerParticles(engine)`.
|
|
56
|
+
- Keep `registerParticles` focused on your app needs (load only desired plugins/bundles).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NuxtModule } from "@nuxt/schema";
|
|
2
|
+
export interface ITsParticlesNuxtOptions {
|
|
3
|
+
initPath?: string;
|
|
4
|
+
}
|
|
5
|
+
declare module "@nuxt/schema" {
|
|
6
|
+
interface NuxtConfig {
|
|
7
|
+
tsparticles?: ITsParticlesNuxtOptions;
|
|
8
|
+
}
|
|
9
|
+
interface NuxtOptions {
|
|
10
|
+
tsparticles?: ITsParticlesNuxtOptions;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare const tsParticlesNuxtModule: NuxtModule<ITsParticlesNuxtOptions>;
|
|
14
|
+
export default tsParticlesNuxtModule;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { addPlugin, addTemplate, defineNuxtModule } from "@nuxt/kit";
|
|
2
|
+
const tsParticlesNuxtModule = defineNuxtModule({
|
|
3
|
+
meta: {
|
|
4
|
+
name: "@tsparticles/nuxt3",
|
|
5
|
+
configKey: "tsparticles",
|
|
6
|
+
compatibility: {
|
|
7
|
+
nuxt: ">=3.0.0 <4",
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
defaults: {
|
|
11
|
+
initPath: "~/utils/particlesInit",
|
|
12
|
+
},
|
|
13
|
+
setup(options) {
|
|
14
|
+
const initPath = options.initPath ?? "~/utils/particlesInit";
|
|
15
|
+
const pluginPath = addTemplate({
|
|
16
|
+
filename: "tsparticles.client.mjs",
|
|
17
|
+
getContents: () => `import { defineNuxtPlugin } from "#app";
|
|
18
|
+
import VueParticles from "@tsparticles/vue3";
|
|
19
|
+
import { registerParticles } from "${initPath}";
|
|
20
|
+
|
|
21
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
22
|
+
nuxtApp.vueApp.use(VueParticles, {
|
|
23
|
+
init: registerParticles,
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
`,
|
|
27
|
+
}).dst;
|
|
28
|
+
addPlugin({
|
|
29
|
+
src: pluginPath,
|
|
30
|
+
mode: "client",
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
export default tsParticlesNuxtModule;
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tsparticles/nuxt3",
|
|
3
|
+
"version": "4.0.0-beta.12",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "prettier --write README.md && pnpm run prettify && tsc -p tsconfig.json",
|
|
15
|
+
"build:ci": "prettier --check README.md && pnpm run prettify:ci && tsc -p tsconfig.json",
|
|
16
|
+
"lint": "eslint . --max-warnings 0",
|
|
17
|
+
"prettify": "prettier --write \"lib/**/*.ts\"",
|
|
18
|
+
"prettify:ci": "prettier --check \"lib/**/*.ts\"",
|
|
19
|
+
"prepublishOnly": "pnpm run build"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@nuxt/kit": "^4.4.2",
|
|
27
|
+
"@tsparticles/engine": "^4.0.0-beta.12",
|
|
28
|
+
"@tsparticles/vue3": "^4.0.0-beta.12"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"nuxt": "^3.0.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@eslint/js": "^10.0.1",
|
|
35
|
+
"@nuxt/schema": "^4.4.2",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^8.58.2",
|
|
37
|
+
"@typescript-eslint/parser": "^8.58.2",
|
|
38
|
+
"eslint": "^10.2.0",
|
|
39
|
+
"globals": "^17.5.0",
|
|
40
|
+
"typescript": "^6.0.2"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"gitHead": "bdbc95716ce44665fbecfaca8757445e248b562d"
|
|
46
|
+
}
|