UNPKG

@nextcloud/vue

Version:
1 lines 2.73 kB
{"version":3,"file":"index.cjs","sources":["../src/functions/a11y/index.ts","../src/plugin.ts"],"sourcesContent":["/**\n * @copyright 2022 Christopher Ng <chrng8@gmail.com>\n *\n * @author Christopher Ng <chrng8@gmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n/**\n * Return true if the DOM event is an accessible mouse or keyboard element activation, false otherwise\n *\n * @param {Event} event DOM event\n *\n * @return {boolean}\n */\nexport const isA11yActivation = (event: Event) => {\n\tif (event.type === 'click') {\n\t\treturn true\n\t}\n\tif (event.type === 'keydown' && (event as KeyboardEvent).key === 'Enter') {\n\t\treturn true\n\t}\n\treturn false\n}\n","import type { DefineComponent, Directive, PluginObject } from 'vue'\n\nimport * as NcComponents from './components/index.js'\nimport * as NcDirectives from './directives/index.js'\n\n/**\n * Install all Nextcloud Vue components and directives globally\n * @example\n * ```js\n * import { NextcloudVuePlugin } from '@nextcloud/vue'\n * import Vue from 'vue'\n *\n * // ...\n *\n * Vue.use(NextcloudVuePlugin)\n * new Vue({\n * // options\n * })\n * ```\n */\nexport const NextcloudVuePlugin: PluginObject<never> = {\n\tinstall(Vue) {\n\t\t// Install components\n\t\tObject.entries(NcComponents as { [key: string]: DefineComponent }).forEach(([name, component]) => {\n\t\t\tVue.component(component.name || name, component)\n\t\t})\n\n\t\t// Install directives\n\t\tObject.entries(NcDirectives as { [key: string]: Directive }).forEach(([name, directive]) => {\n\t\t\tVue.directive(name, directive)\n\t\t})\n\t},\n}\n"],"names":["isA11yActivation","event","NextcloudVuePlugin","Vue","NcComponents","name","component","NcDirectives","directive"],"mappings":"unKA6BaA,GAAoBC,GAC5BA,EAAM,OAAS,SAGfA,EAAM,OAAS,WAAcA,EAAwB,MAAQ,kKCbrDC,GAA0C,CACtD,QAAQC,EAAK,CAEL,OAAA,QAAQC,EAAkD,EAAE,QAAQ,CAAC,CAACC,EAAMC,CAAS,IAAM,CACjGH,EAAI,UAAUG,EAAU,MAAQD,EAAMC,CAAS,CAAA,CAC/C,EAGM,OAAA,QAAQC,EAA4C,EAAE,QAAQ,CAAC,CAACF,EAAMG,CAAS,IAAM,CACvFL,EAAA,UAAUE,EAAMG,CAAS,CAAA,CAC7B,CACF,CACD"}