Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
5823f74
Experiment supporting `<Rect>` as html `<div>` (need to fix types and…
techniq Jun 11, 2025
8ec2bc7
Merge branch 'next' into html-rect
techniq Jun 11, 2025
4d5f1c9
feat: Add `pointsToAngleAndLength()` math util
techniq Jun 12, 2025
a3ae56f
fix(Rect): Support border radius for html
techniq Jun 12, 2025
748795e
feat(Text): Initial support for Html context
techniq Jun 12, 2025
464d312
feat(Line): Initial support for Html context
techniq Jun 12, 2025
ffc022b
More html context experimenting
techniq Jun 12, 2025
ccdc8f7
Merge branch 'next' into html-rect
techniq Jun 21, 2025
26f4375
Merge branch 'next' into html-rect
techniq Jun 24, 2025
484f5df
docs(Calendar): Fix canvas clipping
techniq Jun 24, 2025
d7590b2
feat(Circle): Add html support
techniq Jun 24, 2025
cc06e8e
Document more examples with html support (at least partial)
techniq Jun 24, 2025
1061545
fix(Text): Support rotate with html context
techniq Jun 24, 2025
73941aa
fix(Text): Coalesce rotate to `0` deg
techniq Jun 24, 2025
9ad23ef
fix(Calendar): Align label Text when using Html with other contexts
techniq Jun 24, 2025
88990d6
Merge branch 'next' into html-rect
techniq Aug 17, 2025
de4e495
Add `CommonEvents` type to support Svg/Html contexts and make svelte-…
techniq Aug 17, 2025
6da4494
Merge branch 'next' into html-rect
techniq Aug 18, 2025
1d37a13
feat(Ellipse): Support html context
techniq Aug 20, 2025
78d88d6
fix(Primatives): Apply default classes when using Canvas context (lik…
techniq Aug 20, 2025
e62d736
Update changeset
techniq Aug 20, 2025
e2e6be5
docs: Fix radial grid example
techniq Aug 20, 2025
e29abe7
fix(Line): Correctly center and respect strokeWidth
techniq Aug 20, 2025
227ab32
docs: Improve some primitive examples
techniq Aug 20, 2025
97a13dd
fix(Text): Apply `fill: currentColor` to support more straightforward…
techniq Aug 20, 2025
815e4f2
Merge branch 'next' into html-rect
techniq Sep 13, 2025
a85c8b5
Remove use of `layerClass` and apply `lc-{name}` class directly to al…
techniq Sep 13, 2025
0cbef45
Update extractLayerProps() and usage to no longer use layerClass
techniq Sep 13, 2025
a5a57e0
Update primitives to support css-only (no Tailwind)
techniq Sep 15, 2025
e8adc04
Add TODO about touch scrolling
techniq Sep 15, 2025
1a21d5c
Update Grid and Spline to support css-only (no Tailwind)
techniq Sep 15, 2025
1af5da1
feat(LinearGradient): Support Html context
techniq Sep 15, 2025
22034c4
fix(TooltipContext): Revert back to pointer events (instead of mouse/…
techniq Sep 15, 2025
b2f034e
Update AnnotationLine, AnnotationPoint, and AnnotationRange to suppor…
techniq Sep 15, 2025
969e591
Update BrushContext to support css-only (no Tailwind)
techniq Sep 15, 2025
c7fe36c
fix(TooltipContext): Place classes in `base` css layer
techniq Sep 15, 2025
0fb4c39
Update Calendar to support css-only (no Tailwind)
techniq Sep 15, 2025
e1374b1
Update MonthPath to support css-only (no Tailwind)
techniq Sep 15, 2025
e090721
Update Marker to support css-only (no Tailwind)
techniq Sep 15, 2025
5b6ca0b
Update Highlight and Labels to support css-only (no Tailwind)
techniq Sep 15, 2025
a0c0b29
feat(LineChart): Support `orientation="vertical"`. Resolves #640
techniq Sep 15, 2025
9efe2ae
fix(AreaChart|LineChart|DefaultTooltip): Handle per-series data with …
techniq Sep 16, 2025
1cec888
Add Dagre docs placeholder
techniq Sep 16, 2025
d75b630
fix(SimplifiedCharts): Properly handle `legend` prop as object when d…
techniq Sep 17, 2025
dff350c
Merge branch 'next' into html-rect
techniq Sep 17, 2025
6b4fd9a
Add `getObjectOrNull` and `resolveMaybeFn` to simplify use cases
techniq Sep 18, 2025
ee2bd7f
Update PieChart to use SeriesState for series/key selection. Use `cr…
techniq Sep 18, 2025
e35eb29
fix(SimplifiedChart): Still add selected legend item opacity when ite…
techniq Sep 18, 2025
8d895e0
Fix import
techniq Sep 18, 2025
9f08640
Merge branch 'next' into html-rect
techniq Sep 20, 2025
72b364b
feat(Highlight): Support passing `opacity`
techniq Sep 20, 2025
e5dce44
feat(SeriesState): Add `isHighlighted(seriesKey)` to easy check if se…
techniq Sep 20, 2025
5c05b65
Remove most tailwind classes from simplified charts (using opacity pr…
techniq Sep 20, 2025
e2d30e7
docs(PieChart): Turn off tooltip for segments examples
techniq Sep 20, 2025
dcb101d
Remove SeriesState (and HighlightState) to new `states` directory (fi…
techniq Sep 20, 2025
a309859
Remove tailwind classes (and cls) from layout components
techniq Sep 20, 2025
0c7e046
Remove tailwind classes (and cls) from Legend
techniq Sep 21, 2025
d4b7739
Fix legend ramp swatch
techniq Sep 21, 2025
920b8c0
cleanup
techniq Sep 21, 2025
3b742ac
feat(Legend): Add `selected` prop to fade out unselected items (if pa…
techniq Sep 21, 2025
83e82ea
Use Legend selected prop and remove last remaining `opacity-*` classes
techniq Sep 21, 2025
9da566c
Remove tailwind classes (and cls) from TileImage
techniq Sep 21, 2025
e6f42a0
Remove tailwind classes (and cls) from Hull and Voronoi
techniq Sep 21, 2025
809a218
Cleanup TooltipContext
techniq Sep 21, 2025
3855cce
Add overlooked fallback for --color-surface-content usage
techniq Sep 21, 2025
1457c6f
Always use oklab (and not oklch) when mixing colors (especially trans…
techniq Sep 21, 2025
f7fad58
Remove tailwind classes (and cls) from Tooltip components
techniq Sep 21, 2025
ec0ab79
move overlooked .lc-text-svg TW classes to CSS
techniq Sep 21, 2025
9a54c90
Remove remaining tailwind classes
techniq Sep 21, 2025
a989514
Add examples/standalone
techniq Sep 21, 2025
0082e34
Set default color for --color-primary usage
techniq Sep 21, 2025
eb71f02
fix(PieChart): Use schemeObservable10 as css variable fallbacks
techniq Sep 21, 2025
cfa39ab
Add more chart types to examples/standalone
techniq Sep 21, 2025
3e93294
Add examples/skeleton-3
techniq Sep 21, 2025
8529e30
feat: Simplify Skeleton integration with `@import 'layerchart/skeleto…
techniq Sep 22, 2025
2c3c946
Add examples/daisyui-5
techniq Sep 22, 2025
2b172b0
Add examples/svelteux-2
techniq Sep 22, 2025
ef47596
Add examples/shadcn-svelte-1
techniq Sep 22, 2025
7777449
Rename examples/svelte-ux-2 directory
techniq Sep 22, 2025
f534ba7
Update pnpm-lock after dirctory rename
techniq Sep 22, 2025
acdbae9
cleanup
techniq Sep 22, 2025
bb32851
Fix `pnpm check` for examples
techniq Sep 22, 2025
cefa9e2
Investigate issue 645
techniq Sep 23, 2025
953490c
fix svelte-check
techniq Sep 23, 2025
007e9cf
Just ignore
techniq Sep 23, 2025
8d3d961
Merge branch 'next' into issue-645
techniq Sep 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .changeset/crazy-ads-appear.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/empty-buses-flash.md

This file was deleted.

2 changes: 1 addition & 1 deletion .changeset/weak-donuts-tan.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'layerchart': patch
---

feat: Simplify daisyUI, shadcn-svelte, and Skeleton integrations with single line `@import 'layerchart/{library}.css'` added to `app.css`
feat: Simplify Skeleton integration with `@import 'layerchart/skeleton.css'`
2 changes: 1 addition & 1 deletion .changeset/whole-women-listen.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'layerchart': minor
---

feat: Support css-only usage (no Tailwind required) while retaining first-class Tailwind support
feat: Support css-only usage (no Tailwind required) while still providing first-class Tailwind support
2 changes: 1 addition & 1 deletion .github/workflows/build-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: pnpm install

- name: Build site
run: pnpm build:packages
run: pnpm build

- name: Upload build artifact
uses: actions/upload-artifact@v4
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,12 @@ jobs:

- run: pnpm install --frozen-lockfile

- run: pnpm check:packages
- run: pnpm check

- run: pnpm lint:packages
- run: pnpm lint

- run: pnpm test:unit
env:
CI: true

- run: pnpm build:packages

- run: pnpm build:examples

# Run after building to ensure svelte-package is ran
- run: pnpm check:examples
- run: pnpm lint:examples
- run: pnpm build
2 changes: 1 addition & 1 deletion .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: pnpm install

- name: Build site
run: pnpm build:packages
run: pnpm build

- name: Deploy to Cloudflare Pages
uses: AdrianGonz97/refined-cf-pages-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pkg-pr-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- run: pnpm install --frozen-lockfile

- run: pnpm build:packages
- run: pnpm build

- run: pnpm package

Expand Down
2 changes: 1 addition & 1 deletion examples/daisyui-5/src/app.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import 'tailwindcss';
@plugin "daisyui";
@import 'layerchart/daisyui-5.css';
@import 'layerchart/daisyui.css';
4 changes: 0 additions & 4 deletions examples/shadcn-svelte-1/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ bun.lockb

# Miscellaneous
/static/

# Ignore shadcn/ui components and utils
src/lib/components/ui/
src/lib/utils.ts
2 changes: 1 addition & 1 deletion examples/skeleton-3/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@import '@skeletonlabs/skeleton/optional/presets';
@import '@skeletonlabs/skeleton/themes/cerberus';

@import 'layerchart/skeleton-3.css';
@import 'layerchart/skeleton.css';

@source '../node_modules/@skeletonlabs/skeleton-svelte/dist';

Expand Down
2 changes: 1 addition & 1 deletion examples/svelte-ux-2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@sveltejs/kit": "^2.22.0",
"@sveltejs/vite-plugin-svelte": "^6.0.0",
"@tailwindcss/vite": "^4.0.0",
"layerchart": "workspace:*",
"layerchart": "workspace:2.0.0-next.38",
"prettier": "^3.4.2",
"prettier-plugin-svelte": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.11",
Expand Down
14 changes: 5 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@
"author": "Sean Lynch <[email protected]>",
"license": "MIT",
"type": "module",
"homepage": "https://layerchart.com",
"scripts": {
"dev": "pnpm -r dev",
"test:unit": "pnpm -r test:unit",
"build:packages": "rimraf packages/*/dist && pnpm --filter './packages/*' build",
"build:examples": "rimraf packages/*/dist && pnpm --filter './packages/*' package && pnpm --filter './examples/*' build",
"package": "pnpm --filter './packages/*' package",
"check:packages": "pnpm --filter './packages/*' check",
"check:examples": "pnpm --filter './examples/*' check",
"lint:packages": "pnpm --filter './packages/*' lint",
"lint:examples": "pnpm --filter './examples/*' lint",
"build": "rimraf packages/*/dist && pnpm -r build",
"package": "pnpm -r package",
"check": "pnpm -r check",
"lint": "pnpm -r lint",
"format": "pnpm -r format",
"changeset": "changeset",
"changeset:version": "changeset version",
Expand All @@ -33,4 +29,4 @@
"esbuild"
]
}
}
}
19 changes: 6 additions & 13 deletions packages/layerchart/src/lib/components/Grid.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@

<!-- Add extra rule after last band -->
{#if isScaleBand(ctx.xScale) && bandAlign === 'between' && !ctx.radial && xTickVals.length}
{@const x = ctx.xScale(xTickVals[xTickVals.length - 1])! + ctx.xScale.step() + xBandOffset}
<Rule
x={xTickVals[xTickVals.length - 1]}
xOffset={ctx.xScale.step() + xBandOffset}
Expand Down Expand Up @@ -218,11 +217,9 @@
/>
{/if}
{:else}
<Line
x1={ctx.xRange[0]}
y1={ctx.yScale(y) + yBandOffset}
x2={ctx.xRange[1]}
y2={ctx.yScale(y) + yBandOffset}
<Rule
{y}
yOffset={yBandOffset}
{motion}
{...splineProps}
class={cls('lc-grid-y-rule', classes.line, splineProps?.class)}
Expand All @@ -240,13 +237,9 @@
class={cls('lc-grid-y-radial-circle', classes.line, splineProps?.class)}
/>
{:else}
{@const y =
ctx.yScale(yTickVals[yTickVals.length - 1])! + ctx.yScale.step() + yBandOffset}
<Line
x1={ctx.xRange[0]}
y1={y}
x2={ctx.xRange[1]}
y2={y}
<Rule
y={yTickVals[yTickVals.length - 1]}
yOffset={ctx.yScale.step() + yBandOffset}
{motion}
{...splineProps}
class={cls('lc-grid-y-end-rule', classes.line, splineProps?.class)}
Expand Down
8 changes: 0 additions & 8 deletions packages/layerchart/src/lib/components/Group.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,3 @@
{@render children?.()}
</div>
{/if}

<style>
@layer base {
:where(.lc-group-div) {
position: absolute;
}
}
</style>
83 changes: 41 additions & 42 deletions packages/layerchart/src/lib/components/Legend.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -435,57 +435,56 @@
right: 0;
}
}
}

:where(.lc-legend-title) {
font-size: 10px;
font-weight: 600;
}
:where(.lc-legend-title) {
font-size: 10px;
font-weight: 600;
}

:where(.lc-legend-ramp-svg) {
overflow: visible;
}
:where(.lc-legend-ramp-svg) {
overflow: visible;
}

:where(.lc-legend-tick-text) {
font-size: 10px;
fill: var(--color-surface-content, currentColor);
}
:where(.lc-legend-tick-text) {
font-size: 10px;
fill: var(--color-surface-content, currentColor);
}

:where(.lc-legend-tick-line) {
stroke: var(--color-surface-content, currentColor);
}
:where(.lc-legend-tick-line) {
stroke: var(--color-surface-content, currentColor);
}

:where(.lc-legend-swatch-group) {
display: flex;
gap: 0.25rem 1rem;
:where(.lc-legend-swatch-group) {
display: flex;
gap: 0.25rem 1rem;

&[data-orientation='vertical'] {
flex-direction: column;
}
&[data-orientation='vertical'] {
flex-direction: column;
}
}

:where(.lc-legend-swatch-button) {
display: flex;
align-items: center;
gap: 0.25rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
:where(.lc-legend-swatch-button) {
display: flex;
align-items: center;
gap: 0.25rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

:where(.lc-legend-swatch) {
width: 16px;
height: 16px;
flex-shrink: 0;
border-radius: 9999px; /* full */
}
:where(.lc-legend-swatch) {
width: 16px;
height: 16px;
flex-shrink: 0;
border-radius: 9999px; /* full */
}

:where(.lc-legend-swatch-label) {
font-size: 0.75rem; /* text-xs */
line-height: calc(1 / 0.75);
color: var(--color-surface-content, currentColor);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
:where(.lc-legend-swatch-label) {
font-size: 0.75rem; /* text-xs */
color: var(--color-surface-content, currentColor);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
25 changes: 15 additions & 10 deletions packages/layerchart/src/lib/components/Rule.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -223,25 +223,30 @@

<style>
@layer components {
/* TODO: better way to handle this without affecting other components? */
/* Could add a layer between "components" and "base" but would require more setup (and not alignw with TW layers) */
:global(
:where(
.lc-rule-x-line,
.lc-rule-y-line,
.lc-rule-x-radial-line,
.lc-rule-y-radial-circle
):not([class*='lc-axis'], [class*='lc-grid'])
) {
:global(:where(.lc-rule-x-line, .lc-rule-y-line)) {
--stroke-color: color-mix(
in oklab,
var(--color-surface-content, currentColor) 50%,
transparent
);
}

:global(:where(.lc-rule-x-radial-line)) {
/* STYLE-TODO: should this be 10% or 50% like .lc-rule-x-line? */
--stroke-color: color-mix(
in oklab,
var(--color-surface-content, currentColor) 10%,
transparent
);
}

:global(:where(.lc-rule-y-radial-circle)) {
--fill-color: none;
--stroke-color: color-mix(
in oklab,
var(--color-surface-content, currentColor) 50%,
transparent
);
}
}
</style>
4 changes: 4 additions & 0 deletions packages/layerchart/src/lib/components/charts/ArcChart.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@
const item = chartData.find((d) => keyAccessor(d) === tick);
return item ? (labelAccessor(item) ?? tick) : tick;
},
onclick: (e, item) => {
// Select data keys instead of series value
seriesState.selectedKeys.toggle(item.value);
},
...props.legend,
...getObjectOrNull(legend),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@
x: isVertical ? (s.value ?? (s.data ? undefined : s.key)) : undefined,
y: !isVertical ? (s.value ?? (s.data ? undefined : s.key)) : undefined,
stroke: s.color,
...props.spline,
...s.props,
opacity:
// Checking `visibleSeries.length <= 1` fixes re-animated tweened areas on hover
seriesState.visibleSeries.length <= 1 || seriesState.isHighlighted(s.key, true) ? 1 : 0.1,
...props.spline,
...s.props,
class: cls(props.spline?.class, s.props?.class),
};

Expand Down
7 changes: 5 additions & 2 deletions packages/layerchart/src/lib/components/charts/PieChart.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@
const item = chartData.find((d) => keyAccessor(d) === tick);
return item ? (labelAccessor(item) ?? tick) : tick;
},
onclick: (e, item) => {
// Select data keys instead of series value
seriesState.selectedKeys.toggle(item.value);
},
...props.legend,
...getObjectOrNull(legend),
},
Expand Down Expand Up @@ -415,8 +419,7 @@
{@render marks(snippetProps)}
{:else}
<Group {...getGroupProps()}>
<!-- Use `series` instead of `visibleSeries` since data is filtered (legend) instead of series -->
{#each series as s, seriesIdx (s.key)}
{#each seriesState.visibleSeries as s, seriesIdx (s.key)}
{#if typeof pie === 'function'}
{@render pie({
...snippetProps,
Expand Down
Loading
Loading