refactor(ui): new standard and accessible UI font (#1777)
This commit is contained in:
@@ -36,6 +36,7 @@ public class BookLoreUserTransformer {
|
|||||||
bookLoreUser.setTheme(userEntity.getTheme());
|
bookLoreUser.setTheme(userEntity.getTheme());
|
||||||
bookLoreUser.setThemeAccent(userEntity.getThemeAccent());
|
bookLoreUser.setThemeAccent(userEntity.getThemeAccent());
|
||||||
bookLoreUser.setThemeSyncEnabled(userEntity.isThemeSyncEnabled());
|
bookLoreUser.setThemeSyncEnabled(userEntity.isThemeSyncEnabled());
|
||||||
|
bookLoreUser.setUiFont(userEntity.getUiFont());
|
||||||
bookLoreUser.setDefaultPassword(userEntity.isDefaultPassword());
|
bookLoreUser.setDefaultPassword(userEntity.isDefaultPassword());
|
||||||
bookLoreUser.setPermissions(permissions);
|
bookLoreUser.setPermissions(permissions);
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class BookLoreUser {
|
|||||||
private String theme;
|
private String theme;
|
||||||
private String themeAccent;
|
private String themeAccent;
|
||||||
private boolean themeSyncEnabled;
|
private boolean themeSyncEnabled;
|
||||||
|
private String uiFont;
|
||||||
private ProvisioningMethod provisioningMethod;
|
private ProvisioningMethod provisioningMethod;
|
||||||
private List<Library> assignedLibraries;
|
private List<Library> assignedLibraries;
|
||||||
private UserPermissions permissions;
|
private UserPermissions permissions;
|
||||||
|
|||||||
@@ -10,4 +10,5 @@ public class UserProfileUpdateRequest {
|
|||||||
private String theme;
|
private String theme;
|
||||||
private String themeAccent;
|
private String themeAccent;
|
||||||
private Boolean themeSyncEnabled;
|
private Boolean themeSyncEnabled;
|
||||||
|
private String uiFont;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,10 @@ public class BookLoreUserEntity {
|
|||||||
@Column(name = "theme_sync_enabled", nullable = false)
|
@Column(name = "theme_sync_enabled", nullable = false)
|
||||||
private boolean themeSyncEnabled = true;
|
private boolean themeSyncEnabled = true;
|
||||||
|
|
||||||
|
@Builder.Default
|
||||||
|
@Column(name = "ui_font", nullable = false, length = 32)
|
||||||
|
private String uiFont = "default";
|
||||||
|
|
||||||
@Column(name = "provisioning_method")
|
@Column(name = "provisioning_method")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private ProvisioningMethod provisioningMethod;
|
private ProvisioningMethod provisioningMethod;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class UserService {
|
|||||||
"red", "orange", "amber", "yellow", "lime", "green", "emerald", "teal",
|
"red", "orange", "amber", "yellow", "lime", "green", "emerald", "teal",
|
||||||
"cyan", "sky", "blue", "indigo", "violet", "purple", "fuchsia", "pink", "rose"
|
"cyan", "sky", "blue", "indigo", "violet", "purple", "fuchsia", "pink", "rose"
|
||||||
);
|
);
|
||||||
|
private static final Set<String> SUPPORTED_UI_FONTS = Set.of("default", "atkinson");
|
||||||
|
|
||||||
private final UserRepository userRepository;
|
private final UserRepository userRepository;
|
||||||
private final LibraryRepository libraryRepository;
|
private final LibraryRepository libraryRepository;
|
||||||
@@ -124,6 +125,11 @@ public class UserService {
|
|||||||
user.setThemeSyncEnabled(updateRequest.getThemeSyncEnabled());
|
user.setThemeSyncEnabled(updateRequest.getThemeSyncEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (updateRequest.getUiFont() != null) {
|
||||||
|
validateUiFont(updateRequest.getUiFont());
|
||||||
|
user.setUiFont(updateRequest.getUiFont());
|
||||||
|
}
|
||||||
|
|
||||||
userRepository.save(user);
|
userRepository.save(user);
|
||||||
auditService.log(AuditAction.USER_UPDATED, "User", id, "Updated user profile: " + user.getUsername());
|
auditService.log(AuditAction.USER_UPDATED, "User", id, "Updated user profile: " + user.getUsername());
|
||||||
return bookLoreUserTransformer.toDTO(user);
|
return bookLoreUserTransformer.toDTO(user);
|
||||||
@@ -282,4 +288,10 @@ public class UserService {
|
|||||||
throw ApiError.INVALID_INPUT.createException("Unsupported theme accent: " + themeAccent);
|
throw ApiError.INVALID_INPUT.createException("Unsupported theme accent: " + themeAccent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void validateUiFont(String uiFont) {
|
||||||
|
if (!SUPPORTED_UI_FONTS.contains(uiFont)) {
|
||||||
|
throw ApiError.INVALID_INPUT.createException("Unsupported UI font: " + uiFont);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE users
|
||||||
|
ADD COLUMN ui_font VARCHAR(32) NOT NULL DEFAULT 'default';
|
||||||
@@ -114,6 +114,23 @@ class UserServiceTest {
|
|||||||
verify(userRepository).save(user);
|
verify(userRepository).save(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void updateUserProfile_updatesUiFont() {
|
||||||
|
BookLoreUserEntity user = userEntity(1L);
|
||||||
|
UserProfileUpdateRequest request = new UserProfileUpdateRequest();
|
||||||
|
request.setUiFont("atkinson");
|
||||||
|
|
||||||
|
when(userRepository.findByIdWithDetails(1L)).thenReturn(Optional.of(user));
|
||||||
|
when(authenticationService.getAuthenticatedUser()).thenReturn(currentUser(1L, false));
|
||||||
|
when(userRepository.save(user)).thenReturn(user);
|
||||||
|
when(bookLoreUserTransformer.toDTO(user)).thenAnswer(invocation -> currentUser(1L, false));
|
||||||
|
|
||||||
|
userService.updateUserProfile(1L, request);
|
||||||
|
|
||||||
|
assertThat(user.getUiFont()).isEqualTo("atkinson");
|
||||||
|
verify(userRepository).save(user);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void updateUserProfile_rejectsUnsupportedLocale() {
|
void updateUserProfile_rejectsUnsupportedLocale() {
|
||||||
BookLoreUserEntity user = userEntity(1L);
|
BookLoreUserEntity user = userEntity(1L);
|
||||||
@@ -130,6 +147,22 @@ class UserServiceTest {
|
|||||||
verify(userRepository, never()).save(any());
|
verify(userRepository, never()).save(any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void updateUserProfile_rejectsUnsupportedUiFont() {
|
||||||
|
BookLoreUserEntity user = userEntity(1L);
|
||||||
|
UserProfileUpdateRequest request = new UserProfileUpdateRequest();
|
||||||
|
request.setUiFont("papyrus");
|
||||||
|
|
||||||
|
when(userRepository.findByIdWithDetails(1L)).thenReturn(Optional.of(user));
|
||||||
|
when(authenticationService.getAuthenticatedUser()).thenReturn(currentUser(1L, false));
|
||||||
|
|
||||||
|
assertThatThrownBy(() -> userService.updateUserProfile(1L, request))
|
||||||
|
.isInstanceOf(APIException.class)
|
||||||
|
.hasMessageContaining("Unsupported UI font");
|
||||||
|
|
||||||
|
verify(userRepository, never()).save(any());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void updateUserProfile_rejectsUnsupportedTheme() {
|
void updateUserProfile_rejectsUnsupportedTheme() {
|
||||||
BookLoreUserEntity user = userEntity(1L);
|
BookLoreUserEntity user = userEntity(1L);
|
||||||
|
|||||||
+4
@@ -347,6 +347,7 @@
|
|||||||
.rating-value {
|
.rating-value {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: var(--app-text-sm);
|
font-size: var(--app-text-sm);
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,6 +441,7 @@
|
|||||||
|
|
||||||
.metadata-value {
|
.metadata-value {
|
||||||
color: var(--color-text-secondary);
|
color: var(--color-text-secondary);
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
@@ -773,6 +775,7 @@
|
|||||||
|
|
||||||
.navigation-position {
|
.navigation-position {
|
||||||
font-size: var(--app-text-sm);
|
font-size: var(--app-text-sm);
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
color: var(--color-text-secondary);
|
color: var(--color-text-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -830,6 +833,7 @@
|
|||||||
font-size: 0.8313rem;
|
font-size: 0.8313rem;
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comic-volume-number,
|
.comic-volume-number,
|
||||||
|
|||||||
@@ -242,12 +242,12 @@ describe('UserService', () => {
|
|||||||
httpTestingController.expectOne(req => req.url.endsWith('/api/v1/users/me')).flush(buildUser());
|
httpTestingController.expectOne(req => req.url.endsWith('/api/v1/users/me')).flush(buildUser());
|
||||||
await flushCurrentUserQuery();
|
await flushCurrentUserQuery();
|
||||||
|
|
||||||
service.updateUserProfile(7, {locale: 'de', theme: 'custom', themeAccent: 'teal', themeSyncEnabled: true}).subscribe();
|
service.updateUserProfile(7, {locale: 'de', theme: 'custom', themeAccent: 'teal', themeSyncEnabled: true, uiFont: 'atkinson'}).subscribe();
|
||||||
|
|
||||||
const request = httpTestingController.expectOne(req => req.url.endsWith('/api/v1/users/7/profile'));
|
const request = httpTestingController.expectOne(req => req.url.endsWith('/api/v1/users/7/profile'));
|
||||||
expect(request.request.method).toBe('PUT');
|
expect(request.request.method).toBe('PUT');
|
||||||
expect(request.request.body).toEqual({locale: 'de', theme: 'custom', themeAccent: 'teal', themeSyncEnabled: true});
|
expect(request.request.body).toEqual({locale: 'de', theme: 'custom', themeAccent: 'teal', themeSyncEnabled: true, uiFont: 'atkinson'});
|
||||||
request.flush(buildUser({locale: 'de', theme: 'custom', themeAccent: 'teal', themeSyncEnabled: true}));
|
request.flush(buildUser({locale: 'de', theme: 'custom', themeAccent: 'teal', themeSyncEnabled: true, uiFont: 'atkinson'}));
|
||||||
await flushCurrentUserQuery();
|
await flushCurrentUserQuery();
|
||||||
|
|
||||||
expect(service.currentUser()).toEqual(expect.objectContaining({
|
expect(service.currentUser()).toEqual(expect.objectContaining({
|
||||||
@@ -255,6 +255,7 @@ describe('UserService', () => {
|
|||||||
theme: 'custom',
|
theme: 'custom',
|
||||||
themeAccent: 'teal',
|
themeAccent: 'teal',
|
||||||
themeSyncEnabled: true,
|
themeSyncEnabled: true,
|
||||||
|
uiFont: 'atkinson',
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { DashboardConfig } from '../../dashboard/models/dashboard-config.model';
|
|||||||
import { injectQuery, queryOptions, QueryClient } from '@tanstack/angular-query-experimental';
|
import { injectQuery, queryOptions, QueryClient } from '@tanstack/angular-query-experimental';
|
||||||
import { CURRENT_USER_QUERY_KEY } from './user-query-keys';
|
import { CURRENT_USER_QUERY_KEY } from './user-query-keys';
|
||||||
import { AppTheme, CustomPrimary } from '../../../shared/model/app-state.model';
|
import { AppTheme, CustomPrimary } from '../../../shared/model/app-state.model';
|
||||||
|
import {DEFAULT_UI_FONT, normalizeUiFont, type UiFontPreference} from '../../../shared/model/ui-font.model';
|
||||||
|
|
||||||
export interface EntityViewPreferences {
|
export interface EntityViewPreferences {
|
||||||
global: EntityViewPreference;
|
global: EntityViewPreference;
|
||||||
@@ -324,6 +325,7 @@ export interface User {
|
|||||||
theme: AppTheme;
|
theme: AppTheme;
|
||||||
themeAccent: CustomPrimary | null;
|
themeAccent: CustomPrimary | null;
|
||||||
themeSyncEnabled: boolean;
|
themeSyncEnabled: boolean;
|
||||||
|
uiFont?: UiFontPreference;
|
||||||
assignedLibraries: Library[];
|
assignedLibraries: Library[];
|
||||||
permissions: {
|
permissions: {
|
||||||
admin: boolean;
|
admin: boolean;
|
||||||
@@ -382,6 +384,7 @@ export interface UserProfileUpdateRequest {
|
|||||||
theme?: AppTheme;
|
theme?: AppTheme;
|
||||||
themeAccent?: CustomPrimary | null;
|
themeAccent?: CustomPrimary | null;
|
||||||
themeSyncEnabled?: boolean;
|
themeSyncEnabled?: boolean;
|
||||||
|
uiFont?: UiFontPreference;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@@ -535,6 +538,7 @@ export class UserService {
|
|||||||
theme,
|
theme,
|
||||||
themeAccent: theme === 'custom' ? user.themeAccent ?? 'orange' : null,
|
themeAccent: theme === 'custom' ? user.themeAccent ?? 'orange' : null,
|
||||||
themeSyncEnabled: user.themeSyncEnabled ?? true,
|
themeSyncEnabled: user.themeSyncEnabled ?? true,
|
||||||
|
uiFont: normalizeUiFont(user.uiFont ?? DEFAULT_UI_FONT),
|
||||||
permissions: {
|
permissions: {
|
||||||
...permissions,
|
...permissions,
|
||||||
canBulkResetGrimmoryReadProgress: permissions.canBulkResetGrimmoryReadProgress ?? permissions.canBulkResetBookloreReadProgress,
|
canBulkResetGrimmoryReadProgress: permissions.canBulkResetGrimmoryReadProgress ?? permissions.canBulkResetBookloreReadProgress,
|
||||||
|
|||||||
+14
@@ -108,6 +108,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section class="w-full max-w-2xl rounded-md border-l-[3px] border-l-primary bg-[color-mix(in_srgb,var(--color-card)_35%,var(--color-page))] p-3.5 transition-[background,border-color] duration-200 hover:bg-[color-mix(in_srgb,var(--color-card)_20%,var(--color-page))] max-md:p-2.5">
|
||||||
|
<div class="mb-1">
|
||||||
|
<span class="text-sm font-medium text-text">{{ t('uiFont.label') }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="mt-2.5 flex max-w-lg items-center gap-2.5 border-t border-dashed border-border pt-2.5">
|
||||||
|
<p-toggleswitch
|
||||||
|
inputId="interface-font"
|
||||||
|
[ngModel]="useAccessibleUiFont()"
|
||||||
|
(ngModelChange)="updateAccessibleUiFont($event)">
|
||||||
|
</p-toggleswitch>
|
||||||
|
<label class="text-sm font-medium text-text" for="interface-font">{{ t('uiFont.accessibleLabel') }}</label>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="w-full max-w-2xl rounded-md border-l-[3px] border-l-primary bg-[color-mix(in_srgb,var(--color-card)_35%,var(--color-page))] p-3.5 transition-[background,border-color] duration-200 hover:bg-[color-mix(in_srgb,var(--color-card)_20%,var(--color-page))] max-md:p-2.5">
|
<section class="w-full max-w-2xl rounded-md border-l-[3px] border-l-primary bg-[color-mix(in_srgb,var(--color-card)_35%,var(--color-page))] p-3.5 transition-[background,border-color] duration-200 hover:bg-[color-mix(in_srgb,var(--color-card)_20%,var(--color-page))] max-md:p-2.5">
|
||||||
<div class="mb-1">
|
<div class="mb-1">
|
||||||
<label class="text-sm font-medium text-text" for="interface-language">{{ t('language.label') }}</label>
|
<label class="text-sm font-medium text-text" for="interface-language">{{ t('language.label') }}</label>
|
||||||
|
|||||||
+20
@@ -17,6 +17,8 @@ import type {AppearancePreference, AppTheme, CustomPrimary} from '../../../../sh
|
|||||||
import {APPEARANCE_OPTIONS} from '../../../../shared/layout/theme/appearance-options';
|
import {APPEARANCE_OPTIONS} from '../../../../shared/layout/theme/appearance-options';
|
||||||
import {UserService} from '../../user-management/user.service';
|
import {UserService} from '../../user-management/user.service';
|
||||||
import type {User, UserProfileUpdateRequest} from '../../user-management/user.service';
|
import type {User, UserProfileUpdateRequest} from '../../user-management/user.service';
|
||||||
|
import {AppUiFontService} from '../../../../shared/service/app-ui-font.service';
|
||||||
|
import {ACCESSIBLE_UI_FONT, DEFAULT_UI_FONT} from '../../../../shared/model/ui-font.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-display-preferences',
|
selector: 'app-display-preferences',
|
||||||
@@ -34,6 +36,7 @@ import type {User, UserProfileUpdateRequest} from '../../user-management/user.se
|
|||||||
export class DisplayPreferencesComponent {
|
export class DisplayPreferencesComponent {
|
||||||
private readonly themeService = inject(AppThemeService);
|
private readonly themeService = inject(AppThemeService);
|
||||||
private readonly localeService = inject(AppLocaleService);
|
private readonly localeService = inject(AppLocaleService);
|
||||||
|
private readonly uiFontService = inject(AppUiFontService);
|
||||||
private readonly userService = inject(UserService);
|
private readonly userService = inject(UserService);
|
||||||
private readonly messageService = inject(MessageService);
|
private readonly messageService = inject(MessageService);
|
||||||
private readonly t = inject(TranslocoService);
|
private readonly t = inject(TranslocoService);
|
||||||
@@ -51,6 +54,8 @@ export class DisplayPreferencesComponent {
|
|||||||
label: LANG_LABELS[value] ?? value,
|
label: LANG_LABELS[value] ?? value,
|
||||||
}));
|
}));
|
||||||
protected readonly selectedAppearancePreference = this.themeService.appearancePreference;
|
protected readonly selectedAppearancePreference = this.themeService.appearancePreference;
|
||||||
|
protected readonly selectedUiFont = this.uiFontService.uiFont;
|
||||||
|
protected readonly useAccessibleUiFont = computed(() => this.selectedUiFont() === ACCESSIBLE_UI_FONT);
|
||||||
protected readonly selectedThemePreference = this.themeService.themePreference;
|
protected readonly selectedThemePreference = this.themeService.themePreference;
|
||||||
protected readonly oledDarkMode = this.themeService.oledDarkMode;
|
protected readonly oledDarkMode = this.themeService.oledDarkMode;
|
||||||
protected readonly showOledDarkModeToggle = computed(() => this.themeService.effectiveAppearance() === 'dark');
|
protected readonly showOledDarkModeToggle = computed(() => this.themeService.effectiveAppearance() === 'dark');
|
||||||
@@ -84,6 +89,21 @@ export class DisplayPreferencesComponent {
|
|||||||
this.showSavedToast('settingsView.language.savedDetail');
|
this.showSavedToast('settingsView.language.savedDetail');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected async updateAccessibleUiFont(useAccessibleFont: boolean): Promise<void> {
|
||||||
|
const uiFont = useAccessibleFont ? ACCESSIBLE_UI_FONT : DEFAULT_UI_FONT;
|
||||||
|
if (uiFont === this.selectedUiFont()) return;
|
||||||
|
|
||||||
|
const previousUiFont = this.selectedUiFont();
|
||||||
|
this.uiFontService.applyUiFont(uiFont);
|
||||||
|
|
||||||
|
if (!await this.updateCurrentUserProfile({uiFont})) {
|
||||||
|
this.uiFontService.applyUiFont(previousUiFont);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.showSavedToast('settingsView.uiFont.savedDetail');
|
||||||
|
}
|
||||||
|
|
||||||
protected async updateThemePreference(themePreference: AppTheme): Promise<void> {
|
protected async updateThemePreference(themePreference: AppTheme): Promise<void> {
|
||||||
if (!this.selectedThemeSyncEnabled()) {
|
if (!this.selectedThemeSyncEnabled()) {
|
||||||
this.themeService.applyDeviceTheme(themePreference, this.selectedCustomPrimary());
|
this.themeService.applyDeviceTheme(themePreference, this.selectedCustomPrimary());
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
export const UI_FONT_VALUES = ['default', 'atkinson'] as const;
|
||||||
|
|
||||||
|
export type UiFontPreference = (typeof UI_FONT_VALUES)[number];
|
||||||
|
|
||||||
|
export const DEFAULT_UI_FONT: UiFontPreference = 'default';
|
||||||
|
export const ACCESSIBLE_UI_FONT: UiFontPreference = 'atkinson';
|
||||||
|
|
||||||
|
export function normalizeUiFont(value: string | null | undefined): UiFontPreference {
|
||||||
|
return UI_FONT_VALUES.includes(value as UiFontPreference) ? value as UiFontPreference : DEFAULT_UI_FONT;
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
import {DOCUMENT} from '@angular/common';
|
||||||
|
import {TestBed} from '@angular/core/testing';
|
||||||
|
import {afterEach, beforeEach, describe, expect, it} from 'vitest';
|
||||||
|
|
||||||
|
import {AppUiFontService} from './app-ui-font.service';
|
||||||
|
|
||||||
|
describe('AppUiFontService', () => {
|
||||||
|
let service: AppUiFontService;
|
||||||
|
let document: Document;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
localStorage.clear();
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
document = TestBed.inject(DOCUMENT);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
delete document.documentElement.dataset['uiFont'];
|
||||||
|
localStorage.clear();
|
||||||
|
TestBed.resetTestingModule();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('applies an accessible UI font to the document root', () => {
|
||||||
|
service = TestBed.inject(AppUiFontService);
|
||||||
|
|
||||||
|
service.applyUiFont('atkinson');
|
||||||
|
|
||||||
|
expect(service.uiFont()).toBe('atkinson');
|
||||||
|
expect(document.documentElement.dataset['uiFont']).toBe('atkinson');
|
||||||
|
expect(localStorage.getItem('appUiFont')).toBe('atkinson');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('falls back to the default UI font for unsupported values', () => {
|
||||||
|
service = TestBed.inject(AppUiFontService);
|
||||||
|
|
||||||
|
service.applyUiFont('unsupported');
|
||||||
|
|
||||||
|
expect(service.uiFont()).toBe('default');
|
||||||
|
expect(document.documentElement.dataset['uiFont']).toBeUndefined();
|
||||||
|
expect(localStorage.getItem('appUiFont')).toBe('default');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads a stored accessible UI font on creation', () => {
|
||||||
|
localStorage.setItem('appUiFont', 'atkinson');
|
||||||
|
|
||||||
|
service = TestBed.inject(AppUiFontService);
|
||||||
|
|
||||||
|
expect(service.uiFont()).toBe('atkinson');
|
||||||
|
expect(document.documentElement.dataset['uiFont']).toBe('atkinson');
|
||||||
|
expect(localStorage.getItem('appUiFont')).toBe('atkinson');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('normalizes an unsupported stored UI font on creation', () => {
|
||||||
|
localStorage.setItem('appUiFont', 'unsupported');
|
||||||
|
|
||||||
|
service = TestBed.inject(AppUiFontService);
|
||||||
|
|
||||||
|
expect(service.uiFont()).toBe('default');
|
||||||
|
expect(document.documentElement.dataset['uiFont']).toBeUndefined();
|
||||||
|
expect(localStorage.getItem('appUiFont')).toBe('default');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import {DOCUMENT, isPlatformBrowser} from '@angular/common';
|
||||||
|
import {inject, Injectable, PLATFORM_ID, signal} from '@angular/core';
|
||||||
|
|
||||||
|
import {DEFAULT_UI_FONT, normalizeUiFont, type UiFontPreference} from '../model/ui-font.model';
|
||||||
|
|
||||||
|
const STORAGE_KEY = 'appUiFont';
|
||||||
|
|
||||||
|
@Injectable({providedIn: 'root'})
|
||||||
|
export class AppUiFontService {
|
||||||
|
private readonly document = inject(DOCUMENT);
|
||||||
|
private readonly platformId = inject(PLATFORM_ID);
|
||||||
|
private readonly uiFontSignal = signal<UiFontPreference>(DEFAULT_UI_FONT);
|
||||||
|
|
||||||
|
readonly uiFont = this.uiFontSignal.asReadonly();
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.applyUiFont(this.getStoredUiFont());
|
||||||
|
}
|
||||||
|
|
||||||
|
private getStoredUiFont(): UiFontPreference {
|
||||||
|
if (!isPlatformBrowser(this.platformId)) {
|
||||||
|
return DEFAULT_UI_FONT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return normalizeUiFont(localStorage.getItem(STORAGE_KEY));
|
||||||
|
}
|
||||||
|
|
||||||
|
applyUiFont(uiFont: string | null | undefined): void {
|
||||||
|
const nextUiFont = normalizeUiFont(uiFont);
|
||||||
|
this.uiFontSignal.set(nextUiFont);
|
||||||
|
this.applyRootAttribute(nextUiFont);
|
||||||
|
|
||||||
|
if (isPlatformBrowser(this.platformId)) {
|
||||||
|
localStorage.setItem(STORAGE_KEY, nextUiFont);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private applyRootAttribute(uiFont: UiFontPreference): void {
|
||||||
|
const root = this.document.documentElement;
|
||||||
|
if (uiFont === DEFAULT_UI_FONT) {
|
||||||
|
delete root.dataset['uiFont'];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
root.dataset['uiFont'] = uiFont;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import {StartupService} from './startup.service';
|
|||||||
import {UserService} from '../../features/settings/user-management/user.service';
|
import {UserService} from '../../features/settings/user-management/user.service';
|
||||||
import {AppThemeService} from './app-theme.service';
|
import {AppThemeService} from './app-theme.service';
|
||||||
import {AppLocaleService} from './app-locale.service';
|
import {AppLocaleService} from './app-locale.service';
|
||||||
|
import {AppUiFontService} from './app-ui-font.service';
|
||||||
|
|
||||||
describe('StartupService', () => {
|
describe('StartupService', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -62,6 +63,7 @@ describe('StartupService', () => {
|
|||||||
const applySyncedTheme = vi.fn();
|
const applySyncedTheme = vi.fn();
|
||||||
const applyLocale = vi.fn().mockResolvedValue(undefined);
|
const applyLocale = vi.fn().mockResolvedValue(undefined);
|
||||||
const getDisplayLocale = vi.fn().mockReturnValue('de');
|
const getDisplayLocale = vi.fn().mockReturnValue('de');
|
||||||
|
const applyUiFont = vi.fn();
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
providers: [
|
providers: [
|
||||||
@@ -79,6 +81,7 @@ describe('StartupService', () => {
|
|||||||
{provide: QueryClient, useValue: {fetchQuery}},
|
{provide: QueryClient, useValue: {fetchQuery}},
|
||||||
{provide: AppThemeService, useValue: {applySyncedTheme, appState: () => ({themeSyncEnabled: true})}},
|
{provide: AppThemeService, useValue: {applySyncedTheme, appState: () => ({themeSyncEnabled: true})}},
|
||||||
{provide: AppLocaleService, useValue: {applyLocale, getDisplayLocale}},
|
{provide: AppLocaleService, useValue: {applyLocale, getDisplayLocale}},
|
||||||
|
{provide: AppUiFontService, useValue: {applyUiFont}},
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -86,16 +89,18 @@ describe('StartupService', () => {
|
|||||||
|
|
||||||
await expect(service.load()).resolves.toBeUndefined();
|
await expect(service.load()).resolves.toBeUndefined();
|
||||||
expect(fetchQuery).not.toHaveBeenCalled();
|
expect(fetchQuery).not.toHaveBeenCalled();
|
||||||
|
expect(applyUiFont).not.toHaveBeenCalled();
|
||||||
expect(getDisplayLocale).toHaveBeenCalledOnce();
|
expect(getDisplayLocale).toHaveBeenCalledOnce();
|
||||||
expect(applyLocale).toHaveBeenCalledWith('de');
|
expect(applyLocale).toHaveBeenCalledWith('de');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uses the backend locale for authenticated users', async () => {
|
it('uses the backend locale for authenticated users', async () => {
|
||||||
const fetchQuery = vi.fn().mockResolvedValue({id: 1, username: 'admin', locale: 'en', theme: 'custom', themeAccent: 'teal', themeSyncEnabled: true});
|
const fetchQuery = vi.fn().mockResolvedValue({id: 1, username: 'admin', locale: 'en', theme: 'custom', themeAccent: 'teal', themeSyncEnabled: true, uiFont: 'atkinson'});
|
||||||
const updateUserProfile = vi.fn().mockReturnValue(of({id: 1, username: 'admin', locale: 'de', theme: 'custom', themeAccent: 'teal', themeSyncEnabled: true}));
|
const updateUserProfile = vi.fn().mockReturnValue(of({id: 1, username: 'admin', locale: 'de', theme: 'custom', themeAccent: 'teal', themeSyncEnabled: true}));
|
||||||
const applySyncedTheme = vi.fn();
|
const applySyncedTheme = vi.fn();
|
||||||
const applyLocale = vi.fn().mockResolvedValue(undefined);
|
const applyLocale = vi.fn().mockResolvedValue(undefined);
|
||||||
const getDisplayLocale = vi.fn().mockReturnValue('de');
|
const getDisplayLocale = vi.fn().mockReturnValue('de');
|
||||||
|
const applyUiFont = vi.fn();
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
providers: [
|
providers: [
|
||||||
@@ -106,7 +111,7 @@ describe('StartupService', () => {
|
|||||||
useValue: {
|
useValue: {
|
||||||
getUserQueryOptions: () => queryOptions({
|
getUserQueryOptions: () => queryOptions({
|
||||||
queryKey: ['user'],
|
queryKey: ['user'],
|
||||||
queryFn: async () => ({id: 1, username: 'admin', locale: 'en', theme: 'custom', themeAccent: 'teal', themeSyncEnabled: true}),
|
queryFn: async () => ({id: 1, username: 'admin', locale: 'en', theme: 'custom', themeAccent: 'teal', themeSyncEnabled: true, uiFont: 'atkinson'}),
|
||||||
}),
|
}),
|
||||||
updateUserProfile,
|
updateUserProfile,
|
||||||
},
|
},
|
||||||
@@ -114,6 +119,7 @@ describe('StartupService', () => {
|
|||||||
{provide: QueryClient, useValue: {fetchQuery}},
|
{provide: QueryClient, useValue: {fetchQuery}},
|
||||||
{provide: AppThemeService, useValue: {applySyncedTheme, appState: () => ({themeSyncEnabled: true})}},
|
{provide: AppThemeService, useValue: {applySyncedTheme, appState: () => ({themeSyncEnabled: true})}},
|
||||||
{provide: AppLocaleService, useValue: {applyLocale, getDisplayLocale}},
|
{provide: AppLocaleService, useValue: {applyLocale, getDisplayLocale}},
|
||||||
|
{provide: AppUiFontService, useValue: {applyUiFont}},
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -123,6 +129,7 @@ describe('StartupService', () => {
|
|||||||
|
|
||||||
expect(updateUserProfile).not.toHaveBeenCalled();
|
expect(updateUserProfile).not.toHaveBeenCalled();
|
||||||
expect(applySyncedTheme).toHaveBeenCalledWith('custom', 'teal');
|
expect(applySyncedTheme).toHaveBeenCalledWith('custom', 'teal');
|
||||||
|
expect(applyUiFont).toHaveBeenCalledWith('atkinson');
|
||||||
expect(applyLocale).toHaveBeenCalledWith('en');
|
expect(applyLocale).toHaveBeenCalledWith('en');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {QueryClient} from '@tanstack/angular-query-experimental';
|
|||||||
import {AppThemeService} from './app-theme.service';
|
import {AppThemeService} from './app-theme.service';
|
||||||
import {DEFAULT_CUSTOM_PRIMARY} from '../model/app-state.model';
|
import {DEFAULT_CUSTOM_PRIMARY} from '../model/app-state.model';
|
||||||
import {AppLocaleService} from './app-locale.service';
|
import {AppLocaleService} from './app-locale.service';
|
||||||
|
import {AppUiFontService} from './app-ui-font.service';
|
||||||
|
|
||||||
@Injectable({providedIn: 'root'})
|
@Injectable({providedIn: 'root'})
|
||||||
export class StartupService {
|
export class StartupService {
|
||||||
@@ -13,6 +14,7 @@ export class StartupService {
|
|||||||
private queryClient = inject(QueryClient);
|
private queryClient = inject(QueryClient);
|
||||||
private appThemeService = inject(AppThemeService);
|
private appThemeService = inject(AppThemeService);
|
||||||
private appLocaleService = inject(AppLocaleService);
|
private appLocaleService = inject(AppLocaleService);
|
||||||
|
private appUiFontService = inject(AppUiFontService);
|
||||||
|
|
||||||
async load(): Promise<void> {
|
async load(): Promise<void> {
|
||||||
if (this.authService.token()) {
|
if (this.authService.token()) {
|
||||||
@@ -26,6 +28,7 @@ export class StartupService {
|
|||||||
|
|
||||||
private async applyUserPreferences(user: User): Promise<void> {
|
private async applyUserPreferences(user: User): Promise<void> {
|
||||||
this.applyTheme(user);
|
this.applyTheme(user);
|
||||||
|
this.appUiFontService.applyUiFont(user.uiFont);
|
||||||
await this.appLocaleService.applyLocale(user.locale);
|
await this.appLocaleService.applyLocale(user.locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,93 @@
|
|||||||
|
Copyright 2020-2024 The Atkinson Hyperlegible Next Project Authors (https://github.com/googlefonts/atkinson-hyperlegible-next)
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
https://openfontlicense.org
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
|
with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as
|
||||||
|
distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
|
new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
|
writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
|
in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
|
presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
|
remain under this license does not apply to any document created
|
||||||
|
using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
http://scripts.sil.org/OFL
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
|
with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as
|
||||||
|
distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
|
new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
|
writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION AND CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
|
in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
|
presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
|
remain under this license does not apply to any document created
|
||||||
|
using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
@@ -12,17 +12,17 @@
|
|||||||
html {
|
html {
|
||||||
--mobile-shell-active: 0;
|
--mobile-shell-active: 0;
|
||||||
|
|
||||||
font-family: var(--font-family), "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
|
font-family: var(--font-family);
|
||||||
font-size: var(--font-size-root);
|
font-size: var(--font-size-root);
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: var(--color-app);
|
background-color: var(--color-app);
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
font-family: var(--font-family), serif;
|
font-family: var(--font-family);
|
||||||
font-size: var(--app-text-base);
|
font-size: var(--app-text-base);
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
picture,
|
picture,
|
||||||
@@ -67,6 +67,7 @@ h6 {
|
|||||||
color: var(--color-text-strong);
|
color: var(--color-text-strong);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
|
text-wrap: balance;
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
|
|
||||||
&:first-child {
|
&:first-child {
|
||||||
@@ -102,6 +103,7 @@ p {
|
|||||||
margin: 0 0 0.875rem;
|
margin: 0 0 0.875rem;
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
|
text-wrap: pretty;
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
@@ -113,6 +115,12 @@ p.p-secondary {
|
|||||||
color: var(--color-text-secondary);
|
color: var(--color-text-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
li,
|
||||||
|
figcaption,
|
||||||
|
blockquote {
|
||||||
|
text-wrap: pretty;
|
||||||
|
}
|
||||||
|
|
||||||
mark {
|
mark {
|
||||||
padding: 0.2188rem 0.35rem;
|
padding: 0.2188rem 0.35rem;
|
||||||
border-radius: var(--radius-lg);
|
border-radius: var(--radius-lg);
|
||||||
|
|||||||
@@ -29,8 +29,42 @@
|
|||||||
--tw-enter-translate-y: 0.25rem;
|
--tw-enter-translate-y: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Inter";
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 100 900;
|
||||||
|
font-display: swap;
|
||||||
|
src: url("../fonts/Inter-latin[wght].woff2") format("woff2");
|
||||||
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Inter";
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 100 900;
|
||||||
|
font-display: swap;
|
||||||
|
src: url("../fonts/Inter-latin-ext[wght].woff2") format("woff2");
|
||||||
|
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Atkinson Hyperlegible Next";
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 200 800;
|
||||||
|
font-display: swap;
|
||||||
|
src: url("../fonts/AtkinsonHyperlegibleNext[wght].woff2") format("woff2");
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Atkinson Hyperlegible Next";
|
||||||
|
font-style: italic;
|
||||||
|
font-weight: 200 800;
|
||||||
|
font-display: swap;
|
||||||
|
src: url("../fonts/AtkinsonHyperlegibleNext-Italic[wght].woff2") format("woff2");
|
||||||
|
}
|
||||||
|
|
||||||
@theme static {
|
@theme static {
|
||||||
--font-sans: -apple-system, "BlinkMacSystemFont", "Segoe UI", "Roboto", "Helvetica", "Arial", sans-serif;
|
--font-sans: var(--font-ui, "Inter", sans-serif);
|
||||||
|
|
||||||
--text-app-xs: 0.6563rem;
|
--text-app-xs: 0.6563rem;
|
||||||
--text-app-sm: 0.7656rem;
|
--text-app-sm: 0.7656rem;
|
||||||
@@ -91,6 +125,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
|
--font-ui: "Inter", sans-serif;
|
||||||
--font-size-root: 16px;
|
--font-size-root: 16px;
|
||||||
--app-text-xs: var(--text-app-xs);
|
--app-text-xs: var(--text-app-xs);
|
||||||
--app-text-sm: var(--text-app-sm);
|
--app-text-sm: var(--text-app-sm);
|
||||||
@@ -98,6 +133,10 @@
|
|||||||
--app-text-lg: var(--text-app-lg);
|
--app-text-lg: var(--text-app-lg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[data-ui-font="atkinson"] {
|
||||||
|
--font-ui: "Atkinson Hyperlegible Next", sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
[data-app-theme] {
|
[data-app-theme] {
|
||||||
--color-surface-150: color-mix(in srgb, var(--color-surface-100) 70%, var(--color-surface-200));
|
--color-surface-150: color-mix(in srgb, var(--color-surface-100) 70%, var(--color-surface-200));
|
||||||
--color-app: color-mix(in srgb, var(--color-surface-150), var(--color-primary-200) var(--app-primary-tint, 0%));
|
--color-app: color-mix(in srgb, var(--color-surface-150), var(--color-primary-200) var(--app-primary-tint, 0%));
|
||||||
|
|||||||
@@ -6,9 +6,14 @@
|
|||||||
"label": "Language",
|
"label": "Language",
|
||||||
"savedDetail": "Your language preference has been saved."
|
"savedDetail": "Your language preference has been saved."
|
||||||
},
|
},
|
||||||
|
"uiFont": {
|
||||||
|
"label": "Interface Font",
|
||||||
|
"accessibleLabel": "Use accessible font",
|
||||||
|
"savedDetail": "Your interface font preference has been saved."
|
||||||
|
},
|
||||||
"theme": {
|
"theme": {
|
||||||
"sectionTitle": "Display",
|
"sectionTitle": "Display",
|
||||||
"sectionDesc": "Configure the language, appearance, and theme for your account.",
|
"sectionDesc": "Configure the language, interface font, appearance, and theme for your account.",
|
||||||
"oledDarkMode": "OLED dark mode",
|
"oledDarkMode": "OLED dark mode",
|
||||||
"savedDetail": "Your display preferences have been saved.",
|
"savedDetail": "Your display preferences have been saved.",
|
||||||
"syncSavedDetail": "Your theme sync preference has been saved.",
|
"syncSavedDetail": "Your theme sync preference has been saved.",
|
||||||
|
|||||||
Reference in New Issue
Block a user