elevation.mjs.map 2.1 KB

1
  1. {"version":3,"file":"elevation.mjs","names":["computed","isRef","propsFactory","makeElevationProps","elevation","type","Number","String","validator","v","value","parseInt","isNaN","useElevation","props","elevationClasses","classes","push"],"sources":["../../src/composables/elevation.ts"],"sourcesContent":["// Utilities\nimport { computed, isRef } from 'vue'\nimport { propsFactory } from '@/util'\n\n// Types\nimport type { Ref } from 'vue'\nexport interface ElevationProps {\n elevation?: number | string | null\n}\n\n// Composables\nexport const makeElevationProps = propsFactory({\n elevation: {\n type: [Number, String],\n validator (v: any) {\n const value = parseInt(v)\n\n return (\n !isNaN(value) &&\n value >= 0 &&\n // Material Design has a maximum elevation of 24\n // https://material.io/design/environment/elevation.html#default-elevations\n value <= 24\n )\n },\n },\n}, 'elevation')\n\ntype ElevationData = {\n elevationClasses: Ref<string[]>\n}\n\nexport function useElevation (props: ElevationProps | Ref<number | string | undefined>): ElevationData {\n const elevationClasses = computed(() => {\n const elevation = isRef(props) ? props.value : props.elevation\n const classes: string[] = []\n\n if (elevation == null) return classes\n\n classes.push(`elevation-${elevation}`)\n\n return classes\n })\n\n return { elevationClasses }\n}\n"],"mappings":"AAAA;AACA,SAASA,QAAQ,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAC5BC,YAAY,6BAErB;AAMA;AACA,OAAO,MAAMC,kBAAkB,GAAGD,YAAY,CAAC;EAC7CE,SAAS,EAAE;IACTC,IAAI,EAAE,CAACC,MAAM,EAAEC,MAAM,CAAC;IACtBC,SAASA,CAAEC,CAAM,EAAE;MACjB,MAAMC,KAAK,GAAGC,QAAQ,CAACF,CAAC,CAAC;MAEzB,OACE,CAACG,KAAK,CAACF,KAAK,CAAC,IACbA,KAAK,IAAI,CAAC;MACV;MACA;MACAA,KAAK,IAAI,EAAE;IAEf;EACF;AACF,CAAC,EAAE,WAAW,CAAC;AAMf,OAAO,SAASG,YAAYA,CAAEC,KAAwD,EAAiB;EACrG,MAAMC,gBAAgB,GAAGf,QAAQ,CAAC,MAAM;IACtC,MAAMI,SAAS,GAAGH,KAAK,CAACa,KAAK,CAAC,GAAGA,KAAK,CAACJ,KAAK,GAAGI,KAAK,CAACV,SAAS;IAC9D,MAAMY,OAAiB,GAAG,EAAE;IAE5B,IAAIZ,SAAS,IAAI,IAAI,EAAE,OAAOY,OAAO;IAErCA,OAAO,CAACC,IAAI,CAAE,aAAYb,SAAU,EAAC,CAAC;IAEtC,OAAOY,OAAO;EAChB,CAAC,CAAC;EAEF,OAAO;IAAED;EAAiB,CAAC;AAC7B"}