@jump-section/react 1.0.6 → 1.0.8

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 CHANGED
@@ -1,12 +1,12 @@
1
- import React from 'react';
1
+ import { FC, ReactNode } from 'react';
2
2
  import { ScrollManager } from '@jump-section/core';
3
3
 
4
4
  interface ScrollSectionProviderProps {
5
- children: React.ReactNode;
5
+ children: ReactNode;
6
6
  offset?: number;
7
7
  behavior?: ScrollBehavior;
8
8
  }
9
- declare const ScrollSectionProvider: React.FC<ScrollSectionProviderProps>;
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 React from 'react';
1
+ import { FC, ReactNode } from 'react';
2
2
  import { ScrollManager } from '@jump-section/core';
3
3
 
4
4
  interface ScrollSectionProviderProps {
5
- children: React.ReactNode;
5
+ children: ReactNode;
6
6
  offset?: number;
7
7
  behavior?: ScrollBehavior;
8
8
  }
9
- declare const ScrollSectionProvider: React.FC<ScrollSectionProviderProps>;
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,2 @@
1
- 'use strict';var react=require('react'),core=require('@jump-section/core'),jsxRuntime=require('react/jsx-runtime');var c=react.createContext(null),d=({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 E=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=d;exports.useScrollManager=i;exports.useScrollSection=E;
1
+ "use client";
2
+ '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 E=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=E;
package/dist/index.mjs CHANGED
@@ -1 +1,2 @@
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),d=({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 E=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{d as ScrollSectionProvider,i as useScrollManager,E as useScrollSection};
1
+ "use client";
2
+ 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 E=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,E as useScrollSection};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jump-section/react",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
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": "./dist/index.mjs",
27
- "require": "./dist/index.js"
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,
@@ -36,7 +42,7 @@
36
42
  "@jump-section/core": "^1.0.1"
37
43
  },
38
44
  "scripts": {
39
- "build": "tsup",
45
+ "build": "tsup && node scripts/post-build.js",
40
46
  "test": "vitest run --environment jsdom"
41
47
  },
42
48
  "peerDependencies": {