ublo-lib 1.10.25 → 1.10.26
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
declare type CmsMode = "connected" | "info" | "editing";
|
|
3
|
-
|
|
4
|
-
export
|
|
3
|
+
export default function useInView(ref: React.MutableRefObject<HTMLElement>, cmsMode: CmsMode, selector: string, repeat?: boolean, intersectionValue?: number): void;
|
|
4
|
+
export {};
|
|
5
5
|
//# sourceMappingURL=use-in-view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-in-view.d.ts","sourceRoot":"","sources":["../../../src/common/hooks/use-in-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"use-in-view.d.ts","sourceRoot":"","sources":["../../../src/common/hooks/use-in-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,aAAK,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAYhD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,GAAG,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,EACxC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,OAAc,EACtB,iBAAiB,GAAE,MAAY,QAmFhC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { useUbloContext } from "ublo/with-ublo";
|
|
2
3
|
const ratio = (steps) => Array.from({ length: steps + 1 }).map((_, i) => i / steps);
|
|
3
4
|
const buildClass = (className) => `${className}--in-view`;
|
|
4
5
|
const options = {
|
|
5
6
|
rootMargin: "0px",
|
|
6
7
|
threshold: ratio(100),
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
+
export default function useInView(ref, cmsMode, selector, repeat = true, intersectionValue = 0.2) {
|
|
10
|
+
const { path } = useUbloContext();
|
|
9
11
|
const [compatible, setCompatible] = React.useState(false);
|
|
10
12
|
const callback = React.useCallback((entries) => {
|
|
11
13
|
entries.forEach((entry) => {
|
|
@@ -76,6 +78,5 @@ const useInView = (ref, cmsMode, selector, repeat = true, intersectionValue = 0.
|
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
|
-
}, [callback, cmsMode, compatible,
|
|
80
|
-
}
|
|
81
|
-
export default useInView;
|
|
81
|
+
}, [callback, cmsMode, compatible, path, ref, selector]);
|
|
82
|
+
}
|