chore: move ui utils to utils/ui
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@
|
||||
},
|
||||
"aliases": {
|
||||
"components": "$lib/components",
|
||||
"utils": "$lib/utils",
|
||||
"utils": "$lib/utils/ui",
|
||||
"ui": "$lib/components/ui",
|
||||
"hooks": "$lib/hooks",
|
||||
"lib": "$lib"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { type WithElementRef, cn } from '$lib/utils.js';
|
||||
import { type WithElementRef, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { type WithElementRef, cn } from '$lib/utils.js';
|
||||
import { type WithElementRef, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { type WithElementRef, cn } from '$lib/utils.js';
|
||||
import { type WithElementRef, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts" module>
|
||||
import { type VariantProps, tv } from 'tailwind-variants';
|
||||
|
||||
import { type WithElementRef, cn } from '$lib/utils.js';
|
||||
import { type WithElementRef, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { type WithElementRef, cn } from '$lib/utils.js';
|
||||
import { type WithElementRef, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { type WithElementRef, cn } from '$lib/utils.js';
|
||||
import { type WithElementRef, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { type WithElementRef, cn } from '$lib/utils.js';
|
||||
import { type WithElementRef, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { type WithElementRef, cn } from '$lib/utils.js';
|
||||
import { type WithElementRef, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { type WithElementRef, cn } from '$lib/utils.js';
|
||||
import { type WithElementRef, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { type WithElementRef, cn } from '$lib/utils.js';
|
||||
import { type WithElementRef, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { type WithElementRef, cn } from '$lib/utils.js';
|
||||
import { type WithElementRef, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import MinusIcon from '@lucide/svelte/icons/minus';
|
||||
import { Checkbox as CheckboxPrimitive } from 'bits-ui';
|
||||
|
||||
import { type WithoutChildrenOrChild, cn } from '$lib/utils.js';
|
||||
import { type WithoutChildrenOrChild, cn } from '$lib/utils/ui.js';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import XIcon from '@lucide/svelte/icons/x';
|
||||
import { Dialog as DialogPrimitive } from 'bits-ui';
|
||||
|
||||
import { type WithoutChildrenOrChild, cn } from '$lib/utils.js';
|
||||
import { type WithoutChildrenOrChild, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import DialogPortal from './dialog-portal.svelte';
|
||||
import * as Dialog from './index.js';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Dialog as DialogPrimitive } from 'bits-ui';
|
||||
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { cn } from '$lib/utils/ui.js';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { type WithElementRef, cn } from '$lib/utils.js';
|
||||
import { type WithElementRef, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { type WithElementRef, cn } from '$lib/utils.js';
|
||||
import { type WithElementRef, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Dialog as DialogPrimitive } from 'bits-ui';
|
||||
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { cn } from '$lib/utils/ui.js';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Dialog as DialogPrimitive } from 'bits-ui';
|
||||
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { cn } from '$lib/utils/ui.js';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { type WithElementRef, cn } from '$lib/utils.js';
|
||||
import { type WithElementRef, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { HTMLInputAttributes, HTMLInputTypeAttribute } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Label as LabelPrimitive } from 'bits-ui';
|
||||
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { cn } from '$lib/utils/ui.js';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { Select as SelectPrimitive } from 'bits-ui';
|
||||
|
||||
import { type WithoutChild, cn } from '$lib/utils.js';
|
||||
import { type WithoutChild, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import SelectPortal from './select-portal.svelte';
|
||||
import SelectScrollDownButton from './select-scroll-down-button.svelte';
|
||||
import SelectScrollUpButton from './select-scroll-up-button.svelte';
|
||||
|
||||
import type { WithoutChildrenOrChild } from '$lib/utils.js';
|
||||
import type { WithoutChildrenOrChild } from '$lib/utils/ui.js';
|
||||
import type { ComponentProps } from 'svelte';
|
||||
|
||||
let {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Select as SelectPrimitive } from 'bits-ui';
|
||||
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { ComponentProps } from 'svelte';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import CheckIcon from '@lucide/svelte/icons/check';
|
||||
import { Select as SelectPrimitive } from 'bits-ui';
|
||||
|
||||
import { type WithoutChild, cn } from '$lib/utils.js';
|
||||
import { type WithoutChild, cn } from '$lib/utils/ui.js';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { type WithElementRef, cn } from '$lib/utils.js';
|
||||
import { type WithElementRef, cn } from '$lib/utils/ui.js';
|
||||
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
|
||||
import { Select as SelectPrimitive } from 'bits-ui';
|
||||
|
||||
import { type WithoutChildrenOrChild, cn } from '$lib/utils.js';
|
||||
import { type WithoutChildrenOrChild, cn } from '$lib/utils/ui.js';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import ChevronUpIcon from '@lucide/svelte/icons/chevron-up';
|
||||
import { Select as SelectPrimitive } from 'bits-ui';
|
||||
|
||||
import { type WithoutChildrenOrChild, cn } from '$lib/utils.js';
|
||||
import { type WithoutChildrenOrChild, cn } from '$lib/utils/ui.js';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { cn } from '$lib/utils/ui.js';
|
||||
|
||||
import { Separator } from '$lib/components/ui/separator/index.js';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
|
||||
import { Select as SelectPrimitive } from 'bits-ui';
|
||||
|
||||
import { type WithoutChild, cn } from '$lib/utils.js';
|
||||
import { type WithoutChild, cn } from '$lib/utils/ui.js';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Separator as SeparatorPrimitive } from 'bits-ui';
|
||||
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { cn } from '$lib/utils/ui.js';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Switch as SwitchPrimitive } from 'bits-ui';
|
||||
|
||||
import { type WithoutChildrenOrChild, cn } from '$lib/utils.js';
|
||||
import { type WithoutChildrenOrChild, cn } from '$lib/utils/ui.js';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
export * from './ui.ts';
|
||||
export * from './meteo.ts';
|
||||
|
||||
export const pad = (n: string | number) => {
|
||||
if (n === null || n === undefined) {
|
||||
return '';
|
||||
}
|
||||
return ('0' + n).slice(-2);
|
||||
};
|
||||
@@ -11,10 +11,3 @@ export type WithoutChild<T> = T extends { child?: any } ? Omit<T, 'child'> : T;
|
||||
export type WithoutChildren<T> = T extends { children?: any } ? Omit<T, 'children'> : T;
|
||||
export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
|
||||
export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & { ref?: U | null };
|
||||
|
||||
export const pad = (n: string | number) => {
|
||||
if (n === null || n === undefined) {
|
||||
return '';
|
||||
}
|
||||
return ('0' + n).slice(-2);
|
||||
};
|
||||
@@ -8,7 +8,7 @@
|
||||
import { type GeoLocation, storedLocation } from '$lib/stores/settings';
|
||||
import { urlHashStore } from '$lib/stores/url-hash-store';
|
||||
|
||||
import { pad } from '$lib/utils';
|
||||
import { pad } from '$lib/utils/index';
|
||||
|
||||
import { Label } from '$lib/components/ui/label';
|
||||
import * as Select from '$lib/components/ui/select';
|
||||
|
||||
Reference in New Issue
Block a user