ngx-glassy-effect 0.0.22

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 ADDED
@@ -0,0 +1,3 @@
1
+ # NgxGlassyEffect
2
+
3
+ Hello world
@@ -0,0 +1,241 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ElementRef, DestroyRef, PLATFORM_ID, input, signal, effect, Directive } from '@angular/core';
3
+ import { isPlatformBrowser } from '@angular/common';
4
+
5
+ class GlassyEffect {
6
+ el = inject((ElementRef));
7
+ destroyRef = inject(DestroyRef);
8
+ platformId = inject(PLATFORM_ID);
9
+ isBrowser = isPlatformBrowser(this.platformId);
10
+ bezel = input(10, /* @ts-ignore */
11
+ ...(ngDevMode ? [{ debugName: "bezel" }] : /* istanbul ignore next */ []));
12
+ scale = input(50, /* @ts-ignore */
13
+ ...(ngDevMode ? [{ debugName: "scale" }] : /* istanbul ignore next */ []));
14
+ blur = input(1, /* @ts-ignore */
15
+ ...(ngDevMode ? [{ debugName: "blur" }] : /* istanbul ignore next */ []));
16
+ profile = input('squircle', /* @ts-ignore */
17
+ ...(ngDevMode ? [{ debugName: "profile" }] : /* istanbul ignore next */ []));
18
+ width = signal(0, /* @ts-ignore */
19
+ ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
20
+ height = signal(0, /* @ts-ignore */
21
+ ...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
22
+ filterId = `glassy-effect-${Math.random().toString(36).substring(2, 9)}`;
23
+ resizeObserver;
24
+ sharedCanvas = this.isBrowser ? document.createElement('canvas') : null;
25
+ borderLayer = null;
26
+ animationFrameId = null;
27
+ constructor() {
28
+ if (!this.isBrowser)
29
+ return;
30
+ this.setupResizeObserver();
31
+ effect(() => {
32
+ const w = Math.floor(this.width());
33
+ const h = Math.floor(this.height());
34
+ const bezel = this.bezel();
35
+ const scale = this.scale();
36
+ const blur = this.blur();
37
+ const profile = this.profile();
38
+ if (w === 0 || h === 0)
39
+ return;
40
+ const dataUrl = this.generateDisplacementMap(w, h, bezel, profile);
41
+ this.syncSvgFilter(dataUrl, w, h, scale, blur);
42
+ const nativeEl = this.el.nativeElement;
43
+ nativeEl.style.backdropFilter = `url(#${this.filterId})`;
44
+ this.applyAppleGlassLighting();
45
+ });
46
+ this.destroyRef.onDestroy(() => {
47
+ if (this.resizeObserver)
48
+ this.resizeObserver.disconnect();
49
+ if (this.animationFrameId)
50
+ cancelAnimationFrame(this.animationFrameId);
51
+ const svgEl = document.getElementById(`svg-container-${this.filterId}`);
52
+ if (svgEl)
53
+ svgEl.remove();
54
+ });
55
+ }
56
+ applyAppleGlassLighting() {
57
+ const nativeEl = this.el.nativeElement;
58
+ // Ensure containment context for the absolute border layer
59
+ const computedStyle = window.getComputedStyle(nativeEl);
60
+ if (computedStyle.position === 'static') {
61
+ nativeEl.style.position = 'relative';
62
+ }
63
+ nativeEl.style.border = 'none';
64
+ nativeEl.style.boxShadow = `
65
+ 0 4px 20px -2px rgba(0, 0, 0, 0.4),
66
+ 0 1px 3px 0 rgba(0, 0, 0, 0.2)
67
+ `;
68
+ if (!this.borderLayer) {
69
+ this.borderLayer = document.createElement('div');
70
+ this.borderLayer.style.position = 'absolute';
71
+ this.borderLayer.style.inset = '0px';
72
+ this.borderLayer.style.pointerEvents = 'none';
73
+ this.borderLayer.style.zIndex = '1';
74
+ this.borderLayer.style.webkitMask = 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)';
75
+ this.borderLayer.style.webkitMaskComposite = 'xor';
76
+ this.borderLayer.style.maskComposite = 'exclude';
77
+ this.borderLayer.style.padding = '1px';
78
+ nativeEl.appendChild(this.borderLayer);
79
+ }
80
+ this.borderLayer.style.borderRadius = computedStyle.borderRadius || 'inherit';
81
+ this.borderLayer.style.opacity = '0.85';
82
+ this.borderLayer.style.background = `
83
+ linear-gradient(135deg,
84
+ rgba(255, 255, 255, 0.45) 0%,
85
+ rgba(255, 255, 255, 0.05) 45%,
86
+ rgba(0, 0, 0, 0) 60%
87
+ ),
88
+ linear-gradient(to bottom,
89
+ rgba(255, 255, 255, 0.1) 0%,
90
+ rgba(0, 0, 0, 0.35) 100%
91
+ )
92
+ `;
93
+ }
94
+ setupResizeObserver() {
95
+ this.resizeObserver = new ResizeObserver(() => {
96
+ if (this.animationFrameId)
97
+ cancelAnimationFrame(this.animationFrameId);
98
+ this.animationFrameId = requestAnimationFrame(() => {
99
+ const rect = this.el.nativeElement.getBoundingClientRect();
100
+ this.width.set(rect.width);
101
+ this.height.set(rect.height);
102
+ });
103
+ });
104
+ this.resizeObserver.observe(this.el.nativeElement);
105
+ }
106
+ generateDisplacementMap(w, h, bezel, profile) {
107
+ const canvas = this.sharedCanvas;
108
+ if (!canvas)
109
+ return '';
110
+ canvas.width = w;
111
+ canvas.height = h;
112
+ const ctx = canvas.getContext('2d');
113
+ if (!ctx)
114
+ return '';
115
+ const imgData = ctx.createImageData(w, h);
116
+ const data = imgData.data;
117
+ for (let y = 0; y < h; y++) {
118
+ for (let x = 0; x < w; x++) {
119
+ const distL = x;
120
+ const distR = w - x;
121
+ const distT = y;
122
+ const distB = h - y;
123
+ let minDist = Math.min(distL, distR, distT, distB);
124
+ let nx = 0;
125
+ let ny = 0;
126
+ if (minDist < bezel) {
127
+ if (minDist === distL)
128
+ nx = 1;
129
+ else if (minDist === distR)
130
+ nx = -1;
131
+ else if (minDist === distT)
132
+ ny = 1;
133
+ else if (minDist === distB)
134
+ ny = -1;
135
+ if (x < bezel && y < bezel) {
136
+ const dist = Math.sqrt(Math.pow(bezel - x, 2) + Math.pow(bezel - y, 2));
137
+ minDist = bezel - dist;
138
+ if (dist > 0) {
139
+ nx = (bezel - x) / dist;
140
+ ny = (bezel - y) / dist;
141
+ }
142
+ }
143
+ else if (x > w - bezel && y < bezel) {
144
+ const dist = Math.sqrt(Math.pow(x - (w - bezel), 2) + Math.pow(bezel - y, 2));
145
+ minDist = bezel - dist;
146
+ if (dist > 0) {
147
+ nx = -(x - (w - bezel)) / dist;
148
+ ny = (bezel - y) / dist;
149
+ }
150
+ }
151
+ else if (x < bezel && y > h - bezel) {
152
+ const dist = Math.sqrt(Math.pow(bezel - x, 2) + Math.pow(y - (h - bezel), 2));
153
+ minDist = bezel - dist;
154
+ if (dist > 0) {
155
+ nx = (bezel - x) / dist;
156
+ ny = -(y - (h - bezel)) / dist;
157
+ }
158
+ }
159
+ else if (x > w - bezel && y > h - bezel) {
160
+ const dist = Math.sqrt(Math.pow(x - (w - bezel), 2) + Math.pow(y - (h - bezel), 2));
161
+ minDist = bezel - dist;
162
+ if (dist > 0) {
163
+ nx = -(x - (w - bezel)) / dist;
164
+ ny = -(y - (h - bezel)) / dist;
165
+ }
166
+ }
167
+ }
168
+ let t = Math.max(0, Math.min(1, minDist / bezel));
169
+ if (minDist < 0)
170
+ t = 0;
171
+ let slope = 0;
172
+ const om_t = 1 - t;
173
+ if (profile === 'circle') {
174
+ const heightVal = Math.sqrt(1 - om_t * om_t);
175
+ slope = heightVal > 0 ? om_t / heightVal : 0;
176
+ }
177
+ else {
178
+ const heightVal = Math.pow(1 - Math.pow(om_t, 4), 0.25);
179
+ slope = heightVal > 0 ? Math.pow(om_t, 3) / Math.pow(heightVal, 3) : 0;
180
+ }
181
+ const magnitudeClamp = Math.min(1, slope * 0.45);
182
+ const rVal = Math.floor(128 + nx * magnitudeClamp * 127);
183
+ const gVal = Math.floor(128 + ny * magnitudeClamp * 127);
184
+ const idx = (y * w + x) * 4;
185
+ data[idx] = rVal;
186
+ data[idx + 1] = gVal;
187
+ data[idx + 2] = 128;
188
+ data[idx + 3] = 255;
189
+ }
190
+ }
191
+ ctx.putImageData(imgData, 0, 0);
192
+ return canvas.toDataURL();
193
+ }
194
+ syncSvgFilter(dataUrl, w, h, scale, blur) {
195
+ let container = document.getElementById(`svg-container-${this.filterId}`);
196
+ if (!container) {
197
+ container = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
198
+ container.id = `svg-container-${this.filterId}`;
199
+ container.setAttribute('style', 'position: absolute; width: 0; height: 0; pointer-events: none;');
200
+ document.body.appendChild(container);
201
+ }
202
+ container.innerHTML = `
203
+ <filter id="${this.filterId}"
204
+ x="-10%" y="-10%" width="120%" height="120%"
205
+ primitiveUnits="userSpaceOnUse"
206
+ color-interpolation-filters="sRGB">
207
+
208
+ <feImage href="${dataUrl}" x="0" y="0" width="${w}" height="${h}" preserveAspectRatio="none" result="glass_map" />
209
+ <feGaussianBlur in="SourceGraphic" stdDeviation="${blur}" result="blurred_substrate" />
210
+
211
+ <feDisplacementMap
212
+ in="blurred_substrate"
213
+ in2="glass_map"
214
+ scale="${scale}"
215
+ xChannelSelector="R"
216
+ yChannelSelector="G"
217
+ />
218
+ </filter>
219
+ `;
220
+ }
221
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: GlassyEffect, deps: [], target: i0.ɵɵFactoryTarget.Directive });
222
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.0", type: GlassyEffect, isStandalone: true, selector: "[ngxGlassyEffect]", inputs: { bezel: { classPropertyName: "bezel", publicName: "bezel", isSignal: true, isRequired: false, transformFunction: null }, scale: { classPropertyName: "scale", publicName: "scale", isSignal: true, isRequired: false, transformFunction: null }, blur: { classPropertyName: "blur", publicName: "blur", isSignal: true, isRequired: false, transformFunction: null }, profile: { classPropertyName: "profile", publicName: "profile", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
223
+ }
224
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: GlassyEffect, decorators: [{
225
+ type: Directive,
226
+ args: [{
227
+ selector: '[ngxGlassyEffect]',
228
+ standalone: true
229
+ }]
230
+ }], ctorParameters: () => [], propDecorators: { bezel: [{ type: i0.Input, args: [{ isSignal: true, alias: "bezel", required: false }] }], scale: [{ type: i0.Input, args: [{ isSignal: true, alias: "scale", required: false }] }], blur: [{ type: i0.Input, args: [{ isSignal: true, alias: "blur", required: false }] }], profile: [{ type: i0.Input, args: [{ isSignal: true, alias: "profile", required: false }] }] } });
231
+
232
+ /*
233
+ * Public API Surface of ngx-glassy-effect
234
+ */
235
+
236
+ /**
237
+ * Generated bundle index. Do not edit.
238
+ */
239
+
240
+ export { GlassyEffect };
241
+ //# sourceMappingURL=ngx-glassy-effect.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-glassy-effect.mjs","sources":["../../../projects/ngx-glassy-effect/src/lib/glassy-effect.ts","../../../projects/ngx-glassy-effect/src/public-api.ts","../../../projects/ngx-glassy-effect/src/ngx-glassy-effect.ts"],"sourcesContent":["import { DestroyRef, Directive, ElementRef, inject, input, signal, effect, PLATFORM_ID } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\n@Directive({\n selector: '[ngxGlassyEffect]',\n standalone: true\n})\nexport class GlassyEffect {\n private el = inject(ElementRef<HTMLElement>);\n private destroyRef = inject(DestroyRef);\n private platformId = inject(PLATFORM_ID);\n private isBrowser = isPlatformBrowser(this.platformId);\n\n bezel = input<number>(10);\n scale = input<number>(50);\n blur = input<number>(1);\n profile = input<'circle' | 'squircle'>('squircle');\n\n private width = signal<number>(0);\n private height = signal<number>(0);\n\n private filterId = `glassy-effect-${Math.random().toString(36).substring(2, 9)}`;\n private resizeObserver!: ResizeObserver;\n\n private sharedCanvas = this.isBrowser ? document.createElement('canvas') : null;\n private borderLayer: HTMLDivElement | null = null;\n private animationFrameId: number | null = null;\n\n constructor() {\n if (!this.isBrowser) return;\n\n this.setupResizeObserver();\n\n effect(() => {\n const w = Math.floor(this.width());\n const h = Math.floor(this.height());\n const bezel = this.bezel();\n const scale = this.scale();\n const blur = this.blur();\n const profile = this.profile();\n\n if (w === 0 || h === 0) return;\n\n const dataUrl = this.generateDisplacementMap(w, h, bezel, profile);\n this.syncSvgFilter(dataUrl, w, h, scale, blur);\n\n const nativeEl = this.el.nativeElement;\n nativeEl.style.backdropFilter = `url(#${this.filterId})`;\n this.applyAppleGlassLighting();\n });\n\n this.destroyRef.onDestroy(() => {\n if (this.resizeObserver) this.resizeObserver.disconnect();\n if (this.animationFrameId) cancelAnimationFrame(this.animationFrameId);\n\n const svgEl = document.getElementById(`svg-container-${this.filterId}`);\n if (svgEl) svgEl.remove();\n });\n }\n\n private applyAppleGlassLighting(): void {\n const nativeEl = this.el.nativeElement;\n\n // Ensure containment context for the absolute border layer\n const computedStyle = window.getComputedStyle(nativeEl);\n if (computedStyle.position === 'static') {\n nativeEl.style.position = 'relative';\n }\n\n nativeEl.style.border = 'none';\n nativeEl.style.boxShadow = `\n 0 4px 20px -2px rgba(0, 0, 0, 0.4),\n 0 1px 3px 0 rgba(0, 0, 0, 0.2)\n `;\n\n if (!this.borderLayer) {\n this.borderLayer = document.createElement('div');\n this.borderLayer.style.position = 'absolute';\n this.borderLayer.style.inset = '0px';\n this.borderLayer.style.pointerEvents = 'none';\n this.borderLayer.style.zIndex = '1';\n this.borderLayer.style.webkitMask = 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)';\n this.borderLayer.style.webkitMaskComposite = 'xor';\n this.borderLayer.style.maskComposite = 'exclude';\n this.borderLayer.style.padding = '1px';\n nativeEl.appendChild(this.borderLayer);\n }\n\n this.borderLayer.style.borderRadius = computedStyle.borderRadius || 'inherit';\n this.borderLayer.style.opacity = '0.85';\n this.borderLayer.style.background = `\n linear-gradient(135deg,\n rgba(255, 255, 255, 0.45) 0%,\n rgba(255, 255, 255, 0.05) 45%,\n rgba(0, 0, 0, 0) 60%\n ),\n linear-gradient(to bottom,\n rgba(255, 255, 255, 0.1) 0%,\n rgba(0, 0, 0, 0.35) 100%\n )\n `;\n }\n\n private setupResizeObserver(): void {\n this.resizeObserver = new ResizeObserver(() => {\n if (this.animationFrameId) cancelAnimationFrame(this.animationFrameId);\n\n this.animationFrameId = requestAnimationFrame(() => {\n const rect = this.el.nativeElement.getBoundingClientRect();\n this.width.set(rect.width);\n this.height.set(rect.height);\n });\n });\n this.resizeObserver.observe(this.el.nativeElement);\n }\n\n private generateDisplacementMap(\n w: number,\n h: number,\n bezel: number,\n profile: 'circle' | 'squircle'\n ): string {\n const canvas = this.sharedCanvas;\n if (!canvas) return '';\n\n canvas.width = w;\n canvas.height = h;\n const ctx = canvas.getContext('2d');\n if (!ctx) return '';\n\n const imgData = ctx.createImageData(w, h);\n const data = imgData.data;\n\n for (let y = 0; y < h; y++) {\n for (let x = 0; x < w; x++) {\n const distL = x;\n const distR = w - x;\n const distT = y;\n const distB = h - y;\n\n let minDist = Math.min(distL, distR, distT, distB);\n let nx = 0;\n let ny = 0;\n\n if (minDist < bezel) {\n if (minDist === distL) nx = 1;\n else if (minDist === distR) nx = -1;\n else if (minDist === distT) ny = 1;\n else if (minDist === distB) ny = -1;\n\n if (x < bezel && y < bezel) {\n const dist = Math.sqrt(Math.pow(bezel - x, 2) + Math.pow(bezel - y, 2));\n minDist = bezel - dist;\n if (dist > 0) {\n nx = (bezel - x) / dist;\n ny = (bezel - y) / dist;\n }\n } else if (x > w - bezel && y < bezel) {\n const dist = Math.sqrt(Math.pow(x - (w - bezel), 2) + Math.pow(bezel - y, 2));\n minDist = bezel - dist;\n if (dist > 0) {\n nx = -(x - (w - bezel)) / dist;\n ny = (bezel - y) / dist;\n }\n } else if (x < bezel && y > h - bezel) {\n const dist = Math.sqrt(Math.pow(bezel - x, 2) + Math.pow(y - (h - bezel), 2));\n minDist = bezel - dist;\n if (dist > 0) {\n nx = (bezel - x) / dist;\n ny = -(y - (h - bezel)) / dist;\n }\n } else if (x > w - bezel && y > h - bezel) {\n const dist = Math.sqrt(Math.pow(x - (w - bezel), 2) + Math.pow(y - (h - bezel), 2));\n minDist = bezel - dist;\n if (dist > 0) {\n nx = -(x - (w - bezel)) / dist;\n ny = -(y - (h - bezel)) / dist;\n }\n }\n }\n\n let t = Math.max(0, Math.min(1, minDist / bezel));\n if (minDist < 0) t = 0;\n\n let slope = 0;\n const om_t = 1 - t;\n\n if (profile === 'circle') {\n const heightVal = Math.sqrt(1 - om_t * om_t);\n slope = heightVal > 0 ? om_t / heightVal : 0;\n } else {\n const heightVal = Math.pow(1 - Math.pow(om_t, 4), 0.25);\n slope = heightVal > 0 ? Math.pow(om_t, 3) / Math.pow(heightVal, 3) : 0;\n }\n\n const magnitudeClamp = Math.min(1, slope * 0.45);\n\n const rVal = Math.floor(128 + nx * magnitudeClamp * 127);\n const gVal = Math.floor(128 + ny * magnitudeClamp * 127);\n\n const idx = (y * w + x) * 4;\n data[idx] = rVal;\n data[idx + 1] = gVal;\n data[idx + 2] = 128;\n data[idx + 3] = 255;\n }\n }\n\n ctx.putImageData(imgData, 0, 0);\n return canvas.toDataURL();\n }\n\n private syncSvgFilter(dataUrl: string, w: number, h: number, scale: number, blur: number): void {\n let container: Element | null = document.getElementById(`svg-container-${this.filterId}`);\n\n if (!container) {\n container = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n container.id = `svg-container-${this.filterId}`;\n container.setAttribute('style', 'position: absolute; width: 0; height: 0; pointer-events: none;');\n document.body.appendChild(container);\n }\n\n container.innerHTML = `\n <filter id=\"${this.filterId}\"\n x=\"-10%\" y=\"-10%\" width=\"120%\" height=\"120%\"\n primitiveUnits=\"userSpaceOnUse\"\n color-interpolation-filters=\"sRGB\">\n\n <feImage href=\"${dataUrl}\" x=\"0\" y=\"0\" width=\"${w}\" height=\"${h}\" preserveAspectRatio=\"none\" result=\"glass_map\" />\n <feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"${blur}\" result=\"blurred_substrate\" />\n\n <feDisplacementMap\n in=\"blurred_substrate\"\n in2=\"glass_map\"\n scale=\"${scale}\"\n xChannelSelector=\"R\"\n yChannelSelector=\"G\"\n />\n </filter>\n `;\n }\n}\n","/*\n * Public API Surface of ngx-glassy-effect\n */\n\nexport * from './lib/glassy-effect';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAOa,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A,mBAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,IAAA,EAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAZ,YAAY,EAAA,UAAA,EAAA,CAAA;kBAJxB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,UAAU,EAAE;AACb,iBAAA;;;ACND;;AAEG;;ACFH;;AAEG;;;;"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "ngx-glassy-effect",
3
+ "version": "0.0.22",
4
+ "peerDependencies": {
5
+ "@angular/common": "^21.0.0",
6
+ "@angular/core": "^21.0.0"
7
+ },
8
+ "author": {
9
+ "name": "anassmdi",
10
+ "url": "https://github.com/anassmdi"
11
+ },
12
+ "license": "MIT",
13
+ "dependencies": {
14
+ "tslib": "^2.3.0"
15
+ },
16
+ "keywords": [
17
+ "angular",
18
+ "ngx",
19
+ "glassy",
20
+ "liquid-glass",
21
+ "ngx-glassy-effect",
22
+ "glass-effect",
23
+ "glassy-effect"
24
+ ],
25
+ "repository": {
26
+ "url": "https://github.com/anassmdi/ngx-glassy-effect",
27
+ "type": "git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/anassmdi/ngx-glassy-effect/issues"
31
+ },
32
+ "sideEffects": false,
33
+ "module": "fesm2022/ngx-glassy-effect.mjs",
34
+ "typings": "types/ngx-glassy-effect.d.ts",
35
+ "exports": {
36
+ "./package.json": {
37
+ "default": "./package.json"
38
+ },
39
+ ".": {
40
+ "types": "./types/ngx-glassy-effect.d.ts",
41
+ "default": "./fesm2022/ngx-glassy-effect.mjs"
42
+ }
43
+ },
44
+ "type": "module"
45
+ }
@@ -0,0 +1,28 @@
1
+ import * as _angular_core from '@angular/core';
2
+
3
+ declare class GlassyEffect {
4
+ private el;
5
+ private destroyRef;
6
+ private platformId;
7
+ private isBrowser;
8
+ bezel: _angular_core.InputSignal<number>;
9
+ scale: _angular_core.InputSignal<number>;
10
+ blur: _angular_core.InputSignal<number>;
11
+ profile: _angular_core.InputSignal<"circle" | "squircle">;
12
+ private width;
13
+ private height;
14
+ private filterId;
15
+ private resizeObserver;
16
+ private sharedCanvas;
17
+ private borderLayer;
18
+ private animationFrameId;
19
+ constructor();
20
+ private applyAppleGlassLighting;
21
+ private setupResizeObserver;
22
+ private generateDisplacementMap;
23
+ private syncSvgFilter;
24
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<GlassyEffect, never>;
25
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<GlassyEffect, "[ngxGlassyEffect]", never, { "bezel": { "alias": "bezel"; "required": false; "isSignal": true; }; "scale": { "alias": "scale"; "required": false; "isSignal": true; }; "blur": { "alias": "blur"; "required": false; "isSignal": true; }; "profile": { "alias": "profile"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
26
+ }
27
+
28
+ export { GlassyEffect };