ng-glass 0.0.2 → 0.0.3
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
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
`ng-glass` is a lightweight Angular library for creating beautiful glassmorphism effects in your applications. It provides a directive and a component to easily apply the glass effect to any element.
|
|
4
4
|
|
|
5
|
+
**[Live Demo →](https://ng-glass.netlify.app/)**
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ng-glass",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"homepage": "https://ng-glass.netlify.app/",
|
|
4
5
|
"peerDependencies": {
|
|
5
|
-
"@angular/common": "
|
|
6
|
-
"@angular/core": "
|
|
6
|
+
"@angular/common": ">=18.0.0",
|
|
7
|
+
"@angular/core": ">=18.0.0"
|
|
7
8
|
},
|
|
8
9
|
"dependencies": {
|
|
9
10
|
"tslib": "^2.3.0"
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
:host > div {
|
|
2
|
+
padding: 1.5rem;
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
.card-header {
|
|
2
|
-
padding-bottom:
|
|
3
|
-
|
|
6
|
+
padding-bottom: 12px;
|
|
7
|
+
margin-bottom: 4px;
|
|
8
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.15);
|
|
4
9
|
}
|
|
5
10
|
|
|
6
11
|
.card-body {
|
|
7
|
-
padding:
|
|
12
|
+
padding: 16px 0;
|
|
8
13
|
}
|
|
9
14
|
|
|
10
15
|
.card-footer {
|
|
11
|
-
padding-top:
|
|
12
|
-
|
|
16
|
+
padding-top: 12px;
|
|
17
|
+
margin-top: 4px;
|
|
18
|
+
border-top: 1px solid rgba(255, 255, 255, 0.15);
|
|
13
19
|
}
|
|
@@ -12,7 +12,7 @@ import { GlassDirective } from '../glass.directive';
|
|
|
12
12
|
export class GlassCardComponent {
|
|
13
13
|
blur = input<number>(10);
|
|
14
14
|
opacity = input<number>(0.15);
|
|
15
|
-
borderRadius = input
|
|
15
|
+
borderRadius = input<number>(16);
|
|
16
16
|
shadow = input<string>('0 4px 30px rgba(0, 0, 0, 0.1)');
|
|
17
17
|
gradient = input<string>('linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0))');
|
|
18
18
|
}
|
|
@@ -11,18 +11,23 @@ export class GlassDirective {
|
|
|
11
11
|
opacity = input(0.15);
|
|
12
12
|
borderRadius = input(10);
|
|
13
13
|
shadow = input('0 4px 30px rgba(0, 0, 0, 0.1)');
|
|
14
|
+
borderColor = input('rgba(255, 255, 255, 0.2)');
|
|
14
15
|
gradient = input('linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0))');
|
|
15
16
|
|
|
16
17
|
constructor(private elementRef: ElementRef, private renderer: Renderer2) {
|
|
17
18
|
this.el = this.elementRef.nativeElement;
|
|
18
19
|
|
|
19
20
|
effect(() => {
|
|
21
|
+
const op = this.opacity();
|
|
22
|
+
const computedGradient = this.gradient() !== 'linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0))'
|
|
23
|
+
? this.gradient()
|
|
24
|
+
: `linear-gradient(135deg, rgba(255,255,255,${op}), rgba(255,255,255,${(op * 0.5).toFixed(2)}))`;
|
|
20
25
|
this.renderer.setStyle(this.el, 'backdrop-filter', `blur(${this.blur()}px)`);
|
|
21
26
|
this.renderer.setStyle(this.el, '-webkit-backdrop-filter', `blur(${this.blur()}px)`);
|
|
22
|
-
this.renderer.setStyle(this.el, 'background',
|
|
27
|
+
this.renderer.setStyle(this.el, 'background', computedGradient);
|
|
23
28
|
this.renderer.setStyle(this.el, 'border-radius', `${this.borderRadius()}px`);
|
|
24
29
|
this.renderer.setStyle(this.el, 'box-shadow', this.shadow());
|
|
25
|
-
this.renderer.setStyle(this.el, 'border',
|
|
30
|
+
this.renderer.setStyle(this.el, 'border', `1px solid ${this.borderColor()}`);
|
|
26
31
|
});
|
|
27
32
|
}
|
|
28
33
|
}
|