@broberg/app-shell 0.20.1 → 0.21.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/preact.d.cts CHANGED
@@ -471,8 +471,12 @@ interface ItemActionsMenuProps {
471
471
  lang: Lang;
472
472
  /** The menu's accessible name, e.g. the conversation's title. */
473
473
  label: string;
474
- /** "auto" (default): below the anchor if it fits, else above. "down": always below. */
475
- placement?: "auto" | "down";
474
+ /**
475
+ * "auto" (default): right-aligned to the anchor, below it if it fits, else above.
476
+ * "down": right-aligned, always below. "up-start" (F092.31): ABOVE the anchor and
477
+ * left-aligned to its left edge (e.g. a «+» in a composer); below if there is no room above.
478
+ */
479
+ placement?: "auto" | "down" | "up-start";
476
480
  /** testids: `<prefix>-menu`, `<prefix>-action-<id>`, `<prefix>-back`, `<prefix>-input`, `<prefix>-save`. Default "item-actions". */
477
481
  testidPrefix?: string;
478
482
  }
package/dist/preact.d.ts CHANGED
@@ -471,8 +471,12 @@ interface ItemActionsMenuProps {
471
471
  lang: Lang;
472
472
  /** The menu's accessible name, e.g. the conversation's title. */
473
473
  label: string;
474
- /** "auto" (default): below the anchor if it fits, else above. "down": always below. */
475
- placement?: "auto" | "down";
474
+ /**
475
+ * "auto" (default): right-aligned to the anchor, below it if it fits, else above.
476
+ * "down": right-aligned, always below. "up-start" (F092.31): ABOVE the anchor and
477
+ * left-aligned to its left edge (e.g. a «+» in a composer); below if there is no room above.
478
+ */
479
+ placement?: "auto" | "down" | "up-start";
476
480
  /** testids: `<prefix>-menu`, `<prefix>-action-<id>`, `<prefix>-back`, `<prefix>-input`, `<prefix>-save`. Default "item-actions". */
477
481
  testidPrefix?: string;
478
482
  }
package/dist/preact.js CHANGED
@@ -577,9 +577,12 @@ function ItemActionsMenu(props) {
577
577
  const vw = window.innerWidth, vh = window.innerHeight, m = 8;
578
578
  const w = Math.min(240, vw - 2 * m);
579
579
  const h = menu.current?.offsetHeight ?? 0;
580
- const left = Math.max(m, Math.min(r.right - w, vw - w - m));
580
+ const start = props.placement === "up-start";
581
+ const left = Math.max(m, Math.min(start ? r.left : r.right - w, vw - w - m));
581
582
  const fitsBelow = r.bottom + 4 + h <= vh - m;
582
- const top = props.placement === "down" || fitsBelow || r.top - 4 - h < m ? Math.min(r.bottom + 4, vh - m - h) : r.top - 4 - h;
583
+ const fitsAbove = r.top - 4 - h >= m;
584
+ const below = start ? !fitsAbove : props.placement === "down" || fitsBelow || !fitsAbove;
585
+ const top = below ? Math.min(r.bottom + 4, vh - m - h) : r.top - 4 - h;
583
586
  setPos({ position: "fixed", left: `${left}px`, top: `${Math.max(m, top)}px`, width: `${w}px` });
584
587
  }, [stack.length]);
585
588
  useLayoutEffect(() => {