@compositive/foundation
Version:
Compositive framework foundation package.
25 lines (22 loc) • 924 B
JavaScript
import { isDefined } from '@compositive/commons-predicates';
import { coalesce } from '@compositive/commons-util';
import '../theming/ComputedTheme.js';
import '../theming/Theme.js';
import 'react/jsx-runtime';
import '../theming/ThemeContext.js';
import '@compositive/primitives';
import 'react';
import '../styling/resolveThemedStyleProperties.js';
import '../styling/ThemedStyle.js';
import { useTheme } from '../theming/useTheme.js';
function useSurface(names) {
var _a;
const { surfaces } = useTheme();
const Component = (_a = coalesce(...names.map((name) => surfaces[name]))) === null || _a === void 0 ? void 0 : _a.toComponent();
isDefined.assert(Component, () => `Can't find a surface definition for this component in the theme. Looked up keys: ${names
.map((n) => n.toString())
.join(", ")}.`);
return Component;
}
export { useSurface };
//# sourceMappingURL=useSurface.js.map