{"version":3,"file":"density.mjs","names":["computed","getCurrentInstanceName","propsFactory","allowedDensities","makeDensityProps","density","type","String","default","validator","v","includes","useDensity","props","name","arguments","length","undefined","densityClasses"],"sources":["../../src/composables/density.ts"],"sourcesContent":["// Utilities\nimport { computed } from 'vue'\nimport { getCurrentInstanceName, propsFactory } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\n\nconst allowedDensities = [null, 'default', 'comfortable', 'compact'] as const\n\n// typeof allowedDensities[number] evalutes to any\n// when generating api types for whatever reason.\nexport type Density = null | 'default' | 'comfortable' | 'compact'\n\nexport interface DensityProps {\n density?: Density\n}\n\n// Composables\nexport const makeDensityProps = propsFactory({\n density: {\n type: String as PropType,\n default: 'default',\n validator: (v: any) => allowedDensities.includes(v),\n },\n}, 'density')\n\nexport function useDensity (\n props: DensityProps,\n name = getCurrentInstanceName(),\n) {\n const densityClasses = computed(() => {\n return `${name}--density-${props.density}`\n })\n\n return { densityClasses }\n}\n"],"mappings":"AAAA;AACA,SAASA,QAAQ,QAAQ,KAAK;AAAA,SACrBC,sBAAsB,EAAEC,YAAY,6BAE7C;AAGA,MAAMC,gBAAgB,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,CAAU;;AAE7E;AACA;;AAOA;AACA,OAAO,MAAMC,gBAAgB,GAAGF,YAAY,CAAC;EAC3CG,OAAO,EAAE;IACPC,IAAI,EAAEC,MAA2B;IACjCC,OAAO,EAAE,SAAS;IAClBC,SAAS,EAAGC,CAAM,IAAKP,gBAAgB,CAACQ,QAAQ,CAACD,CAAC;EACpD;AACF,CAAC,EAAE,SAAS,CAAC;AAEb,OAAO,SAASE,UAAUA,CACxBC,KAAmB,EAEnB;EAAA,IADAC,IAAI,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGd,sBAAsB,EAAE;EAE/B,MAAMiB,cAAc,GAAGlB,QAAQ,CAAC,MAAM;IACpC,OAAQ,GAAEc,IAAK,aAAYD,KAAK,CAACR,OAAQ,EAAC;EAC5C,CAAC,CAAC;EAEF,OAAO;IAAEa;EAAe,CAAC;AAC3B"}