@zag-js/popper
Advanced tools
Comparing version 0.0.0-dev-20240611102459 to 0.0.0-dev-20240611130830
@@ -54,4 +54,3 @@ "use strict"; | ||
function getDOMRect(anchorRect) { | ||
if (!anchorRect) | ||
return createDOMRect(); | ||
if (!anchorRect) return createDOMRect(); | ||
const { x, y, width, height } = anchorRect; | ||
@@ -118,9 +117,7 @@ return createDOMRect(x, y, width, height); | ||
var shiftArrowMiddleware = (arrowEl) => { | ||
if (!arrowEl) | ||
return; | ||
if (!arrowEl) return; | ||
return { | ||
name: "shiftArrow", | ||
fn({ placement, middlewareData }) { | ||
if (!middlewareData.arrow) | ||
return {}; | ||
if (!middlewareData.arrow) return {}; | ||
const { x, y } = middlewareData.arrow; | ||
@@ -172,4 +169,3 @@ const dir = placement.split("-")[0]; | ||
function getArrowMiddleware(arrowElement, opts) { | ||
if (!arrowElement) | ||
return; | ||
if (!arrowElement) return; | ||
return (0, import_dom.arrow)({ | ||
@@ -181,4 +177,3 @@ element: arrowElement, | ||
function getOffsetMiddleware(arrowElement, opts) { | ||
if ((0, import_utils.isNull)(opts.offset ?? opts.gutter)) | ||
return; | ||
if ((0, import_utils.isNull)(opts.offset ?? opts.gutter)) return; | ||
return (0, import_dom.offset)(({ placement }) => { | ||
@@ -199,4 +194,3 @@ const arrowOffset = (arrowElement?.clientHeight || 0) / 2; | ||
function getFlipMiddleware(opts) { | ||
if (!opts.flip) | ||
return; | ||
if (!opts.flip) return; | ||
return (0, import_dom.flip)({ | ||
@@ -209,4 +203,3 @@ boundary: getBoundaryMiddleware(opts), | ||
function getShiftMiddleware(opts) { | ||
if (!opts.slide && !opts.overlap) | ||
return; | ||
if (!opts.slide && !opts.overlap) return; | ||
return (0, import_dom.shift)({ | ||
@@ -235,4 +228,3 @@ boundary: getBoundaryMiddleware(opts), | ||
function getAutoUpdateOptions(opts) { | ||
if (!opts) | ||
return {}; | ||
if (!opts) return {}; | ||
if (opts === true) { | ||
@@ -245,4 +237,3 @@ return { ancestorResize: true, ancestorScroll: true, elementResize: true, layoutShift: true }; | ||
const reference = getAnchorElement(referenceOrVirtual, opts.getAnchorRect); | ||
if (!floating || !reference) | ||
return; | ||
if (!floating || !reference) return; | ||
const options = Object.assign({}, defaultOptions, opts); | ||
@@ -262,4 +253,3 @@ const arrowEl = floating.querySelector("[data-part=arrow]"); | ||
const updatePosition = async () => { | ||
if (!reference || !floating) | ||
return; | ||
if (!reference || !floating) return; | ||
const pos = await (0, import_dom.computePosition)(reference, floating, { | ||
@@ -266,0 +256,0 @@ placement, |
{ | ||
"name": "@zag-js/popper", | ||
"version": "0.0.0-dev-20240611102459", | ||
"version": "0.0.0-dev-20240611130830", | ||
"description": "Dynamic positioning logic for ui machines", | ||
@@ -27,4 +27,4 @@ "keywords": [ | ||
"@floating-ui/dom": "1.6.5", | ||
"@zag-js/dom-query": "0.0.0-dev-20240611102459", | ||
"@zag-js/utils": "0.0.0-dev-20240611102459" | ||
"@zag-js/dom-query": "0.0.0-dev-20240611130830", | ||
"@zag-js/utils": "0.0.0-dev-20240611130830" | ||
}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
89981
1225
+ Added@zag-js/dom-query@0.0.0-dev-20240611130830(transitive)
+ Added@zag-js/utils@0.0.0-dev-20240611130830(transitive)
- Removed@zag-js/dom-query@0.0.0-dev-20240611102459(transitive)
- Removed@zag-js/utils@0.0.0-dev-20240611102459(transitive)