@boyernick/standard-ui-react 0.4.2-canary.66 → 0.4.2-canary.67
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/package.json
CHANGED
|
@@ -18,6 +18,13 @@ export interface GlassConfig {
|
|
|
18
18
|
rim?: number;
|
|
19
19
|
/** Rim light width. Default 3.5, less on small panes. */
|
|
20
20
|
rimWidth?: number;
|
|
21
|
+
/**
|
|
22
|
+
* A hairline shade just inside the outline, deepest away from the light.
|
|
23
|
+
* On a light page the rim light has nothing to brighten, so without it a
|
|
24
|
+
* pane's only edge is its soft shadow. Default 0.16 over a light ground,
|
|
25
|
+
* 0 over a dark one.
|
|
26
|
+
*/
|
|
27
|
+
edge?: number;
|
|
21
28
|
/** Specular sheen on the lit side of the bezel. Default 0.35. */
|
|
22
29
|
specular?: number;
|
|
23
30
|
/** Frost blur, as a Gaussian sigma. Default 3. */
|
|
@@ -94,6 +101,7 @@ export interface ResolvedGlass {
|
|
|
94
101
|
dispersionBlue: number;
|
|
95
102
|
rim: number;
|
|
96
103
|
rimWidth: number;
|
|
104
|
+
edge: number;
|
|
97
105
|
specular: number;
|
|
98
106
|
frost: number;
|
|
99
107
|
grain: number;
|
|
@@ -144,6 +152,7 @@ export function resolveGlass(
|
|
|
144
152
|
dispersionBlue: pick(config.dispersionBlue, 0.8, 0, 1),
|
|
145
153
|
rim: pick(config.rim, 0.5, 0, 2),
|
|
146
154
|
rimWidth: pick(config.rimWidth, Math.min(3.5, Math.max(1.25, short * 0.04)), 0.5, 12),
|
|
155
|
+
edge: pick(config.edge, options?.lightGround ? 0.16 : 0, 0, 1),
|
|
147
156
|
specular: pick(config.specular, 0.35, 0, 2),
|
|
148
157
|
frost: pick(config.frost, 3, 0, 16),
|
|
149
158
|
grain: pick(config.grain, 0.07, 0, 0.5),
|
|
@@ -765,7 +765,7 @@ export function createLensGlass({ root, glassElements, defaults = {} }: LensGlas
|
|
|
765
765
|
["u_radius", glass.radius], ["u_power", glass.power], ["u_bezel", glass.bezel],
|
|
766
766
|
["u_bend", glass.bend], ["u_dispersionRed", glass.dispersionRed],
|
|
767
767
|
["u_dispersionBlue", glass.dispersionBlue], ["u_rim", glass.rim],
|
|
768
|
-
["u_rimWidth", glass.rimWidth], ["u_specular", glass.specular], ["u_frost", glass.frost],
|
|
768
|
+
["u_rimWidth", glass.rimWidth], ["u_edge", glass.edge], ["u_specular", glass.specular], ["u_frost", glass.frost],
|
|
769
769
|
["u_grain", glass.grain], ["u_dim", glass.dim], ["u_fadeStart", glass.fadeStart],
|
|
770
770
|
["u_fadeEnd", glass.fadeEnd], ["u_shadow", glass.shadow],
|
|
771
771
|
["u_hover", glass.button ? pane.hover : 0], ["u_press", glass.button ? pane.press : 0],
|
|
@@ -31,6 +31,7 @@ uniform float u_dispersionRed;
|
|
|
31
31
|
uniform float u_dispersionBlue;
|
|
32
32
|
uniform float u_rim;
|
|
33
33
|
uniform float u_rimWidth;
|
|
34
|
+
uniform float u_edge;
|
|
34
35
|
uniform float u_specular;
|
|
35
36
|
uniform float u_frost;
|
|
36
37
|
uniform float u_grain;
|
|
@@ -125,6 +126,11 @@ void main() {
|
|
|
125
126
|
color += u_rim * (1.0 + 0.4 * u_hover) * rim * (0.55 + 0.45 * facing);
|
|
126
127
|
color += u_specular * 0.35 * pow(t, 3.0) * facing;
|
|
127
128
|
|
|
129
|
+
// Hairline edge: a light ground clips the rim to white, so shade one CSS
|
|
130
|
+
// pixel inside the outline instead, more on the side away from the light.
|
|
131
|
+
float hairline = 1.0 - smoothstep(0.0, 1.0, inside);
|
|
132
|
+
color = min(color, vec3(1.0)) * (1.0 - u_edge * hairline * (1.0 - 0.45 * facing));
|
|
133
|
+
|
|
128
134
|
// Grain, fixed to the device pixel grid so a still pane never needs redrawing.
|
|
129
135
|
color += (hash(floor(scenePx * u_dpr)) - 0.5) * u_grain;
|
|
130
136
|
|