funnel-gfx-wc 0.1.37 → 0.1.39

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.
@@ -1,57 +1,40 @@
1
1
  import { h } from "@stencil/core";
2
- import { funnelDefs, colorFor, ColorPlugin, } from "../../utils";
3
- import Between from "between.js";
4
- Between._plugins.color = ColorPlugin;
2
+ import { animate } from "animejs";
3
+ import { funnelDefs, colorFor } from "../../utils";
5
4
  let barHeight = [];
6
5
  let barRefs = undefined;
7
6
  const bgdFill = colorFor('white');
8
7
  const xFill = colorFor('bada55');
9
- let lastHex = '#bada55';
10
8
  let tween = undefined;
11
- let lastVal = [0, 0, 0, 0, 0];
12
9
  let tween2 = [undefined, undefined, undefined, undefined, undefined];
13
10
  const processColor = (next) => {
14
11
  if (!barRefs)
15
12
  return;
16
- const hex1 = lastHex;
17
13
  const hex2 = colorFor(next);
18
14
  // IMPORTANT: we are tweening between the hex values, not the names...
19
- if (hex1 !== null && hex1 !== hex2) {
20
- if (tween) {
21
- tween.pause();
22
- }
23
- tween = new Between(hex1, hex2)
24
- .time(1000)
25
- .easing(Between.Easing.Cubic.InOut)
26
- .on('update', (v) => {
27
- barRefs.forEach(bar => {
28
- bar.setAttribute('fill', `${v}`);
29
- });
30
- lastHex = v;
31
- });
15
+ if (tween) {
16
+ tween.pause();
32
17
  }
18
+ tween = animate(barRefs, {
19
+ fill: hex2,
20
+ ease: 'inOutCubic',
21
+ });
33
22
  };
34
23
  const processValues = (next) => {
35
24
  if (!barRefs)
36
25
  return;
37
26
  barRefs.forEach((bar, index) => {
38
27
  const height = barHeight[index];
39
- const last = lastVal[index];
40
28
  const value = next[index];
41
- if (last !== null && last !== value) {
42
- if (tween2[index]) {
43
- tween2[index].pause();
44
- }
45
- // NOTE: next & last are values between 0-100 (aka. percentage)
46
- tween2[index] = new Between(last, value)
47
- .time(1000)
48
- .easing(Between.Easing.Cubic.InOut)
49
- .on('update', (v) => {
50
- const y = height * ((100 - v) / 100);
51
- bar.setAttribute('y', `${y}`);
52
- lastVal[index] = v;
53
- });
29
+ if (tween2[index]) {
30
+ tween2[index].pause();
54
31
  }
32
+ // NOTE: next & last are values between 0-100 (aka. percentage)
33
+ const y = height * ((100 - value) / 100);
34
+ tween2[index] = animate(bar, {
35
+ y: y,
36
+ ease: 'inOutCubic',
37
+ });
55
38
  });
56
39
  };
57
40
  const createFunnel = ({ id, height, width, x, y, drop }) => {
@@ -1,4 +1,4 @@
1
- /*! tailwindcss v4.1.4 | MIT License | https://tailwindcss.com */
1
+ /*! tailwindcss v4.1.5 | MIT License | https://tailwindcss.com */
2
2
  @layer properties;
3
3
  @layer theme, base, components, utilities;
4
4
  @layer theme {
@@ -1,4 +1,4 @@
1
- /*! tailwindcss v4.1.4 | MIT License | https://tailwindcss.com */
1
+ /*! tailwindcss v4.1.5 | MIT License | https://tailwindcss.com */
2
2
  @layer properties;
3
3
  @layer theme, base, components, utilities;
4
4
  @layer theme {
@@ -1,4 +1,3 @@
1
- export * from './color-plugin';
2
1
  export * from './funnel-defs';
3
2
  export * from './named-colors';
4
3
  export * from './store';
@@ -1,4 +1,4 @@
1
1
  // WARNING: generated file...
2
- const TW_VERSION = '4.1.4';
2
+ const TW_VERSION = '4.1.5';
3
3
  export { TW_VERSION };
4
4
  export default TW_VERSION;