@code-hike/smooth-lines
Advanced tools
Comparing version 0.0.0-01f6c70 to 0.0.0-133ab88
@@ -109,2 +109,3 @@ 'use strict'; | ||
exitIndex: !nextLine ? exitIndex++ : null, | ||
elementWithProgress: (prevLine === null || prevLine === void 0 ? void 0 : prevLine.elementWithProgress) || (nextLine === null || nextLine === void 0 ? void 0 : nextLine.elementWithProgress), | ||
}; | ||
@@ -114,3 +115,2 @@ }); | ||
var exitCount = exitIndex; | ||
// console.log({ linesData }) | ||
return linesData.map(function (lineData) { | ||
@@ -121,3 +121,3 @@ return getLineTransition(lineData, enterCount, exitCount); | ||
function getLineTransition(_a, enterCount, exitCount) { | ||
var element = _a.element, key = _a.key, prevIndex = _a.prevIndex, nextIndex = _a.nextIndex, enterIndex = _a.enterIndex, exitIndex = _a.exitIndex; | ||
var element = _a.element, key = _a.key, prevIndex = _a.prevIndex, nextIndex = _a.nextIndex, enterIndex = _a.enterIndex, exitIndex = _a.exitIndex, elementWithProgress = _a.elementWithProgress; | ||
// startY is the progress when we start moving vertically | ||
@@ -130,2 +130,3 @@ // endY is when we stop | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -145,2 +146,3 @@ tweenY: { fixed: true, value: nextIndex }, | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -158,2 +160,3 @@ tweenY: { fixed: true, value: prevIndex }, | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -234,3 +237,3 @@ tweenY: { | ||
} }, lines.map(function (_a) { | ||
var element = _a.element, key = _a.key, tweenX = _a.tweenX, tweenY = _a.tweenY; | ||
var element = _a.element, key = _a.key, tweenX = _a.tweenX, tweenY = _a.tweenY, elementWithProgress = _a.elementWithProgress; | ||
var dx = tween(tweenX, progress); | ||
@@ -257,3 +260,6 @@ var dy = tween(tweenY, progress); | ||
opacity: opacity, | ||
} }, element)); | ||
width: lw, | ||
} }, elementWithProgress | ||
? elementWithProgress(progress) | ||
: element)); | ||
})))); | ||
@@ -260,0 +266,0 @@ } |
@@ -101,2 +101,3 @@ import React, { useMemo } from 'react'; | ||
exitIndex: !nextLine ? exitIndex++ : null, | ||
elementWithProgress: (prevLine === null || prevLine === void 0 ? void 0 : prevLine.elementWithProgress) || (nextLine === null || nextLine === void 0 ? void 0 : nextLine.elementWithProgress), | ||
}; | ||
@@ -106,3 +107,2 @@ }); | ||
var exitCount = exitIndex; | ||
// console.log({ linesData }) | ||
return linesData.map(function (lineData) { | ||
@@ -113,3 +113,3 @@ return getLineTransition(lineData, enterCount, exitCount); | ||
function getLineTransition(_a, enterCount, exitCount) { | ||
var element = _a.element, key = _a.key, prevIndex = _a.prevIndex, nextIndex = _a.nextIndex, enterIndex = _a.enterIndex, exitIndex = _a.exitIndex; | ||
var element = _a.element, key = _a.key, prevIndex = _a.prevIndex, nextIndex = _a.nextIndex, enterIndex = _a.enterIndex, exitIndex = _a.exitIndex, elementWithProgress = _a.elementWithProgress; | ||
// startY is the progress when we start moving vertically | ||
@@ -122,2 +122,3 @@ // endY is when we stop | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -137,2 +138,3 @@ tweenY: { fixed: true, value: nextIndex }, | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -150,2 +152,3 @@ tweenY: { fixed: true, value: prevIndex }, | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -226,3 +229,3 @@ tweenY: { | ||
} }, lines.map(function (_a) { | ||
var element = _a.element, key = _a.key, tweenX = _a.tweenX, tweenY = _a.tweenY; | ||
var element = _a.element, key = _a.key, tweenX = _a.tweenX, tweenY = _a.tweenY, elementWithProgress = _a.elementWithProgress; | ||
var dx = tween(tweenX, progress); | ||
@@ -249,3 +252,6 @@ var dy = tween(tweenY, progress); | ||
opacity: opacity, | ||
} }, element)); | ||
width: lw, | ||
} }, elementWithProgress | ||
? elementWithProgress(progress) | ||
: element)); | ||
})))); | ||
@@ -252,0 +258,0 @@ } |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.foo = {}, global.React)); | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ch = {}, global.React)); | ||
}(this, (function (exports, React) { 'use strict'; | ||
@@ -109,2 +109,3 @@ | ||
exitIndex: !nextLine ? exitIndex++ : null, | ||
elementWithProgress: (prevLine === null || prevLine === void 0 ? void 0 : prevLine.elementWithProgress) || (nextLine === null || nextLine === void 0 ? void 0 : nextLine.elementWithProgress), | ||
}; | ||
@@ -114,3 +115,2 @@ }); | ||
var exitCount = exitIndex; | ||
// console.log({ linesData }) | ||
return linesData.map(function (lineData) { | ||
@@ -121,3 +121,3 @@ return getLineTransition(lineData, enterCount, exitCount); | ||
function getLineTransition(_a, enterCount, exitCount) { | ||
var element = _a.element, key = _a.key, prevIndex = _a.prevIndex, nextIndex = _a.nextIndex, enterIndex = _a.enterIndex, exitIndex = _a.exitIndex; | ||
var element = _a.element, key = _a.key, prevIndex = _a.prevIndex, nextIndex = _a.nextIndex, enterIndex = _a.enterIndex, exitIndex = _a.exitIndex, elementWithProgress = _a.elementWithProgress; | ||
// startY is the progress when we start moving vertically | ||
@@ -130,2 +130,3 @@ // endY is when we stop | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -145,2 +146,3 @@ tweenY: { fixed: true, value: nextIndex }, | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -158,2 +160,3 @@ tweenY: { fixed: true, value: prevIndex }, | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -234,3 +237,3 @@ tweenY: { | ||
} }, lines.map(function (_a) { | ||
var element = _a.element, key = _a.key, tweenX = _a.tweenX, tweenY = _a.tweenY; | ||
var element = _a.element, key = _a.key, tweenX = _a.tweenX, tweenY = _a.tweenY, elementWithProgress = _a.elementWithProgress; | ||
var dx = tween(tweenX, progress); | ||
@@ -257,3 +260,6 @@ var dy = tween(tweenY, progress); | ||
opacity: opacity, | ||
} }, element)); | ||
width: lw, | ||
} }, elementWithProgress | ||
? elementWithProgress(progress) | ||
: element)); | ||
})))); | ||
@@ -260,0 +266,0 @@ } |
@@ -7,2 +7,3 @@ /// <reference types="react" /> | ||
element: Element; | ||
elementWithProgress?: (progress: number) => Element; | ||
key: Key; | ||
@@ -12,2 +13,3 @@ }; | ||
element: React.ReactNode; | ||
elementWithProgress?: (progress: number) => Element; | ||
key: number; | ||
@@ -14,0 +16,0 @@ tweenY: TweenParams; |
{ | ||
"name": "@code-hike/smooth-lines", | ||
"version": "0.0.0-01f6c70", | ||
"version": "0.0.0-133ab88", | ||
"main": "dist/index.js", | ||
@@ -27,2 +27,3 @@ "typings": "dist/index.d.ts", | ||
"repository": "code-hike/codehike", | ||
"author": "Rodrigo Pombo", | ||
"license": "MIT", | ||
@@ -29,0 +30,0 @@ "funding": { |
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
35182
799
1