mirror of
https://github.com/jnsahaj/tweakcn.git
synced 2026-09-21 12:50:29 +08:00
fix: build errors
This commit is contained in:
+2
-1
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user