Skip to content

Commit 4a7cccb

Browse files
authored
docs: Integrate renderContext documentation and toggling (#549)
* Setup shared state to track selected `renderContext` to use for all examples. Add `meta.supportedContexts` to page load() to display options and document per component / example * Add `supportedContexts` for all primatives and use `Layer` for examples with shared state * Add `supportedContexts` for all common components (Axis, Grid, etc) and use `Layer` for examples with shared state * Add `supportedContexts` for all simplified charts (AreaChart, BarChart, etc) and use `Layer` for examples with shared state * breaking(Spline): Rename `splineRef` to `pathRef` * fix(Calendar|MonthPath): Support canvas by using `Spline` instead of `path` * Add `supportedContexts` for all data marks (Area, Bars, etc) and use `Layer` for examples with shared state * Add `supportedContexts` for all annotations and use `Layer` for examples with shared state * Add `supportedContexts` for all interactions and use `Layer` for examples with shared state * Add `supportedContexts` for all layout components and use `Layer` for examples with shared state * Add `supportedContexts` for all clip path and other components and use `Layer` for examples with shared state * Fix types. Add changeset * Add `supportedContexts` for force examples and a few others * fix(GeoPath): Do not register with hit canavs unless pointer events (onclick, onpointermove, etc) or tooltipContext are defined * Add `supportedContexts` for GeoPath example * Add `supportedContexts` for GeoPoint example * Fix Layer onpointermove type * Add `supportedContexts` for more geo examples * Add `supportedContexts` for zoomable map example * Add `supportedContexts` for zoomable tile map example * Add `supportedContexts` for timezomes example * breaking(Blur): Remove children snippet props (not needed and easier to support canvas in the future) * Add `supportedContexts` for remaining geo examples * Cleanup * Add `supportedContexts` for remaining examples * fix(Layer): Pass `onpointermove` via `restProps` * Update remaining usage of Svg/Canvas to Layer
1 parent 07d9b22 commit 4a7cccb

File tree

276 files changed

+1600
-2141
lines changed

Some content is hidden

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

276 files changed

+1600
-2141
lines changed

.changeset/bumpy-breads-rhyme.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(GeoPath): Do not register with hit canavs unless pointer events (onclick, onpointermove, etc) or tooltipContext are defined

.changeset/huge-boats-fix.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: Document each component's context support (svg, canvas, html) with interactive toggle

.changeset/ninety-ghosts-taste.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+
breaking(Blur): Remove children snippet props (not needed and easier to support canvas in the future)

.changeset/pink-flies-worry.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(Calendar|MonthPath): Support canvas by using `Spline` instead of `path`

.changeset/tangy-lies-strive.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+
breaking(Spline): Rename `splineRef` to `pathRef`

packages/layerchart/src/app.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ declare namespace App {
1919
hideUsage?: boolean;
2020
hideTableOfContents?: boolean;
2121
status?: string;
22+
supportedContexts?: Array<'svg' | 'canvas' | 'html'>;
2223
};
2324
}
2425

packages/layerchart/src/lib/components/Arc.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,13 @@
401401
<Spline
402402
pathData={trackArc()}
403403
stroke="none"
404-
bind:splineRef={trackRef}
404+
bind:pathRef={trackRef}
405405
{...extractLayerProps(track, 'arc-track')}
406406
/>
407407
{/if}
408408

409409
<Spline
410-
bind:splineRef={ref}
410+
bind:pathRef={ref}
411411
pathData={arc()}
412412
transform="translate({xOffset}, {yOffset})"
413413
{fill}

packages/layerchart/src/lib/components/Blur.svelte

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
1515
/**
1616
* The default children snippet which provides
17-
* the id and url for the filter.
17+
* the id for the filter.
1818
*/
19-
children?: Snippet<[{ id: string; url: string }]>;
19+
children?: Snippet;
2020
};
2121
</script>
2222

@@ -42,7 +42,9 @@
4242

4343
{#if children}
4444
<g filter="url(#{id})" class={layerClass('blur-g')}>
45-
{@render children({ id, url: `url(#${id})` })}
45+
{@render children()}
4646
</g>
4747
{/if}
48+
{:else if children}
49+
{@render children()}
4850
{/if}

packages/layerchart/src/lib/components/Connector.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
type = 'rounded',
8383
radius = 20,
8484
curve = curveLinear,
85-
splineRef = $bindable(),
85+
pathRef = $bindable(),
8686
pathData: pathDataProp,
8787
marker,
8888
markerStart,
@@ -137,7 +137,7 @@
137137

138138
<Spline
139139
pathData={motionPath.current}
140-
bind:splineRef
140+
bind:pathRef
141141
marker-start={markerStartId ? `url(#${markerStartId})` : undefined}
142142
marker-mid={markerMidId ? `url(#${markerMidId})` : undefined}
143143
marker-end={markerEndId ? `url(#${markerEndId})` : undefined}

packages/layerchart/src/lib/components/GeoPath.svelte

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,11 @@
157157
name: 'GeoPath',
158158
render,
159159
events: {
160-
click: _onClick,
161-
pointerenter: _onPointerEnter,
162-
pointermove: _onPointerMove,
163-
pointerleave: _onPointerLeave,
160+
// Only register events if they are defined (so they are not registered with hit canvas unnecessarily)
161+
click: onclick ? _onClick : undefined,
162+
pointerenter: restProps.onpointerenter || tooltipContext ? _onPointerEnter : undefined,
163+
pointermove: restProps.onpointermove || tooltipContext ? _onPointerMove : undefined,
164+
pointerleave: restProps.onpointerleave || tooltipContext ? _onPointerLeave : undefined,
164165
pointerdown: restProps.onpointerdown,
165166
touchmove: restProps.ontouchmove,
166167
},

0 commit comments

Comments
 (0)