2026-01-07 16:53:17 +03:00
|
|
|
import {
|
|
|
|
|
type ControlModel,
|
|
|
|
|
createTypographyControl,
|
|
|
|
|
} from '$shared/lib';
|
|
|
|
|
|
2026-01-18 15:55:07 +03:00
|
|
|
/**
|
|
|
|
|
* Creates a typography control manager that handles a collection of typography controls.
|
|
|
|
|
*
|
|
|
|
|
* @param configs - Array of control configurations.
|
|
|
|
|
* @returns - Typography control manager instance.
|
|
|
|
|
*/
|
2026-01-07 16:53:17 +03:00
|
|
|
export function createTypographyControlManager(configs: ControlModel[]) {
|
|
|
|
|
const controls = $state(
|
|
|
|
|
configs.map(({ id, increaseLabel, decreaseLabel, controlLabel, ...config }) => ({
|
|
|
|
|
id,
|
|
|
|
|
increaseLabel,
|
|
|
|
|
decreaseLabel,
|
|
|
|
|
controlLabel,
|
|
|
|
|
instance: createTypographyControl(config),
|
|
|
|
|
})),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
get controls() {
|
|
|
|
|
return controls;
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|