@tb-dev/vue 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,4 +6,6 @@ export declare function useElementSize<T extends MaybeElement>(element: MaybeRef
6
6
  stop: () => void;
7
7
  };
8
8
  export declare function useHeight<T extends MaybeElement>(element: MaybeRefOrGetter<T>): Readonly<Ref<number>>;
9
+ export declare function useHeightDiff<T extends MaybeElement>(element: MaybeRefOrGetter<T>): import('vue').ComputedRef<number>;
9
10
  export declare function useWidth<T extends MaybeElement>(element: MaybeRefOrGetter<T>): Readonly<Ref<number>>;
11
+ export declare function useWidthDiff<T extends MaybeElement>(element: MaybeRefOrGetter<T>): import('vue').ComputedRef<number>;
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { unwrap, isNil, toPixel } from '@tb-dev/utils';
6
6
  import { Primitive, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaRoot, ScrollAreaViewport, ScrollAreaCorner, useForwardPropsEmits, CheckboxRoot, CheckboxIndicator, ContextMenuRoot, ContextMenuCheckboxItem, ContextMenuItemIndicator, ContextMenuPortal, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, useForwardProps, ContextMenuSubTrigger, ContextMenuTrigger, DialogRoot, DialogClose, DialogOverlay, DialogPortal, DialogContent, DialogDescription, DialogTitle, DialogTrigger, DropdownMenuRoot, DropdownMenuCheckboxItem, DropdownMenuItemIndicator, DropdownMenuPortal, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, NumberFieldRoot, NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput, Label, PopoverRoot, PopoverAnchor, PopoverPortal, PopoverContent, PopoverTrigger, ProgressRoot, ProgressIndicator, RadioGroupRoot, RadioGroupItem, RadioGroupIndicator, SelectRoot, SelectPortal, SelectContent, SelectViewport, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectIcon, SelectValue, Separator, createContext, TooltipRoot, TooltipPortal, TooltipContent, TooltipArrow, TooltipProvider, TooltipTrigger, TabsRoot, TabsContent, TabsList, TabsTrigger, TagsInputRoot, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText, Toggle } from 'reka-ui';
7
7
  export { DropdownMenuPortal } from 'reka-ui';
8
8
  import { RouterLink } from 'vue-router';
9
- import { createReusableTemplate, reactiveOmit, useVModel, useMediaQuery, useEventListener, computedAsync, useAsyncState, useElementSize as useElementSize$1, tryOnScopeDispose, onKeyStroke, useLocalStorage, useWindowSize } from '@vueuse/core';
9
+ import { createReusableTemplate, reactiveOmit, useVModel, useMediaQuery, useEventListener, computedAsync, useAsyncState, useWindowSize, useElementSize as useElementSize$1, tryOnScopeDispose, onKeyStroke, useLocalStorage } from '@vueuse/core';
10
10
  import { Check, Circle, ChevronRight, X, Minus, Plus, CircleIcon, ChevronDown, ChevronUp } from 'lucide-vue-next';
11
11
 
12
12
  function create$1() {
@@ -3896,15 +3896,32 @@ function asyncRef(initial, fn, options = {}) {
3896
3896
  return Object.assign(state, { execute });
3897
3897
  }
3898
3898
 
3899
+ function useWindowHeight() {
3900
+ return useWindowSize().height;
3901
+ }
3902
+ function useWindowWidth() {
3903
+ return useWindowSize().width;
3904
+ }
3905
+
3899
3906
  function useElementSize(element) {
3900
3907
  return useElementSize$1(toRef(element), { height: 0, width: 0 }, { box: "border-box" });
3901
3908
  }
3902
3909
  function useHeight(element) {
3903
3910
  return useElementSize(element).height;
3904
3911
  }
3912
+ function useHeightDiff(element) {
3913
+ const height = useHeight(element);
3914
+ const windowHeight = useWindowHeight();
3915
+ return computed(() => windowHeight.value - height.value);
3916
+ }
3905
3917
  function useWidth(element) {
3906
3918
  return useElementSize(element).width;
3907
3919
  }
3920
+ function useWidthDiff(element) {
3921
+ const width = useWidth(element);
3922
+ const windowWidth = useWindowWidth();
3923
+ return computed(() => windowWidth.value - width.value);
3924
+ }
3908
3925
 
3909
3926
  function onKeyDown(key, handler, options = {}) {
3910
3927
  const {
@@ -3984,11 +4001,4 @@ function localRef(key, initial, options) {
3984
4001
  });
3985
4002
  }
3986
4003
 
3987
- function useWindowHeight() {
3988
- return useWindowSize().height;
3989
- }
3990
- function useWindowWidth() {
3991
- return useWindowSize().width;
3992
- }
3993
-
3994
- export { _sfc_main$1T as Badge, _sfc_main$1S as Button, _sfc_main$1R as ButtonLink, _sfc_main$1J as Card, _sfc_main$1I as Checkbox, _sfc_main$1H as ContextMenu, _sfc_main$1G as ContextMenuCheckboxItem, _sfc_main$1F as ContextMenuContent, _sfc_main$1E as ContextMenuGroup, _sfc_main$1D as ContextMenuItem, _sfc_main$1C as ContextMenuLabel, _sfc_main$1B as ContextMenuRadioGroup, _sfc_main$1A as ContextMenuRadioItem, _sfc_main$1z as ContextMenuSeparator, _sfc_main$1y as ContextMenuShortcut, _sfc_main$1x as ContextMenuSub, _sfc_main$1w as ContextMenuSubContent, _sfc_main$1v as ContextMenuSubTrigger, _sfc_main$1u as ContextMenuTrigger, _sfc_main$1t as Dialog, _sfc_main$1s as DialogClose, _sfc_main$1q as DialogContent, _sfc_main$1p as DialogDescription, _sfc_main$1o as DialogFooter, _sfc_main$1n as DialogHeader, _sfc_main$1r as DialogOverlay, _sfc_main$1m as DialogScrollContent, _sfc_main$1l as DialogTitle, _sfc_main$1k as DialogTrigger, _sfc_main$1j as DropdownMenu, _sfc_main$1i as DropdownMenuCheckboxItem, _sfc_main$1h as DropdownMenuContent, _sfc_main$1g as DropdownMenuGroup, _sfc_main$1f as DropdownMenuItem, _sfc_main$1e as DropdownMenuLabel, _sfc_main$1d as DropdownMenuRadioGroup, _sfc_main$1c as DropdownMenuRadioItem, _sfc_main$1b as DropdownMenuSeparator, _sfc_main$1a as DropdownMenuShortcut, _sfc_main$19 as DropdownMenuSub, _sfc_main$18 as DropdownMenuSubContent, _sfc_main$17 as DropdownMenuSubTrigger, _sfc_main$16 as DropdownMenuTrigger, _sfc_main$15 as Input, _sfc_main$$ as InputNumber, _sfc_main$_ as InputText, _sfc_main$Y as Label, _sfc_main$X as Link, _sfc_main$W as Popover, _sfc_main$V as PopoverAnchor, _sfc_main$U as PopoverContent, _sfc_main$T as PopoverTrigger, _sfc_main$S as Progress, _sfc_main$R as RadioGroup, _sfc_main$Q as RadioGroupItem, _sfc_main$1P as ScrollArea, _sfc_main$P as Select, _sfc_main$O as SelectContent, _sfc_main$N as SelectGroup, _sfc_main$M as SelectItem, _sfc_main$L as SelectItemText, _sfc_main$K as SelectLabel, _sfc_main$J as SelectScrollDownButton, _sfc_main$I as SelectScrollUpButton, _sfc_main$H as SelectSeparator, _sfc_main$G as SelectTrigger, _sfc_main$F as SelectValue, _sfc_main$E as Separator, _sfc_main$D as Sheet, _sfc_main$C as SheetClose, _sfc_main$A as SheetContent, _sfc_main$z as SheetDescription, _sfc_main$y as SheetFooter, _sfc_main$x as SheetHeader, _sfc_main$w as SheetTitle, _sfc_main$v as SheetTrigger, _sfc_main$j as Sidebar, _sfc_main$l as Skeleton, _sfc_main$c as Table, _sfc_main$g as TableCell, _sfc_main$e as TableHead, _sfc_main$b as TableLink, _sfc_main$f as TableRow, _sfc_main$a as Tabs, _sfc_main$9 as TabsContent, _sfc_main$8 as TabsList, _sfc_main$7 as TabsTrigger, _sfc_main$6 as TagsInput, _sfc_main$5 as TagsInputInput, _sfc_main$4 as TagsInputItem, _sfc_main$3 as TagsInputItemDelete, _sfc_main$2 as TagsInputItemText, _sfc_main$1 as Textarea, _sfc_main as Toggle, _sfc_main$p as Tooltip, _sfc_main$o as TooltipContent, _sfc_main$n as TooltipProvider, _sfc_main$m as TooltipTrigger, asyncComputed, asyncRef, cn, getCurrentApp, getErrorHandler, handleError, inject, localRef, maybe, onAltKeyDown, onCtrlKeyDown, onCtrlShiftKeyDown, onKeyDown, onShiftKeyDown, provide, runWithContext, setCurrentApp, setErrorHandler, tryGetCurrentApp, tryInject, trySetCurrentApp, useElementSize, useHeight, useSidebar, useWidth, useWindowHeight, useWindowWidth };
4004
+ export { _sfc_main$1T as Badge, _sfc_main$1S as Button, _sfc_main$1R as ButtonLink, _sfc_main$1J as Card, _sfc_main$1I as Checkbox, _sfc_main$1H as ContextMenu, _sfc_main$1G as ContextMenuCheckboxItem, _sfc_main$1F as ContextMenuContent, _sfc_main$1E as ContextMenuGroup, _sfc_main$1D as ContextMenuItem, _sfc_main$1C as ContextMenuLabel, _sfc_main$1B as ContextMenuRadioGroup, _sfc_main$1A as ContextMenuRadioItem, _sfc_main$1z as ContextMenuSeparator, _sfc_main$1y as ContextMenuShortcut, _sfc_main$1x as ContextMenuSub, _sfc_main$1w as ContextMenuSubContent, _sfc_main$1v as ContextMenuSubTrigger, _sfc_main$1u as ContextMenuTrigger, _sfc_main$1t as Dialog, _sfc_main$1s as DialogClose, _sfc_main$1q as DialogContent, _sfc_main$1p as DialogDescription, _sfc_main$1o as DialogFooter, _sfc_main$1n as DialogHeader, _sfc_main$1r as DialogOverlay, _sfc_main$1m as DialogScrollContent, _sfc_main$1l as DialogTitle, _sfc_main$1k as DialogTrigger, _sfc_main$1j as DropdownMenu, _sfc_main$1i as DropdownMenuCheckboxItem, _sfc_main$1h as DropdownMenuContent, _sfc_main$1g as DropdownMenuGroup, _sfc_main$1f as DropdownMenuItem, _sfc_main$1e as DropdownMenuLabel, _sfc_main$1d as DropdownMenuRadioGroup, _sfc_main$1c as DropdownMenuRadioItem, _sfc_main$1b as DropdownMenuSeparator, _sfc_main$1a as DropdownMenuShortcut, _sfc_main$19 as DropdownMenuSub, _sfc_main$18 as DropdownMenuSubContent, _sfc_main$17 as DropdownMenuSubTrigger, _sfc_main$16 as DropdownMenuTrigger, _sfc_main$15 as Input, _sfc_main$$ as InputNumber, _sfc_main$_ as InputText, _sfc_main$Y as Label, _sfc_main$X as Link, _sfc_main$W as Popover, _sfc_main$V as PopoverAnchor, _sfc_main$U as PopoverContent, _sfc_main$T as PopoverTrigger, _sfc_main$S as Progress, _sfc_main$R as RadioGroup, _sfc_main$Q as RadioGroupItem, _sfc_main$1P as ScrollArea, _sfc_main$P as Select, _sfc_main$O as SelectContent, _sfc_main$N as SelectGroup, _sfc_main$M as SelectItem, _sfc_main$L as SelectItemText, _sfc_main$K as SelectLabel, _sfc_main$J as SelectScrollDownButton, _sfc_main$I as SelectScrollUpButton, _sfc_main$H as SelectSeparator, _sfc_main$G as SelectTrigger, _sfc_main$F as SelectValue, _sfc_main$E as Separator, _sfc_main$D as Sheet, _sfc_main$C as SheetClose, _sfc_main$A as SheetContent, _sfc_main$z as SheetDescription, _sfc_main$y as SheetFooter, _sfc_main$x as SheetHeader, _sfc_main$w as SheetTitle, _sfc_main$v as SheetTrigger, _sfc_main$j as Sidebar, _sfc_main$l as Skeleton, _sfc_main$c as Table, _sfc_main$g as TableCell, _sfc_main$e as TableHead, _sfc_main$b as TableLink, _sfc_main$f as TableRow, _sfc_main$a as Tabs, _sfc_main$9 as TabsContent, _sfc_main$8 as TabsList, _sfc_main$7 as TabsTrigger, _sfc_main$6 as TagsInput, _sfc_main$5 as TagsInputInput, _sfc_main$4 as TagsInputItem, _sfc_main$3 as TagsInputItemDelete, _sfc_main$2 as TagsInputItemText, _sfc_main$1 as Textarea, _sfc_main as Toggle, _sfc_main$p as Tooltip, _sfc_main$o as TooltipContent, _sfc_main$n as TooltipProvider, _sfc_main$m as TooltipTrigger, asyncComputed, asyncRef, cn, getCurrentApp, getErrorHandler, handleError, inject, localRef, maybe, onAltKeyDown, onCtrlKeyDown, onCtrlShiftKeyDown, onKeyDown, onShiftKeyDown, provide, runWithContext, setCurrentApp, setErrorHandler, tryGetCurrentApp, tryInject, trySetCurrentApp, useElementSize, useHeight, useHeightDiff, useSidebar, useWidth, useWidthDiff, useWindowHeight, useWindowWidth };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/vue",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Vue utilities",
5
5
  "license": "MIT",
6
6
  "type": "module",