Skip to content

Commit

Permalink
middlewares as export (#1149)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjagielka authored Nov 7, 2023
1 parent 0610728 commit 7ed135d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/utils/Popper.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
export let strategy: 'absolute' | 'fixed' = 'absolute';
export let open: boolean = false;
export let yOnly: boolean = false;
// extra floating UI middleware list
export let middlewares: Middleware[] = [dom.flip(), dom.shift()];
const dispatch = createEventDispatcher();
Expand Down Expand Up @@ -81,8 +83,7 @@
top: 'bottom'
};
let middleware: (Middleware | null)[];
$: middleware = [dom.flip(), dom.shift(), dom.offset(+offset), arrowEl && dom.arrow({ element: arrowEl, padding: 10 })];
$: middleware = [...middlewares, dom.offset(+offset), arrowEl && dom.arrow({ element: arrowEl, padding: 10 })];
function updatePosition() {
dom.computePosition(referenceEl, floatingEl, { placement, strategy, middleware }).then(({ x, y, middlewareData, placement, strategy }: ComputePositionReturn) => {
Expand Down

2 comments on commit 7ed135d

@vercel
Copy link

@vercel vercel bot commented on 7ed135d Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 7ed135d Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.