@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
package/README.md
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
# Particles
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@uibit/particles)
|
|
4
|
+
|
|
5
|
+
|
|
3
6
|
[Interactive Demonstration](https://rawlings.github.io/uibit/components/particles)
|
|
4
7
|
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @uibit/particles
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
|
|
5
15
|
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
16
|
|
|
7
17
|
## Value Delivery
|
package/custom-elements.json
CHANGED
|
@@ -39,6 +39,14 @@
|
|
|
39
39
|
"module": "./types"
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
+
{
|
|
43
|
+
"kind": "js",
|
|
44
|
+
"name": "ParticleMode",
|
|
45
|
+
"declaration": {
|
|
46
|
+
"name": "ParticleMode",
|
|
47
|
+
"module": "./types"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
42
50
|
{
|
|
43
51
|
"kind": "js",
|
|
44
52
|
"name": "EffectParticlesConfig",
|
|
@@ -55,7 +63,7 @@
|
|
|
55
63
|
"declarations": [
|
|
56
64
|
{
|
|
57
65
|
"kind": "class",
|
|
58
|
-
"description": "An interactive canvas effect element. Creates dynamic background visuals
|
|
66
|
+
"description": "An interactive canvas effect element. Creates dynamic background visuals",
|
|
59
67
|
"name": "Particles",
|
|
60
68
|
"cssProperties": [
|
|
61
69
|
{
|
|
@@ -314,6 +322,211 @@
|
|
|
314
322
|
"kind": "method",
|
|
315
323
|
"name": "_updateAndDraw",
|
|
316
324
|
"privacy": "private"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"kind": "field",
|
|
328
|
+
"name": "locale",
|
|
329
|
+
"type": {
|
|
330
|
+
"text": "string"
|
|
331
|
+
},
|
|
332
|
+
"default": "''",
|
|
333
|
+
"description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
|
|
334
|
+
"attribute": "locale",
|
|
335
|
+
"inheritedFrom": {
|
|
336
|
+
"name": "UIBitElement",
|
|
337
|
+
"module": "../../platform/core/src/element.ts"
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"kind": "field",
|
|
342
|
+
"name": "resolvedLocale",
|
|
343
|
+
"type": {
|
|
344
|
+
"text": "string | undefined"
|
|
345
|
+
},
|
|
346
|
+
"description": "Resolves the active locale for formatting and localization.\nChecks the `locale` property first, then traverses up the DOM to find\nthe nearest ancestor with a `lang` attribute, and finally falls back\nto undefined (which defaults to browser locale).",
|
|
347
|
+
"readonly": true,
|
|
348
|
+
"inheritedFrom": {
|
|
349
|
+
"name": "UIBitElement",
|
|
350
|
+
"module": "../../platform/core/src/element.ts"
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
"kind": "field",
|
|
355
|
+
"name": "_disposables",
|
|
356
|
+
"type": {
|
|
357
|
+
"text": "Set<() => void>"
|
|
358
|
+
},
|
|
359
|
+
"privacy": "private",
|
|
360
|
+
"default": "new Set()",
|
|
361
|
+
"inheritedFrom": {
|
|
362
|
+
"name": "UIBitElement",
|
|
363
|
+
"module": "../../platform/core/src/element.ts"
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"kind": "method",
|
|
368
|
+
"name": "createProperty",
|
|
369
|
+
"static": true,
|
|
370
|
+
"parameters": [
|
|
371
|
+
{
|
|
372
|
+
"name": "name",
|
|
373
|
+
"type": {
|
|
374
|
+
"text": "PropertyKey"
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"name": "options",
|
|
379
|
+
"optional": true,
|
|
380
|
+
"type": {
|
|
381
|
+
"text": "PropertyDeclaration"
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
],
|
|
385
|
+
"description": "Overrides createProperty to automatically map camelCase property names\nto kebab-case attribute names by default.",
|
|
386
|
+
"inheritedFrom": {
|
|
387
|
+
"name": "UIBitElement",
|
|
388
|
+
"module": "../../platform/core/src/element.ts"
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"kind": "method",
|
|
393
|
+
"name": "finalizeStyles",
|
|
394
|
+
"static": true,
|
|
395
|
+
"return": {
|
|
396
|
+
"type": {
|
|
397
|
+
"text": "Array<any>"
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
"parameters": [
|
|
401
|
+
{
|
|
402
|
+
"name": "styles",
|
|
403
|
+
"optional": true,
|
|
404
|
+
"type": {
|
|
405
|
+
"text": "CSSResultGroup"
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
],
|
|
409
|
+
"description": "Automatically prepends basic layout resets (border-box) to the\ncomponent's final styles.",
|
|
410
|
+
"inheritedFrom": {
|
|
411
|
+
"name": "UIBitElement",
|
|
412
|
+
"module": "../../platform/core/src/element.ts"
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
"kind": "method",
|
|
417
|
+
"name": "dispatchCustomEvent",
|
|
418
|
+
"return": {
|
|
419
|
+
"type": {
|
|
420
|
+
"text": "boolean"
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
"parameters": [
|
|
424
|
+
{
|
|
425
|
+
"name": "name",
|
|
426
|
+
"type": {
|
|
427
|
+
"text": "string"
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"name": "detail",
|
|
432
|
+
"optional": true,
|
|
433
|
+
"type": {
|
|
434
|
+
"text": "T"
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
"name": "options",
|
|
439
|
+
"optional": true,
|
|
440
|
+
"type": {
|
|
441
|
+
"text": "Omit<CustomEventInit<T>, 'detail'>"
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
],
|
|
445
|
+
"description": "Helper to dispatch a custom event with standard bubbles and composed options.",
|
|
446
|
+
"inheritedFrom": {
|
|
447
|
+
"name": "UIBitElement",
|
|
448
|
+
"module": "../../platform/core/src/element.ts"
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
"kind": "method",
|
|
453
|
+
"name": "getCssPropertyValue",
|
|
454
|
+
"return": {
|
|
455
|
+
"type": {
|
|
456
|
+
"text": "string"
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
"parameters": [
|
|
460
|
+
{
|
|
461
|
+
"name": "propertyName",
|
|
462
|
+
"type": {
|
|
463
|
+
"text": "string"
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
],
|
|
467
|
+
"description": "Helper to retrieve a computed CSS custom property value from the element.",
|
|
468
|
+
"inheritedFrom": {
|
|
469
|
+
"name": "UIBitElement",
|
|
470
|
+
"module": "../../platform/core/src/element.ts"
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"kind": "method",
|
|
475
|
+
"name": "registerDisposable",
|
|
476
|
+
"parameters": [
|
|
477
|
+
{
|
|
478
|
+
"name": "cleanup",
|
|
479
|
+
"type": {
|
|
480
|
+
"text": "() => void"
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
],
|
|
484
|
+
"description": "Register a cleanup function to be executed when the element is disconnected from the DOM.",
|
|
485
|
+
"inheritedFrom": {
|
|
486
|
+
"name": "UIBitElement",
|
|
487
|
+
"module": "../../platform/core/src/element.ts"
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"kind": "method",
|
|
492
|
+
"name": "listen",
|
|
493
|
+
"return": {
|
|
494
|
+
"type": {
|
|
495
|
+
"text": "() => void"
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
"parameters": [
|
|
499
|
+
{
|
|
500
|
+
"name": "target",
|
|
501
|
+
"type": {
|
|
502
|
+
"text": "EventTarget"
|
|
503
|
+
}
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
"name": "type",
|
|
507
|
+
"type": {
|
|
508
|
+
"text": "K"
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
"name": "listener",
|
|
513
|
+
"type": {
|
|
514
|
+
"text": "(this: EventTarget, ev: HTMLElementEventMap[K]) => any"
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
"name": "options",
|
|
519
|
+
"optional": true,
|
|
520
|
+
"type": {
|
|
521
|
+
"text": "boolean | AddEventListenerOptions"
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
],
|
|
525
|
+
"description": "Utility to add an event listener that is automatically cleaned up when the element is disconnected.",
|
|
526
|
+
"inheritedFrom": {
|
|
527
|
+
"name": "UIBitElement",
|
|
528
|
+
"module": "../../platform/core/src/element.ts"
|
|
529
|
+
}
|
|
317
530
|
}
|
|
318
531
|
],
|
|
319
532
|
"attributes": [
|
|
@@ -379,12 +592,32 @@
|
|
|
379
592
|
"default": "100",
|
|
380
593
|
"description": "Radius of the mouse hover interaction zone",
|
|
381
594
|
"fieldName": "interactiveRadius"
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
"name": "locale",
|
|
598
|
+
"type": {
|
|
599
|
+
"text": "string"
|
|
600
|
+
},
|
|
601
|
+
"default": "''",
|
|
602
|
+
"description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
|
|
603
|
+
"fieldName": "locale",
|
|
604
|
+
"inheritedFrom": {
|
|
605
|
+
"name": "UIBitElement",
|
|
606
|
+
"module": "../../platform/core/src/element.ts"
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
],
|
|
610
|
+
"cssStates": [
|
|
611
|
+
{
|
|
612
|
+
"name": "paused",
|
|
613
|
+
"description": "Active when particle animations are suspended."
|
|
382
614
|
}
|
|
383
615
|
],
|
|
384
616
|
"superclass": {
|
|
385
617
|
"name": "UIBitElement",
|
|
386
618
|
"package": "@uibit/core"
|
|
387
619
|
},
|
|
620
|
+
"summary": "A lightweight canvas-based interactive particle background effect.\nacross many modes: particles, abstract art, grids, flow fields, and more.",
|
|
388
621
|
"tagName": "uibit-particles",
|
|
389
622
|
"customElement": true
|
|
390
623
|
}
|
|
@@ -442,6 +675,250 @@
|
|
|
442
675
|
"path": "src/types.ts",
|
|
443
676
|
"declarations": [],
|
|
444
677
|
"exports": []
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
"kind": "javascript-module",
|
|
681
|
+
"path": "../../platform/core/src/element.ts",
|
|
682
|
+
"declarations": [
|
|
683
|
+
{
|
|
684
|
+
"kind": "class",
|
|
685
|
+
"description": "A foundational base class for all UIBit web components.\nProvides custom event helpers, default kebab-case attribute mapping,\nautomatic cleanup/disposable tracking, and auto-injected reset styles.",
|
|
686
|
+
"name": "UIBitElement",
|
|
687
|
+
"members": [
|
|
688
|
+
{
|
|
689
|
+
"kind": "field",
|
|
690
|
+
"name": "locale",
|
|
691
|
+
"type": {
|
|
692
|
+
"text": "string"
|
|
693
|
+
},
|
|
694
|
+
"default": "''",
|
|
695
|
+
"description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
|
|
696
|
+
"attribute": "locale"
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
"kind": "field",
|
|
700
|
+
"name": "resolvedLocale",
|
|
701
|
+
"type": {
|
|
702
|
+
"text": "string | undefined"
|
|
703
|
+
},
|
|
704
|
+
"description": "Resolves the active locale for formatting and localization.\nChecks the `locale` property first, then traverses up the DOM to find\nthe nearest ancestor with a `lang` attribute, and finally falls back\nto undefined (which defaults to browser locale).",
|
|
705
|
+
"readonly": true
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
"kind": "field",
|
|
709
|
+
"name": "_disposables",
|
|
710
|
+
"type": {
|
|
711
|
+
"text": "Set<() => void>"
|
|
712
|
+
},
|
|
713
|
+
"privacy": "private",
|
|
714
|
+
"default": "new Set()"
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
"kind": "method",
|
|
718
|
+
"name": "createProperty",
|
|
719
|
+
"static": true,
|
|
720
|
+
"parameters": [
|
|
721
|
+
{
|
|
722
|
+
"name": "name",
|
|
723
|
+
"type": {
|
|
724
|
+
"text": "PropertyKey"
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
"name": "options",
|
|
729
|
+
"optional": true,
|
|
730
|
+
"type": {
|
|
731
|
+
"text": "PropertyDeclaration"
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
],
|
|
735
|
+
"description": "Overrides createProperty to automatically map camelCase property names\nto kebab-case attribute names by default."
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
"kind": "method",
|
|
739
|
+
"name": "finalizeStyles",
|
|
740
|
+
"static": true,
|
|
741
|
+
"return": {
|
|
742
|
+
"type": {
|
|
743
|
+
"text": "Array<any>"
|
|
744
|
+
}
|
|
745
|
+
},
|
|
746
|
+
"parameters": [
|
|
747
|
+
{
|
|
748
|
+
"name": "styles",
|
|
749
|
+
"optional": true,
|
|
750
|
+
"type": {
|
|
751
|
+
"text": "CSSResultGroup"
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
],
|
|
755
|
+
"description": "Automatically prepends basic layout resets (border-box) to the\ncomponent's final styles."
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
"kind": "method",
|
|
759
|
+
"name": "dispatchCustomEvent",
|
|
760
|
+
"return": {
|
|
761
|
+
"type": {
|
|
762
|
+
"text": "boolean"
|
|
763
|
+
}
|
|
764
|
+
},
|
|
765
|
+
"parameters": [
|
|
766
|
+
{
|
|
767
|
+
"name": "name",
|
|
768
|
+
"type": {
|
|
769
|
+
"text": "string"
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
"name": "detail",
|
|
774
|
+
"optional": true,
|
|
775
|
+
"type": {
|
|
776
|
+
"text": "T"
|
|
777
|
+
}
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
"name": "options",
|
|
781
|
+
"optional": true,
|
|
782
|
+
"type": {
|
|
783
|
+
"text": "Omit<CustomEventInit<T>, 'detail'>"
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
],
|
|
787
|
+
"description": "Helper to dispatch a custom event with standard bubbles and composed options."
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
"kind": "method",
|
|
791
|
+
"name": "getCssPropertyValue",
|
|
792
|
+
"return": {
|
|
793
|
+
"type": {
|
|
794
|
+
"text": "string"
|
|
795
|
+
}
|
|
796
|
+
},
|
|
797
|
+
"parameters": [
|
|
798
|
+
{
|
|
799
|
+
"name": "propertyName",
|
|
800
|
+
"type": {
|
|
801
|
+
"text": "string"
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
],
|
|
805
|
+
"description": "Helper to retrieve a computed CSS custom property value from the element."
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
"kind": "method",
|
|
809
|
+
"name": "registerDisposable",
|
|
810
|
+
"parameters": [
|
|
811
|
+
{
|
|
812
|
+
"name": "cleanup",
|
|
813
|
+
"type": {
|
|
814
|
+
"text": "() => void"
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
],
|
|
818
|
+
"description": "Register a cleanup function to be executed when the element is disconnected from the DOM."
|
|
819
|
+
},
|
|
820
|
+
{
|
|
821
|
+
"kind": "method",
|
|
822
|
+
"name": "listen",
|
|
823
|
+
"return": {
|
|
824
|
+
"type": {
|
|
825
|
+
"text": "() => void"
|
|
826
|
+
}
|
|
827
|
+
},
|
|
828
|
+
"parameters": [
|
|
829
|
+
{
|
|
830
|
+
"name": "target",
|
|
831
|
+
"type": {
|
|
832
|
+
"text": "EventTarget"
|
|
833
|
+
}
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
"name": "type",
|
|
837
|
+
"type": {
|
|
838
|
+
"text": "K"
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
"name": "listener",
|
|
843
|
+
"type": {
|
|
844
|
+
"text": "(this: EventTarget, ev: HTMLElementEventMap[K]) => any"
|
|
845
|
+
}
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
"name": "options",
|
|
849
|
+
"optional": true,
|
|
850
|
+
"type": {
|
|
851
|
+
"text": "boolean | AddEventListenerOptions"
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
],
|
|
855
|
+
"description": "Utility to add an event listener that is automatically cleaned up when the element is disconnected."
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
"kind": "method",
|
|
859
|
+
"name": "listen",
|
|
860
|
+
"return": {
|
|
861
|
+
"type": {
|
|
862
|
+
"text": "() => void"
|
|
863
|
+
}
|
|
864
|
+
},
|
|
865
|
+
"parameters": [
|
|
866
|
+
{
|
|
867
|
+
"name": "target",
|
|
868
|
+
"type": {
|
|
869
|
+
"text": "EventTarget"
|
|
870
|
+
}
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
"name": "type",
|
|
874
|
+
"type": {
|
|
875
|
+
"text": "string"
|
|
876
|
+
}
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
"name": "listener",
|
|
880
|
+
"type": {
|
|
881
|
+
"text": "EventListenerOrEventListenerObject"
|
|
882
|
+
}
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
"name": "options",
|
|
886
|
+
"optional": true,
|
|
887
|
+
"type": {
|
|
888
|
+
"text": "boolean | AddEventListenerOptions"
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
]
|
|
892
|
+
}
|
|
893
|
+
],
|
|
894
|
+
"attributes": [
|
|
895
|
+
{
|
|
896
|
+
"name": "locale",
|
|
897
|
+
"type": {
|
|
898
|
+
"text": "string"
|
|
899
|
+
},
|
|
900
|
+
"default": "''",
|
|
901
|
+
"description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
|
|
902
|
+
"fieldName": "locale"
|
|
903
|
+
}
|
|
904
|
+
],
|
|
905
|
+
"superclass": {
|
|
906
|
+
"name": "LitElement",
|
|
907
|
+
"package": "lit"
|
|
908
|
+
},
|
|
909
|
+
"customElement": true
|
|
910
|
+
}
|
|
911
|
+
],
|
|
912
|
+
"exports": [
|
|
913
|
+
{
|
|
914
|
+
"kind": "js",
|
|
915
|
+
"name": "UIBitElement",
|
|
916
|
+
"declaration": {
|
|
917
|
+
"name": "UIBitElement",
|
|
918
|
+
"module": "../../platform/core/src/element.ts"
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
]
|
|
445
922
|
}
|
|
446
923
|
]
|
|
447
924
|
}
|
|
@@ -2,69 +2,91 @@ import { Component, ChangeDetectionStrategy, ElementRef, input, effect, booleanA
|
|
|
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
5
|
@Component({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
selector: 'uibit-particles',
|
|
7
|
+
template: '<ng-content></ng-content>',
|
|
8
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
9
|
+
standalone: true
|
|
11
10
|
})
|
|
12
11
|
export class NgxParticles {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
constructor(private el: ElementRef<HTMLElementClass>){
|
|
13
|
+
effect(()=>{
|
|
14
|
+
if (this.el.nativeElement) {
|
|
15
|
+
this.el.nativeElement.count = this.count();
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
effect(()=>{
|
|
19
|
+
if (this.el.nativeElement) {
|
|
20
|
+
this.el.nativeElement.speed = this.speed();
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
effect(()=>{
|
|
24
|
+
if (this.el.nativeElement) {
|
|
25
|
+
this.el.nativeElement.mode = this.mode();
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
effect(()=>{
|
|
29
|
+
if (this.el.nativeElement) {
|
|
30
|
+
this.el.nativeElement.connect = this.connect();
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
effect(()=>{
|
|
34
|
+
if (this.el.nativeElement) {
|
|
35
|
+
this.el.nativeElement.connectDistance = this.connectDistance();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
effect(()=>{
|
|
39
|
+
if (this.el.nativeElement) {
|
|
40
|
+
this.el.nativeElement.hoverEffect = this.hoverEffect();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
effect(()=>{
|
|
44
|
+
if (this.el.nativeElement) {
|
|
45
|
+
this.el.nativeElement.interactiveRadius = this.interactiveRadius();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
effect(()=>{
|
|
49
|
+
if (this.el.nativeElement) {
|
|
50
|
+
this.el.nativeElement._resize = this._resize();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
effect(()=>{
|
|
54
|
+
if (this.el.nativeElement) {
|
|
55
|
+
this.el.nativeElement._loop = this._loop();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
effect(()=>{
|
|
59
|
+
if (this.el.nativeElement) {
|
|
60
|
+
this.el.nativeElement.locale = this.locale();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
readonly count = input<number, any>(50, {
|
|
65
|
+
transform: numberAttribute
|
|
18
66
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.el.nativeElement.speed = this.speed();
|
|
22
|
-
}
|
|
67
|
+
readonly speed = input<number, any>(1, {
|
|
68
|
+
transform: numberAttribute
|
|
23
69
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
70
|
+
readonly mode = input<ParticleMode>('float');
|
|
71
|
+
readonly connect = input<boolean, any>(false, {
|
|
72
|
+
transform: booleanAttribute
|
|
28
73
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.el.nativeElement.connect = this.connect();
|
|
32
|
-
}
|
|
74
|
+
readonly connectDistance = input<number, any>(100, {
|
|
75
|
+
transform: numberAttribute
|
|
33
76
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
77
|
+
readonly hoverEffect = input<ParticleHoverEffect>('repel');
|
|
78
|
+
readonly interactiveRadius = input<number, any>(100, {
|
|
79
|
+
transform: numberAttribute
|
|
38
80
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
|
|
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() }));
|
|
81
|
+
readonly _resize = input<any>(new ResizeController(this, {
|
|
82
|
+
callback: (entry)=>{
|
|
83
|
+
const { width, height } = entry.contentRect;
|
|
84
|
+
this._resizeCanvas(width, height);
|
|
85
|
+
}
|
|
86
|
+
}));
|
|
87
|
+
readonly _loop = input<any>(new LoopController(this, {
|
|
88
|
+
autoStart: false,
|
|
89
|
+
callback: ()=>this._updateAndDraw()
|
|
90
|
+
}));
|
|
91
|
+
readonly locale = input<string>('');
|
|
70
92
|
}
|