refactor(AdjustTypography): consume typography-control module from its new home

This commit is contained in:
Ilia Mashkov
2026-05-31 17:04:51 +03:00
parent 7834c7cbf2
commit c613d4cf88
3 changed files with 21 additions and 18 deletions
@@ -11,22 +11,23 @@
*/
import {
type ControlId,
DEFAULT_FONT_SIZE,
DEFAULT_FONT_WEIGHT,
DEFAULT_LETTER_SPACING,
DEFAULT_LINE_HEIGHT,
DEFAULT_TYPOGRAPHY_CONTROLS_DATA,
} from '$entities/Font';
import {
type ControlDataModel,
type ControlModel,
type PersistentStore,
type TypographyControl,
createPersistentStore,
createTypographyControl,
} from '$shared/lib';
import type { NumericControl } from '$shared/ui';
import { SvelteMap } from 'svelte/reactivity';
import { DEFAULT_TYPOGRAPHY_CONTROLS_DATA } from '../../const/const';
import type {
ControlId,
ControlModel,
} from '../../types/typography';
import { createTypographyControl } from '../../typographyControl/createTypographyControl.svelte';
/**
* Epsilon for detecting "significant" base-size changes when reconciling
@@ -36,7 +37,7 @@ import { SvelteMap } from 'svelte/reactivity';
*/
const BASE_SIZE_EPSILON = 0.01;
type ControlOnlyFields<T extends string = string> = Omit<ControlModel<T>, keyof ControlDataModel>;
type ControlOnlyFields<T extends string = string> = Omit<ControlModel<T>, 'value' | 'min' | 'max' | 'step'>;
/**
* A control with its associated instance
@@ -45,7 +46,7 @@ export interface Control extends ControlOnlyFields<ControlId> {
/**
* The reactive typography control instance
*/
instance: TypographyControl;
instance: NumericControl;
}
/**
@@ -5,11 +5,6 @@
Desktop: inline bar with combo controls.
-->
<script lang="ts">
import {
MULTIPLIER_L,
MULTIPLIER_M,
MULTIPLIER_S,
} from '$entities/Font';
import type { ResponsiveManager } from '$shared/lib';
import { cn } from '$shared/lib';
import {
@@ -24,7 +19,12 @@ import { Popover } from 'bits-ui';
import { getContext } from 'svelte';
import { cubicOut } from 'svelte/easing';
import { fly } from 'svelte/transition';
import { typographySettingsStore } from '../../model';
import {
MULTIPLIER_L,
MULTIPLIER_M,
MULTIPLIER_S,
typographySettingsStore,
} from '../../model';
interface Props {
/**
@@ -11,13 +11,15 @@
import {
type ComparisonResult,
DualFontLayout,
findSplitIndex,
} from '$entities/Font';
import {
MULTIPLIER_L,
MULTIPLIER_M,
MULTIPLIER_S,
findSplitIndex,
} from '$entities/Font';
import { TypographyMenu } from '$features/AdjustTypography';
import { typographySettingsStore } from '$features/AdjustTypography/model';
TypographyMenu,
typographySettingsStore,
} from '$features/AdjustTypography';
import {
type ResponsiveManager,
debounce,