techniq / layerchart

Composable Svelte chart components to build a wide range of visualizations
https://www.layerchart.com
MIT License
668 stars 12 forks source link

Suggestion: use "alias" so page source / example match usage #177

Closed CaptainCodeman closed 5 months ago

CaptainCodeman commented 6 months ago

The getting-started page explain how examples / page source will need different imports:

The page source will show:

import Chart, { Svg } from '$lib/components/Chart.svelte';
import Axis from '$lib/components/Axis.svelte';
import Bars from '$lib/components/Bars.svelte';

If you followed instructions to npm install layerchart your code should be:

import { Chart, Svg, Axis, Bars } from 'layerchart';

Using the alias configuration option would allow the internal code to import from 'layerchart' which might make things clearer / simpler.

BTW: excellent lib, just exploring it ...

CaptainCodeman commented 6 months ago

Oh, maybe a duplicate of https://github.com/techniq/layerchart/issues/108

techniq commented 6 months ago

Thanks @CaptainCodeman. There has been some exploration in a PR and need to see if there is any performance regressions (that outweigh the benefits). Likely there will not be though.

CaptainCodeman commented 5 months ago

Sorry for the noise, I should have looked first. I've never noticed any perf issue with that approach (although my libs tend to be smaller). AFAIK there are none and it's just a mapping done at the vite level.

techniq commented 5 months ago

As soon as I wrap up the Brush component I'm going to use alias see how it goes. Will be a good improvement for examples and general development.

techniq commented 5 months ago

and no worries about the noise, always nice to gauge interest to help set priorities.

CaptainCodeman commented 5 months ago

Yeah, as someone new to the lib it was one thing that tripped me up a little. That and the tailwindcss custom colors that appear to depend on the ux lib.

techniq commented 5 months ago

@CaptainCodeman Yeah, improving docs when not using Svelte UX (whether it's Skeleton, shadcn-svelte, standalone, etc) needs to be improved. Gathering notes in https://github.com/techniq/layerchart/issues/160 to move to the docs once I get more fleshed out.

Also hoping to gather a lot of examples of various framework combinations to allow others to use as reference.

techniq commented 5 months ago

@CaptainCodeman https://github.com/techniq/layerchart/pull/192 😁