svelte-plots-basic 1.0.5 → 1.0.6

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/dist/index.js CHANGED
@@ -2058,7 +2058,7 @@
2058
2058
  return child_ctx;
2059
2059
  }
2060
2060
 
2061
- // (53:0) {#if rx !== undefined && ry !== undefined}
2061
+ // (55:0) {#if rx !== undefined && ry !== undefined}
2062
2062
  function create_if_block$6(ctx) {
2063
2063
  let g;
2064
2064
  let g_class_value;
@@ -2079,7 +2079,7 @@
2079
2079
 
2080
2080
  attr(g, "class", g_class_value = "series " + /*style*/ ctx[2]);
2081
2081
  attr(g, "title", /*title*/ ctx[1]);
2082
- attr(g, "style", /*barsStyleStr*/ ctx[7]);
2082
+ attr(g, "style", /*barsStyleStr*/ ctx[3]);
2083
2083
  },
2084
2084
  m(target, anchor) {
2085
2085
  insert(target, g, anchor);
@@ -2089,7 +2089,7 @@
2089
2089
  }
2090
2090
  },
2091
2091
  p(ctx, dirty) {
2092
- if (dirty & /*rx, ry, rw, rh, left*/ 121) {
2092
+ if (dirty & /*rx, ry, rw, rh, left*/ 241) {
2093
2093
  each_value = /*left*/ ctx[0];
2094
2094
  let i;
2095
2095
 
@@ -2119,6 +2119,10 @@
2119
2119
  if (dirty & /*title*/ 2) {
2120
2120
  attr(g, "title", /*title*/ ctx[1]);
2121
2121
  }
2122
+
2123
+ if (dirty & /*barsStyleStr*/ 8) {
2124
+ attr(g, "style", /*barsStyleStr*/ ctx[3]);
2125
+ }
2122
2126
  },
2123
2127
  d(detaching) {
2124
2128
  if (detaching) detach(g);
@@ -2127,7 +2131,7 @@
2127
2131
  };
2128
2132
  }
2129
2133
 
2130
- // (55:3) {#each left as v, i}
2134
+ // (57:3) {#each left as v, i}
2131
2135
  function create_each_block$3(ctx) {
2132
2136
  let rect;
2133
2137
  let rect_x_value;
@@ -2138,28 +2142,28 @@
2138
2142
  return {
2139
2143
  c() {
2140
2144
  rect = svg_element("rect");
2141
- attr(rect, "x", rect_x_value = /*rx*/ ctx[6][/*i*/ ctx[27]]);
2142
- attr(rect, "y", rect_y_value = /*ry*/ ctx[5][/*i*/ ctx[27]]);
2143
- attr(rect, "width", rect_width_value = /*rw*/ ctx[4][/*i*/ ctx[27]]);
2144
- attr(rect, "height", rect_height_value = /*rh*/ ctx[3][/*i*/ ctx[27]]);
2145
+ attr(rect, "x", rect_x_value = /*rx*/ ctx[7][/*i*/ ctx[27]]);
2146
+ attr(rect, "y", rect_y_value = /*ry*/ ctx[6][/*i*/ ctx[27]]);
2147
+ attr(rect, "width", rect_width_value = /*rw*/ ctx[5][/*i*/ ctx[27]]);
2148
+ attr(rect, "height", rect_height_value = /*rh*/ ctx[4][/*i*/ ctx[27]]);
2145
2149
  },
2146
2150
  m(target, anchor) {
2147
2151
  insert(target, rect, anchor);
2148
2152
  },
2149
2153
  p(ctx, dirty) {
2150
- if (dirty & /*rx*/ 64 && rect_x_value !== (rect_x_value = /*rx*/ ctx[6][/*i*/ ctx[27]])) {
2154
+ if (dirty & /*rx*/ 128 && rect_x_value !== (rect_x_value = /*rx*/ ctx[7][/*i*/ ctx[27]])) {
2151
2155
  attr(rect, "x", rect_x_value);
2152
2156
  }
2153
2157
 
2154
- if (dirty & /*ry*/ 32 && rect_y_value !== (rect_y_value = /*ry*/ ctx[5][/*i*/ ctx[27]])) {
2158
+ if (dirty & /*ry*/ 64 && rect_y_value !== (rect_y_value = /*ry*/ ctx[6][/*i*/ ctx[27]])) {
2155
2159
  attr(rect, "y", rect_y_value);
2156
2160
  }
2157
2161
 
2158
- if (dirty & /*rw*/ 16 && rect_width_value !== (rect_width_value = /*rw*/ ctx[4][/*i*/ ctx[27]])) {
2162
+ if (dirty & /*rw*/ 32 && rect_width_value !== (rect_width_value = /*rw*/ ctx[5][/*i*/ ctx[27]])) {
2159
2163
  attr(rect, "width", rect_width_value);
2160
2164
  }
2161
2165
 
2162
- if (dirty & /*rh*/ 8 && rect_height_value !== (rect_height_value = /*rh*/ ctx[3][/*i*/ ctx[27]])) {
2166
+ if (dirty & /*rh*/ 16 && rect_height_value !== (rect_height_value = /*rh*/ ctx[4][/*i*/ ctx[27]])) {
2163
2167
  attr(rect, "height", rect_height_value);
2164
2168
  }
2165
2169
  },
@@ -2171,7 +2175,7 @@
2171
2175
 
2172
2176
  function create_fragment$8(ctx) {
2173
2177
  let if_block_anchor;
2174
- let if_block = /*rx*/ ctx[6] !== undefined && /*ry*/ ctx[5] !== undefined && create_if_block$6(ctx);
2178
+ let if_block = /*rx*/ ctx[7] !== undefined && /*ry*/ ctx[6] !== undefined && create_if_block$6(ctx);
2175
2179
 
2176
2180
  return {
2177
2181
  c() {
@@ -2183,7 +2187,7 @@
2183
2187
  insert(target, if_block_anchor, anchor);
2184
2188
  },
2185
2189
  p(ctx, [dirty]) {
2186
- if (/*rx*/ ctx[6] !== undefined && /*ry*/ ctx[5] !== undefined) {
2190
+ if (/*rx*/ ctx[7] !== undefined && /*ry*/ ctx[6] !== undefined) {
2187
2191
  if (if_block) {
2188
2192
  if_block.p(ctx, dirty);
2189
2193
  } else {
@@ -2210,6 +2214,7 @@
2210
2214
  let ry;
2211
2215
  let rw;
2212
2216
  let rh;
2217
+ let barsStyleStr;
2213
2218
  let $axesHeight;
2214
2219
  let $yLim;
2215
2220
  let $axesWidth;
@@ -2225,9 +2230,6 @@
2225
2230
  let { title = "" } = $$props;
2226
2231
  let { style = "series_rect" } = $$props;
2227
2232
 
2228
- // styles for bars and labels
2229
- const barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`;
2230
-
2231
2233
  // multiply width and height values if needed
2232
2234
  if (!Array.isArray(left) || !Array.isArray(top) || left.length < 1 || left.length != top.length) {
2233
2235
  throw "Rectangles: parameters 'left' and 'top' must be vectors of the same size.";
@@ -2276,19 +2278,24 @@
2276
2278
  $$self.$$.update = () => {
2277
2279
  if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/ 6291457) {
2278
2280
  // reactive variables for coordinates of data points in pixels
2279
- $$invalidate(6, rx = axes.scaleX(left, $xLim, $axesWidth));
2281
+ $$invalidate(7, rx = axes.scaleX(left, $xLim, $axesWidth));
2280
2282
  }
2281
2283
 
2282
2284
  if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/ 1589248) {
2283
- $$invalidate(5, ry = axes.scaleY(top, $yLim, $axesHeight));
2285
+ $$invalidate(6, ry = axes.scaleY(top, $yLim, $axesHeight));
2284
2286
  }
2285
2287
 
2286
2288
  if ($$self.$$.dirty & /*width, $xLim, $axesWidth*/ 6295552) {
2287
- $$invalidate(4, rw = axes.scaleX(width, $xLim, $axesWidth, true));
2289
+ $$invalidate(5, rw = axes.scaleX(width, $xLim, $axesWidth, true));
2288
2290
  }
2289
2291
 
2290
2292
  if ($$self.$$.dirty & /*height, $yLim, $axesHeight*/ 1581056) {
2291
- $$invalidate(3, rh = axes.scaleY(height, $yLim, $axesHeight, true));
2293
+ $$invalidate(4, rh = axes.scaleY(height, $yLim, $axesHeight, true));
2294
+ }
2295
+
2296
+ if ($$self.$$.dirty & /*faceColor, borderColor, lineWidth*/ 458752) {
2297
+ // styles for bars and labels
2298
+ $$invalidate(3, barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`);
2292
2299
  }
2293
2300
  };
2294
2301
 
@@ -2296,11 +2303,11 @@
2296
2303
  left,
2297
2304
  title,
2298
2305
  style,
2306
+ barsStyleStr,
2299
2307
  rh,
2300
2308
  rw,
2301
2309
  ry,
2302
2310
  rx,
2303
- barsStyleStr,
2304
2311
  xLim,
2305
2312
  yLim,
2306
2313
  axesWidth,
package/dist/index.mjs CHANGED
@@ -2052,7 +2052,7 @@ function get_each_context$3(ctx, list, i) {
2052
2052
  return child_ctx;
2053
2053
  }
2054
2054
 
2055
- // (53:0) {#if rx !== undefined && ry !== undefined}
2055
+ // (55:0) {#if rx !== undefined && ry !== undefined}
2056
2056
  function create_if_block$6(ctx) {
2057
2057
  let g;
2058
2058
  let g_class_value;
@@ -2073,7 +2073,7 @@ function create_if_block$6(ctx) {
2073
2073
 
2074
2074
  attr(g, "class", g_class_value = "series " + /*style*/ ctx[2]);
2075
2075
  attr(g, "title", /*title*/ ctx[1]);
2076
- attr(g, "style", /*barsStyleStr*/ ctx[7]);
2076
+ attr(g, "style", /*barsStyleStr*/ ctx[3]);
2077
2077
  },
2078
2078
  m(target, anchor) {
2079
2079
  insert(target, g, anchor);
@@ -2083,7 +2083,7 @@ function create_if_block$6(ctx) {
2083
2083
  }
2084
2084
  },
2085
2085
  p(ctx, dirty) {
2086
- if (dirty & /*rx, ry, rw, rh, left*/ 121) {
2086
+ if (dirty & /*rx, ry, rw, rh, left*/ 241) {
2087
2087
  each_value = /*left*/ ctx[0];
2088
2088
  let i;
2089
2089
 
@@ -2113,6 +2113,10 @@ function create_if_block$6(ctx) {
2113
2113
  if (dirty & /*title*/ 2) {
2114
2114
  attr(g, "title", /*title*/ ctx[1]);
2115
2115
  }
2116
+
2117
+ if (dirty & /*barsStyleStr*/ 8) {
2118
+ attr(g, "style", /*barsStyleStr*/ ctx[3]);
2119
+ }
2116
2120
  },
2117
2121
  d(detaching) {
2118
2122
  if (detaching) detach(g);
@@ -2121,7 +2125,7 @@ function create_if_block$6(ctx) {
2121
2125
  };
2122
2126
  }
2123
2127
 
2124
- // (55:3) {#each left as v, i}
2128
+ // (57:3) {#each left as v, i}
2125
2129
  function create_each_block$3(ctx) {
2126
2130
  let rect;
2127
2131
  let rect_x_value;
@@ -2132,28 +2136,28 @@ function create_each_block$3(ctx) {
2132
2136
  return {
2133
2137
  c() {
2134
2138
  rect = svg_element("rect");
2135
- attr(rect, "x", rect_x_value = /*rx*/ ctx[6][/*i*/ ctx[27]]);
2136
- attr(rect, "y", rect_y_value = /*ry*/ ctx[5][/*i*/ ctx[27]]);
2137
- attr(rect, "width", rect_width_value = /*rw*/ ctx[4][/*i*/ ctx[27]]);
2138
- attr(rect, "height", rect_height_value = /*rh*/ ctx[3][/*i*/ ctx[27]]);
2139
+ attr(rect, "x", rect_x_value = /*rx*/ ctx[7][/*i*/ ctx[27]]);
2140
+ attr(rect, "y", rect_y_value = /*ry*/ ctx[6][/*i*/ ctx[27]]);
2141
+ attr(rect, "width", rect_width_value = /*rw*/ ctx[5][/*i*/ ctx[27]]);
2142
+ attr(rect, "height", rect_height_value = /*rh*/ ctx[4][/*i*/ ctx[27]]);
2139
2143
  },
2140
2144
  m(target, anchor) {
2141
2145
  insert(target, rect, anchor);
2142
2146
  },
2143
2147
  p(ctx, dirty) {
2144
- if (dirty & /*rx*/ 64 && rect_x_value !== (rect_x_value = /*rx*/ ctx[6][/*i*/ ctx[27]])) {
2148
+ if (dirty & /*rx*/ 128 && rect_x_value !== (rect_x_value = /*rx*/ ctx[7][/*i*/ ctx[27]])) {
2145
2149
  attr(rect, "x", rect_x_value);
2146
2150
  }
2147
2151
 
2148
- if (dirty & /*ry*/ 32 && rect_y_value !== (rect_y_value = /*ry*/ ctx[5][/*i*/ ctx[27]])) {
2152
+ if (dirty & /*ry*/ 64 && rect_y_value !== (rect_y_value = /*ry*/ ctx[6][/*i*/ ctx[27]])) {
2149
2153
  attr(rect, "y", rect_y_value);
2150
2154
  }
2151
2155
 
2152
- if (dirty & /*rw*/ 16 && rect_width_value !== (rect_width_value = /*rw*/ ctx[4][/*i*/ ctx[27]])) {
2156
+ if (dirty & /*rw*/ 32 && rect_width_value !== (rect_width_value = /*rw*/ ctx[5][/*i*/ ctx[27]])) {
2153
2157
  attr(rect, "width", rect_width_value);
2154
2158
  }
2155
2159
 
2156
- if (dirty & /*rh*/ 8 && rect_height_value !== (rect_height_value = /*rh*/ ctx[3][/*i*/ ctx[27]])) {
2160
+ if (dirty & /*rh*/ 16 && rect_height_value !== (rect_height_value = /*rh*/ ctx[4][/*i*/ ctx[27]])) {
2157
2161
  attr(rect, "height", rect_height_value);
2158
2162
  }
2159
2163
  },
@@ -2165,7 +2169,7 @@ function create_each_block$3(ctx) {
2165
2169
 
2166
2170
  function create_fragment$8(ctx) {
2167
2171
  let if_block_anchor;
2168
- let if_block = /*rx*/ ctx[6] !== undefined && /*ry*/ ctx[5] !== undefined && create_if_block$6(ctx);
2172
+ let if_block = /*rx*/ ctx[7] !== undefined && /*ry*/ ctx[6] !== undefined && create_if_block$6(ctx);
2169
2173
 
2170
2174
  return {
2171
2175
  c() {
@@ -2177,7 +2181,7 @@ function create_fragment$8(ctx) {
2177
2181
  insert(target, if_block_anchor, anchor);
2178
2182
  },
2179
2183
  p(ctx, [dirty]) {
2180
- if (/*rx*/ ctx[6] !== undefined && /*ry*/ ctx[5] !== undefined) {
2184
+ if (/*rx*/ ctx[7] !== undefined && /*ry*/ ctx[6] !== undefined) {
2181
2185
  if (if_block) {
2182
2186
  if_block.p(ctx, dirty);
2183
2187
  } else {
@@ -2204,6 +2208,7 @@ function instance$8($$self, $$props, $$invalidate) {
2204
2208
  let ry;
2205
2209
  let rw;
2206
2210
  let rh;
2211
+ let barsStyleStr;
2207
2212
  let $axesHeight;
2208
2213
  let $yLim;
2209
2214
  let $axesWidth;
@@ -2219,9 +2224,6 @@ function instance$8($$self, $$props, $$invalidate) {
2219
2224
  let { title = "" } = $$props;
2220
2225
  let { style = "series_rect" } = $$props;
2221
2226
 
2222
- // styles for bars and labels
2223
- const barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`;
2224
-
2225
2227
  // multiply width and height values if needed
2226
2228
  if (!Array.isArray(left) || !Array.isArray(top) || left.length < 1 || left.length != top.length) {
2227
2229
  throw "Rectangles: parameters 'left' and 'top' must be vectors of the same size.";
@@ -2270,19 +2272,24 @@ function instance$8($$self, $$props, $$invalidate) {
2270
2272
  $$self.$$.update = () => {
2271
2273
  if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/ 6291457) {
2272
2274
  // reactive variables for coordinates of data points in pixels
2273
- $$invalidate(6, rx = axes.scaleX(left, $xLim, $axesWidth));
2275
+ $$invalidate(7, rx = axes.scaleX(left, $xLim, $axesWidth));
2274
2276
  }
2275
2277
 
2276
2278
  if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/ 1589248) {
2277
- $$invalidate(5, ry = axes.scaleY(top, $yLim, $axesHeight));
2279
+ $$invalidate(6, ry = axes.scaleY(top, $yLim, $axesHeight));
2278
2280
  }
2279
2281
 
2280
2282
  if ($$self.$$.dirty & /*width, $xLim, $axesWidth*/ 6295552) {
2281
- $$invalidate(4, rw = axes.scaleX(width, $xLim, $axesWidth, true));
2283
+ $$invalidate(5, rw = axes.scaleX(width, $xLim, $axesWidth, true));
2282
2284
  }
2283
2285
 
2284
2286
  if ($$self.$$.dirty & /*height, $yLim, $axesHeight*/ 1581056) {
2285
- $$invalidate(3, rh = axes.scaleY(height, $yLim, $axesHeight, true));
2287
+ $$invalidate(4, rh = axes.scaleY(height, $yLim, $axesHeight, true));
2288
+ }
2289
+
2290
+ if ($$self.$$.dirty & /*faceColor, borderColor, lineWidth*/ 458752) {
2291
+ // styles for bars and labels
2292
+ $$invalidate(3, barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`);
2286
2293
  }
2287
2294
  };
2288
2295
 
@@ -2290,11 +2297,11 @@ function instance$8($$self, $$props, $$invalidate) {
2290
2297
  left,
2291
2298
  title,
2292
2299
  style,
2300
+ barsStyleStr,
2293
2301
  rh,
2294
2302
  rw,
2295
2303
  ry,
2296
2304
  rx,
2297
- barsStyleStr,
2298
2305
  xLim,
2299
2306
  yLim,
2300
2307
  axesWidth,
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "dist"
26
26
  ],
27
27
  "description": "Svelte components for creating simple plots",
28
- "version": "1.0.5",
28
+ "version": "1.0.6",
29
29
  "repository": {
30
30
  "type": "git",
31
31
  "url": "svkucheryavski/svelte-plots-basic"
@@ -14,8 +14,6 @@
14
14
  export let title = "";
15
15
  export let style = "series_rect";
16
16
 
17
- // styles for bars and labels
18
- const barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`;
19
17
 
20
18
  // multiply width and height values if needed
21
19
  if (!Array.isArray(left) || !Array.isArray(top) || left.length < 1 || left.length != top.length) {
@@ -48,6 +46,10 @@
48
46
  $: ry = axes.scaleY(top, $yLim, $axesHeight);
49
47
  $: rw = axes.scaleX(width, $xLim, $axesWidth, true);
50
48
  $: rh = axes.scaleY(height, $yLim, $axesHeight, true);
49
+
50
+ // styles for bars and labels
51
+ $: barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`;
52
+
51
53
  </script>
52
54
 
53
55
  {#if rx !== undefined && ry !== undefined}