chore: follow the general comments style
This commit is contained in:
@@ -29,9 +29,13 @@ import { untrack } from 'svelte';
|
||||
* Storage schema for comparison state
|
||||
*/
|
||||
interface ComparisonState {
|
||||
/** Font ID for side A (left/top) */
|
||||
/**
|
||||
* Unique identifier for the primary font being compared (Side A)
|
||||
*/
|
||||
fontAId: string | null;
|
||||
/** Font ID for side B (right/bottom) */
|
||||
/**
|
||||
* Unique identifier for the secondary font being compared (Side B)
|
||||
*/
|
||||
fontBId: string | null;
|
||||
}
|
||||
|
||||
@@ -53,21 +57,33 @@ const storage = createPersistentStore<ComparisonState>('glyphdiff:comparison', {
|
||||
* storage is empty.
|
||||
*/
|
||||
export class ComparisonStore {
|
||||
/** Font for side A */
|
||||
/**
|
||||
* The primary font model for Side A (left/top)
|
||||
*/
|
||||
#fontA = $state<UnifiedFont | undefined>();
|
||||
/** Font for side B */
|
||||
/**
|
||||
* The secondary font model for Side B (right/bottom)
|
||||
*/
|
||||
#fontB = $state<UnifiedFont | undefined>();
|
||||
/** Sample text to display */
|
||||
/**
|
||||
* The preview text string displayed in the comparison area
|
||||
*/
|
||||
#sampleText = $state('The quick brown fox jumps over the lazy dog');
|
||||
/** Whether fonts are loaded and ready to display */
|
||||
/**
|
||||
* Flag indicating if both fonts are successfully loaded and ready for rendering
|
||||
*/
|
||||
#fontsReady = $state(false);
|
||||
/** Active side for single-font operations */
|
||||
/**
|
||||
* Currently active side (A or B) for single-font adjustments
|
||||
*/
|
||||
#side = $state<Side>('A');
|
||||
/** Slider position for character morphing (0-100) */
|
||||
/**
|
||||
* Interactive slider position (0-100) used for morphing/layout transitions
|
||||
*/
|
||||
#sliderPosition = $state(50);
|
||||
// /** Typography controls for this comparison */
|
||||
// #typography = createTypographyControlManager(DEFAULT_TYPOGRAPHY_CONTROLS_DATA, 'glyphdiff:comparison:typography');
|
||||
/** TanStack Query-backed batch font fetcher */
|
||||
/**
|
||||
* TanStack Query-backed store for efficient batch font retrieval
|
||||
*/
|
||||
#batchStore: BatchFontStore;
|
||||
|
||||
constructor() {
|
||||
@@ -211,14 +227,9 @@ export class ComparisonStore {
|
||||
};
|
||||
}
|
||||
|
||||
// // ── Getters / Setters ─────────────────────────────────────────────────────
|
||||
|
||||
// /** Typography control manager */
|
||||
// get typography() {
|
||||
// return typographySettingsStore;
|
||||
// }
|
||||
|
||||
/** Font for side A */
|
||||
/**
|
||||
* Primary font for comparison (reactive)
|
||||
*/
|
||||
get fontA() {
|
||||
return this.#fontA;
|
||||
}
|
||||
@@ -228,7 +239,9 @@ export class ComparisonStore {
|
||||
this.updateStorage();
|
||||
}
|
||||
|
||||
/** Font for side B */
|
||||
/**
|
||||
* Secondary font for comparison (reactive)
|
||||
*/
|
||||
get fontB() {
|
||||
return this.#fontB;
|
||||
}
|
||||
@@ -238,7 +251,9 @@ export class ComparisonStore {
|
||||
this.updateStorage();
|
||||
}
|
||||
|
||||
/** Sample text to display */
|
||||
/**
|
||||
* Shared preview text string (reactive)
|
||||
*/
|
||||
get text() {
|
||||
return this.#sampleText;
|
||||
}
|
||||
@@ -247,7 +262,9 @@ export class ComparisonStore {
|
||||
this.#sampleText = value;
|
||||
}
|
||||
|
||||
/** Active side for single-font operations */
|
||||
/**
|
||||
* Side currently selected for focused manipulation (reactive)
|
||||
*/
|
||||
get side() {
|
||||
return this.#side;
|
||||
}
|
||||
@@ -256,7 +273,9 @@ export class ComparisonStore {
|
||||
this.#side = value;
|
||||
}
|
||||
|
||||
/** Slider position (0-100) for character morphing */
|
||||
/**
|
||||
* Morphing slider position (0-100) used by Character components (reactive)
|
||||
*/
|
||||
get sliderPosition() {
|
||||
return this.#sliderPosition;
|
||||
}
|
||||
@@ -265,12 +284,16 @@ export class ComparisonStore {
|
||||
this.#sliderPosition = value;
|
||||
}
|
||||
|
||||
/** Whether both fonts are selected and loaded */
|
||||
/**
|
||||
* True if both fonts are ready for side-by-side display (reactive)
|
||||
*/
|
||||
get isReady() {
|
||||
return !!this.#fontA && !!this.#fontB && this.#fontsReady;
|
||||
}
|
||||
|
||||
/** Whether currently loading (batch fetch in flight or fonts not yet painted) */
|
||||
/**
|
||||
* True if any font is currently being fetched or loaded (reactive)
|
||||
*/
|
||||
get isLoading() {
|
||||
return this.#batchStore.isLoading || !this.#fontsReady;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user