shadcn-svelte 0.2.0 → 0.3.1
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.
- package/dist/index.js +58 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6264,13 +6264,67 @@ import prompts3 from "prompts";
|
|
|
6264
6264
|
// src/utils/templates.ts
|
|
6265
6265
|
var UTILS = `import { type ClassValue, clsx } from "clsx";
|
|
6266
6266
|
import { twMerge } from "tailwind-merge";
|
|
6267
|
-
|
|
6267
|
+
import { cubicOut } from "svelte/easing";
|
|
6268
|
+
import type { TransitionConfig } from "svelte/transition";
|
|
6269
|
+
|
|
6268
6270
|
export function cn(...inputs: ClassValue[]) {
|
|
6269
|
-
|
|
6271
|
+
return twMerge(clsx(inputs));
|
|
6270
6272
|
}
|
|
6271
|
-
|
|
6273
|
+
|
|
6274
|
+
type FlyAndScaleParams = {
|
|
6275
|
+
y?: number;
|
|
6276
|
+
x?: number;
|
|
6277
|
+
start?: number;
|
|
6278
|
+
duration?: number;
|
|
6279
|
+
};
|
|
6280
|
+
|
|
6281
|
+
export const flyAndScale = (
|
|
6282
|
+
node: Element,
|
|
6283
|
+
params: FlyAndScaleParams = { y: -8, x: 0, start: 0.95, duration: 150 }
|
|
6284
|
+
): TransitionConfig => {
|
|
6285
|
+
const style = getComputedStyle(node);
|
|
6286
|
+
const transform = style.transform === "none" ? "" : style.transform;
|
|
6287
|
+
|
|
6288
|
+
const scaleConversion = (
|
|
6289
|
+
valueA: number,
|
|
6290
|
+
scaleA: [number, number],
|
|
6291
|
+
scaleB: [number, number]
|
|
6292
|
+
) => {
|
|
6293
|
+
const [minA, maxA] = scaleA;
|
|
6294
|
+
const [minB, maxB] = scaleB;
|
|
6295
|
+
|
|
6296
|
+
const percentage = (valueA - minA) / (maxA - minA);
|
|
6297
|
+
const valueB = percentage * (maxB - minB) + minB;
|
|
6298
|
+
|
|
6299
|
+
return valueB;
|
|
6300
|
+
};
|
|
6301
|
+
|
|
6302
|
+
const styleToString = (
|
|
6303
|
+
style: Record<string, number | string | undefined>
|
|
6304
|
+
): string => {
|
|
6305
|
+
return Object.keys(style).reduce((str, key) => {
|
|
6306
|
+
if (style[key] === undefined) return str;
|
|
6307
|
+
return str + \`\${key}:\${style[key]};\`;
|
|
6308
|
+
}, "");
|
|
6309
|
+
};
|
|
6310
|
+
|
|
6311
|
+
return {
|
|
6312
|
+
duration: params.duration ?? 200,
|
|
6313
|
+
delay: 0,
|
|
6314
|
+
css: (t) => {
|
|
6315
|
+
const y = scaleConversion(t, [0, 1], [params.y ?? 5, 0]);
|
|
6316
|
+
const x = scaleConversion(t, [0, 1], [params.x ?? 0, 0]);
|
|
6317
|
+
const scale = scaleConversion(t, [0, 1], [params.start ?? 0.95, 1]);
|
|
6318
|
+
|
|
6319
|
+
return styleToString({
|
|
6320
|
+
transform: \`\${transform} translate3d(\${x}px, \${y}px, 0) scale(\${scale})\`,
|
|
6321
|
+
opacity: t
|
|
6322
|
+
});
|
|
6323
|
+
},
|
|
6324
|
+
easing: cubicOut
|
|
6325
|
+
};
|
|
6326
|
+
};`;
|
|
6272
6327
|
var TAILWIND_CONFIG_WITH_VARIABLES = `import { fontFamily } from "tailwindcss/defaultTheme";
|
|
6273
|
-
import tailwindcssAnimate from "tailwindcss-animate";
|
|
6274
6328
|
|
|
6275
6329
|
/** @type {import('tailwindcss').Config} */
|
|
6276
6330
|
const config = {
|
|
@@ -6330,7 +6384,6 @@ const config = {
|
|
|
6330
6384
|
}
|
|
6331
6385
|
}
|
|
6332
6386
|
},
|
|
6333
|
-
plugins: [tailwindcssAnimate]
|
|
6334
6387
|
};
|
|
6335
6388
|
|
|
6336
6389
|
export default config;
|
|
@@ -6338,7 +6391,6 @@ export default config;
|
|
|
6338
6391
|
|
|
6339
6392
|
// src/commands/init.ts
|
|
6340
6393
|
var PROJECT_DEPENDENCIES = [
|
|
6341
|
-
"tailwindcss-animate",
|
|
6342
6394
|
"tailwind-variants",
|
|
6343
6395
|
"clsx",
|
|
6344
6396
|
"tailwind-merge"
|