// // Copyright 2023 DXOS.org // import { type ClassNameArray, type ComponentFunction, type Theme, type ThemeFunction } from '@dxos/ui-types'; import { getDeep } from '@dxos/util'; export const bindTheme =
>(theme: Theme => {
return (path: string, styleProps?: P, ...etc: ClassNameArray) => {
const result = getDeep >(theme, path.split('.'));
return typeof result === 'function' ? result(styleProps ?? ({} as P), ...etc) : undefined;
};
};