@uibit/particles 0.1.0 → 0.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/README.md +10 -0
- package/custom-elements.json +478 -1
- package/dist/frameworks/angular/index.ts +79 -57
- package/dist/frameworks/astro/index.d.ts +14 -1
- package/dist/frameworks/preact/index.d.ts +2 -0
- package/dist/frameworks/react/index.ts +150 -0
- package/dist/frameworks/solid/index.d.ts +1 -0
- package/dist/frameworks/stencil/index.d.ts +2 -0
- package/dist/frameworks/svelte/index.svelte +84 -29
- package/dist/frameworks/vue/index.ts +172 -26
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/particles.d.ts +4 -1
- package/dist/particles.d.ts.map +1 -1
- package/dist/particles.js +4 -1
- package/dist/particles.js.map +1 -1
- package/package.json +7 -7
- package/dist/frameworks/react/index.d.ts +0 -26
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import type { Particles as HTMLElementClass } from '@uibit/particles';
|
|
2
2
|
import '@uibit/particles';
|
|
3
|
+
import type { Particle, ParticleHoverEffect, ParticleMode } from '@uibit/particles';
|
|
3
4
|
|
|
4
5
|
declare global {
|
|
5
6
|
namespace astroHTML.JSX {
|
|
6
7
|
interface IntrinsicElements {
|
|
7
|
-
'uibit-particles': Partial<HTMLElementClass> & astroHTML.JSX.HTMLAttributes
|
|
8
|
+
'uibit-particles': Partial<HTMLElementClass> & astroHTML.JSX.HTMLAttributes & {
|
|
9
|
+
count?: number;
|
|
10
|
+
speed?: number;
|
|
11
|
+
mode?: ParticleMode;
|
|
12
|
+
connect?: boolean;
|
|
13
|
+
connectDistance?: number;
|
|
14
|
+
hoverEffect?: ParticleHoverEffect;
|
|
15
|
+
interactiveRadius?: number;
|
|
16
|
+
_resize?: any;
|
|
17
|
+
_loop?: any;
|
|
18
|
+
locale?: string;
|
|
19
|
+
|
|
20
|
+
};
|
|
8
21
|
}
|
|
9
22
|
}
|
|
10
23
|
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useLayoutEffect, useImperativeHandle } from 'react';
|
|
2
|
+
import type { Particles as HTMLElementClass } from '@uibit/particles';
|
|
3
|
+
import '@uibit/particles';
|
|
4
|
+
import type { Particle, ParticleHoverEffect, ParticleMode } from '@uibit/particles';
|
|
5
|
+
const useTypeOfLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
6
|
+
export interface ParticlesProps extends Omit<React.HTMLAttributes<HTMLElementClass>, 'count' | 'speed' | 'mode' | 'connect' | 'connectDistance' | 'hoverEffect' | 'interactiveRadius' | '_resize' | '_loop' | 'locale'> {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
count?: number;
|
|
9
|
+
speed?: number;
|
|
10
|
+
mode?: ParticleMode;
|
|
11
|
+
connect?: boolean;
|
|
12
|
+
connectDistance?: number;
|
|
13
|
+
hoverEffect?: ParticleHoverEffect;
|
|
14
|
+
interactiveRadius?: number;
|
|
15
|
+
_resize?: any;
|
|
16
|
+
_loop?: any;
|
|
17
|
+
locale?: string;
|
|
18
|
+
}
|
|
19
|
+
export const Particles = ({ ref, children, ...props }: ParticlesProps & {
|
|
20
|
+
ref?: React.Ref<HTMLElementClass>;
|
|
21
|
+
})=>{
|
|
22
|
+
const innerRef = useRef<HTMLElementClass>(null);
|
|
23
|
+
const propsRef = useRef(props);
|
|
24
|
+
propsRef.current = props;
|
|
25
|
+
useImperativeHandle(ref, ()=>innerRef.current!);
|
|
26
|
+
useTypeOfLayoutEffect(()=>{
|
|
27
|
+
const element = innerRef.current;
|
|
28
|
+
if (element && props.count !== undefined) {
|
|
29
|
+
(element as any).count = props.count;
|
|
30
|
+
}
|
|
31
|
+
}, [
|
|
32
|
+
props.count
|
|
33
|
+
]);
|
|
34
|
+
useTypeOfLayoutEffect(()=>{
|
|
35
|
+
const element = innerRef.current;
|
|
36
|
+
if (element && props.speed !== undefined) {
|
|
37
|
+
(element as any).speed = props.speed;
|
|
38
|
+
}
|
|
39
|
+
}, [
|
|
40
|
+
props.speed
|
|
41
|
+
]);
|
|
42
|
+
useTypeOfLayoutEffect(()=>{
|
|
43
|
+
const element = innerRef.current;
|
|
44
|
+
if (element && props.mode !== undefined) {
|
|
45
|
+
(element as any).mode = props.mode;
|
|
46
|
+
}
|
|
47
|
+
}, [
|
|
48
|
+
props.mode
|
|
49
|
+
]);
|
|
50
|
+
useTypeOfLayoutEffect(()=>{
|
|
51
|
+
const element = innerRef.current;
|
|
52
|
+
if (element && props.connect !== undefined) {
|
|
53
|
+
(element as any).connect = props.connect;
|
|
54
|
+
}
|
|
55
|
+
}, [
|
|
56
|
+
props.connect
|
|
57
|
+
]);
|
|
58
|
+
useTypeOfLayoutEffect(()=>{
|
|
59
|
+
const element = innerRef.current;
|
|
60
|
+
if (element && props.connectDistance !== undefined) {
|
|
61
|
+
(element as any).connectDistance = props.connectDistance;
|
|
62
|
+
}
|
|
63
|
+
}, [
|
|
64
|
+
props.connectDistance
|
|
65
|
+
]);
|
|
66
|
+
useTypeOfLayoutEffect(()=>{
|
|
67
|
+
const element = innerRef.current;
|
|
68
|
+
if (element && props.hoverEffect !== undefined) {
|
|
69
|
+
(element as any).hoverEffect = props.hoverEffect;
|
|
70
|
+
}
|
|
71
|
+
}, [
|
|
72
|
+
props.hoverEffect
|
|
73
|
+
]);
|
|
74
|
+
useTypeOfLayoutEffect(()=>{
|
|
75
|
+
const element = innerRef.current;
|
|
76
|
+
if (element && props.interactiveRadius !== undefined) {
|
|
77
|
+
(element as any).interactiveRadius = props.interactiveRadius;
|
|
78
|
+
}
|
|
79
|
+
}, [
|
|
80
|
+
props.interactiveRadius
|
|
81
|
+
]);
|
|
82
|
+
useTypeOfLayoutEffect(()=>{
|
|
83
|
+
const element = innerRef.current;
|
|
84
|
+
if (element && props._resize !== undefined) {
|
|
85
|
+
(element as any)._resize = props._resize;
|
|
86
|
+
}
|
|
87
|
+
}, [
|
|
88
|
+
props._resize
|
|
89
|
+
]);
|
|
90
|
+
useTypeOfLayoutEffect(()=>{
|
|
91
|
+
const element = innerRef.current;
|
|
92
|
+
if (element && props._loop !== undefined) {
|
|
93
|
+
(element as any)._loop = props._loop;
|
|
94
|
+
}
|
|
95
|
+
}, [
|
|
96
|
+
props._loop
|
|
97
|
+
]);
|
|
98
|
+
useTypeOfLayoutEffect(()=>{
|
|
99
|
+
const element = innerRef.current;
|
|
100
|
+
if (element && props.locale !== undefined) {
|
|
101
|
+
(element as any).locale = props.locale;
|
|
102
|
+
}
|
|
103
|
+
}, [
|
|
104
|
+
props.locale
|
|
105
|
+
]);
|
|
106
|
+
const domProps = {
|
|
107
|
+
...props
|
|
108
|
+
};
|
|
109
|
+
const customPropNames = [
|
|
110
|
+
'count',
|
|
111
|
+
'speed',
|
|
112
|
+
'mode',
|
|
113
|
+
'connect',
|
|
114
|
+
'connectDistance',
|
|
115
|
+
'hoverEffect',
|
|
116
|
+
'interactiveRadius',
|
|
117
|
+
'_resize',
|
|
118
|
+
'_loop',
|
|
119
|
+
'locale'
|
|
120
|
+
];
|
|
121
|
+
for (const key of customPropNames){
|
|
122
|
+
delete (domProps as any)[key];
|
|
123
|
+
}
|
|
124
|
+
return React.createElement('uibit-particles', {
|
|
125
|
+
ref: innerRef,
|
|
126
|
+
...domProps
|
|
127
|
+
}, children);
|
|
128
|
+
};
|
|
129
|
+
declare global {
|
|
130
|
+
namespace React {
|
|
131
|
+
namespace JSX {
|
|
132
|
+
interface IntrinsicElements {
|
|
133
|
+
'uibit-particles': React.ClassAttributes<HTMLElementClass> & React.HTMLAttributes<HTMLElementClass> & {
|
|
134
|
+
children?: React.ReactNode;
|
|
135
|
+
class?: string;
|
|
136
|
+
count?: number;
|
|
137
|
+
speed?: number;
|
|
138
|
+
mode?: ParticleMode;
|
|
139
|
+
connect?: boolean;
|
|
140
|
+
connectDistance?: number;
|
|
141
|
+
hoverEffect?: ParticleHoverEffect;
|
|
142
|
+
interactiveRadius?: number;
|
|
143
|
+
_resize?: any;
|
|
144
|
+
_loop?: any;
|
|
145
|
+
locale?: string;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
import '@uibit/particles';
|
|
3
3
|
import type { Particles as HTMLElementClass } from '@uibit/particles';
|
|
4
4
|
import type { Particle, ParticleHoverEffect, ParticleMode } from '@uibit/particles';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
count =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
count = $bindable(),
|
|
8
|
+
speed = $bindable(),
|
|
9
|
+
mode = $bindable(),
|
|
10
|
+
connect = $bindable(),
|
|
11
|
+
connectDistance = $bindable(),
|
|
12
|
+
hoverEffect = $bindable(),
|
|
13
|
+
interactiveRadius = $bindable(),
|
|
14
|
+
_resize = $bindable(),
|
|
15
|
+
_loop = $bindable(),
|
|
16
|
+
locale = $bindable(),
|
|
17
|
+
children,
|
|
18
|
+
...restProps
|
|
17
19
|
} = $props<{
|
|
18
|
-
children?:
|
|
20
|
+
children?: import('svelte').Snippet;
|
|
19
21
|
count?: number;
|
|
20
22
|
speed?: number;
|
|
21
23
|
mode?: ParticleMode;
|
|
@@ -25,44 +27,97 @@
|
|
|
25
27
|
interactiveRadius?: number;
|
|
26
28
|
_resize?: any;
|
|
27
29
|
_loop?: any;
|
|
28
|
-
|
|
30
|
+
locale?: string;
|
|
31
|
+
|
|
32
|
+
[key: string]: any;
|
|
29
33
|
}>();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (elementRef && count !== undefined) {
|
|
34
|
+
|
|
35
|
+
let elementRef: HTMLElementClass | null = $state(null);
|
|
36
|
+
|
|
37
|
+
$effect(() => {
|
|
38
|
+
if (elementRef && count !== undefined && elementRef.count !== count) {
|
|
35
39
|
elementRef.count = count;
|
|
36
40
|
}
|
|
37
|
-
if (elementRef && speed !== undefined) {
|
|
41
|
+
if (elementRef && speed !== undefined && elementRef.speed !== speed) {
|
|
38
42
|
elementRef.speed = speed;
|
|
39
43
|
}
|
|
40
|
-
if (elementRef && mode !== undefined) {
|
|
44
|
+
if (elementRef && mode !== undefined && elementRef.mode !== mode) {
|
|
41
45
|
elementRef.mode = mode;
|
|
42
46
|
}
|
|
43
|
-
if (elementRef && connect !== undefined) {
|
|
47
|
+
if (elementRef && connect !== undefined && elementRef.connect !== connect) {
|
|
44
48
|
elementRef.connect = connect;
|
|
45
49
|
}
|
|
46
|
-
if (elementRef && connectDistance !== undefined) {
|
|
50
|
+
if (elementRef && connectDistance !== undefined && elementRef.connectDistance !== connectDistance) {
|
|
47
51
|
elementRef.connectDistance = connectDistance;
|
|
48
52
|
}
|
|
49
|
-
if (elementRef && hoverEffect !== undefined) {
|
|
53
|
+
if (elementRef && hoverEffect !== undefined && elementRef.hoverEffect !== hoverEffect) {
|
|
50
54
|
elementRef.hoverEffect = hoverEffect;
|
|
51
55
|
}
|
|
52
|
-
if (elementRef && interactiveRadius !== undefined) {
|
|
56
|
+
if (elementRef && interactiveRadius !== undefined && elementRef.interactiveRadius !== interactiveRadius) {
|
|
53
57
|
elementRef.interactiveRadius = interactiveRadius;
|
|
54
58
|
}
|
|
55
|
-
if (elementRef && _resize !== undefined) {
|
|
59
|
+
if (elementRef && _resize !== undefined && elementRef._resize !== _resize) {
|
|
56
60
|
elementRef._resize = _resize;
|
|
57
61
|
}
|
|
58
|
-
if (elementRef && _loop !== undefined) {
|
|
62
|
+
if (elementRef && _loop !== undefined && elementRef._loop !== _loop) {
|
|
59
63
|
elementRef._loop = _loop;
|
|
60
64
|
}
|
|
65
|
+
if (elementRef && locale !== undefined && elementRef.locale !== locale) {
|
|
66
|
+
elementRef.locale = locale;
|
|
67
|
+
}
|
|
61
68
|
});
|
|
62
|
-
|
|
69
|
+
|
|
70
|
+
$effect(() => {
|
|
71
|
+
const element = elementRef;
|
|
72
|
+
if (!element) return;
|
|
73
|
+
|
|
74
|
+
const handleEvent = () => {
|
|
75
|
+
if (count !== element.count) {
|
|
76
|
+
count = element.count as any;
|
|
77
|
+
}
|
|
78
|
+
if (speed !== element.speed) {
|
|
79
|
+
speed = element.speed as any;
|
|
80
|
+
}
|
|
81
|
+
if (mode !== element.mode) {
|
|
82
|
+
mode = element.mode as any;
|
|
83
|
+
}
|
|
84
|
+
if (connect !== element.connect) {
|
|
85
|
+
connect = element.connect as any;
|
|
86
|
+
}
|
|
87
|
+
if (connectDistance !== element.connectDistance) {
|
|
88
|
+
connectDistance = element.connectDistance as any;
|
|
89
|
+
}
|
|
90
|
+
if (hoverEffect !== element.hoverEffect) {
|
|
91
|
+
hoverEffect = element.hoverEffect as any;
|
|
92
|
+
}
|
|
93
|
+
if (interactiveRadius !== element.interactiveRadius) {
|
|
94
|
+
interactiveRadius = element.interactiveRadius as any;
|
|
95
|
+
}
|
|
96
|
+
if (_resize !== element._resize) {
|
|
97
|
+
_resize = element._resize as any;
|
|
98
|
+
}
|
|
99
|
+
if (_loop !== element._loop) {
|
|
100
|
+
_loop = element._loop as any;
|
|
101
|
+
}
|
|
102
|
+
if (locale !== element.locale) {
|
|
103
|
+
locale = element.locale as any;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const events = ['change', 'input'];
|
|
108
|
+
for (const event of events) {
|
|
109
|
+
element.addEventListener(event, handleEvent);
|
|
110
|
+
}
|
|
111
|
+
return () => {
|
|
112
|
+
for (const event of events) {
|
|
113
|
+
element.removeEventListener(event, handleEvent);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
|
|
63
118
|
</script>
|
|
64
119
|
|
|
65
|
-
<uibit-particles bind:this={elementRef} {
|
|
120
|
+
<uibit-particles bind:this={elementRef} {...restProps}>
|
|
66
121
|
|
|
67
122
|
{#if children}
|
|
68
123
|
{@render children()}
|
|
@@ -1,31 +1,177 @@
|
|
|
1
|
-
import { defineComponent, h } from 'vue';
|
|
1
|
+
import { defineComponent, h, ref, watch } from 'vue';
|
|
2
2
|
import type { Particles as HTMLElementClass } from '@uibit/particles';
|
|
3
3
|
import '@uibit/particles';
|
|
4
4
|
import type { Particle, ParticleHoverEffect, ParticleMode } from '@uibit/particles';
|
|
5
|
-
|
|
6
5
|
export const Particles = defineComponent({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
6
|
+
name: 'Particles',
|
|
7
|
+
props: {
|
|
8
|
+
count: {
|
|
9
|
+
type: [
|
|
10
|
+
String,
|
|
11
|
+
Number,
|
|
12
|
+
Boolean,
|
|
13
|
+
Array,
|
|
14
|
+
Object
|
|
15
|
+
] as any
|
|
16
|
+
},
|
|
17
|
+
speed: {
|
|
18
|
+
type: [
|
|
19
|
+
String,
|
|
20
|
+
Number,
|
|
21
|
+
Boolean,
|
|
22
|
+
Array,
|
|
23
|
+
Object
|
|
24
|
+
] as any
|
|
25
|
+
},
|
|
26
|
+
mode: {
|
|
27
|
+
type: [
|
|
28
|
+
String,
|
|
29
|
+
Number,
|
|
30
|
+
Boolean,
|
|
31
|
+
Array,
|
|
32
|
+
Object
|
|
33
|
+
] as any
|
|
34
|
+
},
|
|
35
|
+
connect: {
|
|
36
|
+
type: [
|
|
37
|
+
String,
|
|
38
|
+
Number,
|
|
39
|
+
Boolean,
|
|
40
|
+
Array,
|
|
41
|
+
Object
|
|
42
|
+
] as any
|
|
43
|
+
},
|
|
44
|
+
connectDistance: {
|
|
45
|
+
type: [
|
|
46
|
+
String,
|
|
47
|
+
Number,
|
|
48
|
+
Boolean,
|
|
49
|
+
Array,
|
|
50
|
+
Object
|
|
51
|
+
] as any
|
|
52
|
+
},
|
|
53
|
+
hoverEffect: {
|
|
54
|
+
type: [
|
|
55
|
+
String,
|
|
56
|
+
Number,
|
|
57
|
+
Boolean,
|
|
58
|
+
Array,
|
|
59
|
+
Object
|
|
60
|
+
] as any
|
|
61
|
+
},
|
|
62
|
+
interactiveRadius: {
|
|
63
|
+
type: [
|
|
64
|
+
String,
|
|
65
|
+
Number,
|
|
66
|
+
Boolean,
|
|
67
|
+
Array,
|
|
68
|
+
Object
|
|
69
|
+
] as any
|
|
70
|
+
},
|
|
71
|
+
_resize: {
|
|
72
|
+
type: [
|
|
73
|
+
String,
|
|
74
|
+
Number,
|
|
75
|
+
Boolean,
|
|
76
|
+
Array,
|
|
77
|
+
Object
|
|
78
|
+
] as any
|
|
79
|
+
},
|
|
80
|
+
_loop: {
|
|
81
|
+
type: [
|
|
82
|
+
String,
|
|
83
|
+
Number,
|
|
84
|
+
Boolean,
|
|
85
|
+
Array,
|
|
86
|
+
Object
|
|
87
|
+
] as any
|
|
88
|
+
},
|
|
89
|
+
locale: {
|
|
90
|
+
type: [
|
|
91
|
+
String,
|
|
92
|
+
Number,
|
|
93
|
+
Boolean,
|
|
94
|
+
Array,
|
|
95
|
+
Object
|
|
96
|
+
] as any
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
emits: [],
|
|
100
|
+
setup (props, { slots, emit }) {
|
|
101
|
+
const elementRef = ref<HTMLElementClass | null>(null);
|
|
102
|
+
if (false) {
|
|
103
|
+
watch(()=>props.modelValue, (newVal)=>{
|
|
104
|
+
if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
|
|
105
|
+
elementRef.value.value = newVal;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
watch(()=>props.value, (newVal)=>{
|
|
109
|
+
if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
|
|
110
|
+
elementRef.value.value = newVal;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
watch(()=>props.count, (newVal)=>{
|
|
115
|
+
if (elementRef.value && newVal !== undefined) {
|
|
116
|
+
(elementRef.value as any).count = newVal;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
watch(()=>props.speed, (newVal)=>{
|
|
120
|
+
if (elementRef.value && newVal !== undefined) {
|
|
121
|
+
(elementRef.value as any).speed = newVal;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
watch(()=>props.mode, (newVal)=>{
|
|
125
|
+
if (elementRef.value && newVal !== undefined) {
|
|
126
|
+
(elementRef.value as any).mode = newVal;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
watch(()=>props.connect, (newVal)=>{
|
|
130
|
+
if (elementRef.value && newVal !== undefined) {
|
|
131
|
+
(elementRef.value as any).connect = newVal;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
watch(()=>props.connectDistance, (newVal)=>{
|
|
135
|
+
if (elementRef.value && newVal !== undefined) {
|
|
136
|
+
(elementRef.value as any).connectDistance = newVal;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
watch(()=>props.hoverEffect, (newVal)=>{
|
|
140
|
+
if (elementRef.value && newVal !== undefined) {
|
|
141
|
+
(elementRef.value as any).hoverEffect = newVal;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
watch(()=>props.interactiveRadius, (newVal)=>{
|
|
145
|
+
if (elementRef.value && newVal !== undefined) {
|
|
146
|
+
(elementRef.value as any).interactiveRadius = newVal;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
watch(()=>props._resize, (newVal)=>{
|
|
150
|
+
if (elementRef.value && newVal !== undefined) {
|
|
151
|
+
(elementRef.value as any)._resize = newVal;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
watch(()=>props._loop, (newVal)=>{
|
|
155
|
+
if (elementRef.value && newVal !== undefined) {
|
|
156
|
+
(elementRef.value as any)._loop = newVal;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
watch(()=>props.locale, (newVal)=>{
|
|
160
|
+
if (elementRef.value && newVal !== undefined) {
|
|
161
|
+
(elementRef.value as any).locale = newVal;
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
return ()=>{
|
|
165
|
+
const eventListeners: Record<string, any> = {};
|
|
166
|
+
const mergedProps = {
|
|
167
|
+
...props,
|
|
168
|
+
...eventListeners,
|
|
169
|
+
ref: elementRef
|
|
170
|
+
};
|
|
171
|
+
if (false && props.modelValue !== undefined) {
|
|
172
|
+
(mergedProps as any).value = props.modelValue;
|
|
173
|
+
}
|
|
174
|
+
return h('uibit-particles', mergedProps, slots.default?.());
|
|
175
|
+
};
|
|
176
|
+
}
|
|
31
177
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default, Particles } from './particles';
|
|
2
|
-
export type { Particle, ParticleHoverEffect, EffectParticlesConfig } from './types';
|
|
2
|
+
export type { Particle, ParticleHoverEffect, ParticleMode, EffectParticlesConfig } from './types';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACjD,YAAY,EAAE,QAAQ,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACjD,YAAY,EAAE,QAAQ,EAAE,mBAAmB,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/particles.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { UIBitElement, ResizeController, LoopController } from '@uibit/core';
|
|
|
2
2
|
import type { ParticleHoverEffect, ParticleMode } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* An interactive canvas effect element. Creates dynamic background visuals
|
|
5
|
+
|
|
6
|
+
* @summary A lightweight canvas-based interactive particle background effect.
|
|
5
7
|
* across many modes: particles, abstract art, grids, flow fields, and more.
|
|
6
8
|
*
|
|
7
9
|
* @cssprop [--uibit-particles-color=#6b7280] - Space or comma-separated list of colors
|
|
@@ -9,7 +11,8 @@ import type { ParticleHoverEffect, ParticleMode } from './types';
|
|
|
9
11
|
* @cssprop [--uibit-particles-opacity=1] - Opacity of the canvas overlay
|
|
10
12
|
* @cssprop [--uibit-particles-min-size=0.0625rem] - Minimum particle size
|
|
11
13
|
* @cssprop [--uibit-particles-max-size=0.1875rem] - Maximum particle size
|
|
12
|
-
|
|
14
|
+
|
|
15
|
+
* @cssstate paused - Active when particle animations are suspended.*/
|
|
13
16
|
export declare class Particles extends UIBitElement {
|
|
14
17
|
static styles: import("lit").CSSResult;
|
|
15
18
|
/** Number of particles / elements in the field */
|
package/dist/particles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"particles.d.ts","sourceRoot":"","sources":["../src/particles.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG5F,OAAO,KAAK,EAAY,mBAAmB,EAAE,YAAY,EAAgB,MAAM,SAAS,CAAC;AAEzF
|
|
1
|
+
{"version":3,"file":"particles.d.ts","sourceRoot":"","sources":["../src/particles.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG5F,OAAO,KAAK,EAAY,mBAAmB,EAAE,YAAY,EAAgB,MAAM,SAAS,CAAC;AAEzF;;;;;;;;;;;;sEAYsE;AACtE,qBACa,SAAU,SAAQ,YAAY;IACzC,MAAM,CAAC,MAAM,0BAAU;IAEvB,kDAAkD;IACtB,KAAK,SAAM;IAEvC,uBAAuB;IACK,KAAK,SAAK;IAEtC;;;;OAIG;IACyB,IAAI,EAAE,YAAY,CAAW;IAEzD,wDAAwD;IAC3B,OAAO,UAAS;IAE7C,wCAAwC;IACmB,eAAe,SAAO;IAEjF,+DAA+D;IACR,WAAW,EAAE,mBAAmB,CAAW;IAElG,iDAAiD;IACY,iBAAiB,SAAO;IAEpE,OAAO,CAAC,OAAO,CAAqB;IAErD,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,MAAM,CAAgE;IAC9E,OAAO,CAAC,IAAI,CAAyC;IACrD,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,KAAK,CAAK;IAElB,SAAS,CAAC,OAAO,mBAKd;IAEH,SAAS,CAAC,KAAK,iBAGZ;IAEH,YAAY,SAOX;IAED,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,QAKnD;IAED,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,cAAc;IAkJtB,OAAO,CAAC,cAAc;IA4WtB,MAAM,oCASL;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,SAAS,CAAC;KAC9B;CACF;eAEc,SAAS"}
|
package/dist/particles.js
CHANGED
|
@@ -10,6 +10,8 @@ import { property, query } from 'lit/decorators.js';
|
|
|
10
10
|
import { styles } from './styles';
|
|
11
11
|
/**
|
|
12
12
|
* An interactive canvas effect element. Creates dynamic background visuals
|
|
13
|
+
|
|
14
|
+
* @summary A lightweight canvas-based interactive particle background effect.
|
|
13
15
|
* across many modes: particles, abstract art, grids, flow fields, and more.
|
|
14
16
|
*
|
|
15
17
|
* @cssprop [--uibit-particles-color=#6b7280] - Space or comma-separated list of colors
|
|
@@ -17,7 +19,8 @@ import { styles } from './styles';
|
|
|
17
19
|
* @cssprop [--uibit-particles-opacity=1] - Opacity of the canvas overlay
|
|
18
20
|
* @cssprop [--uibit-particles-min-size=0.0625rem] - Minimum particle size
|
|
19
21
|
* @cssprop [--uibit-particles-max-size=0.1875rem] - Maximum particle size
|
|
20
|
-
|
|
22
|
+
|
|
23
|
+
* @cssstate paused - Active when particle animations are suspended.*/
|
|
21
24
|
let Particles = class Particles extends UIBitElement {
|
|
22
25
|
constructor() {
|
|
23
26
|
super(...arguments);
|