Chore/architecture refactoring #42
@@ -0,0 +1,6 @@
|
|||||||
|
export {
|
||||||
|
createTypographySettingsStore,
|
||||||
|
type TypographySettingsStore,
|
||||||
|
typographySettingsStore,
|
||||||
|
} from './model';
|
||||||
|
export { TypographyMenu } from './ui';
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
export {
|
||||||
|
createTypographySettingsStore,
|
||||||
|
type TypographySettingsStore,
|
||||||
|
typographySettingsStore,
|
||||||
|
} from './store/typographySettingsStore/typographySettingsStore.svelte';
|
||||||
+12
-3
@@ -16,6 +16,7 @@ import {
|
|||||||
DEFAULT_FONT_WEIGHT,
|
DEFAULT_FONT_WEIGHT,
|
||||||
DEFAULT_LETTER_SPACING,
|
DEFAULT_LETTER_SPACING,
|
||||||
DEFAULT_LINE_HEIGHT,
|
DEFAULT_LINE_HEIGHT,
|
||||||
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
} from '$entities/Font';
|
} from '$entities/Font';
|
||||||
import {
|
import {
|
||||||
type ControlDataModel,
|
type ControlDataModel,
|
||||||
@@ -67,7 +68,7 @@ export interface TypographySettings {
|
|||||||
* Manages multiple typography controls with persistent storage and
|
* Manages multiple typography controls with persistent storage and
|
||||||
* responsive scaling support for font size.
|
* responsive scaling support for font size.
|
||||||
*/
|
*/
|
||||||
export class TypographySettingsManager {
|
export class TypographySettingsStore {
|
||||||
/**
|
/**
|
||||||
* Internal map of reactive controls keyed by their identifier
|
* Internal map of reactive controls keyed by their identifier
|
||||||
*/
|
*/
|
||||||
@@ -303,7 +304,7 @@ export class TypographySettingsManager {
|
|||||||
* @param storageId - Persistent storage identifier
|
* @param storageId - Persistent storage identifier
|
||||||
* @returns Typography control manager instance
|
* @returns Typography control manager instance
|
||||||
*/
|
*/
|
||||||
export function createTypographySettingsManager(
|
export function createTypographySettingsStore(
|
||||||
configs: ControlModel<ControlId>[],
|
configs: ControlModel<ControlId>[],
|
||||||
storageId: string = 'glyphdiff:typography',
|
storageId: string = 'glyphdiff:typography',
|
||||||
) {
|
) {
|
||||||
@@ -313,5 +314,13 @@ export function createTypographySettingsManager(
|
|||||||
lineHeight: DEFAULT_LINE_HEIGHT,
|
lineHeight: DEFAULT_LINE_HEIGHT,
|
||||||
letterSpacing: DEFAULT_LETTER_SPACING,
|
letterSpacing: DEFAULT_LETTER_SPACING,
|
||||||
});
|
});
|
||||||
return new TypographySettingsManager(configs, storage);
|
return new TypographySettingsStore(configs, storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App-wide typography settings singleton, keyed for the comparison view.
|
||||||
|
*/
|
||||||
|
export const typographySettingsStore = createTypographySettingsStore(
|
||||||
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
|
'glyphdiff:comparison:typography',
|
||||||
|
);
|
||||||
+45
-45
@@ -17,13 +17,13 @@ import {
|
|||||||
} from 'vitest';
|
} from 'vitest';
|
||||||
import {
|
import {
|
||||||
type TypographySettings,
|
type TypographySettings,
|
||||||
TypographySettingsManager,
|
TypographySettingsStore,
|
||||||
} from './settingsManager.svelte';
|
} from './typographySettingsStore.svelte';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Strategy for TypographySettingsManager
|
* Test Strategy for TypographySettingsStore
|
||||||
*
|
*
|
||||||
* This test suite validates the TypographySettingsManager state management logic.
|
* This test suite validates the TypographySettingsStore state management logic.
|
||||||
* These are unit tests for the manager logic, separate from component rendering.
|
* These are unit tests for the manager logic, separate from component rendering.
|
||||||
*
|
*
|
||||||
* NOTE: Svelte 5's $effect runs in microtasks, so we need to flush effects
|
* NOTE: Svelte 5's $effect runs in microtasks, so we need to flush effects
|
||||||
@@ -46,7 +46,7 @@ async function flushEffects() {
|
|||||||
await Promise.resolve();
|
await Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('TypographySettingsManager - Unit Tests', () => {
|
describe('TypographySettingsStore - Unit Tests', () => {
|
||||||
let mockStorage: TypographySettings;
|
let mockStorage: TypographySettings;
|
||||||
let mockPersistentStore: {
|
let mockPersistentStore: {
|
||||||
value: TypographySettings;
|
value: TypographySettings;
|
||||||
@@ -86,7 +86,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
|
|
||||||
describe('Initialization', () => {
|
describe('Initialization', () => {
|
||||||
it('creates manager with default values from storage', () => {
|
it('creates manager with default values from storage', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -106,7 +106,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
};
|
};
|
||||||
mockPersistentStore = createMockPersistentStore(mockStorage);
|
mockPersistentStore = createMockPersistentStore(mockStorage);
|
||||||
|
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -118,7 +118,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('initializes font size control with base size multiplied by current multiplier (1)', () => {
|
it('initializes font size control with base size multiplied by current multiplier (1)', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -127,7 +127,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns all controls via controls getter', () => {
|
it('returns all controls via controls getter', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -143,7 +143,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns individual controls via specific getters', () => {
|
it('returns individual controls via specific getters', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -161,7 +161,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('control instances have expected interface', () => {
|
it('control instances have expected interface', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -180,7 +180,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
|
|
||||||
describe('Multiplier System', () => {
|
describe('Multiplier System', () => {
|
||||||
it('has default multiplier of 1', () => {
|
it('has default multiplier of 1', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -189,7 +189,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('updates multiplier when set', () => {
|
it('updates multiplier when set', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -202,7 +202,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('does not update multiplier if set to same value', () => {
|
it('does not update multiplier if set to same value', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -218,7 +218,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
mockStorage = { fontSize: 48, fontWeight: 400, lineHeight: 1.5, letterSpacing: 0 };
|
mockStorage = { fontSize: 48, fontWeight: 400, lineHeight: 1.5, letterSpacing: 0 };
|
||||||
mockPersistentStore = createMockPersistentStore(mockStorage);
|
mockPersistentStore = createMockPersistentStore(mockStorage);
|
||||||
|
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -242,7 +242,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('updates font size control display value when multiplier increases', () => {
|
it('updates font size control display value when multiplier increases', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -263,7 +263,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
|
|
||||||
describe('Base Size Setter', () => {
|
describe('Base Size Setter', () => {
|
||||||
it('updates baseSize when set directly', () => {
|
it('updates baseSize when set directly', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -274,7 +274,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('updates size control value when baseSize is set', () => {
|
it('updates size control value when baseSize is set', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -285,7 +285,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('applies multiplier to size control when baseSize is set', () => {
|
it('applies multiplier to size control when baseSize is set', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -299,7 +299,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
|
|
||||||
describe('Rendered Size Calculation', () => {
|
describe('Rendered Size Calculation', () => {
|
||||||
it('calculates renderedSize as baseSize * multiplier', () => {
|
it('calculates renderedSize as baseSize * multiplier', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -308,7 +308,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('updates renderedSize when multiplier changes', () => {
|
it('updates renderedSize when multiplier changes', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -321,7 +321,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('updates renderedSize when baseSize changes', () => {
|
it('updates renderedSize when baseSize changes', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -341,7 +341,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
// proxy effect behavior should be tested in E2E tests.
|
// proxy effect behavior should be tested in E2E tests.
|
||||||
|
|
||||||
it('does NOT immediately update baseSize from control change (effect is async)', () => {
|
it('does NOT immediately update baseSize from control change (effect is async)', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -356,7 +356,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('updates baseSize via direct setter (synchronous)', () => {
|
it('updates baseSize via direct setter (synchronous)', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -381,7 +381,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
};
|
};
|
||||||
mockPersistentStore = createMockPersistentStore(mockStorage);
|
mockPersistentStore = createMockPersistentStore(mockStorage);
|
||||||
|
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -394,7 +394,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('syncs to storage after effect flush (async)', async () => {
|
it('syncs to storage after effect flush (async)', async () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -410,7 +410,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('syncs control changes to storage after effect flush (async)', async () => {
|
it('syncs control changes to storage after effect flush (async)', async () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -423,7 +423,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('syncs height control changes to storage after effect flush (async)', async () => {
|
it('syncs height control changes to storage after effect flush (async)', async () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -435,7 +435,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('syncs spacing control changes to storage after effect flush (async)', async () => {
|
it('syncs spacing control changes to storage after effect flush (async)', async () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -449,7 +449,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
|
|
||||||
describe('Control Value Getters', () => {
|
describe('Control Value Getters', () => {
|
||||||
it('returns current weight value', () => {
|
it('returns current weight value', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -461,7 +461,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns current height value', () => {
|
it('returns current height value', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -473,7 +473,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns current spacing value', () => {
|
it('returns current spacing value', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -486,7 +486,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
|
|
||||||
it('returns default value when control is not found', () => {
|
it('returns default value when control is not found', () => {
|
||||||
// Create a manager with empty configs (no controls)
|
// Create a manager with empty configs (no controls)
|
||||||
const manager = new TypographySettingsManager([], mockPersistentStore);
|
const manager = new TypographySettingsStore([], mockPersistentStore);
|
||||||
|
|
||||||
expect(manager.weight).toBe(DEFAULT_FONT_WEIGHT);
|
expect(manager.weight).toBe(DEFAULT_FONT_WEIGHT);
|
||||||
expect(manager.height).toBe(DEFAULT_LINE_HEIGHT);
|
expect(manager.height).toBe(DEFAULT_LINE_HEIGHT);
|
||||||
@@ -504,7 +504,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
};
|
};
|
||||||
mockPersistentStore = createMockPersistentStore(mockStorage);
|
mockPersistentStore = createMockPersistentStore(mockStorage);
|
||||||
|
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -537,7 +537,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
clear: clearSpy,
|
clear: clearSpy,
|
||||||
};
|
};
|
||||||
|
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -548,7 +548,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('respects multiplier when resetting font size control', () => {
|
it('respects multiplier when resetting font size control', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -566,7 +566,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
|
|
||||||
describe('Complex Scenarios', () => {
|
describe('Complex Scenarios', () => {
|
||||||
it('handles changing multiplier then modifying baseSize', () => {
|
it('handles changing multiplier then modifying baseSize', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -587,7 +587,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('maintains correct renderedSize throughout changes', () => {
|
it('maintains correct renderedSize throughout changes', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -609,7 +609,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('handles multiple control changes in sequence', async () => {
|
it('handles multiple control changes in sequence', async () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -634,7 +634,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
mockStorage = { fontSize: 48, fontWeight: 400, lineHeight: 1.5, letterSpacing: 0 };
|
mockStorage = { fontSize: 48, fontWeight: 400, lineHeight: 1.5, letterSpacing: 0 };
|
||||||
mockPersistentStore = createMockPersistentStore(mockStorage);
|
mockPersistentStore = createMockPersistentStore(mockStorage);
|
||||||
|
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -646,7 +646,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('handles very small multiplier', () => {
|
it('handles very small multiplier', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -659,7 +659,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('handles large base size with multiplier', () => {
|
it('handles large base size with multiplier', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -672,7 +672,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('handles floating point precision in multiplier', () => {
|
it('handles floating point precision in multiplier', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -691,7 +691,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('handles control methods (increase/decrease)', () => {
|
it('handles control methods (increase/decrease)', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -705,7 +705,7 @@ describe('TypographySettingsManager - Unit Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('handles control boundary conditions', () => {
|
it('handles control boundary conditions', () => {
|
||||||
const manager = new TypographySettingsManager(
|
const manager = new TypographySettingsStore(
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
||||||
mockPersistentStore,
|
mockPersistentStore,
|
||||||
);
|
);
|
||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
FontApplicator,
|
FontApplicator,
|
||||||
type UnifiedFont,
|
type UnifiedFont,
|
||||||
} from '$entities/Font';
|
} from '$entities/Font';
|
||||||
import { typographySettingsStore } from '$features/SetupFont/model';
|
import { typographySettingsStore } from '$features/AdjustTypography/model';
|
||||||
import {
|
import {
|
||||||
Badge,
|
Badge,
|
||||||
ContentEditable,
|
ContentEditable,
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
export {
|
|
||||||
createTypographySettingsManager,
|
|
||||||
type TypographySettingsManager,
|
|
||||||
} from './lib';
|
|
||||||
export { typographySettingsStore } from './model';
|
|
||||||
export { TypographyMenu } from './ui';
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
export {
|
|
||||||
createTypographySettingsManager,
|
|
||||||
type TypographySettingsManager,
|
|
||||||
} from './settingsManager/settingsManager.svelte';
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { typographySettingsStore } from './state/typographySettingsStore';
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import { DEFAULT_TYPOGRAPHY_CONTROLS_DATA } from '$entities/Font';
|
|
||||||
import { createTypographySettingsManager } from '../../lib';
|
|
||||||
|
|
||||||
export const typographySettingsStore = createTypographySettingsManager(
|
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
|
|
||||||
'glyphdiff:comparison:typography',
|
|
||||||
);
|
|
||||||
@@ -21,7 +21,7 @@ import {
|
|||||||
fontStore,
|
fontStore,
|
||||||
getFontUrl,
|
getFontUrl,
|
||||||
} from '$entities/Font';
|
} from '$entities/Font';
|
||||||
import { typographySettingsStore } from '$features/SetupFont/model';
|
import { typographySettingsStore } from '$features/AdjustTypography/model';
|
||||||
import { createPersistentStore } from '$shared/lib';
|
import { createPersistentStore } from '$shared/lib';
|
||||||
import { untrack } from 'svelte';
|
import { untrack } from 'svelte';
|
||||||
import { getPretextFontString } from '../../lib';
|
import { getPretextFontString } from '../../lib';
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ vi.mock('$entities/Font', async importOriginal => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
vi.mock('$features/SetupFont', () => ({
|
vi.mock('$features/AdjustTypography', () => ({
|
||||||
DEFAULT_TYPOGRAPHY_CONTROLS_DATA: [],
|
DEFAULT_TYPOGRAPHY_CONTROLS_DATA: [],
|
||||||
createTypographyControlManager: vi.fn(() => ({
|
createTypographyControlManager: vi.fn(() => ({
|
||||||
weight: 400,
|
weight: 400,
|
||||||
@@ -80,7 +80,7 @@ vi.mock('$features/SetupFont', () => ({
|
|||||||
})),
|
})),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock('$features/SetupFont/model', () => ({
|
vi.mock('$features/AdjustTypography/model', () => ({
|
||||||
typographySettingsStore: {
|
typographySettingsStore: {
|
||||||
weight: 400,
|
weight: 400,
|
||||||
renderedSize: 48,
|
renderedSize: 48,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
Renders a single character with morphing animation
|
Renders a single character with morphing animation
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { typographySettingsStore } from '$features/SetupFont';
|
import { typographySettingsStore } from '$features/AdjustTypography';
|
||||||
import { cn } from '$shared/lib';
|
import { cn } from '$shared/lib';
|
||||||
import { comparisonStore } from '../../model';
|
import { comparisonStore } from '../../model';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
Renders a line of text in the SliderArea
|
Renders a line of text in the SliderArea
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { typographySettingsStore } from '$features/SetupFont';
|
import { typographySettingsStore } from '$features/AdjustTypography';
|
||||||
import type { Snippet } from 'svelte';
|
import type { Snippet } from 'svelte';
|
||||||
|
|
||||||
interface LineChar {
|
interface LineChar {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
- Performance optimized using offscreen canvas for measurements and transform-based animations.
|
- Performance optimized using offscreen canvas for measurements and transform-based animations.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { TypographyMenu } from '$features/SetupFont';
|
import { TypographyMenu } from '$features/AdjustTypography';
|
||||||
import { typographySettingsStore } from '$features/SetupFont/model';
|
import { typographySettingsStore } from '$features/AdjustTypography/model';
|
||||||
import {
|
import {
|
||||||
type ResponsiveManager,
|
type ResponsiveManager,
|
||||||
debounce,
|
debounce,
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import {
|
|||||||
createFontRowSizeResolver,
|
createFontRowSizeResolver,
|
||||||
fontStore,
|
fontStore,
|
||||||
} from '$entities/Font';
|
} from '$entities/Font';
|
||||||
import { FontSampler } from '$features/DisplayFont';
|
|
||||||
import {
|
import {
|
||||||
TypographyMenu,
|
TypographyMenu,
|
||||||
typographySettingsStore,
|
typographySettingsStore,
|
||||||
} from '$features/SetupFont';
|
} from '$features/AdjustTypography';
|
||||||
|
import { FontSampler } from '$features/DisplayFont';
|
||||||
import { throttle } from '$shared/lib/utils';
|
import { throttle } from '$shared/lib/utils';
|
||||||
import { Skeleton } from '$shared/ui';
|
import { Skeleton } from '$shared/ui';
|
||||||
import { layoutManager } from '../../model';
|
import { layoutManager } from '../../model';
|
||||||
|
|||||||
Reference in New Issue
Block a user