// // 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>): ThemeFunction

=> { return (path: string, styleProps?: P, ...etc: ClassNameArray) => { const result = getDeep | ComponentFunction

>(theme, path.split('.')); return typeof result === 'function' ? result(styleProps ?? ({} as P), ...etc) : undefined; }; };