@phreshos/react-ui 0.1.38 → 0.1.39
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/surface/surface.d.ts +11 -0
- package/dist/surface/surface.js +17 -7
- package/package.json +1 -1
|
@@ -78,3 +78,14 @@ export declare function surfacePaint(visual: Visual, color: Color, depth: Surfac
|
|
|
78
78
|
distortion: number;
|
|
79
79
|
variables: CSSProperties;
|
|
80
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* How far the inward spill reaches: at most a fixed depth, and less on short
|
|
83
|
+
* Surfaces. At a fixed depth a small button was lit through nearly half its
|
|
84
|
+
* height and read as swollen, while a large panel barely changes.
|
|
85
|
+
*
|
|
86
|
+
* The limit is the height of the spill's background layer, not the gradient's
|
|
87
|
+
* size: browsers reject a size that mixes pixels and percentages inside
|
|
88
|
+
* radial-gradient(), and one rejected layer drops the whole background,
|
|
89
|
+
* grain included.
|
|
90
|
+
*/
|
|
91
|
+
export declare const spillDepth = "min(6px, 12%)";
|
package/dist/surface/surface.js
CHANGED
|
@@ -111,11 +111,10 @@ export function surfacePaint(visual, color, depth, options, shadowOptions, inter
|
|
|
111
111
|
const rim = edged
|
|
112
112
|
? `linear-gradient(to right, transparent, ${colorOpacity(light, lit.side)} 18%, ${colorOpacity(light, lit.edge)} 50%, ${colorOpacity(light, lit.side)} 82%, transparent)`
|
|
113
113
|
: "none";
|
|
114
|
-
// The spill
|
|
115
|
-
//
|
|
116
|
-
// read as swollen, while a large panel barely changes.
|
|
114
|
+
// The spill fills its own background layer, whose height the stylesheet
|
|
115
|
+
// limits (see spillDepth).
|
|
117
116
|
const spill = (edge) => edged && lit.spill > 0
|
|
118
|
-
? `radial-gradient(50%
|
|
117
|
+
? `radial-gradient(50% 100% at 50% ${edge === "top" ? "0" : "100%"}, ${colorOpacity(light, lit.spill)}, transparent)`
|
|
119
118
|
: "none";
|
|
120
119
|
// A recessed Surface holds a value, so focus and validity also claim its hairline.
|
|
121
120
|
const claimed = interaction?.invalid || (depth === "recessed" && interaction?.focusVisible);
|
|
@@ -148,8 +147,17 @@ export function surfacePaint(visual, color, depth, options, shadowOptions, inter
|
|
|
148
147
|
}
|
|
149
148
|
};
|
|
150
149
|
}
|
|
151
|
-
/**
|
|
152
|
-
|
|
150
|
+
/**
|
|
151
|
+
* How far the inward spill reaches: at most a fixed depth, and less on short
|
|
152
|
+
* Surfaces. At a fixed depth a small button was lit through nearly half its
|
|
153
|
+
* height and read as swollen, while a large panel barely changes.
|
|
154
|
+
*
|
|
155
|
+
* The limit is the height of the spill's background layer, not the gradient's
|
|
156
|
+
* size: browsers reject a size that mixes pixels and percentages inside
|
|
157
|
+
* radial-gradient(), and one rejected layer drops the whole background,
|
|
158
|
+
* grain included.
|
|
159
|
+
*/
|
|
160
|
+
export const spillDepth = "min(6px, 12%)";
|
|
153
161
|
/** How much light each part of the rim receives, interpolated along the canvas darkness. */
|
|
154
162
|
function edgeLight(depth, darkness) {
|
|
155
163
|
const { light, dark } = edgeLightEnds[depth];
|
|
@@ -219,7 +227,9 @@ const stylesheet = `
|
|
|
219
227
|
z-index: -1;
|
|
220
228
|
background-color: var(--phreshos-surface-paint);
|
|
221
229
|
background-image: var(--phreshos-surface-spill-top), var(--phreshos-surface-spill-bottom), var(--phreshos-surface-grain);
|
|
222
|
-
background-size:
|
|
230
|
+
background-size: 100% ${spillDepth}, 100% ${spillDepth}, ${grainSize}px ${grainSize}px;
|
|
231
|
+
background-position: center top, center bottom, 0 0;
|
|
232
|
+
background-repeat: no-repeat, no-repeat, repeat;
|
|
223
233
|
-webkit-backdrop-filter: var(--phreshos-surface-frost);
|
|
224
234
|
backdrop-filter: var(--phreshos-surface-frost);
|
|
225
235
|
transition: background-color var(--phreshos-surface-duration) var(--phreshos-surface-easing);
|