@ultralabs/glass 0.1.0 → 0.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1 — 2026-11-22
4
+ ### Fixed
5
+ - Menus, selects and popovers no longer flash after their open animation settles (UL-635). Cause: the surface switched its `backdrop-filter` to an SVG `url(#ul-refraction-…)` filter at settle, and Chrome paints such a filter with no backdrop at all until it has built it (about 0.5 s on the first open while the displacement map decodes, one frame afterwards). Anchored overlays (`.ul-anchored`) now always use the lite material (CSS blur + colour, built instantly), and their morph carries the blur on a separate shell element that hands over to the settled surface (the island → dialog pattern).
6
+ - Button labels keep descenders (g, j, p, y) when a consumer clips the label for an ellipsis: `.ul-btn` has `line-height: 1`, the label now has `.2em` block padding with a matching negative margin (layout unchanged).
7
+ - Listbox inside an anchored surface: the scroll area reaches the surface edge, so the floating selection indicator is no longer cut off above the first item.
8
+ ### Changed
9
+ - Anchored overlays never refract (see above). Use refraction on in-flow surfaces; for a large surface that must refract regardless of the area budget, pass `quality="full"`.
10
+
3
11
  ## 0.1.0 — 2026-11-10
4
12
  Not tagged, not published (owner: docs/release-checklist.md). Earlier per-task records below are kept as history.
5
13
  ### Added
package/dist/esm/index.js CHANGED
@@ -1407,8 +1407,14 @@ function unbindFilter(s) {
1407
1407
  dropPriv(s);
1408
1408
  setUrl(s, "");
1409
1409
  }
1410
+ var stickyPriv = (s) => !!s.priv && !!s.morphed;
1411
+ function withPasses(s, p, n) {
1412
+ const b = p.scales[0] ?? 0;
1413
+ return { ...p, n, scales: n === 3 ? [b, b * (1 - 0.05 * s.aberration), b * (1 - 0.1 * s.aberration)] : [b] };
1414
+ }
1410
1415
  var waitingMaps = /* @__PURE__ */ new WeakSet();
1411
1416
  function bindFilter(s) {
1417
+ if (s.el.hasAttribute("data-ul-morphing")) s.morphed = true;
1412
1418
  if (s.mode !== "refract") {
1413
1419
  unbindFilter(s);
1414
1420
  return;
@@ -1434,9 +1440,11 @@ function bindFilter(s) {
1434
1440
  }));
1435
1441
  return;
1436
1442
  }
1437
- const p = paramsOf(s);
1443
+ let p = paramsOf(s);
1438
1444
  if (!p) return;
1439
- if (isLive(s)) {
1445
+ const sticky = !isLive(s) && stickyPriv(s);
1446
+ if (sticky && s.priv.n !== p.n) p = withPasses(s, p, s.priv.n);
1447
+ if (isLive(s) || sticky) {
1440
1448
  if (!s.priv || s.priv.n !== p.n) {
1441
1449
  dropPriv(s);
1442
1450
  s.priv = takePriv(p.n);
@@ -1717,6 +1725,7 @@ function resolveMode(s) {
1717
1725
  const q = config.forceQuality ?? s.opts.quality ?? "auto";
1718
1726
  if (q === "flat" || isFlatMaterial(s.el)) return "flat";
1719
1727
  if (!s.canRefract) return "fallback";
1728
+ if (s.el.classList.contains("ul-anchored")) return "lite";
1720
1729
  if (q === "full") return "refract";
1721
1730
  if (q === "lite") return "lite";
1722
1731
  return s.granted ? "refract" : "lite";
@@ -3513,6 +3522,13 @@ var AnchoredMorph = class {
3513
3522
  tau = 0;
3514
3523
  anim = null;
3515
3524
  stageAnim = null;
3525
+ /** Backdrop shell (UL-635): the only blurred element while the morph runs; see ensureShell(). */
3526
+ shell = null;
3527
+ shellAnim = null;
3528
+ shellRaf = 0;
3529
+ shellTimer = 0;
3530
+ shellFade = null;
3531
+ shellFilter = null;
3516
3532
  seg = null;
3517
3533
  loop = 0;
3518
3534
  fin = null;
@@ -3843,7 +3859,104 @@ var AnchoredMorph = class {
3843
3859
  this.surface.dispatchEvent(new CustomEvent("ul:morph", { bubbles: true, detail: { phase: this.phase, state, duration, reduced: reduced(), morph: this } }));
3844
3860
  }
3845
3861
  /* ---------- lifecycle ---------- */
3862
+ /*
3863
+ * Backdrop shell (UL-635). A backdrop-filter on an element whose transform / clip-path / size animation ends (or whose
3864
+ * clip-path, overflow and will-change are cleared at settle) makes Chrome rebuild its backdrop: one frame of unblurred
3865
+ * page. Same fix as the island -> contact dialog morph: while the morph runs the blur lives on a sibling shell that
3866
+ * plays the SAME keyframes, the surface has backdrop-filter: none; at settle the surface first goes static, then on the
3867
+ * next frame gets its blur back while the shell hides in the same commit, and the shell is removed a frame later.
3868
+ * The shell carries the plain CSS part of the surface's backdrop (SVG url() filters are dropped while moving).
3869
+ */
3870
+ ensureShell() {
3871
+ const s = this.surface, parent = s.parentElement;
3872
+ cancelAnimationFrame(this.shellRaf);
3873
+ this.shellRaf = 0;
3874
+ clearTimeout(this.shellTimer);
3875
+ this.shellTimer = 0;
3876
+ this.shellFade?.cancel();
3877
+ this.shellFade = null;
3878
+ if (!parent) return;
3879
+ if (this.shellFilter == null || !s.style.getPropertyValue("backdrop-filter")) {
3880
+ const cs2 = getComputedStyle(s);
3881
+ const raw = cs2.backdropFilter || cs2.webkitBackdropFilter || "none";
3882
+ const plain = raw === "none" ? "" : raw.replace(/url\([^)]*\)/g, "").trim();
3883
+ this.shellFilter = plain || "none";
3884
+ }
3885
+ if (this.shellFilter === "none") {
3886
+ this.dropShell();
3887
+ return;
3888
+ }
3889
+ const cs = getComputedStyle(s);
3890
+ const sh = this.shell ?? (this.shell = document.createElement("div"));
3891
+ sh.className = "ul-morph-shell";
3892
+ sh.setAttribute("aria-hidden", "true");
3893
+ if (sh.parentElement !== parent || sh.nextSibling !== s) parent.insertBefore(sh, s);
3894
+ const st = sh.style;
3895
+ st.cssText = "";
3896
+ st.position = cs.position === "static" ? "absolute" : cs.position;
3897
+ st.left = cs.left;
3898
+ st.top = cs.top;
3899
+ st.right = "auto";
3900
+ st.bottom = "auto";
3901
+ st.margin = "0";
3902
+ st.zIndex = cs.zIndex;
3903
+ st.translate = cs.translate;
3904
+ st.boxSizing = "border-box";
3905
+ st.width = cs.width;
3906
+ st.height = cs.height;
3907
+ st.borderRadius = cs.borderTopLeftRadius;
3908
+ st.pointerEvents = "none";
3909
+ st.visibility = "visible";
3910
+ st.background = "transparent";
3911
+ st.setProperty("backdrop-filter", this.shellFilter);
3912
+ st.setProperty("-webkit-backdrop-filter", this.shellFilter);
3913
+ s.style.setProperty("backdrop-filter", "none", "important");
3914
+ s.style.setProperty("-webkit-backdrop-filter", "none", "important");
3915
+ }
3916
+ /** Interrupted / not a shell run: no shell, the surface owns its blur again at once. */
3917
+ dropShell() {
3918
+ cancelAnimationFrame(this.shellRaf);
3919
+ this.shellRaf = 0;
3920
+ clearTimeout(this.shellTimer);
3921
+ this.shellTimer = 0;
3922
+ this.shellFade?.cancel();
3923
+ this.shellFade = null;
3924
+ this.shellAnim?.cancel();
3925
+ this.shellAnim = null;
3926
+ this.shell?.remove();
3927
+ this.surface.style.removeProperty("backdrop-filter");
3928
+ this.surface.style.removeProperty("-webkit-backdrop-filter");
3929
+ }
3930
+ /** Settled: frame 0 the surface is already static (no blur), frame 1 blur back on the surface + shell hidden, frame 2 shell gone. */
3931
+ handoverShell() {
3932
+ const s = this.surface, sh = this.shell, sa = this.shellAnim;
3933
+ this.shellAnim = null;
3934
+ if (!sh || !sh.isConnected) {
3935
+ this.dropShell();
3936
+ return;
3937
+ }
3938
+ cancelAnimationFrame(this.shellRaf);
3939
+ this.shellRaf = requestAnimationFrame(() => {
3940
+ this.shellRaf = 0;
3941
+ s.style.removeProperty("backdrop-filter");
3942
+ s.style.removeProperty("-webkit-backdrop-filter");
3943
+ this.shellTimer = window.setTimeout(() => {
3944
+ this.shellTimer = 0;
3945
+ if (!sh.isConnected) return;
3946
+ const fade = sh.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 180, easing: "linear", fill: "forwards" });
3947
+ this.shellFade = fade;
3948
+ fade.onfinish = () => {
3949
+ if (this.shellFade !== fade) return;
3950
+ this.shellFade = null;
3951
+ sa?.cancel();
3952
+ fade.cancel();
3953
+ sh.remove();
3954
+ };
3955
+ }, 160);
3956
+ });
3957
+ }
3846
3958
  begin() {
3959
+ this.ensureShell();
3847
3960
  const s = this.surface, fin = this.fin;
3848
3961
  s.style.visibility = "";
3849
3962
  s.setAttribute("data-ul-morphing", "");
@@ -3874,7 +3987,7 @@ var AnchoredMorph = class {
3874
3987
  b?.cancel();
3875
3988
  const s = this.surface;
3876
3989
  s.removeAttribute("data-ul-morphing");
3877
- s.style.willChange = "";
3990
+ s.style.willChange = "transform";
3878
3991
  if (this.prevOverflow !== null) {
3879
3992
  s.style.overflow = this.prevOverflow;
3880
3993
  this.prevOverflow = null;
@@ -3892,6 +4005,8 @@ var AnchoredMorph = class {
3892
4005
  this.hideGoo();
3893
4006
  this.clearHole();
3894
4007
  if (settled) releaseGlassTier(s);
4008
+ if (settled) this.handoverShell();
4009
+ else this.dropShell();
3895
4010
  }
3896
4011
  /** Visual rect of the surface right now (animation applied), in the surface's local px. Read BEFORE stop(). */
3897
4012
  visualPose() {
@@ -3934,7 +4049,7 @@ var AnchoredMorph = class {
3934
4049
  }
3935
4050
  this.ensureHole();
3936
4051
  const ha = this.holeRect();
3937
- const anim = s.animate(poses.map((f, i) => ({
4052
+ const keys = poses.map((f, i) => ({
3938
4053
  offset: i / N,
3939
4054
  transform: `translate(${f.x.toFixed(2)}px, ${f.y.toFixed(2)}px)`,
3940
4055
  width: `${f.w.toFixed(2)}px`,
@@ -3942,12 +4057,15 @@ var AnchoredMorph = class {
3942
4057
  borderRadius: `${f.r.toFixed(2)}px`,
3943
4058
  ...this.opts.anchorOnTop === false ? {} : { clipPath: this.clipFor(g2, f, ha) }
3944
4059
  // the hole is keyframed: always in sync with the pose, no per-frame style writes
3945
- })), { duration: dur, easing: "linear", fill: "both" });
4060
+ }));
4061
+ const anim = s.animate(keys, { duration: dur, easing: "linear", fill: "both" });
4062
+ this.shellAnim?.cancel();
4063
+ this.shellAnim = this.shell?.isConnected ? this.shell.animate(keys, { duration: dur, easing: "linear", fill: "both" }) : null;
3946
4064
  this.stageAnim = this.stage ? this.stage.animate(poses.map((f, i) => {
3947
4065
  const [dx, dy] = TRAVEL[this.side] ?? TRAVEL.bottom, d = (1 - f.c) * tok6.offset;
3948
4066
  return { offset: i / N, opacity: f.c.toFixed(3), transform: `translate(${(f.cx - dx * d).toFixed(2)}px, ${(f.cy - dy * d).toFixed(2)}px)` };
3949
4067
  }), { duration: dur, easing: "linear", fill: "both" }) : null;
3950
- startNow(anim, this.stageAnim);
4068
+ startNow(anim, this.stageAnim, this.shellAnim);
3951
4069
  this.anim = anim;
3952
4070
  this.seg = { t0, t1, dur };
3953
4071
  const useGoo = !!this.goo && tok6.goo && !reduced();
@@ -4188,6 +4306,7 @@ var AnchoredMorph = class {
4188
4306
  destroy() {
4189
4307
  this.stopOpenBehavior();
4190
4308
  this.stop();
4309
+ this.dropShell();
4191
4310
  const s = this.surface;
4192
4311
  for (const p of ["left", "top", "visibility", "transform-origin", "opacity", "pointer-events", "translate", "clip-path", "overflow", "will-change"]) s.style.removeProperty(p);
4193
4312
  s.getAnimations().forEach((an) => {
@@ -72,6 +72,13 @@ export declare class AnchoredMorph {
72
72
  private tau;
73
73
  private anim;
74
74
  private stageAnim;
75
+ /** Backdrop shell (UL-635): the only blurred element while the morph runs; see ensureShell(). */
76
+ private shell;
77
+ private shellAnim;
78
+ private shellRaf;
79
+ private shellTimer;
80
+ private shellFade;
81
+ private shellFilter;
75
82
  private seg;
76
83
  private loop;
77
84
  private fin;
@@ -133,6 +140,11 @@ export declare class AnchoredMorph {
133
140
  private applyHole;
134
141
  private clearHole;
135
142
  private emit;
143
+ private ensureShell;
144
+ /** Interrupted / not a shell run: no shell, the surface owns its blur again at once. */
145
+ private dropShell;
146
+ /** Settled: frame 0 the surface is already static (no blur), frame 1 blur back on the surface + shell hidden, frame 2 shell gone. */
147
+ private handoverShell;
136
148
  private begin;
137
149
  /** Cancel animations and remove every temporary style (hole included). */
138
150
  private stop;
package/dist/ul-glass.css CHANGED
@@ -2140,6 +2140,10 @@ html[data-ul-hit=off] .ul-hit-layer {
2140
2140
  min-width: 0;
2141
2141
  white-space: nowrap;
2142
2142
  }
2143
+ .ul-btn-label {
2144
+ padding-block: .2em;
2145
+ margin-block: -.2em;
2146
+ }
2143
2147
  .ul-btn > .ul-btn-icon {
2144
2148
  z-index: 1;
2145
2149
  }
@@ -3700,6 +3704,13 @@ button.ul-step-hit:focus-visible {
3700
3704
  .ul-nsel-control:disabled + .ul-nsel-chev {
3701
3705
  opacity: var(--ul-control-disabled-opacity);
3702
3706
  }
3707
+ .ul-anchored .ul-listbox {
3708
+ margin: calc(-1 * var(--ul-glass-padding, 8px));
3709
+ padding: var(--ul-glass-padding, 8px);
3710
+ border-radius: var(--ul-glass-radius, 0px);
3711
+ max-height: calc(var(--ul-selection-list-max-h) + 2 * var(--ul-glass-padding, 8px));
3712
+ scroll-padding-block: var(--ul-glass-padding, 8px);
3713
+ }
3703
3714
 
3704
3715
  /* src/components/ULPickers/ULPickers.css */
3705
3716
  .ul-picker {
package/dist/ul-glass.js CHANGED
@@ -1828,8 +1828,14 @@ var UL = (() => {
1828
1828
  dropPriv(s);
1829
1829
  setUrl(s, "");
1830
1830
  }
1831
+ var stickyPriv = (s) => !!s.priv && !!s.morphed;
1832
+ function withPasses(s, p, n) {
1833
+ const b = p.scales[0] ?? 0;
1834
+ return { ...p, n, scales: n === 3 ? [b, b * (1 - 0.05 * s.aberration), b * (1 - 0.1 * s.aberration)] : [b] };
1835
+ }
1831
1836
  var waitingMaps = /* @__PURE__ */ new WeakSet();
1832
1837
  function bindFilter(s) {
1838
+ if (s.el.hasAttribute("data-ul-morphing")) s.morphed = true;
1833
1839
  if (s.mode !== "refract") {
1834
1840
  unbindFilter(s);
1835
1841
  return;
@@ -1855,9 +1861,11 @@ var UL = (() => {
1855
1861
  }));
1856
1862
  return;
1857
1863
  }
1858
- const p = paramsOf(s);
1864
+ let p = paramsOf(s);
1859
1865
  if (!p) return;
1860
- if (isLive(s)) {
1866
+ const sticky = !isLive(s) && stickyPriv(s);
1867
+ if (sticky && s.priv.n !== p.n) p = withPasses(s, p, s.priv.n);
1868
+ if (isLive(s) || sticky) {
1861
1869
  if (!s.priv || s.priv.n !== p.n) {
1862
1870
  dropPriv(s);
1863
1871
  s.priv = takePriv(p.n);
@@ -2138,6 +2146,7 @@ var UL = (() => {
2138
2146
  const q = config.forceQuality ?? s.opts.quality ?? "auto";
2139
2147
  if (q === "flat" || isFlatMaterial(s.el)) return "flat";
2140
2148
  if (!s.canRefract) return "fallback";
2149
+ if (s.el.classList.contains("ul-anchored")) return "lite";
2141
2150
  if (q === "full") return "refract";
2142
2151
  if (q === "lite") return "lite";
2143
2152
  return s.granted ? "refract" : "lite";
@@ -3934,6 +3943,13 @@ ${r.examples.join("\n")}` : "";
3934
3943
  tau = 0;
3935
3944
  anim = null;
3936
3945
  stageAnim = null;
3946
+ /** Backdrop shell (UL-635): the only blurred element while the morph runs; see ensureShell(). */
3947
+ shell = null;
3948
+ shellAnim = null;
3949
+ shellRaf = 0;
3950
+ shellTimer = 0;
3951
+ shellFade = null;
3952
+ shellFilter = null;
3937
3953
  seg = null;
3938
3954
  loop = 0;
3939
3955
  fin = null;
@@ -4264,7 +4280,104 @@ ${r.examples.join("\n")}` : "";
4264
4280
  this.surface.dispatchEvent(new CustomEvent("ul:morph", { bubbles: true, detail: { phase: this.phase, state, duration, reduced: reduced(), morph: this } }));
4265
4281
  }
4266
4282
  /* ---------- lifecycle ---------- */
4283
+ /*
4284
+ * Backdrop shell (UL-635). A backdrop-filter on an element whose transform / clip-path / size animation ends (or whose
4285
+ * clip-path, overflow and will-change are cleared at settle) makes Chrome rebuild its backdrop: one frame of unblurred
4286
+ * page. Same fix as the island -> contact dialog morph: while the morph runs the blur lives on a sibling shell that
4287
+ * plays the SAME keyframes, the surface has backdrop-filter: none; at settle the surface first goes static, then on the
4288
+ * next frame gets its blur back while the shell hides in the same commit, and the shell is removed a frame later.
4289
+ * The shell carries the plain CSS part of the surface's backdrop (SVG url() filters are dropped while moving).
4290
+ */
4291
+ ensureShell() {
4292
+ const s = this.surface, parent = s.parentElement;
4293
+ cancelAnimationFrame(this.shellRaf);
4294
+ this.shellRaf = 0;
4295
+ clearTimeout(this.shellTimer);
4296
+ this.shellTimer = 0;
4297
+ this.shellFade?.cancel();
4298
+ this.shellFade = null;
4299
+ if (!parent) return;
4300
+ if (this.shellFilter == null || !s.style.getPropertyValue("backdrop-filter")) {
4301
+ const cs2 = getComputedStyle(s);
4302
+ const raw = cs2.backdropFilter || cs2.webkitBackdropFilter || "none";
4303
+ const plain = raw === "none" ? "" : raw.replace(/url\([^)]*\)/g, "").trim();
4304
+ this.shellFilter = plain || "none";
4305
+ }
4306
+ if (this.shellFilter === "none") {
4307
+ this.dropShell();
4308
+ return;
4309
+ }
4310
+ const cs = getComputedStyle(s);
4311
+ const sh = this.shell ?? (this.shell = document.createElement("div"));
4312
+ sh.className = "ul-morph-shell";
4313
+ sh.setAttribute("aria-hidden", "true");
4314
+ if (sh.parentElement !== parent || sh.nextSibling !== s) parent.insertBefore(sh, s);
4315
+ const st = sh.style;
4316
+ st.cssText = "";
4317
+ st.position = cs.position === "static" ? "absolute" : cs.position;
4318
+ st.left = cs.left;
4319
+ st.top = cs.top;
4320
+ st.right = "auto";
4321
+ st.bottom = "auto";
4322
+ st.margin = "0";
4323
+ st.zIndex = cs.zIndex;
4324
+ st.translate = cs.translate;
4325
+ st.boxSizing = "border-box";
4326
+ st.width = cs.width;
4327
+ st.height = cs.height;
4328
+ st.borderRadius = cs.borderTopLeftRadius;
4329
+ st.pointerEvents = "none";
4330
+ st.visibility = "visible";
4331
+ st.background = "transparent";
4332
+ st.setProperty("backdrop-filter", this.shellFilter);
4333
+ st.setProperty("-webkit-backdrop-filter", this.shellFilter);
4334
+ s.style.setProperty("backdrop-filter", "none", "important");
4335
+ s.style.setProperty("-webkit-backdrop-filter", "none", "important");
4336
+ }
4337
+ /** Interrupted / not a shell run: no shell, the surface owns its blur again at once. */
4338
+ dropShell() {
4339
+ cancelAnimationFrame(this.shellRaf);
4340
+ this.shellRaf = 0;
4341
+ clearTimeout(this.shellTimer);
4342
+ this.shellTimer = 0;
4343
+ this.shellFade?.cancel();
4344
+ this.shellFade = null;
4345
+ this.shellAnim?.cancel();
4346
+ this.shellAnim = null;
4347
+ this.shell?.remove();
4348
+ this.surface.style.removeProperty("backdrop-filter");
4349
+ this.surface.style.removeProperty("-webkit-backdrop-filter");
4350
+ }
4351
+ /** Settled: frame 0 the surface is already static (no blur), frame 1 blur back on the surface + shell hidden, frame 2 shell gone. */
4352
+ handoverShell() {
4353
+ const s = this.surface, sh = this.shell, sa = this.shellAnim;
4354
+ this.shellAnim = null;
4355
+ if (!sh || !sh.isConnected) {
4356
+ this.dropShell();
4357
+ return;
4358
+ }
4359
+ cancelAnimationFrame(this.shellRaf);
4360
+ this.shellRaf = requestAnimationFrame(() => {
4361
+ this.shellRaf = 0;
4362
+ s.style.removeProperty("backdrop-filter");
4363
+ s.style.removeProperty("-webkit-backdrop-filter");
4364
+ this.shellTimer = window.setTimeout(() => {
4365
+ this.shellTimer = 0;
4366
+ if (!sh.isConnected) return;
4367
+ const fade = sh.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 180, easing: "linear", fill: "forwards" });
4368
+ this.shellFade = fade;
4369
+ fade.onfinish = () => {
4370
+ if (this.shellFade !== fade) return;
4371
+ this.shellFade = null;
4372
+ sa?.cancel();
4373
+ fade.cancel();
4374
+ sh.remove();
4375
+ };
4376
+ }, 160);
4377
+ });
4378
+ }
4267
4379
  begin() {
4380
+ this.ensureShell();
4268
4381
  const s = this.surface, fin = this.fin;
4269
4382
  s.style.visibility = "";
4270
4383
  s.setAttribute("data-ul-morphing", "");
@@ -4295,7 +4408,7 @@ ${r.examples.join("\n")}` : "";
4295
4408
  b?.cancel();
4296
4409
  const s = this.surface;
4297
4410
  s.removeAttribute("data-ul-morphing");
4298
- s.style.willChange = "";
4411
+ s.style.willChange = "transform";
4299
4412
  if (this.prevOverflow !== null) {
4300
4413
  s.style.overflow = this.prevOverflow;
4301
4414
  this.prevOverflow = null;
@@ -4313,6 +4426,8 @@ ${r.examples.join("\n")}` : "";
4313
4426
  this.hideGoo();
4314
4427
  this.clearHole();
4315
4428
  if (settled) releaseGlassTier(s);
4429
+ if (settled) this.handoverShell();
4430
+ else this.dropShell();
4316
4431
  }
4317
4432
  /** Visual rect of the surface right now (animation applied), in the surface's local px. Read BEFORE stop(). */
4318
4433
  visualPose() {
@@ -4355,7 +4470,7 @@ ${r.examples.join("\n")}` : "";
4355
4470
  }
4356
4471
  this.ensureHole();
4357
4472
  const ha = this.holeRect();
4358
- const anim = s.animate(poses.map((f, i) => ({
4473
+ const keys = poses.map((f, i) => ({
4359
4474
  offset: i / N,
4360
4475
  transform: `translate(${f.x.toFixed(2)}px, ${f.y.toFixed(2)}px)`,
4361
4476
  width: `${f.w.toFixed(2)}px`,
@@ -4363,12 +4478,15 @@ ${r.examples.join("\n")}` : "";
4363
4478
  borderRadius: `${f.r.toFixed(2)}px`,
4364
4479
  ...this.opts.anchorOnTop === false ? {} : { clipPath: this.clipFor(g2, f, ha) }
4365
4480
  // the hole is keyframed: always in sync with the pose, no per-frame style writes
4366
- })), { duration: dur, easing: "linear", fill: "both" });
4481
+ }));
4482
+ const anim = s.animate(keys, { duration: dur, easing: "linear", fill: "both" });
4483
+ this.shellAnim?.cancel();
4484
+ this.shellAnim = this.shell?.isConnected ? this.shell.animate(keys, { duration: dur, easing: "linear", fill: "both" }) : null;
4367
4485
  this.stageAnim = this.stage ? this.stage.animate(poses.map((f, i) => {
4368
4486
  const [dx, dy] = TRAVEL[this.side] ?? TRAVEL.bottom, d = (1 - f.c) * tok6.offset;
4369
4487
  return { offset: i / N, opacity: f.c.toFixed(3), transform: `translate(${(f.cx - dx * d).toFixed(2)}px, ${(f.cy - dy * d).toFixed(2)}px)` };
4370
4488
  }), { duration: dur, easing: "linear", fill: "both" }) : null;
4371
- startNow(anim, this.stageAnim);
4489
+ startNow(anim, this.stageAnim, this.shellAnim);
4372
4490
  this.anim = anim;
4373
4491
  this.seg = { t0, t1, dur };
4374
4492
  const useGoo = !!this.goo && tok6.goo && !reduced();
@@ -4609,6 +4727,7 @@ ${r.examples.join("\n")}` : "";
4609
4727
  destroy() {
4610
4728
  this.stopOpenBehavior();
4611
4729
  this.stop();
4730
+ this.dropShell();
4612
4731
  const s = this.surface;
4613
4732
  for (const p of ["left", "top", "visibility", "transform-origin", "opacity", "pointer-events", "translate", "clip-path", "overflow", "will-change"]) s.style.removeProperty(p);
4614
4733
  s.getAnimations().forEach((an) => {