-
-
Notifications
You must be signed in to change notification settings - Fork 13
chore: fix mark property types + linting issues #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
35cc427
refine graticule mark props
gka a682816
refine area mark prop types
gka 7ab586b
refine & export arrow mark props
gka fcdc48f
refine & export axisX mark props
gka 474f50d
bump dependencies
gka f853d54
code formatting
gka 6cee752
chore: fix eslint errors
gka a0877dc
chore: fix more lint errors
gka 9897afa
add lint workflow
gka adbe036
chore: refine & export axisY and bar mark prop types
gka dabc567
chore: refine & export bollinger mark prop types
gka bc7c07e
add interval to barX prop type
gka 3883ccf
add @component comments
gka ff9a607
add more component comments
gka c0c025d
chore: refine & export brush mark prop types
gka e130315
chore: refine & export cell mark prop types
gka b855719
chore: refine & export differenceY mark prop types
gka 612d150
chore: refine & export color legend mark prop types
gka e1dbb18
chore: refine & export dot mark prop types
gka f5a3cf1
chore: refine & export frame mark prop types + use rectpath in frame
gka 5cd23c4
docs: use borderRadius in frame example
gka 7aae918
chore: refine & export geo mark prop types
gka 1e1cb86
formatting + lint
gka 619f1b0
add frame class
gka 00d31e9
remove log
gka ce240c8
..
gka 4a43f22
chore: refine & export grid mark prop types
gka e27d094
add type for linkable mark props
gka 4e86084
format
gka e5264aa
export line mark props type
gka 304b801
link mark props
gka 4608349
rect mark props
gka 81e2185
stack
gka 7b45bb0
document rect stacking
gka 10f1877
fix link
gka e773a49
docs: sort marks alphabetically in sidebar
gka 31f5c3b
ts: export regression mark types
gka 1ca9cf4
ts: export rule mark props types
gka 4f81a9e
ts: export spike, vector and sphere mark props types
gka 13265ac
ts: export text mark props type
gka 6022452
ts: export tick marks prop types
gka a545e47
fix typo
gka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore: refine & export frame mark prop types + use rectpath in frame
- Loading branch information
commit f5a3cf14e3ff62c5b4a83148777f6eefc385bfe1
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,61 @@ | ||
<script lang="ts"> | ||
import Mark from '../Mark.svelte'; | ||
import { getContext } from 'svelte'; | ||
import type { PlotContext, BaseRectMarkProps } from '../types.js'; | ||
import type { BaseMarkProps } from '../types.js'; | ||
import { resolveProp, resolveScaledStyles } from '../helpers/resolve.js'; | ||
import { addEventHandlers } from './helpers/events.js'; | ||
|
||
type FrameMarkProps = BaseMarkProps & | ||
<!-- | ||
@component | ||
Renders a simple frame around the entire plot domain | ||
--> | ||
<script module lang="ts"> | ||
export type FrameMarkProps = Omit< | ||
BaseMarkProps, | ||
'fill' | 'stroke' | 'fillOpacity' | 'strokeOpacity' | ||
> & | ||
Omit< | ||
BaseRectMarkProps, | ||
'inset' | 'insetLeft' | 'insetRight' | 'insetTop' | 'insetBottom' | ||
> & { | ||
fill: string; | ||
stroke: string; | ||
fillOpacity: number; | ||
strokeOpacity: number; | ||
automatic?: boolean; | ||
inset?: number; | ||
insetLeft?: number; | ||
insetRight?: number; | ||
insetTop?: number; | ||
insetBottom?: number; | ||
}; | ||
</script> | ||
|
||
let { automatic, class: className = '', ...options }: FrameMarkProps = $props(); | ||
<script lang="ts"> | ||
import Mark from '../Mark.svelte'; | ||
import { getContext } from 'svelte'; | ||
import type { PlotContext, BaseRectMarkProps } from '../types.js'; | ||
import type { BaseMarkProps } from '../types.js'; | ||
import RectPath from './helpers/RectPath.svelte'; | ||
|
||
let { | ||
automatic, | ||
class: className = '', | ||
fill, | ||
stroke, | ||
fillOpacity, | ||
strokeOpacity, | ||
...options | ||
}: FrameMarkProps = $props(); | ||
|
||
const { getPlotState } = getContext<PlotContext>('svelteplot'); | ||
const plot = $derived(getPlotState()); | ||
|
||
const dx = $derived(resolveProp(options.dx, null, 0)); | ||
const dy = $derived(resolveProp(options.dy, null, 0)); | ||
|
||
const { | ||
insetLeft = options.inset || 0, | ||
insetTop = options.inset || 0, | ||
insetRight = options.inset || 0, | ||
insetBottom = options.inset || 0 | ||
} = $derived(options); | ||
</script> | ||
|
||
<Mark type="frame" {automatic}> | ||
<rect | ||
class={['frame', className]} | ||
transform={dx || dy ? `translate(${dx},${dy})` : null} | ||
style={resolveScaledStyles({}, options, {}, plot, 'stroke')} | ||
x={plot.options.marginLeft + +insetLeft} | ||
y={plot.options.marginTop + +insetTop} | ||
rx={resolveProp(options.rx, null, null)} | ||
ry={resolveProp(options.ry, null, null)} | ||
width={plot.facetWidth - (insetLeft || 0) - (insetRight || 0)} | ||
height={plot.facetHeight - (insetBottom || 0) - (insetTop || 0)} | ||
use:addEventHandlers={{ getPlotState, options: options, datum: {} }} /> | ||
{#snippet children({ usedScales })} | ||
<RectPath | ||
class={className} | ||
datum={{ fill, stroke, fillOpacity, strokeOpacity, datum: {}, valid: true }} | ||
x={plot.options.marginLeft} | ||
y={plot.options.marginTop} | ||
width={plot.facetWidth} | ||
height={plot.facetHeight} | ||
{usedScales} | ||
fallbackStyle="stroke" | ||
options={{ ...options, fill, stroke, fillOpacity, strokeOpacity }} /> | ||
{/snippet} | ||
</Mark> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.