@vue-interface/sizeable
Version:
The sizeable mixin for interface components.
1 lines • 2.23 kB
Source Map (JSON)
{"version":3,"file":"sizeable.umd.cjs","sources":["../src/Sizeable.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent } from 'vue';\n\nexport default defineComponent({\n\n props: {\n\n /**\n * The generic component prefix.\n */\n componentPrefix: String,\n\n /**\n * The size name.\n */\n size: String,\n\n /**\n * The sizable prefix. Should use to component prefix, unless the\n * sizeable prefix is different than the component prefix.\n */\n sizePrefix: String\n\n },\n\n computed: {\n\n /**\n * The computed sizeable class prefix.\n */\n sizeableClassPrefix(): string|undefined {\n return this.sizePrefix || this.componentPrefix;\n },\n \n /**\n * Determines if the size already has the prefix.\n */\n hasSizeablePrefix(): boolean {\n if(this.size === undefined) {\n return false;\n }\n\n return !!this.size.match(\n new RegExp(`^${this.sizeableClassPrefix}`)\n );\n },\n\n /**\n * The size classes that get injected into the DOM.\n */\n sizeableClass(): string {\n // If there is no size just return an empty string.\n if(!this.size) {\n return '';\n }\n\n // If there is no size prefix or the size already had the\n // prefix, then return the size as-is.\n if(!this.sizeableClassPrefix || this.hasSizeablePrefix) {\n return this.size;\n }\n\n // Otherwise prefix the size.\n return `${this.sizeableClassPrefix}-${this.size}`;\n }\n\n }\n\n});\n</script>"],"names":["_sfc_main","defineComponent"],"mappings":"6PAGA,MAAAA,EAAeC,kBAAgB,CAE3B,MAAO,CAKH,gBAAiB,OAKjB,KAAM,OAMN,WAAY,MAEhB,EAEA,SAAU,CAKN,qBAAwC,CAC7B,OAAA,KAAK,YAAc,KAAK,eACnC,EAKA,mBAA6B,CACtB,OAAA,KAAK,OAAS,OACN,GAGJ,CAAC,CAAC,KAAK,KAAK,MACf,IAAI,OAAO,IAAI,KAAK,qBAAqB,CAAA,CAEjD,EAKA,eAAwB,CAEjB,OAAC,KAAK,KAMN,CAAC,KAAK,qBAAuB,KAAK,kBAC1B,KAAK,KAIT,GAAG,KAAK,uBAAuB,KAAK,OAVhC,EAWf,CAEJ,CAEJ,CAAC"}