vuestic-ui
Version:
Vue 3 UI Framework
1 lines • 1.56 kB
Source Map (JSON)
{"version":3,"file":"withConfigTransport.mjs","sources":["../../../../../src/services/config-transport/withConfigTransport.ts"],"sourcesContent":["import { createProxyComponent } from './createProxyComponent'\n\nconst CLASS_COMPONENT_KEY = '__c'\n\nconst patchClassComponent = (component: { [CLASS_COMPONENT_KEY]: any }): any => {\n component[CLASS_COMPONENT_KEY] = createProxyComponent(component[CLASS_COMPONENT_KEY])\n return component\n}\n\n/** Allows props to be passed from vuestic config if they were not provided */\nexport const withConfigTransport = <T>(component: T): T => {\n if ('setup' in (component as any)) {\n return createProxyComponent(component as any)\n } else if (CLASS_COMPONENT_KEY in (component as any)) {\n // TODO: Remove this. We don't want to use class components\n return patchClassComponent(component as any)\n } else {\n // Options api. We need to transform it to Composition API and then create proxy.\n (component as any).setup = () => ({ /* Fake setup function */})\n // TODO: remove this? no point if this will not work anyway\n return createProxyComponent(component as any)\n }\n}\n\nexport default withConfigTransport\n"],"names":[],"mappings":";AAEA,MAAM,sBAAsB;AAE5B,MAAM,sBAAsB,CAAC,cAAmD;AAC9E,YAAU,mBAAmB,IAAI,qBAAqB,UAAU,mBAAmB,CAAC;AAC7E,SAAA;AACT;AAGa,MAAA,sBAAsB,CAAI,cAAoB;AACzD,MAAI,WAAY,WAAmB;AACjC,WAAO,qBAAqB,SAAgB;AAAA,EAAA,WACnC,uBAAwB,WAAmB;AAEpD,WAAO,oBAAoB,SAAgB;AAAA,EAAA,OACtC;AAEJ,cAAkB,QAAQ,OAAO;AAAA;AAAA,IAAA;AAElC,WAAO,qBAAqB,SAAgB;AAAA,EAC9C;AACF;AAEA,MAAA,wBAAe;"}