All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.lib.util.getCurrentInstance.mjs.map Maven / Gradle / Ivy

{"version":3,"file":"getCurrentInstance.mjs","names":["getCurrentInstance","_getCurrentInstance","toKebabCase","name","message","vm","Error","getCurrentInstanceName","arguments","length","undefined","type","aliasName","_uid","_map","WeakMap","getUid","has","get","uid","set","reset"],"sources":["../../src/util/getCurrentInstance.ts"],"sourcesContent":["// Utilities\nimport { getCurrentInstance as _getCurrentInstance } from 'vue'\nimport { toKebabCase } from '@/util/helpers'\n\n// Types\nimport type { ComponentInternalInstance } from 'vue'\n\nexport function getCurrentInstance (name: string, message?: string) {\n  const vm = _getCurrentInstance()\n\n  if (!vm) {\n    throw new Error(`[Vuetify] ${name} ${message || 'must be called from inside a setup function'}`)\n  }\n\n  return vm\n}\n\nexport function getCurrentInstanceName (name = 'composables') {\n  const vm = getCurrentInstance(name).type\n\n  return toKebabCase(vm?.aliasName || vm?.name)\n}\n\nlet _uid = 0\nlet _map = new WeakMap()\nexport function getUid () {\n  const vm = getCurrentInstance('getUid')\n\n  if (_map.has(vm)) return _map.get(vm)!\n  else {\n    const uid = _uid++\n    _map.set(vm, uid)\n    return uid\n  }\n}\ngetUid.reset = () => {\n  _uid = 0\n  _map = new WeakMap()\n}\n"],"mappings":"AAAA;AACA,SAASA,kBAAkB,IAAIC,mBAAmB,QAAQ,KAAK;AAAA,SACtDC,WAAW,yBAEpB;AAGA,OAAO,SAASF,kBAAkBA,CAAEG,IAAY,EAAEC,OAAgB,EAAE;EAClE,MAAMC,EAAE,GAAGJ,mBAAmB,CAAC,CAAC;EAEhC,IAAI,CAACI,EAAE,EAAE;IACP,MAAM,IAAIC,KAAK,CAAE,aAAYH,IAAK,IAAGC,OAAO,IAAI,6CAA8C,EAAC,CAAC;EAClG;EAEA,OAAOC,EAAE;AACX;AAEA,OAAO,SAASE,sBAAsBA,CAAA,EAAwB;EAAA,IAAtBJ,IAAI,GAAAK,SAAA,CAAAC,MAAA,QAAAD,S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