chore: enforce brackets for if clause and for/while loops
This commit is contained in:
@@ -128,7 +128,9 @@ export class TypographySettingsManager {
|
||||
// This handles the "Multiplier" logic specifically for the Font Size Control
|
||||
$effect(() => {
|
||||
const ctrl = this.#controls.get('font_size')?.instance;
|
||||
if (!ctrl) return;
|
||||
if (!ctrl) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the user moves the slider/clicks buttons in the UI:
|
||||
// We update the baseSize (User Intent)
|
||||
@@ -147,10 +149,18 @@ export class TypographySettingsManager {
|
||||
* Gets initial value for a control from storage or defaults
|
||||
*/
|
||||
#getInitialValue(id: string, saved: TypographySettings): number {
|
||||
if (id === 'font_size') return saved.fontSize * this.#multiplier;
|
||||
if (id === 'font_weight') return saved.fontWeight;
|
||||
if (id === 'line_height') return saved.lineHeight;
|
||||
if (id === 'letter_spacing') return saved.letterSpacing;
|
||||
if (id === 'font_size') {
|
||||
return saved.fontSize * this.#multiplier;
|
||||
}
|
||||
if (id === 'font_weight') {
|
||||
return saved.fontWeight;
|
||||
}
|
||||
if (id === 'line_height') {
|
||||
return saved.lineHeight;
|
||||
}
|
||||
if (id === 'letter_spacing') {
|
||||
return saved.letterSpacing;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -165,7 +175,9 @@ export class TypographySettingsManager {
|
||||
* Updates the multiplier and recalculates dependent control values
|
||||
*/
|
||||
set multiplier(value: number) {
|
||||
if (this.#multiplier === value) return;
|
||||
if (this.#multiplier === value) {
|
||||
return;
|
||||
}
|
||||
this.#multiplier = value;
|
||||
|
||||
// When multiplier changes, we must update the Font Size Control's display value
|
||||
@@ -192,7 +204,9 @@ export class TypographySettingsManager {
|
||||
set baseSize(val: number) {
|
||||
this.#baseSize = val;
|
||||
const ctrl = this.#controls.get('font_size')?.instance;
|
||||
if (ctrl) ctrl.value = val * this.#multiplier;
|
||||
if (ctrl) {
|
||||
ctrl.value = val * this.#multiplier;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,9 +282,15 @@ export class TypographySettingsManager {
|
||||
// Map storage key to control id
|
||||
const key = c.id.replace('_', '') as keyof TypographySettings;
|
||||
// Simplified for brevity, you'd map these properly:
|
||||
if (c.id === 'font_weight') c.instance.value = defaults.fontWeight;
|
||||
if (c.id === 'line_height') c.instance.value = defaults.lineHeight;
|
||||
if (c.id === 'letter_spacing') c.instance.value = defaults.letterSpacing;
|
||||
if (c.id === 'font_weight') {
|
||||
c.instance.value = defaults.fontWeight;
|
||||
}
|
||||
if (c.id === 'line_height') {
|
||||
c.instance.value = defaults.lineHeight;
|
||||
}
|
||||
if (c.id === 'letter_spacing') {
|
||||
c.instance.value = defaults.letterSpacing;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,7 +48,9 @@ let isOpen = $state(false);
|
||||
* Sets the common font size multiplier based on the current responsive state.
|
||||
*/
|
||||
$effect(() => {
|
||||
if (!responsive) return;
|
||||
if (!responsive) {
|
||||
return;
|
||||
}
|
||||
switch (true) {
|
||||
case responsive.isMobile:
|
||||
typographySettingsStore.multiplier = MULTIPLIER_S;
|
||||
|
||||
Reference in New Issue
Block a user