@empoleon/solid-measure
Version:
Compute measurements of SolidJS components
28 lines (24 loc) • 529 B
text/typescript
import { MeasurementType } from "./get-content-rect";
export interface MeasureProps {
client?: boolean;
offset?: boolean;
scroll?: boolean;
bounds?: boolean;
margin?: boolean;
}
const types: MeasurementType[] = [
"client",
"offset",
"scroll",
"bounds",
"margin",
];
export default function getTypes(props: MeasureProps): MeasurementType[] {
const allowedTypes: MeasurementType[] = [];
types.forEach((type) => {
if (props[type]) {
allowedTypes.push(type);
}
});
return allowedTypes;
}