@spaethtech/svelte-ui 0.7.1-dev.48.f0e45b8 → 0.7.1-dev.50.4b4666d

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.
@@ -248,6 +248,24 @@
248
248
  activeMode = currentMode;
249
249
  });
250
250
 
251
+ // Suppress the slide/width transition for a frame whenever the MODE changes (from a resize), so the
252
+ // switch SNAPS instead of animating the wrong intermediate state — e.g. a labeled drawer sliding
253
+ // offscreen, or an expanded rail collapsing to icon. Same-mode interactions (drawer open/close,
254
+ // hover-expand) still animate because `currentMode` didn't change.
255
+ let noTransition = $state(false);
256
+ $effect(() => {
257
+ currentMode; // re-run on mode change
258
+ noTransition = true;
259
+ let r2: number | undefined;
260
+ const r1 = requestAnimationFrame(() => {
261
+ r2 = requestAnimationFrame(() => (noTransition = false));
262
+ });
263
+ return () => {
264
+ cancelAnimationFrame(r1);
265
+ if (r2 !== undefined) cancelAnimationFrame(r2);
266
+ };
267
+ });
268
+
251
269
  const isStepped = $derived(currentMode === "stepped");
252
270
  const isDrawer = $derived(currentMode === "drawer" || currentMode === "stepped");
253
271
  // Dock side. `right` mirrors the frame, drawer slide, hamburger corner, popout side, and item layout.
@@ -298,6 +316,17 @@
298
316
  ? `${collapsedWidth}px`
299
317
  : `${expandedWidth}px`,
300
318
  );
319
+ // Slide (drawer/stepped) or width (icon hover-expand) transition — suppressed on a mode change (see
320
+ // `noTransition`) so resizing between modes snaps rather than animating a wrong intermediate state.
321
+ const transitionClass = $derived(
322
+ noTransition
323
+ ? "transition-none"
324
+ : currentMode === "stepped" || currentMode === "drawer"
325
+ ? "transition-transform duration-200"
326
+ : currentMode === "icon" && hoverExpandActive
327
+ ? "transition-[width] duration-200"
328
+ : "",
329
+ );
301
330
 
302
331
  // ── DEV depth warning ───────────────────────────────────────────
303
332
  if (DEV) {
@@ -782,17 +811,17 @@
782
811
  onmouseenter={hoverExpandActive ? openHoverExpand : undefined}
783
812
  onmouseleave={hoverExpandActive ? scheduleHoverCollapse : undefined}
784
813
  class="
785
- flex flex-col z-[60] overflow-hidden shrink-0
814
+ flex flex-col z-[60] overflow-hidden shrink-0 {transitionClass}
786
815
  [background-color:var(--ui-color-background)]
787
816
  [color:var(--ui-color-text)]
788
817
  {dockBorder}
789
818
  {currentMode === 'stepped'
790
- ? `absolute inset-y-0 ${dockEdge} z-[75] transition-transform duration-200 ${open ? 'translate-x-0' : dockOff}`
819
+ ? `absolute inset-y-0 ${dockEdge} z-[75] ${open ? 'translate-x-0' : dockOff}`
791
820
  : currentMode === 'drawer'
792
- ? `absolute inset-y-0 ${dockEdge} z-[75] transition-transform duration-200 ${open ? 'translate-x-0' : dockOff}`
821
+ ? `absolute inset-y-0 ${dockEdge} z-[75] ${open ? 'translate-x-0' : dockOff}`
793
822
  : currentMode === 'icon'
794
823
  ? hoverExpandActive
795
- ? `absolute inset-y-0 ${dockEdge} z-[65] transition-[width] duration-200 ${effectivelyExpanded ? 'shadow-lg' : ''}`
824
+ ? `absolute inset-y-0 ${dockEdge} z-[65] ${effectivelyExpanded ? 'shadow-lg' : ''}`
796
825
  : 'relative'
797
826
  : 'relative'}
798
827
  {additionalClass}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaethtech/svelte-ui",
3
- "version": "0.7.1-dev.48.f0e45b8",
3
+ "version": "0.7.1-dev.50.4b4666d",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/spaethtech/svelte-ui.git"