0.4.7 • Published 4 years ago

@omysoul/svelte-song-display v0.4.7

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

@omysoul/svelte-song-display

npm install @omysoul/svelte-song-display

This component attempts to render lyrics as large as possible one verse at a time. However it keeps the size of text consistent from verse to verse. To do this it tries many permutations of line breaks to find the one with the best coverage.

The component features a responsive canvas which will adjust its resolution when it resizes. It also adapts to pixel density. You can pass in a style prop to make the canvas resize by giving hight and width relative units (%, vh, vw, vmin) or using flex.

The SongDisplay component accepts songs in the following format:

const song = `title: Amazing grace 
author: John newton

Amazing grace, How sweet the sound
That saved a wretch like me.
I once was lost, but now I am found,
Was blind, but now I see.

'Twas grace that taught my heart to fear,
And grace my fears relieved.
How precious did that grace appear
The hour I first believed.`;

The title and the author lines are can be omitted and are currently not rendered.

Props

Prop
stylenormal HTML style attribute
verseIdwhich verse to show zero indexed number
blankshow a blank screen boolean
showSongshow the whole song at once
fillStylecolor of text hex values only
texttext of song in above format
fontWeightstring e.g. "italic bold" or "400"
fontFamilyCSS fontFamily
lineHeightdefault: 1.4
verseGapdefault: 0.75

Storybook

Example

<script>
  import SongDisplay from "@omysoul/svelte-song-display";
</script>
<SongDisplay
  style="width: 60%; height: 360px;"
  verseId="{1}"
  blank="{false}"
  wholeSong="{false}"
  fillStyle="#3cf"
  text="{song}"
/>
0.4.7

4 years ago

0.4.6

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.0

4 years ago

0.2.10

4 years ago

0.3.0

4 years ago

0.2.6

4 years ago

0.2.9

4 years ago

0.2.5

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.4

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago