@xwadex/fesd-next 0.3.4-7.2 → 0.3.4-7.21
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/components/anchors/anchors.d.ts +14 -0
- package/dist/components/anchors/anchors.js +24 -0
- package/dist/components/anchors/index.d.ts +1 -0
- package/dist/components/anchors/index.js +1 -0
- package/dist/components/embla-carousels/embla-carousels-hooks.d.ts +36 -0
- package/dist/components/embla-carousels/embla-carousels-hooks.js +84 -0
- package/dist/components/embla-carousels/embla-carousels.d.ts +23 -0
- package/dist/components/embla-carousels/embla-carousels.js +59 -0
- package/dist/components/embla-carousels/index.d.ts +2 -0
- package/dist/components/embla-carousels/index.js +2 -0
- package/dist/components/index.d.ts +5 -2
- package/dist/components/index.js +5 -2
- package/dist/components/puck-contents/-heading-block.d.ts +13 -0
- package/dist/components/puck-contents/-heading-block.js +77 -0
- package/dist/components/puck-contents/-media-content.d.ts +7 -0
- package/dist/components/puck-contents/-media-content.js +22 -0
- package/dist/components/puck-contents/-text-content.d.ts +13 -0
- package/dist/components/puck-contents/-text-content.js +148 -0
- package/dist/components/puck-contents/index.d.ts +2 -0
- package/dist/components/puck-contents/index.js +2 -0
- package/dist/components/puck-contents/puck-configs.d.ts +14 -0
- package/dist/components/puck-contents/puck-configs.js +65 -0
- package/dist/components/puck-contents/puck-contents-editor.d.ts +5 -0
- package/dist/components/puck-contents/puck-contents-editor.js +27 -0
- package/dist/components/puck-contents/puck-contents-rander.d.ts +5 -0
- package/dist/components/puck-contents/puck-contents-rander.js +14 -0
- package/dist/components/puck-contents/puck-inital-datas.d.ts +46 -0
- package/dist/components/puck-contents/puck-inital-datas.js +92 -0
- package/dist/components/scroll-containers/index.d.ts +3 -0
- package/dist/components/scroll-containers/index.js +3 -0
- package/dist/components/scroll-containers/lenis-scroll.d.ts +20 -0
- package/dist/components/scroll-containers/lenis-scroll.js +66 -0
- package/dist/components/scroll-containers/native-scroll.d.ts +6 -0
- package/dist/components/scroll-containers/native-scroll.js +24 -0
- package/dist/components/scroll-containers/scroll-containers.d.ts +25 -0
- package/dist/components/scroll-containers/scroll-containers.js +47 -0
- package/dist/components/tests/index.d.ts +1 -0
- package/dist/components/tests/index.js +1 -0
- package/dist/components/tests/tests.d.ts +4 -0
- package/dist/components/tests/tests.js +10 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useAnchors.d.ts +48 -33
- package/dist/hooks/useAnchors.js +181 -98
- package/dist/hooks/useHash.d.ts +1 -0
- package/dist/hooks/useHash.js +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/shadcns/components/ui/accordion.d.ts +7 -0
- package/dist/shadcns/components/ui/accordion.js +18 -0
- package/dist/shadcns/components/ui/alert-dialog.d.ts +14 -0
- package/dist/shadcns/components/ui/alert-dialog.js +38 -0
- package/dist/shadcns/components/ui/alert.d.ts +9 -0
- package/dist/shadcns/components/ui/alert.js +25 -0
- package/dist/shadcns/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/shadcns/components/ui/aspect-ratio.js +7 -0
- package/dist/shadcns/components/ui/avatar.d.ts +6 -0
- package/dist/shadcns/components/ui/avatar.js +14 -0
- package/dist/shadcns/components/ui/badge.d.ts +9 -0
- package/dist/shadcns/components/ui/badge.js +23 -0
- package/dist/shadcns/components/ui/breadcrumb.d.ts +11 -0
- package/dist/shadcns/components/ui/breadcrumb.js +27 -0
- package/dist/shadcns/components/ui/button-group.d.ts +11 -0
- package/dist/shadcns/components/ui/button-group.js +26 -0
- package/dist/shadcns/components/ui/button.d.ts +10 -0
- package/dist/shadcns/components/ui/button.js +32 -0
- package/dist/shadcns/components/ui/calendar.d.ts +8 -0
- package/dist/shadcns/components/ui/calendar.js +73 -0
- package/dist/shadcns/components/ui/card.d.ts +9 -0
- package/dist/shadcns/components/ui/card.js +25 -0
- package/dist/shadcns/components/ui/carousel.d.ts +19 -0
- package/dist/shadcns/components/ui/carousel.js +91 -0
- package/dist/shadcns/components/ui/chart.d.ts +40 -0
- package/dist/shadcns/components/ui/chart.js +114 -0
- package/dist/shadcns/components/ui/checkbox.d.ts +4 -0
- package/dist/shadcns/components/ui/checkbox.js +9 -0
- package/dist/shadcns/components/ui/collapsible.d.ts +5 -0
- package/dist/shadcns/components/ui/collapsible.js +13 -0
- package/dist/shadcns/components/ui/command.d.ts +18 -0
- package/dist/shadcns/components/ui/command.js +33 -0
- package/dist/shadcns/components/ui/context-menu.d.ts +25 -0
- package/dist/shadcns/components/ui/context-menu.js +51 -0
- package/dist/shadcns/components/ui/dialog.d.ts +15 -0
- package/dist/shadcns/components/ui/dialog.js +36 -0
- package/dist/shadcns/components/ui/drawer.d.ts +13 -0
- package/dist/shadcns/components/ui/drawer.js +35 -0
- package/dist/shadcns/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/shadcns/components/ui/dropdown-menu.js +51 -0
- package/dist/shadcns/components/ui/field.d.ts +24 -0
- package/dist/shadcns/components/ui/field.js +76 -0
- package/dist/shadcns/components/ui/form.d.ts +24 -0
- package/dist/shadcns/components/ui/form.js +56 -0
- package/dist/shadcns/components/ui/hover-card.d.ts +6 -0
- package/dist/shadcns/components/ui/hover-card.js +14 -0
- package/dist/shadcns/components/ui/input-otp.d.ts +11 -0
- package/dist/shadcns/components/ui/input-otp.js +21 -0
- package/dist/shadcns/components/ui/input.d.ts +3 -0
- package/dist/shadcns/components/ui/input.js +6 -0
- package/dist/shadcns/components/ui/item.d.ts +23 -0
- package/dist/shadcns/components/ui/item.js +65 -0
- package/dist/shadcns/components/ui/label.d.ts +4 -0
- package/dist/shadcns/components/ui/label.js +8 -0
- package/dist/shadcns/components/ui/menubar.d.ts +26 -0
- package/dist/shadcns/components/ui/menubar.js +54 -0
- package/dist/shadcns/components/ui/native-select.d.ts +7 -0
- package/dist/shadcns/components/ui/native-select.js +13 -0
- package/dist/shadcns/components/ui/navigation-menu.d.ts +14 -0
- package/dist/shadcns/components/ui/navigation-menu.js +32 -0
- package/dist/shadcns/components/ui/pagination.d.ts +13 -0
- package/dist/shadcns/components/ui/pagination.js +28 -0
- package/dist/shadcns/components/ui/popover.d.ts +7 -0
- package/dist/shadcns/components/ui/popover.js +17 -0
- package/dist/shadcns/components/ui/progress.d.ts +4 -0
- package/dist/shadcns/components/ui/progress.js +8 -0
- package/dist/shadcns/components/ui/radio-group.d.ts +5 -0
- package/dist/shadcns/components/ui/radio-group.js +12 -0
- package/dist/shadcns/components/ui/resizable.d.ts +8 -0
- package/dist/shadcns/components/ui/resizable.js +15 -0
- package/dist/shadcns/components/ui/scroll-area.d.ts +5 -0
- package/dist/shadcns/components/ui/scroll-area.js +11 -0
- package/dist/shadcns/components/ui/select.d.ts +15 -0
- package/dist/shadcns/components/ui/select.js +38 -0
- package/dist/shadcns/components/ui/separator.d.ts +4 -0
- package/dist/shadcns/components/ui/separator.js +8 -0
- package/dist/shadcns/components/ui/sheet.d.ts +13 -0
- package/dist/shadcns/components/ui/sheet.js +40 -0
- package/dist/shadcns/components/ui/sidebar.d.ts +66 -0
- package/dist/shadcns/components/ui/sidebar.js +204 -0
- package/dist/shadcns/components/ui/skeleton.d.ts +2 -0
- package/dist/shadcns/components/ui/skeleton.js +6 -0
- package/dist/shadcns/components/ui/slider.d.ts +4 -0
- package/dist/shadcns/components/ui/slider.js +10 -0
- package/dist/shadcns/components/ui/sonner.d.ts +3 -0
- package/dist/shadcns/components/ui/sonner.js +13 -0
- package/dist/shadcns/components/ui/switch.d.ts +4 -0
- package/dist/shadcns/components/ui/switch.js +8 -0
- package/dist/shadcns/components/ui/table.d.ts +10 -0
- package/dist/shadcns/components/ui/table.js +28 -0
- package/dist/shadcns/components/ui/tabs.d.ts +7 -0
- package/dist/shadcns/components/ui/tabs.js +17 -0
- package/dist/shadcns/components/ui/textarea.d.ts +3 -0
- package/dist/shadcns/components/ui/textarea.js +7 -0
- package/dist/shadcns/components/ui/toggle-group.d.ts +7 -0
- package/dist/shadcns/components/ui/toggle-group.js +20 -0
- package/dist/shadcns/components/ui/toggle.d.ts +9 -0
- package/dist/shadcns/components/ui/toggle.js +26 -0
- package/dist/shadcns/components/ui/tooltip.d.ts +7 -0
- package/dist/shadcns/components/ui/tooltip.js +17 -0
- package/dist/{hooks/useIsMobile.js → shadcns/hooks/use-mobile.js} +5 -6
- package/dist/shadcns/index.d.ts +48 -0
- package/dist/shadcns/index.js +48 -0
- package/dist/shadcns/lib/utils.d.ts +2 -0
- package/dist/shadcns/lib/utils.js +5 -0
- package/dist/types/shadcns.type.d.ts +0 -1
- package/dist/types/shadcns.type.js +1 -0
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -5
- package/package.json +6 -2
- package/dist/components/TestComponent.d.ts +0 -4
- package/dist/components/TestComponent.js +0 -10
- /package/dist/{hooks/useIsMobile.d.ts → shadcns/hooks/use-mobile.d.ts} +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Puck } from "@puckeditor/core";
|
|
4
|
+
import { editorConfig, editorConfigOverrides } from "./puck-configs";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { useRouter } from "next/navigation";
|
|
7
|
+
const PuckContentsEditor = ({ previewRoute = "/puck/previews" }) => {
|
|
8
|
+
const [state, setstate] = useState({});
|
|
9
|
+
const router = useRouter();
|
|
10
|
+
const save = (data) => {
|
|
11
|
+
console.log(data);
|
|
12
|
+
setstate(prev => ({ ...prev, data }));
|
|
13
|
+
router.push(`${previewRoute ?? "/previews"}?data=` + JSON.stringify(data));
|
|
14
|
+
};
|
|
15
|
+
return (_jsx(Puck, { config: editorConfig, data: {}, onPublish: save, overrides: editorConfigOverrides, height: "100%",
|
|
16
|
+
// _experimentalFullScreenCanvas
|
|
17
|
+
plugins: [
|
|
18
|
+
// headingAnalyzer,
|
|
19
|
+
// MyPlugin,
|
|
20
|
+
// outline,
|
|
21
|
+
// blocks,
|
|
22
|
+
// legacySideBar,
|
|
23
|
+
// fields
|
|
24
|
+
] }));
|
|
25
|
+
};
|
|
26
|
+
PuckContentsEditor.displayName = "PuckContentsEditor";
|
|
27
|
+
export default PuckContentsEditor;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Render } from "@puckeditor/core";
|
|
4
|
+
import { renderConfig } from "./puck-configs";
|
|
5
|
+
import { initialData } from "./puck-inital-datas";
|
|
6
|
+
import { useEffect } from "react";
|
|
7
|
+
const PuckContentsRander = ({ datas }) => {
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
console.log(datas);
|
|
10
|
+
}, [datas]);
|
|
11
|
+
return (_jsx(Render, { "data-id": "wade", config: renderConfig, data: datas ?? initialData }));
|
|
12
|
+
};
|
|
13
|
+
PuckContentsRander.displayName = "PuckContentsRander";
|
|
14
|
+
export default PuckContentsRander;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const initialData: {
|
|
2
|
+
root: {
|
|
3
|
+
props: {
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
content: never[];
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
content: {
|
|
10
|
+
type: string;
|
|
11
|
+
props: {
|
|
12
|
+
mediaBlock: {
|
|
13
|
+
type: string;
|
|
14
|
+
props: {
|
|
15
|
+
id: string;
|
|
16
|
+
imgs: string;
|
|
17
|
+
alt: string;
|
|
18
|
+
};
|
|
19
|
+
}[];
|
|
20
|
+
textBlock: {
|
|
21
|
+
type: string;
|
|
22
|
+
props: {
|
|
23
|
+
id: string;
|
|
24
|
+
title: string;
|
|
25
|
+
subTitle: string;
|
|
26
|
+
description: string;
|
|
27
|
+
titleOptions: {
|
|
28
|
+
content2: string;
|
|
29
|
+
tage2: string;
|
|
30
|
+
color2: string;
|
|
31
|
+
align2: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}[];
|
|
35
|
+
options: {
|
|
36
|
+
textAlign: string;
|
|
37
|
+
textAlign2: string;
|
|
38
|
+
};
|
|
39
|
+
background: {
|
|
40
|
+
isImage: string;
|
|
41
|
+
};
|
|
42
|
+
id: string;
|
|
43
|
+
};
|
|
44
|
+
}[];
|
|
45
|
+
zones: {};
|
|
46
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export const initialData = {
|
|
2
|
+
"root": {
|
|
3
|
+
"props": {
|
|
4
|
+
"title": "Hello, world",
|
|
5
|
+
"description": "Lorem ipsum",
|
|
6
|
+
"content": []
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"content": [
|
|
10
|
+
{
|
|
11
|
+
"type": "Base Block",
|
|
12
|
+
"props": {
|
|
13
|
+
"mediaBlock": [
|
|
14
|
+
{
|
|
15
|
+
"type": "MediaContent",
|
|
16
|
+
"props": {
|
|
17
|
+
"id": "MediaContent-168337f3-0b6f-43d8-8850-6f402eedcb65",
|
|
18
|
+
"imgs": "/01.png",
|
|
19
|
+
"alt": "alt"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"textBlock": [
|
|
24
|
+
{
|
|
25
|
+
"type": "TextContent",
|
|
26
|
+
"props": {
|
|
27
|
+
"id": "TextContent-5679409f-98c3-40b5-8a80-ab322f90695f",
|
|
28
|
+
"title": "Content that adapts to your layout",
|
|
29
|
+
"subTitle": "Designed for clarity and consistency",
|
|
30
|
+
"description": "This section supports flexible content placement and alignment across different screen sizes.",
|
|
31
|
+
"titleOptions": {
|
|
32
|
+
"content2": "Content that adapts to your layout",
|
|
33
|
+
"tage2": "h3",
|
|
34
|
+
"color2": "",
|
|
35
|
+
"align2": "left"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"options": {
|
|
41
|
+
"textAlign": "left",
|
|
42
|
+
"textAlign2": "top"
|
|
43
|
+
},
|
|
44
|
+
"background": {
|
|
45
|
+
"isImage": "no"
|
|
46
|
+
},
|
|
47
|
+
"id": "Base Block-aff75e04-815f-4014-97df-83f886fb5f76"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"type": "Base Block",
|
|
52
|
+
"props": {
|
|
53
|
+
"mediaBlock": [
|
|
54
|
+
{
|
|
55
|
+
"type": "MediaContent",
|
|
56
|
+
"props": {
|
|
57
|
+
"id": "MediaContent-d8dd3ec5-7b3d-487d-81d8-56468bf517be",
|
|
58
|
+
"imgs": "/01.png",
|
|
59
|
+
"alt": "alt"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"textBlock": [
|
|
64
|
+
{
|
|
65
|
+
"type": "TextContent",
|
|
66
|
+
"props": {
|
|
67
|
+
"id": "TextContent-0c983fb1-559e-4c82-8830-4e1b3ada07d4",
|
|
68
|
+
"title": "Content that adapts to your layout",
|
|
69
|
+
"subTitle": "Designed for clarity and consistency",
|
|
70
|
+
"description": "This section supports flexible content placement and alignment across different screen sizes.",
|
|
71
|
+
"titleOptions": {
|
|
72
|
+
"content2": "Content that adapts to your layout",
|
|
73
|
+
"tage2": "h3",
|
|
74
|
+
"color2": "",
|
|
75
|
+
"align2": "left"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"options": {
|
|
81
|
+
"textAlign": "right",
|
|
82
|
+
"textAlign2": "top"
|
|
83
|
+
},
|
|
84
|
+
"background": {
|
|
85
|
+
"isImage": "no"
|
|
86
|
+
},
|
|
87
|
+
"id": "Base Block-494258fc-5ee2-4403-9788-acb8824205d8"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"zones": {}
|
|
92
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Lenis from 'lenis';
|
|
2
|
+
import type { LenisOptions } from "lenis";
|
|
3
|
+
export interface LenisScrollProps {
|
|
4
|
+
root?: boolean | "asChild";
|
|
5
|
+
name?: string;
|
|
6
|
+
options?: LenisOptions;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const LenisScroll: React.FC<LenisScrollProps>;
|
|
11
|
+
export declare const LenisRootScroll: React.FC<LenisScrollProps>;
|
|
12
|
+
type LenisScrollContainerProps = Omit<LenisScrollProps, "root">;
|
|
13
|
+
export declare const LenisContainerScroll: React.FC<LenisScrollContainerProps>;
|
|
14
|
+
interface LenisStores {
|
|
15
|
+
root?: Lenis | null;
|
|
16
|
+
}
|
|
17
|
+
export declare const useLenisStores: import("zustand").UseBoundStore<import("zustand").StoreApi<LenisStores>>;
|
|
18
|
+
export declare const setRootLenis: (lenis: Lenis) => void;
|
|
19
|
+
export declare const getRootLenis: () => LenisStores;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// update: 2025.11.12
|
|
4
|
+
// version: 0.0.1.bate
|
|
5
|
+
// dev: wade
|
|
6
|
+
import { memo, useEffect, useEffectEvent, useLayoutEffect, useRef, useState } from "react";
|
|
7
|
+
import { ReactLenis, useLenis, } from "lenis/react";
|
|
8
|
+
import Lenis from 'lenis';
|
|
9
|
+
import { create } from "zustand";
|
|
10
|
+
import { ScrollContainerContext, setScrollContainerStore } from "./scroll-containers";
|
|
11
|
+
import { cn } from "../../shadcns/index.js";
|
|
12
|
+
export const LenisScroll = memo((props) => {
|
|
13
|
+
return (_jsxs(_Fragment, { children: [props?.root == true
|
|
14
|
+
? _jsx(LenisRootScroll, { ...props })
|
|
15
|
+
: _jsx(LenisContainerScroll, { ...props }), "\t"] }));
|
|
16
|
+
});
|
|
17
|
+
export const LenisRootScroll = memo(({ root, options }) => {
|
|
18
|
+
const lenis = useLenis();
|
|
19
|
+
const lenisRef = useRef(null);
|
|
20
|
+
const registerRootLenis = useEffectEvent(() => {
|
|
21
|
+
if (!root == true || !lenis)
|
|
22
|
+
return;
|
|
23
|
+
setRootLenis(lenis);
|
|
24
|
+
});
|
|
25
|
+
useEffect(() => { registerRootLenis(); }, [lenis]);
|
|
26
|
+
return (_jsx(ReactLenis, { ref: lenisRef, root: root, options: {
|
|
27
|
+
autoRaf: true,
|
|
28
|
+
lerp: 0.0005,
|
|
29
|
+
duration: 1.5,
|
|
30
|
+
smoothWheel: true,
|
|
31
|
+
...options
|
|
32
|
+
} }));
|
|
33
|
+
});
|
|
34
|
+
export const LenisContainerScroll = memo(({ name, className, children, options, ...restProps }) => {
|
|
35
|
+
const [containerRef, setContainerRef] = useState();
|
|
36
|
+
const wrapperRef = useRef(null);
|
|
37
|
+
const contentRef = useRef(null);
|
|
38
|
+
const initLenis = useEffectEvent(() => {
|
|
39
|
+
if (!wrapperRef.current || !contentRef.current || !name)
|
|
40
|
+
return;
|
|
41
|
+
const lenis = new Lenis({
|
|
42
|
+
wrapper: wrapperRef.current,
|
|
43
|
+
content: contentRef.current,
|
|
44
|
+
autoRaf: true,
|
|
45
|
+
...options
|
|
46
|
+
});
|
|
47
|
+
setContainerRef(contentRef);
|
|
48
|
+
setScrollContainerStore({ name, action: "add", node: lenis });
|
|
49
|
+
return () => {
|
|
50
|
+
setScrollContainerStore({ name, action: "remove" });
|
|
51
|
+
lenis?.destroy?.();
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
useLayoutEffect(() => {
|
|
55
|
+
const effect = initLenis();
|
|
56
|
+
return effect;
|
|
57
|
+
}, [name, options]);
|
|
58
|
+
return (_jsx("div", { ref: wrapperRef, "data-lenis-scroll": name, className: cn("group overflow-hidden", className), ...restProps, children: _jsx("div", { ref: contentRef, className: cn("h-full", "relative", "will-change-transform overscroll-contain"), children: _jsx(ScrollContainerContext, { value: { containerRef }, children: children }) }) }));
|
|
59
|
+
});
|
|
60
|
+
export const useLenisStores = create()(() => ({
|
|
61
|
+
root: null,
|
|
62
|
+
}));
|
|
63
|
+
export const setRootLenis = (lenis) => useLenisStores.setState(() => {
|
|
64
|
+
return { root: lenis };
|
|
65
|
+
});
|
|
66
|
+
export const getRootLenis = () => useLenisStores.getState();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type PropsType<T extends React.ElementType = "div"> = React.ComponentProps<T> & {
|
|
2
|
+
name: string;
|
|
3
|
+
tag?: T;
|
|
4
|
+
};
|
|
5
|
+
export declare const NativeScroll: import("react").MemoExoticComponent<(<T extends React.ElementType = "div">({ tag: Component, name, className, ...restProps }: PropsType<T>) => import("react/jsx-runtime").JSX.Element)>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
// update: 2025.11.12
|
|
4
|
+
// version: 0.0.1.bate
|
|
5
|
+
// dev: wade
|
|
6
|
+
import { memo, useEffectEvent, useEffect, useRef, useState } from "react";
|
|
7
|
+
import { ScrollContainerContext, setScrollContainerStore } from "./scroll-containers";
|
|
8
|
+
import { cn } from "../../shadcns/index.js";
|
|
9
|
+
export const NativeScroll = memo(({ tag: Component = "div", name, className, ...restProps }) => {
|
|
10
|
+
const componentRef = useRef(null);
|
|
11
|
+
const [containerRef, setContainerRef] = useState();
|
|
12
|
+
const nativeEffect = useEffectEvent(() => {
|
|
13
|
+
if (!componentRef.current)
|
|
14
|
+
return;
|
|
15
|
+
setContainerRef(componentRef);
|
|
16
|
+
setScrollContainerStore({ name, action: "add", node: componentRef.current });
|
|
17
|
+
return () => { setScrollContainerStore({ name, action: "remove" }); };
|
|
18
|
+
});
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const effect = nativeEffect();
|
|
21
|
+
return effect;
|
|
22
|
+
}, [componentRef?.current]);
|
|
23
|
+
return (_jsx(ScrollContainerContext, { value: { containerRef }, children: _jsx(Component, { ref: componentRef, "data-native-scroll": name, className: cn("overflow-auto", "will-change-transform", className), ...restProps }) }));
|
|
24
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Lenis from "lenis";
|
|
2
|
+
import { LenisScrollProps } from "./lenis-scroll";
|
|
3
|
+
type PropsType<T extends React.ElementType = "div"> = React.ComponentProps<T> & LenisScrollProps & {
|
|
4
|
+
name: string;
|
|
5
|
+
lenis?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const ScrollContainer: <T extends React.ElementType = "div">({ name, lenis, ...props }: PropsType<T>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export interface ScrollContainerContext {
|
|
9
|
+
containerRef: React.RefObject<HTMLDivElement | null> | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare const ScrollContainerContext: import("react").Context<ScrollContainerContext | null>;
|
|
12
|
+
export declare const useScrollContainerContext: () => ScrollContainerContext;
|
|
13
|
+
export interface ScrollContainersStores {
|
|
14
|
+
containers: Map<string, Lenis | HTMLDivElement | null>;
|
|
15
|
+
}
|
|
16
|
+
export declare const useScrollContainersStores: import("zustand").UseBoundStore<import("zustand").StoreApi<ScrollContainersStores>>;
|
|
17
|
+
export declare const getScrollContainer: (name: string) => HTMLDivElement | Lenis | null | undefined;
|
|
18
|
+
export declare const getScrollContainerStores: () => ScrollContainersStores;
|
|
19
|
+
export interface SetStoreOptions {
|
|
20
|
+
name: string;
|
|
21
|
+
node?: Lenis | HTMLDivElement | null;
|
|
22
|
+
action: "add" | "remove";
|
|
23
|
+
}
|
|
24
|
+
export declare const setScrollContainerStore: (options: SetStoreOptions) => void;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
// update: 2025.11.12
|
|
4
|
+
// version: 0.0.1.bate
|
|
5
|
+
// dev: wade
|
|
6
|
+
import { createContext, use } from "react";
|
|
7
|
+
import Lenis from "lenis";
|
|
8
|
+
import { create } from "zustand";
|
|
9
|
+
import { NativeScroll } from "./native-scroll";
|
|
10
|
+
import { LenisScroll } from "./lenis-scroll";
|
|
11
|
+
export const ScrollContainer = ({ name, lenis = false, ...props }) => {
|
|
12
|
+
return (_jsx(_Fragment, { children: lenis
|
|
13
|
+
? _jsx(LenisScroll, { name: name, ...props })
|
|
14
|
+
: _jsx(NativeScroll, { name: name, ...props }) }));
|
|
15
|
+
};
|
|
16
|
+
export const ScrollContainerContext = createContext(null);
|
|
17
|
+
export const useScrollContainerContext = () => {
|
|
18
|
+
const context = use(ScrollContainerContext);
|
|
19
|
+
if (!context)
|
|
20
|
+
throw new Error("useScrollContainerContext must be used inside ScrollContainerProvider");
|
|
21
|
+
return context;
|
|
22
|
+
};
|
|
23
|
+
export const useScrollContainersStores = create()(() => ({
|
|
24
|
+
containers: new Map(),
|
|
25
|
+
}));
|
|
26
|
+
export const getScrollContainer = (name) => {
|
|
27
|
+
const stores = useScrollContainersStores.getState();
|
|
28
|
+
return stores.containers?.get(name);
|
|
29
|
+
};
|
|
30
|
+
export const getScrollContainerStores = () => useScrollContainersStores.getState();
|
|
31
|
+
export const setScrollContainerStore = (options) => {
|
|
32
|
+
const { action, name, node } = options;
|
|
33
|
+
useScrollContainersStores.setState(stores => {
|
|
34
|
+
const containerDom = stores.containers?.get(name);
|
|
35
|
+
const isContainerNode = node instanceof Lenis || node instanceof HTMLDivElement;
|
|
36
|
+
if (action == "add" && isContainerNode) {
|
|
37
|
+
if (containerDom == node)
|
|
38
|
+
return stores;
|
|
39
|
+
// console.log("node", node, name);
|
|
40
|
+
stores.containers?.set(name, node);
|
|
41
|
+
}
|
|
42
|
+
else if (action == "remove" && containerDom) {
|
|
43
|
+
stores.containers?.delete(name);
|
|
44
|
+
}
|
|
45
|
+
return { containers: stores.containers };
|
|
46
|
+
});
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Tests } from "./tests";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Tests } from "./tests";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "../../shadcns/index.js";
|
|
4
|
+
import { CarouselPrevious } from "../../shadcns/index.js";
|
|
5
|
+
import { Carousel } from "../../shadcns/index.js";
|
|
6
|
+
const Tests = () => {
|
|
7
|
+
return (_jsxs(_Fragment, { children: [_jsx(Carousel, { children: _jsx(CarouselPrevious, {}) }), _jsx(Button, { children: "test123133232" })] }));
|
|
8
|
+
};
|
|
9
|
+
Tests.displayName = "Tests";
|
|
10
|
+
export default Tests;
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -1,51 +1,66 @@
|
|
|
1
|
-
import { Easing } from "motion/react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export interface AnchorActionsOptions {
|
|
5
|
-
anchor?: string;
|
|
6
|
-
container: string;
|
|
7
|
-
offseters?: string | string[];
|
|
8
|
-
direction?: "horizontal" | "vertical";
|
|
1
|
+
import type { AnimationPlaybackControlsWithThen, Easing } from "motion/react";
|
|
2
|
+
import Lenis from "lenis";
|
|
3
|
+
export interface AnimateOptions {
|
|
9
4
|
duration?: number;
|
|
10
|
-
offset?: number;
|
|
11
5
|
delay?: number;
|
|
12
6
|
ease?: Easing | Easing[] | undefined;
|
|
13
|
-
onScroll?: () => void;
|
|
7
|
+
onScroll?: (lenis?: Lenis) => void;
|
|
14
8
|
onScrolling?: (value: number) => void;
|
|
15
|
-
onScrolled?: () => void;
|
|
9
|
+
onScrolled?: (lenis?: Lenis) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface AnchorOptions extends AnimateOptions {
|
|
12
|
+
anchor: string;
|
|
13
|
+
container?: string;
|
|
14
|
+
offseters?: string | string[];
|
|
15
|
+
direction?: "x" | "y";
|
|
16
|
+
align?: "start" | "center" | "end";
|
|
17
|
+
offset?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface ScrollOptions extends AnimateOptions {
|
|
20
|
+
controllerKey: string;
|
|
21
|
+
containerDom: HTMLElement | Window;
|
|
22
|
+
anchorScrollValue: {
|
|
23
|
+
left: number;
|
|
24
|
+
top: number;
|
|
25
|
+
};
|
|
26
|
+
containerScrollValue: {
|
|
27
|
+
left: number;
|
|
28
|
+
top: number;
|
|
29
|
+
};
|
|
30
|
+
direction?: AnchorOptions["direction"];
|
|
16
31
|
}
|
|
32
|
+
export type AnimateController = AnimationPlaybackControlsWithThen;
|
|
17
33
|
export declare function useAnchors(): {
|
|
18
34
|
registerAnchors: typeof registerAnchors;
|
|
19
|
-
registerContainers: typeof registerContainers;
|
|
20
35
|
registerOffseters: typeof registerOffseters;
|
|
36
|
+
setStores: (options: AnchorStoreOptions) => void;
|
|
21
37
|
getStores: () => AnchorsStores;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
38
|
+
scrollToAnchor: (anchorOptions: AnchorOptions) => void;
|
|
39
|
+
};
|
|
40
|
+
export interface RegistrationDatas {
|
|
41
|
+
key: keyof AnchorsStores;
|
|
42
|
+
name: string;
|
|
43
|
+
}
|
|
44
|
+
export declare function useRegistration({ key, name }: RegistrationDatas): {
|
|
45
|
+
[x: string]: string | import("react").RefObject<null>;
|
|
46
|
+
ref: import("react").RefObject<null>;
|
|
26
47
|
};
|
|
27
48
|
export declare function registerAnchors(name: string): {
|
|
28
|
-
|
|
29
|
-
"
|
|
49
|
+
[x: string]: string | import("react").RefObject<null>;
|
|
50
|
+
ref: import("react").RefObject<null>;
|
|
30
51
|
};
|
|
31
52
|
export declare function registerOffseters(name: string): {
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
};
|
|
35
|
-
export declare function registerContainers(name: string): {
|
|
36
|
-
ref: (node: HTMLDivElement | null) => void;
|
|
37
|
-
"data-anchor-container": string;
|
|
53
|
+
[x: string]: string | import("react").RefObject<null>;
|
|
54
|
+
ref: import("react").RefObject<null>;
|
|
38
55
|
};
|
|
39
|
-
export
|
|
56
|
+
export interface AnchorsStores {
|
|
40
57
|
anchors: Map<string, HTMLElement | null>;
|
|
41
|
-
containers: Map<string, HTMLElement | null>;
|
|
42
58
|
offseters: Map<string, HTMLElement | null>;
|
|
43
|
-
}
|
|
59
|
+
}
|
|
44
60
|
export declare const useAnchorsStores: import("zustand").UseBoundStore<import("zustand").StoreApi<AnchorsStores>>;
|
|
45
61
|
export declare const getAnchorsStores: () => AnchorsStores;
|
|
46
|
-
export
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
export declare const
|
|
51
|
-
export declare const removeOffseter: (name: string) => void;
|
|
62
|
+
export interface AnchorStoreOptions extends RegistrationDatas {
|
|
63
|
+
node: HTMLDivElement | null;
|
|
64
|
+
action: "add" | "remove";
|
|
65
|
+
}
|
|
66
|
+
export declare const setAnchorsStore: (options: AnchorStoreOptions) => void;
|