sticky-card-stack 0.1.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/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # scs
2
+
3
+ React sticky card stack with GSAP ScrollTrigger and Lenis smooth scroll. Build a vertical stack of cards that stick and scale on scroll.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install scs
9
+ ```
10
+
11
+ Peer dependencies (install if you don’t have them):
12
+
13
+ ```bash
14
+ npm install react react-dom gsap lenis
15
+ ```
16
+
17
+ ## Quick start
18
+
19
+ 1. Call **`useScrollTrigger()`** once at your app root (e.g. in your root layout or main component).
20
+ 2. Wrap your cards in **`StickCardStack`** and use **`StickCard`** for each card.
21
+
22
+ ```tsx
23
+ import { StickCardStack, StickCard, useScrollTrigger } from 'scs';
24
+ import 'scs/style.css'; // optional: default card layout and demo styles
25
+
26
+ function App() {
27
+ useScrollTrigger();
28
+
29
+ return (
30
+ <StickCardStack scrollHeight={8}>
31
+ <StickCard
32
+ header={<h2>Card 1</h2>}
33
+ content={<p>Content</p>}
34
+ main={<img src="..." alt="" />}
35
+ />
36
+ <StickCard
37
+ header={<h2>Card 2</h2>}
38
+ content={<p>More content</p>}
39
+ main={<img src="..." alt="" />}
40
+ />
41
+ </StickCardStack>
42
+ );
43
+ }
44
+ ```
45
+
46
+ ## API
47
+
48
+ ### `useScrollTrigger()`
49
+
50
+ Call once at the root of your app. Sets up Lenis smooth scroll and syncs it with GSAP ScrollTrigger. Required for `StickCardStack` to work correctly.
51
+
52
+ ### `StickCardStack`
53
+
54
+ | Prop | Type | Default | Description |
55
+ |-----------------|------------|---------|-------------|
56
+ | `children` | `ReactNode`| — | Card elements (e.g. `StickCard` components). |
57
+ | `scrollHeight` | `number` | `8` | Height of the scroll area as a multiple of viewport height. |
58
+ | `cardYOffset` | `number` | `5` | Vertical offset between stacked cards (percent). |
59
+ | `cardScaleStep` | `number` | `0.075` | Scale reduction per card (e.g. 0.075 = 7.5% smaller per card). |
60
+ | `className` | `string` | — | Optional class name for the wrapper. |
61
+ | `colorVariants` | `string[]` | — | Optional background colors applied per card by index (cycles if fewer than cards). |
62
+
63
+ ### `StickCard`
64
+
65
+ Each card can be used in two ways:
66
+
67
+ - **Structured:** `header`, `content`, and `main` props for the default two-column layout (header top, content bottom-left, main right).
68
+ - **Custom:** `children` only; you structure the card yourself.
69
+
70
+ Shared prop:
71
+
72
+ - **`colorOverride`** — Optional hex (or other) color for this card; overrides stack variant/`colorVariants`.
73
+
74
+ Example with custom layout:
75
+
76
+ ```tsx
77
+ <StickCard colorOverride="#1a1a2e">
78
+ <div className="my-card">…</div>
79
+ </StickCard>
80
+ ```
81
+
82
+ ## TypeScript
83
+
84
+ Exported types:
85
+
86
+ - `StickCardStackProps`
87
+ - `StickCardProps`
88
+ - `StickCardPropsStructured`
89
+ - `StickCardPropsChildren`
90
+ - `STICK_CARD_STACK_DEFAULTS`
91
+
92
+
93
+ ## License
94
+
95
+ MIT
@@ -0,0 +1,5 @@
1
+ export { StickCardStack } from './lib/StickCardStack';
2
+ export { StickCard } from './lib/StickCard';
3
+ export { useScrollTrigger } from './lib/useScrollTrigger';
4
+ export type { StickCardStackProps, StickCardProps, StickCardPropsStructured, StickCardPropsChildren, } from './lib/types';
5
+ export { STICK_CARD_STACK_DEFAULTS } from './lib/types';
@@ -0,0 +1,10 @@
1
+ import { ReactElement } from 'react';
2
+ import { StickCardPropsChildren, StickCardPropsStructured } from './types';
3
+ /**
4
+ * A single card for use inside StickCardStack.
5
+ * Either use structured props (header, content, main) for the default two-column layout,
6
+ * or pass children and structure the card yourself.
7
+ * Variant (1–4) is derived from position in the stack when used inside StickCardStack.
8
+ */
9
+ export declare function StickCard(props: StickCardPropsStructured): ReactElement;
10
+ export declare function StickCard(props: StickCardPropsChildren): ReactElement;
@@ -0,0 +1,12 @@
1
+ import { StickCardStackProps } from './types';
2
+ /** Injected by StickCardStack: variant (1–4) and optional per-card color from colorVariants. */
3
+ export interface StickCardContextValue {
4
+ variant: number;
5
+ color: string | null;
6
+ }
7
+ export declare const StickCardVariantContext: import('react').Context<StickCardContextValue | null>;
8
+ /**
9
+ * A sticky stack of cards that animate on scroll (GSAP + ScrollTrigger).
10
+ * Use with useScrollTrigger() at app root for smooth scrolling.
11
+ */
12
+ export declare function StickCardStack({ children, scrollHeight, cardYOffset, cardScaleStep, className, colorVariants, }: StickCardStackProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,58 @@
1
+ import { ReactNode } from 'react';
2
+ /** Props for the StickCardStack root component */
3
+ export interface StickCardStackProps {
4
+ /** Card elements; each child is rendered as one stacked card */
5
+ children: ReactNode;
6
+ /**
7
+ * Height of the scroll area as a multiple of viewport height.
8
+ * @default 8
9
+ */
10
+ scrollHeight?: number;
11
+ /**
12
+ * Vertical offset between stacked cards (in percent).
13
+ * @default 5
14
+ */
15
+ cardYOffset?: number;
16
+ /**
17
+ * Scale reduction per card in the stack (e.g. 0.075 = 7.5% smaller per card).
18
+ * @default 0.075
19
+ */
20
+ cardScaleStep?: number;
21
+ /** Optional class name for the wrapper element */
22
+ className?: string;
23
+ /**
24
+ * Optional list of background colors (e.g. ['#3d2fa9', '#ff7722']).
25
+ * Applied per card by index (cycles if fewer colors than cards).
26
+ * When not provided, cards use the base CSS variables (.card-1 … .card-4).
27
+ */
28
+ colorVariants?: string[];
29
+ }
30
+ /** Common props for StickCard */
31
+ export interface StickCardPropsBase {
32
+ /**
33
+ * Custom background color for this card (e.g. '#3d2fa9').
34
+ * When set, overrides stack context (variant/colorVariants) and uses this color only.
35
+ */
36
+ colorOverride?: string | null;
37
+ }
38
+ /** Structured card: header (20% top), content (22% at bottom of left column), and main column. */
39
+ export interface StickCardPropsStructured extends StickCardPropsBase {
40
+ /** Optional header slot at top of left column (e.g. "Join us"). */
41
+ header: ReactNode;
42
+ /** Content slot: primary text in left column (e.g. "Football"). */
43
+ content: ReactNode;
44
+ /** Main slot: trailing column (e.g. image, media). */
45
+ main: ReactNode;
46
+ }
47
+ /** Custom layout: you supply children and structure the card yourself. */
48
+ export interface StickCardPropsChildren extends StickCardPropsBase {
49
+ children: ReactNode;
50
+ }
51
+ /** Props for a single StickCard: either structured (header, content, main) or custom (children). */
52
+ export type StickCardProps = StickCardPropsStructured | StickCardPropsChildren;
53
+ /** Default values for StickCardStack animation options */
54
+ export declare const STICK_CARD_STACK_DEFAULTS: {
55
+ readonly scrollHeight: 8;
56
+ readonly cardYOffset: 5;
57
+ readonly cardScaleStep: 0.075;
58
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Sets up Lenis smooth scroll and syncs it with GSAP ScrollTrigger.
3
+ * Call once at app root (e.g. in your root layout or App) when using StickCardStack.
4
+ */
5
+ export declare function useScrollTrigger(): void;
package/dist/scs.css ADDED
@@ -0,0 +1 @@
1
+ .stick-card-stack-wrap{position:relative}.stick-card-stack{position:sticky;top:0;height:100svh;width:100%;background-color:#e3e3db}.stick-card-stack .stick-card-stack-inner{position:absolute;inset:0;perspective:850px}.stick-card-stack .stick-card{position:absolute;top:50%;left:50%;width:65%;height:60%;display:flex;justify-content:center;align-items:center;padding:2.5rem;border-radius:1rem;transform-origin:center bottom;will-change:transform}@media(max-width:1024px){.stick-card-stack .stick-card{width:calc(100% - 4rem);height:75%}}
package/dist/scs.js ADDED
@@ -0,0 +1,139 @@
1
+ import { jsx as r, jsxs as N, Fragment as H } from "react/jsx-runtime";
2
+ import { createContext as O, useRef as T, useEffect as A, Children as p, useContext as U } from "react";
3
+ import t from "gsap";
4
+ import { ScrollTrigger as h } from "gsap/ScrollTrigger";
5
+ import X from "lenis";
6
+ const w = {
7
+ scrollHeight: 8,
8
+ cardYOffset: 5,
9
+ cardScaleStep: 0.075
10
+ }, R = O(null), j = 4;
11
+ t.registerPlugin(h);
12
+ function M({
13
+ children: e,
14
+ scrollHeight: n = w.scrollHeight,
15
+ cardYOffset: c = w.cardYOffset,
16
+ cardScaleStep: i = w.cardScaleStep,
17
+ className: o,
18
+ colorVariants: m
19
+ }) {
20
+ const y = T(null), x = T(null);
21
+ A(() => {
22
+ const g = y.current, l = x.current;
23
+ if (!g || !l) return;
24
+ const s = l.querySelectorAll(".stick-card"), a = s.length;
25
+ if (a === 0) return;
26
+ const d = 1 / a;
27
+ s.forEach((v, u) => {
28
+ t.set(v, {
29
+ xPercent: -50,
30
+ yPercent: -50 + u * c,
31
+ scale: 1 - u * i
32
+ });
33
+ });
34
+ const b = window.innerHeight * n, E = h.create({
35
+ trigger: g,
36
+ start: "top top",
37
+ end: `+=${b}px`,
38
+ onUpdate(v) {
39
+ const u = v.progress, f = Math.min(
40
+ Math.floor(u / d),
41
+ a - 1
42
+ ), k = (u - f * d) / d;
43
+ s.forEach((C, S) => {
44
+ if (S < f)
45
+ t.set(C, {
46
+ yPercent: -250,
47
+ rotationX: 35
48
+ });
49
+ else if (S === f)
50
+ t.set(C, {
51
+ yPercent: t.utils.interpolate(-50, -200, k),
52
+ rotationX: t.utils.interpolate(0, 35, k),
53
+ scale: 1
54
+ });
55
+ else {
56
+ const P = S - f, _ = (P - k) * c, $ = 1 - (P - k) * i;
57
+ t.set(C, {
58
+ yPercent: -50 + _,
59
+ rotationX: 0,
60
+ scale: $
61
+ });
62
+ }
63
+ });
64
+ }
65
+ });
66
+ return () => {
67
+ E.kill();
68
+ };
69
+ }, [n, c, i]);
70
+ const I = {
71
+ height: `calc(100svh * ${n})`
72
+ };
73
+ return /* @__PURE__ */ r(
74
+ "div",
75
+ {
76
+ ref: y,
77
+ className: o ? `stick-card-stack-wrap ${o}` : "stick-card-stack-wrap",
78
+ style: I,
79
+ children: /* @__PURE__ */ r("section", { className: "stick-card-stack", children: /* @__PURE__ */ r("div", { ref: x, className: "stick-card-stack-inner", children: p.map(e, (g, l) => {
80
+ const s = p.count(e), a = l % j + 1, d = m && m.length > 0 ? m[l % m.length] : null;
81
+ return /* @__PURE__ */ r(R.Provider, { value: { variant: a, color: d }, children: /* @__PURE__ */ r(
82
+ "div",
83
+ {
84
+ className: "stick-card",
85
+ style: { zIndex: s - l },
86
+ children: g
87
+ }
88
+ ) });
89
+ }) }) })
90
+ }
91
+ );
92
+ }
93
+ function q(e) {
94
+ const { colorOverride: n } = e, c = U(R), i = c?.variant ?? 1, o = n ?? c?.color ?? null;
95
+ return /* @__PURE__ */ r(
96
+ "div",
97
+ {
98
+ className: o ? "card-demo" : `card-demo card-${i}`,
99
+ style: o ? { backgroundColor: o } : void 0,
100
+ children: "children" in e && e.children != null ? e.children : /* @__PURE__ */ N(H, { children: [
101
+ /* @__PURE__ */ N("div", { className: "col col-leading", children: [
102
+ /* @__PURE__ */ r("div", { className: "col-header", children: "header" in e ? e.header : null }),
103
+ /* @__PURE__ */ r("div", { className: "col-content", children: "content" in e ? e.content : null })
104
+ ] }),
105
+ /* @__PURE__ */ r("div", { className: "col col-main", children: "main" in e ? e.main : null })
106
+ ] })
107
+ }
108
+ );
109
+ }
110
+ t.registerPlugin(h);
111
+ function B() {
112
+ A(() => {
113
+ const e = new X();
114
+ return e.on("scroll", h.update), t.ticker.add((n) => {
115
+ e.raf(n * 1e3);
116
+ }), t.ticker.lagSmoothing(0), h.scrollerProxy(document.body, {
117
+ scrollTop(n) {
118
+ return arguments.length && typeof n == "number" && e.scrollTo(n, { immediate: !0 }), e.scroll;
119
+ },
120
+ getBoundingClientRect() {
121
+ return {
122
+ top: 0,
123
+ left: 0,
124
+ width: window.innerWidth,
125
+ height: window.innerHeight
126
+ };
127
+ }
128
+ }), () => {
129
+ t.ticker.remove(e.raf), e.destroy();
130
+ };
131
+ }, []);
132
+ }
133
+ export {
134
+ w as STICK_CARD_STACK_DEFAULTS,
135
+ q as StickCard,
136
+ M as StickCardStack,
137
+ B as useScrollTrigger
138
+ };
139
+ //# sourceMappingURL=scs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scs.js","sources":["../src/lib/types.ts","../src/lib/StickCardStack.tsx","../src/lib/StickCard.tsx","../src/lib/useScrollTrigger.ts"],"sourcesContent":["import type { ReactNode } from 'react';\n\n/** Props for the StickCardStack root component */\nexport interface StickCardStackProps {\n /** Card elements; each child is rendered as one stacked card */\n children: ReactNode;\n /**\n * Height of the scroll area as a multiple of viewport height.\n * @default 8\n */\n scrollHeight?: number;\n /**\n * Vertical offset between stacked cards (in percent).\n * @default 5\n */\n cardYOffset?: number;\n /**\n * Scale reduction per card in the stack (e.g. 0.075 = 7.5% smaller per card).\n * @default 0.075\n */\n cardScaleStep?: number;\n /** Optional class name for the wrapper element */\n className?: string;\n /**\n * Optional list of background colors (e.g. ['#3d2fa9', '#ff7722']).\n * Applied per card by index (cycles if fewer colors than cards).\n * When not provided, cards use the base CSS variables (.card-1 … .card-4).\n */\n colorVariants?: string[];\n}\n\n/** Common props for StickCard */\nexport interface StickCardPropsBase {\n /**\n * Custom background color for this card (e.g. '#3d2fa9').\n * When set, overrides stack context (variant/colorVariants) and uses this color only.\n */\n colorOverride?: string | null;\n}\n\n/** Structured card: header (20% top), content (22% at bottom of left column), and main column. */\nexport interface StickCardPropsStructured extends StickCardPropsBase {\n /** Optional header slot at top of left column (e.g. \"Join us\"). */\n header: ReactNode;\n /** Content slot: primary text in left column (e.g. \"Football\"). */\n content: ReactNode;\n /** Main slot: trailing column (e.g. image, media). */\n main: ReactNode;\n}\n\n/** Custom layout: you supply children and structure the card yourself. */\nexport interface StickCardPropsChildren extends StickCardPropsBase {\n children: ReactNode;\n}\n\n/** Props for a single StickCard: either structured (header, content, main) or custom (children). */\nexport type StickCardProps = StickCardPropsStructured | StickCardPropsChildren;\n\n/** Default values for StickCardStack animation options */\nexport const STICK_CARD_STACK_DEFAULTS = {\n scrollHeight: 8,\n cardYOffset: 5,\n cardScaleStep: 0.075,\n} as const;\n","import { createContext, useEffect, useRef, Children } from 'react';\nimport gsap from 'gsap';\nimport { ScrollTrigger } from 'gsap/ScrollTrigger';\nimport type { StickCardStackProps } from './types';\nimport { STICK_CARD_STACK_DEFAULTS } from './types';\nimport './StickCardStack.css';\n\n/** Injected by StickCardStack: variant (1–4) and optional per-card color from colorVariants. */\nexport interface StickCardContextValue {\n variant: number;\n color: string | null;\n}\nexport const StickCardVariantContext = createContext<StickCardContextValue | null>(null);\n\nconst VARIANT_COUNT = 4;\n\ngsap.registerPlugin(ScrollTrigger);\n\n/**\n * A sticky stack of cards that animate on scroll (GSAP + ScrollTrigger).\n * Use with useScrollTrigger() at app root for smooth scrolling.\n */\nexport function StickCardStack({\n children,\n scrollHeight = STICK_CARD_STACK_DEFAULTS.scrollHeight,\n cardYOffset = STICK_CARD_STACK_DEFAULTS.cardYOffset,\n cardScaleStep = STICK_CARD_STACK_DEFAULTS.cardScaleStep,\n className,\n colorVariants,\n}: StickCardStackProps) {\n const wrapRef = useRef<HTMLDivElement>(null);\n const innerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const wrap = wrapRef.current;\n const inner = innerRef.current;\n if (!wrap || !inner) return;\n\n const cards = inner.querySelectorAll<HTMLElement>('.stick-card');\n const totalCards = cards.length;\n if (totalCards === 0) return;\n\n const segmentSize = 1 / totalCards;\n\n cards.forEach((card, i) => {\n gsap.set(card, {\n xPercent: -50,\n yPercent: -50 + i * cardYOffset,\n scale: 1 - i * cardScaleStep,\n });\n });\n\n const scrollHeightPx = window.innerHeight * scrollHeight;\n\n const st = ScrollTrigger.create({\n trigger: wrap,\n start: 'top top',\n end: `+=${scrollHeightPx}px`,\n onUpdate(self) {\n const progress = self.progress;\n const activeIndex = Math.min(\n Math.floor(progress / segmentSize),\n totalCards - 1\n );\n const segmentProgress =\n (progress - activeIndex * segmentSize) / segmentSize;\n\n cards.forEach((card, i) => {\n if (i < activeIndex) {\n gsap.set(card, {\n yPercent: -250,\n rotationX: 35,\n });\n } else if (i === activeIndex) {\n gsap.set(card, {\n yPercent: gsap.utils.interpolate(-50, -200, segmentProgress),\n rotationX: gsap.utils.interpolate(0, 35, segmentProgress),\n scale: 1,\n });\n } else {\n const behindIndex = i - activeIndex;\n const currentYOffset = (behindIndex - segmentProgress) * cardYOffset;\n const currentScale =\n 1 - (behindIndex - segmentProgress) * cardScaleStep;\n gsap.set(card, {\n yPercent: -50 + currentYOffset,\n rotationX: 0,\n scale: currentScale,\n });\n }\n });\n },\n });\n\n return () => {\n st.kill();\n };\n }, [scrollHeight, cardYOffset, cardScaleStep]);\n\n const wrapStyle = {\n height: `calc(100svh * ${scrollHeight})`,\n };\n\n return (\n <div\n ref={wrapRef}\n className={className ? `stick-card-stack-wrap ${className}` : 'stick-card-stack-wrap'}\n style={wrapStyle}\n >\n <section className=\"stick-card-stack\">\n <div ref={innerRef} className=\"stick-card-stack-inner\">\n {Children.map(children, (child, index) => {\n const totalCards = Children.count(children);\n const variant = (index % VARIANT_COUNT) + 1;\n const color =\n colorVariants && colorVariants.length > 0\n ? colorVariants[index % colorVariants.length]\n : null;\n return (\n <StickCardVariantContext.Provider value={{ variant, color }}>\n <div\n className=\"stick-card\"\n style={{ zIndex: totalCards - index }}\n >\n {child}\n </div>\n </StickCardVariantContext.Provider>\n );\n })}\n </div>\n </section>\n </div>\n );\n}\n","import { useContext, type ReactElement } from 'react';\nimport { StickCardVariantContext } from './StickCardStack';\nimport type { StickCardProps, StickCardPropsChildren, StickCardPropsStructured } from './types';\n\n/**\n * A single card for use inside StickCardStack.\n * Either use structured props (header, content, main) for the default two-column layout,\n * or pass children and structure the card yourself.\n * Variant (1–4) is derived from position in the stack when used inside StickCardStack.\n */\nexport function StickCard(props: StickCardPropsStructured): ReactElement;\nexport function StickCard(props: StickCardPropsChildren): ReactElement;\nexport function StickCard(props: StickCardProps): ReactElement {\n const { colorOverride: colorProp } = props;\n const context = useContext(StickCardVariantContext);\n const variant = context?.variant ?? 1;\n const color = colorProp ?? context?.color ?? null;\n\n return (\n <div\n className={color ? 'card-demo' : `card-demo card-${variant}`}\n style={color ? { backgroundColor: color } : undefined}\n >\n {'children' in props && props.children != null ? (\n props.children\n ) : (\n <>\n <div className=\"col col-leading\">\n <div className=\"col-header\">{'header' in props ? props.header : null}</div>\n <div className=\"col-content\">{'content' in props ? props.content : null}</div>\n </div>\n <div className=\"col col-main\">{'main' in props ? props.main : null}</div>\n </>\n )}\n </div>\n );\n}\n","import { useEffect } from 'react';\nimport gsap from 'gsap';\nimport { ScrollTrigger } from 'gsap/ScrollTrigger';\nimport Lenis from 'lenis';\n\ngsap.registerPlugin(ScrollTrigger);\n\n/**\n * Sets up Lenis smooth scroll and syncs it with GSAP ScrollTrigger.\n * Call once at app root (e.g. in your root layout or App) when using StickCardStack.\n */\nexport function useScrollTrigger(): void {\n useEffect(() => {\n const lenis = new Lenis();\n\n lenis.on('scroll', ScrollTrigger.update);\n\n gsap.ticker.add((time) => {\n lenis.raf(time * 1000);\n });\n gsap.ticker.lagSmoothing(0);\n\n ScrollTrigger.scrollerProxy(document.body, {\n scrollTop(value) {\n if (arguments.length && typeof value === 'number') {\n lenis.scrollTo(value, { immediate: true });\n }\n return lenis.scroll;\n },\n getBoundingClientRect() {\n return {\n top: 0,\n left: 0,\n width: window.innerWidth,\n height: window.innerHeight,\n };\n },\n });\n\n return () => {\n gsap.ticker.remove(lenis.raf);\n lenis.destroy();\n };\n }, []);\n}\n"],"names":["STICK_CARD_STACK_DEFAULTS","StickCardVariantContext","createContext","VARIANT_COUNT","gsap","ScrollTrigger","StickCardStack","children","scrollHeight","cardYOffset","cardScaleStep","className","colorVariants","wrapRef","useRef","innerRef","useEffect","wrap","inner","cards","totalCards","segmentSize","card","i","scrollHeightPx","st","self","progress","activeIndex","segmentProgress","behindIndex","currentYOffset","currentScale","wrapStyle","jsx","Children","child","index","variant","color","StickCard","props","colorProp","context","useContext","jsxs","Fragment","useScrollTrigger","lenis","Lenis","time","value"],"mappings":";;;;;AA2DO,MAAMA,IAA4B;AAAA,EACvC,cAAc;AAAA,EACd,aAAa;AAAA,EACb,eAAe;AACjB,GCnDaC,IAA0BC,EAA4C,IAAI,GAEjFC,IAAgB;AAEtBC,EAAK,eAAeC,CAAa;AAM1B,SAASC,EAAe;AAAA,EAC7B,UA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AEpCH,EAAM;AAAA,MACf;AAAA,MACA,wBAAwB;AACtB,eAAO;AAAA,UACL,KAAK;AAAA,UACL,MAAM;AAAA,UACN,OAAO,OAAO;AAAA,UACd,QAAQ,OAAO;AAAA,QAAA;AAAA,MAEnB;AAAA,IAAA,CACD,GAEM,MAAM;AACX,MAAA5C,EAAK,OAAO,OAAO4C,EAAM,GAAG,GAC5BA,EAAM,QAAA;AAAA,IACR;AAAA,EACF,GAAG,CAAA,CAAE;AACP;"}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "sticky-card-stack",
3
+ "version": "0.1.0",
4
+ "description": "React sticky card stack with GSAP ScrollTrigger and Lenis smooth scroll",
5
+ "type": "module",
6
+ "main": "./dist/scs.js",
7
+ "module": "./dist/scs.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/scs.js"
13
+ },
14
+ "./style.css": "./dist/scs.css"
15
+ },
16
+ "files": ["dist"],
17
+ "scripts": {
18
+ "dev": "vite",
19
+ "build": "tsc -b && vite build",
20
+ "build:lib": "vite build --config vite.lib.config.ts",
21
+ "prepublishOnly": "npm run build:lib",
22
+ "lint": "eslint .",
23
+ "preview": "vite preview"
24
+ },
25
+ "dependencies": {
26
+ "gsap": "^3.14.2",
27
+ "lenis": "^1.3.17",
28
+ "react": "^19.2.0",
29
+ "react-dom": "^19.2.0"
30
+ },
31
+ "peerDependencies": {
32
+ "react": ">=18",
33
+ "react-dom": ">=18",
34
+ "gsap": ">=3.12",
35
+ "lenis": ">=1.0"
36
+ },
37
+ "devDependencies": {
38
+ "@eslint/js": "^9.39.1",
39
+ "@types/node": "^24.10.1",
40
+ "@types/react": "^19.2.7",
41
+ "@types/react-dom": "^19.2.3",
42
+ "@vitejs/plugin-react": "^5.1.1",
43
+ "eslint": "^9.39.1",
44
+ "eslint-plugin-react-hooks": "^7.0.1",
45
+ "eslint-plugin-react-refresh": "^0.4.24",
46
+ "globals": "^16.5.0",
47
+ "typescript": "~5.9.3",
48
+ "typescript-eslint": "^8.48.0",
49
+ "vite": "^7.3.1",
50
+ "vite-plugin-dts": "^4.5.4"
51
+ },
52
+ "keywords": [
53
+ "react",
54
+ "gsap",
55
+ "scroll-trigger",
56
+ "lenis",
57
+ "sticky",
58
+ "cards",
59
+ "scroll-animation"
60
+ ],
61
+ "license": "MIT"
62
+ }