From 242d87a54bb9e85434e58349b029bbe5d10d9deb Mon Sep 17 00:00:00 2001 From: Elias Schneider Date: Mon, 9 Jun 2025 18:08:39 +0200 Subject: [PATCH] chore: upgrade to Shadcn v1.0.0 --- frontend/components.json | 7 ++--- frontend/src/lib/utils/style.ts | 53 --------------------------------- 2 files changed, 3 insertions(+), 57 deletions(-) diff --git a/frontend/components.json b/frontend/components.json index bd2450c1..c810da1a 100644 --- a/frontend/components.json +++ b/frontend/components.json @@ -1,10 +1,9 @@ { - "$schema": "https://next.shadcn-svelte.com/schema.json", + "$schema": "https://shadcn-svelte.com/schema.json", "style": "default", "tailwind": { - "config": "tailwind.config.ts", "css": "src/app.css", - "baseColor": "zinc" + "baseColor": "neutral" }, "aliases": { "components": "$lib/components", @@ -14,5 +13,5 @@ "lib": "$lib" }, "typescript": true, - "registry": "https://next.shadcn-svelte.com/registry" + "registry": "https://shadcn-svelte.com/registry" } diff --git a/frontend/src/lib/utils/style.ts b/frontend/src/lib/utils/style.ts index ed12e14d..1bc82b72 100644 --- a/frontend/src/lib/utils/style.ts +++ b/frontend/src/lib/utils/style.ts @@ -1,66 +1,13 @@ import { type ClassValue, clsx } from 'clsx'; import { twMerge } from 'tailwind-merge'; -import { cubicOut } from 'svelte/easing'; -import type { TransitionConfig } from 'svelte/transition'; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } -// eslint-disable-next-line @typescript-eslint/no-explicit-any export type WithoutChild = T extends { child?: any } ? Omit : T; -// eslint-disable-next-line @typescript-eslint/no-explicit-any export type WithoutChildren = T extends { children?: any } ? Omit : T; export type WithoutChildrenOrChild = WithoutChildren>; export type WithElementRef = T & { ref?: U | null; }; - -type FlyAndScaleParams = { - y?: number; - x?: number; - start?: number; - duration?: number; -}; - -//DEPRECATED NEEDS TO BE REPLACED -export const flyAndScale = ( - node: Element, - params: FlyAndScaleParams = { y: -8, x: 0, start: 0.95, duration: 150 } -): TransitionConfig => { - const style = getComputedStyle(node); - const transform = style.transform === 'none' ? '' : style.transform; - - const scaleConversion = (valueA: number, scaleA: [number, number], scaleB: [number, number]) => { - const [minA, maxA] = scaleA; - const [minB, maxB] = scaleB; - - const percentage = (valueA - minA) / (maxA - minA); - const valueB = percentage * (maxB - minB) + minB; - - return valueB; - }; - - const styleToString = (style: Record): string => { - return Object.keys(style).reduce((str, key) => { - if (style[key] === undefined) return str; - return str + `${key}:${style[key]};`; - }, ''); - }; - - return { - duration: params.duration ?? 200, - delay: 0, - css: (t) => { - const y = scaleConversion(t, [0, 1], [params.y ?? 5, 0]); - const x = scaleConversion(t, [0, 1], [params.x ?? 0, 0]); - const scale = scaleConversion(t, [0, 1], [params.start ?? 0.95, 1]); - - return styleToString({ - transform: `${transform} translate3d(${x}px, ${y}px, 0) scale(${scale})`, - opacity: t - }); - }, - easing: cubicOut - }; -};