layerchart 0.40.3 → 0.41.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.
@@ -20,6 +20,8 @@ export let lines = false;
20
20
  export let area = false;
21
21
  /** Show bar and pass props to Rect */
22
22
  export let bar = false;
23
+ /** Set to false to disable spring transitions */
24
+ export let motion = true;
23
25
  // TODO: Fix circle points being backwards for stack (see AreaStack)
24
26
  let _points = [];
25
27
  let _lines = [];
@@ -167,7 +169,7 @@ $: if (highlightData) {
167
169
  {#if area}
168
170
  <slot name="area" area={_area}>
169
171
  <Rect
170
- spring
172
+ spring={motion}
171
173
  {..._area}
172
174
  {...typeof area === 'object' ? area : null}
173
175
  class={cls(
@@ -182,7 +184,7 @@ $: if (highlightData) {
182
184
  {#if bar}
183
185
  <slot name="bar" {bar}>
184
186
  <Bar
185
- spring
187
+ spring={motion}
186
188
  x={typeof bar === 'object' ? bar.x : null}
187
189
  y={typeof bar === 'object' ? bar.y : null}
188
190
  inset={typeof bar === 'object' ? bar.inset : null}
@@ -200,7 +202,7 @@ $: if (highlightData) {
200
202
  <slot name="lines" lines={_lines}>
201
203
  {#each _lines as line}
202
204
  <Line
203
- spring
205
+ spring={motion}
204
206
  x1={line.x1}
205
207
  y1={line.y1}
206
208
  x2={line.x2}
@@ -221,7 +223,7 @@ $: if (highlightData) {
221
223
  <!-- TODO: Improve color with stacked data -->
222
224
  {@const fill = $config.r ? $rGet(highlightData) : null}
223
225
  <Circle
224
- spring
226
+ spring={motion}
225
227
  cx={point.x}
226
228
  cy={point.y}
227
229
  r={4}
@@ -61,6 +61,7 @@ declare const __propDef: {
61
61
  [prop: string]: import("svelte/motion").TweenedOptions<unknown> | undefined;
62
62
  } | undefined;
63
63
  }> | undefined;
64
+ /** Set to false to disable spring transitions */ motion?: boolean | undefined;
64
65
  };
65
66
  events: {
66
67
  click: MouseEvent;
@@ -1,9 +1,8 @@
1
1
  <script>import { getContext } from 'svelte';
2
- import { spring } from 'svelte/motion';
3
2
  import { fade } from 'svelte/transition';
4
- import { writable } from 'svelte/store';
5
3
  import { cls } from 'svelte-ux';
6
4
  import { tooltipContext } from './TooltipContext.svelte';
5
+ import { motionStore } from '../stores/motionStore.js';
7
6
  /** `x` position of tooltip. By default uses the pointer/mouse, can also snap to data or an explicit fixed position. */
8
7
  export let x = 'pointer';
9
8
  /** `y` position of tooltip. By default uses the pointer/mouse, can also snap to data or an explicit fixed position. */
@@ -14,16 +13,17 @@ export let xOffset = typeof x === 'number' || typeof y === 'number' ? 0 : 10;
14
13
  export let yOffset = typeof x === 'number' || typeof y === 'number' ? 0 : 10;
15
14
  export let anchor = 'top-left';
16
15
  export let contained = 'container'; // TODO: Support 'window' using getBoundingClientRect()
17
- export let animate = true;
18
16
  export let variant = 'default';
17
+ /** Set to `false` to disable spring transitions */
18
+ export let motion = true;
19
19
  export let header = undefined;
20
20
  export let classes = {};
21
21
  const { padding, xGet, yGet, containerWidth, containerHeight } = getContext('LayerCake');
22
22
  const tooltip = tooltipContext();
23
23
  let tooltipWidth = 0;
24
24
  let tooltipHeight = 0;
25
- const xPos = animate ? spring($tooltip.x) : writable($tooltip.x);
26
- const yPos = animate ? spring($tooltip.y) : writable($tooltip.y);
25
+ const xPos = motionStore($tooltip.x, { spring: motion });
26
+ const yPos = motionStore($tooltip.y, { spring: motion });
27
27
  function alignValue(value, align, addlOffset, tooltipSize) {
28
28
  const alignOffset = align === 'center' ? tooltipSize / 2 : align === 'end' ? tooltipSize : 0;
29
29
  return value + (align === 'end' ? -addlOffset : addlOffset) - alignOffset;
@@ -8,8 +8,8 @@ declare const __propDef: {
8
8
  yOffset?: number | undefined;
9
9
  anchor?: ("center" | "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right") | undefined;
10
10
  contained?: false | "container" | undefined;
11
- animate?: boolean | undefined;
12
11
  variant?: "default" | "none" | "invert" | undefined;
12
+ motion?: boolean | undefined;
13
13
  header?: ((data: any) => any) | undefined;
14
14
  classes?: {
15
15
  root?: string | undefined;
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.40.3",
7
+ "version": "0.41.0",
8
8
  "devDependencies": {
9
9
  "@changesets/cli": "^2.27.5",
10
10
  "@mdi/js": "^7.4.47",