1 line
No EOL
2.4 KiB
Text
1 line
No EOL
2.4 KiB
Text
{"version":3,"sources":["../../../src/mixins/registrable/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAP,MAAgB,KAAhB;AAEA,SAAS,WAAT,QAA4B,oBAA5B;;AAEA,SAAS,eAAT,CAA0B,KAA1B,EAAyC,MAAzC,EAAuD;AACrD,SAAO,MAAM,WAAW,CAAC,OAAO,KAAK,oCAAoC,MAAM,EAAvD,CAAxB;AACD;;AASD,OAAM,SAAU,MAAV,CAEH,SAFG,EAEW,KAFX,EAE2B,MAF3B,EAE0C;AAC9C,QAAM,WAAW,GAAG,KAAK,IAAI,MAAT,GAAkB;AACpC,IAAA,QAAQ,EAAE,eAAe,CAAC,KAAD,EAAQ,MAAR,CADW;AAEpC,IAAA,UAAU,EAAE,eAAe,CAAC,KAAD,EAAQ,MAAR;AAFS,GAAlB,GAGhB,IAHJ;AAKA,SAAO,GAAG,CAAC,MAAJ,CAAW;AAChB,IAAA,IAAI,EAAE,oBADU;AAGhB,IAAA,MAAM,EAAE;AACN,OAAC,SAAD,GAAa;AACX,QAAA,OAAO,EAAE;AADE;AADP;AAHQ,GAAX,CAAP;AASD;AAED,OAAM,SAAU,OAAV,CAAmB,SAAnB,EAAsC,IAAI,GAAG,KAA7C,EAAkD;AACtD,SAAO,GAAG,CAAC,MAAJ,CAAW;AAChB,IAAA,IAAI,EAAE,qBADU;AAGhB,IAAA,OAAO,EAAE,IAAI,GAAG,EAAH,GAAQ;AACnB,MAAA,QAAQ,EAAE,IADS;AAEnB,MAAA,UAAU,EAAE;AAFO,KAHL;;AAOhB,IAAA,OAAO,GAAA;AACL,aAAO;AACL,SAAC,SAAD,GAAa,IAAI,GAAG,IAAH,GAAU;AACzB,UAAA,QAAQ,EAAE,KAAK,QADU;AAEzB,UAAA,UAAU,EAAE,KAAK;AAFQ;AADtB,OAAP;AAMD;;AAde,GAAX,CAAP;AAgBD","sourcesContent":["import Vue from 'vue'\nimport { VueConstructor } from 'vue/types/vue'\nimport { consoleWarn } from '../../util/console'\n\nfunction generateWarning (child: string, parent: string) {\n return () => consoleWarn(`The ${child} component must be used inside a ${parent}`)\n}\n\nexport type Registrable<T extends string, C extends VueConstructor | null = null> = VueConstructor<Vue & {\n [K in T]: C extends VueConstructor ? InstanceType<C> : {\n register (...props: any[]): void\n unregister (self: any): void\n }\n}>\n\nexport function inject<\n T extends string, C extends VueConstructor | null = null\n> (namespace: T, child?: string, parent?: string): Registrable<T, C> {\n const defaultImpl = child && parent ? {\n register: generateWarning(child, parent),\n unregister: generateWarning(child, parent),\n } : null\n\n return Vue.extend({\n name: 'registrable-inject',\n\n inject: {\n [namespace]: {\n default: defaultImpl,\n },\n },\n })\n}\n\nexport function provide (namespace: string, self = false) {\n return Vue.extend({\n name: 'registrable-provide',\n\n methods: self ? {} : {\n register: null,\n unregister: null,\n },\n provide (): object {\n return {\n [namespace]: self ? this : {\n register: this.register,\n unregister: this.unregister,\n },\n }\n },\n })\n}\n"],"sourceRoot":"","file":"index.js"} |