size.mjs.map 2.1 KB

1
  1. {"version":3,"file":"size.mjs","names":["convertToUnit","destructComputed","getCurrentInstanceName","includes","propsFactory","predefinedSizes","makeSizeProps","size","type","String","Number","default","useSize","props","name","arguments","length","undefined","sizeClasses","sizeStyles","width","height"],"sources":["../../src/composables/size.ts"],"sourcesContent":["// Utilities\nimport { convertToUnit, destructComputed, getCurrentInstanceName, includes, propsFactory } from '@/util'\n\n// Types\nconst predefinedSizes = ['x-small', 'small', 'default', 'large', 'x-large']\n\nexport interface SizeProps {\n size?: string | number\n}\n\n// Composables\nexport const makeSizeProps = propsFactory({\n size: {\n type: [String, Number],\n default: 'default',\n },\n}, 'size')\n\nexport function useSize (\n props: SizeProps,\n name = getCurrentInstanceName(),\n) {\n return destructComputed(() => {\n let sizeClasses\n let sizeStyles\n if (includes(predefinedSizes, props.size)) {\n sizeClasses = `${name}--size-${props.size}`\n } else if (props.size) {\n sizeStyles = {\n width: convertToUnit(props.size),\n height: convertToUnit(props.size),\n }\n }\n return { sizeClasses, sizeStyles }\n })\n}\n"],"mappings":"AAAA;AAAA,SACSA,aAAa,EAAEC,gBAAgB,EAAEC,sBAAsB,EAAEC,QAAQ,EAAEC,YAAY,6BAExF;AACA,MAAMC,eAAe,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC;AAM3E;AACA,OAAO,MAAMC,aAAa,GAAGF,YAAY,CAAC;EACxCG,IAAI,EAAE;IACJC,IAAI,EAAE,CAACC,MAAM,EAAEC,MAAM,CAAC;IACtBC,OAAO,EAAE;EACX;AACF,CAAC,EAAE,MAAM,CAAC;AAEV,OAAO,SAASC,OAAOA,CACrBC,KAAgB,EAEhB;EAAA,IADAC,IAAI,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGb,sBAAsB,EAAE;EAE/B,OAAOD,gBAAgB,CAAC,MAAM;IAC5B,IAAIiB,WAAW;IACf,IAAIC,UAAU;IACd,IAAIhB,QAAQ,CAACE,eAAe,EAAEQ,KAAK,CAACN,IAAI,CAAC,EAAE;MACzCW,WAAW,GAAI,GAAEJ,IAAK,UAASD,KAAK,CAACN,IAAK,EAAC;IAC7C,CAAC,MAAM,IAAIM,KAAK,CAACN,IAAI,EAAE;MACrBY,UAAU,GAAG;QACXC,KAAK,EAAEpB,aAAa,CAACa,KAAK,CAACN,IAAI,CAAC;QAChCc,MAAM,EAAErB,aAAa,CAACa,KAAK,CAACN,IAAI;MAClC,CAAC;IACH;IACA,OAAO;MAAEW,WAAW;MAAEC;IAAW,CAAC;EACpC,CAAC,CAAC;AACJ"}