@floating-ui/vue
Advanced tools
Comparing version 1.0.7 to 1.1.0
@@ -72,3 +72,3 @@ import { AlignedPlacement } from '@floating-ui/dom'; | ||
*/ | ||
element: MaybeReadonlyRef<MaybeElement<Element>>; | ||
element: MaybeReadonlyRefOrGetter<MaybeElement<Element>>; | ||
/** | ||
@@ -139,2 +139,4 @@ * The padding between the arrow element and the floating element edges. Useful when the floating element has rounded corners. | ||
export declare type MaybeReadonlyRefOrGetter<T> = MaybeReadonlyRef<T> | (() => T); | ||
export { Middleware } | ||
@@ -198,3 +200,3 @@ | ||
*/ | ||
open?: MaybeReadonlyRef<boolean | undefined>; | ||
open?: MaybeReadonlyRefOrGetter<boolean | undefined>; | ||
/** | ||
@@ -204,3 +206,3 @@ * Where to place the floating element relative to its reference element. | ||
*/ | ||
placement?: MaybeReadonlyRef<Placement | undefined>; | ||
placement?: MaybeReadonlyRefOrGetter<Placement | undefined>; | ||
/** | ||
@@ -210,3 +212,3 @@ * The type of CSS position property to use. | ||
*/ | ||
strategy?: MaybeReadonlyRef<Strategy | undefined>; | ||
strategy?: MaybeReadonlyRefOrGetter<Strategy | undefined>; | ||
/** | ||
@@ -216,3 +218,3 @@ * These are plain objects that modify the positioning coordinates in some fashion, or provide useful data for the consumer to use. | ||
*/ | ||
middleware?: MaybeReadonlyRef<Middleware[] | undefined>; | ||
middleware?: MaybeReadonlyRefOrGetter<Middleware[] | undefined>; | ||
/** | ||
@@ -223,3 +225,3 @@ * Whether to use `transform` instead of `top` and `left` styles to | ||
*/ | ||
transform?: MaybeReadonlyRef<boolean | undefined>; | ||
transform?: MaybeReadonlyRefOrGetter<boolean | undefined>; | ||
/** | ||
@@ -226,0 +228,0 @@ * Callback to handle mounting/unmounting of the elements. |
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 { unref, computed, ref, shallowRef, watch, getCurrentScope, onScopeDispose, shallowReadonly } from 'vue-demi'; | ||
import { toValue, computed, ref, shallowRef, watch, getCurrentScope, onScopeDispose, shallowReadonly } from 'vue-demi'; | ||
import { isNode, getNodeName } from '@floating-ui/utils/dom'; | ||
@@ -27,3 +27,3 @@ | ||
fn(args) { | ||
const element = unwrapElement(unref(options.element)); | ||
const element = unwrapElement(toValue(options.element)); | ||
if (element == null) { | ||
@@ -66,17 +66,17 @@ return {}; | ||
const openOption = computed(() => { | ||
var _unref; | ||
return (_unref = unref(options.open)) != null ? _unref : true; | ||
var _toValue; | ||
return (_toValue = toValue(options.open)) != null ? _toValue : true; | ||
}); | ||
const middlewareOption = computed(() => unref(options.middleware)); | ||
const middlewareOption = computed(() => toValue(options.middleware)); | ||
const placementOption = computed(() => { | ||
var _unref2; | ||
return (_unref2 = unref(options.placement)) != null ? _unref2 : 'bottom'; | ||
var _toValue2; | ||
return (_toValue2 = toValue(options.placement)) != null ? _toValue2 : 'bottom'; | ||
}); | ||
const strategyOption = computed(() => { | ||
var _unref3; | ||
return (_unref3 = unref(options.strategy)) != null ? _unref3 : 'absolute'; | ||
var _toValue3; | ||
return (_toValue3 = toValue(options.strategy)) != null ? _toValue3 : 'absolute'; | ||
}); | ||
const transformOption = computed(() => { | ||
var _unref4; | ||
return (_unref4 = unref(options.transform)) != null ? _unref4 : true; | ||
var _toValue4; | ||
return (_toValue4 = toValue(options.transform)) != null ? _toValue4 : true; | ||
}); | ||
@@ -83,0 +83,0 @@ const referenceElement = computed(() => unwrapElement(reference.value)); |
@@ -28,3 +28,3 @@ (function (global, factory) { | ||
fn(args) { | ||
const element = unwrapElement(vueDemi.unref(options.element)); | ||
const element = unwrapElement(vueDemi.toValue(options.element)); | ||
if (element == null) { | ||
@@ -67,17 +67,17 @@ return {}; | ||
const openOption = vueDemi.computed(() => { | ||
var _unref; | ||
return (_unref = vueDemi.unref(options.open)) != null ? _unref : true; | ||
var _toValue; | ||
return (_toValue = vueDemi.toValue(options.open)) != null ? _toValue : true; | ||
}); | ||
const middlewareOption = vueDemi.computed(() => vueDemi.unref(options.middleware)); | ||
const middlewareOption = vueDemi.computed(() => vueDemi.toValue(options.middleware)); | ||
const placementOption = vueDemi.computed(() => { | ||
var _unref2; | ||
return (_unref2 = vueDemi.unref(options.placement)) != null ? _unref2 : 'bottom'; | ||
var _toValue2; | ||
return (_toValue2 = vueDemi.toValue(options.placement)) != null ? _toValue2 : 'bottom'; | ||
}); | ||
const strategyOption = vueDemi.computed(() => { | ||
var _unref3; | ||
return (_unref3 = vueDemi.unref(options.strategy)) != null ? _unref3 : 'absolute'; | ||
var _toValue3; | ||
return (_toValue3 = vueDemi.toValue(options.strategy)) != null ? _toValue3 : 'absolute'; | ||
}); | ||
const transformOption = vueDemi.computed(() => { | ||
var _unref4; | ||
return (_unref4 = vueDemi.unref(options.transform)) != null ? _unref4 : true; | ||
var _toValue4; | ||
return (_toValue4 = vueDemi.toValue(options.transform)) != null ? _toValue4 : true; | ||
}); | ||
@@ -84,0 +84,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,u){"use strict";function o(e){if(function(e){return null!=e&&"object"==typeof e&&"$el"in e}(e)){const t=e.$el;return u.isNode(t)&&"#comment"===u.getNodeName(t)?null:t}return e}function r(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function l(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(u){const r=o(n.unref(e.element));return null==r?{}:t.arrow({element:r,padding:e.padding}).fn(u)}}},e.useFloating=function(e,u,i){void 0===i&&(i={});const a=i.whileElementsMounted,f=n.computed((()=>{var e;return null==(e=n.unref(i.open))||e})),c=n.computed((()=>n.unref(i.middleware))),d=n.computed((()=>{var e;return null!=(e=n.unref(i.placement))?e:"bottom"})),s=n.computed((()=>{var e;return null!=(e=n.unref(i.strategy))?e:"absolute"})),p=n.computed((()=>{var e;return null==(e=n.unref(i.transform))||e})),m=n.computed((()=>o(e.value))),v=n.computed((()=>o(u.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=l(v.value,y.value),n=l(v.value,g.value);return p.value?{...e,transform:"translate("+t+"px, "+n+"px)",...r(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 R(){"function"==typeof j&&(j(),j=void 0)}return n.watch([c,d,s],x,{flush:"sync"}),n.watch([m,v],(function(){R(),void 0!==a?null==m.value||null==v.value||(j=a(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(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("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}}})); |
{ | ||
"name": "@floating-ui/vue", | ||
"version": "1.0.7", | ||
"version": "1.1.0", | ||
"description": "Floating UI for Vue", | ||
@@ -49,3 +49,3 @@ "publishConfig": { | ||
"vue-demi": ">=0.13.0", | ||
"@floating-ui/utils": "^0.2.3" | ||
"@floating-ui/utils": "^0.2.4" | ||
}, | ||
@@ -52,0 +52,0 @@ "devDependencies": { |
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
41834
798
Updated@floating-ui/utils@^0.2.4