layerchart 0.38.3 → 0.38.5

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.
@@ -22,7 +22,7 @@ export let rule = false;
22
22
  /** Draw a grid lines */
23
23
  export let grid = false;
24
24
  /** Control the number of ticks*/
25
- export let ticks = placement === 'left' || placement === 'right' ? 4 : undefined;
25
+ export let ticks = undefined;
26
26
  /** Length of the tick line */
27
27
  export let tickLength = 4;
28
28
  /** Format tick labels */
@@ -50,8 +50,10 @@ $: tickVals = Array.isArray(ticks)
50
50
  : typeof ticks === 'function'
51
51
  ? ticks(_scale)
52
52
  : isScaleBand(_scale)
53
- ? _scale.domain()
54
- : _scale.ticks(ticks);
53
+ ? ticks
54
+ ? _scale.domain().filter((v, i) => i % ticks === 0)
55
+ : _scale.domain()
56
+ : _scale.ticks(ticks ?? (placement === 'left' || placement === 'right' ? 4 : undefined));
55
57
  function getCoords(tick) {
56
58
  switch (placement) {
57
59
  case 'top':
@@ -24,6 +24,8 @@ export let tooltip = undefined;
24
24
  * @type {CurveFactory | CurveFactoryLineOnly | undefined}
25
25
  */
26
26
  export let curve = curveLinearClosed;
27
+ let className = undefined;
28
+ export { className as class };
27
29
  const dispatch = createEventDispatcher();
28
30
  const { width, height } = getContext('LayerCake');
29
31
  const canvas = getContext('canvas');
@@ -35,8 +37,8 @@ $: ctx = canvas?.ctx;
35
37
  $: if (renderContext === 'canvas' && $ctx) {
36
38
  let computedStyles = {};
37
39
  // Transfer classes defined on <GeoPath> to <canvas> to enable window.getComputedStyle() retrieval (Tailwind classes, etc)
38
- if ($$props.class) {
39
- $ctx.canvas.classList.add(...$$props.class.split(' '));
40
+ if (className) {
41
+ $ctx.canvas.classList.add(...className.split(' '));
40
42
  computedStyles = window.getComputedStyle($ctx.canvas);
41
43
  }
42
44
  // console.count('render');
@@ -79,7 +81,7 @@ $: if (renderContext === 'canvas' && $ctx) {
79
81
  on:pointerleave
80
82
  on:click={(event) => dispatch('click', { geoPath, event })}
81
83
  on:click
82
- class={cls($$props.fill == null && 'fill-transparent', $$props.class)}
84
+ class={cls(fill == null && 'fill-transparent', className)}
83
85
  />
84
86
  </slot>
85
87
  {/if}
@@ -12,6 +12,7 @@ declare const __propDef: {
12
12
  strokeWidth?: number | string | undefined;
13
13
  tooltip?: TooltipContextValue | undefined;
14
14
  curve?: CurveFactory | CurveFactoryLineOnly | undefined;
15
+ class?: string | undefined;
15
16
  };
16
17
  events: {
17
18
  pointerenter: PointerEvent;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "Sean Lynch <techniq35@gmail.com>",
5
5
  "license": "MIT",
6
6
  "repository": "techniq/layerchart",
7
- "version": "0.38.3",
7
+ "version": "0.38.5",
8
8
  "devDependencies": {
9
9
  "@changesets/cli": "^2.27.5",
10
10
  "@mdi/js": "^7.4.47",