Skip to content

Commit 1678de5

Browse files
authored
feat: CSS-only usage, HTML components, and more (#557)
* Experiment supporting `<Rect>` as html `<div>` (need to fix types and further validate) * feat: Add `pointsToAngleAndLength()` math util * fix(Rect): Support border radius for html * feat(Text): Initial support for Html context * feat(Line): Initial support for Html context * More html context experimenting * docs(Calendar): Fix canvas clipping * feat(Circle): Add html support * Document more examples with html support (at least partial) * fix(Text): Support rotate with html context * fix(Text): Coalesce rotate to `0` deg * fix(Calendar): Align label Text when using Html with other contexts * Add `CommonEvents` type to support Svg/Html contexts and make svelte-check happy * feat(Ellipse): Support html context * fix(Primatives): Apply default classes when using Canvas context (like Svg) * Update changeset * docs: Fix radial grid example * fix(Line): Correctly center and respect strokeWidth * docs: Improve some primitive examples * fix(Text): Apply `fill: currentColor` to support more straightforward way of changing color (ex. `class="text-red-500"` or `style="color:red"`) * Remove use of `layerClass` and apply `lc-{name}` class directly to allow easy component <style> targetting * Update extractLayerProps() and usage to no longer use layerClass * Update primitives to support css-only (no Tailwind) * Add TODO about touch scrolling * Update Grid and Spline to support css-only (no Tailwind) * feat(LinearGradient): Support Html context * fix(TooltipContext): Revert back to pointer events (instead of mouse/touch) but with `touch-action: pan-y`. Provides simplified events while allowing horizontal scrubbing with vertical scrolling. Add `touchAction` prop to control. Support css-only usage (no Tailwind) * Update AnnotationLine, AnnotationPoint, and AnnotationRange to support css-only (no Tailwind) * Update BrushContext to support css-only (no Tailwind) * fix(TooltipContext): Place classes in `base` css layer * Update Calendar to support css-only (no Tailwind) * Update MonthPath to support css-only (no Tailwind) * Update Marker to support css-only (no Tailwind) * Update Highlight and Labels to support css-only (no Tailwind) * feat(LineChart): Support `orientation="vertical"`. Resolves #640 * fix(AreaChart|LineChart|DefaultTooltip): Handle per-series data with different length * Add Dagre docs placeholder * fix(SimplifiedCharts): Properly handle `legend` prop as object when determining bottom padding * Add `getObjectOrNull` and `resolveMaybeFn` to simplify use cases * Update PieChart to use SeriesState for series/key selection. Use `createLegendProps` (with some overrides for data/series selection differences). Fix legend selection styling when overrides are provided * fix(SimplifiedChart): Still add selected legend item opacity when item classes are also applied * Fix import * feat(Highlight): Support passing `opacity` * feat(SeriesState): Add `isHighlighted(seriesKey)` to easy check if series is hightlight (or should be faded) * Remove most tailwind classes from simplified charts (using opacity props). Update ArcChart to use SeriesState * docs(PieChart): Turn off tooltip for segments examples * Remove SeriesState (and HighlightState) to new `states` directory (first of many) * Remove tailwind classes (and cls) from layout components * Remove tailwind classes (and cls) from Legend * Fix legend ramp swatch * cleanup * feat(Legend): Add `selected` prop to fade out unselected items (if passed and non-empty) * Use Legend selected prop and remove last remaining `opacity-*` classes * Remove tailwind classes (and cls) from TileImage * Remove tailwind classes (and cls) from Hull and Voronoi * Cleanup TooltipContext * Add overlooked fallback for --color-surface-content usage * Always use oklab (and not oklch) when mixing colors (especially transparent) * Remove tailwind classes (and cls) from Tooltip components * move overlooked .lc-text-svg TW classes to CSS * Remove remaining tailwind classes * Add examples/standalone * Set default color for --color-primary usage * fix(PieChart): Use schemeObservable10 as css variable fallbacks * Add more chart types to examples/standalone * Add examples/skeleton-3 * feat: Simplify Skeleton integration with `@import 'layerchart/skeleton.css'` * Add examples/daisyui-5 * Add examples/svelteux-2 * Add examples/shadcn-svelte-1 * Rename examples/svelte-ux-2 directory * Update pnpm-lock after dirctory rename * cleanup * Fix `pnpm check` for examples * Run `pnpm package` for layerchart before building examples (fix CI) * update Svelte UX layerchart workspace version * update CI to handle examples/* * Update top-level package scripts with filtered build/check/lint scripts (separate packages from examples) * fix typo * fix filter * Ignore shadcn-svelte components/utils from prettier * Change Grid to use Line instead of Rule instead to guarantee style order (since Rule is also on the `components` layer, but Line is on `base`) * fix(LineChart): Allow opacity to be overriden by series props (fix large series examples) * fix(Group): Restore adding "position: absolute" when using Html * Put all the legend classes in the components layer (was overlooked) * fix(Legend): Align line-height with original `text-xs` * Fix legend selection on LineChart/etc and simplify SeriesState * Add homepage to package.json * remove Rule import * Allow Rule to be used by Axis/Grid without applying default styles due to inconsistent source order * fix(TooltipContext): Fix `band` mode regression when both x/y are scaleBand (ex. punchcard chart) * Refine changeset * update changesets * Rename daisyUI and skeleton css files to indicate version * fix(TooltipHeader): use semi-transparent --color-surface-content for bottom border
1 parent 24e71b4 commit 1678de5

231 files changed

Lines changed: 5479 additions & 1111 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/chilly-games-hide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'layerchart': patch
3+
---
4+
5+
fix(TooltipContext): Revert back to pointer events (instead of mouse/touch) but with `touch-action: pan-y`. Provides simplified events while allowing horizontal scrubbing with vertical scrolling.

.changeset/crazy-ads-appear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'layerchart': patch
3+
---
4+
5+
fix(TooltipContext): Fix `band` mode regression when both x/y are scaleBand (ex. punchcard chart)

.changeset/cute-donkeys-greet.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'layerchart': patch
3+
---
4+
5+
fix(SimplifiedCharts): Properly handle `legend` prop as object when determining bottom padding

.changeset/deep-signs-listen.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'layerchart': patch
3+
---
4+
5+
fix(Text): Apply `fill: currentColor` to support more straightforward way of changing color (ex. `class="text-red-500"` or `style="color:red"`)

.changeset/empty-buses-flash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'layerchart': patch
3+
---
4+
5+
docs: Add examples for standalone, daisyUI v5, shadcn-svelte v1, Skeleton v3, and Svelte UX v2 (next) (including light/dark theming)

.changeset/fast-insects-deny.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'layerchart': patch
3+
---
4+
5+
feat(LineChart): Support `orientation="vertical"`. Resolves #640

.changeset/grumpy-ties-mix.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'layerchart': patch
3+
---
4+
5+
fix(AreaChart|LineChart|DefaultTooltip): Handle per-series data with different length

.changeset/heavy-signs-kick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'layerchart': patch
3+
---
4+
5+
feat(Highlight): Support passing `opacity`

.changeset/hot-pigs-push.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'layerchart': patch
3+
---
4+
5+
fix(SimplifiedChart): Still add selected legend item opacity when item classes are also applied

.changeset/huge-regions-live.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'layerchart': patch
3+
---
4+
5+
feat(Legend): Add `selected` prop to fade out unselected items (if passed and non-empty)

0 commit comments

Comments
 (0)