@floating-ui/vue
Advanced tools
Comparing version 1.1.0 to 1.1.1
import { arrow as arrow$1, computePosition } from '@floating-ui/dom'; | ||
export { autoPlacement, autoUpdate, computePosition, detectOverflow, flip, getOverflowAncestors, hide, inline, limitShift, offset, platform, shift, size } from '@floating-ui/dom'; | ||
import { toValue, computed, ref, shallowRef, watch, getCurrentScope, onScopeDispose, shallowReadonly } from 'vue-demi'; | ||
import { isNode, getNodeName } from '@floating-ui/utils/dom'; | ||
import { unref, computed, ref, shallowRef, watch, getCurrentScope, onScopeDispose, shallowReadonly } from 'vue-demi'; | ||
@@ -17,2 +17,6 @@ function isComponentPublicInstance(target) { | ||
function toValue(source) { | ||
return typeof source === 'function' ? source() : unref(source); | ||
} | ||
/** | ||
@@ -19,0 +23,0 @@ * Positions an inner element of the floating element such that it is centered to the reference element. |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@floating-ui/dom'), require('vue-demi'), require('@floating-ui/utils/dom')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@floating-ui/dom', 'vue-demi', '@floating-ui/utils/dom'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FloatingUIVue = {}, global.FloatingUIDOM, global.VueDemi, global.FloatingUIUtilsDOM)); | ||
})(this, (function (exports, dom, vueDemi, dom$1) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@floating-ui/dom'), require('@floating-ui/utils/dom'), require('vue-demi')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@floating-ui/dom', '@floating-ui/utils/dom', 'vue-demi'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FloatingUIVue = {}, global.FloatingUIDOM, global.FloatingUIUtilsDOM, global.VueDemi)); | ||
})(this, (function (exports, dom, dom$1, vueDemi) { 'use strict'; | ||
@@ -18,2 +18,6 @@ function isComponentPublicInstance(target) { | ||
function toValue(source) { | ||
return typeof source === 'function' ? source() : vueDemi.unref(source); | ||
} | ||
/** | ||
@@ -29,3 +33,3 @@ * Positions an inner element of the floating element such that it is centered to the reference element. | ||
fn(args) { | ||
const element = unwrapElement(vueDemi.toValue(options.element)); | ||
const element = unwrapElement(toValue(options.element)); | ||
if (element == null) { | ||
@@ -69,16 +73,16 @@ return {}; | ||
var _toValue; | ||
return (_toValue = vueDemi.toValue(options.open)) != null ? _toValue : true; | ||
return (_toValue = toValue(options.open)) != null ? _toValue : true; | ||
}); | ||
const middlewareOption = vueDemi.computed(() => vueDemi.toValue(options.middleware)); | ||
const middlewareOption = vueDemi.computed(() => toValue(options.middleware)); | ||
const placementOption = vueDemi.computed(() => { | ||
var _toValue2; | ||
return (_toValue2 = vueDemi.toValue(options.placement)) != null ? _toValue2 : 'bottom'; | ||
return (_toValue2 = toValue(options.placement)) != null ? _toValue2 : 'bottom'; | ||
}); | ||
const strategyOption = vueDemi.computed(() => { | ||
var _toValue3; | ||
return (_toValue3 = vueDemi.toValue(options.strategy)) != null ? _toValue3 : 'absolute'; | ||
return (_toValue3 = toValue(options.strategy)) != null ? _toValue3 : 'absolute'; | ||
}); | ||
const transformOption = vueDemi.computed(() => { | ||
var _toValue4; | ||
return (_toValue4 = vueDemi.toValue(options.transform)) != null ? _toValue4 : true; | ||
return (_toValue4 = toValue(options.transform)) != null ? _toValue4 : true; | ||
}); | ||
@@ -85,0 +89,0 @@ const referenceElement = vueDemi.computed(() => unwrapElement(reference.value)); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@floating-ui/dom"),require("vue-demi"),require("@floating-ui/utils/dom")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/dom","vue-demi","@floating-ui/utils/dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIVue={},e.FloatingUIDOM,e.VueDemi,e.FloatingUIUtilsDOM)}(this,(function(e,t,n,o){"use strict";function u(e){if(function(e){return null!=e&&"object"==typeof e&&"$el"in e}(e)){const t=e.$el;return o.isNode(t)&&"#comment"===o.getNodeName(t)?null:t}return e}function l(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function r(e,t){const n=l(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(o){const l=u(n.toValue(e.element));return null==l?{}:t.arrow({element:l,padding:e.padding}).fn(o)}}},e.useFloating=function(e,o,a){void 0===a&&(a={});const i=a.whileElementsMounted,f=n.computed((()=>{var e;return null==(e=n.toValue(a.open))||e})),c=n.computed((()=>n.toValue(a.middleware))),d=n.computed((()=>{var e;return null!=(e=n.toValue(a.placement))?e:"bottom"})),s=n.computed((()=>{var e;return null!=(e=n.toValue(a.strategy))?e:"absolute"})),p=n.computed((()=>{var e;return null==(e=n.toValue(a.transform))||e})),m=n.computed((()=>u(e.value))),v=n.computed((()=>u(o.value))),y=n.ref(0),g=n.ref(0),b=n.ref(s.value),w=n.ref(d.value),h=n.shallowRef({}),P=n.ref(!1),O=n.computed((()=>{const e={position:b.value,left:"0",top:"0"};if(!v.value)return e;const t=r(v.value,y.value),n=r(v.value,g.value);return p.value?{...e,transform:"translate("+t+"px, "+n+"px)",...l(v.value)>=1.5&&{willChange:"transform"}}:{position:b.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:s.value}).then((e=>{y.value=e.x,g.value=e.y,b.value=e.strategy,w.value=e.placement,h.value=e.middlewareData,P.value=!0}))}function V(){"function"==typeof j&&(j(),j=void 0)}return n.watch([c,d,s],x,{flush:"sync"}),n.watch([m,v],(function(){V(),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(V),{x:n.shallowReadonly(y),y:n.shallowReadonly(g),strategy:n.shallowReadonly(b),placement:n.shallowReadonly(w),middlewareData:n.shallowReadonly(h),isPositioned:n.shallowReadonly(P),floatingStyles:O,update:x}}})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@floating-ui/dom"),require("@floating-ui/utils/dom"),require("vue-demi")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/dom","@floating-ui/utils/dom","vue-demi"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIVue={},e.FloatingUIDOM,e.FloatingUIUtilsDOM,e.VueDemi)}(this,(function(e,t,n,u){"use strict";function o(e){if(function(e){return null!=e&&"object"==typeof e&&"$el"in e}(e)){const t=e.$el;return n.isNode(t)&&"#comment"===n.getNodeName(t)?null:t}return e}function r(e){return"function"==typeof e?e():u.unref(e)}function l(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function i(e,t){const n=l(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(n){const u=o(r(e.element));return null==u?{}:t.arrow({element:u,padding:e.padding}).fn(n)}}},e.useFloating=function(e,n,a){void 0===a&&(a={});const f=a.whileElementsMounted,c=u.computed((()=>{var e;return null==(e=r(a.open))||e})),d=u.computed((()=>r(a.middleware))),s=u.computed((()=>{var e;return null!=(e=r(a.placement))?e:"bottom"})),p=u.computed((()=>{var e;return null!=(e=r(a.strategy))?e:"absolute"})),m=u.computed((()=>{var e;return null==(e=r(a.transform))||e})),v=u.computed((()=>o(e.value))),y=u.computed((()=>o(n.value))),g=u.ref(0),b=u.ref(0),w=u.ref(p.value),h=u.ref(s.value),P=u.shallowRef({}),O=u.ref(!1),j=u.computed((()=>{const e={position:w.value,left:"0",top:"0"};if(!y.value)return e;const t=i(y.value,g.value),n=i(y.value,b.value);return m.value?{...e,transform:"translate("+t+"px, "+n+"px)",...l(y.value)>=1.5&&{willChange:"transform"}}:{position:w.value,left:t+"px",top:n+"px"}}));let x;function R(){null!=v.value&&null!=y.value&&t.computePosition(v.value,y.value,{middleware:d.value,placement:s.value,strategy:p.value}).then((e=>{g.value=e.x,b.value=e.y,w.value=e.strategy,h.value=e.placement,P.value=e.middlewareData,O.value=!0}))}function D(){"function"==typeof x&&(x(),x=void 0)}return u.watch([d,s,p],R,{flush:"sync"}),u.watch([v,y],(function(){D(),void 0!==f?null==v.value||null==y.value||(x=f(v.value,y.value,R)):R()}),{flush:"sync"}),u.watch(c,(function(){c.value||(O.value=!1)}),{flush:"sync"}),u.getCurrentScope()&&u.onScopeDispose(D),{x:u.shallowReadonly(g),y:u.shallowReadonly(b),strategy:u.shallowReadonly(w),placement:u.shallowReadonly(h),middlewareData:u.shallowReadonly(P),isPositioned:u.shallowReadonly(O),floatingStyles:j,update:R}}})); |
{ | ||
"name": "@floating-ui/vue", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Floating UI for Vue", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
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
42092
807