fix(theme): preserve poyraz dark interaction tokens
This commit is contained in:
@@ -93,7 +93,21 @@ try {
|
|||||||
assert.equal(fileService.readPublicBranding(darkLogo.id).metadata.id, darkLogo.id);
|
assert.equal(fileService.readPublicBranding(darkLogo.id).metadata.id, darkLogo.id);
|
||||||
assert.equal(fileService.readPublicBranding(icon.id).metadata.id, icon.id);
|
assert.equal(fileService.readPublicBranding(icon.id).metadata.id, icon.id);
|
||||||
assert.ok(contrastRatio(branding.primaryColor, branding.cssVariables["--poyraz-primary-foreground"]) >= 4.5);
|
assert.ok(contrastRatio(branding.primaryColor, branding.cssVariables["--poyraz-primary-foreground"]) >= 4.5);
|
||||||
assert.ok(contrastRatio(branding.accentColor, branding.cssVariables["--poyraz-accent-foreground"]) >= 4.5);
|
assert.equal(
|
||||||
|
branding.cssVariables["--poyraz-accent"],
|
||||||
|
undefined,
|
||||||
|
"Poyraz must own the light/dark semantic accent surface",
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
branding.cssVariables["--poyraz-accent-foreground"],
|
||||||
|
undefined,
|
||||||
|
"Poyraz must own the light/dark semantic accent foreground",
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
branding.cssVariables["--poyraz-accent-hover"],
|
||||||
|
undefined,
|
||||||
|
"Poyraz must own the light/dark semantic accent hover surface",
|
||||||
|
);
|
||||||
assertDomainError(() => brandingService.update(clientOne, { applicationName: "Attack" }), "FORBIDDEN");
|
assertDomainError(() => brandingService.update(clientOne, { applicationName: "Attack" }), "FORBIDDEN");
|
||||||
assertDomainError(() => brandingService.update(ownerTwo, { applicationName: "Attack" }), "FORBIDDEN");
|
assertDomainError(() => brandingService.update(ownerTwo, { applicationName: "Attack" }), "FORBIDDEN");
|
||||||
assertDomainError(() => brandingService.update(ownerOne, { primaryColor: "red" }), "VALIDATION_ERROR");
|
assertDomainError(() => brandingService.update(ownerOne, { primaryColor: "red" }), "VALIDATION_ERROR");
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ export function getPublicBranding(): PublicBranding {
|
|||||||
iconUrl: null,
|
iconUrl: null,
|
||||||
cssVariables: buildBrandingTokens(
|
cssVariables: buildBrandingTokens(
|
||||||
DEFAULT_BRANDING.primaryColor,
|
DEFAULT_BRANDING.primaryColor,
|
||||||
DEFAULT_BRANDING.accentColor,
|
|
||||||
DEFAULT_BRANDING.radiusScale,
|
DEFAULT_BRANDING.radiusScale,
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ export class BrandingService {
|
|||||||
lightLogoUrl: publicAssetUrl(lightLogoId),
|
lightLogoUrl: publicAssetUrl(lightLogoId),
|
||||||
darkLogoUrl: publicAssetUrl(darkLogoId),
|
darkLogoUrl: publicAssetUrl(darkLogoId),
|
||||||
iconUrl: publicAssetUrl(settings.iconFileId),
|
iconUrl: publicAssetUrl(settings.iconFileId),
|
||||||
cssVariables: buildBrandingTokens(settings.primaryColor, settings.accentColor, settings.radiusScale),
|
cssVariables: buildBrandingTokens(settings.primaryColor, settings.radiusScale),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +164,6 @@ export class BrandingService {
|
|||||||
|
|
||||||
export function buildBrandingTokens(
|
export function buildBrandingTokens(
|
||||||
primary: string,
|
primary: string,
|
||||||
accent: string,
|
|
||||||
radiusScale: "compact" | "default" | "soft",
|
radiusScale: "compact" | "default" | "soft",
|
||||||
): Record<`--${string}`, string> {
|
): Record<`--${string}`, string> {
|
||||||
const radii = {
|
const radii = {
|
||||||
@@ -173,7 +172,6 @@ export function buildBrandingTokens(
|
|||||||
soft: ["0.5rem", "0.75rem", "1rem", "1.25rem", "1.5rem"],
|
soft: ["0.5rem", "0.75rem", "1rem", "1.25rem", "1.5rem"],
|
||||||
}[radiusScale];
|
}[radiusScale];
|
||||||
const primaryForeground = readableForeground(primary);
|
const primaryForeground = readableForeground(primary);
|
||||||
const accentForeground = readableForeground(accent);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"--poyraz-primary": primary,
|
"--poyraz-primary": primary,
|
||||||
@@ -188,9 +186,6 @@ export function buildBrandingTokens(
|
|||||||
"--poyraz-primary-dark": mixHex(primary, "#000000", 0.4),
|
"--poyraz-primary-dark": mixHex(primary, "#000000", 0.4),
|
||||||
"--poyraz-primary-muted": `color-mix(in srgb, ${primary} 12%, var(--poyraz-surface))`,
|
"--poyraz-primary-muted": `color-mix(in srgb, ${primary} 12%, var(--poyraz-surface))`,
|
||||||
"--poyraz-primary-muted-foreground": primary,
|
"--poyraz-primary-muted-foreground": primary,
|
||||||
"--poyraz-accent": accent,
|
|
||||||
"--poyraz-accent-foreground": accentForeground,
|
|
||||||
"--poyraz-accent-hover": mixHex(accent, accentForeground, 0.1),
|
|
||||||
"--poyraz-ring": primary,
|
"--poyraz-ring": primary,
|
||||||
"--poyraz-focus-ring": primary,
|
"--poyraz-focus-ring": primary,
|
||||||
"--poyraz-radius-xs": radii[0],
|
"--poyraz-radius-xs": radii[0],
|
||||||
|
|||||||
Reference in New Issue
Block a user