Open curran opened 6 years ago
From https://medium.com/@currankelleher/introducing-vizhub-beta-2edc4a0a1908
By Composition, I using components from existing visualizations to create new visualizations. For example, one could rapidly prototype an interactive dashboard with multiple linked views by composing components from “The Basic Bar Chart”, “The Basic Scatter Plot”, and “The Basic Line Chart”, without re-implementing the components from scratch.
We need to define the strategy for composing code across visualizations. Ideally you could take a component defined in one visualization and use it in another. Currently you can do this by copy-pasting files, but this feels like a workaround.
Desired Abilities:
Open Questions:
import { scatterPlot } from '@curran/scatter-plot'
?Idea: use Lerna in the exported .zip
. This would allow use of imports that resemble familiar namespaced packages, like import { scatterPlot } from '@curran/scatter-plot'
. There would be a package locally set up called @curran/scatter-plot
I guess. Is this possible with lerna? Not sure...
This approach would result in a flat tree (like NPM post-v3), whereas the ./curran/scatter-plot
approach would result in a deep tree with potentially multiple copies of the same imported thing (like NPM pre-v3).
Tricky:
Depends on #220 - we should really only import from specific revisions, otherwise things will break.
As a visualization author, I want to compose components from other visualizations, so that I can reuse them.
Idea for importing syntax:
import { something } from './${username}/${slug}/${filename}';