@gardev/components 0.0.6 → 0.0.8
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/gardev-components.mjs +575 -0
- package/fesm2022/gardev-components.mjs.map +1 -0
- package/package.json +23 -12
- package/types/gardev-components.d.ts +139 -0
- package/ng-package.json +0 -7
- package/src/lib/components/bottle/bottle.component.css +0 -4
- package/src/lib/components/bottle/bottle.component.html +0 -1
- package/src/lib/components/bottle/bottle.component.spec.ts +0 -23
- package/src/lib/components/bottle/bottle.component.ts +0 -164
- package/src/lib/components/caroussel/caroussel-menu/caroussel-menu.component.css +0 -23
- package/src/lib/components/caroussel/caroussel-menu/caroussel-menu.component.html +0 -5
- package/src/lib/components/caroussel/caroussel-menu/caroussel-menu.component.ts +0 -63
- package/src/lib/components/caroussel/caroussel-menu/caroussel-menu.spec.ts +0 -23
- package/src/lib/components/caroussel/caroussel.component.css +0 -11
- package/src/lib/components/caroussel/caroussel.component.html +0 -8
- package/src/lib/components/caroussel/caroussel.component.ts +0 -24
- package/src/lib/components/cronogram/cronogram.component.css +0 -58
- package/src/lib/components/cronogram/cronogram.component.html +0 -47
- package/src/lib/components/cronogram/cronogram.component.spec.ts +0 -23
- package/src/lib/components/cronogram/cronogram.component.ts +0 -99
- package/src/lib/components/stack-caroussel/stack-caroussel.css +0 -25
- package/src/lib/components/stack-caroussel/stack-caroussel.html +0 -4
- package/src/lib/components/stack-caroussel/stack-caroussel.spec.ts +0 -23
- package/src/lib/components/stack-caroussel/stack-caroussel.ts +0 -50
- package/src/lib/layouts/menu/menu.component.css +0 -50
- package/src/lib/layouts/menu/menu.component.html +0 -21
- package/src/lib/layouts/menu/menu.component.ts +0 -98
- package/src/lib/layouts/menu/menu.spec.ts +0 -23
- package/src/lib/layouts/navbar/navbar.component.css +0 -34
- package/src/lib/layouts/navbar/navbar.component.html +0 -10
- package/src/lib/layouts/navbar/navbar.component.spec.ts +0 -23
- package/src/lib/layouts/navbar/navbar.component.ts +0 -46
- package/src/lib/layouts/page-layout/page-layout.component.css +0 -13
- package/src/lib/layouts/page-layout/page-layout.component.html +0 -32
- package/src/lib/layouts/page-layout/page-layout.component.spec.ts +0 -23
- package/src/lib/layouts/page-layout/page-layout.component.ts +0 -13
- package/src/lib/layouts/scroll-reactive-section/scroll-reactive-section.component.css +0 -0
- package/src/lib/layouts/scroll-reactive-section/scroll-reactive-section.component.html +0 -10
- package/src/lib/layouts/scroll-reactive-section/scroll-reactive-section.component.spec.ts +0 -23
- package/src/lib/layouts/scroll-reactive-section/scroll-reactive-section.component.ts +0 -40
- package/src/lib/layouts/section/section.component.css +0 -0
- package/src/lib/layouts/section/section.component.html +0 -10
- package/src/lib/layouts/section/section.component.spec.ts +0 -23
- package/src/lib/layouts/section/section.component.ts +0 -12
- package/src/lib/theme.service.ts +0 -22
- package/src/public-api.ts +0 -14
- package/tsconfig.lib.json +0 -17
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -15
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { ViewChild, Input, Component, EventEmitter, ElementRef, Output, ViewChildren, HostListener, inject, ViewContainerRef, Injectable } from '@angular/core';
|
|
3
|
+
import * as THREE from 'three';
|
|
4
|
+
import { SVGLoader } from 'three/examples/jsm/Addons.js';
|
|
5
|
+
import * as i1 from '@angular/common';
|
|
6
|
+
import { NgForOf, NgClass, NgStyle, CommonModule } from '@angular/common';
|
|
7
|
+
import { Overlay } from '@angular/cdk/overlay';
|
|
8
|
+
import { TemplatePortal } from '@angular/cdk/portal';
|
|
9
|
+
|
|
10
|
+
class BottleComponent {
|
|
11
|
+
color = '#868132';
|
|
12
|
+
wineColor = '#fff6f5';
|
|
13
|
+
container;
|
|
14
|
+
scene;
|
|
15
|
+
camera;
|
|
16
|
+
renderer;
|
|
17
|
+
glassMaterial;
|
|
18
|
+
liquidMaterial;
|
|
19
|
+
foilMaterial;
|
|
20
|
+
ngAfterViewInit() {
|
|
21
|
+
this.glassMaterial = new THREE.MeshPhysicalMaterial({
|
|
22
|
+
color: new THREE.Color(this.color),
|
|
23
|
+
metalness: 0,
|
|
24
|
+
roughness: 0,
|
|
25
|
+
transmission: 1,
|
|
26
|
+
thickness: 0,
|
|
27
|
+
ior: 1.5,
|
|
28
|
+
clearcoat: 1.0,
|
|
29
|
+
clearcoatRoughness: 0.05,
|
|
30
|
+
opacity: 1,
|
|
31
|
+
side: THREE.FrontSide,
|
|
32
|
+
transparent: true,
|
|
33
|
+
depthWrite: false,
|
|
34
|
+
envMapIntensity: 2.5
|
|
35
|
+
});
|
|
36
|
+
this.liquidMaterial = new THREE.MeshPhysicalMaterial({
|
|
37
|
+
color: new THREE.Color('#e2d744'),
|
|
38
|
+
metalness: 0.4,
|
|
39
|
+
// roughness: 0.25,
|
|
40
|
+
transmission: 0.2,
|
|
41
|
+
thickness: 0.4,
|
|
42
|
+
ior: 1.5,
|
|
43
|
+
clearcoat: 1.0,
|
|
44
|
+
clearcoatRoughness: 0.05,
|
|
45
|
+
transparent: true,
|
|
46
|
+
opacity: 0.8,
|
|
47
|
+
depthWrite: false, // 🔑 el líquid SÍ escriu profunditat
|
|
48
|
+
side: THREE.BackSide,
|
|
49
|
+
// envMapIntensity: 1.2,
|
|
50
|
+
});
|
|
51
|
+
this.foilMaterial = new THREE.MeshPhysicalMaterial({
|
|
52
|
+
color: 0x156289,
|
|
53
|
+
metalness: 0.25,
|
|
54
|
+
roughness: 0.3,
|
|
55
|
+
side: THREE.DoubleSide
|
|
56
|
+
});
|
|
57
|
+
this.createSceneAndLighting();
|
|
58
|
+
this.loadModelFromSVGFile();
|
|
59
|
+
this.animate();
|
|
60
|
+
}
|
|
61
|
+
animate = () => {
|
|
62
|
+
requestAnimationFrame(this.animate);
|
|
63
|
+
if (this.camera) {
|
|
64
|
+
const t = Date.now() * 0.0002;
|
|
65
|
+
this.camera.position.x = Math.sin(t) * 50;
|
|
66
|
+
this.camera.position.z = Math.cos(t) * 50;
|
|
67
|
+
this.camera.lookAt(0, 0, 0);
|
|
68
|
+
}
|
|
69
|
+
this.renderer.shadowMap.enabled = true;
|
|
70
|
+
this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
|
71
|
+
this.renderer.render(this.scene, this.camera);
|
|
72
|
+
};
|
|
73
|
+
loadModelFromSVGFile() {
|
|
74
|
+
const loader = new SVGLoader();
|
|
75
|
+
loader.load('assets/bitmap.svg', (data) => {
|
|
76
|
+
const bottleGroup = new THREE.Group();
|
|
77
|
+
data.paths.forEach((path, index) => {
|
|
78
|
+
const shapes = SVGLoader.createShapes(path);
|
|
79
|
+
shapes.forEach((shape) => {
|
|
80
|
+
const points = shape.getPoints().map(p => new THREE.Vector2(p.x * 0.1, -p.y * 0.1));
|
|
81
|
+
const geometry = new THREE.LatheGeometry(points, 128); // més segments → més suau
|
|
82
|
+
geometry.computeVertexNormals(); // normals correctes
|
|
83
|
+
const material = (index === 0) ? this.glassMaterial :
|
|
84
|
+
(index === 1) ? this.liquidMaterial : this.foilMaterial;
|
|
85
|
+
const mesh = new THREE.Mesh(geometry, material);
|
|
86
|
+
const layerGroup = new THREE.Group();
|
|
87
|
+
layerGroup.add(mesh);
|
|
88
|
+
bottleGroup.add(layerGroup);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
const box = new THREE.Box3().setFromObject(bottleGroup);
|
|
92
|
+
const center = box.getCenter(new THREE.Vector3());
|
|
93
|
+
bottleGroup.position.sub(center);
|
|
94
|
+
this.scene.add(bottleGroup);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
createSceneAndLighting() {
|
|
98
|
+
this.scene = new THREE.Scene();
|
|
99
|
+
const width = this.container.nativeElement.clientWidth;
|
|
100
|
+
const height = this.container.nativeElement.clientHeight;
|
|
101
|
+
this.camera = new THREE.PerspectiveCamera(35, width / height, 0.1, 5000);
|
|
102
|
+
this.camera.position.set(30, 20, 50);
|
|
103
|
+
this.camera.lookAt(0, 0, 0);
|
|
104
|
+
this.renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
|
|
105
|
+
this.renderer.setSize(width, height);
|
|
106
|
+
this.renderer.toneMapping = THREE.ACESFilmicToneMapping; // millora realisme colors
|
|
107
|
+
this.container.nativeElement.appendChild(this.renderer.domElement);
|
|
108
|
+
const ambientLight = new THREE.AmbientLight(0xffffff, 0.3);
|
|
109
|
+
this.scene.add(ambientLight);
|
|
110
|
+
const directionalLight = new THREE.DirectionalLight(0xffffff, 1.0);
|
|
111
|
+
directionalLight.position.set(50, 80, 50);
|
|
112
|
+
directionalLight.castShadow = true;
|
|
113
|
+
directionalLight.shadow.mapSize.width = 2048;
|
|
114
|
+
directionalLight.shadow.mapSize.height = 2048;
|
|
115
|
+
directionalLight.shadow.radius = 4;
|
|
116
|
+
this.scene.add(directionalLight);
|
|
117
|
+
const backLight = new THREE.PointLight(0xffffff, 0.5);
|
|
118
|
+
backLight.position.set(-30, 40, -30);
|
|
119
|
+
this.scene.add(backLight);
|
|
120
|
+
const sideLight = new THREE.PointLight(0xffffff, 0.3);
|
|
121
|
+
sideLight.position.set(30, 10, -40);
|
|
122
|
+
this.scene.add(sideLight);
|
|
123
|
+
const textureLoader = new THREE.TextureLoader();
|
|
124
|
+
textureLoader.load('assets/environment-map.png', (texture) => {
|
|
125
|
+
texture.mapping = THREE.EquirectangularReflectionMapping;
|
|
126
|
+
this.scene.environment = texture;
|
|
127
|
+
//this.scene.background = texture;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: BottleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
131
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: BottleComponent, isStandalone: true, selector: "app-bottle", inputs: { color: "color", wineColor: "wineColor" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, static: true }], ngImport: i0, template: "<div #container class=\"three-container\"></div>", styles: [".three-container{width:300px;height:600px}\n"] });
|
|
132
|
+
}
|
|
133
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: BottleComponent, decorators: [{
|
|
134
|
+
type: Component,
|
|
135
|
+
args: [{ selector: 'app-bottle', standalone: true, template: "<div #container class=\"three-container\"></div>", styles: [".three-container{width:300px;height:600px}\n"] }]
|
|
136
|
+
}], propDecorators: { color: [{
|
|
137
|
+
type: Input
|
|
138
|
+
}], wineColor: [{
|
|
139
|
+
type: Input
|
|
140
|
+
}], container: [{
|
|
141
|
+
type: ViewChild,
|
|
142
|
+
args: ['container', { static: true }]
|
|
143
|
+
}] } });
|
|
144
|
+
|
|
145
|
+
class CarousselMenuComponent {
|
|
146
|
+
length = 0;
|
|
147
|
+
buttons;
|
|
148
|
+
selectedIndex;
|
|
149
|
+
indexChange = new EventEmitter();
|
|
150
|
+
positions = [];
|
|
151
|
+
resetWidthId;
|
|
152
|
+
ngAfterViewInit() {
|
|
153
|
+
const btns = this.buttons.toArray();
|
|
154
|
+
const firstRight = btns[0]?.nativeElement.getBoundingClientRect().right ?? 0;
|
|
155
|
+
this.positions = btns.map(b => b.nativeElement.getBoundingClientRect().right - firstRight);
|
|
156
|
+
}
|
|
157
|
+
selectIndex(i) {
|
|
158
|
+
this.indexChange.emit(i);
|
|
159
|
+
const el = this.selectedIndex.nativeElement;
|
|
160
|
+
const x = this.positions[i] ?? 0;
|
|
161
|
+
el.style.transform = `translateX(${x}px)`;
|
|
162
|
+
const baseWidth = el.getBoundingClientRect().width;
|
|
163
|
+
el.style.width = `${baseWidth * 1.5}px`;
|
|
164
|
+
if (this.resetWidthId) {
|
|
165
|
+
clearTimeout(this.resetWidthId);
|
|
166
|
+
}
|
|
167
|
+
this.resetWidthId = window.setTimeout(() => {
|
|
168
|
+
el.style.width = `${baseWidth}px`;
|
|
169
|
+
}, 150);
|
|
170
|
+
}
|
|
171
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: CarousselMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
172
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: CarousselMenuComponent, isStandalone: true, selector: "ard-caroussel-menu", inputs: { length: "length" }, outputs: { indexChange: "indexChange" }, viewQueries: [{ propertyName: "selectedIndex", first: true, predicate: ["selectedIndex"], descendants: true }, { propertyName: "buttons", predicate: ["btn"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div style=\"display: flex; gap: 1rem;\">\r\n <button #btn *ngFor=\"let _ of [].constructor(length); let i = index\" (click)=\"selectIndex(i)\">\r\n </button>\r\n <div #selectedIndex id=\"selectedIndex\"></div>\r\n</div>", styles: ["button{width:calc(1rem - 4px);height:calc(1rem - 4px);background:#000;border:0;border-radius:1rem;z-index:1;margin:2px;cursor:pointer}#selectedIndex{width:1rem;height:1rem;background:#fff;border-radius:1rem;position:absolute;z-index:0;transition:transform .3s cubic-bezier(.35,0,.25,1),width .3s cubic-bezier(.35,0,.25,1);will-change:transform,width}\n"], dependencies: [{ kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
173
|
+
}
|
|
174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: CarousselMenuComponent, decorators: [{
|
|
175
|
+
type: Component,
|
|
176
|
+
args: [{ selector: 'ard-caroussel-menu', standalone: true, imports: [NgForOf], template: "<div style=\"display: flex; gap: 1rem;\">\r\n <button #btn *ngFor=\"let _ of [].constructor(length); let i = index\" (click)=\"selectIndex(i)\">\r\n </button>\r\n <div #selectedIndex id=\"selectedIndex\"></div>\r\n</div>", styles: ["button{width:calc(1rem - 4px);height:calc(1rem - 4px);background:#000;border:0;border-radius:1rem;z-index:1;margin:2px;cursor:pointer}#selectedIndex{width:1rem;height:1rem;background:#fff;border-radius:1rem;position:absolute;z-index:0;transition:transform .3s cubic-bezier(.35,0,.25,1),width .3s cubic-bezier(.35,0,.25,1);will-change:transform,width}\n"] }]
|
|
177
|
+
}], propDecorators: { length: [{
|
|
178
|
+
type: Input
|
|
179
|
+
}], buttons: [{
|
|
180
|
+
type: ViewChildren,
|
|
181
|
+
args: ['btn', { read: ElementRef }]
|
|
182
|
+
}], selectedIndex: [{
|
|
183
|
+
type: ViewChild,
|
|
184
|
+
args: ['selectedIndex']
|
|
185
|
+
}], indexChange: [{
|
|
186
|
+
type: Output
|
|
187
|
+
}] } });
|
|
188
|
+
|
|
189
|
+
class CarousselComponent {
|
|
190
|
+
images = [];
|
|
191
|
+
index = 0;
|
|
192
|
+
next() {
|
|
193
|
+
this.index = (this.index + 1) % this.images.length;
|
|
194
|
+
}
|
|
195
|
+
goTo(i) {
|
|
196
|
+
this.index = i;
|
|
197
|
+
}
|
|
198
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: CarousselComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
199
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: CarousselComponent, isStandalone: true, selector: "ard-caroussel", inputs: { images: "images" }, ngImport: i0, template: "<div style=\"position: relative; top: 0; width: 100%; height: 100%; overflow: hidden;\">\r\n <img *ngFor=\"let img of images; let i = index\" [src]=\"img\" [style.opacity]=\"i === index ? 1 : 0\" class=\"image\"\r\n alt=\"\">\r\n\r\n <div style=\"position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px;\">\r\n <ard-caroussel-menu (indexChange)=\"goTo($event)\" [length]=\"images.length\"></ard-caroussel-menu>\r\n </div>\r\n</div>", styles: [".image{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover;object-position:center;transition:opacity .5s ease-in-out}\n"], dependencies: [{ kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: CarousselMenuComponent, selector: "ard-caroussel-menu", inputs: ["length"], outputs: ["indexChange"] }] });
|
|
200
|
+
}
|
|
201
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: CarousselComponent, decorators: [{
|
|
202
|
+
type: Component,
|
|
203
|
+
args: [{ selector: 'ard-caroussel', imports: [NgForOf, CarousselMenuComponent], template: "<div style=\"position: relative; top: 0; width: 100%; height: 100%; overflow: hidden;\">\r\n <img *ngFor=\"let img of images; let i = index\" [src]=\"img\" [style.opacity]=\"i === index ? 1 : 0\" class=\"image\"\r\n alt=\"\">\r\n\r\n <div style=\"position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px;\">\r\n <ard-caroussel-menu (indexChange)=\"goTo($event)\" [length]=\"images.length\"></ard-caroussel-menu>\r\n </div>\r\n</div>", styles: [".image{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover;object-position:center;transition:opacity .5s ease-in-out}\n"] }]
|
|
204
|
+
}], propDecorators: { images: [{
|
|
205
|
+
type: Input
|
|
206
|
+
}] } });
|
|
207
|
+
|
|
208
|
+
class CronogramComponent {
|
|
209
|
+
wrapper;
|
|
210
|
+
line;
|
|
211
|
+
children;
|
|
212
|
+
items = [
|
|
213
|
+
{ date: 2000, content: 'Lorem ipsum dolor sit amet', image: 'lorem' },
|
|
214
|
+
{ date: 2001, content: 'Lorem ipsum dolor sit amet', image: 'lorem' },
|
|
215
|
+
{ date: 2002, content: 'Lorem ipsum dolor sit amet', image: 'lorem' }
|
|
216
|
+
];
|
|
217
|
+
positionsY = [];
|
|
218
|
+
ngAfterViewInit() {
|
|
219
|
+
this.positionsY = this.children.map(i => i.nativeElement.getBoundingClientRect().y);
|
|
220
|
+
this.line.nativeElement.style.maxHeight = `${this.wrapper.nativeElement.getBoundingClientRect().height}px`;
|
|
221
|
+
}
|
|
222
|
+
lastScrollY = window.scrollY;
|
|
223
|
+
onScroll() {
|
|
224
|
+
const scrollPosition = window.scrollY;
|
|
225
|
+
if (scrollPosition > this.lastScrollY) {
|
|
226
|
+
this.onScrollDown(scrollPosition);
|
|
227
|
+
}
|
|
228
|
+
else if (scrollPosition < this.lastScrollY) {
|
|
229
|
+
this.onScrollUp(scrollPosition);
|
|
230
|
+
}
|
|
231
|
+
this.lastScrollY = scrollPosition;
|
|
232
|
+
this.line.nativeElement.style.height = `${this.visibleHeight(this.wrapper.nativeElement)}px`;
|
|
233
|
+
}
|
|
234
|
+
onScrollDown(scrollPosition) {
|
|
235
|
+
let index = this.positionsY.findIndex(pos => pos > scrollPosition - 100);
|
|
236
|
+
if (index === -1) {
|
|
237
|
+
index = this.positionsY.length;
|
|
238
|
+
}
|
|
239
|
+
this.children.forEach((child, i) => {
|
|
240
|
+
const el = child.nativeElement;
|
|
241
|
+
if (i < index) {
|
|
242
|
+
el.classList.remove("hidden");
|
|
243
|
+
el.classList.add("visible");
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
this.line.nativeElement.style.transition = 'height 1.2s';
|
|
247
|
+
}
|
|
248
|
+
onScrollUp(scrollPosition) {
|
|
249
|
+
let index = this.positionsY.findIndex(pos => pos > scrollPosition - 50);
|
|
250
|
+
if (index === -1) {
|
|
251
|
+
index = this.positionsY.length;
|
|
252
|
+
}
|
|
253
|
+
this.children.forEach((child, i) => {
|
|
254
|
+
const el = child.nativeElement;
|
|
255
|
+
if (i >= index) {
|
|
256
|
+
el.classList.add("hidden");
|
|
257
|
+
el.classList.remove("visible");
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
this.line.nativeElement.style.transition = 'height 0s';
|
|
261
|
+
}
|
|
262
|
+
visibleHeight(el) {
|
|
263
|
+
const rect = el.getBoundingClientRect();
|
|
264
|
+
const viewportHeight = window.innerHeight;
|
|
265
|
+
const topVisible = Math.max(rect.top, 0);
|
|
266
|
+
const bottomVisible = Math.min(rect.bottom, viewportHeight);
|
|
267
|
+
return Math.max(0, bottomVisible - topVisible);
|
|
268
|
+
}
|
|
269
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: CronogramComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
270
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.0", type: CronogramComponent, isStandalone: true, selector: "ard-cronogram", host: { listeners: { "window:scroll": "onScroll()" } }, viewQueries: [{ propertyName: "wrapper", first: true, predicate: ["wrapper"], descendants: true, read: ElementRef }, { propertyName: "line", first: true, predicate: ["line"], descendants: true, read: ElementRef }, { propertyName: "children", predicate: ["CronogramContent"], descendants: true, read: ElementRef }], ngImport: i0, template: "<h4>cronogram.component.ts</h4>\r\n\r\n<p>\r\n en la vista mobile, estar\u00E0 tot en un mateix costat?\r\n</p>\r\n\r\n<div #wrapper>\r\n\r\n\r\n\r\n @for(day of items; track day.date; let i = $index;) {\r\n\r\n <div style=\"display: grid; grid-template-columns: 1fr 0fr 1fr;\" class=\"general-container\" #CronogramContent>\r\n\r\n\r\n <div class=\"left-container\" [ngClass]=\"i % 2 == 0 ? 'odd' : 'even'\">\r\n @if(i % 2 === 0) {\r\n <h3>{{day.date}}</h3>\r\n <p>lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit\r\n amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet,</p>\r\n }\r\n </div>\r\n\r\n\r\n <div class=\"center\" style=\"height: 100%; display: flex; width: 1rem; flex-flow: column; position: relative\">\r\n <div class=\"bullet\" style=\"z-index: 2\">\r\n </div>\r\n\r\n @if (i == 0) {\r\n <div class=\"line\" #line>\r\n\r\n </div>\r\n }\r\n\r\n </div>\r\n <div class=\"right-container cronogram-content\" [ngClass]=\"i % 2 == 0 ? 'odd' : 'even'\">\r\n @if(i % 2 !== 0) {\r\n <h3>{{day.date}}</h3>\r\n <p>lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit\r\n amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet,</p>\r\n\r\n }\r\n </div>\r\n\r\n </div>\r\n }\r\n</div>", styles: [".left-container.odd,.right-container.even{padding:0 1rem}.left-container,.right-container{padding:0 1rem;max-width:35ch}.general-container{transition:opacity .6s}.line{background:var(--color-text);width:100%;position:absolute;border-radius:1rem 1rem 0 0;animation-timing-function:ease-out;width:.4rem}.bullet{width:.4rem;min-height:.4rem;background:var(--color-text);outline:3px solid var(--color-text);border-radius:2rem;position:absolute}.hidden{opacity:0}.visible{opacity:1}.center{position:relative}.left-container{display:flex;justify-content:end;text-align:end;justify-self:end;flex-flow:column}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
271
|
+
}
|
|
272
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: CronogramComponent, decorators: [{
|
|
273
|
+
type: Component,
|
|
274
|
+
args: [{ selector: 'ard-cronogram', imports: [NgClass], template: "<h4>cronogram.component.ts</h4>\r\n\r\n<p>\r\n en la vista mobile, estar\u00E0 tot en un mateix costat?\r\n</p>\r\n\r\n<div #wrapper>\r\n\r\n\r\n\r\n @for(day of items; track day.date; let i = $index;) {\r\n\r\n <div style=\"display: grid; grid-template-columns: 1fr 0fr 1fr;\" class=\"general-container\" #CronogramContent>\r\n\r\n\r\n <div class=\"left-container\" [ngClass]=\"i % 2 == 0 ? 'odd' : 'even'\">\r\n @if(i % 2 === 0) {\r\n <h3>{{day.date}}</h3>\r\n <p>lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit\r\n amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet,</p>\r\n }\r\n </div>\r\n\r\n\r\n <div class=\"center\" style=\"height: 100%; display: flex; width: 1rem; flex-flow: column; position: relative\">\r\n <div class=\"bullet\" style=\"z-index: 2\">\r\n </div>\r\n\r\n @if (i == 0) {\r\n <div class=\"line\" #line>\r\n\r\n </div>\r\n }\r\n\r\n </div>\r\n <div class=\"right-container cronogram-content\" [ngClass]=\"i % 2 == 0 ? 'odd' : 'even'\">\r\n @if(i % 2 !== 0) {\r\n <h3>{{day.date}}</h3>\r\n <p>lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit\r\n amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet,</p>\r\n\r\n }\r\n </div>\r\n\r\n </div>\r\n }\r\n</div>", styles: [".left-container.odd,.right-container.even{padding:0 1rem}.left-container,.right-container{padding:0 1rem;max-width:35ch}.general-container{transition:opacity .6s}.line{background:var(--color-text);width:100%;position:absolute;border-radius:1rem 1rem 0 0;animation-timing-function:ease-out;width:.4rem}.bullet{width:.4rem;min-height:.4rem;background:var(--color-text);outline:3px solid var(--color-text);border-radius:2rem;position:absolute}.hidden{opacity:0}.visible{opacity:1}.center{position:relative}.left-container{display:flex;justify-content:end;text-align:end;justify-self:end;flex-flow:column}\n"] }]
|
|
275
|
+
}], propDecorators: { wrapper: [{
|
|
276
|
+
type: ViewChild,
|
|
277
|
+
args: ['wrapper', { read: ElementRef }]
|
|
278
|
+
}], line: [{
|
|
279
|
+
type: ViewChild,
|
|
280
|
+
args: ['line', { read: ElementRef }]
|
|
281
|
+
}], children: [{
|
|
282
|
+
type: ViewChildren,
|
|
283
|
+
args: ['CronogramContent', { read: ElementRef }]
|
|
284
|
+
}], onScroll: [{
|
|
285
|
+
type: HostListener,
|
|
286
|
+
args: ['window:scroll', []]
|
|
287
|
+
}] } });
|
|
288
|
+
|
|
289
|
+
class MenuComponent {
|
|
290
|
+
cdr;
|
|
291
|
+
justifySelf = 'end';
|
|
292
|
+
menu = [];
|
|
293
|
+
direction = 'horizontal';
|
|
294
|
+
menuContainer;
|
|
295
|
+
unorderedList;
|
|
296
|
+
constructor(cdr) {
|
|
297
|
+
this.cdr = cdr;
|
|
298
|
+
}
|
|
299
|
+
collapsed = false;
|
|
300
|
+
listWidth = 0;
|
|
301
|
+
ngAfterViewInit() {
|
|
302
|
+
setTimeout(() => {
|
|
303
|
+
this.getWidth();
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
getWidth() {
|
|
307
|
+
const containerWidth = this.menuContainer.nativeElement.getBoundingClientRect().width;
|
|
308
|
+
if (!this.collapsed)
|
|
309
|
+
this.listWidth = this.unorderedList?.nativeElement?.scrollWidth;
|
|
310
|
+
this.collapsed = containerWidth < this.listWidth;
|
|
311
|
+
this.cdr.detectChanges();
|
|
312
|
+
console.log(containerWidth, this.listWidth, this.collapsed);
|
|
313
|
+
}
|
|
314
|
+
//#region overlay
|
|
315
|
+
overlay = inject(Overlay);
|
|
316
|
+
overlayRef;
|
|
317
|
+
menuOverlay; // Template del menú
|
|
318
|
+
trigger; // Botó
|
|
319
|
+
toggleMenu() {
|
|
320
|
+
console.log('toggleMenu');
|
|
321
|
+
this.overlayRef ? this.closeMenu() : this.openMenu();
|
|
322
|
+
}
|
|
323
|
+
viewContainerRef = inject(ViewContainerRef);
|
|
324
|
+
openMenu() {
|
|
325
|
+
const positionStrategy = this.overlay
|
|
326
|
+
.position()
|
|
327
|
+
.flexibleConnectedTo(this.trigger)
|
|
328
|
+
.withPositions([
|
|
329
|
+
{
|
|
330
|
+
originX: 'start',
|
|
331
|
+
originY: 'bottom',
|
|
332
|
+
overlayX: 'start',
|
|
333
|
+
overlayY: 'top'
|
|
334
|
+
}
|
|
335
|
+
]);
|
|
336
|
+
this.overlayRef = this.overlay.create({
|
|
337
|
+
positionStrategy,
|
|
338
|
+
hasBackdrop: true,
|
|
339
|
+
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
340
|
+
scrollStrategy: this.overlay.scrollStrategies.reposition()
|
|
341
|
+
});
|
|
342
|
+
this.overlayRef.backdropClick().subscribe(() => this.closeMenu());
|
|
343
|
+
const portal = new TemplatePortal(this.menuOverlay, this.viewContainerRef); // ✅ SI
|
|
344
|
+
this.overlayRef.attach(portal);
|
|
345
|
+
}
|
|
346
|
+
closeMenu() {
|
|
347
|
+
this.overlayRef?.dispose();
|
|
348
|
+
this.overlayRef = undefined;
|
|
349
|
+
}
|
|
350
|
+
action(value) {
|
|
351
|
+
console.log(value);
|
|
352
|
+
this.closeMenu();
|
|
353
|
+
}
|
|
354
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MenuComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
355
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.0", type: MenuComponent, isStandalone: true, selector: "ard-menu", inputs: { justifySelf: "justifySelf", menu: "menu", direction: "direction" }, host: { listeners: { "window:resize": "getWidth()" } }, viewQueries: [{ propertyName: "menuContainer", first: true, predicate: ["menuContainer"], descendants: true }, { propertyName: "unorderedList", first: true, predicate: ["unorderedList"], descendants: true }, { propertyName: "menuOverlay", first: true, predicate: ["menuOverlay"], descendants: true }, { propertyName: "trigger", first: true, predicate: ["overlayTrigger"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div #menuContainer id=\"menu-container\">\r\n @if(!collapsed) {\r\n <ul #unorderedList [style.flexFlow]=\"direction == 'horizontal' ? 'row' : 'column'\"\r\n [style.justifySelf]=\"justifySelf\">\r\n @for (i of menu; track i.label) {\r\n <li><a [href]=\"i.path\">{{i.label}}</a></li>\r\n }\r\n </ul>\r\n } @else {\r\n <button #overlayTrigger [style.justifySelf]=\"justifySelf\" (click)=\"toggleMenu()\">Menu</button>\r\n\r\n <ng-template #menuOverlay>\r\n <div id=\"dropdown\">\r\n @for (i of menu; track i.label) {\r\n <li><a [href]=\"i.path\">{{i.label}}</a></li>\r\n }\r\n </div>\r\n </ng-template>\r\n }\r\n\r\n</div>", styles: ["ul{list-style-type:none;display:flex;margin:0;padding:0}a{color:var(--menu-text);text-decoration:none;font-weight:400}a:hover{text-decoration:underline}button{display:flex;justify-self:end}li:after{content:\"\";margin-left:1rem}#menu-container{width:100%;height:100%;overflow:hidden}:host{width:100%;overflow:hidden}#dropdown{background:#fff;border-radius:1rem;border:1px solid black;padding:1rem;margin:0 1rem}#dropdown li{list-style-type:none}\n"] });
|
|
356
|
+
}
|
|
357
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MenuComponent, decorators: [{
|
|
358
|
+
type: Component,
|
|
359
|
+
args: [{ selector: 'ard-menu', template: "<div #menuContainer id=\"menu-container\">\r\n @if(!collapsed) {\r\n <ul #unorderedList [style.flexFlow]=\"direction == 'horizontal' ? 'row' : 'column'\"\r\n [style.justifySelf]=\"justifySelf\">\r\n @for (i of menu; track i.label) {\r\n <li><a [href]=\"i.path\">{{i.label}}</a></li>\r\n }\r\n </ul>\r\n } @else {\r\n <button #overlayTrigger [style.justifySelf]=\"justifySelf\" (click)=\"toggleMenu()\">Menu</button>\r\n\r\n <ng-template #menuOverlay>\r\n <div id=\"dropdown\">\r\n @for (i of menu; track i.label) {\r\n <li><a [href]=\"i.path\">{{i.label}}</a></li>\r\n }\r\n </div>\r\n </ng-template>\r\n }\r\n\r\n</div>", styles: ["ul{list-style-type:none;display:flex;margin:0;padding:0}a{color:var(--menu-text);text-decoration:none;font-weight:400}a:hover{text-decoration:underline}button{display:flex;justify-self:end}li:after{content:\"\";margin-left:1rem}#menu-container{width:100%;height:100%;overflow:hidden}:host{width:100%;overflow:hidden}#dropdown{background:#fff;border-radius:1rem;border:1px solid black;padding:1rem;margin:0 1rem}#dropdown li{list-style-type:none}\n"] }]
|
|
360
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { justifySelf: [{
|
|
361
|
+
type: Input
|
|
362
|
+
}], menu: [{
|
|
363
|
+
type: Input
|
|
364
|
+
}], direction: [{
|
|
365
|
+
type: Input
|
|
366
|
+
}], menuContainer: [{
|
|
367
|
+
type: ViewChild,
|
|
368
|
+
args: ['menuContainer']
|
|
369
|
+
}], unorderedList: [{
|
|
370
|
+
type: ViewChild,
|
|
371
|
+
args: ['unorderedList']
|
|
372
|
+
}], getWidth: [{
|
|
373
|
+
type: HostListener,
|
|
374
|
+
args: ['window:resize']
|
|
375
|
+
}], menuOverlay: [{
|
|
376
|
+
type: ViewChild,
|
|
377
|
+
args: ['menuOverlay']
|
|
378
|
+
}], trigger: [{
|
|
379
|
+
type: ViewChild,
|
|
380
|
+
args: ['overlayTrigger', { read: ElementRef }]
|
|
381
|
+
}] } });
|
|
382
|
+
|
|
383
|
+
class NavbarComponent {
|
|
384
|
+
nav;
|
|
385
|
+
navFiller;
|
|
386
|
+
navContent;
|
|
387
|
+
onScrollCallback;
|
|
388
|
+
type = 'regular';
|
|
389
|
+
sticky = true;
|
|
390
|
+
navHeight = '100vhh';
|
|
391
|
+
lastScrollY = 0;
|
|
392
|
+
initialNavHeight;
|
|
393
|
+
ngAfterViewInit() {
|
|
394
|
+
this.initialNavHeight = this.navFiller.nativeElement.offsetHeight;
|
|
395
|
+
}
|
|
396
|
+
onScroll() {
|
|
397
|
+
if (this.type == 'hero')
|
|
398
|
+
this.nav.nativeElement.style.height = `calc(${this.navHeight} - ${window.scrollY}px)`;
|
|
399
|
+
if (this.sticky == 'onScrollUp') {
|
|
400
|
+
this.nav.nativeElement.style.minHeight = window.scrollY < this.lastScrollY
|
|
401
|
+
? this.navContent.nativeElement.clientHeight + 'px'
|
|
402
|
+
: '0px';
|
|
403
|
+
this.lastScrollY = window.scrollY;
|
|
404
|
+
}
|
|
405
|
+
let navScrollRatio = window.scrollY / (this.initialNavHeight - 100); //100: alçada temptativa del navbar
|
|
406
|
+
navScrollRatio > 1 - this.nav.nativeElement.offsetHeight ? this.nav.nativeElement.style.transition = 'min-height 0.3s ease' : this.nav.nativeElement.style.transition = 'min-height 0s ease';
|
|
407
|
+
if (this.onScrollCallback)
|
|
408
|
+
this.onScrollCallback(navScrollRatio);
|
|
409
|
+
}
|
|
410
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: NavbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
411
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: NavbarComponent, isStandalone: true, selector: "ard-navbar", inputs: { onScrollCallback: "onScrollCallback", type: "type", sticky: "sticky", navHeight: "navHeight" }, host: { listeners: { "window:scroll": "onScroll()" } }, viewQueries: [{ propertyName: "nav", first: true, predicate: ["nav"], descendants: true }, { propertyName: "navFiller", first: true, predicate: ["navFiller"], descendants: true }, { propertyName: "navContent", first: true, predicate: ["navContent"], descendants: true }], ngImport: i0, template: "<div id=\"nav-container\" style=\"z-index: 1\">\r\n <nav #nav [style.height]=\"navHeight\" [style.minHeight]=\"sticky ? 'fit-content' : 0 \"\r\n [ngClass]=\"`nav_sticky--` + sticky\">\r\n <div #navContent id=\"nav-content\">\r\n <ng-content></ng-content>\r\n </div>\r\n </nav>\r\n</div>\r\n<div #navFiller id=\"nav-filler\" [style.height]=\"navHeight\">\r\n</div>", styles: [":host{width:100%}#nav-container{height:0;position:sticky;top:0;will-change:transform,opacity}#nav-container nav{will-change:transform,opacity;position:relative;bottom:0;will-change:transform;display:flex;flex-flow:column;justify-content:end;align-items:center;border-bottom:1px solid grey}#nav-container nav #nav-content{will-change:transform,opacity;min-height:fit-content;display:flex;width:100%;justify-content:center;align-items:center;flex:1}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
412
|
+
}
|
|
413
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: NavbarComponent, decorators: [{
|
|
414
|
+
type: Component,
|
|
415
|
+
args: [{ selector: 'ard-navbar', imports: [NgClass], standalone: true, template: "<div id=\"nav-container\" style=\"z-index: 1\">\r\n <nav #nav [style.height]=\"navHeight\" [style.minHeight]=\"sticky ? 'fit-content' : 0 \"\r\n [ngClass]=\"`nav_sticky--` + sticky\">\r\n <div #navContent id=\"nav-content\">\r\n <ng-content></ng-content>\r\n </div>\r\n </nav>\r\n</div>\r\n<div #navFiller id=\"nav-filler\" [style.height]=\"navHeight\">\r\n</div>", styles: [":host{width:100%}#nav-container{height:0;position:sticky;top:0;will-change:transform,opacity}#nav-container nav{will-change:transform,opacity;position:relative;bottom:0;will-change:transform;display:flex;flex-flow:column;justify-content:end;align-items:center;border-bottom:1px solid grey}#nav-container nav #nav-content{will-change:transform,opacity;min-height:fit-content;display:flex;width:100%;justify-content:center;align-items:center;flex:1}\n"] }]
|
|
416
|
+
}], propDecorators: { nav: [{
|
|
417
|
+
type: ViewChild,
|
|
418
|
+
args: ['nav']
|
|
419
|
+
}], navFiller: [{
|
|
420
|
+
type: ViewChild,
|
|
421
|
+
args: ['navFiller']
|
|
422
|
+
}], navContent: [{
|
|
423
|
+
type: ViewChild,
|
|
424
|
+
args: ['navContent']
|
|
425
|
+
}], onScrollCallback: [{
|
|
426
|
+
type: Input
|
|
427
|
+
}], type: [{
|
|
428
|
+
type: Input
|
|
429
|
+
}], sticky: [{
|
|
430
|
+
type: Input
|
|
431
|
+
}], navHeight: [{
|
|
432
|
+
type: Input
|
|
433
|
+
}], onScroll: [{
|
|
434
|
+
type: HostListener,
|
|
435
|
+
args: ['window:scroll', []]
|
|
436
|
+
}] } });
|
|
437
|
+
|
|
438
|
+
class PageLayoutComponent {
|
|
439
|
+
headerBackground = '';
|
|
440
|
+
title = 'Lorem ipsum';
|
|
441
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: PageLayoutComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
442
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: PageLayoutComponent, isStandalone: true, selector: "ard-page-layout", inputs: { headerBackground: "headerBackground", title: "title" }, ngImport: i0, template: "<header class=\"page-header\" [ngStyle]=\"{\r\n 'background': headerBackground\r\n ? `linear-gradient(color-mix(in srgb, var(--color-bg) 40%, transparent), color-mix(in srgb, var(--color-bg) 40%, transparent)),\r\n url('${headerBackground}') center/cover no-repeat`\r\n : 'none'\r\n }\" style=\"position: relative\">\r\n <div class=\"layout_max-width\">\r\n <h1>\r\n {{title}}\r\n </h1>\r\n </div>\r\n <div class=\"custom-shape-divider-top-1770151990\" style=\"position: absolute; bottom: 0; height: 25px; width: 100%\">\r\n <svg data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1200 120\" preserveAspectRatio=\"none\"\r\n style=\"height: 40px; width: 100%\">\r\n <path\r\n d=\"M985.66,92.83C906.67,72,823.78,31,743.84,14.19c-82.26-17.34-168.06-16.33-250.45.39-57.84,11.73-114,31.07-172,41.86A600.21,600.21,0,0,1,0,27.35V120H1200V95.8C1132.19,118.92,1055.71,111.31,985.66,92.83Z\"\r\n style=\"fill: var(--color-bg)\"></path>\r\n </svg>\r\n </div>\r\n</header>\r\n\r\n<main class=\"page-main\">\r\n <div class=\"layout_max-width\">\r\n <ng-content></ng-content>\r\n </div>\r\n</main>\r\n\r\n<section class=\"page-sections\">\r\n <div class=\"layout_max-width\">\r\n <ng-content select=\"[sections]\"></ng-content>\r\n </div>\r\n</section>", styles: [".page-header{height:66vh;background-size:cover;background-position:center;background-repeat:no-repeat;display:flex;align-items:center}.header-content{width:100%}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
443
|
+
}
|
|
444
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: PageLayoutComponent, decorators: [{
|
|
445
|
+
type: Component,
|
|
446
|
+
args: [{ selector: 'ard-page-layout', imports: [NgStyle,], template: "<header class=\"page-header\" [ngStyle]=\"{\r\n 'background': headerBackground\r\n ? `linear-gradient(color-mix(in srgb, var(--color-bg) 40%, transparent), color-mix(in srgb, var(--color-bg) 40%, transparent)),\r\n url('${headerBackground}') center/cover no-repeat`\r\n : 'none'\r\n }\" style=\"position: relative\">\r\n <div class=\"layout_max-width\">\r\n <h1>\r\n {{title}}\r\n </h1>\r\n </div>\r\n <div class=\"custom-shape-divider-top-1770151990\" style=\"position: absolute; bottom: 0; height: 25px; width: 100%\">\r\n <svg data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1200 120\" preserveAspectRatio=\"none\"\r\n style=\"height: 40px; width: 100%\">\r\n <path\r\n d=\"M985.66,92.83C906.67,72,823.78,31,743.84,14.19c-82.26-17.34-168.06-16.33-250.45.39-57.84,11.73-114,31.07-172,41.86A600.21,600.21,0,0,1,0,27.35V120H1200V95.8C1132.19,118.92,1055.71,111.31,985.66,92.83Z\"\r\n style=\"fill: var(--color-bg)\"></path>\r\n </svg>\r\n </div>\r\n</header>\r\n\r\n<main class=\"page-main\">\r\n <div class=\"layout_max-width\">\r\n <ng-content></ng-content>\r\n </div>\r\n</main>\r\n\r\n<section class=\"page-sections\">\r\n <div class=\"layout_max-width\">\r\n <ng-content select=\"[sections]\"></ng-content>\r\n </div>\r\n</section>", styles: [".page-header{height:66vh;background-size:cover;background-position:center;background-repeat:no-repeat;display:flex;align-items:center}.header-content{width:100%}\n"] }]
|
|
447
|
+
}], propDecorators: { headerBackground: [{
|
|
448
|
+
type: Input
|
|
449
|
+
}], title: [{
|
|
450
|
+
type: Input
|
|
451
|
+
}] } });
|
|
452
|
+
|
|
453
|
+
class ScrollReactiveSectionComponent {
|
|
454
|
+
container;
|
|
455
|
+
content;
|
|
456
|
+
ngAfterViewInit() {
|
|
457
|
+
this.update();
|
|
458
|
+
}
|
|
459
|
+
update() {
|
|
460
|
+
const containerEl = this.container.nativeElement;
|
|
461
|
+
const contentEl = this.content.nativeElement;
|
|
462
|
+
const rect = containerEl.getBoundingClientRect();
|
|
463
|
+
const viewportHeight = window.innerHeight;
|
|
464
|
+
const visibleTop = Math.max(rect.top, 0);
|
|
465
|
+
const visibleBottom = Math.min(rect.bottom, viewportHeight);
|
|
466
|
+
const visibleHeight = Math.max(0, visibleBottom - visibleTop);
|
|
467
|
+
const maxHeight = containerEl.offsetHeight;
|
|
468
|
+
const height = Math.min(visibleHeight, maxHeight);
|
|
469
|
+
contentEl.style.height = `${height}px`;
|
|
470
|
+
}
|
|
471
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ScrollReactiveSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
472
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: ScrollReactiveSectionComponent, isStandalone: true, selector: "ard-scroll-reactive-section", host: { listeners: { "window:scroll": "update()", "window:resize": "update()" } }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true }, { propertyName: "content", first: true, predicate: ["content"], descendants: true }], ngImport: i0, template: "<div style=\"position: sticky; top:0; height: 0; z-index: 0;\">\r\n <div #content\r\n style=\"background: gray; display: flex; justify-content: center; align-items: center;overflow: hidden;\">\r\n <ng-content></ng-content>\r\n\r\n </div>\r\n</div>\r\n<div style=\"position: relative; height: 100vh; pointer-events: none;\" #container>\r\n\r\n</div>" });
|
|
473
|
+
}
|
|
474
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ScrollReactiveSectionComponent, decorators: [{
|
|
475
|
+
type: Component,
|
|
476
|
+
args: [{ selector: 'ard-scroll-reactive-section', standalone: true, template: "<div style=\"position: sticky; top:0; height: 0; z-index: 0;\">\r\n <div #content\r\n style=\"background: gray; display: flex; justify-content: center; align-items: center;overflow: hidden;\">\r\n <ng-content></ng-content>\r\n\r\n </div>\r\n</div>\r\n<div style=\"position: relative; height: 100vh; pointer-events: none;\" #container>\r\n\r\n</div>" }]
|
|
477
|
+
}], propDecorators: { container: [{
|
|
478
|
+
type: ViewChild,
|
|
479
|
+
args: ['container']
|
|
480
|
+
}], content: [{
|
|
481
|
+
type: ViewChild,
|
|
482
|
+
args: ['content']
|
|
483
|
+
}], update: [{
|
|
484
|
+
type: HostListener,
|
|
485
|
+
args: ['window:scroll']
|
|
486
|
+
}, {
|
|
487
|
+
type: HostListener,
|
|
488
|
+
args: ['window:resize']
|
|
489
|
+
}] } });
|
|
490
|
+
|
|
491
|
+
class SectionComponent {
|
|
492
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
493
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: SectionComponent, isStandalone: true, selector: "ard-section", ngImport: i0, template: "<section class=\"layout_max-width\">\r\n <h2>Secci\u00F3</h2>\r\n <div style=\"display: flex;\">\r\n <!-- <app-bottle [color]=\"'#5b8940'\"></app-bottle> -->\r\n <!-- <app-bottle [color]=\"'#b4862a'\"></app-bottle>\r\n <app-bottle [color]=\"'#121e10'\"></app-bottle>\r\n <app-bottle [wineColor]=\"'#ffffff'\"></app-bottle> -->\r\n <!-- <app-bottle [color]=\"'#868132'\" [wineColor]=\"'#e2d744'\"></app-bottle> -->\r\n </div>\r\n</section>", styles: [""] });
|
|
494
|
+
}
|
|
495
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SectionComponent, decorators: [{
|
|
496
|
+
type: Component,
|
|
497
|
+
args: [{ selector: 'ard-section', imports: [], standalone: true, template: "<section class=\"layout_max-width\">\r\n <h2>Secci\u00F3</h2>\r\n <div style=\"display: flex;\">\r\n <!-- <app-bottle [color]=\"'#5b8940'\"></app-bottle> -->\r\n <!-- <app-bottle [color]=\"'#b4862a'\"></app-bottle>\r\n <app-bottle [color]=\"'#121e10'\"></app-bottle>\r\n <app-bottle [wineColor]=\"'#ffffff'\"></app-bottle> -->\r\n <!-- <app-bottle [color]=\"'#868132'\" [wineColor]=\"'#e2d744'\"></app-bottle> -->\r\n </div>\r\n</section>" }]
|
|
498
|
+
}] });
|
|
499
|
+
|
|
500
|
+
class StackCaroussel {
|
|
501
|
+
images = [];
|
|
502
|
+
atmospheric = false;
|
|
503
|
+
animating = false;
|
|
504
|
+
getOffset(index) {
|
|
505
|
+
return {
|
|
506
|
+
transform: `translate(${index * 16}px, ${index * 16}px)`,
|
|
507
|
+
zIndex: this.images.length - index,
|
|
508
|
+
opacity: this.atmospheric
|
|
509
|
+
? 1 - (this.images.length - index * 0.08)
|
|
510
|
+
: 1
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
rotateStack() {
|
|
514
|
+
if (this.animating || this.images.length === 0)
|
|
515
|
+
return;
|
|
516
|
+
this.animating = true;
|
|
517
|
+
const last = this.images[this.images.length - 1];
|
|
518
|
+
const rest = this.images.slice(0, this.images.length - 1);
|
|
519
|
+
// Fase 1
|
|
520
|
+
const el = document.querySelector('.img-last');
|
|
521
|
+
if (el) {
|
|
522
|
+
el.classList.add('move-out');
|
|
523
|
+
}
|
|
524
|
+
setTimeout(() => {
|
|
525
|
+
// Reordenem array
|
|
526
|
+
this.images = [last, ...rest];
|
|
527
|
+
setTimeout(() => {
|
|
528
|
+
this.animating = false;
|
|
529
|
+
}, 50);
|
|
530
|
+
}, 300);
|
|
531
|
+
}
|
|
532
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: StackCaroussel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
533
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: StackCaroussel, isStandalone: true, selector: "ard-stack-caroussel", inputs: { images: "images", atmospheric: "atmospheric" }, ngImport: i0, template: "<div class=\"stack-container\" (click)=\"rotateStack()\">\r\n <img *ngFor=\"let img of images; let i = index; let last = last\" [src]=\"img\" [ngStyle]=\"getOffset(i)\"\r\n [class.img-last]=\"last\" class=\"stack-image\" />\r\n</div>", styles: [":host{--anim-speed: .3s}.stack-container{position:relative;width:400px;height:400px;cursor:pointer}.stack-image{position:absolute;width:200px;height:200px;object-fit:cover;transition:transform var(--anim-speed) ease,opacity var(--anim-speed) ease}.stack-image.move-out{transform:translate(200px)!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
534
|
+
}
|
|
535
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: StackCaroussel, decorators: [{
|
|
536
|
+
type: Component,
|
|
537
|
+
args: [{ selector: 'ard-stack-caroussel', imports: [CommonModule], template: "<div class=\"stack-container\" (click)=\"rotateStack()\">\r\n <img *ngFor=\"let img of images; let i = index; let last = last\" [src]=\"img\" [ngStyle]=\"getOffset(i)\"\r\n [class.img-last]=\"last\" class=\"stack-image\" />\r\n</div>", styles: [":host{--anim-speed: .3s}.stack-container{position:relative;width:400px;height:400px;cursor:pointer}.stack-image{position:absolute;width:200px;height:200px;object-fit:cover;transition:transform var(--anim-speed) ease,opacity var(--anim-speed) ease}.stack-image.move-out{transform:translate(200px)!important}\n"] }]
|
|
538
|
+
}], propDecorators: { images: [{
|
|
539
|
+
type: Input
|
|
540
|
+
}], atmospheric: [{
|
|
541
|
+
type: Input
|
|
542
|
+
}] } });
|
|
543
|
+
|
|
544
|
+
class ThemeService {
|
|
545
|
+
ngOnInit() {
|
|
546
|
+
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
547
|
+
document.body.classList.toggle('dark', prefersDark);
|
|
548
|
+
}
|
|
549
|
+
toggle() {
|
|
550
|
+
document.body.classList.toggle('dark');
|
|
551
|
+
}
|
|
552
|
+
setDark() {
|
|
553
|
+
document.body.classList.add('dark');
|
|
554
|
+
}
|
|
555
|
+
setLight() {
|
|
556
|
+
document.body.classList.remove('dark');
|
|
557
|
+
}
|
|
558
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
559
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ThemeService, providedIn: 'root' });
|
|
560
|
+
}
|
|
561
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ThemeService, decorators: [{
|
|
562
|
+
type: Injectable,
|
|
563
|
+
args: [{ providedIn: 'root' }]
|
|
564
|
+
}] });
|
|
565
|
+
|
|
566
|
+
/*
|
|
567
|
+
* Public API Surface of @ardev/components
|
|
568
|
+
*/
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Generated bundle index. Do not edit.
|
|
572
|
+
*/
|
|
573
|
+
|
|
574
|
+
export { BottleComponent, CarousselComponent, CronogramComponent, MenuComponent, NavbarComponent, PageLayoutComponent, ScrollReactiveSectionComponent, SectionComponent, StackCaroussel, ThemeService };
|
|
575
|
+
//# sourceMappingURL=gardev-components.mjs.map
|