1 |
- {"version":3,"file":"focus.mjs","names":["useProxiedModel","computed","EventProp","getCurrentInstanceName","propsFactory","makeFocusProps","focused","Boolean","useFocus","props","name","arguments","length","undefined","isFocused","focusClasses","value","focus","blur"],"sources":["../../src/composables/focus.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed } from 'vue'\nimport { EventProp, getCurrentInstanceName, propsFactory } from '@/util'\n\n// Types\nexport interface FocusProps {\n focused: boolean\n 'onUpdate:focused': ((focused: boolean) => any) | undefined\n}\n\n// Composables\nexport const makeFocusProps = propsFactory({\n focused: Boolean,\n 'onUpdate:focused': EventProp<[boolean]>(),\n}, 'focus')\n\nexport function useFocus (\n props: FocusProps,\n name = getCurrentInstanceName()\n) {\n const isFocused = useProxiedModel(props, 'focused')\n const focusClasses = computed(() => {\n return ({\n [`${name}--focused`]: isFocused.value,\n })\n })\n\n function focus () {\n isFocused.value = true\n }\n\n function blur () {\n isFocused.value = false\n }\n\n return { focusClasses, isFocused, focus, blur }\n}\n"],"mappings":"AAAA;AAAA,SACSA,eAAe,8BAExB;AACA,SAASC,QAAQ,QAAQ,KAAK;AAAA,SACrBC,SAAS,EAAEC,sBAAsB,EAAEC,YAAY,6BAExD;AAMA;AACA,OAAO,MAAMC,cAAc,GAAGD,YAAY,CAAC;EACzCE,OAAO,EAAEC,OAAO;EAChB,kBAAkB,EAAEL,SAAS;AAC/B,CAAC,EAAE,OAAO,CAAC;AAEX,OAAO,SAASM,QAAQA,CACtBC,KAAiB,EAEjB;EAAA,IADAC,IAAI,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGR,sBAAsB,EAAE;EAE/B,MAAMW,SAAS,GAAGd,eAAe,CAACS,KAAK,EAAE,SAAS,CAAC;EACnD,MAAMM,YAAY,GAAGd,QAAQ,CAAC,MAAM;IAClC,OAAQ;MACN,CAAE,GAAES,IAAK,WAAU,GAAGI,SAAS,CAACE;IAClC,CAAC;EACH,CAAC,CAAC;EAEF,SAASC,KAAKA,CAAA,EAAI;IAChBH,SAAS,CAACE,KAAK,GAAG,IAAI;EACxB;EAEA,SAASE,IAAIA,CAAA,EAAI;IACfJ,SAAS,CAACE,KAAK,GAAG,KAAK;EACzB;EAEA,OAAO;IAAED,YAAY;IAAED,SAAS;IAAEG,KAAK;IAAEC;EAAK,CAAC;AACjD"}
|