1 line
2.3 KiB
Text
1 line
2.3 KiB
Text
|
{"version":3,"sources":["../../../src/mixins/registrable/index.ts"],"names":[],"mappings":";;;;;;;;AAAA;;AAEA;;;;;;AAEA,SAAS,eAAT,CAA0B,KAA1B,EAAyC,MAAzC,EAAuD;AACrD,SAAO;AAAA,WAAM,wCAAmB,KAAnB,8CAA4D,MAA5D,EAAN;AAAA,GAAP;AACD;;AASK,SAAU,MAAV,CAEH,SAFG,EAEW,KAFX,EAE2B,MAF3B,EAE0C;AAC9C,MAAM,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,aAAI,MAAJ,CAAW;AAChB,IAAA,IAAI,EAAE,oBADU;AAGhB,IAAA,MAAM,sBACH,SADG,EACS;AACX,MAAA,OAAO,EAAE;AADE,KADT;AAHU,GAAX,CAAP;AASD;;AAEK,SAAU,OAAV,CAAmB,SAAnB,EAAkD;AAAA,MAAZ,IAAY,uEAAL,KAAK;AACtD,SAAO,aAAI,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,OAPgB,qBAOT;AACL,iCACG,SADH,EACe,IAAI,GAAG,IAAH,GAAU;AACzB,QAAA,QAAQ,EAAE,KAAK,QADU;AAEzB,QAAA,UAAU,EAAE,KAAK;AAFQ,OAD7B;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"}
|