@lluc_llull/ui-lib 0.12.4 → 0.14.1
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/fesm2022/lluc_llull-ui-lib-src-lib-effects.mjs +144 -0
- package/fesm2022/lluc_llull-ui-lib-src-lib-effects.mjs.map +1 -0
- package/fesm2022/lluc_llull-ui-lib-src-lib-sliders.mjs +53 -0
- package/fesm2022/lluc_llull-ui-lib-src-lib-sliders.mjs.map +1 -0
- package/fesm2022/lluc_llull-ui-lib.mjs +413 -348
- package/fesm2022/lluc_llull-ui-lib.mjs.map +1 -1
- package/lib/components/core/content/category-progress/category-progress.interface.d.ts +1 -1
- package/lib/components/core/content/hero-section/hero-section.interface.d.ts +1 -1
- package/lib/components/core/content/hero-section/hero-section.stories.d.ts +1 -1
- package/lib/components/core/content/index.d.ts +1 -1
- package/lib/components/core/footers/legal-footer/legal-footer.interface.d.ts +2 -2
- package/lib/components/core/footers/links-footer/links-footer.interface.d.ts +1 -1
- package/lib/components/core/footers/social-footer/social-footer.interface.d.ts +1 -1
- package/lib/components/core/footers/visual-footer/visual-footer.interface.d.ts +1 -1
- package/lib/components/core/headers/header-clear/header-clear.component.d.ts +6 -4
- package/lib/components/core/headers/header-clear/header-clear.interface.d.ts +1 -1
- package/lib/components/core/headers/header-mobile/header-mobile.component.d.ts +6 -4
- package/lib/components/core/headers/header-mobile/header-mobile.interface.d.ts +1 -1
- package/lib/components/core/index.d.ts +1 -1
- package/lib/components/core/modals/lang-modal/lang-modal.component.d.ts +2 -2
- package/lib/components/core/modals/nav-modal/nav-modal.interface.d.ts +1 -1
- package/lib/components/shared/ui-icon/ui-icon.component.d.ts +5 -1
- package/lib/directives/index.d.ts +0 -1
- package/lib/{components/effects → effects}/dynamic-background/effects/sphere-deform/sphere-deform.effect.d.ts +1 -1
- package/lib/interfaces/index.d.ts +1 -1
- package/lib/interfaces/page-config.interface.d.ts +1 -0
- package/lib/interfaces/ui-lib-button.interface.d.ts +1 -1
- package/lib/interfaces/ui-lib-nav-items.interface.d.ts +2 -2
- package/lib/services/mapper/cdn.token.d.ts +2 -0
- package/lib/services/mapper/component-mappers/header-clear.mapper.d.ts +1 -1
- package/lib/services/mapper/component-mappers/index.d.ts +1 -1
- package/lib/services/mapper/component-mappers/lang-modal.mapper.d.ts +2 -5
- package/lib/services/mapper/component-mappers/nav-modal.mapper.d.ts +3 -4
- package/lib/services/mapper/component-mappers/types.d.ts +1 -1
- package/lib/services/mapper/index.d.ts +2 -1
- package/lib/services/mapper/mapper.service.d.ts +1 -0
- package/lib/utils/utils.d.ts +2 -2
- package/package.json +26 -15
- package/public-api.d.ts +1 -1
- package/src/lib/effects/dynamic-background/dynamic-background.component.d.ts +26 -0
- package/src/lib/effects/dynamic-background/effects/dynamic-effect.interface.d.ts +6 -0
- package/src/lib/effects/dynamic-background/effects/effect-registry.d.ts +3 -0
- package/src/lib/effects/dynamic-background/effects/sphere-deform/sphere-deform.effect.d.ts +13 -0
- package/src/lib/effects/dynamic-background/index.d.ts +1 -0
- package/src/lib/effects/index.d.ts +1 -0
- package/src/lib/sliders/index.d.ts +1 -0
- package/src/lib/sliders/swiper.directive.d.ts +12 -0
- package/src/lib/styles/main.css +2 -2
- package/styles/main.css +2 -2
- package/esm2022/lib/Enum/index.mjs +0 -2
- package/esm2022/lib/Enum/link-type.enum.mjs +0 -9
- package/esm2022/lib/components/core/content/category-progress/category-progress.component.mjs +0 -18
- package/esm2022/lib/components/core/content/category-progress/category-progress.interface.mjs +0 -2
- package/esm2022/lib/components/core/content/category-progress/index.mjs +0 -3
- package/esm2022/lib/components/core/content/hero-section/hero-section.component.mjs +0 -25
- package/esm2022/lib/components/core/content/hero-section/hero-section.interface.mjs +0 -2
- package/esm2022/lib/components/core/content/hero-section/hero-section.stories.mjs +0 -25
- package/esm2022/lib/components/core/content/hero-section/index.mjs +0 -4
- package/esm2022/lib/components/core/content/index.mjs +0 -4
- package/esm2022/lib/components/core/content/section-intro/index.mjs +0 -3
- package/esm2022/lib/components/core/content/section-intro/section-intro.component.mjs +0 -23
- package/esm2022/lib/components/core/content/section-intro/section-intro.interface.mjs +0 -2
- package/esm2022/lib/components/core/footers/index.mjs +0 -5
- package/esm2022/lib/components/core/footers/legal-footer/index.mjs +0 -3
- package/esm2022/lib/components/core/footers/legal-footer/legal-footer.component.mjs +0 -27
- package/esm2022/lib/components/core/footers/legal-footer/legal-footer.interface.mjs +0 -2
- package/esm2022/lib/components/core/footers/links-footer/index.mjs +0 -3
- package/esm2022/lib/components/core/footers/links-footer/links-footer.component.mjs +0 -15
- package/esm2022/lib/components/core/footers/links-footer/links-footer.interface.mjs +0 -2
- package/esm2022/lib/components/core/footers/social-footer/index.mjs +0 -3
- package/esm2022/lib/components/core/footers/social-footer/social-footer.component.mjs +0 -20
- package/esm2022/lib/components/core/footers/social-footer/social-footer.interface.mjs +0 -2
- package/esm2022/lib/components/core/footers/visual-footer/index.mjs +0 -3
- package/esm2022/lib/components/core/footers/visual-footer/visual-footer.component.mjs +0 -29
- package/esm2022/lib/components/core/footers/visual-footer/visual-footer.interface.mjs +0 -2
- package/esm2022/lib/components/core/headers/header-clear/header-clear.component.mjs +0 -59
- package/esm2022/lib/components/core/headers/header-clear/header-clear.interface.mjs +0 -2
- package/esm2022/lib/components/core/headers/header-clear/index.mjs +0 -3
- package/esm2022/lib/components/core/headers/header-mobile/header-mobile.component.mjs +0 -59
- package/esm2022/lib/components/core/headers/header-mobile/header-mobile.interface.mjs +0 -2
- package/esm2022/lib/components/core/headers/header-mobile/index.mjs +0 -3
- package/esm2022/lib/components/core/headers/index.mjs +0 -3
- package/esm2022/lib/components/core/index.mjs +0 -5
- package/esm2022/lib/components/core/modals/index.mjs +0 -3
- package/esm2022/lib/components/core/modals/lang-modal/index.mjs +0 -3
- package/esm2022/lib/components/core/modals/lang-modal/lang-modal.component.mjs +0 -33
- package/esm2022/lib/components/core/modals/lang-modal/lang-modal.interface.mjs +0 -2
- package/esm2022/lib/components/core/modals/nav-modal/index.mjs +0 -3
- package/esm2022/lib/components/core/modals/nav-modal/nav-modal.component.mjs +0 -25
- package/esm2022/lib/components/core/modals/nav-modal/nav-modal.interface.mjs +0 -2
- package/esm2022/lib/components/effects/dynamic-background/dynamic-background.component.mjs +0 -87
- package/esm2022/lib/components/effects/dynamic-background/effects/dynamic-effect.interface.mjs +0 -2
- package/esm2022/lib/components/effects/dynamic-background/effects/effect-registry.mjs +0 -7
- package/esm2022/lib/components/effects/dynamic-background/effects/sphere-deform/sphere-deform.effect.mjs +0 -37
- package/esm2022/lib/components/effects/dynamic-background/index.mjs +0 -2
- package/esm2022/lib/components/effects/index.mjs +0 -2
- package/esm2022/lib/components/shared/index.mjs +0 -2
- package/esm2022/lib/components/shared/ui-icon/index.mjs +0 -3
- package/esm2022/lib/components/shared/ui-icon/ui-icon.component.mjs +0 -40
- package/esm2022/lib/components/shared/ui-icon/ui-icon.interface.mjs +0 -2
- package/esm2022/lib/directives/index.mjs +0 -3
- package/esm2022/lib/directives/link-type.directive.mjs +0 -106
- package/esm2022/lib/directives/swiper.directive.mjs +0 -43
- package/esm2022/lib/interfaces/index.mjs +0 -8
- package/esm2022/lib/interfaces/page-config.interface.mjs +0 -2
- package/esm2022/lib/interfaces/site-config.interface.mjs +0 -2
- package/esm2022/lib/interfaces/ui-lib-address.interface.mjs +0 -2
- package/esm2022/lib/interfaces/ui-lib-button.interface.mjs +0 -2
- package/esm2022/lib/interfaces/ui-lib-image.interface.mjs +0 -2
- package/esm2022/lib/interfaces/ui-lib-lang-item.interface.mjs +0 -2
- package/esm2022/lib/interfaces/ui-lib-nav-items.interface.mjs +0 -2
- package/esm2022/lib/modules/icons/icon.module.mjs +0 -24
- package/esm2022/lib/modules/icons/index.mjs +0 -2
- package/esm2022/lib/modules/index.mjs +0 -2
- package/esm2022/lib/services/index.mjs +0 -4
- package/esm2022/lib/services/mapper/component-mappers/category-progress.mapper.mjs +0 -12
- package/esm2022/lib/services/mapper/component-mappers/header-clear.mapper.mjs +0 -18
- package/esm2022/lib/services/mapper/component-mappers/hero-section.mapper.mjs +0 -10
- package/esm2022/lib/services/mapper/component-mappers/index.mjs +0 -23
- package/esm2022/lib/services/mapper/component-mappers/lang-modal.mapper.mjs +0 -14
- package/esm2022/lib/services/mapper/component-mappers/legal-footer.mapper.mjs +0 -9
- package/esm2022/lib/services/mapper/component-mappers/links-footer.mapper.mjs +0 -5
- package/esm2022/lib/services/mapper/component-mappers/nav-modal.mapper.mjs +0 -48
- package/esm2022/lib/services/mapper/component-mappers/section-intro.mapper.mjs +0 -9
- package/esm2022/lib/services/mapper/component-mappers/social-footer.mapper.mjs +0 -7
- package/esm2022/lib/services/mapper/component-mappers/types.mjs +0 -2
- package/esm2022/lib/services/mapper/component-mappers/visual-footer.mapper.mjs +0 -18
- package/esm2022/lib/services/mapper/index.mjs +0 -3
- package/esm2022/lib/services/mapper/mapper.service.mjs +0 -45
- package/esm2022/lib/services/screen-sizer/index.mjs +0 -2
- package/esm2022/lib/services/screen-sizer/screen-sizer.service.mjs +0 -66
- package/esm2022/lib/services/theme/index.mjs +0 -2
- package/esm2022/lib/services/theme/theme.service.mjs +0 -73
- package/esm2022/lib/utils/index.mjs +0 -2
- package/esm2022/lib/utils/utils.mjs +0 -38
- package/esm2022/lluc_llull-ui-lib.mjs +0 -5
- package/esm2022/public-api.mjs +0 -21
- /package/lib/{components/effects → effects}/dynamic-background/dynamic-background.component.d.ts +0 -0
- /package/lib/{components/effects → effects}/dynamic-background/effects/dynamic-effect.interface.d.ts +0 -0
- /package/lib/{components/effects → effects}/dynamic-background/effects/effect-registry.d.ts +0 -0
- /package/lib/{components/effects → effects}/dynamic-background/index.d.ts +0 -0
- /package/lib/{components/effects → effects}/index.d.ts +0 -0
- /package/lib/{directives → sliders}/swiper.directive.d.ts +0 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { isPlatformBrowser, CommonModule } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, PLATFORM_ID, Input, ViewChild, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
|
|
6
|
+
class SphereDeformEffect {
|
|
7
|
+
size;
|
|
8
|
+
rotationSpeed;
|
|
9
|
+
color;
|
|
10
|
+
mesh;
|
|
11
|
+
time = 0;
|
|
12
|
+
constructor(size, rotationSpeed, color) {
|
|
13
|
+
this.size = size;
|
|
14
|
+
this.rotationSpeed = rotationSpeed;
|
|
15
|
+
this.color = color;
|
|
16
|
+
}
|
|
17
|
+
init(scene, _options) {
|
|
18
|
+
const geometry = new THREE.SphereGeometry(this.size, 128, 128);
|
|
19
|
+
const material = this.color
|
|
20
|
+
? new THREE.MeshStandardMaterial({ color: this.color, flatShading: true })
|
|
21
|
+
: new THREE.MeshNormalMaterial({ flatShading: true });
|
|
22
|
+
this.mesh = new THREE.Mesh(geometry, material);
|
|
23
|
+
scene.add(this.mesh);
|
|
24
|
+
}
|
|
25
|
+
animate() {
|
|
26
|
+
this.time += 0.02;
|
|
27
|
+
const positionAttr = this.mesh.geometry.attributes['position'];
|
|
28
|
+
const vertex = new THREE.Vector3();
|
|
29
|
+
for (let i = 0; i < positionAttr.count; i++) {
|
|
30
|
+
vertex.fromBufferAttribute(positionAttr, i);
|
|
31
|
+
const offset = Math.sin(vertex.x * 3 + this.time) * 0.2 +
|
|
32
|
+
Math.cos(vertex.y * 5 + this.time * 0.7) * 0.2;
|
|
33
|
+
vertex.normalize().multiplyScalar(this.size + offset);
|
|
34
|
+
positionAttr.setXYZ(i, vertex.x, vertex.y, vertex.z);
|
|
35
|
+
}
|
|
36
|
+
positionAttr.needsUpdate = true;
|
|
37
|
+
this.mesh.geometry.computeVertexNormals();
|
|
38
|
+
this.mesh.rotation.y += this.rotationSpeed;
|
|
39
|
+
}
|
|
40
|
+
dispose() {
|
|
41
|
+
this.mesh?.geometry.dispose();
|
|
42
|
+
this.mesh?.material?.dispose();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const EFFECT_REGISTRY = {
|
|
47
|
+
'sphere-deform': SphereDeformEffect,
|
|
48
|
+
// 'ring-transform': RingTransformEffect,
|
|
49
|
+
// 'particles': ParticlesEffect,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
class DynamicBackgroundComponent {
|
|
53
|
+
canvasRef;
|
|
54
|
+
effect = 'sphere-deform';
|
|
55
|
+
rotationSpeed = 0.01;
|
|
56
|
+
size = 2;
|
|
57
|
+
backgroundColor = '#000000';
|
|
58
|
+
elementColor;
|
|
59
|
+
platformId = inject(PLATFORM_ID);
|
|
60
|
+
isBrowser = isPlatformBrowser(this.platformId);
|
|
61
|
+
scene;
|
|
62
|
+
camera;
|
|
63
|
+
renderer;
|
|
64
|
+
animationId;
|
|
65
|
+
currentEffect;
|
|
66
|
+
ngOnInit() {
|
|
67
|
+
if (this.isBrowser) {
|
|
68
|
+
this.initScene();
|
|
69
|
+
this.loadEffect();
|
|
70
|
+
this.animate();
|
|
71
|
+
window.addEventListener('resize', this.onResize);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
ngOnDestroy() {
|
|
75
|
+
if (this.isBrowser) {
|
|
76
|
+
cancelAnimationFrame(this.animationId);
|
|
77
|
+
this.renderer?.dispose();
|
|
78
|
+
this.currentEffect?.dispose();
|
|
79
|
+
window.removeEventListener('resize', this.onResize);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
initScene() {
|
|
83
|
+
const width = window.innerWidth;
|
|
84
|
+
const height = window.innerHeight;
|
|
85
|
+
this.scene = new THREE.Scene();
|
|
86
|
+
this.scene.background = new THREE.Color(this.backgroundColor);
|
|
87
|
+
this.camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000);
|
|
88
|
+
this.camera.position.z = 5;
|
|
89
|
+
this.renderer = new THREE.WebGLRenderer({
|
|
90
|
+
canvas: this.canvasRef.nativeElement,
|
|
91
|
+
antialias: true,
|
|
92
|
+
});
|
|
93
|
+
this.renderer.setSize(width, height);
|
|
94
|
+
const light = new THREE.DirectionalLight(0xffffff, 1);
|
|
95
|
+
light.position.set(5, 5, 5).normalize();
|
|
96
|
+
this.scene.add(light);
|
|
97
|
+
}
|
|
98
|
+
loadEffect() {
|
|
99
|
+
const EffectClass = EFFECT_REGISTRY[this.effect];
|
|
100
|
+
if (!EffectClass) {
|
|
101
|
+
throw new Error(`Efecto "${this.effect}" no está registrado en EFFECT_REGISTRY`);
|
|
102
|
+
}
|
|
103
|
+
this.currentEffect = new EffectClass(this.size, this.rotationSpeed, this.elementColor);
|
|
104
|
+
this.currentEffect.init(this.scene, {});
|
|
105
|
+
}
|
|
106
|
+
animate = () => {
|
|
107
|
+
this.animationId = requestAnimationFrame(this.animate);
|
|
108
|
+
this.currentEffect.animate();
|
|
109
|
+
this.renderer.render(this.scene, this.camera);
|
|
110
|
+
};
|
|
111
|
+
onResize = () => {
|
|
112
|
+
const width = window.innerWidth;
|
|
113
|
+
const height = window.innerHeight;
|
|
114
|
+
this.camera.aspect = width / height;
|
|
115
|
+
this.camera.updateProjectionMatrix();
|
|
116
|
+
this.renderer.setSize(width, height);
|
|
117
|
+
};
|
|
118
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicBackgroundComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
119
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.19", type: DynamicBackgroundComponent, isStandalone: true, selector: "lib-dynamic-background", inputs: { effect: "effect", rotationSpeed: "rotationSpeed", size: "size", backgroundColor: "backgroundColor", elementColor: "elementColor" }, viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["bgCanvas"], descendants: true, static: true }], ngImport: i0, template: "<canvas #bgCanvas class=\"dynamic-bg-canvas\"></canvas>\n", styles: [".dynamic-bg-canvas{position:absolute;top:0;left:0;width:100%;height:100%;display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
120
|
+
}
|
|
121
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicBackgroundComponent, decorators: [{
|
|
122
|
+
type: Component,
|
|
123
|
+
args: [{ selector: 'lib-dynamic-background', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<canvas #bgCanvas class=\"dynamic-bg-canvas\"></canvas>\n", styles: [".dynamic-bg-canvas{position:absolute;top:0;left:0;width:100%;height:100%;display:block}\n"] }]
|
|
124
|
+
}], propDecorators: { canvasRef: [{
|
|
125
|
+
type: ViewChild,
|
|
126
|
+
args: ['bgCanvas', { static: true }]
|
|
127
|
+
}], effect: [{
|
|
128
|
+
type: Input
|
|
129
|
+
}], rotationSpeed: [{
|
|
130
|
+
type: Input
|
|
131
|
+
}], size: [{
|
|
132
|
+
type: Input
|
|
133
|
+
}], backgroundColor: [{
|
|
134
|
+
type: Input
|
|
135
|
+
}], elementColor: [{
|
|
136
|
+
type: Input
|
|
137
|
+
}] } });
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Generated bundle index. Do not edit.
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
export { DynamicBackgroundComponent };
|
|
144
|
+
//# sourceMappingURL=lluc_llull-ui-lib-src-lib-effects.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lluc_llull-ui-lib-src-lib-effects.mjs","sources":["../../../projects/ui-lib/src/lib/effects/dynamic-background/effects/sphere-deform/sphere-deform.effect.ts","../../../projects/ui-lib/src/lib/effects/dynamic-background/effects/effect-registry.ts","../../../projects/ui-lib/src/lib/effects/dynamic-background/dynamic-background.component.ts","../../../projects/ui-lib/src/lib/effects/dynamic-background/dynamic-background.component.html","../../../projects/ui-lib/src/lib/effects/lluc_llull-ui-lib-src-lib-effects.ts"],"sourcesContent":["import * as THREE from 'three';\nimport { DynamicEffect } from '../dynamic-effect.interface';\n\nexport class SphereDeformEffect implements DynamicEffect {\n private mesh!: THREE.Mesh;\n private time = 0;\n\n constructor(\n private size: number,\n private rotationSpeed: number,\n private color?: string,\n ) {}\n\n init(scene: THREE.Scene, _options: any): void {\n const geometry = new THREE.SphereGeometry(this.size, 128, 128);\n\n const material = this.color\n ? new THREE.MeshStandardMaterial({ color: this.color, flatShading: true })\n : new THREE.MeshNormalMaterial({ flatShading: true });\n\n this.mesh = new THREE.Mesh(geometry, material);\n scene.add(this.mesh);\n }\n\n animate(): void {\n this.time += 0.02;\n const positionAttr = this.mesh.geometry.attributes['position'] as THREE.BufferAttribute;\n const vertex = new THREE.Vector3();\n\n for (let i = 0; i < positionAttr.count; i++) {\n vertex.fromBufferAttribute(positionAttr, i);\n\n const offset =\n Math.sin(vertex.x * 3 + this.time) * 0.2 +\n Math.cos(vertex.y * 5 + this.time * 0.7) * 0.2;\n\n vertex.normalize().multiplyScalar(this.size + offset);\n\n positionAttr.setXYZ(i, vertex.x, vertex.y, vertex.z);\n }\n\n positionAttr.needsUpdate = true;\n this.mesh.geometry.computeVertexNormals();\n\n this.mesh.rotation.y += this.rotationSpeed;\n }\n\n dispose(): void {\n this.mesh?.geometry.dispose();\n (this.mesh?.material as THREE.Material)?.dispose();\n }\n}\n","import { DynamicEffect } from './dynamic-effect.interface';\nimport { SphereDeformEffect } from './sphere-deform/sphere-deform.effect';\n// import { RingTransformEffect } from './ring-transform/ring-transform.effect';\n// import { ParticlesEffect } from './particles/particles.effect';\n\nexport type EffectKey = 'sphere-deform' | 'ring-transform' | 'particles';\n\nexport const EFFECT_REGISTRY: Partial<Record<EffectKey, new (...args: any[]) => DynamicEffect>> = {\n 'sphere-deform': SphereDeformEffect,\n // 'ring-transform': RingTransformEffect,\n // 'particles': ParticlesEffect,\n};\n","import { CommonModule, isPlatformBrowser } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Input,\n OnDestroy,\n OnInit,\n PLATFORM_ID,\n ViewChild,\n inject,\n} from '@angular/core';\nimport * as THREE from 'three';\nimport { DynamicEffect } from './effects/dynamic-effect.interface';\nimport { EFFECT_REGISTRY, EffectKey } from './effects/effect-registry';\n\n@Component({\n selector: 'lib-dynamic-background',\n standalone: true,\n imports: [CommonModule],\n templateUrl: './dynamic-background.component.html',\n styleUrl: './dynamic-background.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DynamicBackgroundComponent implements OnInit, OnDestroy {\n @ViewChild('bgCanvas', { static: true }) canvasRef!: ElementRef<HTMLCanvasElement>;\n\n @Input() effect: EffectKey = 'sphere-deform';\n @Input() rotationSpeed = 0.01;\n @Input() size = 2;\n @Input() backgroundColor = '#000000';\n @Input() elementColor?: string;\n\n private readonly platformId = inject(PLATFORM_ID);\n private readonly isBrowser = isPlatformBrowser(this.platformId);\n\n private scene!: THREE.Scene;\n private camera!: THREE.PerspectiveCamera;\n private renderer!: THREE.WebGLRenderer;\n private animationId!: number;\n\n private currentEffect!: DynamicEffect;\n\n ngOnInit(): void {\n if (this.isBrowser) {\n this.initScene();\n this.loadEffect();\n this.animate();\n window.addEventListener('resize', this.onResize);\n }\n }\n\n ngOnDestroy(): void {\n if (this.isBrowser) {\n cancelAnimationFrame(this.animationId);\n this.renderer?.dispose();\n this.currentEffect?.dispose();\n window.removeEventListener('resize', this.onResize);\n }\n }\n\n private initScene(): void {\n const width = window.innerWidth;\n const height = window.innerHeight;\n\n this.scene = new THREE.Scene();\n this.scene.background = new THREE.Color(this.backgroundColor);\n\n this.camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000);\n this.camera.position.z = 5;\n\n this.renderer = new THREE.WebGLRenderer({\n canvas: this.canvasRef.nativeElement,\n antialias: true,\n });\n this.renderer.setSize(width, height);\n\n const light = new THREE.DirectionalLight(0xffffff, 1);\n light.position.set(5, 5, 5).normalize();\n this.scene.add(light);\n }\n\n private loadEffect(): void {\n const EffectClass = EFFECT_REGISTRY[this.effect];\n if (!EffectClass) {\n throw new Error(`Efecto \"${this.effect}\" no está registrado en EFFECT_REGISTRY`);\n }\n this.currentEffect = new EffectClass(this.size, this.rotationSpeed, this.elementColor);\n this.currentEffect.init(this.scene, {});\n }\n\n private animate = (): void => {\n this.animationId = requestAnimationFrame(this.animate);\n this.currentEffect.animate();\n this.renderer.render(this.scene, this.camera);\n };\n\n private onResize = (): void => {\n const width = window.innerWidth;\n const height = window.innerHeight;\n this.camera.aspect = width / height;\n this.camera.updateProjectionMatrix();\n this.renderer.setSize(width, height);\n };\n}\n","<canvas #bgCanvas class=\"dynamic-bg-canvas\"></canvas>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAGa,kBAAkB,CAAA;AAKf,IAAA,IAAA;AACA,IAAA,aAAA;AACA,IAAA,KAAA;AANJ,IAAA,IAAI;IACJ,IAAI,GAAG,CAAC;AAEhB,IAAA,WAAA,CACY,IAAY,EACZ,aAAqB,EACrB,KAAc,EAAA;QAFd,IAAA,CAAA,IAAI,GAAJ,IAAI;QACJ,IAAA,CAAA,aAAa,GAAb,aAAa;QACb,IAAA,CAAA,KAAK,GAAL,KAAK;IACd;IAEH,IAAI,CAAC,KAAkB,EAAE,QAAa,EAAA;AAClC,QAAA,MAAM,QAAQ,GAAG,IAAI,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC;AAE9D,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC;AAClB,cAAE,IAAI,KAAK,CAAC,oBAAoB,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE;AACzE,cAAE,IAAI,KAAK,CAAC,kBAAkB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AAEzD,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC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+BACI,wBAAwB,EAAA,UAAA,EACtB,IAAI,EAAA,OAAA,EACP,CAAC,YAAY,CAAC,EAAA,eAAA,EAGN,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,2DAAA,EAAA,MAAA,EAAA,CAAA,2FAAA,CAAA,EAAA;8BAGN,SAAS,EAAA,CAAA;sBAAjD,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;gBAE9B,MAAM,EAAA,CAAA;sBAAd;gBACQ,aAAa,EAAA,CAAA;sBAArB;gBACQ,IAAI,EAAA,CAAA;sBAAZ;gBACQ,eAAe,EAAA,CAAA;sBAAvB;gBACQ,YAAY,EAAA,CAAA;sBAApB;;;AE/BL;;AAEG;;;;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Input, Directive } from '@angular/core';
|
|
3
|
+
import Swiper from 'swiper';
|
|
4
|
+
import { Navigation, Pagination, Autoplay } from 'swiper/modules';
|
|
5
|
+
|
|
6
|
+
Swiper.use([Navigation, Pagination, Autoplay]);
|
|
7
|
+
class SwiperDirective {
|
|
8
|
+
el;
|
|
9
|
+
swiperConfig;
|
|
10
|
+
swiperInstance;
|
|
11
|
+
constructor(el) {
|
|
12
|
+
this.el = el;
|
|
13
|
+
}
|
|
14
|
+
ngAfterViewInit() {
|
|
15
|
+
this.swiperInstance = new Swiper(this.el.nativeElement, {
|
|
16
|
+
spaceBetween: 16,
|
|
17
|
+
navigation: {
|
|
18
|
+
nextEl: '.swiper-button-next',
|
|
19
|
+
prevEl: '.swiper-button-prev',
|
|
20
|
+
},
|
|
21
|
+
pagination: { clickable: true },
|
|
22
|
+
breakpoints: {
|
|
23
|
+
0: { slidesPerView: 1 }, // móviles
|
|
24
|
+
480: { slidesPerView: 1 }, // small tablets
|
|
25
|
+
768: { slidesPerView: 3 }, // tablets
|
|
26
|
+
1024: { slidesPerView: 4 }, // laptops
|
|
27
|
+
1280: { slidesPerView: 7 }, // desktop → máximo 7
|
|
28
|
+
},
|
|
29
|
+
...this.swiperConfig,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
ngOnDestroy() {
|
|
33
|
+
this.swiperInstance?.destroy(true, true);
|
|
34
|
+
}
|
|
35
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: SwiperDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
36
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.19", type: SwiperDirective, isStandalone: true, selector: "[appSwiper]", inputs: { swiperConfig: "swiperConfig" }, ngImport: i0 });
|
|
37
|
+
}
|
|
38
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: SwiperDirective, decorators: [{
|
|
39
|
+
type: Directive,
|
|
40
|
+
args: [{
|
|
41
|
+
selector: '[appSwiper]',
|
|
42
|
+
standalone: true,
|
|
43
|
+
}]
|
|
44
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { swiperConfig: [{
|
|
45
|
+
type: Input
|
|
46
|
+
}] } });
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Generated bundle index. Do not edit.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
export { SwiperDirective };
|
|
53
|
+
//# sourceMappingURL=lluc_llull-ui-lib-src-lib-sliders.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lluc_llull-ui-lib-src-lib-sliders.mjs","sources":["../../../projects/ui-lib/src/lib/sliders/swiper.directive.ts","../../../projects/ui-lib/src/lib/sliders/lluc_llull-ui-lib-src-lib-sliders.ts"],"sourcesContent":["import { AfterViewInit, Directive, ElementRef, Input, OnDestroy } from '@angular/core';\nimport Swiper from 'swiper';\nimport { Autoplay, Navigation, Pagination } from 'swiper/modules';\n\nSwiper.use([Navigation, Pagination, Autoplay]);\n\n@Directive({\n selector: '[appSwiper]',\n standalone: true,\n})\nexport class SwiperDirective implements AfterViewInit, OnDestroy {\n @Input() swiperConfig: any;\n\n private swiperInstance?: Swiper;\n\n constructor(private el: ElementRef) {}\n\n ngAfterViewInit(): void {\n this.swiperInstance = new Swiper(this.el.nativeElement, {\n spaceBetween: 16,\n navigation: {\n nextEl: '.swiper-button-next',\n prevEl: '.swiper-button-prev',\n },\n pagination: { clickable: true },\n breakpoints: {\n 0: { slidesPerView: 1 }, // móviles\n 480: { slidesPerView: 1 }, // small tablets\n 768: { slidesPerView: 3 }, // tablets\n 1024: { slidesPerView: 4 }, // laptops\n 1280: { slidesPerView: 7 }, // desktop → máximo 7\n },\n ...this.swiperConfig,\n });\n }\n\n ngOnDestroy(): void {\n this.swiperInstance?.destroy(true, true);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAIA,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;MAMjC,eAAe,CAAA;AAKJ,IAAA,EAAA;AAJX,IAAA,YAAY;AAEb,IAAA,cAAc;AAEtB,IAAA,WAAA,CAAoB,EAAc,EAAA;QAAd,IAAA,CAAA,EAAE,GAAF,EAAE;IAAe;IAErC,eAAe,GAAA;QACX,IAAI,CAAC,cAAc,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE;AACpD,YAAA,YAAY,EAAE,EAAE;AAChB,YAAA,UAAU,EAAE;AACR,gBAAA,MAAM,EAAE,qBAAqB;AAC7B,gBAAA,MAAM,EAAE,qBAAqB;AAChC,aAAA;AACD,YAAA,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;AAC/B,YAAA,WAAW,EAAE;AACT,gBAAA,CAAC,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;AACvB,gBAAA,GAAG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