svelte-tiny-linked-charts 1.2.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
  [![npm version](https://badgen.net/npm/v/svelte-tiny-linked-charts)](https://www.npmjs.com/package/svelte-tiny-linked-charts)
5
5
  [![npm downloads](https://badgen.net/npm/dt/svelte-tiny-linked-charts)](https://www.npmjs.com/package/svelte-tiny-linked-charts)
6
6
  [![MadeWithSvelte.com shield](https://madewithsvelte.com/storage/repo-shields/3278-shield.svg)](https://madewithsvelte.com/p/tiny-linked-charts/shield-link)
7
+ [![bundle size](https://badgen.net/bundlephobia/minzip/svelte-confetti)](https://bundlephobia.com/package/svelte-tiny-linked-charts)
7
8
 
8
9
  This is a library to display tiny bar charts. These charts are more so meant for graphic aids, rather than scientific representations. There's no axis labels, no extensive data visualisation, just bars.
9
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-tiny-linked-charts",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "build": "rollup -c",
@@ -44,11 +44,6 @@
44
44
  "main": "src/index.js",
45
45
  "module": "src/index.mjs",
46
46
  "svelte": "src/index.js",
47
- "exports": {
48
- ".": {
49
- "svelte": "./src/index.js"
50
- }
51
- },
52
47
  "author": {
53
48
  "email": "mitchel_jager@hotmail.com",
54
49
  "name": "mitcheljager"
@@ -121,6 +121,23 @@
121
121
  { /if }
122
122
 
123
123
  { #each Object.entries(data) as [key, value], i }
124
+ { #if type == "bar" }
125
+ <rect
126
+ style={ transition ? `transition: all ${ transition }ms` : null }
127
+ opacity={ hover && $hoveringKey[linkedKey] && $hoveringKey[linkedKey] != key ? fadeOpacity : 1 }
128
+ fill={ fill }
129
+ width={ barWidth }
130
+ height={ type == "line" ? height : getHeight(value) }
131
+ x={ (parseInt(gap) + barWidth) * i }
132
+ y={ (height - getHeight(value)) } />
133
+ { :else if type == "line" }
134
+ <circle
135
+ fill={ hover && $hoveringKey[linkedKey] !== null && $hoveringKey[linkedKey] == key ? fill : "transparent" }
136
+ r={ barWidth / 2 }
137
+ cy={ height - getHeight(value) }
138
+ cx={ ((parseInt(gap) + barWidth) * i) } />
139
+ { /if }
140
+
124
141
  <!-- svelte-ignore a11y-no-noninteractive-tabindex -->
125
142
  <rect
126
143
  on:mouseover={ () => startHover(key, i) }
@@ -128,22 +145,11 @@
128
145
  on:touchstart={ () => startHover(key, i) }
129
146
  on:click={ () => clickHandler(key, i) }
130
147
  on:keypress={ () => clickHandler(key, i) }
131
- style={ transition ? `transition: all ${ transition }ms` : null }
132
- opacity={ hover && $hoveringKey[linkedKey] && $hoveringKey[linkedKey] != key ? fadeOpacity : 1 }
133
- fill={ type == "line" ? "transparent" : fill }
134
148
  width={ barWidth }
135
- height={ type == "line" ? height : getHeight(value) }
136
- y={ type == "line" ? 0 : (height - getHeight(value)) }
149
+ height={ height }
150
+ fill="transparent"
137
151
  x={ (parseInt(gap) + barWidth) * i }
138
152
  { tabindex } />
139
-
140
- { #if type == "line" }
141
- <circle
142
- fill={ hover && $hoveringKey[linkedKey] !== null && $hoveringKey[linkedKey] == key ? fill : "transparent" }
143
- r={ barWidth / 2 }
144
- cy={ height - getHeight(value) }
145
- cx={ ((parseInt(gap) + barWidth) * i) } />
146
- { /if }
147
153
  { /each }
148
154
  </g>
149
155
  </svg>