-
-
Notifications
You must be signed in to change notification settings - Fork 13
feat: add text.lineHeight + support css variable font sizes #115
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for a new lineHeight text option and CSS variable font sizes, enhancing how text is rendered and positioned.
- Updated documentation to describe the new lineHeight option.
- Introduced an example showcasing CSS variable usage for font sizes in a Svelte component.
- Refactored text rendering by extracting multiline text logic into a helper component.
Reviewed Changes
Copilot reviewed 78 out of 78 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/routes/marks/text/+page.md | Updated text options documentation with a new lineHeight property and clarified positioning channels. |
src/routes/examples/text/css-var.svelte | Added an example demonstrating CSS variable-driven font size usage. |
src/lib/marks/helpers/MultilineText.svelte | Introduced a new helper to handle multiline text, incorporating lineHeight support. |
src/lib/marks/Text.svelte | Updated to use the new MultilineText helper and set default lineHeight. |
src/lib/helpers/resolve.ts | Minor code refactoring. |
src/lib/helpers/getBaseStyles.ts | Added helper functions to interpret pixel and rem values. |
Comments suppressed due to low confidence (1)
src/lib/marks/helpers/MultilineText.svelte:117
- The default lineHeight value is set to 1.2 here, while the documentation and the defaults in Text.svelte suggest a value of 1.1. Consider aligning the default values across components to ensure consistent behavior.
const lineHeight = $derived( textLines.length > 1 ? (resolveProp(args.lineHeight, d.datum) ?? 1.2) : 0 )
✅ Deploy Preview for svelteplot ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-115
# or install the specific version
npm install svelteplot@0.3.3-pr-115.0 |
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-115
# or install the specific version
npm install svelteplot@0.3.3-pr-115.1 |
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-115
# or install the specific version
npm install svelteplot@0.3.3-pr-115.2 |
This pull request improves support for multiline text, CSS variables for font size and line height,
Enhancements to text rendering:
Support for multiline text and line height customization:
lineHeight
property toText.svelte
, allowing users to specify line height as a multiplier of font size. Default value set to1.2
.Support for CSS variables in font size and line height:
maybeFromPixel
andmaybeFromRem
to convert CSS values (e.g.,px
andrem
) into numerical values.text/css-var.svelte
) demonstrating the use of CSS variables for font size and line height in SVG text rendering.