Template Tag Function Editor (#67)

![CleanShot 2024-08-15 at 16 53
09@2x](https://github.com/user-attachments/assets/8c0eb655-1daf-4dc8-811f-f606c770f7dc)
This commit is contained in:
Gregory Schier
2024-08-16 08:31:19 -07:00
committed by GitHub
parent a7f0fadeae
commit aa85ecb618
62 changed files with 1339 additions and 437 deletions

View File

@@ -39,7 +39,7 @@ export type YaakTheme = YaakColors & {
appHeader: Partial<YaakColors>;
button: Partial<YaakColors>;
banner: Partial<YaakColors>;
placeholder: Partial<YaakColors>;
templateTag: Partial<YaakColors>;
urlBar: Partial<YaakColors>;
editor: Partial<YaakColors>;
input: Partial<YaakColors>;
@@ -87,7 +87,7 @@ function themeVariables(theme?: Partial<YaakColors>, base?: CSSVariables): CSSVa
return vars;
}
function placeholderColorVariables(color: YaakColor): Partial<CSSVariables> {
function templateTagColorVariables(color: YaakColor): Partial<CSSVariables> {
return {
text: color.lift(0.6),
textSubtle: color.lift(0.4),
@@ -201,14 +201,14 @@ function bannerCSS(color: YaakColorKey, colors?: Partial<YaakColors>): string |
);
}
function placeholderCSS(color: YaakColorKey, colors?: Partial<YaakColors>): string | null {
function templateTagCSS(color: YaakColorKey, colors?: Partial<YaakColors>): string | null {
const yaakColor = colors?.[color];
if (yaakColor == null) {
return null;
}
return [
variablesToCSS(`.x-theme-placeholder--${color}`, placeholderColorVariables(yaakColor)),
variablesToCSS(`.x-theme-templateTag--${color}`, templateTagColorVariables(yaakColor)),
].join('\n\n');
}
@@ -254,7 +254,7 @@ export function getThemeCSS(theme: YaakTheme): string {
bannerCSS(key as YaakColorKey, theme.components?.banner ?? colors),
),
...Object.keys(colors ?? {}).map((key) =>
placeholderCSS(key as YaakColorKey, theme.components?.placeholder ?? colors),
templateTagCSS(key as YaakColorKey, theme.components?.templateTag ?? colors),
),
].join('\n\n');
} catch (err) {