vireglass 3.0.0 → 3.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/dist/dom.cjs +5 -3
- package/dist/dom.cjs.map +1 -1
- package/dist/dom.d.cts +1 -1
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +5 -3
- package/dist/dom.js.map +1 -1
- package/package.json +1 -1
- package/src/dom/index.ts +1 -1
- package/src/dom/rim.ts +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vireglass",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "A physically-derived liquid glass material for interfaces. One material model, three render targets: WebGL2, live DOM, and Android AGSL.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Danil Kotlaev",
|
package/src/dom/index.ts
CHANGED
|
@@ -548,7 +548,7 @@ export function attachGlass(el: HTMLElement, opts: AttachGlassOptions = {}): Gla
|
|
|
548
548
|
el.style.setProperty(
|
|
549
549
|
'--vireglass-rim',
|
|
550
550
|
(opts.accessibility ?? a11y).increaseContrast
|
|
551
|
-
? contrastRimCss(pole, contrastRimLuma(pole))
|
|
551
|
+
? contrastRimCss(pole, contrastRimLuma(pole), appear)
|
|
552
552
|
: rimGradientCss(opticsNow, [tr, tg, tb], opts.light ?? REST_LIGHT, appear),
|
|
553
553
|
);
|
|
554
554
|
el.style.setProperty('--vireglass-rim-width', `${RIM_WIDTH_PX}px`);
|
package/src/dom/rim.ts
CHANGED
|
@@ -129,10 +129,12 @@ export const RIM_WIDTH_PX = RIM.widthPx;
|
|
|
129
129
|
* everything around it. It has to hold at every angle, including the one facing away from the key
|
|
130
130
|
* light where the ordinary rim falls back to a dim dark line.
|
|
131
131
|
*/
|
|
132
|
-
export function contrastRimCss(bodyLuma: number, rimLuma: number): string {
|
|
132
|
+
export function contrastRimCss(bodyLuma: number, rimLuma: number, appear = 1): string {
|
|
133
133
|
const v = to255(rimLuma);
|
|
134
|
-
// Opaque on purpose. A border that lets the backdrop through is the
|
|
135
|
-
// to replace, and the body behind it is already at its own pole.
|
|
134
|
+
// Opaque on purpose once the element is there. A border that lets the backdrop through is the
|
|
135
|
+
// thing this setting exists to replace, and the body behind it is already at its own pole.
|
|
136
136
|
void bodyLuma;
|
|
137
|
-
|
|
137
|
+
const present = clamp01(appear);
|
|
138
|
+
const colour = present >= 1 ? `rgb(${v},${v},${v})` : `rgba(${v},${v},${v},${present.toFixed(3)})`;
|
|
139
|
+
return `conic-gradient(${colour} 0deg, ${colour} 360deg)`;
|
|
138
140
|
}
|