@persian-caesar/liquid-glass 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +154 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sobhan (Sobhan-SRZA from Persian Caesar)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Liquid Glass
|
|
2
|
+
|
|
3
|
+
**Beautiful liquid-like glassmorphism effect for React** with real-time displacement distortion.
|
|
4
|
+
|
|
5
|
+
A lightweight, performant, and fully customizable React component that creates a stunning liquid glass / fluid glassmorphism effect using SVG filters and canvas-generated displacement maps.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
*(Replace with actual screenshot/GIF after adding one)*
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- ✨ Real-time liquid distortion effect
|
|
15
|
+
- 🎨 Highly customizable (blur, contrast, displacement, elasticity, etc.)
|
|
16
|
+
- 📏 Fully responsive with ResizeObserver
|
|
17
|
+
- ⚡ Lightweight & performant (uses SVG Filter + Canvas)
|
|
18
|
+
- 🔧 Full styling control — style the container however you want
|
|
19
|
+
- 📦 TypeScript support
|
|
20
|
+
- 🌳 Tree-shakable
|
|
21
|
+
- ⚛️ React 18 & 19 compatible
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @persian-caesar/liquid-glass
|
|
29
|
+
# or
|
|
30
|
+
yarn add @persian-caesar/liquid-glass
|
|
31
|
+
# or
|
|
32
|
+
pnpm add @persian-caesar/liquid-glass
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Quick Usage
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { LiquidGlass } from '@persian-caesar/liquid-glass';
|
|
41
|
+
|
|
42
|
+
function App() {
|
|
43
|
+
return (
|
|
44
|
+
<LiquidGlass
|
|
45
|
+
borderRadius={24}
|
|
46
|
+
blur={0.3}
|
|
47
|
+
className="w-full max-w-md p-8 text-white"
|
|
48
|
+
style={{
|
|
49
|
+
background: 'rgba(255, 255, 255, 0.08)',
|
|
50
|
+
backdropFilter: 'none', // will be overridden by component
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
<h1 className="text-3xl font-bold mb-4">Hello Liquid Glass</h1>
|
|
54
|
+
<p>Any content you want — fully stylable container.</p>
|
|
55
|
+
</LiquidGlass>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Props
|
|
63
|
+
|
|
64
|
+
| Prop | Type | Default | Description |
|
|
65
|
+
| ------------------- | --------------------- | ------- | ---------------------------------- |
|
|
66
|
+
| `borderRadius` | `number` | `20` | Border radius in pixels |
|
|
67
|
+
| `blur` | `number` | `0.25` | Backdrop blur intensity |
|
|
68
|
+
| `contrast` | `number` | `1.2` | Contrast adjustment |
|
|
69
|
+
| `brightness` | `number` | `1.05` | Brightness adjustment |
|
|
70
|
+
| `saturation` | `number` | `1.1` | Saturation adjustment |
|
|
71
|
+
| `shadowIntensity` | `number` | `0.25` | Shadow strength (0 = disabled) |
|
|
72
|
+
| `displacementScale` | `number` | `1` | Strength of liquid distortion |
|
|
73
|
+
| `elasticity` | `number` | `0.6` | How "liquid" the edges feel |
|
|
74
|
+
| `className` | `string` | `""` | Additional CSS classes |
|
|
75
|
+
| `style` | `React.CSSProperties` | `{}` | Custom styles (overrides internal) |
|
|
76
|
+
| `as` | `React.ElementType` | `"div"` | Render as different HTML element |
|
|
77
|
+
| `children` | `React.ReactNode` | - | Content inside the glass |
|
|
78
|
+
| `filterId` | `string` | auto | Custom filter ID (advanced) |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Advanced Example
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
<LiquidGlass
|
|
86
|
+
borderRadius={32}
|
|
87
|
+
blur={0.4}
|
|
88
|
+
contrast={1.3}
|
|
89
|
+
displacementScale={1.4}
|
|
90
|
+
elasticity={0.75}
|
|
91
|
+
shadowIntensity={0.15}
|
|
92
|
+
className="min-h-[400px] flex items-center justify-center"
|
|
93
|
+
style={{
|
|
94
|
+
background: 'linear-gradient(145deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05))',
|
|
95
|
+
color: 'white',
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
{/* Your content */}
|
|
99
|
+
</LiquidGlass>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Requirements
|
|
105
|
+
|
|
106
|
+
- **React**: `^18.0.0 || ^19.0.0`
|
|
107
|
+
- **React DOM**: `^18.0.0 || ^19.0.0`
|
|
108
|
+
- Modern browser with support for:
|
|
109
|
+
- `ResizeObserver`
|
|
110
|
+
- SVG Filters (`feDisplacementMap`)
|
|
111
|
+
- `backdrop-filter`
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Browser Support
|
|
116
|
+
|
|
117
|
+
Works in all modern browsers (Chrome, Firefox, Safari, Edge).
|
|
118
|
+
Older browsers will gracefully degrade to a simple glassmorphism look.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## How It Works
|
|
123
|
+
|
|
124
|
+
The component uses a combination of:
|
|
125
|
+
- Canvas to generate a dynamic displacement map
|
|
126
|
+
- SVG `<filter>` with `<feDisplacementMap>`
|
|
127
|
+
- `backdrop-filter` for blur + color adjustments
|
|
128
|
+
- `ResizeObserver` to adapt to container size
|
|
129
|
+
|
|
130
|
+
This creates a unique **liquid / fluid** distortion effect that reacts to the shape of your container.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Development
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
git clone https://github.com/Persian-Caesar/Liquid-Glass.git
|
|
138
|
+
cd Liquid-Glass
|
|
139
|
+
npm install
|
|
140
|
+
npm run dev # watch mode
|
|
141
|
+
npm run build # production build
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
[MIT License](./LICENSE)
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Author
|
|
153
|
+
|
|
154
|
+
Made with ❤️ by **[Persian-Caesar](https://github.com/persian-caesar/)**
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface LiquidGlassProps {
|
|
4
|
+
borderRadius?: number;
|
|
5
|
+
blur?: number;
|
|
6
|
+
contrast?: number;
|
|
7
|
+
brightness?: number;
|
|
8
|
+
saturation?: number;
|
|
9
|
+
shadowIntensity?: number;
|
|
10
|
+
displacementScale?: number;
|
|
11
|
+
elasticity?: number;
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
as?: React.ElementType;
|
|
16
|
+
filterId?: string;
|
|
17
|
+
}
|
|
18
|
+
declare const LiquidGlass: React.FC<LiquidGlassProps>;
|
|
19
|
+
|
|
20
|
+
export { LiquidGlass, type LiquidGlassProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useCallback as b,useEffect as T,useId as rt,useRef as d,useState as U}from"react";import{Fragment as it,jsx as l,jsxs as _}from"react/jsx-runtime";var at=({borderRadius:k=20,blur:A=.25,contrast:O=1.2,brightness:z=1.05,saturation:W=1.1,shadowIntensity:S=.25,displacementScale:w=1,elasticity:R=.6,className:B="",style:J={},children:K,as:Q="div",filterId:X})=>{let y=d(null),Y=d(null),v=d(null),G=d(null),$=d(null),Z=rt(),f=X||`liquid-glass-${Z.replace(/:/g,"-")}`,[u,j]=U(300),[h,tt]=U(200),m=1,x=b((t,n,s)=>(s=Math.max(0,Math.min(1,(s-t)/(n-t))),s*s*(3-2*s)),[]),q=b((t,n)=>Math.sqrt(t*t+n*n),[]),E=b((t,n,s,i,e)=>{let r=Math.abs(t)-s+e,o=Math.abs(n)-i+e;return Math.min(Math.max(r,o),0)+q(Math.max(r,0),Math.max(o,0))-e},[q]),I=b(()=>{let t=v.current,n=G.current,s=$.current;if(!t||!n||!s)return;let i=t.getContext("2d");if(!i)return;let e=Math.max(1,Math.floor(u*m)),r=Math.max(1,Math.floor(h*m));if(e<=0||r<=0)return;(t.width!==e||t.height!==r)&&(t.width=e,t.height=r);let o=new Uint8ClampedArray(e*r*4),c=0,M=[];for(let a=0;a<o.length;a+=4){let p=a/4%e,g=Math.floor(a/4/e),D={x:p/e,y:g/r},L=D.x-.5,F=D.y-.5,nt=E(L,F,.3,.2,R),st=x(.8,0,nt-.15),P=x(0,1,st),V={x:L*P+.5,y:F*P+.5},H=V.x*e-p,N=V.y*r-g;c=Math.max(c,Math.abs(H),Math.abs(N)),M.push(H,N)}c*=.5*w;let C=0;for(let a=0;a<o.length;a+=4){let p=M[C++]/c+.5,g=M[C++]/c+.5;o[a]=p*255,o[a+1]=g*255,o[a+2]=0,o[a+3]=255}i.putImageData(new ImageData(o,e,r),0,0),n.setAttributeNS("http://www.w3.org/1999/xlink","href",t.toDataURL()),s.setAttribute("scale",(c/m).toString())},[u,h,w,R,E,x]);T(()=>{let t=y.current;if(!t)return;let n=new ResizeObserver(s=>{for(let i of s){let{width:e,height:r}=i.contentRect;j(Math.max(e,100)),tt(Math.max(r,100))}});return n.observe(t),()=>n.disconnect()},[]),T(()=>{I()},[I]);let et={borderRadius:`${k}px`,backdropFilter:`url(#${f}_filter) blur(${A}px) contrast(${O}) brightness(${z}) saturate(${W})`,boxShadow:S>0?`0 4px 8px rgba(0, 0, 0, ${S}), 0 -10px 25px inset rgba(0, 0, 0, 0.15)`:void 0};return _(it,{children:[l("svg",{ref:Y,xmlns:"http://www.w3.org/2000/svg",width:"0",height:"0",style:{position:"fixed",top:0,left:0,pointerEvents:"none"},children:l("defs",{children:_("filter",{id:`${f}_filter`,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",x:"0",y:"0",width:u.toString(),height:h.toString(),children:[l("feImage",{ref:G,id:`${f}_map`,width:u.toString(),height:h.toString()}),l("feDisplacementMap",{ref:$,in:"SourceGraphic",in2:`${f}_map`,xChannelSelector:"R",yChannelSelector:"G"})]})})}),l("canvas",{ref:v,width:u*m,height:h*m,style:{display:"none"}}),l(Q,{ref:y,className:`liquid-glass ${B}`,style:{...et,...J},children:K})]})},ot=at;export{ot as LiquidGlass};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/LiquidGlass.tsx"],"sourcesContent":["import type React from \"react\";\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\";\n\nexport interface LiquidGlassProps {\n // Core effect options\n borderRadius?: number;\n blur?: number;\n contrast?: number;\n brightness?: number;\n saturation?: number;\n shadowIntensity?: number;\n displacementScale?: number;\n elasticity?: number;\n\n // Customization\n className?: string;\n style?: React.CSSProperties; \n children?: React.ReactNode;\n\n // Advanced\n as?: React.ElementType; \n filterId?: string; \n}\n\nconst LiquidGlass: React.FC<LiquidGlassProps> = ({\n borderRadius = 20,\n blur = 0.25,\n contrast = 1.2,\n brightness = 1.05,\n saturation = 1.1,\n shadowIntensity = 0.25,\n displacementScale = 1,\n elasticity = 0.6,\n\n className = \"\",\n style = {},\n children,\n as: Component = \"div\",\n filterId,\n}) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const svgRef = useRef<SVGSVGElement>(null);\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const feImageRef = useRef<SVGFEImageElement>(null);\n const feDisplacementMapRef = useRef<SVGFEDisplacementMapElement>(null);\n\n const reactId = useId();\n const id = filterId || `liquid-glass-${reactId.replace(/:/g, \"-\")}`;\n\n const [width, setWidth] = useState(300);\n const [height, setHeight] = useState(200);\n const canvasDPI = 1;\n\n // Utility functions (همان قبلیها)\n const smoothStep = useCallback((a: number, b: number, t: number) => {\n t = Math.max(0, Math.min(1, (t - a) / (b - a)));\n return t * t * (3 - 2 * t);\n }, []);\n\n const length = useCallback((x: number, y: number) => Math.sqrt(x * x + y * y), []);\n\n const roundedRectSDF = useCallback(\n (x: number, y: number, w: number, h: number, radius: number) => {\n const qx = Math.abs(x) - w + radius;\n const qy = Math.abs(y) - h + radius;\n return (\n Math.min(Math.max(qx, qy), 0) +\n length(Math.max(qx, 0), Math.max(qy, 0)) -\n radius\n );\n },\n [length]\n );\n\n const updateShader = useCallback(() => {\n // ... (کد updateShader قبلی بدون تغییر نگه داشته میشه)\n const canvas = canvasRef.current;\n const feImage = feImageRef.current;\n const feDisplacementMap = feDisplacementMapRef.current;\n if (!canvas || !feImage || !feDisplacementMap) return;\n\n const context = canvas.getContext(\"2d\");\n if (!context) return;\n\n const w = Math.max(1, Math.floor(width * canvasDPI));\n const h = Math.max(1, Math.floor(height * canvasDPI));\n\n if (w <= 0 || h <= 0) return;\n if (canvas.width !== w || canvas.height !== h) {\n canvas.width = w;\n canvas.height = h;\n }\n\n const data = new Uint8ClampedArray(w * h * 4);\n let maxScale = 0;\n const rawValues: number[] = [];\n\n for (let i = 0; i < data.length; i += 4) {\n const x = (i / 4) % w;\n const y = Math.floor(i / 4 / w);\n const uv = { x: x / w, y: y / h };\n\n const ix = uv.x - 0.5;\n const iy = uv.y - 0.5;\n const distanceToEdge = roundedRectSDF(ix, iy, 0.3, 0.2, elasticity);\n const displacement = smoothStep(0.8, 0, distanceToEdge - 0.15);\n const scaled = smoothStep(0, 1, displacement);\n\n const pos = {\n x: ix * scaled + 0.5,\n y: iy * scaled + 0.5,\n };\n\n const dx = pos.x * w - x;\n const dy = pos.y * h - y;\n\n maxScale = Math.max(maxScale, Math.abs(dx), Math.abs(dy));\n rawValues.push(dx, dy);\n }\n\n maxScale *= 0.5 * displacementScale;\n\n let index = 0;\n for (let i = 0; i < data.length; i += 4) {\n const r = rawValues[index++] / maxScale + 0.5;\n const g = rawValues[index++] / maxScale + 0.5;\n data[i] = r * 255;\n data[i + 1] = g * 255;\n data[i + 2] = 0;\n data[i + 3] = 255;\n }\n\n context.putImageData(new ImageData(data, w, h), 0, 0);\n feImage.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"href\", canvas.toDataURL());\n feDisplacementMap.setAttribute(\"scale\", (maxScale / canvasDPI).toString());\n }, [width, height, displacementScale, elasticity, roundedRectSDF, smoothStep]);\n\n // Resize Observer\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const { width: newWidth, height: newHeight } = entry.contentRect;\n setWidth(Math.max(newWidth, 100));\n setHeight(Math.max(newHeight, 100));\n }\n });\n\n resizeObserver.observe(container);\n return () => resizeObserver.disconnect();\n }, []);\n\n // Update shader when needed\n useEffect(() => {\n updateShader();\n }, [updateShader]);\n\n const filterStyle: React.CSSProperties = {\n borderRadius: `${borderRadius}px`,\n backdropFilter: `url(#${id}_filter) blur(${blur}px) contrast(${contrast}) brightness(${brightness}) saturate(${saturation})`,\n boxShadow: shadowIntensity > 0\n ? `0 4px 8px rgba(0, 0, 0, ${shadowIntensity}), 0 -10px 25px inset rgba(0, 0, 0, 0.15)`\n : undefined,\n };\n\n return (\n <>\n {/* SVG Filter - Hidden */}\n <svg\n ref={svgRef}\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"0\"\n height=\"0\"\n style={{ position: \"fixed\", top: 0, left: 0, pointerEvents: \"none\" }}\n >\n <defs>\n <filter\n id={`${id}_filter`}\n filterUnits=\"userSpaceOnUse\"\n colorInterpolationFilters=\"sRGB\"\n x=\"0\"\n y=\"0\"\n width={width.toString()}\n height={height.toString()}\n >\n <feImage ref={feImageRef} id={`${id}_map`} width={width.toString()} height={height.toString()} />\n <feDisplacementMap\n ref={feDisplacementMapRef}\n in=\"SourceGraphic\"\n in2={`${id}_map`}\n xChannelSelector=\"R\"\n yChannelSelector=\"G\"\n />\n </filter>\n </defs>\n </svg>\n\n {/* Hidden Canvas */}\n <canvas\n ref={canvasRef}\n width={width * canvasDPI}\n height={height * canvasDPI}\n style={{ display: \"none\" }}\n />\n\n {/* Main Glass Container - Fully Customizable */}\n <Component\n ref={containerRef}\n className={`liquid-glass ${className}`}\n style={{\n ...filterStyle,\n ...style, \n }}\n >\n {children}\n </Component>\n </>\n );\n};\n\nexport default LiquidGlass;"],"mappings":"AACA,OAAS,eAAAA,EAAa,aAAAC,EAAW,SAAAC,GAAO,UAAAC,EAAQ,YAAAC,MAAgB,QAuKxD,mBAAAC,GAmBgB,OAAAC,EATJ,QAAAC,MAVZ,oBAhJR,IAAMC,GAA0C,CAAC,CAC7C,aAAAC,EAAe,GACf,KAAAC,EAAO,IACP,SAAAC,EAAW,IACX,WAAAC,EAAa,KACb,WAAAC,EAAa,IACb,gBAAAC,EAAkB,IAClB,kBAAAC,EAAoB,EACpB,WAAAC,EAAa,GAEb,UAAAC,EAAY,GACZ,MAAAC,EAAQ,CAAC,EACT,SAAAC,EACA,GAAIC,EAAY,MAChB,SAAAC,CACJ,IAAM,CACF,IAAMC,EAAenB,EAAuB,IAAI,EAC1CoB,EAASpB,EAAsB,IAAI,EACnCqB,EAAYrB,EAA0B,IAAI,EAC1CsB,EAAatB,EAA0B,IAAI,EAC3CuB,EAAuBvB,EAAoC,IAAI,EAE/DwB,EAAUzB,GAAM,EAChB0B,EAAKP,GAAY,gBAAgBM,EAAQ,QAAQ,KAAM,GAAG,CAAC,GAE3D,CAACE,EAAOC,CAAQ,EAAI1B,EAAS,GAAG,EAChC,CAAC2B,EAAQC,EAAS,EAAI5B,EAAS,GAAG,EAClC6B,EAAY,EAGZC,EAAalC,EAAY,CAACmC,EAAWC,EAAWC,KAClDA,EAAI,KAAK,IAAI,EAAG,KAAK,IAAI,GAAIA,EAAIF,IAAMC,EAAID,EAAE,CAAC,EACvCE,EAAIA,GAAK,EAAI,EAAIA,IACzB,CAAC,CAAC,EAECC,EAAStC,EAAY,CAACuC,EAAWC,IAAc,KAAK,KAAKD,EAAIA,EAAIC,EAAIA,CAAC,EAAG,CAAC,CAAC,EAE3EC,EAAiBzC,EACnB,CAACuC,EAAWC,EAAWE,EAAWC,EAAWC,IAAmB,CAC5D,IAAMC,EAAK,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,CAAC,EAGLnE,EAAU,IAAM,CACZ8C,EAAa,CACjB,EAAG,CAACA,CAAY,CAAC,EAEjB,IAAM0B,GAAmC,CACrC,aAAc,GAAGhE,CAAY,KAC7B,eAAgB,QAAQmB,CAAE,iBAAiBlB,CAAI,gBAAgBC,CAAQ,gBAAgBC,CAAU,cAAcC,CAAU,IACzH,UAAWC,EAAkB,EACvB,2BAA2BA,CAAe,4CAC1C,MACV,EAEA,OACIP,EAAAF,GAAA,CAEI,UAAAC,EAAC,OACG,IAAKiB,EACL,MAAM,6BACN,MAAM,IACN,OAAO,IACP,MAAO,CAAE,SAAU,QAAS,IAAK,EAAG,KAAM,EAAG,cAAe,MAAO,EAEnE,SAAAjB,EAAC,QACG,SAAAC,EAAC,UACG,GAAI,GAAGqB,CAAE,UACT,YAAY,iBACZ,0BAA0B,OAC1B,EAAE,IACF,EAAE,IACF,MAAOC,EAAM,SAAS,EACtB,OAAQE,EAAO,SAAS,EAExB,UAAAzB,EAAC,WAAQ,IAAKmB,EAAY,GAAI,GAAGG,CAAE,OAAQ,MAAOC,EAAM,SAAS,EAAG,OAAQE,EAAO,SAAS,EAAG,EAC/FzB,EAAC,qBACG,IAAKoB,EACL,GAAG,gBACH,IAAK,GAAGE,CAAE,OACV,iBAAiB,IACjB,iBAAiB,IACrB,GACJ,EACJ,EACJ,EAGAtB,EAAC,UACG,IAAKkB,EACL,MAAOK,EAAQI,EACf,OAAQF,EAASE,EACjB,MAAO,CAAE,QAAS,MAAO,EAC7B,EAGA3B,EAACc,EAAA,CACG,IAAKE,EACL,UAAW,gBAAgBL,CAAS,GACpC,MAAO,CACH,GAAGwD,GACH,GAAGvD,CACP,EAEC,SAAAC,EACL,GACJ,CAER,EAEOuD,GAAQlE","names":["useCallback","useEffect","useId","useRef","useState","Fragment","jsx","jsxs","LiquidGlass","borderRadius","blur","contrast","brightness","saturation","shadowIntensity","displacementScale","elasticity","className","style","children","Component","filterId","containerRef","svgRef","canvasRef","feImageRef","feDisplacementMapRef","reactId","id","width","setWidth","height","setHeight","canvasDPI","smoothStep","a","b","t","length","x","y","roundedRectSDF","w","h","radius","qx","qy","updateShader","canvas","feImage","feDisplacementMap","context","data","maxScale","rawValues","i","uv","ix","iy","distanceToEdge","displacement","scaled","pos","dx","dy","index","r","container","resizeObserver","entries","entry","newWidth","newHeight","filterStyle","LiquidGlass_default"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@persian-caesar/liquid-glass",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Liquid Glass effect component for React - Beautiful glassmorphism with displacement distortion.",
|
|
5
|
+
"author": "Sobhan-SRZA (mr.sinre) & Persian Caesar",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/Persian-Caesar/Liquid-Glass.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/Persian-Caesar/Liquid-Glass#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/Persian-Caesar/Liquid-Glass/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "dist/index.js",
|
|
17
|
+
"module": "dist/index.js",
|
|
18
|
+
"types": "dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js",
|
|
23
|
+
"require": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsup",
|
|
32
|
+
"dev": "tsup --watch",
|
|
33
|
+
"clean": "rm -rf dist",
|
|
34
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
38
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"typescript": "^5.8.0",
|
|
42
|
+
"tsup": "^8.4.0",
|
|
43
|
+
"@types/react": "^19.0.0",
|
|
44
|
+
"@types/react-dom": "^19.0.0"
|
|
45
|
+
},
|
|
46
|
+
"keywords": [
|
|
47
|
+
"react",
|
|
48
|
+
"component",
|
|
49
|
+
"reactjs",
|
|
50
|
+
"ts",
|
|
51
|
+
"typescript",
|
|
52
|
+
"liquid",
|
|
53
|
+
"glass",
|
|
54
|
+
"liquidglass",
|
|
55
|
+
"liquid-glass",
|
|
56
|
+
"glassmorphism",
|
|
57
|
+
"ui-effect",
|
|
58
|
+
"displacement",
|
|
59
|
+
"svg-filter",
|
|
60
|
+
"persian-caesar",
|
|
61
|
+
"sobhan-srza",
|
|
62
|
+
"framer-motion-alternative"
|
|
63
|
+
]
|
|
64
|
+
}
|