@tarsis/toolkit 0.5.0 → 0.5.1

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.
@@ -46,17 +46,22 @@ function getPath(x, smoothing) {
46
46
  length: Math.sqrt(Math.pow(n[0] - p[0], 2) + Math.pow(n[1] - p[1], 2)),
47
47
  angle: Math.atan2(n[1] - p[1], n[0] - p[0])
48
48
  };
49
- const angle = o.angle + (0);
49
+ const angle = o.angle + (reverse ? Math.PI : 0);
50
50
  const length = o.length * smoothing;
51
51
  return [
52
52
  current[0] + Math.cos(angle) * length,
53
53
  current[1] + Math.sin(angle) * length
54
54
  ];
55
55
  };
56
- return points.reduce(
57
- (acc, point, i, a) => i === 0 ? `M ${point[0]},${point[1]}` : `${acc} ${calculateControlPoint(a[i - 1], a[i - 2], point)}`,
58
- ""
59
- );
56
+ return points.reduce((acc, point, i, a) => {
57
+ if (i === 0) {
58
+ return `M ${point[0]},${point[1]}`;
59
+ }
60
+ const previous = a[i - 1];
61
+ const cp1 = calculateControlPoint(previous, a[i - 2], point, false);
62
+ const cp2 = calculateControlPoint(point, previous, a[i + 1], true);
63
+ return `${acc} C ${cp1[0]},${cp1[1]} ${cp2[0]},${cp2[1]} ${point[0]},${point[1]}`;
64
+ }, "");
60
65
  }
61
66
 
62
67
  exports.chain = chain;
@@ -44,17 +44,22 @@ function getPath(x, smoothing) {
44
44
  length: Math.sqrt(Math.pow(n[0] - p[0], 2) + Math.pow(n[1] - p[1], 2)),
45
45
  angle: Math.atan2(n[1] - p[1], n[0] - p[0])
46
46
  };
47
- const angle = o.angle + (0);
47
+ const angle = o.angle + (reverse ? Math.PI : 0);
48
48
  const length = o.length * smoothing;
49
49
  return [
50
50
  current[0] + Math.cos(angle) * length,
51
51
  current[1] + Math.sin(angle) * length
52
52
  ];
53
53
  };
54
- return points.reduce(
55
- (acc, point, i, a) => i === 0 ? `M ${point[0]},${point[1]}` : `${acc} ${calculateControlPoint(a[i - 1], a[i - 2], point)}`,
56
- ""
57
- );
54
+ return points.reduce((acc, point, i, a) => {
55
+ if (i === 0) {
56
+ return `M ${point[0]},${point[1]}`;
57
+ }
58
+ const previous = a[i - 1];
59
+ const cp1 = calculateControlPoint(previous, a[i - 2], point, false);
60
+ const cp2 = calculateControlPoint(point, previous, a[i + 1], true);
61
+ return `${acc} C ${cp1[0]},${cp1[1]} ${cp2[0]},${cp2[1]} ${point[0]},${point[1]}`;
62
+ }, "");
58
63
  }
59
64
 
60
65
  export { lerp as a, delay as b, chain as c, distance as d, getPath as g, lineEq as l, wait as w };
package/dist/utils.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const svg = require('./svg-6fNe-PW5.cjs');
5
+ const svg = require('./svg-Bi5ULzxB.cjs');
6
6
  const server = require('./server.cjs');
7
7
 
8
8
 
package/dist/utils.js CHANGED
@@ -1,2 +1,2 @@
1
- export { c as chain, b as delay, d as distance, g as getPath, a as lerp, l as lineEq, w as wait } from './svg-C0Ykxk94.js';
1
+ export { c as chain, b as delay, d as distance, g as getPath, a as lerp, l as lineEq, w as wait } from './svg-CoSCBw2u.js';
2
2
  export { BaseLogger, animationLogger, apiLogger, clearSession, componentLogger, eventLogger, getCurrentLogLevel, hookLogger, is, isDebugEnabled, isNonNullable, keys, logger, move, noop, notReachable, setLogLevel, setRequestId, setSessionId, storageLogger, times, utilsLogger, values } from './server.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarsis/toolkit",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },