@mizuui/liquid-glass-vue 0.1.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/README.md +44 -0
- package/index.d.ts +11 -0
- package/lib/liquid-glass-vue.es.js +61 -0
- package/lib/liquid-glass-vue.umd.js +1 -0
- package/package.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# mizuui-liquid-glass-vue
|
|
2
|
+
|
|
3
|
+
`<LiquidGlass>` for Vue 3. Wrap anything and it sits on a pane of real glass —
|
|
4
|
+
the backdrop is refracted through a bevel, not blurred into frost.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm install mizuui-liquid-glass-vue
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
Per-component:
|
|
13
|
+
|
|
14
|
+
```vue
|
|
15
|
+
<script setup>
|
|
16
|
+
import { LiquidGlass } from "mizuui-liquid-glass-vue";
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<LiquidGlass :radius="28" :strength="80">
|
|
21
|
+
<h1>Anything in here sits on glass</h1>
|
|
22
|
+
</LiquidGlass>
|
|
23
|
+
</template>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or register it globally so the tag is available everywhere:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
import { createApp } from "vue";
|
|
30
|
+
import LiquidGlassPlugin from "mizuui-liquid-glass-vue";
|
|
31
|
+
|
|
32
|
+
createApp(App).use(LiquidGlassPlugin).mount("#app");
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Props
|
|
36
|
+
|
|
37
|
+
All [`mizuui-liquid-glass-core`](../mizuui-liquid-glass-core/README.md) options are exposed as
|
|
38
|
+
props: `radius`, `depth`, `strength`, `falloff`, `chromaticAberration`, `blur`,
|
|
39
|
+
`saturation`, `brightness`, `specular`, `resolution`, `fallbackBlur`.
|
|
40
|
+
|
|
41
|
+
`as` changes the rendered tag (default `div`).
|
|
42
|
+
|
|
43
|
+
The effect needs something behind it to bend, and the element sizes itself from
|
|
44
|
+
its content — give it padding and a width like any other element.
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DefineComponent, Plugin } from 'vue'
|
|
2
|
+
import type { LiquidGlassOptions } from 'mizuui-liquid-glass-core'
|
|
3
|
+
|
|
4
|
+
export interface LiquidGlassProps extends LiquidGlassOptions {
|
|
5
|
+
as?: string | object
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export declare const LiquidGlass: DefineComponent<LiquidGlassProps>
|
|
9
|
+
|
|
10
|
+
declare const plugin: Plugin
|
|
11
|
+
export default plugin
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ref as n, onMounted as i, watch as f, onBeforeUnmount as c, createBlock as d, openBlock as p, resolveDynamicComponent as m, withCtx as b, renderSlot as h } from "vue";
|
|
2
|
+
import { defaultOptions as t, createLiquidGlass as y } from "mizuui-liquid-glass-core";
|
|
3
|
+
const N = {
|
|
4
|
+
__name: "LiquidGlass",
|
|
5
|
+
props: {
|
|
6
|
+
/** Element or component to render as the glass surface. */
|
|
7
|
+
as: { type: [String, Object], default: "div" },
|
|
8
|
+
radius: { type: Number, default: t.radius },
|
|
9
|
+
depth: { type: Number, default: t.depth },
|
|
10
|
+
strength: { type: Number, default: t.strength },
|
|
11
|
+
falloff: { type: Number, default: t.falloff },
|
|
12
|
+
chromaticAberration: { type: Number, default: t.chromaticAberration },
|
|
13
|
+
blur: { type: Number, default: t.blur },
|
|
14
|
+
saturation: { type: Number, default: t.saturation },
|
|
15
|
+
brightness: { type: Number, default: t.brightness },
|
|
16
|
+
specular: { type: Number, default: t.specular },
|
|
17
|
+
resolution: { type: Number, default: t.resolution },
|
|
18
|
+
fallbackBlur: { type: Number, default: t.fallbackBlur }
|
|
19
|
+
},
|
|
20
|
+
setup(l, { expose: s }) {
|
|
21
|
+
const e = l, u = n(null);
|
|
22
|
+
let a = null;
|
|
23
|
+
const o = () => ({
|
|
24
|
+
radius: e.radius,
|
|
25
|
+
depth: e.depth,
|
|
26
|
+
strength: e.strength,
|
|
27
|
+
falloff: e.falloff,
|
|
28
|
+
chromaticAberration: e.chromaticAberration,
|
|
29
|
+
blur: e.blur,
|
|
30
|
+
saturation: e.saturation,
|
|
31
|
+
brightness: e.brightness,
|
|
32
|
+
specular: e.specular,
|
|
33
|
+
resolution: e.resolution,
|
|
34
|
+
fallbackBlur: e.fallbackBlur
|
|
35
|
+
});
|
|
36
|
+
return i(() => {
|
|
37
|
+
const r = u.value instanceof HTMLElement ? u.value : u.value?.$el;
|
|
38
|
+
r instanceof HTMLElement && (a = y(r, o()));
|
|
39
|
+
}), f(o, (r) => a?.update(r)), c(() => {
|
|
40
|
+
a?.destroy(), a = null;
|
|
41
|
+
}), s({
|
|
42
|
+
refresh: () => a?.refresh()
|
|
43
|
+
}), (r, g) => (p(), d(m(l.as), {
|
|
44
|
+
ref_key: "root",
|
|
45
|
+
ref: u
|
|
46
|
+
}, {
|
|
47
|
+
default: b(() => [
|
|
48
|
+
h(r.$slots, "default")
|
|
49
|
+
]),
|
|
50
|
+
_: 3
|
|
51
|
+
}, 512));
|
|
52
|
+
}
|
|
53
|
+
}, L = {
|
|
54
|
+
install(l, s = {}) {
|
|
55
|
+
l.component(s.name ?? "LiquidGlass", N);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
N as LiquidGlass,
|
|
60
|
+
L as default
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(u,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("mizuui-liquid-glass-core")):typeof define=="function"&&define.amd?define(["exports","vue","mizuui-liquid-glass-core"],e):(u=typeof globalThis<"u"?globalThis:u||self,e(u.LiquidGlassVue={},u.Vue,u.LiquidGlassCore))})(this,function(u,e,t){"use strict";const f={__name:"LiquidGlass",props:{as:{type:[String,Object],default:"div"},radius:{type:Number,default:t.defaultOptions.radius},depth:{type:Number,default:t.defaultOptions.depth},strength:{type:Number,default:t.defaultOptions.strength},falloff:{type:Number,default:t.defaultOptions.falloff},chromaticAberration:{type:Number,default:t.defaultOptions.chromaticAberration},blur:{type:Number,default:t.defaultOptions.blur},saturation:{type:Number,default:t.defaultOptions.saturation},brightness:{type:Number,default:t.defaultOptions.brightness},specular:{type:Number,default:t.defaultOptions.specular},resolution:{type:Number,default:t.defaultOptions.resolution},fallbackBlur:{type:Number,default:t.defaultOptions.fallbackBlur}},setup(l,{expose:s}){const n=l,o=e.ref(null);let r=null;const i=()=>({radius:n.radius,depth:n.depth,strength:n.strength,falloff:n.falloff,chromaticAberration:n.chromaticAberration,blur:n.blur,saturation:n.saturation,brightness:n.brightness,specular:n.specular,resolution:n.resolution,fallbackBlur:n.fallbackBlur});return e.onMounted(()=>{const a=o.value instanceof HTMLElement?o.value:o.value?.$el;a instanceof HTMLElement&&(r=t.createLiquidGlass(a,i()))}),e.watch(i,a=>r?.update(a)),e.onBeforeUnmount(()=>{r?.destroy(),r=null}),s({refresh:()=>r?.refresh()}),(a,p)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.as),{ref_key:"root",ref:o},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"default")]),_:3},512))}},d={install(l,s={}){l.component(s.name??"LiquidGlass",f)}};u.LiquidGlass=f,u.default=d,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mizuui/liquid-glass-vue",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A <LiquidGlass> component for Vue 3. Anything inside the tag sits on real refracting glass.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "./lib/mizuui-liquid-glass-vue.umd.js",
|
|
8
|
+
"module": "./lib/mizuui-liquid-glass-vue.es.js",
|
|
9
|
+
"types": "./index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./index.d.ts",
|
|
13
|
+
"import": "./lib/mizuui-liquid-glass-vue.es.js",
|
|
14
|
+
"require": "./lib/mizuui-liquid-glass-vue.umd.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"lib",
|
|
19
|
+
"index.d.ts",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "vite build"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@mizuui/liquid-glass-core": "0.1.0"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"vue": "^3.4.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@vitejs/plugin-vue": "^6.0.0",
|
|
33
|
+
"vite": "^7.0.0"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"vue",
|
|
37
|
+
"vue3",
|
|
38
|
+
"liquid-glass",
|
|
39
|
+
"glassmorphism",
|
|
40
|
+
"refraction"
|
|
41
|
+
]
|
|
42
|
+
}
|