@kitlangton/solid-motion 0.2.0 → 0.2.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.
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/server.js +13 -3
- package/dist/server.js.map +1 -1
- package/dist/source/motion/index.jsx +15 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createComponent, Dynamic, mergeProps, getNextElement, use, insert, effect, style, template } from "solid-js/web";
|
|
2
2
|
import { createContext, useContext, splitProps, createSignal, createEffect, createMemo, onMount, onCleanup, mergeProps as mergeProps$1, on, untrack, For, batch, Index, children } from "solid-js";
|
|
3
|
-
import { isControllingVariants, isVariantLabel, SVGVisualElement, HTMLVisualElement, isMotionValue, isForcedMotionValue, buildHTMLStyles, buildSVGAttrs, isSVGTag, resolveMotionValue, isVariantNode, isAnimationControls, resolveVariantFromProps, getFeatureDefinitions, setFeatureDefinitions, Feature, createAnimationState, isPrimaryPointer, addDomEvent, time, frame, frameData, cancelFrame, mixNumber, calcLength, createBox, eachAxis, measurePageBox, convertBoxToBoundingBox, convertBoundingBoxToBox, addValueToWillChange, animateMotionValue, setDragLock, percent, resize, isElementTextInput, hover, press, HTMLProjectionNode, scrapeSVGMotionValuesFromProps, scrapeHTMLMotionValuesFromProps, motionValue, transformValue, transform, mapValue, JSAnimation, resolveElements, defaultOffset, isGenerator, createGeneratorEasing, fillOffset, isSVGElement, isSVGSVGElement, visualElementStore, ObjectVisualElement, animateSingleValue, animateTarget, spring, GroupAnimationWithThen } from "motion-dom";
|
|
3
|
+
import { isControllingVariants, isVariantLabel, SVGVisualElement, HTMLVisualElement, isMotionValue, isForcedMotionValue, buildHTMLStyles, buildSVGAttrs, isSVGTag, resolveMotionValue, isVariantNode, isAnimationControls, resolveVariantFromProps, getFeatureDefinitions, setFeatureDefinitions, Feature, createAnimationState, isPrimaryPointer, addDomEvent, time, frame, frameData, cancelFrame, mixNumber, calcLength, createBox, eachAxis, measurePageBox, convertBoxToBoundingBox, convertBoundingBoxToBox, addValueToWillChange, animateMotionValue, setDragLock, percent, resize, isElementTextInput, hover, press, HTMLProjectionNode, setTarget, scrapeSVGMotionValuesFromProps, scrapeHTMLMotionValuesFromProps, motionValue, transformValue, transform, mapValue, JSAnimation, resolveElements, defaultOffset, isGenerator, createGeneratorEasing, fillOffset, isSVGElement, isSVGSVGElement, visualElementStore, ObjectVisualElement, animateSingleValue, animateTarget, spring, GroupAnimationWithThen } from "motion-dom";
|
|
4
4
|
export * from "motion-dom";
|
|
5
5
|
import { pipe, secondsToMilliseconds, millisecondsToSeconds, progress, clamp, invariant, noop, getEasingForSegment, removeItem } from "motion-utils";
|
|
6
6
|
const defaultContext = {
|
|
@@ -1478,6 +1478,7 @@ function createMotionComponent(Component, {
|
|
|
1478
1478
|
if (!visualElement) return;
|
|
1479
1479
|
visualElement.scheduleRenderMicrotask();
|
|
1480
1480
|
});
|
|
1481
|
+
let mounted = false;
|
|
1481
1482
|
createEffect(() => {
|
|
1482
1483
|
if (!visualElement) return;
|
|
1483
1484
|
const nextProps = getLatestProps();
|
|
@@ -1485,9 +1486,18 @@ function createMotionComponent(Component, {
|
|
|
1485
1486
|
visualElement.update(nextProps, nextPresenceContext);
|
|
1486
1487
|
prepareDragProjection(visualElement, nextProps);
|
|
1487
1488
|
visualElement.updateFeatures();
|
|
1488
|
-
if (visualElement.current
|
|
1489
|
-
|
|
1489
|
+
if (!visualElement.current || !visualElement.animationState) return;
|
|
1490
|
+
if (!mounted) {
|
|
1491
|
+
mounted = true;
|
|
1492
|
+
const {
|
|
1493
|
+
animate: animate2
|
|
1494
|
+
} = nextProps;
|
|
1495
|
+
const blocked = nextProps.initial === false || nextPresenceContext?.initial === false;
|
|
1496
|
+
if (blocked && animate2 && typeof animate2 !== "boolean" && !isAnimationControls(animate2)) {
|
|
1497
|
+
setTarget(visualElement, animate2);
|
|
1498
|
+
}
|
|
1490
1499
|
}
|
|
1500
|
+
visualElement.animationState.animateChanges();
|
|
1491
1501
|
});
|
|
1492
1502
|
onCleanup(() => {
|
|
1493
1503
|
visualElement?.unmount();
|