Browse Source

[ui] Vue 3 - Renaming webComponentWrapper to webComponentWrap & preping it for internal wrapper implementation

sreenaths 4 years ago
parent
commit
754b46a853

+ 22 - 0
desktop/core/src/desktop/js/vue/webComponentWrap.ts

@@ -0,0 +1,22 @@
+import { createApp, ComponentOptions, Component } from 'vue';
+// import wrapper from './wrapper/index';
+
+// Dummy till wrapper is fixed ---
+import { CreateAppFunction } from '@vue/runtime-core';
+function wrapper(createApp: CreateAppFunction<Element>, component: Component): CustomElementConstructor {
+  return null;
+}
+// Dummy till wrapper is fixed ---
+
+export interface HueComponentOptions<T extends Component> extends ComponentOptions<T> {
+  hueBaseUrl?: string;
+}
+
+export const wrap = <T extends Component>(
+  tag: string,
+  component: { new (): T },
+  options?: ElementDefinitionOptions
+): void => {
+  const customElement: CustomElementConstructor = wrapper(createApp, component);
+  window.customElements.define(tag, customElement, options);
+};

+ 0 - 17
desktop/core/src/desktop/js/vue/webComponentWrapper.ts

@@ -1,17 +0,0 @@
-import Vue, { ComponentOptions } from 'vue';
-import VueCustomElement from 'vue-custom-element';
-import vueCustomElement from 'vue-custom-element';
-
-Vue.use(vueCustomElement);
-
-export interface HueComponentOptions<T extends Vue> extends ComponentOptions<T> {
-  hueBaseUrl?: string;
-}
-
-export const wrap = <T extends Vue>(
-  tag: string,
-  component: { new (): T },
-  options?: VueCustomElement.options
-): void => {
-  Vue.customElement(tag, new component().$options, options);
-};