liqgui 0.1.0 → 0.1.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
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 bymehul
|
|
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.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseElement } from "../core/base-element.js";
|
|
2
2
|
import { glowCSS, createRipple } from "../core/glow.js";
|
|
3
|
-
import { springAnimate,
|
|
3
|
+
import { springAnimate, snappySpring } from "../core/spring-engine.js";
|
|
4
4
|
export class GlassButton extends BaseElement {
|
|
5
5
|
static get observedAttributes() {
|
|
6
6
|
return ["variant", "disabled", "loading"];
|
|
@@ -33,13 +33,14 @@ export class GlassButton extends BaseElement {
|
|
|
33
33
|
cursor: pointer;
|
|
34
34
|
overflow: hidden;
|
|
35
35
|
transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
|
|
36
|
+
will-change: transform;
|
|
36
37
|
}
|
|
37
38
|
button:hover {
|
|
38
39
|
border-color: rgba(255, 255, 255, 0.5);
|
|
39
40
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
|
|
40
41
|
}
|
|
41
42
|
button:focus-visible {
|
|
42
|
-
outline: 2px solid var(--lg-accent-focus
|
|
43
|
+
outline: 2px solid var(--lg-accent-focus);
|
|
43
44
|
outline-offset: 2px;
|
|
44
45
|
}
|
|
45
46
|
button:disabled {
|
|
@@ -98,14 +99,14 @@ export class GlassButton extends BaseElement {
|
|
|
98
99
|
const btn = this.root.querySelector("button");
|
|
99
100
|
// Spring press animation
|
|
100
101
|
btn.addEventListener("mousedown", () => {
|
|
101
|
-
springAnimate(1, 0.
|
|
102
|
+
springAnimate(1, 0.96, v => btn.style.transform = `scale(${v})`, snappySpring);
|
|
102
103
|
});
|
|
103
104
|
btn.addEventListener("mouseup", () => {
|
|
104
|
-
springAnimate(0.
|
|
105
|
+
springAnimate(0.96, 1, v => btn.style.transform = `scale(${v})`, snappySpring);
|
|
105
106
|
});
|
|
106
107
|
btn.addEventListener("mouseleave", () => {
|
|
107
108
|
var _a, _b;
|
|
108
|
-
springAnimate(parseFloat(((_b = (_a = btn.style.transform) === null || _a === void 0 ? void 0 : _a.match(/scale\(([\d.]+)\)/)) === null || _b === void 0 ? void 0 : _b[1]) || "1"), 1, v => btn.style.transform = `scale(${v})`,
|
|
109
|
+
springAnimate(parseFloat(((_b = (_a = btn.style.transform) === null || _a === void 0 ? void 0 : _a.match(/scale\(([\d.]+)\)/)) === null || _b === void 0 ? void 0 : _b[1]) || "1"), 1, v => btn.style.transform = `scale(${v})`, snappySpring);
|
|
109
110
|
});
|
|
110
111
|
// Ripple effect
|
|
111
112
|
btn.addEventListener("click", (e) => {
|
|
@@ -34,6 +34,7 @@ export class GlassModal extends BaseElement {
|
|
|
34
34
|
background: rgba(0, 0, 0, 0.6);
|
|
35
35
|
backdrop-filter: blur(4px);
|
|
36
36
|
-webkit-backdrop-filter: blur(4px);
|
|
37
|
+
will-change: opacity;
|
|
37
38
|
}
|
|
38
39
|
.panel {
|
|
39
40
|
position: relative;
|
|
@@ -44,7 +45,8 @@ export class GlassModal extends BaseElement {
|
|
|
44
45
|
border: 1px solid var(--lg-border);
|
|
45
46
|
box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
|
|
46
47
|
padding: 2rem;
|
|
47
|
-
|
|
48
|
+
width: min(100% - 2rem, 500px);
|
|
49
|
+
min-width: min(320px, 90vw);
|
|
48
50
|
max-width: 90vw;
|
|
49
51
|
max-height: 85vh;
|
|
50
52
|
overflow: auto;
|
|
@@ -29,10 +29,14 @@ export class GlassTabs extends BaseElement {
|
|
|
29
29
|
position: absolute;
|
|
30
30
|
top: 0.25rem;
|
|
31
31
|
bottom: 0.25rem;
|
|
32
|
+
left: 0;
|
|
33
|
+
width: 1px; /* Base width for scaling */
|
|
32
34
|
background: rgba(255, 255, 255, 0.15);
|
|
33
35
|
border-radius: calc(var(--lg-radius) - 4px);
|
|
34
36
|
transition: none;
|
|
35
37
|
pointer-events: none;
|
|
38
|
+
transform-origin: 0 0;
|
|
39
|
+
will-change: transform;
|
|
36
40
|
}
|
|
37
41
|
::slotted(button) {
|
|
38
42
|
position: relative;
|
|
@@ -50,6 +54,10 @@ export class GlassTabs extends BaseElement {
|
|
|
50
54
|
::slotted(button:hover) {
|
|
51
55
|
opacity: 1;
|
|
52
56
|
}
|
|
57
|
+
::slotted(button:focus-visible) {
|
|
58
|
+
outline: none;
|
|
59
|
+
background: rgba(255, 255, 255, 0.1);
|
|
60
|
+
}
|
|
53
61
|
::slotted(button[aria-selected="true"]) {
|
|
54
62
|
opacity: 1;
|
|
55
63
|
}
|
|
@@ -76,21 +84,33 @@ export class GlassTabs extends BaseElement {
|
|
|
76
84
|
// Animate indicator
|
|
77
85
|
const rect = tab.getBoundingClientRect();
|
|
78
86
|
const containerRect = this.getBoundingClientRect();
|
|
79
|
-
const
|
|
87
|
+
const relativeLeft = rect.left - containerRect.left;
|
|
80
88
|
const width = rect.width;
|
|
89
|
+
// We want to animate from current transform to new transform
|
|
90
|
+
// New transform: translate(relativeLeft px) scaleX(width)
|
|
91
|
+
// Note: The indicator has base width 1px, so scaleX = target width
|
|
81
92
|
if (animate && this.indicator) {
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
// Get current transform values
|
|
94
|
+
const style = window.getComputedStyle(this.indicator);
|
|
95
|
+
const matrix = new DOMMatrix(style.transform);
|
|
96
|
+
const currentX = matrix.e;
|
|
97
|
+
const currentScale = matrix.a;
|
|
98
|
+
springAnimate(currentX, relativeLeft, v => {
|
|
99
|
+
const currentWidth = parseFloat(this.indicator.getAttribute('data-width') || '0');
|
|
100
|
+
// We need to synchronize the two animations, but springAnimate runs independently.
|
|
101
|
+
// A better approach for concurrent related springs is needed,
|
|
102
|
+
// but for now we'll rely on the fact that both use the same physics config.
|
|
103
|
+
this.indicator.style.transform = `translateX(${v}px) scaleX(${currentWidth})`;
|
|
86
104
|
}, snappySpring);
|
|
87
|
-
springAnimate(
|
|
88
|
-
this.indicator.
|
|
105
|
+
springAnimate(currentScale, width, v => {
|
|
106
|
+
const currentPos = new DOMMatrix(getComputedStyle(this.indicator).transform).e;
|
|
107
|
+
this.indicator.setAttribute('data-width', v.toString());
|
|
108
|
+
this.indicator.style.transform = `translateX(${currentPos}px) scaleX(${v})`;
|
|
89
109
|
}, snappySpring);
|
|
90
110
|
}
|
|
91
111
|
else if (this.indicator) {
|
|
92
|
-
this.indicator.
|
|
93
|
-
this.indicator.style.
|
|
112
|
+
this.indicator.setAttribute('data-width', width.toString());
|
|
113
|
+
this.indicator.style.transform = `translateX(${relativeLeft}px) scaleX(${width})`;
|
|
94
114
|
}
|
|
95
115
|
// Dispatch event
|
|
96
116
|
this.dispatchEvent(new CustomEvent("change", {
|
package/package.json
CHANGED
package/src/styles/tokens.css
CHANGED
|
@@ -33,7 +33,8 @@ CSS
|
|
|
33
33
|
|
|
34
34
|
/* Default accent */
|
|
35
35
|
--lg-accent: var(--lg-accent-blue);
|
|
36
|
-
--lg-accent-focus:
|
|
36
|
+
--lg-accent-focus: rgba(90, 200, 250, 0.5);
|
|
37
|
+
--lg-focus-ring: 0 0 0 4px var(--lg-accent-focus);
|
|
37
38
|
|
|
38
39
|
/* Typography */
|
|
39
40
|
--lg-font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
|