vireglass 2.0.0 → 2.1.0
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/{chunk-JF3FK254.js → chunk-BZC2WHCK.js} +3 -3
- package/dist/{chunk-JF3FK254.js.map → chunk-BZC2WHCK.js.map} +1 -1
- package/dist/{chunk-IQOBZGCF.js → chunk-FL5UZPY5.js} +28 -30
- package/dist/chunk-FL5UZPY5.js.map +1 -0
- package/dist/dom.cjs +31 -32
- package/dist/dom.cjs.map +1 -1
- package/dist/dom.d.cts +12 -1
- package/dist/dom.d.ts +12 -1
- package/dist/dom.js +5 -4
- package/dist/dom.js.map +1 -1
- package/dist/{group-model-8u4GKrUu.d.cts → group-model-DwtixGhG.d.cts} +15 -6
- package/dist/{group-model-vYSmEVia.d.ts → group-model-z4N27qsC.d.ts} +15 -6
- package/dist/index.cjs +27 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.js +2 -2
- package/package.json +1 -1
- package/src/dom/displacement.ts +7 -2
- package/src/dom/index.ts +9 -1
- package/src/sdf.ts +44 -36
- package/dist/chunk-IQOBZGCF.js.map +0 -1
package/dist/dom.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { B as BackdropSample } from './adaptation-BSbbdExK.cjs';
|
|
2
2
|
import { V as VireGlassGeometry } from './geometry-RhKd7CM5.cjs';
|
|
3
3
|
import { V as VireGlassOptics, a as VireGlassMaterial } from './material-CnUmdKg1.cjs';
|
|
4
|
-
import { T as TouchWarp, M as MorphShape, V as VireGlassAccessibility, S as ScrollEdgeStyle, G as GroupPlane } from './group-model-
|
|
4
|
+
import { T as TouchWarp, M as MorphShape, V as VireGlassAccessibility, S as ScrollEdgeStyle, G as GroupPlane } from './group-model-DwtixGhG.cjs';
|
|
5
5
|
import { V as VireGlassAccent } from './adapters-DugC6Qri.cjs';
|
|
6
6
|
|
|
7
7
|
/** Any `backdrop-filter` at all (e.g. `blur()`) — the fallback path's own requirement. */
|
|
@@ -67,6 +67,9 @@ type DisplacementState = {
|
|
|
67
67
|
smoothing?: number;
|
|
68
68
|
morph?: MorphShape;
|
|
69
69
|
morph2?: MorphShape;
|
|
70
|
+
/** Any number of shapes flowing into this one. `morph`/`morph2` are the first two, kept so a
|
|
71
|
+
* caller that only ever had two does not have to change. */
|
|
72
|
+
morphs?: readonly MorphShape[];
|
|
70
73
|
};
|
|
71
74
|
/**
|
|
72
75
|
* The raw pixel buffer, with no canvas involved — the part actually worth unit-testing.
|
|
@@ -321,6 +324,14 @@ type GlassMorph = {
|
|
|
321
324
|
smoothing: number;
|
|
322
325
|
shape?: MorphShape;
|
|
323
326
|
shape2?: MorphShape;
|
|
327
|
+
/**
|
|
328
|
+
* Any number of shapes flowing into this one. Several independent elements becoming one whole is
|
|
329
|
+
* the behaviour; how many of them there are is the host's business, and it used to be the
|
|
330
|
+
* material's — the count lived in the field NAMES, so a fourth element had nowhere to go.
|
|
331
|
+
*
|
|
332
|
+
* `shape` and `shape2` still work and come first.
|
|
333
|
+
*/
|
|
334
|
+
shapes?: readonly MorphShape[];
|
|
324
335
|
};
|
|
325
336
|
type GlassHandle = {
|
|
326
337
|
update(): void;
|
package/dist/dom.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { B as BackdropSample } from './adaptation-BSbbdExK.js';
|
|
2
2
|
import { V as VireGlassGeometry } from './geometry-GvXtt-_S.js';
|
|
3
3
|
import { V as VireGlassOptics, a as VireGlassMaterial } from './material-CnUmdKg1.js';
|
|
4
|
-
import { T as TouchWarp, M as MorphShape, V as VireGlassAccessibility, S as ScrollEdgeStyle, G as GroupPlane } from './group-model-
|
|
4
|
+
import { T as TouchWarp, M as MorphShape, V as VireGlassAccessibility, S as ScrollEdgeStyle, G as GroupPlane } from './group-model-z4N27qsC.js';
|
|
5
5
|
import { V as VireGlassAccent } from './adapters-BfeAopGO.js';
|
|
6
6
|
|
|
7
7
|
/** Any `backdrop-filter` at all (e.g. `blur()`) — the fallback path's own requirement. */
|
|
@@ -67,6 +67,9 @@ type DisplacementState = {
|
|
|
67
67
|
smoothing?: number;
|
|
68
68
|
morph?: MorphShape;
|
|
69
69
|
morph2?: MorphShape;
|
|
70
|
+
/** Any number of shapes flowing into this one. `morph`/`morph2` are the first two, kept so a
|
|
71
|
+
* caller that only ever had two does not have to change. */
|
|
72
|
+
morphs?: readonly MorphShape[];
|
|
70
73
|
};
|
|
71
74
|
/**
|
|
72
75
|
* The raw pixel buffer, with no canvas involved — the part actually worth unit-testing.
|
|
@@ -321,6 +324,14 @@ type GlassMorph = {
|
|
|
321
324
|
smoothing: number;
|
|
322
325
|
shape?: MorphShape;
|
|
323
326
|
shape2?: MorphShape;
|
|
327
|
+
/**
|
|
328
|
+
* Any number of shapes flowing into this one. Several independent elements becoming one whole is
|
|
329
|
+
* the behaviour; how many of them there are is the host's business, and it used to be the
|
|
330
|
+
* material's — the count lived in the field NAMES, so a fourth element had nowhere to go.
|
|
331
|
+
*
|
|
332
|
+
* `shape` and `shape2` still work and come first.
|
|
333
|
+
*/
|
|
334
|
+
shapes?: readonly MorphShape[];
|
|
324
335
|
};
|
|
325
336
|
type GlassHandle = {
|
|
326
337
|
update(): void;
|
package/dist/dom.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { shadowTint, NO_ACCESSIBILITY, createGroupState, createDeform, elasticAllowed, contrastRimLuma, concentricRadius, scrollEdgeStrength, scrollEdgeStyle, applyGlassScale, GLASS_SCALE_DEFAULT, applyAccessibility, applyAppear, accentTone, accentAmount, raiseIntoGlass } from './chunk-3PGYF2NK.js';
|
|
2
2
|
import { ambientFrom, shouldInkBeLight, INK_LIGHT, INK_DARK } from './chunk-JNRZNMJJ.js';
|
|
3
|
-
import { touchWarp, sceneDistance, sceneGradient, sdfRoundedRect, VIREGLASS_MATERIAL, REST_LIGHT, resolveOptics, refractionStrength } from './chunk-
|
|
3
|
+
import { touchWarp, sceneDistance, sceneGradient, sdfRoundedRect, VIREGLASS_MATERIAL, REST_LIGHT, resolveOptics, refractionStrength } from './chunk-FL5UZPY5.js';
|
|
4
4
|
import { shadowOpacity, bevelDp, thicknessDp, rimDp, shadowOpacityFrom, shadowReachDp, halfMinDp, MAX_STRETCH, roundedRectGeometry } from './chunk-P2ZOODXD.js';
|
|
5
5
|
import { LENS, BODY, RIM, TOUCH, SHADOW, SHADOW_GAP, SCROLL_EDGE, BEVEL, SPECTRAL, DISPERSION } from './chunk-TTOKBARR.js';
|
|
6
6
|
|
|
@@ -29,6 +29,7 @@ function renderDisplacementPixels(optics, geometry, dpr, state = {}) {
|
|
|
29
29
|
const rawScale = optics.refraction * thicknessDp(geometry, optics) * SCALE_GAIN;
|
|
30
30
|
const scale = Math.min(rawScale, MAX_SCALE);
|
|
31
31
|
const smoothing = state.smoothing ?? 0;
|
|
32
|
+
const shapes = [state.morph, state.morph2, ...state.morphs ?? []];
|
|
32
33
|
const data = new Uint8ClampedArray(width * height * 4);
|
|
33
34
|
const halfW = geometry.width / 2;
|
|
34
35
|
const halfH = geometry.height / 2;
|
|
@@ -38,7 +39,7 @@ function renderDisplacementPixels(optics, geometry, dpr, state = {}) {
|
|
|
38
39
|
const x = (px + 0.5) / density - halfW;
|
|
39
40
|
const i = (py * width + px) * 4;
|
|
40
41
|
const [wx, wy] = state.touch ? touchWarp(x, y, state.touch) : [x, y];
|
|
41
|
-
const sd = sceneDistance(wx, wy, geometry.width, geometry.height, geometry.cornerRadius, smoothing,
|
|
42
|
+
const sd = sceneDistance(wx, wy, geometry.width, geometry.height, geometry.cornerRadius, smoothing, ...shapes);
|
|
42
43
|
const t = Math.min(Math.max((sd + bevel) / bevel, 0), 1);
|
|
43
44
|
if (t <= 0 || scale <= 0) {
|
|
44
45
|
data[i] = 128;
|
|
@@ -47,7 +48,7 @@ function renderDisplacementPixels(optics, geometry, dpr, state = {}) {
|
|
|
47
48
|
data[i + 3] = 255;
|
|
48
49
|
continue;
|
|
49
50
|
}
|
|
50
|
-
const [gx, gy] = sceneGradient(wx, wy, geometry.width, geometry.height, geometry.cornerRadius, smoothing,
|
|
51
|
+
const [gx, gy] = sceneGradient(wx, wy, geometry.width, geometry.height, geometry.cornerRadius, smoothing, ...shapes);
|
|
51
52
|
const magnitude = bevelProfile(t) * (scale / 2);
|
|
52
53
|
const dx = -gx * magnitude;
|
|
53
54
|
const dy = -gy * magnitude;
|
|
@@ -833,7 +834,7 @@ function attachGlass(el, opts = {}) {
|
|
|
833
834
|
}
|
|
834
835
|
function morphState() {
|
|
835
836
|
if (!morph) return {};
|
|
836
|
-
return { smoothing: morph.smoothing, morph: morph.shape, morph2: morph.shape2 };
|
|
837
|
+
return { smoothing: morph.smoothing, morph: morph.shape, morph2: morph.shape2, morphs: morph.shapes };
|
|
837
838
|
}
|
|
838
839
|
function morphKey() {
|
|
839
840
|
if (!morph) return "0";
|