@lofid/web 1.1.1 → 1.1.2

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.
@@ -3,7 +3,7 @@
3
3
  "readme": "README.md",
4
4
  "package": {
5
5
  "name": "@lofid/web",
6
- "version": "1.1.1"
6
+ "version": "1.1.2"
7
7
  },
8
8
  "modules": [
9
9
  {
@@ -7394,7 +7394,7 @@
7394
7394
  "declarations": [
7395
7395
  {
7396
7396
  "kind": "class",
7397
- "description": "`<lof-resizable-panel>` — one pane of a `<lof-resizable-group>`. Its size is a percentage of the group, set by the group as the host's `flex-basis`.",
7397
+ "description": "`<lof-resizable-panel>` — one pane of a `<lof-resizable-group>`. Its size is a percentage of the group, set by the group as the host's flex-grow: panels share what the handles leave, so the group never overflows, and a panel never grows past its share to fit its content (it scrolls).",
7398
7398
  "name": "LofResizablePanel",
7399
7399
  "tagName": "lof-resizable-panel",
7400
7400
  "customElement": true,
package/dist/index.d.ts CHANGED
@@ -1981,6 +1981,8 @@ declare class LofResizableGroup extends LofElement {
1981
1981
  private resize;
1982
1982
  private pairFor;
1983
1983
  private onPointerDown;
1984
+ /** Space the panels' flex-grow divides: their sizes minus padding and borders. */
1985
+ private sharedExtent;
1984
1986
  private onPointerMove;
1985
1987
  private onPointerEnd;
1986
1988
  private onKeyDown;
@@ -1994,7 +1996,8 @@ declare global {
1994
1996
 
1995
1997
  /**
1996
1998
  * `<lof-resizable-panel>` — one pane of a `<lof-resizable-group>`. Its size is
1997
- * a percentage of the group, set by the group as the host's `flex-basis`.
1999
+ * a percentage of the group, set by the group as the host's flex-grow: panels share what the handles
2000
+ * leave, so the group never overflows, and a panel never grows past its share to fit its content (it scrolls).
1998
2001
  */
1999
2002
  declare class LofResizablePanel extends LofElement {
2000
2003
  static styles: lit.CSSResult;
package/dist/index.js CHANGED
@@ -13312,7 +13312,7 @@ var LofResizablePanel = class extends LofElement {
13312
13312
  /** @internal */
13313
13313
  applySize(pct) {
13314
13314
  this.size = pct;
13315
- this.style.flex = `0 0 ${pct}%`;
13315
+ this.style.flex = `${pct} 1 0px`;
13316
13316
  }
13317
13317
  render() {
13318
13318
  return html37`<slot></slot>`;
@@ -13326,6 +13326,8 @@ LofResizablePanel.styles = css36`
13326
13326
  padding: 16px;
13327
13327
  overflow: auto;
13328
13328
  flex: 0 0 auto;
13329
+ min-width: 0;
13330
+ min-height: 0;
13329
13331
  }
13330
13332
  :host([hidden]) { display: none; }
13331
13333
  /* a scrollable panel is a Tab stop: 2px ring inside the edge (the group clips outside) */
@@ -13546,7 +13548,8 @@ var LofResizableGroup = class extends LofElement {
13546
13548
  this.drag = {
13547
13549
  pair: pr,
13548
13550
  start: vertical ? e.clientY : e.clientX,
13549
- extent: vertical ? rect.height : rect.width,
13551
+ // panels divide what the handles and their own padding leave, so a drag is measured against that
13552
+ extent: this.sharedExtent(vertical) || (vertical ? rect.height : rect.width),
13550
13553
  a: this.sizes[pr.a],
13551
13554
  b: this.sizes[pr.b],
13552
13555
  id: e.pointerId
@@ -13554,6 +13557,14 @@ var LofResizableGroup = class extends LofElement {
13554
13557
  pr.handle.setAttribute("data-dragging", "");
13555
13558
  this.setPointerCapture?.(e.pointerId);
13556
13559
  }
13560
+ /** Space the panels' flex-grow divides: their sizes minus padding and borders. */
13561
+ sharedExtent(vertical) {
13562
+ return [...this.querySelectorAll(":scope > lof-resizable-panel")].reduce((sum, p) => {
13563
+ const r = p.getBoundingClientRect(), cs = getComputedStyle(p);
13564
+ const edges = vertical ? ["paddingTop", "paddingBottom", "borderTopWidth", "borderBottomWidth"] : ["paddingLeft", "paddingRight", "borderLeftWidth", "borderRightWidth"];
13565
+ return sum + (vertical ? r.height : r.width) - edges.reduce((s, k) => s + (parseFloat(cs[k]) || 0), 0);
13566
+ }, 0);
13567
+ }
13557
13568
  onPointerMove(e) {
13558
13569
  const d = this.drag;
13559
13570
  if (!d || e.pointerId !== d.id) return;