@floating-ui/vue
Advanced tools
Comparing version 1.0.1 to 1.0.2
import { arrow as arrow$1, computePosition } from '@floating-ui/dom'; | ||
export * from '@floating-ui/dom'; | ||
export { autoPlacement, autoUpdate, computePosition, detectOverflow, flip, getOverflowAncestors, hide, inline, limitShift, offset, platform, shift, size } from '@floating-ui/dom'; | ||
import { unref, computed, ref, shallowRef, watch, getCurrentScope, onScopeDispose, shallowReadonly } from 'vue-demi'; | ||
@@ -4,0 +4,0 @@ |
@@ -1,1 +0,1 @@ | ||
import{arrow as e,computePosition as n}from"@floating-ui/dom";export*from"@floating-ui/dom";import{unref as l,computed as t,ref as u,shallowRef as a,watch as o,getCurrentScope as r,onScopeDispose as i,shallowReadonly as v}from"vue-demi";function f(e){var n;return null!=(n=null==e?void 0:e.$el)?n:e}function d(n){return{name:"arrow",options:n,fn(t){const u=f(l(n.element));return null==u?{}:e({element:u,padding:n.padding}).fn(t)}}}function s(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function m(e,n){const l=s(e);return Math.round(n*l)/l}function c(e,d,c){void 0===c&&(c={});const p=c.whileElementsMounted,w=t((()=>{var e;return null==(e=l(c.open))||e})),y=t((()=>l(c.middleware))),g=t((()=>{var e;return null!=(e=l(c.placement))?e:"bottom"})),x=t((()=>{var e;return null!=(e=l(c.strategy))?e:"absolute"})),h=t((()=>{var e;return null==(e=l(c.transform))||e})),D=t((()=>f(e.value))),b=t((()=>f(d.value))),M=u(0),P=u(0),C=u(x.value),E=u(g.value),R=a({}),S=u(!1),V=t((()=>{const e={position:C.value,left:"0",top:"0"};if(!b.value)return e;const n=m(b.value,M.value),l=m(b.value,P.value);return h.value?{...e,transform:"translate("+n+"px, "+l+"px)",...s(b.value)>=1.5&&{willChange:"transform"}}:{position:C.value,left:n+"px",top:l+"px"}}));let $;function j(){null!=D.value&&null!=b.value&&n(D.value,b.value,{middleware:y.value,placement:g.value,strategy:x.value}).then((e=>{M.value=e.x,P.value=e.y,C.value=e.strategy,E.value=e.placement,R.value=e.middlewareData,S.value=!0}))}function k(){"function"==typeof $&&($(),$=void 0)}return o([y,g,x],j,{flush:"sync"}),o([D,b],(function(){k(),void 0!==p?null==D.value||null==b.value||($=p(D.value,b.value,j)):j()}),{flush:"sync"}),o(w,(function(){w.value||(S.value=!1)}),{flush:"sync"}),r()&&i(k),{x:v(M),y:v(P),strategy:v(C),placement:v(E),middlewareData:v(R),isPositioned:v(S),floatingStyles:V,update:j}}export{d as arrow,c as useFloating}; | ||
import{arrow as e,computePosition as t}from"@floating-ui/dom";export{autoPlacement,autoUpdate,computePosition,detectOverflow,flip,getOverflowAncestors,hide,inline,limitShift,offset,platform,shift,size}from"@floating-ui/dom";import{unref as n,computed as l,ref as u,shallowRef as a,watch as o,getCurrentScope as r,onScopeDispose as i,shallowReadonly as v}from"vue-demi";function f(e){var t;return null!=(t=null==e?void 0:e.$el)?t:e}function s(t){return{name:"arrow",options:t,fn(l){const u=f(n(t.element));return null==u?{}:e({element:u,padding:t.padding}).fn(l)}}}function d(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function m(e,t){const n=d(e);return Math.round(t*n)/n}function c(e,s,c){void 0===c&&(c={});const p=c.whileElementsMounted,w=l((()=>{var e;return null==(e=n(c.open))||e})),y=l((()=>n(c.middleware))),g=l((()=>{var e;return null!=(e=n(c.placement))?e:"bottom"})),h=l((()=>{var e;return null!=(e=n(c.strategy))?e:"absolute"})),x=l((()=>{var e;return null==(e=n(c.transform))||e})),P=l((()=>f(e.value))),D=l((()=>f(s.value))),b=u(0),M=u(0),O=u(h.value),S=u(g.value),z=a({}),A=u(!1),C=l((()=>{const e={position:O.value,left:"0",top:"0"};if(!D.value)return e;const t=m(D.value,b.value),n=m(D.value,M.value);return x.value?{...e,transform:"translate("+t+"px, "+n+"px)",...d(D.value)>=1.5&&{willChange:"transform"}}:{position:O.value,left:t+"px",top:n+"px"}}));let E;function R(){null!=P.value&&null!=D.value&&t(P.value,D.value,{middleware:y.value,placement:g.value,strategy:h.value}).then((e=>{b.value=e.x,M.value=e.y,O.value=e.strategy,S.value=e.placement,z.value=e.middlewareData,A.value=!0}))}function U(){"function"==typeof E&&(E(),E=void 0)}return o([y,g,h],R,{flush:"sync"}),o([P,D],(function(){U(),void 0!==p?null==P.value||null==D.value||(E=p(P.value,D.value,R)):R()}),{flush:"sync"}),o(w,(function(){w.value||(A.value=!1)}),{flush:"sync"}),r()&&i(U),{x:v(b),y:v(M),strategy:v(O),placement:v(S),middlewareData:v(z),isPositioned:v(A),floatingStyles:C,update:R}}export{s as arrow,c as useFloating}; |
@@ -174,13 +174,57 @@ (function (global, factory) { | ||
Object.defineProperty(exports, 'autoPlacement', { | ||
enumerable: true, | ||
get: function () { return dom.autoPlacement; } | ||
}); | ||
Object.defineProperty(exports, 'autoUpdate', { | ||
enumerable: true, | ||
get: function () { return dom.autoUpdate; } | ||
}); | ||
Object.defineProperty(exports, 'computePosition', { | ||
enumerable: true, | ||
get: function () { return dom.computePosition; } | ||
}); | ||
Object.defineProperty(exports, 'detectOverflow', { | ||
enumerable: true, | ||
get: function () { return dom.detectOverflow; } | ||
}); | ||
Object.defineProperty(exports, 'flip', { | ||
enumerable: true, | ||
get: function () { return dom.flip; } | ||
}); | ||
Object.defineProperty(exports, 'getOverflowAncestors', { | ||
enumerable: true, | ||
get: function () { return dom.getOverflowAncestors; } | ||
}); | ||
Object.defineProperty(exports, 'hide', { | ||
enumerable: true, | ||
get: function () { return dom.hide; } | ||
}); | ||
Object.defineProperty(exports, 'inline', { | ||
enumerable: true, | ||
get: function () { return dom.inline; } | ||
}); | ||
Object.defineProperty(exports, 'limitShift', { | ||
enumerable: true, | ||
get: function () { return dom.limitShift; } | ||
}); | ||
Object.defineProperty(exports, 'offset', { | ||
enumerable: true, | ||
get: function () { return dom.offset; } | ||
}); | ||
Object.defineProperty(exports, 'platform', { | ||
enumerable: true, | ||
get: function () { return dom.platform; } | ||
}); | ||
Object.defineProperty(exports, 'shift', { | ||
enumerable: true, | ||
get: function () { return dom.shift; } | ||
}); | ||
Object.defineProperty(exports, 'size', { | ||
enumerable: true, | ||
get: function () { return dom.size; } | ||
}); | ||
exports.arrow = arrow; | ||
exports.useFloating = useFloating; | ||
Object.keys(dom).forEach(function (k) { | ||
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, { | ||
enumerable: true, | ||
get: function () { return dom[k]; } | ||
}); | ||
}); | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
})); |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@floating-ui/dom"),require("vue-demi")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/dom","vue-demi"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIVue={},e.FloatingUIDOM,e.VueDemi)}(this,(function(e,n,t){"use strict";function l(e){var n;return null!=(n=null==e?void 0:e.$el)?n:e}function u(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function o(e,n){const t=u(e);return Math.round(n*t)/t}e.arrow=function(e){return{name:"arrow",options:e,fn(u){const o=l(t.unref(e.element));return null==o?{}:n.arrow({element:o,padding:e.padding}).fn(u)}}},e.useFloating=function(e,a,r){void 0===r&&(r={});const i=r.whileElementsMounted,f=t.computed((()=>{var e;return null==(e=t.unref(r.open))||e})),d=t.computed((()=>t.unref(r.middleware))),s=t.computed((()=>{var e;return null!=(e=t.unref(r.placement))?e:"bottom"})),c=t.computed((()=>{var e;return null!=(e=t.unref(r.strategy))?e:"absolute"})),v=t.computed((()=>{var e;return null==(e=t.unref(r.transform))||e})),p=t.computed((()=>l(e.value))),m=t.computed((()=>l(a.value))),w=t.ref(0),y=t.ref(0),h=t.ref(c.value),g=t.ref(s.value),x=t.shallowRef({}),b=t.ref(!1),R=t.computed((()=>{const e={position:h.value,left:"0",top:"0"};if(!m.value)return e;const n=o(m.value,w.value),t=o(m.value,y.value);return v.value?{...e,transform:"translate("+n+"px, "+t+"px)",...u(m.value)>=1.5&&{willChange:"transform"}}:{position:h.value,left:n+"px",top:t+"px"}}));let D;function P(){null!=p.value&&null!=m.value&&n.computePosition(p.value,m.value,{middleware:d.value,placement:s.value,strategy:c.value}).then((e=>{w.value=e.x,y.value=e.y,h.value=e.strategy,g.value=e.placement,x.value=e.middlewareData,b.value=!0}))}function O(){"function"==typeof D&&(D(),D=void 0)}return t.watch([d,s,c],P,{flush:"sync"}),t.watch([p,m],(function(){O(),void 0!==i?null==p.value||null==m.value||(D=i(p.value,m.value,P)):P()}),{flush:"sync"}),t.watch(f,(function(){f.value||(b.value=!1)}),{flush:"sync"}),t.getCurrentScope()&&t.onScopeDispose(O),{x:t.shallowReadonly(w),y:t.shallowReadonly(y),strategy:t.shallowReadonly(h),placement:t.shallowReadonly(g),middlewareData:t.shallowReadonly(x),isPositioned:t.shallowReadonly(b),floatingStyles:R,update:P}},Object.keys(n).forEach((function(t){"default"===t||e.hasOwnProperty(t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})),Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@floating-ui/dom"),require("vue-demi")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/dom","vue-demi"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIVue={},e.FloatingUIDOM,e.VueDemi)}(this,(function(e,t,n){"use strict";function u(e){var t;return null!=(t=null==e?void 0:e.$el)?t:e}function r(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function o(e,t){const n=r(e);return Math.round(t*n)/n}Object.defineProperty(e,"autoPlacement",{enumerable:!0,get:function(){return t.autoPlacement}}),Object.defineProperty(e,"autoUpdate",{enumerable:!0,get:function(){return t.autoUpdate}}),Object.defineProperty(e,"computePosition",{enumerable:!0,get:function(){return t.computePosition}}),Object.defineProperty(e,"detectOverflow",{enumerable:!0,get:function(){return t.detectOverflow}}),Object.defineProperty(e,"flip",{enumerable:!0,get:function(){return t.flip}}),Object.defineProperty(e,"getOverflowAncestors",{enumerable:!0,get:function(){return t.getOverflowAncestors}}),Object.defineProperty(e,"hide",{enumerable:!0,get:function(){return t.hide}}),Object.defineProperty(e,"inline",{enumerable:!0,get:function(){return t.inline}}),Object.defineProperty(e,"limitShift",{enumerable:!0,get:function(){return t.limitShift}}),Object.defineProperty(e,"offset",{enumerable:!0,get:function(){return t.offset}}),Object.defineProperty(e,"platform",{enumerable:!0,get:function(){return t.platform}}),Object.defineProperty(e,"shift",{enumerable:!0,get:function(){return t.shift}}),Object.defineProperty(e,"size",{enumerable:!0,get:function(){return t.size}}),e.arrow=function(e){return{name:"arrow",options:e,fn(r){const o=u(n.unref(e.element));return null==o?{}:t.arrow({element:o,padding:e.padding}).fn(r)}}},e.useFloating=function(e,l,a){void 0===a&&(a={});const i=a.whileElementsMounted,f=n.computed((()=>{var e;return null==(e=n.unref(a.open))||e})),c=n.computed((()=>n.unref(a.middleware))),d=n.computed((()=>{var e;return null!=(e=n.unref(a.placement))?e:"bottom"})),p=n.computed((()=>{var e;return null!=(e=n.unref(a.strategy))?e:"absolute"})),s=n.computed((()=>{var e;return null==(e=n.unref(a.transform))||e})),m=n.computed((()=>u(e.value))),v=n.computed((()=>u(l.value))),y=n.ref(0),b=n.ref(0),g=n.ref(p.value),w=n.ref(d.value),h=n.shallowRef({}),P=n.ref(!1),O=n.computed((()=>{const e={position:g.value,left:"0",top:"0"};if(!v.value)return e;const t=o(v.value,y.value),n=o(v.value,b.value);return s.value?{...e,transform:"translate("+t+"px, "+n+"px)",...r(v.value)>=1.5&&{willChange:"transform"}}:{position:g.value,left:t+"px",top:n+"px"}}));let j;function x(){null!=m.value&&null!=v.value&&t.computePosition(m.value,v.value,{middleware:c.value,placement:d.value,strategy:p.value}).then((e=>{y.value=e.x,b.value=e.y,g.value=e.strategy,w.value=e.placement,h.value=e.middlewareData,P.value=!0}))}function R(){"function"==typeof j&&(j(),j=void 0)}return n.watch([c,d,p],x,{flush:"sync"}),n.watch([m,v],(function(){R(),void 0!==i?null==m.value||null==v.value||(j=i(m.value,v.value,x)):x()}),{flush:"sync"}),n.watch(f,(function(){f.value||(P.value=!1)}),{flush:"sync"}),n.getCurrentScope()&&n.onScopeDispose(R),{x:n.shallowReadonly(y),y:n.shallowReadonly(b),strategy:n.shallowReadonly(g),placement:n.shallowReadonly(w),middlewareData:n.shallowReadonly(h),isPositioned:n.shallowReadonly(P),floatingStyles:O,update:x}}})); |
{ | ||
"name": "@floating-ui/vue", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"@rollingversions": { | ||
@@ -35,5 +35,5 @@ "baseVersion": [ | ||
"scripts": { | ||
"test": "jest test", | ||
"test": "vitest", | ||
"build": "NODE_ENV=build rollup -c", | ||
"dev": "parcel test/visual/index.html" | ||
"dev": "vite" | ||
}, | ||
@@ -59,3 +59,3 @@ "author": "lozinsky", | ||
"dependencies": { | ||
"@floating-ui/dom": "^1.2.9", | ||
"@floating-ui/dom": "^1.4.5", | ||
"vue-demi": ">=0.13.0" | ||
@@ -65,6 +65,6 @@ }, | ||
"@parcel/transformer-vue": "^2.6.0", | ||
"@rollup/plugin-commonjs": "^21.0.1", | ||
"@testing-library/vue": "^6.6.1", | ||
"@vitejs/plugin-vue": "^4.2.3", | ||
"vue": "^3.2.45" | ||
} | ||
} |
export { arrow } from './arrow'; | ||
export { useFloating } from './useFloating'; | ||
export * from '@floating-ui/dom'; | ||
export { autoPlacement, autoUpdate, computePosition, detectOverflow, flip, getOverflowAncestors, hide, inline, limitShift, offset, platform, shift, size, } from '@floating-ui/dom'; |
@@ -87,3 +87,3 @@ import type { FloatingElement, Middleware, MiddlewareData, Padding, Placement, ReferenceElement, Strategy } from '@floating-ui/dom'; | ||
*/ | ||
element: MaybeReadonlyRef<MaybeElement<HTMLElement>>; | ||
element: MaybeReadonlyRef<MaybeElement<Element>>; | ||
/** | ||
@@ -90,0 +90,0 @@ * The padding between the arrow element and the floating element edges. Useful when the floating element has rounded corners. |
import type { ComponentPublicInstance } from 'vue-demi'; | ||
import type { MaybeElement } from '../types'; | ||
export declare function unwrapElement<T>(element: MaybeElement<T>): Exclude<T, ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue-demi").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>> | null | undefined; | ||
export declare function unwrapElement<T>(element: MaybeElement<T>): Exclude<T, ComponentPublicInstance> | null | undefined; |
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
32111
699
Updated@floating-ui/dom@^1.4.5