fix: build errors

This commit is contained in:
Sahaj Jain
2025-04-17 16:01:10 +05:30
parent 837d0a8602
commit 865b359baa
28 changed files with 309 additions and 243 deletions
+2 -1
View File
@@ -1,8 +1,9 @@
export function debounce(fn: (...args: any[]) => void, delay: number) {
let timeoutId;
let timeoutId: NodeJS.Timeout;
return function (...args: any[]) {
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
// @ts-expect-error: it works
fn.apply(this, args);
}, delay);
};
+6 -3
View File
@@ -71,7 +71,10 @@ export const parseCssInput = (input: string) => {
return { lightColors, darkColors };
};
const extractCssBlockContent = (input: string, selector: string): string | null => {
const extractCssBlockContent = (
input: string,
selector: string
): string | null => {
const regex = new RegExp(`${escapeRegExp(selector)}\\s*{([^}]+)}`);
return input.match(regex)?.[1]?.trim() || null;
};
@@ -89,13 +92,13 @@ const parseColorVariables = (
if (validNames.includes(cleanName)) {
if (nonColorVariables.includes(cleanName)) {
target[cleanName] = value;
target[cleanName as keyof ThemeStyleProps] = value;
return;
}
const colorValue = processColorValue(value);
const formattedValue = colorFormatter(colorValue, "hex");
target[cleanName] = formattedValue;
target[cleanName as keyof ThemeStyleProps] = formattedValue;
}
});
};
+3 -5
View File
@@ -6,7 +6,6 @@ import { defaultThemeState } from "../config/theme";
export const getShadowMap = (themeEditorState: ThemeEditorState) => {
const mode = themeEditorState.currentMode;
const styles = {
...defaultThemeState.styles.light,
...defaultThemeState.styles[mode],
...themeEditorState.styles[mode],
};
@@ -48,10 +47,9 @@ export const getShadowMap = (themeEditorState: ThemeEditorState) => {
"shadow-sm": `${offsetX} ${offsetY} ${blur} ${spread} ${color(
1.0
)}, ${secondLayer("1px", "2px")}`,
shadow: `${offsetX} ${offsetY} ${blur} ${spread} ${color(1.0)}, ${secondLayer(
"1px",
"2px"
)}`, // Alias for the 'shadow:' example line
shadow: `${offsetX} ${offsetY} ${blur} ${spread} ${color(
1.0
)}, ${secondLayer("1px", "2px")}`, // Alias for the 'shadow:' example line
"shadow-md": `${offsetX} ${offsetY} ${blur} ${spread} ${color(
1.0
+2 -2
View File
@@ -32,7 +32,7 @@ const monoFontNames = [
"Geist Mono",
];
export const fonts = {
export const fonts: Record<string, string> = {
// Sans-serif fonts
Inter: "Inter, sans-serif",
Roboto: "Roboto, sans-serif",
@@ -76,7 +76,7 @@ export const monoFonts = Object.fromEntries(
export const getAppliedThemeFont = (
state: ThemeEditorState,
fontKey: keyof ThemeStyleProps
fontKey: "font-sans" | "font-serif" | "font-mono"
): string | null => {
const fontSans = state.styles.light[fontKey];
// find key of font in fonts object based on value