@uibit/particles 0.1.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/LICENSE +21 -0
- package/README.md +25 -0
- package/custom-elements.json +447 -0
- package/dist/frameworks/angular/index.ts +70 -0
- package/dist/frameworks/astro/index.d.ts +10 -0
- package/dist/frameworks/nuxt/index.ts +7 -0
- package/dist/frameworks/preact/index.d.ts +22 -0
- package/dist/frameworks/qwik/index.tsx +10 -0
- package/dist/frameworks/react/index.d.ts +26 -0
- package/dist/frameworks/solid/index.d.ts +23 -0
- package/dist/frameworks/stencil/index.d.ts +21 -0
- package/dist/frameworks/svelte/index.svelte +72 -0
- package/dist/frameworks/vue/index.ts +31 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/particles.d.ts +60 -0
- package/dist/particles.d.ts.map +1 -0
- package/dist/particles.js +687 -0
- package/dist/particles.js.map +1 -0
- package/dist/styles.d.ts +2 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +40 -0
- package/dist/styles.js.map +1 -0
- package/dist/types.d.ts +41 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +92 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 UIBit Contributors
|
|
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,25 @@
|
|
|
1
|
+
# Particles
|
|
2
|
+
|
|
3
|
+
[Interactive Demonstration](https://rawlings.github.io/uibit/components/particles)
|
|
4
|
+
|
|
5
|
+
Particles provides an interactive canvas-based animation element. It renders dynamic background visuals across multiple presets—including floating nodes, snowfall, rainfall, matrix streams, vortexes, and connection grids—and supports interactive mouse proximity effects.
|
|
6
|
+
|
|
7
|
+
## Value Delivery
|
|
8
|
+
|
|
9
|
+
- **Immersive Backgrounds** – Adds visual depth and sophisticated atmosphere to hero sections, landers, or empty states.
|
|
10
|
+
- **Micro-Interactions** – Responsive to mouse hover with options to attract, repel, or grab elements, increasing user engagement.
|
|
11
|
+
- **Resource Efficient** – Utilizes requestAnimationFrame loop and high-performance HTML5 Canvas APIs to maintain clean rendering performance and steady frame rates.
|
|
12
|
+
|
|
13
|
+
## Ideal Applications
|
|
14
|
+
|
|
15
|
+
- **Hero & Landing Pages** – Premium background textures that sit beneath text titles and call-to-actions.
|
|
16
|
+
- **Loading & State Screens** – Keeps the user engaged during asynchronous operations or application setups.
|
|
17
|
+
- **Exhibits & Interactive Portfolios** – Creative visual backdrops that react to client interaction.
|
|
18
|
+
|
|
19
|
+
## Further Information
|
|
20
|
+
|
|
21
|
+
Detailed design guidelines, customizable attributes, and integration examples are available on our documentation site.
|
|
22
|
+
|
|
23
|
+
## Changelog
|
|
24
|
+
|
|
25
|
+
Please see the [Changelog](CHANGELOG.md) for version history.
|
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "src/index.ts",
|
|
8
|
+
"declarations": [],
|
|
9
|
+
"exports": [
|
|
10
|
+
{
|
|
11
|
+
"kind": "js",
|
|
12
|
+
"name": "default",
|
|
13
|
+
"declaration": {
|
|
14
|
+
"name": "default",
|
|
15
|
+
"module": "./particles"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"kind": "js",
|
|
20
|
+
"name": "Particles",
|
|
21
|
+
"declaration": {
|
|
22
|
+
"name": "Particles",
|
|
23
|
+
"module": "./particles"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"kind": "js",
|
|
28
|
+
"name": "Particle",
|
|
29
|
+
"declaration": {
|
|
30
|
+
"name": "Particle",
|
|
31
|
+
"module": "./types"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"kind": "js",
|
|
36
|
+
"name": "ParticleHoverEffect",
|
|
37
|
+
"declaration": {
|
|
38
|
+
"name": "ParticleHoverEffect",
|
|
39
|
+
"module": "./types"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"kind": "js",
|
|
44
|
+
"name": "EffectParticlesConfig",
|
|
45
|
+
"declaration": {
|
|
46
|
+
"name": "EffectParticlesConfig",
|
|
47
|
+
"module": "./types"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"kind": "javascript-module",
|
|
54
|
+
"path": "src/particles.ts",
|
|
55
|
+
"declarations": [
|
|
56
|
+
{
|
|
57
|
+
"kind": "class",
|
|
58
|
+
"description": "An interactive canvas effect element. Creates dynamic background visuals\nacross many modes: particles, abstract art, grids, flow fields, and more.",
|
|
59
|
+
"name": "Particles",
|
|
60
|
+
"cssProperties": [
|
|
61
|
+
{
|
|
62
|
+
"description": "Space or comma-separated list of colors",
|
|
63
|
+
"name": "--uibit-particles-color",
|
|
64
|
+
"default": "#6b7280"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"description": "Color of connecting lines",
|
|
68
|
+
"name": "--uibit-particles-line-color",
|
|
69
|
+
"default": "#e5e7eb"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"description": "Opacity of the canvas overlay",
|
|
73
|
+
"name": "--uibit-particles-opacity",
|
|
74
|
+
"default": "1"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"description": "Minimum particle size",
|
|
78
|
+
"name": "--uibit-particles-min-size",
|
|
79
|
+
"default": "0.0625rem"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"description": "Maximum particle size",
|
|
83
|
+
"name": "--uibit-particles-max-size",
|
|
84
|
+
"default": "0.1875rem"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"members": [
|
|
88
|
+
{
|
|
89
|
+
"kind": "field",
|
|
90
|
+
"name": "count",
|
|
91
|
+
"type": {
|
|
92
|
+
"text": "number"
|
|
93
|
+
},
|
|
94
|
+
"default": "50",
|
|
95
|
+
"description": "Number of particles / elements in the field",
|
|
96
|
+
"attribute": "count"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"kind": "field",
|
|
100
|
+
"name": "speed",
|
|
101
|
+
"type": {
|
|
102
|
+
"text": "number"
|
|
103
|
+
},
|
|
104
|
+
"default": "1",
|
|
105
|
+
"description": "Speed multiplier",
|
|
106
|
+
"attribute": "speed"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"kind": "field",
|
|
110
|
+
"name": "mode",
|
|
111
|
+
"type": {
|
|
112
|
+
"text": "ParticleMode"
|
|
113
|
+
},
|
|
114
|
+
"default": "'float'",
|
|
115
|
+
"description": "Animation mode.\n'float' | 'snow' | 'rain' | 'neural' | 'matrix' |\n'wave' | 'vortex' | 'smoke' | 'bubbles' | 'grid' | 'aurora' | 'noise' | 'rings'",
|
|
116
|
+
"attribute": "mode"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"kind": "field",
|
|
120
|
+
"name": "connect",
|
|
121
|
+
"type": {
|
|
122
|
+
"text": "boolean"
|
|
123
|
+
},
|
|
124
|
+
"default": "false",
|
|
125
|
+
"description": "Draw constellation lines between nearby particles",
|
|
126
|
+
"attribute": "connect"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"kind": "field",
|
|
130
|
+
"name": "connectDistance",
|
|
131
|
+
"type": {
|
|
132
|
+
"text": "number"
|
|
133
|
+
},
|
|
134
|
+
"default": "100",
|
|
135
|
+
"description": "Max distance for connecting lines",
|
|
136
|
+
"attribute": "connect-distance"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"kind": "field",
|
|
140
|
+
"name": "hoverEffect",
|
|
141
|
+
"type": {
|
|
142
|
+
"text": "ParticleHoverEffect"
|
|
143
|
+
},
|
|
144
|
+
"default": "'repel'",
|
|
145
|
+
"description": "Hover interaction: 'repel' | 'attract' | 'grab' | 'none'",
|
|
146
|
+
"attribute": "hover-effect"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"kind": "field",
|
|
150
|
+
"name": "interactiveRadius",
|
|
151
|
+
"type": {
|
|
152
|
+
"text": "number"
|
|
153
|
+
},
|
|
154
|
+
"default": "100",
|
|
155
|
+
"description": "Radius of the mouse hover interaction zone",
|
|
156
|
+
"attribute": "interactive-radius"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"kind": "field",
|
|
160
|
+
"name": "_canvas",
|
|
161
|
+
"type": {
|
|
162
|
+
"text": "HTMLCanvasElement"
|
|
163
|
+
},
|
|
164
|
+
"privacy": "private"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"kind": "field",
|
|
168
|
+
"name": "_particles",
|
|
169
|
+
"type": {
|
|
170
|
+
"text": "Particle[]"
|
|
171
|
+
},
|
|
172
|
+
"privacy": "private",
|
|
173
|
+
"default": "[]"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"kind": "field",
|
|
177
|
+
"name": "_pulses",
|
|
178
|
+
"type": {
|
|
179
|
+
"text": "NetworkPulse[]"
|
|
180
|
+
},
|
|
181
|
+
"privacy": "private",
|
|
182
|
+
"default": "[]"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"kind": "field",
|
|
186
|
+
"name": "_mouse",
|
|
187
|
+
"type": {
|
|
188
|
+
"text": "{ x: number | null; y: number | null }"
|
|
189
|
+
},
|
|
190
|
+
"privacy": "private",
|
|
191
|
+
"default": "{ x: null, y: null }"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"kind": "field",
|
|
195
|
+
"name": "_ctx",
|
|
196
|
+
"type": {
|
|
197
|
+
"text": "CanvasRenderingContext2D | null"
|
|
198
|
+
},
|
|
199
|
+
"privacy": "private",
|
|
200
|
+
"default": "null"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"kind": "field",
|
|
204
|
+
"name": "_lineColor",
|
|
205
|
+
"type": {
|
|
206
|
+
"text": "string"
|
|
207
|
+
},
|
|
208
|
+
"privacy": "private",
|
|
209
|
+
"default": "'#e5e7eb'"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"kind": "field",
|
|
213
|
+
"name": "_colorCheckTick",
|
|
214
|
+
"type": {
|
|
215
|
+
"text": "number"
|
|
216
|
+
},
|
|
217
|
+
"privacy": "private",
|
|
218
|
+
"default": "0"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"kind": "field",
|
|
222
|
+
"name": "_matrixChars",
|
|
223
|
+
"type": {
|
|
224
|
+
"text": "string[]"
|
|
225
|
+
},
|
|
226
|
+
"privacy": "private",
|
|
227
|
+
"default": "[]"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"kind": "field",
|
|
231
|
+
"name": "_time",
|
|
232
|
+
"type": {
|
|
233
|
+
"text": "number"
|
|
234
|
+
},
|
|
235
|
+
"privacy": "private",
|
|
236
|
+
"default": "0"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"kind": "field",
|
|
240
|
+
"name": "_resize",
|
|
241
|
+
"privacy": "protected",
|
|
242
|
+
"default": "new ResizeController(this, { callback: (entry) => { const { width, height } = entry.contentRect; this._resizeCanvas(width, height); } })"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"kind": "field",
|
|
246
|
+
"name": "_loop",
|
|
247
|
+
"privacy": "protected",
|
|
248
|
+
"default": "new LoopController(this, { autoStart: false, callback: () => this._updateAndDraw() })"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"kind": "method",
|
|
252
|
+
"name": "_resizeCanvas",
|
|
253
|
+
"privacy": "private",
|
|
254
|
+
"parameters": [
|
|
255
|
+
{
|
|
256
|
+
"name": "width",
|
|
257
|
+
"type": {
|
|
258
|
+
"text": "number"
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"name": "height",
|
|
263
|
+
"type": {
|
|
264
|
+
"text": "number"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
]
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"kind": "method",
|
|
271
|
+
"name": "_setupMouseListeners",
|
|
272
|
+
"privacy": "private"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"kind": "method",
|
|
276
|
+
"name": "_parseColors",
|
|
277
|
+
"privacy": "private",
|
|
278
|
+
"return": {
|
|
279
|
+
"type": {
|
|
280
|
+
"text": "string[]"
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"kind": "method",
|
|
286
|
+
"name": "_parseSize",
|
|
287
|
+
"privacy": "private",
|
|
288
|
+
"return": {
|
|
289
|
+
"type": {
|
|
290
|
+
"text": "number"
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"parameters": [
|
|
294
|
+
{
|
|
295
|
+
"name": "prop",
|
|
296
|
+
"type": {
|
|
297
|
+
"text": "string"
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"name": "defaultValue",
|
|
302
|
+
"type": {
|
|
303
|
+
"text": "number"
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
]
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"kind": "method",
|
|
310
|
+
"name": "_initParticles",
|
|
311
|
+
"privacy": "private"
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"kind": "method",
|
|
315
|
+
"name": "_updateAndDraw",
|
|
316
|
+
"privacy": "private"
|
|
317
|
+
}
|
|
318
|
+
],
|
|
319
|
+
"attributes": [
|
|
320
|
+
{
|
|
321
|
+
"name": "count",
|
|
322
|
+
"type": {
|
|
323
|
+
"text": "number"
|
|
324
|
+
},
|
|
325
|
+
"default": "50",
|
|
326
|
+
"description": "Number of particles / elements in the field",
|
|
327
|
+
"fieldName": "count"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"name": "speed",
|
|
331
|
+
"type": {
|
|
332
|
+
"text": "number"
|
|
333
|
+
},
|
|
334
|
+
"default": "1",
|
|
335
|
+
"description": "Speed multiplier",
|
|
336
|
+
"fieldName": "speed"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"name": "mode",
|
|
340
|
+
"type": {
|
|
341
|
+
"text": "ParticleMode"
|
|
342
|
+
},
|
|
343
|
+
"default": "'float'",
|
|
344
|
+
"description": "Animation mode.\n'float' | 'snow' | 'rain' | 'neural' | 'matrix' |\n'wave' | 'vortex' | 'smoke' | 'bubbles' | 'grid' | 'aurora' | 'noise' | 'rings'",
|
|
345
|
+
"fieldName": "mode"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"name": "connect",
|
|
349
|
+
"type": {
|
|
350
|
+
"text": "boolean"
|
|
351
|
+
},
|
|
352
|
+
"default": "false",
|
|
353
|
+
"description": "Draw constellation lines between nearby particles",
|
|
354
|
+
"fieldName": "connect"
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"name": "connect-distance",
|
|
358
|
+
"type": {
|
|
359
|
+
"text": "number"
|
|
360
|
+
},
|
|
361
|
+
"default": "100",
|
|
362
|
+
"description": "Max distance for connecting lines",
|
|
363
|
+
"fieldName": "connectDistance"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"name": "hover-effect",
|
|
367
|
+
"type": {
|
|
368
|
+
"text": "ParticleHoverEffect"
|
|
369
|
+
},
|
|
370
|
+
"default": "'repel'",
|
|
371
|
+
"description": "Hover interaction: 'repel' | 'attract' | 'grab' | 'none'",
|
|
372
|
+
"fieldName": "hoverEffect"
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
"name": "interactive-radius",
|
|
376
|
+
"type": {
|
|
377
|
+
"text": "number"
|
|
378
|
+
},
|
|
379
|
+
"default": "100",
|
|
380
|
+
"description": "Radius of the mouse hover interaction zone",
|
|
381
|
+
"fieldName": "interactiveRadius"
|
|
382
|
+
}
|
|
383
|
+
],
|
|
384
|
+
"superclass": {
|
|
385
|
+
"name": "UIBitElement",
|
|
386
|
+
"package": "@uibit/core"
|
|
387
|
+
},
|
|
388
|
+
"tagName": "uibit-particles",
|
|
389
|
+
"customElement": true
|
|
390
|
+
}
|
|
391
|
+
],
|
|
392
|
+
"exports": [
|
|
393
|
+
{
|
|
394
|
+
"kind": "js",
|
|
395
|
+
"name": "Particles",
|
|
396
|
+
"declaration": {
|
|
397
|
+
"name": "Particles",
|
|
398
|
+
"module": "src/particles.ts"
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
"kind": "custom-element-definition",
|
|
403
|
+
"name": "uibit-particles",
|
|
404
|
+
"declaration": {
|
|
405
|
+
"name": "Particles",
|
|
406
|
+
"module": "src/particles.ts"
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"kind": "js",
|
|
411
|
+
"name": "default",
|
|
412
|
+
"declaration": {
|
|
413
|
+
"name": "Particles",
|
|
414
|
+
"module": "src/particles.ts"
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
]
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
"kind": "javascript-module",
|
|
421
|
+
"path": "src/styles.ts",
|
|
422
|
+
"declarations": [
|
|
423
|
+
{
|
|
424
|
+
"kind": "variable",
|
|
425
|
+
"name": "styles",
|
|
426
|
+
"default": "css` :host { display: block; position: relative; width: 100%; height: 100%; min-height: 9.375rem; /* 150px equivalent */ overflow: hidden; /* Custom CSS variables for visual defaults */ --uibit-particles-color: #6b7280; --uibit-particles-line-color: #e5e7eb; --uibit-particles-opacity: 1; } .container { position: relative; width: 100%; height: 100%; } canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: block; opacity: var(--uibit-particles-opacity); pointer-events: none; /* Let clicks/hovers pass through to the slot content */ } .content { position: relative; z-index: 1; width: 100%; height: 100%; } `"
|
|
427
|
+
}
|
|
428
|
+
],
|
|
429
|
+
"exports": [
|
|
430
|
+
{
|
|
431
|
+
"kind": "js",
|
|
432
|
+
"name": "styles",
|
|
433
|
+
"declaration": {
|
|
434
|
+
"name": "styles",
|
|
435
|
+
"module": "src/styles.ts"
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
]
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
"kind": "javascript-module",
|
|
442
|
+
"path": "src/types.ts",
|
|
443
|
+
"declarations": [],
|
|
444
|
+
"exports": []
|
|
445
|
+
}
|
|
446
|
+
]
|
|
447
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, ElementRef, input, effect, booleanAttribute, numberAttribute } from '@angular/core';
|
|
2
|
+
import '@uibit/particles';
|
|
3
|
+
import type { Particles as HTMLElementClass } from '@uibit/particles';
|
|
4
|
+
import type { Particle, ParticleHoverEffect, ParticleMode } from '@uibit/particles';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'uibit-particles',
|
|
8
|
+
template: '<ng-content></ng-content>',
|
|
9
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10
|
+
standalone: true
|
|
11
|
+
})
|
|
12
|
+
export class NgxParticles {
|
|
13
|
+
constructor(private el: ElementRef<HTMLElementClass>) {
|
|
14
|
+
effect(() => {
|
|
15
|
+
if (this.el.nativeElement) {
|
|
16
|
+
this.el.nativeElement.count = this.count();
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
effect(() => {
|
|
20
|
+
if (this.el.nativeElement) {
|
|
21
|
+
this.el.nativeElement.speed = this.speed();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
effect(() => {
|
|
25
|
+
if (this.el.nativeElement) {
|
|
26
|
+
this.el.nativeElement.mode = this.mode();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
effect(() => {
|
|
30
|
+
if (this.el.nativeElement) {
|
|
31
|
+
this.el.nativeElement.connect = this.connect();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
effect(() => {
|
|
35
|
+
if (this.el.nativeElement) {
|
|
36
|
+
this.el.nativeElement.connectDistance = this.connectDistance();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
effect(() => {
|
|
40
|
+
if (this.el.nativeElement) {
|
|
41
|
+
this.el.nativeElement.hoverEffect = this.hoverEffect();
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
effect(() => {
|
|
45
|
+
if (this.el.nativeElement) {
|
|
46
|
+
this.el.nativeElement.interactiveRadius = this.interactiveRadius();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
effect(() => {
|
|
50
|
+
if (this.el.nativeElement) {
|
|
51
|
+
this.el.nativeElement._resize = this._resize();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
effect(() => {
|
|
55
|
+
if (this.el.nativeElement) {
|
|
56
|
+
this.el.nativeElement._loop = this._loop();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
readonly count = input<number, any>(50, { transform: numberAttribute });
|
|
62
|
+
readonly speed = input<number, any>(1, { transform: numberAttribute });
|
|
63
|
+
readonly mode = input<ParticleMode, any>('float');
|
|
64
|
+
readonly connect = input<boolean, any>(false, { transform: booleanAttribute });
|
|
65
|
+
readonly connectDistance = input<number, any>(100, { transform: numberAttribute });
|
|
66
|
+
readonly hoverEffect = input<ParticleHoverEffect, any>('repel');
|
|
67
|
+
readonly interactiveRadius = input<number, any>(100, { transform: numberAttribute });
|
|
68
|
+
readonly _resize = input<any, any>(new ResizeController(this, { callback: (entry) => { const { width, height } = entry.contentRect; this._resizeCanvas(width, height); } }));
|
|
69
|
+
readonly _loop = input<any, any>(new LoopController(this, { autoStart: false, callback: () => this._updateAndDraw() }));
|
|
70
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Particles as HTMLElementClass } from '@uibit/particles';
|
|
2
|
+
import '@uibit/particles';
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
namespace astroHTML.JSX {
|
|
6
|
+
interface IntrinsicElements {
|
|
7
|
+
'uibit-particles': Partial<HTMLElementClass> & astroHTML.JSX.HTMLAttributes;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { JSX } from 'preact';
|
|
2
|
+
import type { Particles as HTMLElementClass } from '@uibit/particles';
|
|
3
|
+
import '@uibit/particles';
|
|
4
|
+
import type { Particle, ParticleHoverEffect, ParticleMode } from '@uibit/particles';
|
|
5
|
+
|
|
6
|
+
declare module 'preact' {
|
|
7
|
+
namespace JSX {
|
|
8
|
+
interface IntrinsicElements {
|
|
9
|
+
'uibit-particles': JSX.HTMLAttributes<HTMLElementClass> & {
|
|
10
|
+
count?: number;
|
|
11
|
+
speed?: number;
|
|
12
|
+
mode?: ParticleMode;
|
|
13
|
+
connect?: boolean;
|
|
14
|
+
connectDistance?: number;
|
|
15
|
+
hoverEffect?: ParticleHoverEffect;
|
|
16
|
+
interactiveRadius?: number;
|
|
17
|
+
_resize?: any;
|
|
18
|
+
_loop?: any;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { HTMLAttributes, ClassAttributes } 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
|
+
|
|
6
|
+
declare global {
|
|
7
|
+
namespace React {
|
|
8
|
+
namespace JSX {
|
|
9
|
+
interface IntrinsicElements {
|
|
10
|
+
'uibit-particles': ClassAttributes<HTMLElementClass> & HTMLAttributes<HTMLElementClass> & {
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
class?: string;
|
|
13
|
+
count?: number;
|
|
14
|
+
speed?: number;
|
|
15
|
+
mode?: ParticleMode;
|
|
16
|
+
connect?: boolean;
|
|
17
|
+
connectDistance?: number;
|
|
18
|
+
hoverEffect?: ParticleHoverEffect;
|
|
19
|
+
interactiveRadius?: number;
|
|
20
|
+
_resize?: any;
|
|
21
|
+
_loop?: any;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { JSX } from 'solid-js';
|
|
2
|
+
import type { Particles as HTMLElementClass } from '@uibit/particles';
|
|
3
|
+
import '@uibit/particles';
|
|
4
|
+
import type { Particle, ParticleHoverEffect, ParticleMode } from '@uibit/particles';
|
|
5
|
+
|
|
6
|
+
declare module 'solid-js' {
|
|
7
|
+
namespace JSX {
|
|
8
|
+
interface IntrinsicElements {
|
|
9
|
+
'uibit-particles': Partial<HTMLElementClass> & JSX.HTMLAttributes<HTMLElementClass> & {
|
|
10
|
+
count?: number;
|
|
11
|
+
speed?: number;
|
|
12
|
+
mode?: ParticleMode;
|
|
13
|
+
connect?: boolean;
|
|
14
|
+
connectDistance?: number;
|
|
15
|
+
hoverEffect?: ParticleHoverEffect;
|
|
16
|
+
interactiveRadius?: number;
|
|
17
|
+
_resize?: any;
|
|
18
|
+
_loop?: any;
|
|
19
|
+
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|