motion-v 1.0.0-beta.2 → 1.0.0-beta.4

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/cjs/index.js CHANGED
@@ -6687,7 +6687,8 @@ function camelToKebab(str) {
6687
6687
  return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
6688
6688
  }
6689
6689
  function buildSVGPath(attrs, length, spacing = 1, offset = 0) {
6690
- attrs["path-length"] = 1;
6690
+ attrs.pathLength = 1;
6691
+ delete attrs["path-length"];
6691
6692
  attrs["stroke-dashoffset"] = px.transform(-offset);
6692
6693
  const pathLength = px.transform(length);
6693
6694
  const pathSpacing = px.transform(spacing);
@@ -8436,7 +8437,8 @@ class MotionState {
8436
8437
  this.parent = parent;
8437
8438
  (_a = parent == null ? void 0 : parent.children) == null ? void 0 : _a.add(this);
8438
8439
  this.depth = (parent == null ? void 0 : parent.depth) + 1 || 0;
8439
- const initialVariantSource = this.context.initial === false ? ["initial", "animate"] : ["initial"];
8440
+ const initial = options.initial === void 0 && options.variants ? this.context.initial : options.initial;
8441
+ const initialVariantSource = initial === false ? ["initial", "animate"] : ["initial"];
8440
8442
  this.initTarget(initialVariantSource);
8441
8443
  this.featureManager = new FeatureManager(this);
8442
8444
  this.type = isSVGElement(this.options.as) ? "svg" : "html";
@@ -9405,6 +9407,7 @@ function useSpring(source, config = {}) {
9405
9407
  }
9406
9408
  return value;
9407
9409
  }
9410
+ const isSSR = typeof window === "undefined";
9408
9411
  function refWarning(name, ref) {
9409
9412
  heyListen.warning(
9410
9413
  Boolean(!ref || ref.value),
@@ -9430,8 +9433,11 @@ function useScroll({
9430
9433
  refWarning("container", container);
9431
9434
  });
9432
9435
  vue.watch(
9433
- [container, target, () => options.offset],
9436
+ [() => container == null ? void 0 : container.value, () => target == null ? void 0 : target.value, () => options.offset],
9434
9437
  (n, o, onCleanup) => {
9438
+ if (isSSR) {
9439
+ return;
9440
+ }
9435
9441
  const cleanup = scroll(
9436
9442
  (_progress, { x, y }) => {
9437
9443
  values.scrollX.set(x.current);
@@ -28,7 +28,8 @@ class MotionState {
28
28
  this.parent = parent;
29
29
  (_a = parent == null ? void 0 : parent.children) == null ? void 0 : _a.add(this);
30
30
  this.depth = (parent == null ? void 0 : parent.depth) + 1 || 0;
31
- const initialVariantSource = this.context.initial === false ? ["initial", "animate"] : ["initial"];
31
+ const initial = options.initial === void 0 && options.variants ? this.context.initial : options.initial;
32
+ const initialVariantSource = initial === false ? ["initial", "animate"] : ["initial"];
32
33
  this.initTarget(initialVariantSource);
33
34
  this.featureManager = new FeatureManager(this);
34
35
  this.type = isSVGElement(this.options.as) ? "svg" : "html";
@@ -97,7 +97,8 @@ function camelToKebab(str) {
97
97
  return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
98
98
  }
99
99
  function buildSVGPath(attrs, length, spacing = 1, offset = 0) {
100
- attrs["path-length"] = 1;
100
+ attrs.pathLength = 1;
101
+ delete attrs["path-length"];
101
102
  attrs["stroke-dashoffset"] = px.transform(-offset);
102
103
  const pathLength = px.transform(length);
103
104
  const pathSpacing = px.transform(spacing);
@@ -0,0 +1 @@
1
+ export declare const isSSR: boolean;
@@ -0,0 +1,4 @@
1
+ const isSSR = typeof window === "undefined";
2
+ export {
3
+ isSSR
4
+ };
@@ -1,5 +1,6 @@
1
1
  import { onMounted, watch } from "vue";
2
2
  import { warning } from "hey-listen";
3
+ import { isSSR } from "../utils/is.mjs";
3
4
  import { scroll } from "../external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/dom/scroll/index.mjs";
4
5
  import { motionValue } from "../external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/value/index.mjs";
5
6
  import "../external/.pnpm/motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
@@ -28,8 +29,11 @@ function useScroll({
28
29
  refWarning("container", container);
29
30
  });
30
31
  watch(
31
- [container, target, () => options.offset],
32
+ [() => container == null ? void 0 : container.value, () => target == null ? void 0 : target.value, () => options.offset],
32
33
  (n, o, onCleanup) => {
34
+ if (isSSR) {
35
+ return;
36
+ }
33
37
  const cleanup = scroll(
34
38
  (_progress, { x, y }) => {
35
39
  values.scrollX.set(x.current);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-v",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.4",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "MIT",