@neveranyart/weaver 1.0.0
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/LICENSE +674 -0
- package/README.md +18 -0
- package/dist/hooks.d.mts +83 -0
- package/dist/hooks.d.ts +83 -0
- package/dist/hooks.js +358 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hooks.mjs +320 -0
- package/dist/hooks.mjs.map +1 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +17 -0
- package/dist/index.mjs.map +1 -0
- package/dist/routing.d.mts +88 -0
- package/dist/routing.d.ts +88 -0
- package/dist/routing.js +206 -0
- package/dist/routing.js.map +1 -0
- package/dist/routing.mjs +167 -0
- package/dist/routing.mjs.map +1 -0
- package/dist/scene.d.mts +158 -0
- package/dist/scene.d.ts +158 -0
- package/dist/scene.js +325 -0
- package/dist/scene.js.map +1 -0
- package/dist/scene.mjs +297 -0
- package/dist/scene.mjs.map +1 -0
- package/package.json +79 -0
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Weaver
|
|
2
|
+
|
|
3
|
+
## What is this?
|
|
4
|
+
This is `@neveranyart/weaver`, an in-house package for making interactive React CSR.
|
|
5
|
+
|
|
6
|
+
This package is invasive, it requires some packages to be used in the project for it to work:
|
|
7
|
+
```
|
|
8
|
+
- motion
|
|
9
|
+
- @react-three/drei
|
|
10
|
+
- @react-three/fiber
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The package comes packed with:
|
|
14
|
+
- `Pipeline`, `DelayedOutlet`: CSR router handler built for transition animation, hiding initialization lags behind a wall while allowing SEO to work.
|
|
15
|
+
- `BakeScene`: Wait and notify when a 3D scene has finished rendering and ready to be shown, usually paired with `Pipeline`.
|
|
16
|
+
- `Orbit`: ResizeObserver & IntersectionObserver simplified.
|
|
17
|
+
- `SceneSync`: Sync `@react-three/fiber` scene with DOM element.
|
|
18
|
+
- And a big directory of DOM hooks.
|
package/dist/hooks.d.mts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { OrthographicCamera, PerspectiveCamera } from 'three';
|
|
3
|
+
|
|
4
|
+
declare function useBreakpoints(breakpoints?: number[] | null): number;
|
|
5
|
+
|
|
6
|
+
declare function useEffectOnce(callback: React.EffectCallback): void;
|
|
7
|
+
declare function useLayoutEffectOnce(callback: React.EffectCallback): void;
|
|
8
|
+
|
|
9
|
+
interface HookOptions$1 {
|
|
10
|
+
/**
|
|
11
|
+
* Hook will report when first initialized without waiting for scroll event to actually happens.
|
|
12
|
+
*/
|
|
13
|
+
initialCall?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Set an element to only call when the element is actually entering the viewport (with 25% `rootMargin`).
|
|
16
|
+
*/
|
|
17
|
+
intersectOn?: RefObject<HTMLOrSVGElement | null>;
|
|
18
|
+
}
|
|
19
|
+
declare const scrollCallbackReason: {
|
|
20
|
+
readonly Resize: "resize";
|
|
21
|
+
readonly Scroll: "scroll";
|
|
22
|
+
readonly Initialize: "initialize";
|
|
23
|
+
};
|
|
24
|
+
type ScrollCallbackReason = (typeof scrollCallbackReason)[keyof typeof scrollCallbackReason];
|
|
25
|
+
type Callback$2 = (latest: number, reason: ScrollCallbackReason) => void;
|
|
26
|
+
declare function useLenisCallback(callback: Callback$2, options?: HookOptions$1): void;
|
|
27
|
+
|
|
28
|
+
interface MousePositionValues {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
}
|
|
32
|
+
interface HookOptions {
|
|
33
|
+
normalized?: boolean;
|
|
34
|
+
}
|
|
35
|
+
type Callback$1 = (latest: MousePositionValues) => void;
|
|
36
|
+
declare function useMouseCallback(callback: Callback$1, options?: HookOptions): void;
|
|
37
|
+
|
|
38
|
+
declare function useNavigateAnchor(onNavigate?: () => void): (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A simple Orbit hook.
|
|
42
|
+
*
|
|
43
|
+
* @param target HTML element ref to attach to.
|
|
44
|
+
* @param events Specify which events should the orbit tracks.
|
|
45
|
+
*/
|
|
46
|
+
declare function useOrbit(options: {
|
|
47
|
+
target?: RefObject<HTMLElement | null>;
|
|
48
|
+
events: {
|
|
49
|
+
onResize?: (entry: ResizeObserverEntry) => void;
|
|
50
|
+
onIntersect?: (entry: IntersectionObserverEntry) => void;
|
|
51
|
+
};
|
|
52
|
+
rootMargin?: string;
|
|
53
|
+
}): void;
|
|
54
|
+
|
|
55
|
+
declare function useRawParams(prefix: string, limit?: number): (string | undefined)[];
|
|
56
|
+
|
|
57
|
+
declare function useRouteNormalizer(options: {
|
|
58
|
+
autoReplace: boolean;
|
|
59
|
+
}): {
|
|
60
|
+
pathname: string;
|
|
61
|
+
normalizer: (input: string) => string;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
declare function useScreen(): {
|
|
65
|
+
width: number;
|
|
66
|
+
height: number;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
interface ScreenCallbackValues {
|
|
70
|
+
width: number;
|
|
71
|
+
height: number;
|
|
72
|
+
}
|
|
73
|
+
type Callback = (props: ScreenCallbackValues) => void;
|
|
74
|
+
declare function useScreenCallback(callback: Callback, options?: {
|
|
75
|
+
initialCall?: boolean;
|
|
76
|
+
}): void;
|
|
77
|
+
|
|
78
|
+
declare function useViewport(customCamera?: OrthographicCamera | PerspectiveCamera): {
|
|
79
|
+
width: number;
|
|
80
|
+
height: number;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export { useBreakpoints, useEffectOnce, useLayoutEffectOnce, useLenisCallback, useMouseCallback, useNavigateAnchor, useOrbit, useRawParams, useRouteNormalizer, useScreen, useScreenCallback, useViewport };
|
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { OrthographicCamera, PerspectiveCamera } from 'three';
|
|
3
|
+
|
|
4
|
+
declare function useBreakpoints(breakpoints?: number[] | null): number;
|
|
5
|
+
|
|
6
|
+
declare function useEffectOnce(callback: React.EffectCallback): void;
|
|
7
|
+
declare function useLayoutEffectOnce(callback: React.EffectCallback): void;
|
|
8
|
+
|
|
9
|
+
interface HookOptions$1 {
|
|
10
|
+
/**
|
|
11
|
+
* Hook will report when first initialized without waiting for scroll event to actually happens.
|
|
12
|
+
*/
|
|
13
|
+
initialCall?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Set an element to only call when the element is actually entering the viewport (with 25% `rootMargin`).
|
|
16
|
+
*/
|
|
17
|
+
intersectOn?: RefObject<HTMLOrSVGElement | null>;
|
|
18
|
+
}
|
|
19
|
+
declare const scrollCallbackReason: {
|
|
20
|
+
readonly Resize: "resize";
|
|
21
|
+
readonly Scroll: "scroll";
|
|
22
|
+
readonly Initialize: "initialize";
|
|
23
|
+
};
|
|
24
|
+
type ScrollCallbackReason = (typeof scrollCallbackReason)[keyof typeof scrollCallbackReason];
|
|
25
|
+
type Callback$2 = (latest: number, reason: ScrollCallbackReason) => void;
|
|
26
|
+
declare function useLenisCallback(callback: Callback$2, options?: HookOptions$1): void;
|
|
27
|
+
|
|
28
|
+
interface MousePositionValues {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
}
|
|
32
|
+
interface HookOptions {
|
|
33
|
+
normalized?: boolean;
|
|
34
|
+
}
|
|
35
|
+
type Callback$1 = (latest: MousePositionValues) => void;
|
|
36
|
+
declare function useMouseCallback(callback: Callback$1, options?: HookOptions): void;
|
|
37
|
+
|
|
38
|
+
declare function useNavigateAnchor(onNavigate?: () => void): (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A simple Orbit hook.
|
|
42
|
+
*
|
|
43
|
+
* @param target HTML element ref to attach to.
|
|
44
|
+
* @param events Specify which events should the orbit tracks.
|
|
45
|
+
*/
|
|
46
|
+
declare function useOrbit(options: {
|
|
47
|
+
target?: RefObject<HTMLElement | null>;
|
|
48
|
+
events: {
|
|
49
|
+
onResize?: (entry: ResizeObserverEntry) => void;
|
|
50
|
+
onIntersect?: (entry: IntersectionObserverEntry) => void;
|
|
51
|
+
};
|
|
52
|
+
rootMargin?: string;
|
|
53
|
+
}): void;
|
|
54
|
+
|
|
55
|
+
declare function useRawParams(prefix: string, limit?: number): (string | undefined)[];
|
|
56
|
+
|
|
57
|
+
declare function useRouteNormalizer(options: {
|
|
58
|
+
autoReplace: boolean;
|
|
59
|
+
}): {
|
|
60
|
+
pathname: string;
|
|
61
|
+
normalizer: (input: string) => string;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
declare function useScreen(): {
|
|
65
|
+
width: number;
|
|
66
|
+
height: number;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
interface ScreenCallbackValues {
|
|
70
|
+
width: number;
|
|
71
|
+
height: number;
|
|
72
|
+
}
|
|
73
|
+
type Callback = (props: ScreenCallbackValues) => void;
|
|
74
|
+
declare function useScreenCallback(callback: Callback, options?: {
|
|
75
|
+
initialCall?: boolean;
|
|
76
|
+
}): void;
|
|
77
|
+
|
|
78
|
+
declare function useViewport(customCamera?: OrthographicCamera | PerspectiveCamera): {
|
|
79
|
+
width: number;
|
|
80
|
+
height: number;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export { useBreakpoints, useEffectOnce, useLayoutEffectOnce, useLenisCallback, useMouseCallback, useNavigateAnchor, useOrbit, useRawParams, useRouteNormalizer, useScreen, useScreenCallback, useViewport };
|
package/dist/hooks.js
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/hooks/index.ts
|
|
21
|
+
var hooks_exports = {};
|
|
22
|
+
__export(hooks_exports, {
|
|
23
|
+
useBreakpoints: () => useBreakpoints,
|
|
24
|
+
useEffectOnce: () => useEffectOnce,
|
|
25
|
+
useLayoutEffectOnce: () => useLayoutEffectOnce,
|
|
26
|
+
useLenisCallback: () => useLenisCallback,
|
|
27
|
+
useMouseCallback: () => useMouseCallback,
|
|
28
|
+
useNavigateAnchor: () => useNavigateAnchor,
|
|
29
|
+
useOrbit: () => useOrbit,
|
|
30
|
+
useRawParams: () => useRawParams,
|
|
31
|
+
useRouteNormalizer: () => useRouteNormalizer,
|
|
32
|
+
useScreen: () => useScreen,
|
|
33
|
+
useScreenCallback: () => useScreenCallback,
|
|
34
|
+
useViewport: () => useViewport
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(hooks_exports);
|
|
37
|
+
|
|
38
|
+
// src/hooks/breakpoints.ts
|
|
39
|
+
var import_react2 = require("react");
|
|
40
|
+
|
|
41
|
+
// src/hooks/screenCallback.ts
|
|
42
|
+
var import_react = require("react");
|
|
43
|
+
function useScreenCallback(callback, options) {
|
|
44
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
45
|
+
const reportScreen = () => callback({
|
|
46
|
+
width: document.body.clientWidth,
|
|
47
|
+
height: document.documentElement.clientHeight
|
|
48
|
+
});
|
|
49
|
+
if (options?.initialCall) {
|
|
50
|
+
reportScreen();
|
|
51
|
+
}
|
|
52
|
+
window.addEventListener("resize", reportScreen, { passive: true });
|
|
53
|
+
return () => {
|
|
54
|
+
window.removeEventListener("resize", reportScreen);
|
|
55
|
+
};
|
|
56
|
+
}, [callback, options?.initialCall]);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/hooks/breakpoints.ts
|
|
60
|
+
function useBreakpoints(breakpoints) {
|
|
61
|
+
const getBreakpoint = (0, import_react2.useCallback)(
|
|
62
|
+
(width) => {
|
|
63
|
+
const processingBreakpoints = !breakpoints ? [640, 768, 1024, 1280, 1536] : breakpoints;
|
|
64
|
+
if (!processingBreakpoints) {
|
|
65
|
+
throw Error("Uhhh... so you don't want a breakpoint? Just say it.");
|
|
66
|
+
}
|
|
67
|
+
let result = processingBreakpoints.length;
|
|
68
|
+
for (let index = 0; index < processingBreakpoints.length; index++) {
|
|
69
|
+
if (width < processingBreakpoints[index]) {
|
|
70
|
+
result = index;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
75
|
+
},
|
|
76
|
+
[breakpoints]
|
|
77
|
+
);
|
|
78
|
+
const [breakAt, setBreakAt] = (0, import_react2.useState)(
|
|
79
|
+
getBreakpoint(document.body.clientWidth)
|
|
80
|
+
);
|
|
81
|
+
const breakpointCheck = (0, import_react2.useCallback)(
|
|
82
|
+
(latest) => {
|
|
83
|
+
const result = getBreakpoint(latest.width);
|
|
84
|
+
if (result !== breakAt) {
|
|
85
|
+
setBreakAt(result);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
[breakAt, getBreakpoint]
|
|
89
|
+
);
|
|
90
|
+
useScreenCallback(breakpointCheck);
|
|
91
|
+
return breakAt;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// src/hooks/effectOnce.ts
|
|
95
|
+
var import_react3 = require("react");
|
|
96
|
+
function useEffectOnce(callback) {
|
|
97
|
+
(0, import_react3.useEffect)(callback, []);
|
|
98
|
+
}
|
|
99
|
+
function useLayoutEffectOnce(callback) {
|
|
100
|
+
(0, import_react3.useLayoutEffect)(callback, []);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// src/hooks/lenisCallback.ts
|
|
104
|
+
var import_react5 = require("react");
|
|
105
|
+
|
|
106
|
+
// src/index.ts
|
|
107
|
+
var lenisInstance = void 0;
|
|
108
|
+
|
|
109
|
+
// src/hooks/orbit.ts
|
|
110
|
+
var import_react4 = require("react");
|
|
111
|
+
function useOrbit(options) {
|
|
112
|
+
const { onResize, onIntersect } = options.events;
|
|
113
|
+
const { rootMargin = "25% 0px 25% 0px" } = options;
|
|
114
|
+
(0, import_react4.useLayoutEffect)(() => {
|
|
115
|
+
if (!options.target) return;
|
|
116
|
+
if (!options.target.current) return;
|
|
117
|
+
let orbitResize = void 0;
|
|
118
|
+
if (onResize) {
|
|
119
|
+
orbitResize = new ResizeObserver((entries) => onResize(entries[0]));
|
|
120
|
+
orbitResize.observe(options.target.current);
|
|
121
|
+
}
|
|
122
|
+
let orbitIntersect = void 0;
|
|
123
|
+
if (onIntersect) {
|
|
124
|
+
orbitIntersect = new IntersectionObserver(
|
|
125
|
+
(entries) => onIntersect(entries[0]),
|
|
126
|
+
{ rootMargin }
|
|
127
|
+
);
|
|
128
|
+
orbitIntersect.observe(options.target.current);
|
|
129
|
+
}
|
|
130
|
+
return () => {
|
|
131
|
+
orbitResize?.disconnect();
|
|
132
|
+
orbitIntersect?.disconnect();
|
|
133
|
+
};
|
|
134
|
+
}, [onIntersect, onResize, rootMargin, options.target]);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// src/hooks/lenisCallback.ts
|
|
138
|
+
var scrollCallbackReason = {
|
|
139
|
+
Resize: "resize",
|
|
140
|
+
Scroll: "scroll",
|
|
141
|
+
Initialize: "initialize"
|
|
142
|
+
};
|
|
143
|
+
function useLenisCallback(callback, options) {
|
|
144
|
+
const callbackWrapScroll = (0, import_react5.useCallback)(
|
|
145
|
+
() => callback(lenisInstance.actualScroll, scrollCallbackReason.Scroll),
|
|
146
|
+
[callback]
|
|
147
|
+
);
|
|
148
|
+
const callbackWrapResize = (0, import_react5.useCallback)(
|
|
149
|
+
() => callback(lenisInstance.actualScroll, scrollCallbackReason.Resize),
|
|
150
|
+
[callback]
|
|
151
|
+
);
|
|
152
|
+
const intersectOn = (0, import_react5.useMemo)(
|
|
153
|
+
() => options?.intersectOn,
|
|
154
|
+
[options?.intersectOn]
|
|
155
|
+
);
|
|
156
|
+
const initialCall = (0, import_react5.useMemo)(
|
|
157
|
+
() => options?.initialCall,
|
|
158
|
+
[options?.initialCall]
|
|
159
|
+
);
|
|
160
|
+
useOrbit({
|
|
161
|
+
target: intersectOn,
|
|
162
|
+
events: {
|
|
163
|
+
onIntersect(entry) {
|
|
164
|
+
if (entry.isIntersecting) {
|
|
165
|
+
lenisInstance.on("scroll", callbackWrapScroll);
|
|
166
|
+
window.addEventListener("resize", callbackWrapResize);
|
|
167
|
+
} else {
|
|
168
|
+
lenisInstance.off("scroll", callbackWrapScroll);
|
|
169
|
+
window.removeEventListener("resize", callbackWrapResize);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
rootMargin: "50% 0px 50% 0px"
|
|
174
|
+
});
|
|
175
|
+
(0, import_react5.useLayoutEffect)(() => {
|
|
176
|
+
if (!intersectOn) {
|
|
177
|
+
lenisInstance.on("scroll", callbackWrapScroll);
|
|
178
|
+
window.addEventListener("resize", callbackWrapResize);
|
|
179
|
+
}
|
|
180
|
+
if (initialCall) {
|
|
181
|
+
callback(lenisInstance.actualScroll, scrollCallbackReason.Initialize);
|
|
182
|
+
}
|
|
183
|
+
return () => {
|
|
184
|
+
lenisInstance.off("scroll", callbackWrapScroll);
|
|
185
|
+
window.removeEventListener("resize", callbackWrapResize);
|
|
186
|
+
};
|
|
187
|
+
}, [
|
|
188
|
+
callback,
|
|
189
|
+
callbackWrapResize,
|
|
190
|
+
callbackWrapScroll,
|
|
191
|
+
initialCall,
|
|
192
|
+
intersectOn
|
|
193
|
+
]);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// src/hooks/mouseCallback.ts
|
|
197
|
+
var import_react6 = require("react");
|
|
198
|
+
var MouseEventDistributor = class {
|
|
199
|
+
callbacks = /* @__PURE__ */ new Map();
|
|
200
|
+
eventRegistered = false;
|
|
201
|
+
constructor() {
|
|
202
|
+
if (this.eventRegistered) return;
|
|
203
|
+
window.addEventListener("pointermove", this.callbackLoop.bind(this), {
|
|
204
|
+
passive: true
|
|
205
|
+
});
|
|
206
|
+
this.eventRegistered = true;
|
|
207
|
+
}
|
|
208
|
+
addCallbackLoop(id, callback, options) {
|
|
209
|
+
this.callbacks.set(id, { callback, options });
|
|
210
|
+
}
|
|
211
|
+
removeCallbackLoop(id) {
|
|
212
|
+
this.callbacks.delete(id);
|
|
213
|
+
}
|
|
214
|
+
processEvent(event) {
|
|
215
|
+
const mouse = {
|
|
216
|
+
x: event.clientX,
|
|
217
|
+
y: event.clientY
|
|
218
|
+
};
|
|
219
|
+
const mouseNormalized = {
|
|
220
|
+
x: mouse.x / (document.body.clientWidth / 2) - 1,
|
|
221
|
+
y: mouse.y / (document.documentElement.clientHeight / 2) - 1
|
|
222
|
+
};
|
|
223
|
+
return [mouse, mouseNormalized];
|
|
224
|
+
}
|
|
225
|
+
callbackLoop(event) {
|
|
226
|
+
if (event.pointerType !== "mouse") return;
|
|
227
|
+
const callbacks = this.callbacks.entries();
|
|
228
|
+
const [mouse, mouseNormalized] = this.processEvent(event);
|
|
229
|
+
let inspecting = callbacks.next().value;
|
|
230
|
+
while (inspecting) {
|
|
231
|
+
if (inspecting[1].options.normalized) {
|
|
232
|
+
inspecting[1].callback(mouseNormalized);
|
|
233
|
+
} else {
|
|
234
|
+
inspecting[1].callback(mouse);
|
|
235
|
+
}
|
|
236
|
+
inspecting = callbacks.next().value;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
var distributor = new MouseEventDistributor();
|
|
241
|
+
function useMouseCallback(callback, options = {
|
|
242
|
+
normalized: true
|
|
243
|
+
}) {
|
|
244
|
+
const id = (0, import_react6.useId)();
|
|
245
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
246
|
+
distributor.addCallbackLoop(id, callback, options);
|
|
247
|
+
return () => {
|
|
248
|
+
distributor.removeCallbackLoop(id);
|
|
249
|
+
};
|
|
250
|
+
}, [callback, id, options]);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// src/hooks/navigateAnchor.ts
|
|
254
|
+
var import_react7 = require("react");
|
|
255
|
+
var import_react_router = require("react-router");
|
|
256
|
+
function useNavigateAnchor(onNavigate) {
|
|
257
|
+
const navigate = (0, import_react_router.useNavigate)();
|
|
258
|
+
return (0, import_react7.useCallback)(
|
|
259
|
+
(event) => {
|
|
260
|
+
event.preventDefault();
|
|
261
|
+
const href = event.currentTarget.getAttribute("href");
|
|
262
|
+
if (href) {
|
|
263
|
+
if (onNavigate) {
|
|
264
|
+
onNavigate();
|
|
265
|
+
}
|
|
266
|
+
if (href !== window.location.pathname) {
|
|
267
|
+
navigate(event.currentTarget.getAttribute("href") ?? "");
|
|
268
|
+
} else {
|
|
269
|
+
lenisInstance.scrollTo(0, { duration: 2 });
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
[onNavigate, navigate]
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// src/hooks/rawParams.ts
|
|
278
|
+
var import_react_router2 = require("react-router");
|
|
279
|
+
function useRawParams(prefix, limit) {
|
|
280
|
+
const { pathname } = (0, import_react_router2.useLocation)();
|
|
281
|
+
const prefixedPath = pathname.replace(new RegExp(prefix), "");
|
|
282
|
+
if (prefixedPath === pathname) {
|
|
283
|
+
return [];
|
|
284
|
+
}
|
|
285
|
+
return prefixedPath.split("/").filter((param) => param !== "").slice(limit);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// src/hooks/routeNormalizer.ts
|
|
289
|
+
var import_react8 = require("react");
|
|
290
|
+
var import_react_router3 = require("react-router");
|
|
291
|
+
function useRouteNormalizer(options) {
|
|
292
|
+
const { pathname } = (0, import_react_router3.useLocation)();
|
|
293
|
+
const navigate = (0, import_react_router3.useNavigate)();
|
|
294
|
+
const normalizer = (0, import_react8.useCallback)(
|
|
295
|
+
(input) => input.replace(/\/+\//g, () => "/"),
|
|
296
|
+
[]
|
|
297
|
+
);
|
|
298
|
+
(0, import_react8.useLayoutEffect)(() => {
|
|
299
|
+
const result = normalizer(pathname);
|
|
300
|
+
if (options.autoReplace && result !== pathname) {
|
|
301
|
+
window.location.replace(result);
|
|
302
|
+
}
|
|
303
|
+
}, [options.autoReplace, pathname, navigate, normalizer]);
|
|
304
|
+
return {
|
|
305
|
+
pathname,
|
|
306
|
+
normalizer
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// src/hooks/screen.ts
|
|
311
|
+
var import_react9 = require("react");
|
|
312
|
+
function useScreen() {
|
|
313
|
+
const [width, setWidth] = (0, import_react9.useState)(document.body.clientWidth);
|
|
314
|
+
const [height, setHeight] = (0, import_react9.useState)(document.documentElement.clientHeight);
|
|
315
|
+
const setScreen = (0, import_react9.useCallback)(() => {
|
|
316
|
+
setWidth(document.body.clientWidth);
|
|
317
|
+
setHeight(document.documentElement.clientHeight);
|
|
318
|
+
}, []);
|
|
319
|
+
(0, import_react9.useLayoutEffect)(() => {
|
|
320
|
+
window.addEventListener("resize", setScreen, { passive: true });
|
|
321
|
+
return () => {
|
|
322
|
+
window.removeEventListener("resize", setScreen);
|
|
323
|
+
};
|
|
324
|
+
}, [setScreen]);
|
|
325
|
+
return { width, height };
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// src/hooks/viewport.ts
|
|
329
|
+
var import_fiber = require("@react-three/fiber");
|
|
330
|
+
var import_react10 = require("react");
|
|
331
|
+
function useViewport(customCamera) {
|
|
332
|
+
const { viewport, camera } = (0, import_fiber.useThree)();
|
|
333
|
+
const [width, setWidth] = (0, import_react10.useState)(viewport.getCurrentViewport().width);
|
|
334
|
+
const [height, setHeight] = (0, import_react10.useState)(viewport.getCurrentViewport().height);
|
|
335
|
+
const viewportUpdate = (0, import_react10.useCallback)(() => {
|
|
336
|
+
const actualViewport = viewport.getCurrentViewport(customCamera ?? camera);
|
|
337
|
+
setWidth(actualViewport.width);
|
|
338
|
+
setHeight(actualViewport.height);
|
|
339
|
+
}, [camera, customCamera, viewport]);
|
|
340
|
+
useScreenCallback(viewportUpdate);
|
|
341
|
+
return { width, height };
|
|
342
|
+
}
|
|
343
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
344
|
+
0 && (module.exports = {
|
|
345
|
+
useBreakpoints,
|
|
346
|
+
useEffectOnce,
|
|
347
|
+
useLayoutEffectOnce,
|
|
348
|
+
useLenisCallback,
|
|
349
|
+
useMouseCallback,
|
|
350
|
+
useNavigateAnchor,
|
|
351
|
+
useOrbit,
|
|
352
|
+
useRawParams,
|
|
353
|
+
useRouteNormalizer,
|
|
354
|
+
useScreen,
|
|
355
|
+
useScreenCallback,
|
|
356
|
+
useViewport
|
|
357
|
+
});
|
|
358
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/index.ts","../src/hooks/breakpoints.ts","../src/hooks/screenCallback.ts","../src/hooks/effectOnce.ts","../src/hooks/lenisCallback.ts","../src/index.ts","../src/hooks/orbit.ts","../src/hooks/mouseCallback.ts","../src/hooks/navigateAnchor.ts","../src/hooks/rawParams.ts","../src/hooks/routeNormalizer.ts","../src/hooks/screen.ts","../src/hooks/viewport.ts"],"sourcesContent":["import { useBreakpoints } from './breakpoints';\nimport { useEffectOnce, useLayoutEffectOnce } from './effectOnce';\nimport { useLenisCallback } from './lenisCallback';\nimport { useMouseCallback } from './mouseCallback';\nimport { useNavigateAnchor } from './navigateAnchor';\nimport { useOrbit } from './orbit';\nimport { useRawParams } from './rawParams';\nimport { useRouteNormalizer } from './routeNormalizer';\nimport { useScreen } from './screen';\nimport { useScreenCallback } from './screenCallback';\nimport { useViewport } from './viewport';\n\nexport {\n useBreakpoints,\n useEffectOnce,\n useLayoutEffectOnce,\n useLenisCallback,\n useMouseCallback,\n useNavigateAnchor,\n useOrbit,\n useRawParams,\n useRouteNormalizer,\n useScreen,\n useScreenCallback,\n useViewport,\n};\n","import { useCallback, useState } from 'react';\nimport { useScreenCallback } from './screenCallback';\n\nexport function useBreakpoints(breakpoints?: number[] | null) {\n const getBreakpoint = useCallback(\n (width: number) => {\n const processingBreakpoints = !breakpoints\n ? [640, 768, 1024, 1280, 1536]\n : breakpoints;\n\n if (!processingBreakpoints) {\n throw Error(\"Uhhh... so you don't want a breakpoint? Just say it.\");\n }\n\n let result = processingBreakpoints!.length;\n for (let index = 0; index < processingBreakpoints!.length; index++) {\n if (width < processingBreakpoints![index]) {\n result = index;\n break;\n }\n }\n\n return result;\n },\n [breakpoints]\n );\n\n const [breakAt, setBreakAt] = useState<number>(\n getBreakpoint(document.body.clientWidth)\n );\n\n const breakpointCheck = useCallback(\n (latest: { width: number; height: number }) => {\n const result = getBreakpoint(latest.width);\n if (result !== breakAt) {\n setBreakAt(result);\n }\n },\n [breakAt, getBreakpoint]\n );\n useScreenCallback(breakpointCheck);\n\n return breakAt;\n}\n","import { useLayoutEffect } from 'react';\n\nexport interface ScreenCallbackValues {\n width: number;\n height: number;\n}\n\ntype Callback = (props: ScreenCallbackValues) => void;\n\nexport function useScreenCallback(\n callback: Callback,\n options?: { initialCall?: boolean }\n) {\n useLayoutEffect(() => {\n const reportScreen = () =>\n callback({\n width: document.body.clientWidth,\n height: document.documentElement.clientHeight,\n });\n\n // Call it first time when the hook was initialized.\n if (options?.initialCall) {\n reportScreen();\n }\n\n window.addEventListener('resize', reportScreen, { passive: true });\n\n return () => {\n window.removeEventListener('resize', reportScreen);\n };\n }, [callback, options?.initialCall]);\n}\n","import { useEffect, useLayoutEffect } from 'react';\n\nexport function useEffectOnce(callback: React.EffectCallback) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(callback, []);\n}\n\nexport function useLayoutEffectOnce(callback: React.EffectCallback) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(callback, []);\n}\n","import { type RefObject, useCallback, useLayoutEffect, useMemo } from 'react';\nimport { lenisInstance } from '..';\nimport { useOrbit } from './orbit';\n\ninterface HookOptions {\n /**\n * Hook will report when first initialized without waiting for scroll event to actually happens.\n */\n initialCall?: boolean;\n /**\n * Set an element to only call when the element is actually entering the viewport (with 25% `rootMargin`).\n */\n intersectOn?: RefObject<HTMLOrSVGElement | null>;\n}\n\nexport const scrollCallbackReason = {\n Resize: 'resize',\n Scroll: 'scroll',\n Initialize: 'initialize',\n} as const;\nexport type ScrollCallbackReason =\n (typeof scrollCallbackReason)[keyof typeof scrollCallbackReason];\n\ntype Callback = (latest: number, reason: ScrollCallbackReason) => void;\n\nexport function useLenisCallback(callback: Callback, options?: HookOptions) {\n const callbackWrapScroll = useCallback(\n () => callback(lenisInstance!.actualScroll, scrollCallbackReason.Scroll),\n [callback]\n );\n const callbackWrapResize = useCallback(\n () => callback(lenisInstance!.actualScroll, scrollCallbackReason.Resize),\n [callback]\n );\n\n const intersectOn = useMemo(\n () => options?.intersectOn,\n [options?.intersectOn]\n );\n const initialCall = useMemo(\n () => options?.initialCall,\n [options?.initialCall]\n );\n\n useOrbit({\n target: intersectOn as RefObject<HTMLElement | null> | undefined,\n events: {\n onIntersect(entry) {\n if (entry.isIntersecting) {\n lenisInstance!.on('scroll', callbackWrapScroll);\n window.addEventListener('resize', callbackWrapResize);\n } else {\n lenisInstance!.off('scroll', callbackWrapScroll);\n window.removeEventListener('resize', callbackWrapResize);\n }\n },\n },\n rootMargin: '50% 0px 50% 0px',\n });\n\n useLayoutEffect(() => {\n if (!intersectOn) {\n lenisInstance!.on('scroll', callbackWrapScroll);\n window.addEventListener('resize', callbackWrapResize);\n }\n\n if (initialCall) {\n callback(lenisInstance!.actualScroll, scrollCallbackReason.Initialize);\n }\n\n return () => {\n lenisInstance!.off('scroll', callbackWrapScroll);\n window.removeEventListener('resize', callbackWrapResize);\n };\n }, [\n callback,\n callbackWrapResize,\n callbackWrapScroll,\n initialCall,\n intersectOn,\n ]);\n}\n","import Lenis from 'lenis';\nimport { ReactNode } from 'react';\n\nexport let lenisInstance: Lenis | undefined = undefined;\n\nexport type BasicTunnelIn = ({ children }: { children: ReactNode }) => null;\nexport let Default3DTunnelIn: BasicTunnelIn | undefined = undefined;\n\nexport const weaverSetup = {\n setLenisInstance(instance: Lenis) {\n lenisInstance = instance;\n },\n set3DTunnel(tunnelIn: BasicTunnelIn) {\n Default3DTunnelIn = tunnelIn;\n },\n};\n","import { type RefObject, useLayoutEffect } from 'react';\n\n/**\n * A simple Orbit hook.\n *\n * @param target HTML element ref to attach to.\n * @param events Specify which events should the orbit tracks.\n */\nexport function useOrbit(options: {\n target?: RefObject<HTMLElement | null>;\n events: {\n onResize?: (entry: ResizeObserverEntry) => void;\n onIntersect?: (entry: IntersectionObserverEntry) => void;\n };\n rootMargin?: string;\n}) {\n const { onResize, onIntersect } = options.events;\n const { rootMargin = '25% 0px 25% 0px' } = options;\n\n useLayoutEffect(() => {\n if (!options.target) return;\n if (!options.target.current) return;\n\n let orbitResize = undefined;\n if (onResize) {\n orbitResize = new ResizeObserver((entries) => onResize(entries[0]));\n orbitResize.observe(options.target.current);\n }\n let orbitIntersect = undefined;\n if (onIntersect) {\n orbitIntersect = new IntersectionObserver(\n (entries) => onIntersect(entries[0]),\n { rootMargin }\n );\n orbitIntersect.observe(options.target.current);\n }\n\n return () => {\n orbitResize?.disconnect();\n orbitIntersect?.disconnect();\n };\n }, [onIntersect, onResize, rootMargin, options.target]);\n}\n","import { useId, useLayoutEffect } from 'react';\n\nexport interface MousePositionValues {\n x: number;\n y: number;\n}\n\ninterface MouseCallback {\n callback: (latest: MousePositionValues) => void;\n options: HookOptions;\n}\n\ninterface HookOptions {\n normalized?: boolean;\n}\n\ntype Callback = (latest: MousePositionValues) => void;\n\nclass MouseEventDistributor {\n private callbacks = new Map<string, MouseCallback>();\n private eventRegistered = false;\n\n constructor() {\n if (this.eventRegistered) return;\n\n window.addEventListener('pointermove', this.callbackLoop.bind(this), {\n passive: true,\n });\n\n this.eventRegistered = true;\n }\n\n addCallbackLoop(\n id: string,\n callback: (latest: MousePositionValues) => void,\n options: HookOptions\n ) {\n this.callbacks.set(id, { callback, options });\n }\n\n removeCallbackLoop(id: string) {\n this.callbacks.delete(id);\n }\n\n private processEvent(event: PointerEvent) {\n const mouse = {\n x: event.clientX,\n y: event.clientY,\n };\n const mouseNormalized = {\n x: mouse.x / (document.body.clientWidth / 2) - 1,\n y: mouse.y / (document.documentElement.clientHeight / 2) - 1,\n };\n\n return [mouse, mouseNormalized];\n }\n\n private callbackLoop(event: PointerEvent) {\n if (event.pointerType !== 'mouse') return;\n\n const callbacks = this.callbacks.entries();\n const [mouse, mouseNormalized] = this.processEvent(event);\n\n let inspecting = callbacks.next().value;\n while (inspecting) {\n if (inspecting[1].options.normalized) {\n inspecting[1].callback(mouseNormalized);\n } else {\n inspecting[1].callback(mouse);\n }\n\n inspecting = callbacks.next().value;\n }\n }\n}\n\nconst distributor = new MouseEventDistributor();\n\nexport function useMouseCallback(\n callback: Callback,\n options: HookOptions = {\n normalized: true,\n }\n) {\n const id = useId();\n\n useLayoutEffect(() => {\n distributor.addCallbackLoop(id, callback, options);\n\n return () => {\n distributor.removeCallbackLoop(id);\n };\n }, [callback, id, options]);\n}\n","import { useCallback } from 'react';\nimport { useNavigate } from 'react-router';\nimport { lenisInstance } from '..';\n\nexport function useNavigateAnchor(onNavigate?: () => void) {\n const navigate = useNavigate();\n\n return useCallback(\n (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {\n event.preventDefault();\n const href = event.currentTarget.getAttribute('href');\n if (href) {\n if (onNavigate) {\n onNavigate();\n }\n\n if (href !== window.location.pathname) {\n navigate(event.currentTarget.getAttribute('href') ?? '');\n } else {\n lenisInstance!.scrollTo(0, { duration: 2 });\n }\n }\n },\n [onNavigate, navigate]\n );\n}\n","import { useLocation } from 'react-router';\n\nexport function useRawParams(\n prefix: string,\n limit?: number\n): (string | undefined)[] {\n const { pathname } = useLocation();\n\n const prefixedPath = pathname.replace(new RegExp(prefix), '');\n if (prefixedPath === pathname) {\n return [];\n }\n\n return prefixedPath\n .split('/')\n .filter((param) => param !== '')\n .slice(limit);\n}\n","import { useCallback, useLayoutEffect } from 'react';\nimport { useLocation, useNavigate } from 'react-router';\n\nexport function useRouteNormalizer(options: { autoReplace: boolean }) {\n const { pathname } = useLocation();\n const navigate = useNavigate();\n\n const normalizer = useCallback(\n (input: string) => input.replace(/\\/+\\//g, () => '/'),\n []\n );\n\n useLayoutEffect(() => {\n const result = normalizer(pathname);\n if (options.autoReplace && result !== pathname) {\n window.location.replace(result);\n }\n }, [options.autoReplace, pathname, navigate, normalizer]);\n\n return {\n pathname,\n normalizer,\n };\n}\n","import { useCallback, useLayoutEffect, useState } from 'react';\n\nexport function useScreen() {\n const [width, setWidth] = useState(document.body.clientWidth);\n const [height, setHeight] = useState(document.documentElement.clientHeight);\n\n const setScreen = useCallback(() => {\n setWidth(document.body.clientWidth);\n setHeight(document.documentElement.clientHeight);\n }, []);\n\n useLayoutEffect(() => {\n window.addEventListener('resize', setScreen, { passive: true });\n\n return () => {\n window.removeEventListener('resize', setScreen);\n };\n }, [setScreen]);\n\n return { width: width, height: height };\n}\n","import { useThree } from '@react-three/fiber';\nimport { useCallback, useState } from 'react';\nimport { OrthographicCamera, PerspectiveCamera } from 'three';\nimport { useScreenCallback } from './screenCallback';\n\nexport function useViewport(\n customCamera?: OrthographicCamera | PerspectiveCamera\n) {\n const { viewport, camera } = useThree();\n\n const [width, setWidth] = useState(viewport.getCurrentViewport().width);\n const [height, setHeight] = useState(viewport.getCurrentViewport().height);\n\n const viewportUpdate = useCallback(() => {\n const actualViewport = viewport.getCurrentViewport(customCamera ?? camera);\n setWidth(actualViewport.width);\n setHeight(actualViewport.height);\n }, [camera, customCamera, viewport]);\n useScreenCallback(viewportUpdate);\n\n return { width: width, height: height };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAsC;;;ACAtC,mBAAgC;AASzB,SAAS,kBACd,UACA,SACA;AACA,oCAAgB,MAAM;AACpB,UAAM,eAAe,MACnB,SAAS;AAAA,MACP,OAAO,SAAS,KAAK;AAAA,MACrB,QAAQ,SAAS,gBAAgB;AAAA,IACnC,CAAC;AAGH,QAAI,SAAS,aAAa;AACxB,mBAAa;AAAA,IACf;AAEA,WAAO,iBAAiB,UAAU,cAAc,EAAE,SAAS,KAAK,CAAC;AAEjE,WAAO,MAAM;AACX,aAAO,oBAAoB,UAAU,YAAY;AAAA,IACnD;AAAA,EACF,GAAG,CAAC,UAAU,SAAS,WAAW,CAAC;AACrC;;;AD5BO,SAAS,eAAe,aAA+B;AAC5D,QAAM,oBAAgB;AAAA,IACpB,CAAC,UAAkB;AACjB,YAAM,wBAAwB,CAAC,cAC3B,CAAC,KAAK,KAAK,MAAM,MAAM,IAAI,IAC3B;AAEJ,UAAI,CAAC,uBAAuB;AAC1B,cAAM,MAAM,sDAAsD;AAAA,MACpE;AAEA,UAAI,SAAS,sBAAuB;AACpC,eAAS,QAAQ,GAAG,QAAQ,sBAAuB,QAAQ,SAAS;AAClE,YAAI,QAAQ,sBAAuB,KAAK,GAAG;AACzC,mBAAS;AACT;AAAA,QACF;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAA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AAe;AACxC;","names":["import_react","import_react","import_react","import_react","import_react","import_react","import_react_router","import_react","import_react_router","import_react","import_react"]}
|