generate dev environment, add <vue-vega> component, and add example#5
generate dev environment, add <vue-vega> component, and add example#5
Conversation
dev tooling was automatically generated using https://www.npmjs.com/package/vue-sfc-rollup
|
@jsbroks please review |
| data: props.data, | ||
| }; | ||
|
|
||
| const { render, loading } = useVega(config as any); |
There was a problem hiding this comment.
You should be able to set the correct typing on the props with PropType
| config | ||
| ) | ||
| const { embed, ...vegaEmbed } = useVegaEmbed(el, spec, embedOptions) | ||
| const { embed, ...vegaEmbed } = useVegaEmbed(el, spec as any, embedOptions) |
There was a problem hiding this comment.
Why do we need the as any? We should reframe from using it when possible
| return output | ||
| } catch (error) { | ||
| options?.onError?.(error) | ||
| console.log("error is ", error); |
There was a problem hiding this comment.
Probably best to remove console the log by default.
| } catch (error) { | ||
| options?.onError?.(error) | ||
| console.log("error is ", error); | ||
| options?.onError?.(error as any) |
| // Watchers that update vega in the most optimal way by either modifying or | ||
| // re-rendering | ||
| useVegaUpdater(spec, embedOptions, signals, data, render, modify) | ||
| useVegaUpdater(spec as any, embedOptions, signals, data, render, modify) |
| console.log("embed called") | ||
| if (el.value == null) { | ||
| console.log("its null") | ||
| return |
|
Thank you for the comments. Will fix and update the PR. I have two rollup related questions I'm hoping someone can help with.
|
|
Alright, I've fixed the former issue with massive build sizes. Looks like the defaults from https://www.npmjs.com/package/vue-sfc-rollup weren't sane after all. I've removed the non-ESM builds as they were broken. |
|
I've gotten this closer to working but it is still somewhat broken. It looks like there is a fundamental issue using vue-demi for component libraries and there needs to be two versions of vue-vega - one for vue2 and one for vue3: vuejs/rollup-plugin-vue#427 |
|
I wont have time to work on this in the near future, but I did find an example project that is using Vue-Demi for a component library. If I or someone else picks this up, it's probably worth looking at: https://github.com/open-data-plan/g2plot-vue (see package.json and the scripts/postinstall.sh). This doesn't use rollup though. |
|
@jsbroks @aantn could you help with updating the vega-vue library to the latest Vega and Vega-Lite? As for simplifications, we now use npm instead of yarn for package installation and also switched to esm only (which means not bundling the dependencies into the esm bundle but referencing them) which addresses a concern raised above. I'm not sure whether you want to do this with this pull request or close this pull request. Could you help, though, maybe by the end of July? |
A few comments:
npm run serveto see a working application that uses this library. It demoes the very basic component that I added on top of the existing composition API.TODOs:
anyto fix typing errors in the existing code. This needs to be fixed.