recastui
Version:
Solidjs components library focused on usability, whitelabel theming, accessibility and developer experience
30 lines (24 loc) • 861 B
JavaScript
import { boxSystemStyleProps } from './Box/style-props.js';
function getAllUsedStyleProps(props) {
return Object.keys(props).filter(key => __isBoxStyledSystemProp(key));
}
function isEmptyObject(obj) {
console.log('isEmptyObject', obj);
return typeof obj === 'object' && Object.keys(obj).length === 0;
}
const __isBoxStyledSystemProp = prop => boxSystemStyleProps.includes(prop);
const getProps = test => props => {
const next = {};
for (const key in props) {
if (test(key || '')) next[key] = props[key];
}
return next;
};
const MRE = /^m[terblxy]?$/;
const getMargin = getProps(k => MRE.test(k));
const omitMargin = getProps(k => !MRE.test(k));
/** @internal */
function __internalProps(props) {
return props;
}
export { __internalProps, __isBoxStyledSystemProp, getAllUsedStyleProps, getMargin, getProps, isEmptyObject, omitMargin };