{"version":3,"file":"global-properties.mjs","sources":["../../../../../../src/services/vue-plugin/utils/global-properties.ts"],"sourcesContent":["import { App, AppContext, ComponentCustomProperties } from 'vue'\n\n/** Type safe return app global properties for assign */\nexport const extractGlobalProperties = (app: App | AppContext) => app.config.globalProperties\n\n/**\n * Type safe set vue global property\n * Declare type before use this method.\n * ```\ndeclare module 'vue' {\n  export interface ComponentCustomProperties {\n    $vaThing: ThingType\n  }\n}\n * ```\n * @example See `global-config` or `color-config` for example\n */\nexport const defineGlobalProperty = <Key extends keyof ComponentCustomProperties, Value extends ComponentCustomProperties[Key]>(app: App, key: Key, v: Value) => {\n  const globalProperties = extractGlobalProperties(app)\n  globalProperties[key] = v\n}\n\n/** Type safe return vue global property */\nexport const getGlobalProperty = <Key extends keyof ComponentCustomProperties>(app: App | AppContext, key: Key): ComponentCustomProperties[Key] => {\n  return extractGlobalProperties(app)[key]\n}\n"],"names":[],"mappings":"AAGO,MAAM,0BAA0B,CAAC,QAA0B,IAAI,OAAO;AActE,MAAM,uBAAuB,CAA4F,KAAU,KAAU,MAAa;AACzJ,QAAA,mBAAmB,wBAAwB,GAAG;AACpD,mBAAiB,GAAG,IAAI;AAC1B;AAGa,MAAA,oBAAoB,CAA8C,KAAuB,QAA6C;AAC1I,SAAA,wBAAwB,GAAG,EAAE,GAAG;AACzC;"}