@pixodesk/svg-animator-web 1.0.21 → 1.0.22
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.cjs +60 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +60 -9
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.umd.js +60 -9
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -742,6 +742,7 @@ var PxAnimatorConfigSchema = implementsInterface()(px.object({
|
|
|
742
742
|
resetOnFinish: px.boolean().optional(),
|
|
743
743
|
definitions: PxDefsSchema.optional(),
|
|
744
744
|
animate: px.record(PxElementAnimationSchema).optional(),
|
|
745
|
+
timeline: px.string().optional(),
|
|
745
746
|
debug: px.boolean().optional(),
|
|
746
747
|
debugInstName: px.string().optional()
|
|
747
748
|
}));
|
|
@@ -833,6 +834,17 @@ var PxAnimatableGradientStopsSchema = px.union([
|
|
|
833
834
|
px.object({ value: px.array(PxGradientStopSchema) }),
|
|
834
835
|
px.object({ keyframes: px.array(PxKeyframeSchema) })
|
|
835
836
|
]);
|
|
837
|
+
var PxGradientGeometryAnimationSchema = implementsInterface()(px.object({
|
|
838
|
+
gradientX1: PxPropertyAnimationSchema.optional(),
|
|
839
|
+
gradientY1: PxPropertyAnimationSchema.optional(),
|
|
840
|
+
gradientX2: PxPropertyAnimationSchema.optional(),
|
|
841
|
+
gradientY2: PxPropertyAnimationSchema.optional(),
|
|
842
|
+
gradientCx: PxPropertyAnimationSchema.optional(),
|
|
843
|
+
gradientCy: PxPropertyAnimationSchema.optional(),
|
|
844
|
+
gradientFx: PxPropertyAnimationSchema.optional(),
|
|
845
|
+
gradientFy: PxPropertyAnimationSchema.optional(),
|
|
846
|
+
gradientR: PxPropertyAnimationSchema.optional()
|
|
847
|
+
}));
|
|
836
848
|
var PxFillGradientEffectSchema = implementsInterface()(px.object({
|
|
837
849
|
type: px.enum([PxGradientType.linear, PxGradientType.radial]),
|
|
838
850
|
p1: px.tuple([px.number(), px.number()]).optional(),
|
|
@@ -843,7 +855,8 @@ var PxFillGradientEffectSchema = implementsInterface()(px.object({
|
|
|
843
855
|
stops: PxAnimatableGradientStopsSchema.optional(),
|
|
844
856
|
gradientUnits: px.string().optional(),
|
|
845
857
|
spreadMethod: px.string().optional(),
|
|
846
|
-
gradientTransform: px.string().optional()
|
|
858
|
+
gradientTransform: px.string().optional(),
|
|
859
|
+
animate: PxGradientGeometryAnimationSchema.optional()
|
|
847
860
|
}));
|
|
848
861
|
var PxStrokeGradientEffectSchema = PxFillGradientEffectSchema;
|
|
849
862
|
var PxTextPathEffectSchema = implementsInterface()(px.object({
|
|
@@ -2840,6 +2853,7 @@ function partsRecord(part, value, origin) {
|
|
|
2840
2853
|
return rec;
|
|
2841
2854
|
}
|
|
2842
2855
|
function readAnimatable(raw) {
|
|
2856
|
+
var _a, _b;
|
|
2843
2857
|
if (raw === void 0) return {
|
|
2844
2858
|
kind: "absent"
|
|
2845
2859
|
/* Absent */
|
|
@@ -2847,13 +2861,29 @@ function readAnimatable(raw) {
|
|
|
2847
2861
|
if (Array.isArray(raw)) return { kind: "static", value: raw };
|
|
2848
2862
|
if (typeof raw === "object") {
|
|
2849
2863
|
const obj = raw;
|
|
2850
|
-
|
|
2851
|
-
|
|
2864
|
+
const kfs = (_a = obj.keyframes) != null ? _a : obj.kfs;
|
|
2865
|
+
if (kfs) {
|
|
2866
|
+
return { kind: "animated", keyframes: kfs.map(normaliseKeyframe), autoOrient: obj.autoOrient, loop: obj.loop };
|
|
2852
2867
|
}
|
|
2853
|
-
|
|
2868
|
+
const staticValue = (_b = obj.value) != null ? _b : obj.v;
|
|
2869
|
+
if (staticValue !== void 0) return { kind: "static", value: staticValue };
|
|
2854
2870
|
}
|
|
2855
2871
|
return { kind: "static", value: raw };
|
|
2856
2872
|
}
|
|
2873
|
+
function normaliseKeyframe(kf) {
|
|
2874
|
+
if (!kf || typeof kf !== "object") return kf;
|
|
2875
|
+
const k = kf;
|
|
2876
|
+
if (k.t === void 0 && k.v === void 0 && k.e === void 0 && k.to === void 0 && k.ti === void 0) {
|
|
2877
|
+
return kf;
|
|
2878
|
+
}
|
|
2879
|
+
const out = __spreadValues2({}, k);
|
|
2880
|
+
if (out.time === void 0 && k.t !== void 0) out.time = k.t;
|
|
2881
|
+
if (out.value === void 0 && k.v !== void 0) out.value = k.v;
|
|
2882
|
+
if (out.easing === void 0 && k.e !== void 0) out.easing = k.e;
|
|
2883
|
+
if (out.tangentOut === void 0 && k.to !== void 0) out.tangentOut = k.to;
|
|
2884
|
+
if (out.tangentIn === void 0 && k.ti !== void 0) out.tangentIn = k.ti;
|
|
2885
|
+
return out;
|
|
2886
|
+
}
|
|
2857
2887
|
function readStaticOrigin(raw, ctx) {
|
|
2858
2888
|
var _a;
|
|
2859
2889
|
const o = readAnimatable(raw);
|
|
@@ -5806,8 +5836,14 @@ function setupAnimationTriggers(api, config) {
|
|
|
5806
5836
|
break;
|
|
5807
5837
|
}
|
|
5808
5838
|
case "mouseOver": {
|
|
5809
|
-
|
|
5810
|
-
const
|
|
5839
|
+
let enteredOnce = false;
|
|
5840
|
+
const mouseOverHandler = () => {
|
|
5841
|
+
enteredOnce = true;
|
|
5842
|
+
start();
|
|
5843
|
+
};
|
|
5844
|
+
const mouseOutHandler = () => {
|
|
5845
|
+
if (enteredOnce) handleEndAction();
|
|
5846
|
+
};
|
|
5811
5847
|
root.addEventListener("mouseenter", mouseOverHandler);
|
|
5812
5848
|
root.addEventListener("mouseleave", mouseOutHandler);
|
|
5813
5849
|
break;
|
|
@@ -5824,17 +5860,32 @@ function setupAnimationTriggers(api, config) {
|
|
|
5824
5860
|
break;
|
|
5825
5861
|
}
|
|
5826
5862
|
case "scrollIntoView": {
|
|
5863
|
+
const effectiveRatio = (entry) => {
|
|
5864
|
+
var _a, _b;
|
|
5865
|
+
const target = entry.boundingClientRect;
|
|
5866
|
+
const visible = entry.intersectionRect;
|
|
5867
|
+
if (!(target == null ? void 0 : target.height) || !visible) return entry.intersectionRatio;
|
|
5868
|
+
const live = typeof window !== "undefined" && window.innerHeight ? window.innerHeight : Infinity;
|
|
5869
|
+
const declared = (_b = (_a = entry.rootBounds) == null ? void 0 : _a.height) != null ? _b : Infinity;
|
|
5870
|
+
const viewport = Math.min(live, declared);
|
|
5871
|
+
const denom = Math.min(target.height, Number.isFinite(viewport) ? viewport : target.height);
|
|
5872
|
+
return denom > 0 ? visible.height / denom : entry.intersectionRatio;
|
|
5873
|
+
};
|
|
5874
|
+
const thresholdSteps = Array.from({ length: 21 }, (_, i) => i / 20);
|
|
5875
|
+
let wasIntersecting = false;
|
|
5827
5876
|
const observer = new IntersectionObserver(
|
|
5828
5877
|
(entries) => {
|
|
5829
5878
|
entries.forEach((entry) => {
|
|
5830
|
-
if (entry.isIntersecting && entry
|
|
5879
|
+
if (entry.isIntersecting && effectiveRatio(entry) >= scrollIntoViewThreshold) {
|
|
5880
|
+
wasIntersecting = true;
|
|
5831
5881
|
start();
|
|
5832
|
-
} else {
|
|
5882
|
+
} else if (wasIntersecting) {
|
|
5883
|
+
wasIntersecting = false;
|
|
5833
5884
|
handleEndAction();
|
|
5834
5885
|
}
|
|
5835
5886
|
});
|
|
5836
5887
|
},
|
|
5837
|
-
{ threshold:
|
|
5888
|
+
{ threshold: thresholdSteps }
|
|
5838
5889
|
);
|
|
5839
5890
|
observer.observe(root);
|
|
5840
5891
|
break;
|