Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobruni committed Mar 6, 2024
2 parents 27afa84 + 8ca5ebb commit 6e00c48
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: '16'
- uses: pnpm/action-setup@v2.4.0
- uses: pnpm/action-setup@v3.0.0
name: Install pnpm
id: pnpm-install
with:
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: '16'
- uses: pnpm/action-setup@v2.4.0
- uses: pnpm/action-setup@v3.0.0
name: Install pnpm
id: pnpm-install
with:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ yarn add @tsparticles/vue3
```javascript
import Particles from "@tsparticles/vue3";
//import { loadFull } from "tsparticles"; // if you are going to use `loadFull`, install the "tsparticles" package too.
import { loadSlim } from "tsparticles-slim"; // if you are going to use `loadSlim`, install the "tsparticles-slim" package too.
import { loadSlim } from "@tsparticles/slim"; // if you are going to use `loadSlim`, install the "@tsparticles/slim" package too.

createApp(App).use(Particles, {
init: async engine => {
// await loadFull(engine); // you can load the full tsParticles library from "tsparticles" if you need it
await loadSlim(engine); // or you can load the slim version from "tsparticles-slim" if don't need Shapes or Animations
await loadSlim(engine); // or you can load the slim version from "@tsparticles/slim" if don't need Shapes or Animations
},
});
```
Expand Down
4 changes: 2 additions & 2 deletions apps/nuxt3/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: actions/checkout@master

- name: Setup node env 🏗
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v4.0.1
with:
node-version: ${{ matrix.node }}
check-latest: true
Expand All @@ -34,7 +34,7 @@ jobs:
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache node_modules 📦
uses: actions/cache@v3.2.2
uses: actions/cache@v3.3.3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
4 changes: 2 additions & 2 deletions components/vue3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ yarn add @tsparticles/vue3
```javascript
import Particles from "@tsparticles/vue3";
//import { loadFull } from "tsparticles"; // if you are going to use `loadFull`, install the "tsparticles" package too.
import { loadSlim } from "tsparticles-slim"; // if you are going to use `loadSlim`, install the "tsparticles-slim" package too.
import { loadSlim } from "@tsparticles/slim"; // if you are going to use `loadSlim`, install the "@tsparticles/slim" package too.

createApp(App).use(Particles, {
init: async engine => {
// await loadFull(engine); // you can load the full tsParticles library from "tsparticles" if you need it
await loadSlim(engine); // or you can load the slim version from "tsparticles-slim" if don't need Shapes or Animations
await loadSlim(engine); // or you can load the slim version from "@tsparticles/slim" if don't need Shapes or Animations
},
});
```
Expand Down
19 changes: 16 additions & 3 deletions components/vue3/src/components/vue-particles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<script setup lang="ts">
import { type Container, type ISourceOptions, type Engine, tsParticles } from "@tsparticles/engine";
import { nextTick, onMounted, onUnmounted } from "vue";
import { nextTick, onMounted, onUnmounted, watch } from "vue";
export type IParticlesProps = ISourceOptions;
Expand All @@ -14,19 +14,22 @@ const props = defineProps<{
id: string;
options?: IParticlesProps;
url?: string;
theme?: string;
}>();
const emit = defineEmits<{
(e: "particlesLoaded", container?: Container): void;
}>();
addEventListener("particlesInit", (e: Event) => {
const initEventHandler = (e: Event) => {
const evt = e as CustomEvent<Engine>;
engine = evt.detail;
loadParticles();
});
};
addEventListener("particlesInit", initEventHandler);
const loadParticles = async () => {
if (!engine) {
Expand Down Expand Up @@ -60,5 +63,15 @@ onUnmounted(() => {
container.destroy();
container = undefined;
removeEventListener("particlesInit", initEventHandler);
});
watch(
() => props.theme,
() => {
container?.loadTheme(props.theme);
},
{ immediate: true, deep: true },
);
</script>

0 comments on commit 6e00c48

Please sign in to comment.