react-abohook-fullpage 1.1.2

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/README.md ADDED
@@ -0,0 +1,197 @@
1
+ # 🚀 react-abohook-fullpage
2
+
3
+ [![npm version](https://img.shields.io/npm/v/react-abohook-fullpage.svg)](https://www.npmjs.com/package/react-abohook-fullpage)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
5
+
6
+ Lightweight & Modern React FullPage Scrolling Library
7
+ Smooth Transitions • Touch Ready • Keyboard Support • ~5KB gzip
8
+
9
+ <p align="center">
10
+ <img src="https://i.makeagif.com/media/2-28-2026/oL8iYS.gif" alt="React Abohook FullPage Demo" />
11
+ </p>
12
+
13
+ ---
14
+
15
+ ## ✨ Features
16
+
17
+ - 🖥 Smooth full-page section transitions
18
+ - 🖱 Mouse wheel navigation
19
+ - ⌨ Keyboard arrow navigation
20
+ - 📱 Touch & swipe support (mobile optimized)
21
+ - 🧭 Programmatic section control
22
+ - 🦶 Optional footer support
23
+ - 🔒 Built-in animation lock (prevents scroll spam)
24
+ - ⚡ Lightweight (~5KB gzip)
25
+ - 📦 No external animation libraries
26
+
27
+ ---
28
+
29
+ ## 🎯 Perfect For
30
+
31
+ - Landing pages
32
+ - Product showcases
33
+ - Portfolio websites
34
+ - Agency websites
35
+ - One-page applications
36
+
37
+ ---
38
+
39
+ ## 📦 Installation
40
+
41
+ ```bash
42
+ npm install react-abohook-fullpage
43
+ ```
44
+
45
+ or
46
+
47
+ ```bash
48
+ yarn add react-abohook-fullpage
49
+ ```
50
+
51
+ ---
52
+
53
+ ## 🛠 Basic Usage
54
+
55
+ ```jsx
56
+ import { FullPage } from "react-abohook-fullpage";
57
+
58
+ export default function App() {
59
+ return (
60
+ <div
61
+ style={{
62
+ display: "flex",
63
+ flexDirection: "column",
64
+ backgroundColor: "black",
65
+ }}
66
+ >
67
+ <FullPage directionDots="right" duration={700}>
68
+ <FullPage.Section>
69
+ <div
70
+ style={{
71
+ backgroundColor: "deeppink",
72
+ display: "flex",
73
+ flexDirection: "column",
74
+ justifyContent: "center",
75
+ alignItems: "center",
76
+ width: "100%",
77
+ height: "100%",
78
+ }}
79
+ >
80
+ <h1 style={{ fontSize: 24, color: "white" }}>
81
+ @abohook/fullpage Example
82
+ </h1>
83
+ <a
84
+ target="_blank"
85
+ rel="noreferrer"
86
+ style={{ fontSize: 22, color: "white" }}
87
+ href="https://github.com/mostafa0x"
88
+ >
89
+ By Mostafa Ahmed
90
+ </a>
91
+ </div>
92
+ </FullPage.Section>
93
+ <FullPage.Section>
94
+ <div
95
+ style={{
96
+ backgroundColor: "orange",
97
+ display: "flex",
98
+ flexDirection: "column",
99
+ justifyContent: "center",
100
+ alignItems: "center",
101
+ width: "100%",
102
+ height: "100%",
103
+ }}
104
+ >
105
+ <h1 style={{ fontSize: 24, color: "white" }}>Section 1</h1>
106
+ </div>
107
+ </FullPage.Section>
108
+ <FullPage.Section>
109
+ <div
110
+ style={{
111
+ backgroundColor: "blue",
112
+ display: "flex",
113
+ flexDirection: "column",
114
+ justifyContent: "center",
115
+ alignItems: "center",
116
+ width: "100%",
117
+ height: "100%",
118
+ }}
119
+ >
120
+ <h1 style={{ fontSize: 24, color: "white" }}>Section 2</h1>
121
+ </div>
122
+ </FullPage.Section>
123
+ <FullPage.Footer>
124
+ <div
125
+ style={{
126
+ display: "flex",
127
+ justifyContent: "center",
128
+ alignItems: "center",
129
+ height: "100%",
130
+ }}
131
+ >
132
+ <h2>Footer</h2>
133
+ </div>
134
+ </FullPage.Footer>
135
+ </FullPage>
136
+ </div>
137
+ );
138
+ }
139
+ ```
140
+
141
+ ---
142
+
143
+ ## ⚙️ API Overview
144
+
145
+ ### `<FullPage />`
146
+
147
+ | Prop | Type | Default | Description |
148
+ | ------------------- | ------------------------------- | ----------- | ----------------------------------- |
149
+ | `onChange` | `(index: number) => void` | `undefined` | Triggered when section changes |
150
+ | `duration` | `number` | `700` | Transition duration in milliseconds |
151
+ | `directionDots` | `"left" \| "right" \| "bottom"` | `"right"` | Position of navigation dots |
152
+ | `enableContextMenu` | `boolean` | `false` | Enable right-click context menu |
153
+
154
+ ---
155
+
156
+ ### `<FullPage.Section />`
157
+
158
+ Wrap each full screen section.
159
+
160
+ ---
161
+
162
+ ### `<FullPage.Footer />`
163
+
164
+ Optional footer that appears after the last section.
165
+
166
+ ---
167
+
168
+ ## ⚡ Why react-abohook-fullpage?
169
+
170
+ Unlike heavy animation-based fullpage libraries:
171
+
172
+ - ❌ No framer-motion required
173
+ - ❌ No GSAP required
174
+ - ❌ No large dependencies
175
+ - ✅ Pure lightweight logic
176
+ - ✅ Optimized for performance
177
+ - ✅ Clean developer API
178
+ - ✅ Production-ready
179
+
180
+ ---
181
+
182
+ ## 📱 Cross-Platform Ready
183
+
184
+ Works seamlessly across:
185
+
186
+ - Desktop browsers
187
+ - Mobile devices
188
+ - Touch screens
189
+ - Keyboard navigation
190
+
191
+ Built for real-world production environments.
192
+
193
+ ---
194
+
195
+ ## 📄 License
196
+
197
+ MIT © Mostafa Ahmed
@@ -0,0 +1,6 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react");var N={exports:{}},k={};var q;function oe(){if(q)return k;q=1;var r=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function i(f,n,a){var l=null;if(a!==void 0&&(l=""+a),n.key!==void 0&&(l=""+n.key),"key"in n){a={};for(var p in n)p!=="key"&&(a[p]=n[p])}else a=n;return n=a.ref,{$$typeof:r,type:f,key:l,ref:n!==void 0?n:null,props:a}}return k.Fragment=o,k.jsx=i,k.jsxs=i,k}var A={};var J;function ae(){return J||(J=1,process.env.NODE_ENV!=="production"&&(function(){function r(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case m:return"Fragment";case S:return"Profiler";case x:return"StrictMode";case Z:return"Suspense";case Q:return"SuspenseList";case ee:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case R:return"Portal";case j:return e.displayName||"Context";case O:return(e._context.displayName||"Context")+".Consumer";case v:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case K:return t=e.displayName||null,t!==null?t:r(e.type)||"Memo";case L:t=e._payload,e=e._init;try{return r(e(t))}catch{}}return null}function o(e){return""+e}function i(e){try{o(e);var t=!1}catch{t=!0}if(t){t=console;var s=t.error,u=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",u),o(e)}}function f(e){if(e===m)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===L)return"<...>";try{var t=r(e);return t?"<"+t+">":"<...>"}catch{return"<...>"}}function n(){var e=Y.A;return e===null?null:e.getOwner()}function a(){return Error("react-stack-top-frame")}function l(e){if(M.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function p(e,t){function s(){U||(U=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}s.isReactWarning=!0,Object.defineProperty(e,"key",{get:s,configurable:!0})}function h(){var e=r(this.type);return W[e]||(W[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function g(e,t,s,u,F,I){var c=s.ref;return e={$$typeof:w,type:e,key:t,props:s,_owner:u},(c!==void 0?c:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:h}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:F}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:I}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function T(e,t,s,u,F,I){var c=t.children;if(c!==void 0)if(u)if(re(c)){for(u=0;u<c.length;u++)y(c[u]);Object.freeze&&Object.freeze(c)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else y(c);if(M.call(t,"key")){c=r(e);var P=Object.keys(t).filter(function(ne){return ne!=="key"});u=0<P.length?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}",V[c+u]||(P=0<P.length?"{"+P.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
+ let props = %s;
3
+ <%s {...props} />
4
+ React keys must be passed directly to JSX without using spread:
5
+ let props = %s;
6
+ <%s key={someKey} {...props} />`,u,c,P,c),V[c+u]=!0)}if(c=null,s!==void 0&&(i(s),c=""+s),l(t)&&(i(t.key),c=""+t.key),"key"in t){s={};for(var $ in t)$!=="key"&&(s[$]=t[$])}else s=t;return c&&p(s,typeof e=="function"?e.displayName||e.name||"Unknown":e),g(e,c,s,n(),F,I)}function y(e){b(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===L&&(e._payload.status==="fulfilled"?b(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function b(e){return typeof e=="object"&&e!==null&&e.$$typeof===w}var _=d,w=Symbol.for("react.transitional.element"),R=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),j=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),Q=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),te=Symbol.for("react.client.reference"),Y=_.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,re=Array.isArray,C=console.createTask?console.createTask:function(){return null};_={react_stack_bottom_frame:function(e){return e()}};var U,W={},z=_.react_stack_bottom_frame.bind(_,a)(),G=C(f(a)),V={};A.Fragment=m,A.jsx=function(e,t,s){var u=1e4>Y.recentlyCreatedOwnerStacks++;return T(e,t,s,!1,u?Error("react-stack-top-frame"):z,u?C(f(e)):G)},A.jsxs=function(e,t,s){var u=1e4>Y.recentlyCreatedOwnerStacks++;return T(e,t,s,!0,u?Error("react-stack-top-frame"):z,u?C(f(e)):G)}})()),A}var H;function se(){return H||(H=1,process.env.NODE_ENV==="production"?N.exports=oe():N.exports=ae()),N.exports}var E=se();const ie=50,le=(r,o,i,f=700)=>{const[n,a]=d.useState(0),[l,p]=d.useState(!0),h=d.useRef(!1),[g,T]=d.useState(0),y=o&&n+1===r,b=d.useRef(0),_=d.useRef(0),w=d.useRef(!1),R=(m,x)=>{if(m<0||m>=r||h.current)return;const S=x===2;h.current=!0,T(n),a(m),y?m===3||n===r-1?a(S?g:m):a(g):a(m),o&&r===m+1?p(!1):p(!0),setTimeout(()=>{h.current=!1},f)};return d.useEffect(()=>{i&&i(n);const m=v=>{if(h.current)return v.preventDefault();v.deltaY>0?R(n+1,2):R(n-1,2)},x=v=>{h.current||(v.key==="ArrowDown"&&R(n+1,2),v.key==="ArrowUp"&&R(n-1,2))},S=v=>{b.current=v.touches[0].clientY,w.current=!1},O=v=>{_.current=v.touches[0].clientY,w.current=!0},j=()=>{if(!w.current)return;const v=b.current-_.current;Math.abs(v)>=ie&&(v>0?R(n+1,2):R(n-1,2))};return window.addEventListener("wheel",m,{passive:!1}),window.addEventListener("keydown",x),window.addEventListener("touchstart",S,{passive:!0}),window.addEventListener("touchmove",O,{passive:!0}),window.addEventListener("touchend",j),()=>{window.removeEventListener("wheel",m),window.removeEventListener("keydown",x),window.removeEventListener("touchstart",S),window.removeEventListener("touchmove",O),window.removeEventListener("touchend",j)}},[n,r,o,i]),{active:n,goToSection:R,isHiddenFooter:l}},ue=(r=!1)=>{d.useEffect(()=>{if(r)return;const o=i=>i.preventDefault();return window.addEventListener("contextmenu",o),()=>{window.removeEventListener("contextmenu",o)}},[r])};function ce({children:r,index:o,active:i,isHiddenFooter:f}){return E.jsx("section",{style:{position:"relative",width:"100%",height:"100vh",overflow:"hidden",filter:o===i||f?"blur(0px)":"blur(6px)"},children:r})}const fe=d.memo(ce);function de({sectionsLen:r,active:o,goToSection:i,direction:f="right"}){const n=f==="bottom";return E.jsx("div",{style:{position:"fixed",right:f==="right"?24:f==="bottom"?"50%":void 0,left:f==="left"?24:void 0,top:n?void 0:"50%",bottom:n?"5%":void 0,transform:"translateY(-50%)",display:"flex",flexDirection:n?"row":"column",gap:"16px",zIndex:50},children:Array.from({length:r}).map((a,l)=>E.jsx("button",{disabled:l===o,"aria-label":"navigation dot",onClick:()=>i(l,1),style:{width:"16px",height:"16px",display:"flex",alignItems:"center",justifyContent:"center",padding:0,border:"none",background:"none",cursor:"pointer",userSelect:"none"},children:E.jsx("span",{style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:o===l?"white":"rgba(255,255,255,0.4)",transform:o===l?"scale(1.25)":"scale(1)",transition:"all 0.3s ease"}})},l))})}const me=d.memo(de);function ve({children:r}){return E.jsx("div",{style:{position:"relative",width:"100%",height:"100vh",overflow:"hidden",background:"transparent"},children:r})}const X=d.memo(ve);X.__FULLPAGE_SECTION__=!0;function Ee({children:r,styles:o,height:i="30%",backgroundColor:f="yellow"}){return E.jsx("div",{style:{position:"absolute",width:"100%",height:i,backgroundColor:f,bottom:0,zIndex:50,...o},children:r},"fullpage-footer")}const B=d.memo(Ee);B.__FULLPAGE_FOOTER__=!0;function _e(r){process.env.NODE_ENV!=="production"&&r.forEach(o=>{if(d.isValidElement(o)&&!o.type.__FULLPAGE_SECTION__)throw console.warn("[FullPage] You must wrap content inside <FullPage.Section />"),new Error("[FullPage] You must wrap content inside <FullPage.Section />")})}function pe({children:r,isHiddenFooter:o}){const i=o?2500:600;return E.jsx("div",{style:{position:"absolute",left:0,bottom:0,width:"100%",height:"100vh",zIndex:50,transform:o?"translateY(100%)":"translateY(0)",transition:`transform ${i}ms cubic-bezier(0.22,1,0.36,1)`,willChange:"transform",pointerEvents:o?"none":"auto"},children:r})}const he=d.memo(pe);function D({children:r,onChange:o,directionDots:i="right",enableContextMenu:f=!1,duration:n=700}){const a=d.Children.toArray(r),l=a.filter(_=>_.type.__FULLPAGE_SECTION__),p=a.find(_=>_.type.__FULLPAGE_FOOTER__);ue(f),d.useEffect(()=>(_e(l),()=>{}),[l]);const h=!!p,g=l.length+(h?1:0),{active:T,goToSection:y,isHiddenFooter:b}=le(g,h,o,n);return E.jsxs(E.Fragment,{children:[E.jsxs("div",{style:{position:"relative",height:"100vh",width:"100%",overflow:"hidden"},children:[E.jsx("div",{style:{height:`${l.length*100}vh`,transform:b?`translateY(-${T*100}vh)`:`translateY(-${l.length-100}vh)`,transition:"transform 700ms cubic-bezier(0.22,1,0.36,1)"},children:l.map((_,w)=>E.jsx(fe,{index:w,active:T,isHiddenFooter:b,children:_},w))}),p&&E.jsx(he,{isHiddenFooter:b,children:p})]}),E.jsx(me,{sectionsLen:g,active:T,goToSection:y,direction:i})]})}D.Section=X;D.Footer=B;exports.FullPage=D;
@@ -0,0 +1,32 @@
1
+ import { default as default_2 } from 'react';
2
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
3
+
4
+ declare type DirectionDotsType = "left" | "right" | "bottom";
5
+
6
+ export declare function FullPage({ children, onChange, directionDots, enableContextMenu, duration, }: FullPageProps): JSX_2.Element;
7
+
8
+ export declare namespace FullPage {
9
+ var Section: default_2.FC<FullPageSectionProps>;
10
+ var Footer: default_2.FC<FullPageFooterProps>;
11
+ }
12
+
13
+ declare interface FullPageFooterProps {
14
+ children: React.ReactNode;
15
+ styles?: React.CSSProperties;
16
+ height?: number | string;
17
+ backgroundColor?: string;
18
+ }
19
+
20
+ declare interface FullPageProps {
21
+ children: React.ReactNode;
22
+ onChange?: (currentSection: number) => void;
23
+ directionDots?: DirectionDotsType;
24
+ enableContextMenu?: boolean;
25
+ duration: number;
26
+ }
27
+
28
+ declare interface FullPageSectionProps {
29
+ children: React.ReactNode;
30
+ }
31
+
32
+ export { }
@@ -0,0 +1,524 @@
1
+ import U, { useEffect as W, useState as M, useRef as F, memo as A } from "react";
2
+ var L = { exports: {} }, P = {};
3
+ var X;
4
+ function le() {
5
+ if (X) return P;
6
+ X = 1;
7
+ var r = /* @__PURE__ */ Symbol.for("react.transitional.element"), o = /* @__PURE__ */ Symbol.for("react.fragment");
8
+ function i(f, n, a) {
9
+ var l = null;
10
+ if (a !== void 0 && (l = "" + a), n.key !== void 0 && (l = "" + n.key), "key" in n) {
11
+ a = {};
12
+ for (var _ in n)
13
+ _ !== "key" && (a[_] = n[_]);
14
+ } else a = n;
15
+ return n = a.ref, {
16
+ $$typeof: r,
17
+ type: f,
18
+ key: l,
19
+ ref: n !== void 0 ? n : null,
20
+ props: a
21
+ };
22
+ }
23
+ return P.Fragment = o, P.jsx = i, P.jsxs = i, P;
24
+ }
25
+ var k = {};
26
+ var B;
27
+ function ue() {
28
+ return B || (B = 1, process.env.NODE_ENV !== "production" && (function() {
29
+ function r(e) {
30
+ if (e == null) return null;
31
+ if (typeof e == "function")
32
+ return e.$$typeof === ae ? null : e.displayName || e.name || null;
33
+ if (typeof e == "string") return e;
34
+ switch (e) {
35
+ case d:
36
+ return "Fragment";
37
+ case g:
38
+ return "Profiler";
39
+ case y:
40
+ return "StrictMode";
41
+ case te:
42
+ return "Suspense";
43
+ case re:
44
+ return "SuspenseList";
45
+ case oe:
46
+ return "Activity";
47
+ }
48
+ if (typeof e == "object")
49
+ switch (typeof e.tag == "number" && console.error(
50
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
51
+ ), e.$$typeof) {
52
+ case w:
53
+ return "Portal";
54
+ case j:
55
+ return e.displayName || "Context";
56
+ case O:
57
+ return (e._context.displayName || "Context") + ".Consumer";
58
+ case v:
59
+ var t = e.render;
60
+ return e = e.displayName, e || (e = t.displayName || t.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
61
+ case ne:
62
+ return t = e.displayName || null, t !== null ? t : r(e.type) || "Memo";
63
+ case Y:
64
+ t = e._payload, e = e._init;
65
+ try {
66
+ return r(e(t));
67
+ } catch {
68
+ }
69
+ }
70
+ return null;
71
+ }
72
+ function o(e) {
73
+ return "" + e;
74
+ }
75
+ function i(e) {
76
+ try {
77
+ o(e);
78
+ var t = !1;
79
+ } catch {
80
+ t = !0;
81
+ }
82
+ if (t) {
83
+ t = console;
84
+ var s = t.error, u = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
85
+ return s.call(
86
+ t,
87
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
88
+ u
89
+ ), o(e);
90
+ }
91
+ }
92
+ function f(e) {
93
+ if (e === d) return "<>";
94
+ if (typeof e == "object" && e !== null && e.$$typeof === Y)
95
+ return "<...>";
96
+ try {
97
+ var t = r(e);
98
+ return t ? "<" + t + ">" : "<...>";
99
+ } catch {
100
+ return "<...>";
101
+ }
102
+ }
103
+ function n() {
104
+ var e = C.A;
105
+ return e === null ? null : e.getOwner();
106
+ }
107
+ function a() {
108
+ return Error("react-stack-top-frame");
109
+ }
110
+ function l(e) {
111
+ if (z.call(e, "key")) {
112
+ var t = Object.getOwnPropertyDescriptor(e, "key").get;
113
+ if (t && t.isReactWarning) return !1;
114
+ }
115
+ return e.key !== void 0;
116
+ }
117
+ function _(e, t) {
118
+ function s() {
119
+ G || (G = !0, console.error(
120
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
121
+ t
122
+ ));
123
+ }
124
+ s.isReactWarning = !0, Object.defineProperty(e, "key", {
125
+ get: s,
126
+ configurable: !0
127
+ });
128
+ }
129
+ function p() {
130
+ var e = r(this.type);
131
+ return V[e] || (V[e] = !0, console.error(
132
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
133
+ )), e = this.props.ref, e !== void 0 ? e : null;
134
+ }
135
+ function R(e, t, s, u, N, $) {
136
+ var c = s.ref;
137
+ return e = {
138
+ $$typeof: b,
139
+ type: e,
140
+ key: t,
141
+ props: s,
142
+ _owner: u
143
+ }, (c !== void 0 ? c : null) !== null ? Object.defineProperty(e, "ref", {
144
+ enumerable: !1,
145
+ get: p
146
+ }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
147
+ configurable: !1,
148
+ enumerable: !1,
149
+ writable: !0,
150
+ value: 0
151
+ }), Object.defineProperty(e, "_debugInfo", {
152
+ configurable: !1,
153
+ enumerable: !1,
154
+ writable: !0,
155
+ value: null
156
+ }), Object.defineProperty(e, "_debugStack", {
157
+ configurable: !1,
158
+ enumerable: !1,
159
+ writable: !0,
160
+ value: N
161
+ }), Object.defineProperty(e, "_debugTask", {
162
+ configurable: !1,
163
+ enumerable: !1,
164
+ writable: !0,
165
+ value: $
166
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
167
+ }
168
+ function T(e, t, s, u, N, $) {
169
+ var c = t.children;
170
+ if (c !== void 0)
171
+ if (u)
172
+ if (se(c)) {
173
+ for (u = 0; u < c.length; u++)
174
+ x(c[u]);
175
+ Object.freeze && Object.freeze(c);
176
+ } else
177
+ console.error(
178
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
179
+ );
180
+ else x(c);
181
+ if (z.call(t, "key")) {
182
+ c = r(e);
183
+ var S = Object.keys(t).filter(function(ie) {
184
+ return ie !== "key";
185
+ });
186
+ u = 0 < S.length ? "{key: someKey, " + S.join(": ..., ") + ": ...}" : "{key: someKey}", H[c + u] || (S = 0 < S.length ? "{" + S.join(": ..., ") + ": ...}" : "{}", console.error(
187
+ `A props object containing a "key" prop is being spread into JSX:
188
+ let props = %s;
189
+ <%s {...props} />
190
+ React keys must be passed directly to JSX without using spread:
191
+ let props = %s;
192
+ <%s key={someKey} {...props} />`,
193
+ u,
194
+ c,
195
+ S,
196
+ c
197
+ ), H[c + u] = !0);
198
+ }
199
+ if (c = null, s !== void 0 && (i(s), c = "" + s), l(t) && (i(t.key), c = "" + t.key), "key" in t) {
200
+ s = {};
201
+ for (var D in t)
202
+ D !== "key" && (s[D] = t[D]);
203
+ } else s = t;
204
+ return c && _(
205
+ s,
206
+ typeof e == "function" ? e.displayName || e.name || "Unknown" : e
207
+ ), R(
208
+ e,
209
+ c,
210
+ s,
211
+ n(),
212
+ N,
213
+ $
214
+ );
215
+ }
216
+ function x(e) {
217
+ h(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === Y && (e._payload.status === "fulfilled" ? h(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
218
+ }
219
+ function h(e) {
220
+ return typeof e == "object" && e !== null && e.$$typeof === b;
221
+ }
222
+ var E = U, b = /* @__PURE__ */ Symbol.for("react.transitional.element"), w = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), y = /* @__PURE__ */ Symbol.for("react.strict_mode"), g = /* @__PURE__ */ Symbol.for("react.profiler"), O = /* @__PURE__ */ Symbol.for("react.consumer"), j = /* @__PURE__ */ Symbol.for("react.context"), v = /* @__PURE__ */ Symbol.for("react.forward_ref"), te = /* @__PURE__ */ Symbol.for("react.suspense"), re = /* @__PURE__ */ Symbol.for("react.suspense_list"), ne = /* @__PURE__ */ Symbol.for("react.memo"), Y = /* @__PURE__ */ Symbol.for("react.lazy"), oe = /* @__PURE__ */ Symbol.for("react.activity"), ae = /* @__PURE__ */ Symbol.for("react.client.reference"), C = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, z = Object.prototype.hasOwnProperty, se = Array.isArray, I = console.createTask ? console.createTask : function() {
223
+ return null;
224
+ };
225
+ E = {
226
+ react_stack_bottom_frame: function(e) {
227
+ return e();
228
+ }
229
+ };
230
+ var G, V = {}, J = E.react_stack_bottom_frame.bind(
231
+ E,
232
+ a
233
+ )(), q = I(f(a)), H = {};
234
+ k.Fragment = d, k.jsx = function(e, t, s) {
235
+ var u = 1e4 > C.recentlyCreatedOwnerStacks++;
236
+ return T(
237
+ e,
238
+ t,
239
+ s,
240
+ !1,
241
+ u ? Error("react-stack-top-frame") : J,
242
+ u ? I(f(e)) : q
243
+ );
244
+ }, k.jsxs = function(e, t, s) {
245
+ var u = 1e4 > C.recentlyCreatedOwnerStacks++;
246
+ return T(
247
+ e,
248
+ t,
249
+ s,
250
+ !0,
251
+ u ? Error("react-stack-top-frame") : J,
252
+ u ? I(f(e)) : q
253
+ );
254
+ };
255
+ })()), k;
256
+ }
257
+ var Z;
258
+ function ce() {
259
+ return Z || (Z = 1, process.env.NODE_ENV === "production" ? L.exports = le() : L.exports = ue()), L.exports;
260
+ }
261
+ var m = ce();
262
+ const fe = 50, de = (r, o, i, f = 700) => {
263
+ const [n, a] = M(0), [l, _] = M(!0), p = F(!1), [R, T] = M(0), x = o && n + 1 === r, h = F(0), E = F(0), b = F(!1), w = (d, y) => {
264
+ if (d < 0 || d >= r || p.current) return;
265
+ const g = y === 2;
266
+ p.current = !0, T(n), a(d), x ? d === 3 || n === r - 1 ? a(g ? R : d) : a(R) : a(d), o && r === d + 1 ? _(!1) : _(!0), setTimeout(() => {
267
+ p.current = !1;
268
+ }, f);
269
+ };
270
+ return W(() => {
271
+ i && i(n);
272
+ const d = (v) => {
273
+ if (p.current) return v.preventDefault();
274
+ v.deltaY > 0 ? w(n + 1, 2) : w(n - 1, 2);
275
+ }, y = (v) => {
276
+ p.current || (v.key === "ArrowDown" && w(n + 1, 2), v.key === "ArrowUp" && w(n - 1, 2));
277
+ }, g = (v) => {
278
+ h.current = v.touches[0].clientY, b.current = !1;
279
+ }, O = (v) => {
280
+ E.current = v.touches[0].clientY, b.current = !0;
281
+ }, j = () => {
282
+ if (!b.current) return;
283
+ const v = h.current - E.current;
284
+ Math.abs(v) >= fe && (v > 0 ? w(n + 1, 2) : w(n - 1, 2));
285
+ };
286
+ return window.addEventListener("wheel", d, { passive: !1 }), window.addEventListener("keydown", y), window.addEventListener("touchstart", g, { passive: !0 }), window.addEventListener("touchmove", O, { passive: !0 }), window.addEventListener("touchend", j), () => {
287
+ window.removeEventListener("wheel", d), window.removeEventListener("keydown", y), window.removeEventListener("touchstart", g), window.removeEventListener("touchmove", O), window.removeEventListener("touchend", j);
288
+ };
289
+ }, [n, r, o, i]), { active: n, goToSection: w, isHiddenFooter: l };
290
+ }, ve = (r = !1) => {
291
+ W(() => {
292
+ if (r) return;
293
+ const o = (i) => i.preventDefault();
294
+ return window.addEventListener("contextmenu", o), () => {
295
+ window.removeEventListener("contextmenu", o);
296
+ };
297
+ }, [r]);
298
+ };
299
+ function me({
300
+ children: r,
301
+ index: o,
302
+ active: i,
303
+ isHiddenFooter: f
304
+ }) {
305
+ return /* @__PURE__ */ m.jsx(
306
+ "section",
307
+ {
308
+ style: {
309
+ position: "relative",
310
+ width: "100%",
311
+ height: "100vh",
312
+ overflow: "hidden",
313
+ filter: o === i || f ? "blur(0px)" : "blur(6px)"
314
+ },
315
+ children: r
316
+ }
317
+ );
318
+ }
319
+ const Ee = A(me);
320
+ function _e({
321
+ sectionsLen: r,
322
+ active: o,
323
+ goToSection: i,
324
+ direction: f = "right"
325
+ }) {
326
+ const n = f === "bottom";
327
+ return /* @__PURE__ */ m.jsx(
328
+ "div",
329
+ {
330
+ style: {
331
+ position: "fixed",
332
+ right: f === "right" ? 24 : f === "bottom" ? "50%" : void 0,
333
+ left: f === "left" ? 24 : void 0,
334
+ top: n ? void 0 : "50%",
335
+ bottom: n ? "5%" : void 0,
336
+ transform: "translateY(-50%)",
337
+ display: "flex",
338
+ flexDirection: n ? "row" : "column",
339
+ gap: "16px",
340
+ zIndex: 50
341
+ },
342
+ children: Array.from({ length: r }).map((a, l) => /* @__PURE__ */ m.jsx(
343
+ "button",
344
+ {
345
+ disabled: l === o,
346
+ "aria-label": "navigation dot",
347
+ onClick: () => i(l, 1),
348
+ style: {
349
+ width: "16px",
350
+ height: "16px",
351
+ display: "flex",
352
+ alignItems: "center",
353
+ justifyContent: "center",
354
+ padding: 0,
355
+ border: "none",
356
+ background: "none",
357
+ cursor: "pointer",
358
+ userSelect: "none"
359
+ },
360
+ children: /* @__PURE__ */ m.jsx(
361
+ "span",
362
+ {
363
+ style: {
364
+ width: "10px",
365
+ height: "10px",
366
+ borderRadius: "50%",
367
+ backgroundColor: o === l ? "white" : "rgba(255,255,255,0.4)",
368
+ transform: o === l ? "scale(1.25)" : "scale(1)",
369
+ transition: "all 0.3s ease"
370
+ }
371
+ }
372
+ )
373
+ },
374
+ l
375
+ ))
376
+ }
377
+ );
378
+ }
379
+ const pe = A(_e);
380
+ function he({ children: r }) {
381
+ return /* @__PURE__ */ m.jsx(
382
+ "div",
383
+ {
384
+ style: {
385
+ position: "relative",
386
+ width: "100%",
387
+ height: "100vh",
388
+ overflow: "hidden",
389
+ background: "transparent"
390
+ },
391
+ children: r
392
+ }
393
+ );
394
+ }
395
+ const Q = A(he);
396
+ Q.__FULLPAGE_SECTION__ = !0;
397
+ function be({
398
+ children: r,
399
+ styles: o,
400
+ height: i = "30%",
401
+ backgroundColor: f = "yellow"
402
+ }) {
403
+ return /* @__PURE__ */ m.jsx(
404
+ "div",
405
+ {
406
+ style: {
407
+ position: "absolute",
408
+ width: "100%",
409
+ height: i,
410
+ backgroundColor: f,
411
+ bottom: 0,
412
+ zIndex: 50,
413
+ ...o
414
+ },
415
+ children: r
416
+ },
417
+ "fullpage-footer"
418
+ );
419
+ }
420
+ const K = A(be);
421
+ K.__FULLPAGE_FOOTER__ = !0;
422
+ function we(r) {
423
+ process.env.NODE_ENV !== "production" && r.forEach((o) => {
424
+ if (U.isValidElement(o) && !o.type.__FULLPAGE_SECTION__)
425
+ throw console.warn(
426
+ "[FullPage] You must wrap content inside <FullPage.Section />"
427
+ ), new Error(
428
+ "[FullPage] You must wrap content inside <FullPage.Section />"
429
+ );
430
+ });
431
+ }
432
+ function Re({ children: r, isHiddenFooter: o }) {
433
+ const i = o ? 2500 : 600;
434
+ return /* @__PURE__ */ m.jsx(
435
+ "div",
436
+ {
437
+ style: {
438
+ position: "absolute",
439
+ left: 0,
440
+ bottom: 0,
441
+ width: "100%",
442
+ height: "100vh",
443
+ zIndex: 50,
444
+ transform: o ? "translateY(100%)" : "translateY(0)",
445
+ transition: `transform ${i}ms cubic-bezier(0.22,1,0.36,1)`,
446
+ willChange: "transform",
447
+ pointerEvents: o ? "none" : "auto"
448
+ },
449
+ children: r
450
+ }
451
+ );
452
+ }
453
+ const Te = A(Re);
454
+ function ee({
455
+ children: r,
456
+ onChange: o,
457
+ directionDots: i = "right",
458
+ enableContextMenu: f = !1,
459
+ duration: n = 700
460
+ }) {
461
+ const a = U.Children.toArray(r), l = a.filter(
462
+ (E) => E.type.__FULLPAGE_SECTION__
463
+ ), _ = a.find(
464
+ (E) => E.type.__FULLPAGE_FOOTER__
465
+ );
466
+ ve(f), W(() => (we(l), () => {
467
+ }), [l]);
468
+ const p = !!_, R = l.length + (p ? 1 : 0), { active: T, goToSection: x, isHiddenFooter: h } = de(
469
+ R,
470
+ p,
471
+ o,
472
+ n
473
+ );
474
+ return /* @__PURE__ */ m.jsxs(m.Fragment, { children: [
475
+ /* @__PURE__ */ m.jsxs(
476
+ "div",
477
+ {
478
+ style: {
479
+ position: "relative",
480
+ height: "100vh",
481
+ width: "100%",
482
+ overflow: "hidden"
483
+ },
484
+ children: [
485
+ /* @__PURE__ */ m.jsx(
486
+ "div",
487
+ {
488
+ style: {
489
+ height: `${l.length * 100}vh`,
490
+ transform: h ? `translateY(-${T * 100}vh)` : `translateY(-${l.length - 100}vh)`,
491
+ transition: "transform 700ms cubic-bezier(0.22,1,0.36,1)"
492
+ },
493
+ children: l.map((E, b) => /* @__PURE__ */ m.jsx(
494
+ Ee,
495
+ {
496
+ index: b,
497
+ active: T,
498
+ isHiddenFooter: h,
499
+ children: E
500
+ },
501
+ b
502
+ ))
503
+ }
504
+ ),
505
+ _ && /* @__PURE__ */ m.jsx(Te, { isHiddenFooter: h, children: _ })
506
+ ]
507
+ }
508
+ ),
509
+ /* @__PURE__ */ m.jsx(
510
+ pe,
511
+ {
512
+ sectionsLen: R,
513
+ active: T,
514
+ goToSection: x,
515
+ direction: i
516
+ }
517
+ )
518
+ ] });
519
+ }
520
+ ee.Section = Q;
521
+ ee.Footer = K;
522
+ export {
523
+ ee as FullPage
524
+ };
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "react-abohook-fullpage",
3
+ "version": "1.1.2",
4
+ "description": "React FullPage scroll component with parallax and navigation dots",
5
+ "author": "Mostafa Ahmed",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "dist/index.cjs.js",
9
+ "module": "dist/index.es.js",
10
+ "types": "dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.es.js",
15
+ "require": "./dist/index.cjs.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "scripts": {
22
+ "build": "tsc && vite build "
23
+ },
24
+ "peerDependencies": {
25
+ "react": ">=18",
26
+ "react-dom": ">=18"
27
+ },
28
+ "sideEffects": false,
29
+ "keywords": [
30
+ "react",
31
+ "fullpage",
32
+ "parallax",
33
+ "scroll",
34
+ "one page scroll",
35
+ "css transitions"
36
+ ],
37
+ "devDependencies": {
38
+ "@types/node": "^25",
39
+ "@types/react": "^18",
40
+ "@types/react-dom": "^18",
41
+ "@vitejs/plugin-react": "^5",
42
+ "typescript": "^5",
43
+ "vite": "^7",
44
+ "vite-plugin-dts": "^4.5.4"
45
+ }
46
+ }