Open Ellarddekoeijer opened 3 months ago
@Ellarddekoeijer i did get it working vue:
https://github.com/bielu/bielu.Umbraco.Cdn/tree/master/src/bielu.cdn.ui
i think you missunderstood this bit:
isCustomElement: (tag) => tag.startsWith('uui')
as that means uui is custom element prefix in vue and should be compiled to custom element ;) as my CE is prefixed with umbraco so i used it to make sure my component is compiled to CE.
@bielu thanks for replying and helping. I personally doubt that this is causing the issue.
When I use a uui component that simply extends LitElement
everything seems to work just fine. However, once I try to use a uui component that extends something like UUIFormControlMixin
this error occurs. Which makes me belief that the error is in fact caused by the uui library.
My colleague Guus has made a stackblitz that reproduces this
In conclusion: The uui library is said to be vendor-independant, currently it does not seem to be.
Tagging @iOvergaard to make sure this does not fly under the radar.
@bielu @Ellarddekoeijer
I just found out it's an issue since version 1.8.0 (1.8.0-rc.3 is working). This also explains why it is working for @bielu.
Here you can find the comparisons: uui 1.7.2 in a Vue app works uui 1.8.0 in a Vue app doesn't work
Also I found out it's not just a Vue issue, this happens also in React for example. uui 1.7.2 in a React app works uui 1.8.0+ in a React app doesn't work
I think the error logged is also something that might be related to an issue where the (more complex?) uui elements don't conform the CustomElement javascript API. Maybe this issue is overlooked because in Lit the error isn't thrown.
@iOvergaard @nielslyngsoe maybe it's something to look into what changed in the 1.8.0 release? It's unfortunate we can't use the UUI components anymore in javascript frameworks, since we want to create extensions (eg. dashboarding for our projects) where we don't want to use Lit, but do want to use the uui component library.
Which exact UI Library version are you using? For example: 1.0.1 - don't just write v1.
1.8.2
Bug summary
As the title describes, I would like to use The @umbraco-ui/uui web components in a vue app. Vue supports the use of web components, yet I cannot seem to get this to work.
I created a simple vue app using pnpm create vue@latest then I follow the steps over at https://vuejs.org/guide/extras/web-components#using-custom-elements-in-vue. (I can provide my vite config if need be, let me know.)
Then I pnpm add @umbraco-ui/uui-button, remove everything from App.vue, render the web component like so:
No dice! The error chunk-2OPG2DWD.js?v=5cdc5437:9659 Uncaught DOMException: Failed to construct 'CustomElement': The result must not have attributes is thrown and the element does not work.
As far as my understanding about web components & vue goes; built lit components should work in vue. Am I doing something wrong or does @umbraco-ui not support this?
FYI: Originally posted on the Umbraco discord server.
Specifics
No response
Steps to reproduce