72 lines
1.9 KiB
TypeScript
72 lines
1.9 KiB
TypeScript
import type { ControlModel } from '$shared/lib';
|
|
import { createTypographyControlManager } from '../../lib';
|
|
import {
|
|
DEFAULT_FONT_SIZE,
|
|
DEFAULT_FONT_WEIGHT,
|
|
DEFAULT_LETTER_SPACING,
|
|
DEFAULT_LINE_HEIGHT,
|
|
FONT_SIZE_STEP,
|
|
FONT_WEIGHT_STEP,
|
|
LETTER_SPACING_STEP,
|
|
LINE_HEIGHT_STEP,
|
|
MAX_FONT_SIZE,
|
|
MAX_FONT_WEIGHT,
|
|
MAX_LETTER_SPACING,
|
|
MAX_LINE_HEIGHT,
|
|
MIN_FONT_SIZE,
|
|
MIN_FONT_WEIGHT,
|
|
MIN_LETTER_SPACING,
|
|
MIN_LINE_HEIGHT,
|
|
} from '../const/const';
|
|
|
|
export type ControlId = 'font_size' | 'font_weight' | 'line_height' | 'letter_spacing';
|
|
|
|
const controlData: ControlModel<ControlId>[] = [
|
|
{
|
|
id: 'font_size',
|
|
value: DEFAULT_FONT_SIZE,
|
|
max: MAX_FONT_SIZE,
|
|
min: MIN_FONT_SIZE,
|
|
step: FONT_SIZE_STEP,
|
|
|
|
increaseLabel: 'Increase Font Size',
|
|
decreaseLabel: 'Decrease Font Size',
|
|
controlLabel: 'Font Size',
|
|
},
|
|
{
|
|
id: 'font_weight',
|
|
value: DEFAULT_FONT_WEIGHT,
|
|
max: MAX_FONT_WEIGHT,
|
|
min: MIN_FONT_WEIGHT,
|
|
step: FONT_WEIGHT_STEP,
|
|
|
|
increaseLabel: 'Increase Font Weight',
|
|
decreaseLabel: 'Decrease Font Weight',
|
|
controlLabel: 'Font Weight',
|
|
},
|
|
{
|
|
id: 'line_height',
|
|
value: DEFAULT_LINE_HEIGHT,
|
|
max: MAX_LINE_HEIGHT,
|
|
min: MIN_LINE_HEIGHT,
|
|
step: LINE_HEIGHT_STEP,
|
|
|
|
increaseLabel: 'Increase Line Height',
|
|
decreaseLabel: 'Decrease Line Height',
|
|
controlLabel: 'Line Height',
|
|
},
|
|
{
|
|
id: 'letter_spacing',
|
|
value: DEFAULT_LETTER_SPACING,
|
|
max: MAX_LETTER_SPACING,
|
|
min: MIN_LETTER_SPACING,
|
|
step: LETTER_SPACING_STEP,
|
|
|
|
increaseLabel: 'Increase Letter Spacing',
|
|
decreaseLabel: 'Decrease Letter Spacing',
|
|
controlLabel: 'Letter Spacing',
|
|
},
|
|
];
|
|
|
|
export const controlManager = createTypographyControlManager(controlData);
|