@spaethtech/svelte-ui 0.7.1-dev.44.97afb0d → 0.7.1-dev.45.41387ea

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.
@@ -35,6 +35,7 @@
35
35
  align = "start",
36
36
  boundary = "viewport",
37
37
  offset = 4,
38
+ margin = 8,
38
39
  matchWidth = false,
39
40
  surface = false,
40
41
  variant,
@@ -51,6 +52,9 @@
51
52
  /** Default the viewport; pass a container element or CSS selector to bound flipping to it. */
52
53
  boundary?: Boundary;
53
54
  offset?: number;
55
+ /** Minimum gap kept from the boundary edges, in px (default 8). Set `0` to let the box sit flush
56
+ * against an edge — e.g. a sidebar popout that must align to the sidebar's (viewport) edge. */
57
+ margin?: number;
54
58
  matchWidth?: boolean;
55
59
  /** Render a themed floating PANEL around the children (background, border, padding, shadow) instead
56
60
  * of the default bare positioner. `variant`/`size`/`borderless` configure that panel. Consumers
@@ -132,6 +136,7 @@
132
136
  align,
133
137
  boundary,
134
138
  offset,
139
+ margin,
135
140
  matchWidth,
136
141
  onplaced: (p) => (placed = p),
137
142
  }}
@@ -12,6 +12,9 @@ type $$ComponentProps = {
12
12
  /** Default the viewport; pass a container element or CSS selector to bound flipping to it. */
13
13
  boundary?: Boundary;
14
14
  offset?: number;
15
+ /** Minimum gap kept from the boundary edges, in px (default 8). Set `0` to let the box sit flush
16
+ * against an edge — e.g. a sidebar popout that must align to the sidebar's (viewport) edge. */
17
+ margin?: number;
15
18
  matchWidth?: boolean;
16
19
  /** Render a themed floating PANEL around the children (background, border, padding, shadow) instead
17
20
  * of the default bare positioner. `variant`/`size`/`borderless` configure that panel. Consumers
@@ -276,6 +276,15 @@
276
276
  // Labels show in every mode except a collapsed (not hover-expanded) icon rail.
277
277
  const labelsVisible = $derived(currentMode !== "icon" || effectivelyExpanded);
278
278
 
279
+ // Aside width in px, driven by mode (inline style — robust, no Tailwind arbitrary-var class).
280
+ const asideWidthCss = $derived(
281
+ currentMode === "stepped"
282
+ ? "100%"
283
+ : currentMode === "icon" && !effectivelyExpanded
284
+ ? `${collapsedWidth}px`
285
+ : `${expandedWidth}px`,
286
+ );
287
+
279
288
  // ── DEV depth warning ───────────────────────────────────────────
280
289
  if (DEV) {
281
290
  const walk = (list: SideBarMenuItem[], depth: number, path: string[]) => {
@@ -699,7 +708,8 @@
699
708
  role="menu"
700
709
  tabindex="-1"
701
710
  id={popoutId}
702
- class="w-[var(--sbm-expanded-w)] overflow-hidden shadow-lg [background-color:var(--ui-color-background)] [color:var(--ui-color-text)] [border-color:color-mix(in_srgb,var(--ui-color-text)_15%,transparent)] {borderClass}"
711
+ style="width: {expandedWidth}px;"
712
+ class="overflow-hidden shadow-lg [background-color:var(--ui-color-background)] [color:var(--ui-color-text)] [border-color:color-mix(in_srgb,var(--ui-color-text)_15%,transparent)] {borderClass}"
703
713
  onmouseenter={cancelClose}
704
714
  onmouseleave={scheduleClose}
705
715
  >
@@ -749,27 +759,28 @@
749
759
  width, so the expanded float below is positioned against the SIDEBAR's own box (container-relative,
750
760
  never the viewport). In every other mode it's `display: contents` (no box) so layout is unchanged. -->
751
761
  <div
752
- class={hoverExpandActive ? "relative shrink-0 [width:var(--sbm-collapsed-w)]" : "contents"}
753
- style="--sbm-collapsed-w: {collapsedWidth}px; --sbm-expanded-w: {expandedWidth}px;"
762
+ class={hoverExpandActive ? "relative shrink-0" : "contents"}
763
+ style="{hoverExpandActive ? `width: ${collapsedWidth}px;` : ''}"
754
764
  >
755
765
  <aside
756
766
  bind:this={asideRef}
767
+ style="width: {asideWidthCss};"
757
768
  onmouseenter={hoverExpandActive ? openHoverExpand : undefined}
758
769
  onmouseleave={hoverExpandActive ? scheduleHoverCollapse : undefined}
759
770
  class="
760
- flex flex-col z-[60] overflow-hidden
771
+ flex flex-col z-[60] overflow-hidden shrink-0
761
772
  [background-color:var(--ui-color-background)]
762
773
  [color:var(--ui-color-text)]
763
774
  {dockBorder}
764
775
  {currentMode === 'stepped'
765
- ? `absolute inset-y-0 ${dockEdge} w-full z-[75] transition-transform duration-200 ${open ? 'translate-x-0' : dockOff}`
776
+ ? `absolute inset-y-0 ${dockEdge} z-[75] transition-transform duration-200 ${open ? 'translate-x-0' : dockOff}`
766
777
  : currentMode === 'drawer'
767
- ? `absolute inset-y-0 ${dockEdge} w-[var(--sbm-expanded-w)] z-[75] transition-transform duration-200 ${open ? 'translate-x-0' : dockOff}`
778
+ ? `absolute inset-y-0 ${dockEdge} z-[75] transition-transform duration-200 ${open ? 'translate-x-0' : dockOff}`
768
779
  : currentMode === 'icon'
769
780
  ? hoverExpandActive
770
- ? `absolute inset-y-0 ${dockEdge} z-[65] transition-[width] duration-200 ${effectivelyExpanded ? 'w-[var(--sbm-expanded-w)] shadow-lg' : 'w-[var(--sbm-collapsed-w)]'}`
771
- : 'relative w-[var(--sbm-collapsed-w)]'
772
- : 'relative w-[var(--sbm-expanded-w)]'}
781
+ ? `absolute inset-y-0 ${dockEdge} z-[65] transition-[width] duration-200 ${effectivelyExpanded ? 'shadow-lg' : ''}`
782
+ : 'relative'
783
+ : 'relative'}
773
784
  {additionalClass}
774
785
  "
775
786
  >
@@ -802,6 +813,7 @@
802
813
  side={popoutSide}
803
814
  align={geom.align}
804
815
  offset={0}
816
+ margin={0}
805
817
  onclose={() => {
806
818
  if (openId === id) openId = null;
807
819
  }}
@@ -838,6 +850,7 @@
838
850
  side={popoutSide}
839
851
  align={geom.align}
840
852
  offset={0}
853
+ margin={0}
841
854
  onclose={() => {
842
855
  if (openId === id) openId = null;
843
856
  }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaethtech/svelte-ui",
3
- "version": "0.7.1-dev.44.97afb0d",
3
+ "version": "0.7.1-dev.45.41387ea",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/spaethtech/svelte-ui.git"