routie dev init since i didn't adhere to any proper guidance up until now
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
// Utilities
|
||||
import { toRef } from 'vue';
|
||||
import { getCurrentInstanceName, propsFactory } from "../util/index.js"; // Types
|
||||
const allowedDensities = [null, 'default', 'comfortable', 'compact'];
|
||||
|
||||
// typeof allowedDensities[number] evaluates to any
|
||||
// when generating api types for whatever reason.
|
||||
|
||||
// Composables
|
||||
export const makeDensityProps = propsFactory({
|
||||
density: {
|
||||
type: String,
|
||||
default: 'default',
|
||||
validator: v => allowedDensities.includes(v)
|
||||
}
|
||||
}, 'density');
|
||||
export function useDensity(props, name = getCurrentInstanceName()) {
|
||||
const densityClasses = toRef(() => {
|
||||
return `${name}--density-${props.density}`;
|
||||
});
|
||||
return {
|
||||
densityClasses
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=density.js.map
|
||||
Reference in New Issue
Block a user