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.d.cts CHANGED
@@ -134,7 +134,7 @@ declare const RIM_WIDTH_PX: 1;
134
134
  * everything around it. It has to hold at every angle, including the one facing away from the key
135
135
  * light where the ordinary rim falls back to a dim dark line.
136
136
  */
137
- declare function contrastRimCss(bodyLuma: number, rimLuma: number): string;
137
+ declare function contrastRimCss(bodyLuma: number, rimLuma: number, appear?: number): string;
138
138
 
139
139
  declare function shadowAlphaFrom(sample: {
140
140
  busy: number;
package/dist/dom.d.ts CHANGED
@@ -134,7 +134,7 @@ declare const RIM_WIDTH_PX: 1;
134
134
  * everything around it. It has to hold at every angle, including the one facing away from the key
135
135
  * light where the ordinary rim falls back to a dim dark line.
136
136
  */
137
- declare function contrastRimCss(bodyLuma: number, rimLuma: number): string;
137
+ declare function contrastRimCss(bodyLuma: number, rimLuma: number, appear?: number): string;
138
138
 
139
139
  declare function shadowAlphaFrom(sample: {
140
140
  busy: number;
package/dist/dom.js CHANGED
@@ -557,9 +557,11 @@ function rimGradientCss(optics, ambient, light, appear = 1) {
557
557
  return `conic-gradient(from ${start.toFixed(1)}deg, ${line.join(", ")}), conic-gradient(${dark} 0deg, ${dark} 360deg)`;
558
558
  }
559
559
  var RIM_WIDTH_PX = RIM.widthPx;
560
- function contrastRimCss(bodyLuma, rimLuma) {
560
+ function contrastRimCss(bodyLuma, rimLuma, appear = 1) {
561
561
  const v = to2552(rimLuma);
562
- return `conic-gradient(rgb(${v},${v},${v}) 0deg, rgb(${v},${v},${v}) 360deg)`;
562
+ const present = clamp012(appear);
563
+ const colour = present >= 1 ? `rgb(${v},${v},${v})` : `rgba(${v},${v},${v},${present.toFixed(3)})`;
564
+ return `conic-gradient(${colour} 0deg, ${colour} 360deg)`;
563
565
  }
564
566
 
565
567
  // src/dom/nesting.ts
@@ -955,7 +957,7 @@ function attachGlass(el, opts = {}) {
955
957
  const pole = withPresence(resolveBody(opticsNow, sample, light ? 1 : 0), opticsNow).tintLuma;
956
958
  el.style.setProperty(
957
959
  "--vireglass-rim",
958
- (opts.accessibility ?? a11y).increaseContrast ? contrastRimCss(pole, contrastRimLuma(pole)) : rimGradientCss(opticsNow, [tr, tg, tb], opts.light ?? REST_LIGHT, appear)
960
+ (opts.accessibility ?? a11y).increaseContrast ? contrastRimCss(pole, contrastRimLuma(pole), appear) : rimGradientCss(opticsNow, [tr, tg, tb], opts.light ?? REST_LIGHT, appear)
959
961
  );
960
962
  el.style.setProperty("--vireglass-rim-width", `${RIM_WIDTH_PX}px`);
961
963
  el.style.setProperty("--vireglass-radius", `${geometry.cornerRadius}px`);