@mizuui/liquid-glass-core 0.1.2 → 0.1.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/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export interface LiquidGlassOptions {
10
10
  specular?: number
11
11
  resolution?: number
12
12
  fallbackBlur?: number
13
+ shadow?: boolean
13
14
  }
14
15
 
15
16
  export interface LiquidGlassInstance {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mizuui/liquid-glass-core",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Framework-agnostic liquid glass (real backdrop refraction, not frosted blur).",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/filter.js CHANGED
@@ -56,7 +56,7 @@ export function createGlassFilter(id) {
56
56
 
57
57
  const image = el('feImage', {
58
58
  result: 'map',
59
- // preserveAspectRatio: 'none',
59
+ preserveAspectRatio: 'none',
60
60
  x: '0',
61
61
  y: '0',
62
62
  width: String(map.displayWidth),
package/src/glass.js CHANGED
@@ -6,25 +6,27 @@ export const defaultOptions = {
6
6
  /** Corner radius in px. Keep in sync with any border-radius you set yourself. */
7
7
  radius: 30,
8
8
  /** Thickness of the refracting bevel in px. */
9
- depth: 30,
9
+ depth: 100,
10
10
  /** Maximum backdrop displacement in px. This is the strength of the lensing. */
11
- strength: 25,
11
+ strength: 15,
12
12
  /** Falloff curve of the bevel. Higher = the bend is pushed closer to the edge. */
13
13
  falloff: 2,
14
14
  /** Per-channel offset in px. Gives the prism fringe real glass has. */
15
15
  chromaticAberration: 0,
16
16
  /** Backdrop blur in px. Leave at 0 — blur is frosted glass, not liquid glass. */
17
- blur: 5,
17
+ blur: 3,
18
18
  /** Backdrop saturation multiplier. */
19
19
  saturation: 1,
20
20
  /** Backdrop brightness multiplier. */
21
21
  brightness: 1,
22
22
  /** Specular rim intensity, 0 disables it. */
23
- specular: 0.5,
23
+ specular: 0.2,
24
24
  /** Max pixel size of the generated displacement map. */
25
25
  resolution: 512,
26
26
  /** Blur used when the browser cannot run SVG filters in a backdrop-filter. */
27
27
  fallbackBlur: 8,
28
+ /** Whether to show a shadow around the glass pane. */
29
+ shadow: true,
28
30
  }
29
31
 
30
32
  let uid = 0
@@ -72,6 +74,13 @@ export function createLiquidGlass(element, options = {}) {
72
74
  element.style.setProperty('--lg-backdrop', layers.join(' ') || 'none')
73
75
  element.style.setProperty('--lg-radius', `${config.radius}px`)
74
76
  element.style.setProperty('--lg-specular', String(config.specular))
77
+
78
+ element.style.setProperty(
79
+ '--lg-shadow',
80
+ config.shadow
81
+ ? '0 0 40px rgba(8, 7, 16, 0.6)'
82
+ : 'none',
83
+ )
75
84
  }
76
85
 
77
86
  function render() {
@@ -132,6 +141,7 @@ export function createLiquidGlass(element, options = {}) {
132
141
  element.style.removeProperty('--lg-backdrop')
133
142
  element.style.removeProperty('--lg-radius')
134
143
  element.style.removeProperty('--lg-specular')
144
+ element.style.removeProperty('--lg-shadow');
135
145
  },
136
146
  }
137
147
  }
package/src/styles.js CHANGED
@@ -8,6 +8,7 @@ const CSS = `
8
8
  -webkit-backdrop-filter: var(--lg-backdrop, none);
9
9
  backdrop-filter: var(--lg-backdrop, none);
10
10
  transform: translateZ(0);
11
+ box-shadow: var(--lg-shadow, none);
11
12
  }
12
13
 
13
14
  .liquid-glass::after {