@jump-section/react 1.0.6 → 1.0.7
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.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +9 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { ScrollManager } from '@jump-section/core';
|
|
3
3
|
|
|
4
4
|
interface ScrollSectionProviderProps {
|
|
5
|
-
children:
|
|
5
|
+
children: ReactNode;
|
|
6
6
|
offset?: number;
|
|
7
7
|
behavior?: ScrollBehavior;
|
|
8
8
|
}
|
|
9
|
-
declare const ScrollSectionProvider:
|
|
9
|
+
declare const ScrollSectionProvider: FC<ScrollSectionProviderProps>;
|
|
10
10
|
declare const useScrollManager: () => ScrollManager;
|
|
11
11
|
|
|
12
12
|
declare const useScrollSection: (sectionId?: string) => {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { ScrollManager } from '@jump-section/core';
|
|
3
3
|
|
|
4
4
|
interface ScrollSectionProviderProps {
|
|
5
|
-
children:
|
|
5
|
+
children: ReactNode;
|
|
6
6
|
offset?: number;
|
|
7
7
|
behavior?: ScrollBehavior;
|
|
8
8
|
}
|
|
9
|
-
declare const ScrollSectionProvider:
|
|
9
|
+
declare const ScrollSectionProvider: FC<ScrollSectionProviderProps>;
|
|
10
10
|
declare const useScrollManager: () => ScrollManager;
|
|
11
11
|
|
|
12
12
|
declare const useScrollSection: (sectionId?: string) => {
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var react=require('react'),core=require('@jump-section/core'),jsxRuntime=require('react/jsx-runtime');var c=react.createContext(null),
|
|
1
|
+
'use strict';var react=require('react'),core=require('@jump-section/core'),jsxRuntime=require('react/jsx-runtime');var c=react.createContext(null),P=({children:r,offset:e,behavior:n})=>{let t=react.useRef(null);return t.current||(t.current=new core.ScrollManager({offset:e,behavior:n})),react.useEffect(()=>()=>{var l;(l=t.current)==null||l.destroy();},[]),jsxRuntime.jsx(c.Provider,{value:t.current,children:r})},i=()=>{let r=react.useContext(c);if(!r)throw new Error("useScrollManager must be used within a ScrollSectionProvider");return r};var w=r=>{let e=i(),[n,t]=react.useState(null);return react.useEffect(()=>{let o=e.onActiveChange(s=>{t(s);});return ()=>{o();}},[e]),{registerRef:o=>{r&&o?e.registerSection(r,o):r&&!o&&e.unregisterSection(r);},scrollTo:o=>e.scrollTo(o),activeId:n,isActive:r?n===r:false}};exports.ScrollSectionProvider=P;exports.useScrollManager=i;exports.useScrollSection=w;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {createContext,useRef,useEffect,useContext,useState}from'react';import {ScrollManager}from'@jump-section/core';import {jsx}from'react/jsx-runtime';var c=createContext(null),
|
|
1
|
+
import {createContext,useRef,useEffect,useContext,useState}from'react';import {ScrollManager}from'@jump-section/core';import {jsx}from'react/jsx-runtime';var c=createContext(null),P=({children:r,offset:e,behavior:n})=>{let t=useRef(null);return t.current||(t.current=new ScrollManager({offset:e,behavior:n})),useEffect(()=>()=>{var l;(l=t.current)==null||l.destroy();},[]),jsx(c.Provider,{value:t.current,children:r})},i=()=>{let r=useContext(c);if(!r)throw new Error("useScrollManager must be used within a ScrollSectionProvider");return r};var w=r=>{let e=i(),[n,t]=useState(null);return useEffect(()=>{let o=e.onActiveChange(s=>{t(s);});return ()=>{o();}},[e]),{registerRef:o=>{r&&o?e.registerSection(r,o):r&&!o&&e.unregisterSection(r);},scrollTo:o=>e.scrollTo(o),activeId:n,isActive:r?n===r:false}};export{P as ScrollSectionProvider,i as useScrollManager,w as useScrollSection};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jump-section/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "React hooks for jump-section scroll management",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"scroll",
|
|
@@ -23,8 +23,14 @@
|
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
26
|
-
"import":
|
|
27
|
-
|
|
26
|
+
"import": {
|
|
27
|
+
"types": "./dist/index.d.mts",
|
|
28
|
+
"default": "./dist/index.mjs"
|
|
29
|
+
},
|
|
30
|
+
"require": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
}
|
|
28
34
|
}
|
|
29
35
|
},
|
|
30
36
|
"sideEffects": false,
|