@shulya/liquid-glass 0.0.0-stage → 1.0.1
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 +338 -2
- package/dist/angular.cjs +78 -0
- package/dist/angular.mjs +76 -0
- package/dist/core.cjs +1126 -0
- package/dist/core.mjs +1126 -0
- package/dist/index.cjs +17 -0
- package/dist/index.mjs +15 -0
- package/dist/react.cjs +105 -0
- package/dist/react.mjs +106 -0
- package/dist/solid.cjs +82 -0
- package/dist/solid.mjs +80 -0
- package/dist/svelte.cjs +29 -0
- package/dist/svelte.mjs +27 -0
- package/dist/tables.cjs +14 -0
- package/dist/tables.mjs +14 -0
- package/dist/vue.cjs +94 -0
- package/dist/vue.mjs +92 -0
- package/example/README.md +38 -0
- package/example/index.html +15 -0
- package/example/package.json +27 -0
- package/example/src/App.jsx +398 -0
- package/example/src/main.jsx +10 -0
- package/example/src/styles.css +158 -0
- package/example/vite.config.js +22 -0
- package/package.json +114 -4
- package/screen.png +0 -0
- package/src/angular.js +76 -0
- package/src/core.js +1126 -0
- package/src/index.js +15 -0
- package/src/react.js +106 -0
- package/src/solid.js +80 -0
- package/src/svelte.js +27 -0
- package/src/tables.js +14 -0
- package/src/vue.js +92 -0
- package/tables/optical_calibration_matrix.csv +257 -0
- package/tables/optical_calibration_matrix.xlsx +0 -0
- package/types/angular.d.ts +24 -0
- package/types/index.d.ts +80 -0
- package/types/react.d.ts +29 -0
- package/types/solid.d.ts +14 -0
- package/types/svelte.d.ts +15 -0
- package/types/vue.d.ts +19 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
*,
|
|
2
|
+
*::before,
|
|
3
|
+
*::after {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
margin: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
html,
|
|
10
|
+
body,
|
|
11
|
+
#root {
|
|
12
|
+
position: fixed;
|
|
13
|
+
inset: 0;
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
background: #ebedf2;
|
|
18
|
+
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", sans-serif;
|
|
19
|
+
user-select: none;
|
|
20
|
+
-webkit-user-select: none;
|
|
21
|
+
touch-action: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.stage-canvas {
|
|
25
|
+
position: fixed;
|
|
26
|
+
top: 0;
|
|
27
|
+
left: 0;
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
display: block;
|
|
31
|
+
z-index: 1;
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Interactive Draggable LiquidGlass Elements */
|
|
36
|
+
.glass-body {
|
|
37
|
+
position: fixed;
|
|
38
|
+
top: 0;
|
|
39
|
+
left: 0;
|
|
40
|
+
z-index: 20;
|
|
41
|
+
cursor: grab;
|
|
42
|
+
touch-action: none;
|
|
43
|
+
will-change: left, top;
|
|
44
|
+
box-shadow: 2px 10px 18px rgba(0, 0, 0, 0.12);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.glass-body:active {
|
|
48
|
+
cursor: grabbing;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Bottom Control Shelf */
|
|
52
|
+
.shelf-bar {
|
|
53
|
+
position: fixed;
|
|
54
|
+
bottom: 20px;
|
|
55
|
+
left: 50%;
|
|
56
|
+
transform: translateX(-50%);
|
|
57
|
+
z-index: 60;
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
gap: 18px;
|
|
61
|
+
padding: 10px 20px;
|
|
62
|
+
border-radius: 999px;
|
|
63
|
+
background: rgba(255, 255, 255, 0.8);
|
|
64
|
+
backdrop-filter: blur(20px) saturate(180%);
|
|
65
|
+
-webkit-backdrop-filter: blur(20px) saturate(180%);
|
|
66
|
+
border: 1px solid rgba(255, 255, 255, 0.9);
|
|
67
|
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.07), 0 2px 6px rgba(0, 0, 0, 0.03);
|
|
68
|
+
color: #1c1c1e;
|
|
69
|
+
flex-wrap: wrap;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
max-width: 95vw;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.ctrl {
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
gap: 4px;
|
|
78
|
+
min-width: 110px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ctrl-head {
|
|
82
|
+
display: flex;
|
|
83
|
+
justify-content: space-between;
|
|
84
|
+
font-size: 10.5px;
|
|
85
|
+
font-weight: 600;
|
|
86
|
+
color: #636366;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.ctrl-val {
|
|
90
|
+
color: #007aff;
|
|
91
|
+
font-variant-numeric: tabular-nums;
|
|
92
|
+
font-weight: 700;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
input[type="range"] {
|
|
96
|
+
-webkit-appearance: none;
|
|
97
|
+
appearance: none;
|
|
98
|
+
width: 100%;
|
|
99
|
+
height: 4px;
|
|
100
|
+
border-radius: 999px;
|
|
101
|
+
background: rgba(0, 0, 0, 0.1);
|
|
102
|
+
outline: none;
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
input[type="range"]::-webkit-slider-thumb {
|
|
107
|
+
-webkit-appearance: none;
|
|
108
|
+
appearance: none;
|
|
109
|
+
width: 14px;
|
|
110
|
+
height: 14px;
|
|
111
|
+
border-radius: 50%;
|
|
112
|
+
background: #ffffff;
|
|
113
|
+
border: 1.5px solid rgba(0, 122, 255, 0.6);
|
|
114
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.ctrl-toggle {
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
gap: 6px;
|
|
121
|
+
font-size: 11px;
|
|
122
|
+
font-weight: 600;
|
|
123
|
+
color: #3a3a3c;
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
padding: 4px 10px;
|
|
126
|
+
border-radius: 999px;
|
|
127
|
+
background: rgba(0, 0, 0, 0.04);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.ctrl-toggle input {
|
|
131
|
+
accent-color: #007aff;
|
|
132
|
+
width: 13px;
|
|
133
|
+
height: 13px;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.fps-tag {
|
|
138
|
+
font-size: 10.5px;
|
|
139
|
+
font-weight: 700;
|
|
140
|
+
color: #30d158;
|
|
141
|
+
background: rgba(48, 209, 88, 0.12);
|
|
142
|
+
padding: 4px 10px;
|
|
143
|
+
border-radius: 999px;
|
|
144
|
+
font-variant-numeric: tabular-nums;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@media (max-width: 720px) {
|
|
148
|
+
.shelf-bar {
|
|
149
|
+
gap: 10px;
|
|
150
|
+
padding: 10px 14px;
|
|
151
|
+
border-radius: 20px;
|
|
152
|
+
bottom: 12px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.ctrl {
|
|
156
|
+
min-width: 96px;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
plugins: [react()],
|
|
10
|
+
resolve: {
|
|
11
|
+
alias: {
|
|
12
|
+
'@shulya/liquid-glass/react': path.resolve(__dirname, '../dist/react.mjs'),
|
|
13
|
+
'@shulya/liquid-glass': path.resolve(__dirname, '../dist/index.mjs'),
|
|
14
|
+
'liquid-glass-ui/react': path.resolve(__dirname, '../dist/react.mjs'),
|
|
15
|
+
'liquid-glass-ui': path.resolve(__dirname, '../dist/index.mjs')
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
server: {
|
|
19
|
+
port: 5173,
|
|
20
|
+
open: false
|
|
21
|
+
}
|
|
22
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,116 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shulya/liquid-glass",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "High-performance, zero-WebGL Liquid Glass optical UI engine with pre-computed empirical lookup tables for React, Vue, Svelte, Angular, SolidJS, and Vanilla JS.",
|
|
5
|
+
"author": "Shulya (https://shulya.tech)",
|
|
6
|
+
"homepage": "https://liquid.shulya.tech",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/shulya-tech/liquid-glass.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/shulya-tech/liquid-glass/issues"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"liquid-glass",
|
|
16
|
+
"glassmorphism",
|
|
17
|
+
"optical-ui",
|
|
18
|
+
"refraction",
|
|
19
|
+
"apple-glass",
|
|
20
|
+
"react",
|
|
21
|
+
"vue",
|
|
22
|
+
"svelte",
|
|
23
|
+
"angular",
|
|
24
|
+
"solidjs",
|
|
25
|
+
"zero-webgl"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"main": "./dist/index.cjs",
|
|
29
|
+
"module": "./dist/index.mjs",
|
|
30
|
+
"types": "./types/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./types/index.d.ts",
|
|
34
|
+
"import": "./dist/index.mjs",
|
|
35
|
+
"require": "./dist/index.cjs"
|
|
36
|
+
},
|
|
37
|
+
"./react": {
|
|
38
|
+
"types": "./types/react.d.ts",
|
|
39
|
+
"import": "./dist/react.mjs",
|
|
40
|
+
"require": "./dist/react.cjs"
|
|
41
|
+
},
|
|
42
|
+
"./vue": {
|
|
43
|
+
"types": "./types/vue.d.ts",
|
|
44
|
+
"import": "./dist/vue.mjs",
|
|
45
|
+
"require": "./dist/vue.cjs"
|
|
46
|
+
},
|
|
47
|
+
"./svelte": {
|
|
48
|
+
"types": "./types/svelte.d.ts",
|
|
49
|
+
"import": "./dist/svelte.mjs",
|
|
50
|
+
"require": "./dist/svelte.cjs"
|
|
51
|
+
},
|
|
52
|
+
"./angular": {
|
|
53
|
+
"types": "./types/angular.d.ts",
|
|
54
|
+
"import": "./dist/angular.mjs",
|
|
55
|
+
"require": "./dist/angular.cjs"
|
|
56
|
+
},
|
|
57
|
+
"./solid": {
|
|
58
|
+
"types": "./types/solid.d.ts",
|
|
59
|
+
"import": "./dist/solid.mjs",
|
|
60
|
+
"require": "./dist/solid.cjs"
|
|
61
|
+
},
|
|
62
|
+
"./tables": {
|
|
63
|
+
"import": "./dist/tables.mjs",
|
|
64
|
+
"require": "./dist/tables.cjs"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"files": [
|
|
68
|
+
"dist",
|
|
69
|
+
"src",
|
|
70
|
+
"types",
|
|
71
|
+
"example/index.html",
|
|
72
|
+
"example/package.json",
|
|
73
|
+
"example/vite.config.js",
|
|
74
|
+
"example/README.md",
|
|
75
|
+
"example/src",
|
|
76
|
+
"tables/optical_calibration_matrix.xlsx",
|
|
77
|
+
"tables/optical_calibration_matrix.csv",
|
|
78
|
+
"screen.png",
|
|
79
|
+
"README.md",
|
|
80
|
+
"LICENSE"
|
|
81
|
+
],
|
|
82
|
+
"publishConfig": {
|
|
83
|
+
"access": "public"
|
|
84
|
+
},
|
|
85
|
+
"scripts": {
|
|
86
|
+
"build": "node build.mjs",
|
|
87
|
+
"example": "cd example && npm install && npm run dev",
|
|
88
|
+
"prepublishOnly": "node build.mjs"
|
|
89
|
+
},
|
|
90
|
+
"peerDependencies": {
|
|
91
|
+
"@angular/core": ">=14.0.0",
|
|
92
|
+
"react": ">=17.0.0",
|
|
93
|
+
"solid-js": ">=1.5.0",
|
|
94
|
+
"svelte": ">=3.0.0",
|
|
95
|
+
"vue": ">=3.0.0"
|
|
96
|
+
},
|
|
97
|
+
"peerDependenciesMeta": {
|
|
98
|
+
"@angular/core": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
101
|
+
"react": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
104
|
+
"solid-js": {
|
|
105
|
+
"optional": true
|
|
106
|
+
},
|
|
107
|
+
"svelte": {
|
|
108
|
+
"optional": true
|
|
109
|
+
},
|
|
110
|
+
"vue": {
|
|
111
|
+
"optional": true
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"sideEffects": false,
|
|
115
|
+
"license": "MIT"
|
|
116
|
+
}
|
package/screen.png
ADDED
|
Binary file
|
package/src/angular.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular Adapter for Liquid Glass UI
|
|
3
|
+
*/
|
|
4
|
+
import { LiquidGlassController, OPTICAL_DEFAULTS, OPTICAL_LIMITS } from './core.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Framework-agnostic Angular Directive Controller Class
|
|
8
|
+
* Can be used directly with Angular's @Directive({ selector: '[liquidGlass]', standalone: true })
|
|
9
|
+
* or instantiated via ElementRef in any Angular component.
|
|
10
|
+
*/
|
|
11
|
+
export class LiquidGlassDirective {
|
|
12
|
+
/**
|
|
13
|
+
* @param {{ nativeElement: HTMLElement } | HTMLElement} elementRef
|
|
14
|
+
*/
|
|
15
|
+
constructor(elementRef) {
|
|
16
|
+
this.el = elementRef && elementRef.nativeElement ? elementRef.nativeElement : elementRef;
|
|
17
|
+
this.rim = OPTICAL_DEFAULTS.rim;
|
|
18
|
+
this.ior = OPTICAL_DEFAULTS.ior;
|
|
19
|
+
this.height = OPTICAL_DEFAULTS.height;
|
|
20
|
+
this.frosted = OPTICAL_DEFAULTS.frosted;
|
|
21
|
+
this.fusion = OPTICAL_DEFAULTS.fusion;
|
|
22
|
+
this.borderRadius = null;
|
|
23
|
+
this.liquidGlass = null;
|
|
24
|
+
this._controller = null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ngOnInit() {
|
|
28
|
+
const opts =
|
|
29
|
+
typeof this.liquidGlass === 'object' && this.liquidGlass !== null
|
|
30
|
+
? this.liquidGlass
|
|
31
|
+
: {
|
|
32
|
+
rim: this.rim,
|
|
33
|
+
ior: this.ior,
|
|
34
|
+
height: this.height,
|
|
35
|
+
frosted: this.frosted,
|
|
36
|
+
fusion: this.fusion,
|
|
37
|
+
borderRadius: this.borderRadius
|
|
38
|
+
};
|
|
39
|
+
this._controller = new LiquidGlassController(this.el, opts);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
ngOnChanges() {
|
|
43
|
+
if (this._controller) {
|
|
44
|
+
const opts =
|
|
45
|
+
typeof this.liquidGlass === 'object' && this.liquidGlass !== null
|
|
46
|
+
? this.liquidGlass
|
|
47
|
+
: {
|
|
48
|
+
rim: this.rim,
|
|
49
|
+
ior: this.ior,
|
|
50
|
+
height: this.height,
|
|
51
|
+
frosted: this.frosted,
|
|
52
|
+
fusion: this.fusion,
|
|
53
|
+
borderRadius: this.borderRadius
|
|
54
|
+
};
|
|
55
|
+
this._controller.update(opts);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
ngOnDestroy() {
|
|
60
|
+
if (this._controller) {
|
|
61
|
+
this._controller.destroy();
|
|
62
|
+
this._controller = null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Helper to attach LiquidGlass directly inside Angular ngAfterViewInit
|
|
69
|
+
*/
|
|
70
|
+
export function attachAngularLiquidGlass(elementRef, options = {}) {
|
|
71
|
+
const el = elementRef && elementRef.nativeElement ? elementRef.nativeElement : elementRef;
|
|
72
|
+
return new LiquidGlassController(el, options);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { LiquidGlassController, OPTICAL_DEFAULTS, OPTICAL_LIMITS };
|
|
76
|
+
export default LiquidGlassDirective;
|