@juniorxsound/react-three-components 0.1.1 → 0.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.
@@ -1,9 +1,6 @@
1
- import { type ForwardRefExoticComponent, type RefAttributes } from "react";
2
1
  import { CircularCarouselNextTrigger, CircularCarouselPrevTrigger } from "./CircularCarouselTriggers";
3
2
  import type { CircularCarouselProps, CircularCarouselRef } from "./types";
4
- type CircularCarouselComponent = ForwardRefExoticComponent<CircularCarouselProps & RefAttributes<CircularCarouselRef>> & {
3
+ export declare const CircularCarousel: import("react").ForwardRefExoticComponent<CircularCarouselProps & import("react").RefAttributes<CircularCarouselRef>> & {
5
4
  NextTrigger: typeof CircularCarouselNextTrigger;
6
5
  PrevTrigger: typeof CircularCarouselPrevTrigger;
7
6
  };
8
- export declare const CircularCarousel: CircularCarouselComponent;
9
- export {};
@@ -1,3 +1,4 @@
1
- import type { CarouselContextValue } from "./types";
2
- export declare const CarouselContext: import("react").Context<CarouselContextValue | null>;
3
- export declare function useCarouselContext(): CarouselContextValue;
1
+ import { CarouselContext } from "../../hooks";
2
+ export { CarouselContext };
3
+ export declare function useCircularCarouselContext(): import("./types").CarouselContextValue;
4
+ export { useCircularCarouselContext as useCarouselContext };
@@ -1,20 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
- export type DragConfig = {
3
- /** Axis to constrain drag movement. Default: "x" */
4
- axis?: "x" | "y";
5
- /** Pointer options for drag gesture */
6
- pointer?: {
7
- touch?: boolean;
8
- capture?: boolean;
9
- keys?: boolean;
10
- };
11
- /** Touch action CSS property. Default: "none" */
12
- touchAction?: string;
13
- /** Threshold in pixels before drag starts */
14
- threshold?: number;
15
- /** Rubberband effect when dragging past bounds (0-1) */
16
- rubberband?: boolean | number;
17
- };
2
+ import type { DragConfig, CarouselContextValue } from "../../hooks";
3
+ export type { DragConfig, CarouselContextValue };
18
4
  export type CircularCarouselProps = {
19
5
  children: ReactNode;
20
6
  radius?: number;
@@ -34,10 +20,3 @@ export type CircularCarouselRef = {
34
20
  prev(): void;
35
21
  goTo(index: number): void;
36
22
  };
37
- export type CarouselContextValue = {
38
- activeIndex: number;
39
- count: number;
40
- next: () => void;
41
- prev: () => void;
42
- goTo: (index: number) => void;
43
- };
@@ -1,4 +1,3 @@
1
- export declare function clamp(value: number, min: number, max: number): number;
2
1
  export declare function getItemTransform(index: number, count: number, radius: number, axis: "x" | "y" | "z"): {
3
2
  position: readonly [number, 0, number] | readonly [0, number, number] | readonly [number, number, 0];
4
3
  rotation: readonly [0, number, 0] | readonly [number, 0, 0] | readonly [0, 0, number];
@@ -1,9 +1,6 @@
1
- import { type ForwardRefExoticComponent, type RefAttributes } from "react";
2
1
  import { LinearCarouselNextTrigger, LinearCarouselPrevTrigger } from "./LinearCarouselTriggers";
3
2
  import type { LinearCarouselProps, LinearCarouselRef } from "./types";
4
- type LinearCarouselComponent = ForwardRefExoticComponent<LinearCarouselProps & RefAttributes<LinearCarouselRef>> & {
3
+ export declare const LinearCarousel: import("react").ForwardRefExoticComponent<LinearCarouselProps & import("react").RefAttributes<LinearCarouselRef>> & {
5
4
  NextTrigger: typeof LinearCarouselNextTrigger;
6
5
  PrevTrigger: typeof LinearCarouselPrevTrigger;
7
6
  };
8
- export declare const LinearCarousel: LinearCarouselComponent;
9
- export {};
@@ -1,3 +1,3 @@
1
- import type { LinearCarouselContextValue } from "./types";
2
- export declare const LinearCarouselContext: import("react").Context<LinearCarouselContextValue | null>;
3
- export declare function useLinearCarouselContext(): LinearCarouselContextValue;
1
+ import { CarouselContext } from "../../hooks";
2
+ export { CarouselContext as LinearCarouselContext };
3
+ export declare function useLinearCarouselContext(): import("./types").LinearCarouselContextValue;
@@ -1,20 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
- export type DragConfig = {
3
- /** Axis to constrain drag movement */
4
- axis?: "x" | "y";
5
- /** Pointer options for drag gesture */
6
- pointer?: {
7
- touch?: boolean;
8
- capture?: boolean;
9
- keys?: boolean;
10
- };
11
- /** Touch action CSS property. Default: "none" */
12
- touchAction?: string;
13
- /** Threshold in pixels before drag starts */
14
- threshold?: number;
15
- /** Rubberband effect when dragging past bounds (0-1) */
16
- rubberband?: boolean | number;
17
- };
2
+ import type { DragConfig, CarouselContextValue } from "../../hooks";
3
+ export type { DragConfig };
4
+ export type { CarouselContextValue as LinearCarouselContextValue };
18
5
  export type LinearCarouselProps = {
19
6
  children: ReactNode;
20
7
  gap?: number;
@@ -28,16 +15,11 @@ export type LinearCarouselProps = {
28
15
  dragAxis?: "x" | "y";
29
16
  /** Additional drag gesture configuration */
30
17
  dragConfig?: DragConfig;
18
+ /** When true, navigation wraps from last item to first and vice versa. Default: false */
19
+ infinite?: boolean;
31
20
  };
32
21
  export type LinearCarouselRef = {
33
22
  next(): void;
34
23
  prev(): void;
35
24
  goTo(index: number): void;
36
25
  };
37
- export type LinearCarouselContextValue = {
38
- activeIndex: number;
39
- count: number;
40
- next: () => void;
41
- prev: () => void;
42
- goTo: (index: number) => void;
43
- };
@@ -1,2 +1 @@
1
- export declare function clamp(value: number, min: number, max: number): number;
2
1
  export declare function getItemPosition(index: number, gap: number, direction: "horizontal" | "vertical"): readonly [number, number, number];
@@ -0,0 +1,9 @@
1
+ import type React from "react";
2
+ /**
3
+ * A floating 3D shape for use in carousel stories.
4
+ * Pass `isActive` to control the float animation.
5
+ */
6
+ export declare function FloatingShape({ type, isActive, }: {
7
+ type: "box" | "sphere" | "cone" | "plane";
8
+ isActive: boolean;
9
+ }): React.ReactNode;
@@ -0,0 +1,2 @@
1
+ export { useCarouselDrag, type DragConfig, type SpringConfig, type UseCarouselDragOptions, type UseCarouselDragReturn, } from "./useCarouselDrag";
2
+ export { CarouselContext, useCarouselContext, type CarouselContextValue, } from "./useCarouselContext";
@@ -0,0 +1,20 @@
1
+ export type CarouselContextValue = {
2
+ /** Currently active item index */
3
+ activeIndex: number;
4
+ /** Total number of items */
5
+ count: number;
6
+ /** Navigate to the next item */
7
+ next: () => void;
8
+ /** Navigate to the previous item */
9
+ prev: () => void;
10
+ /** Navigate to a specific item by index */
11
+ goTo: (index: number) => void;
12
+ };
13
+ export declare const CarouselContext: import("react").Context<CarouselContextValue | null>;
14
+ /**
15
+ * Hook to access carousel context from within a carousel component.
16
+ * @param componentName - Name of the carousel component for error messages
17
+ * @returns The carousel context value
18
+ * @throws If used outside of a carousel component
19
+ */
20
+ export declare function useCarouselContext(componentName: string): CarouselContextValue;
@@ -0,0 +1,85 @@
1
+ import { type SpringRef } from "@react-spring/web";
2
+ export type DragConfig = {
3
+ /** Axis to constrain drag movement */
4
+ axis?: "x" | "y";
5
+ /** Pointer options for drag gesture */
6
+ pointer?: {
7
+ touch?: boolean;
8
+ capture?: boolean;
9
+ keys?: boolean;
10
+ };
11
+ /** Touch action CSS property. Default: "none" */
12
+ touchAction?: string;
13
+ /** Threshold in pixels before drag starts. Default: 5 */
14
+ threshold?: number;
15
+ /** Rubberband effect when dragging past bounds (0-1) */
16
+ rubberband?: boolean | number;
17
+ /** Filter out taps (clicks) from drags. Default: true */
18
+ filterTaps?: boolean;
19
+ };
20
+ export type SpringConfig = {
21
+ tension: number;
22
+ friction: number;
23
+ };
24
+ export type UseCarouselDragOptions = {
25
+ /** Number of items in the carousel */
26
+ count: number;
27
+ /** Whether drag is enabled */
28
+ dragEnabled: boolean;
29
+ /** Axis for drag gesture ("x" or "y") */
30
+ dragAxis: "x" | "y";
31
+ /** Sensitivity for drag movement (pixels per unit) */
32
+ dragSensitivity: number;
33
+ /** Maximum drag amount per gesture (e.g., itemSpacing or anglePerItem) */
34
+ maxDragAmount: number;
35
+ /** Additional drag configuration */
36
+ dragConfig?: DragConfig;
37
+ /** Spring configuration for settling animations */
38
+ springConfig: SpringConfig;
39
+ /** Spring configuration for drag animations */
40
+ dragSpringConfig: SpringConfig;
41
+ /**
42
+ * Calculate the nearest index from an offset value.
43
+ * @param offset - The current offset value
44
+ * @returns The nearest index
45
+ */
46
+ calculateIndexFromOffset: (offset: number) => number;
47
+ /**
48
+ * Calculate the final target index after drag ends.
49
+ * @param currentOffset - The offset at drag end
50
+ * @param startIndex - The index when drag started
51
+ * @param dragAmount - The clamped drag amount
52
+ * @returns The target index to navigate to
53
+ */
54
+ calculateTargetIndex: (currentOffset: number, startIndex: number, dragAmount: number) => number;
55
+ /**
56
+ * Calculate the target offset for an index.
57
+ * @param index - The target index
58
+ * @param currentOffset - The current offset (useful for shortest path calculations)
59
+ * @returns The target offset value
60
+ */
61
+ calculateTargetOffset: (index: number, currentOffset: number) => number;
62
+ /**
63
+ * Called when navigation completes with the final index.
64
+ */
65
+ onNavigate: (index: number) => void;
66
+ };
67
+ export type UseCarouselDragReturn = {
68
+ /** Spring offset value */
69
+ offset: {
70
+ get: () => number;
71
+ };
72
+ /** Spring API for manual control */
73
+ springApi: SpringRef<{
74
+ offset: number;
75
+ }>;
76
+ /** Ref tracking if currently dragging */
77
+ isDraggingRef: React.MutableRefObject<boolean>;
78
+ /** Ref tracking current offset value (updated each frame) */
79
+ currentOffsetRef: React.MutableRefObject<number>;
80
+ };
81
+ /**
82
+ * Shared hook for carousel drag behavior.
83
+ * Handles spring animation, gesture recognition, and cursor management.
84
+ */
85
+ export declare function useCarouselDrag(options: UseCarouselDragOptions): UseCarouselDragReturn;
@@ -1,37 +1,9 @@
1
- import { jsx as D, jsxs as bt } from "react/jsx-runtime";
2
- import Ot, { createContext as dt, useContext as St, forwardRef as Pt, useState as Dt, useRef as N, useMemo as et, Children as Lt, isValidElement as rt, useCallback as E, useImperativeHandle as Mt, useEffect as nt } from "react";
3
- import { useThree as Ft, useFrame as Gt } from "@react-three/fiber";
4
- import { useSpring as Ut } from "@react-spring/web";
5
- import { useDrag as kt } from "@use-gesture/react";
6
- const S = 2 * Math.PI, zt = 3, jt = "y", Bt = 280, Z = {
7
- tension: 200,
8
- friction: 25
9
- }, Wt = {
10
- tension: 400,
11
- friction: 50
12
- };
13
- function mt(c, t, u) {
14
- return Math.max(t, Math.min(u, c));
15
- }
16
- function Xt(c, t, u, r) {
17
- const o = c / t * S, l = Math.cos(o) * u, s = Math.sin(o) * u, I = r === "y" ? [s, 0, l] : r === "x" ? [0, l, s] : [l, s, 0], $ = r === "y" ? [0, Math.PI + o, 0] : r === "x" ? [Math.PI + o, 0, 0] : [0, 0, Math.PI + o];
18
- return {
19
- position: I,
20
- rotation: $
21
- };
22
- }
23
- function pt(c, t) {
24
- const u = Math.round((c - t) / S);
25
- return t + u * S;
26
- }
27
- const wt = dt(null);
28
- function $t() {
29
- const c = St(wt);
30
- if (!c)
31
- throw new Error("CircularCarousel compound components must be used within CircularCarousel");
32
- return c;
33
- }
34
- var C = { exports: {} }, ht = {};
1
+ import { jsx as dt, jsxs as Yt } from "react/jsx-runtime";
2
+ import Vt, { useRef as nt, useEffect as St, createContext as te, useContext as ee, forwardRef as jt, useState as zt, Children as Wt, useImperativeHandle as Xt, isValidElement as yt } from "react";
3
+ import { useThree as re, useFrame as Bt } from "@react-three/fiber";
4
+ import { useSpring as ne } from "@react-spring/web";
5
+ import { useDrag as oe } from "@use-gesture/react";
6
+ var Ot = { exports: {} }, bt = {};
35
7
  /**
36
8
  * @license React
37
9
  * react-compiler-runtime.production.js
@@ -41,16 +13,16 @@ var C = { exports: {} }, ht = {};
41
13
  * This source code is licensed under the MIT license found in the
42
14
  * LICENSE file in the root directory of this source tree.
43
15
  */
44
- var It;
45
- function Jt() {
46
- if (It) return ht;
47
- It = 1;
48
- var c = Ot.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
49
- return ht.c = function(t) {
50
- return c.H.useMemoCache(t);
51
- }, ht;
16
+ var qt;
17
+ function se() {
18
+ if (qt) return bt;
19
+ qt = 1;
20
+ var n = Vt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
21
+ return bt.c = function(e) {
22
+ return n.H.useMemoCache(e);
23
+ }, bt;
52
24
  }
53
- var Rt = {};
25
+ var Pt = {};
54
26
  /**
55
27
  * @license React
56
28
  * react-compiler-runtime.development.js
@@ -60,379 +32,526 @@ var Rt = {};
60
32
  * This source code is licensed under the MIT license found in the
61
33
  * LICENSE file in the root directory of this source tree.
62
34
  */
63
- var xt;
64
- function Kt() {
65
- return xt || (xt = 1, process.env.NODE_ENV !== "production" && (function() {
66
- var c = Ot.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
67
- Rt.c = function(t) {
68
- var u = c.H;
35
+ var wt;
36
+ function ie() {
37
+ return wt || (wt = 1, process.env.NODE_ENV !== "production" && (function() {
38
+ var n = Vt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
39
+ Pt.c = function(e) {
40
+ var u = n.H;
69
41
  return u === null && console.error(
70
42
  `Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
71
43
  1. You might have mismatching versions of React and the renderer (such as React DOM)
72
44
  2. You might be breaking the Rules of Hooks
73
45
  3. You might have more than one copy of React in the same app
74
46
  See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`
75
- ), u.useMemoCache(t);
47
+ ), u.useMemoCache(e);
76
48
  };
77
- })()), Rt;
49
+ })()), Pt;
78
50
  }
79
- var At;
80
- function Qt() {
81
- return At || (At = 1, process.env.NODE_ENV === "production" ? C.exports = Jt() : C.exports = Kt()), C.exports;
51
+ var Ht;
52
+ function ce() {
53
+ return Ht || (Ht = 1, process.env.NODE_ENV === "production" ? Ot.exports = se() : Ot.exports = ie()), Ot.exports;
82
54
  }
83
- var ot = Qt();
84
- function vt(c) {
85
- const t = ot.c(9), {
86
- next: u
87
- } = $t();
88
- let r, o;
89
- t[0] !== c ? ({
90
- children: r,
91
- ...o
92
- } = c, t[0] = c, t[1] = r, t[2] = o) : (r = t[1], o = t[2]);
93
- let l;
94
- t[3] !== u ? (l = () => u(), t[3] = u, t[4] = l) : l = t[4];
95
- let s;
96
- return t[5] !== r || t[6] !== o || t[7] !== l ? (s = /* @__PURE__ */ D("group", { onClick: l, ...o, children: r }), t[5] = r, t[6] = o, t[7] = l, t[8] = s) : s = t[8], s;
55
+ var _t = ce();
56
+ const w = 2 * Math.PI, le = 3, ue = "y", ae = 280, Dt = {
57
+ tension: 200,
58
+ friction: 25
59
+ }, fe = {
60
+ tension: 400,
61
+ friction: 50
62
+ };
63
+ function Et(n, e, u) {
64
+ return Math.max(e, Math.min(u, n));
97
65
  }
98
- function _t(c) {
99
- const t = ot.c(9), {
100
- prev: u
101
- } = $t();
102
- let r, o;
103
- t[0] !== c ? ({
104
- children: r,
105
- ...o
106
- } = c, t[0] = c, t[1] = r, t[2] = o) : (r = t[1], o = t[2]);
107
- let l;
108
- t[3] !== u ? (l = () => u(), t[3] = u, t[4] = l) : l = t[4];
109
- let s;
110
- return t[5] !== r || t[6] !== o || t[7] !== l ? (s = /* @__PURE__ */ D("group", { onClick: l, ...o, children: r }), t[5] = r, t[6] = o, t[7] = l, t[8] = s) : s = t[8], s;
66
+ function de(n, e, u, t) {
67
+ const s = n / e * w, c = Math.cos(s) * u, o = Math.sin(s) * u, k = t === "y" ? [o, 0, c] : t === "x" ? [0, c, o] : [c, o, 0], H = t === "y" ? [0, Math.PI + s, 0] : t === "x" ? [Math.PI + s, 0, 0] : [0, 0, Math.PI + s];
68
+ return {
69
+ position: k,
70
+ rotation: H
71
+ };
111
72
  }
112
- const Tt = Pt(function({
113
- children: t,
114
- radius: u = zt,
115
- axis: r = jt,
116
- index: o,
117
- defaultIndex: l = 0,
118
- onIndexChange: s,
119
- dragEnabled: I = !0,
120
- dragSensitivity: $,
121
- dragAxis: X = "x",
122
- dragConfig: a
123
- }, st) {
124
- const [ct, q] = Dt(l), x = o !== void 0, R = x ? o : ct, p = N(R);
125
- p.current = R;
126
- const H = et(() => Lt.toArray(t), [t]), Y = H.filter((i) => rt(i) && i.type !== vt && i.type !== _t), ut = H.filter((i) => rt(i) && (i.type === vt || i.type === _t)), n = Y.length, P = N(null), y = n > 0 ? S / n : S, it = $ ?? Bt / y, [{
127
- offset: lt
128
- }, V] = Ut(() => ({
129
- offset: 0
130
- })), v = N(V);
131
- v.current = V;
132
- const z = N(!1), A = N(0), j = N(0), _ = E((i) => {
133
- const e = mt(i, 0, n - 1);
134
- if (e === p.current) return;
135
- p.current = e, x || q(e), s == null || s(e);
136
- const f = -(e / n) * S, m = pt(A.current, f);
137
- v.current.start({
138
- offset: m,
139
- config: Z
140
- });
141
- }, [n, x, s]), b = E(() => {
142
- n !== 0 && _((p.current + 1) % n);
143
- }, [n, _]), O = E(() => {
144
- n !== 0 && _((p.current - 1 + n) % n);
145
- }, [n, _]), d = E((i) => _(i), [_]);
146
- Mt(st, () => ({
147
- next: b,
148
- prev: O,
149
- goTo: d
150
- }), [b, O, d]), nt(() => {
151
- if (!z.current && n > 0) {
152
- const i = -(R / n) * S, e = A.current, m = e === 0 && R !== 0 ? i : pt(e, i);
153
- v.current.start({
154
- offset: m,
155
- config: Z
156
- });
157
- }
158
- }, [R, n]);
73
+ function Lt(n, e) {
74
+ const u = Math.round((n - e) / w);
75
+ return e + u * w;
76
+ }
77
+ function Jt(n) {
159
78
  const {
160
- gl: h
161
- } = Ft();
162
- kt(({
163
- active: i,
164
- movement: [e, f],
165
- first: m,
166
- last: K,
167
- event: ft
79
+ count: e,
80
+ dragEnabled: u,
81
+ dragAxis: t,
82
+ dragSensitivity: s,
83
+ maxDragAmount: c,
84
+ dragConfig: o,
85
+ springConfig: k,
86
+ dragSpringConfig: H,
87
+ calculateIndexFromOffset: d,
88
+ calculateTargetIndex: gt,
89
+ calculateTargetOffset: At,
90
+ onNavigate: Tt
91
+ } = n, {
92
+ gl: E
93
+ } = re(), [{
94
+ offset: ot
95
+ }, T] = ne(() => ({
96
+ offset: 0
97
+ })), N = nt(T);
98
+ N.current = T;
99
+ const st = nt(!1), L = nt(0), R = nt(0), mt = nt(0);
100
+ return oe(({
101
+ active: h,
102
+ movement: [f, g],
103
+ first: C,
104
+ last: M
168
105
  }) => {
169
- z.current = i;
170
- const G = ft, U = X === "x" ? e : f;
171
- if (i && m && G.pointerId != null && (h.domElement.setPointerCapture(G.pointerId), h.domElement.style.cursor = "grabbing", j.current = A.current), !i && K && G.pointerId != null) {
172
- try {
173
- h.domElement.releasePointerCapture(G.pointerId);
174
- } catch {
175
- }
176
- h.domElement.style.cursor = "grab";
106
+ st.current = h;
107
+ const F = t === "x" ? f : g;
108
+ C && (R.current = L.current, mt.current = d(L.current)), h && C && (E.domElement.style.cursor = "grabbing"), !h && M && (E.domElement.style.cursor = "grab");
109
+ const S = R.current, q = Number(F);
110
+ let y = 0;
111
+ if (Number.isFinite(q)) {
112
+ const b = q / s;
113
+ y = Et(b, -c, c);
177
114
  }
178
- const B = m ? A.current : j.current, k = Number(U), L = Number.isFinite(k) ? mt(k / it, -y, y) : 0;
179
- if (i)
180
- v.current.start({
181
- offset: B + L,
182
- config: Wt
115
+ if (h)
116
+ N.current.start({
117
+ offset: S + y,
118
+ config: H
183
119
  });
184
120
  else {
185
- const M = p.current, W = (M - 1 + n) % n, Q = (M + 1) % n, w = B + L;
186
- let T = (Math.round(-w / S * n) % n + n) % n;
187
- T !== W && T !== M && T !== Q && (T = L > 0 ? Q : L < 0 ? W : M);
188
- const F = mt(T, 0, n - 1);
189
- if (n === 0 || !Number.isFinite(F)) {
190
- v.current.start({
191
- offset: B,
192
- config: Z
121
+ const b = mt.current, r = S + y, i = gt(r, b, y);
122
+ if (e === 0 || !Number.isFinite(i)) {
123
+ N.current.start({
124
+ offset: S,
125
+ config: k
193
126
  });
194
127
  return;
195
128
  }
196
- p.current = F, x || q(F), s == null || s(F);
197
- const Yt = -(F / n) * S, Vt = pt(w, Yt);
198
- v.current.start({
199
- offset: Vt,
200
- config: Z
129
+ Tt(i);
130
+ const G = At(i, r);
131
+ N.current.start({
132
+ offset: G,
133
+ config: k
201
134
  });
202
135
  }
203
136
  }, {
204
- target: h.domElement,
205
- enabled: I,
206
- pointer: (a == null ? void 0 : a.pointer) ?? {
137
+ target: E.domElement,
138
+ enabled: u,
139
+ from: () => [0, 0],
140
+ filterTaps: (o == null ? void 0 : o.filterTaps) ?? !0,
141
+ threshold: (o == null ? void 0 : o.threshold) ?? 5,
142
+ pointer: (o == null ? void 0 : o.pointer) ?? {
207
143
  touch: !0,
208
144
  capture: !0
209
145
  },
210
- axis: (a == null ? void 0 : a.axis) ?? X,
211
- touchAction: (a == null ? void 0 : a.touchAction) ?? "none",
212
- threshold: a == null ? void 0 : a.threshold,
213
- rubberband: a == null ? void 0 : a.rubberband
214
- }), nt(() => {
215
- if (!I) return;
216
- const i = h.domElement, e = i.style.touchAction, f = i.style.cursor;
217
- return i.style.touchAction = "none", i.style.cursor = "grab", () => {
218
- i.style.touchAction = e, i.style.cursor = f;
146
+ axis: (o == null ? void 0 : o.axis) ?? t,
147
+ touchAction: (o == null ? void 0 : o.touchAction) ?? "none",
148
+ rubberband: o == null ? void 0 : o.rubberband
149
+ }), St(() => {
150
+ if (!u) return;
151
+ const h = E.domElement, f = h.style.touchAction, g = h.style.cursor;
152
+ return h.style.touchAction = "none", h.style.cursor = "grab", () => {
153
+ h.style.touchAction = f, h.style.cursor = g;
219
154
  };
220
- }, [I, h.domElement]), Gt(() => {
221
- if (!P.current) return;
222
- const i = lt.get();
223
- A.current = i, P.current.rotation[r] = i;
224
- });
225
- const J = E((i) => Xt(i, n, u, r), [n, u, r]), at = et(() => ({
226
- activeIndex: R,
227
- count: n,
228
- next: b,
229
- prev: O,
230
- goTo: d
231
- }), [R, n, b, O, d]);
232
- return /* @__PURE__ */ bt(wt.Provider, { value: at, children: [
233
- /* @__PURE__ */ D("group", { ref: P, children: Y.map((i, e) => {
234
- const {
235
- position: f,
236
- rotation: m
237
- } = J(e);
238
- return /* @__PURE__ */ D("group", { position: f, rotation: m, children: i }, i.key ?? e);
239
- }) }),
240
- ut
241
- ] });
155
+ }, [u, E.domElement]), {
156
+ offset: ot,
157
+ springApi: T,
158
+ isDraggingRef: st,
159
+ currentOffsetRef: L
160
+ };
161
+ }
162
+ const Ft = te(null);
163
+ function Kt(n) {
164
+ const e = ee(Ft);
165
+ if (!e)
166
+ throw new Error(`${n} compound components must be used within ${n}`);
167
+ return e;
168
+ }
169
+ function Qt() {
170
+ return Kt("CircularCarousel");
171
+ }
172
+ function Gt(n) {
173
+ const e = _t.c(9), {
174
+ next: u
175
+ } = Qt();
176
+ let t, s;
177
+ e[0] !== n ? ({
178
+ children: t,
179
+ ...s
180
+ } = n, e[0] = n, e[1] = t, e[2] = s) : (t = e[1], s = e[2]);
181
+ let c;
182
+ e[3] !== u ? (c = () => u(), e[3] = u, e[4] = c) : c = e[4];
183
+ let o;
184
+ return e[5] !== t || e[6] !== s || e[7] !== c ? (o = /* @__PURE__ */ dt("group", { onClick: c, ...s, children: t }), e[5] = t, e[6] = s, e[7] = c, e[8] = o) : o = e[8], o;
185
+ }
186
+ function Ut(n) {
187
+ const e = _t.c(9), {
188
+ prev: u
189
+ } = Qt();
190
+ let t, s;
191
+ e[0] !== n ? ({
192
+ children: t,
193
+ ...s
194
+ } = n, e[0] = n, e[1] = t, e[2] = s) : (t = e[1], s = e[2]);
195
+ let c;
196
+ e[3] !== u ? (c = () => u(), e[3] = u, e[4] = c) : c = e[4];
197
+ let o;
198
+ return e[5] !== t || e[6] !== s || e[7] !== c ? (o = /* @__PURE__ */ dt("group", { onClick: c, ...s, children: t }), e[5] = t, e[6] = s, e[7] = c, e[8] = o) : o = e[8], o;
199
+ }
200
+ const Se = Object.assign(jt(function(e, u) {
201
+ const t = _t.c(76), {
202
+ children: s,
203
+ radius: c,
204
+ axis: o,
205
+ index: k,
206
+ defaultIndex: H,
207
+ onIndexChange: d,
208
+ dragEnabled: gt,
209
+ dragSensitivity: At,
210
+ dragAxis: Tt,
211
+ dragConfig: E
212
+ } = e, ot = c === void 0 ? le : c, T = o === void 0 ? ue : o, N = H === void 0 ? 0 : H, st = gt === void 0 ? !0 : gt, L = Tt === void 0 ? "x" : Tt, [R, mt] = zt(N), h = k !== void 0, f = h ? k : R, g = nt(f);
213
+ let C, M;
214
+ t[0] !== f ? (C = () => {
215
+ g.current = f;
216
+ }, M = [f], t[0] = f, t[1] = C, t[2] = M) : (C = t[1], M = t[2]), St(C, M);
217
+ let F;
218
+ t[3] !== s ? (F = Wt.toArray(s), t[3] = s, t[4] = F) : F = t[4];
219
+ const S = F, q = S.filter(ge);
220
+ let y;
221
+ t[5] !== S ? (y = S.filter(me), t[5] = S, t[6] = y) : y = t[6];
222
+ const b = y, r = q.length, i = nt(null), G = r > 0 ? w / r : w, m = At ?? ae / G;
223
+ let it;
224
+ t[7] !== r ? (it = (a) => (Math.round(-a / w * r) % r + r) % r, t[7] = r, t[8] = it) : it = t[8];
225
+ const pt = it;
226
+ let Y;
227
+ t[9] !== r ? (Y = (a, p, l) => {
228
+ const v = (p - 1 + r) % r, $ = (p + 1) % r;
229
+ let Nt = (Math.round(-a / w * r) % r + r) % r;
230
+ return Nt !== v && Nt !== p && Nt !== $ && (Nt = l > 0 ? $ : l < 0 ? v : p), Nt;
231
+ }, t[9] = r, t[10] = Y) : Y = t[10];
232
+ const ht = Y;
233
+ let V;
234
+ t[11] !== r ? (V = (a, p) => {
235
+ const l = -(a / r) * w;
236
+ return Lt(p, l);
237
+ }, t[11] = r, t[12] = V) : V = t[12];
238
+ const vt = V;
239
+ let j;
240
+ t[13] !== h || t[14] !== d ? (j = (a) => {
241
+ g.current = a, h || mt(a), d == null || d(a);
242
+ }, t[13] = h, t[14] = d, t[15] = j) : j = t[15];
243
+ const xt = j;
244
+ let z;
245
+ t[16] !== G || t[17] !== pt || t[18] !== ht || t[19] !== vt || t[20] !== r || t[21] !== L || t[22] !== E || t[23] !== st || t[24] !== m || t[25] !== xt ? (z = {
246
+ count: r,
247
+ dragEnabled: st,
248
+ dragAxis: L,
249
+ dragSensitivity: m,
250
+ maxDragAmount: G,
251
+ dragConfig: E,
252
+ springConfig: Dt,
253
+ dragSpringConfig: fe,
254
+ calculateIndexFromOffset: pt,
255
+ calculateTargetIndex: ht,
256
+ calculateTargetOffset: vt,
257
+ onNavigate: xt
258
+ }, t[16] = G, t[17] = pt, t[18] = ht, t[19] = vt, t[20] = r, t[21] = L, t[22] = E, t[23] = st, t[24] = m, t[25] = xt, t[26] = z) : z = t[26];
259
+ const {
260
+ offset: Rt,
261
+ springApi: P,
262
+ isDraggingRef: ct,
263
+ currentOffsetRef: x
264
+ } = Jt(z);
265
+ let W;
266
+ t[27] !== r || t[28] !== x || t[29] !== h || t[30] !== d || t[31] !== P ? (W = (a) => {
267
+ const p = Et(a, 0, r - 1);
268
+ if (p === g.current)
269
+ return;
270
+ g.current = p, h || mt(p), d == null || d(p);
271
+ const l = -(p / r) * w, v = Lt(x.current, l);
272
+ P.start({
273
+ offset: v,
274
+ config: Dt
275
+ });
276
+ }, t[27] = r, t[28] = x, t[29] = h, t[30] = d, t[31] = P, t[32] = W) : W = t[32];
277
+ const O = W;
278
+ let X;
279
+ t[33] !== r || t[34] !== O ? (X = () => {
280
+ r !== 0 && O((g.current + 1) % r);
281
+ }, t[33] = r, t[34] = O, t[35] = X) : X = t[35];
282
+ const I = X;
283
+ let B;
284
+ t[36] !== r || t[37] !== O ? (B = () => {
285
+ r !== 0 && O((g.current - 1 + r) % r);
286
+ }, t[36] = r, t[37] = O, t[38] = B) : B = t[38];
287
+ const _ = B;
288
+ let J;
289
+ t[39] !== O ? (J = (a) => O(a), t[39] = O, t[40] = J) : J = t[40];
290
+ const A = J;
291
+ let K, D;
292
+ t[41] !== A || t[42] !== I || t[43] !== _ ? (K = () => ({
293
+ next: I,
294
+ prev: _,
295
+ goTo: A
296
+ }), D = [I, _, A], t[41] = A, t[42] = I, t[43] = _, t[44] = K, t[45] = D) : (K = t[44], D = t[45]), Xt(u, K, D);
297
+ let Q, Z;
298
+ t[46] !== f || t[47] !== r || t[48] !== x || t[49] !== ct || t[50] !== P ? (Q = () => {
299
+ if (!ct.current && r > 0) {
300
+ const a = -(f / r) * w, p = x.current, v = p === 0 && f !== 0 ? a : Lt(p, a);
301
+ P.start({
302
+ offset: v,
303
+ config: Dt
304
+ });
305
+ }
306
+ }, Z = [f, r, P, ct, x], t[46] = f, t[47] = r, t[48] = x, t[49] = ct, t[50] = P, t[51] = Q, t[52] = Z) : (Q = t[51], Z = t[52]), St(Q, Z);
307
+ let tt;
308
+ t[53] !== T || t[54] !== x || t[55] !== Rt ? (tt = () => {
309
+ if (!i.current)
310
+ return;
311
+ const a = Rt.get();
312
+ x.current = a, i.current.rotation[T] = a;
313
+ }, t[53] = T, t[54] = x, t[55] = Rt, t[56] = tt) : tt = t[56], Bt(tt);
314
+ let et;
315
+ t[57] !== T || t[58] !== r || t[59] !== ot ? (et = (a) => de(a, r, ot, T), t[57] = T, t[58] = r, t[59] = ot, t[60] = et) : et = t[60];
316
+ const lt = et;
317
+ let rt;
318
+ t[61] !== f || t[62] !== r || t[63] !== A || t[64] !== I || t[65] !== _ ? (rt = {
319
+ activeIndex: f,
320
+ count: r,
321
+ next: I,
322
+ prev: _,
323
+ goTo: A
324
+ }, t[61] = f, t[62] = r, t[63] = A, t[64] = I, t[65] = _, t[66] = rt) : rt = t[66];
325
+ const It = rt, ut = Ft;
326
+ let at;
327
+ t[67] !== lt ? (at = (a, p) => {
328
+ const {
329
+ position: l,
330
+ rotation: v
331
+ } = lt(p);
332
+ return /* @__PURE__ */ dt("group", { position: l, rotation: v, children: a }, a.key ?? p);
333
+ }, t[67] = lt, t[68] = at) : at = t[68];
334
+ const Ct = q.map(at);
335
+ let U;
336
+ t[69] !== Ct ? (U = /* @__PURE__ */ dt("group", { ref: i, children: Ct }), t[69] = Ct, t[70] = U) : U = t[70];
337
+ let ft;
338
+ return t[71] !== It || t[72] !== ut.Provider || t[73] !== U || t[74] !== b ? (ft = /* @__PURE__ */ Yt(ut.Provider, { value: It, children: [
339
+ U,
340
+ b
341
+ ] }), t[71] = It, t[72] = ut.Provider, t[73] = U, t[74] = b, t[75] = ft) : ft = t[75], ft;
342
+ }), {
343
+ NextTrigger: Gt,
344
+ PrevTrigger: Ut
242
345
  });
243
- Tt.NextTrigger = vt;
244
- Tt.PrevTrigger = _t;
245
- const ue = Tt, Zt = 0.5, Ct = "horizontal", gt = 150, g = {
346
+ function ge(n) {
347
+ return yt(n) && n.type !== Gt && n.type !== Ut;
348
+ }
349
+ function me(n) {
350
+ return yt(n) && (n.type === Gt || n.type === Ut);
351
+ }
352
+ const pe = 0.5, he = "horizontal", ve = 150, Mt = {
246
353
  tension: 200,
247
354
  friction: 25
248
- }, te = {
355
+ }, xe = {
249
356
  tension: 400,
250
357
  friction: 50
251
358
  };
252
- function tt(c, t, u) {
253
- return Math.max(t, Math.min(u, c));
254
- }
255
- function ee(c, t, u) {
256
- const r = c * (1 + t);
257
- return u === "horizontal" ? [r, 0, 0] : [0, r, 0];
359
+ function Re(n, e, u) {
360
+ const t = n * (1 + e);
361
+ return u === "horizontal" ? [t, 0, 0] : [0, t, 0];
258
362
  }
259
- const qt = dt(null);
260
- function Ht() {
261
- const c = St(qt);
262
- if (!c)
263
- throw new Error("LinearCarousel compound components must be used within LinearCarousel");
264
- return c;
363
+ function Zt() {
364
+ return Kt("LinearCarousel");
265
365
  }
266
- function yt(c) {
267
- const t = ot.c(9), {
366
+ function $t(n) {
367
+ const e = _t.c(9), {
268
368
  next: u
269
- } = Ht();
270
- let r, o;
271
- t[0] !== c ? ({
272
- children: r,
273
- ...o
274
- } = c, t[0] = c, t[1] = r, t[2] = o) : (r = t[1], o = t[2]);
275
- let l;
276
- t[3] !== u ? (l = () => u(), t[3] = u, t[4] = l) : l = t[4];
277
- let s;
278
- return t[5] !== r || t[6] !== o || t[7] !== l ? (s = /* @__PURE__ */ D("group", { onClick: l, ...o, children: r }), t[5] = r, t[6] = o, t[7] = l, t[8] = s) : s = t[8], s;
369
+ } = Zt();
370
+ let t, s;
371
+ e[0] !== n ? ({
372
+ children: t,
373
+ ...s
374
+ } = n, e[0] = n, e[1] = t, e[2] = s) : (t = e[1], s = e[2]);
375
+ let c;
376
+ e[3] !== u ? (c = () => u(), e[3] = u, e[4] = c) : c = e[4];
377
+ let o;
378
+ return e[5] !== t || e[6] !== s || e[7] !== c ? (o = /* @__PURE__ */ dt("group", { onClick: c, ...s, children: t }), e[5] = t, e[6] = s, e[7] = c, e[8] = o) : o = e[8], o;
279
379
  }
280
- function Nt(c) {
281
- const t = ot.c(9), {
380
+ function kt(n) {
381
+ const e = _t.c(9), {
282
382
  prev: u
283
- } = Ht();
284
- let r, o;
285
- t[0] !== c ? ({
286
- children: r,
287
- ...o
288
- } = c, t[0] = c, t[1] = r, t[2] = o) : (r = t[1], o = t[2]);
289
- let l;
290
- t[3] !== u ? (l = () => u(), t[3] = u, t[4] = l) : l = t[4];
291
- let s;
292
- return t[5] !== r || t[6] !== o || t[7] !== l ? (s = /* @__PURE__ */ D("group", { onClick: l, ...o, children: r }), t[5] = r, t[6] = o, t[7] = l, t[8] = s) : s = t[8], s;
383
+ } = Zt();
384
+ let t, s;
385
+ e[0] !== n ? ({
386
+ children: t,
387
+ ...s
388
+ } = n, e[0] = n, e[1] = t, e[2] = s) : (t = e[1], s = e[2]);
389
+ let c;
390
+ e[3] !== u ? (c = () => u(), e[3] = u, e[4] = c) : c = e[4];
391
+ let o;
392
+ return e[5] !== t || e[6] !== s || e[7] !== c ? (o = /* @__PURE__ */ dt("group", { onClick: c, ...s, children: t }), e[5] = t, e[6] = s, e[7] = c, e[8] = o) : o = e[8], o;
293
393
  }
294
- const Et = Pt(function({
295
- children: t,
296
- gap: u = Zt,
297
- direction: r = Ct,
298
- index: o,
299
- defaultIndex: l = 0,
300
- onIndexChange: s,
301
- dragEnabled: I = !0,
302
- dragSensitivity: $,
303
- dragAxis: X,
304
- dragConfig: a
305
- }, st) {
306
- const [ct, q] = Dt(l), x = o !== void 0, R = x ? o : ct, p = N(R);
307
- p.current = R;
308
- const H = et(() => Lt.toArray(t), [t]), Y = H.filter((e) => rt(e) && e.type !== yt && e.type !== Nt), ut = H.filter((e) => rt(e) && (e.type === yt || e.type === Nt)), n = Y.length, P = N(null), y = 1 + u, it = $ ?? gt, [{
309
- offset: lt
310
- }, V] = Ut(() => ({
311
- offset: 0
312
- })), v = N(V);
313
- v.current = V;
314
- const z = N(!1), A = N(0), j = N(0), _ = E((e) => {
315
- const f = tt(e, 0, n - 1);
316
- if (f === p.current) return;
317
- p.current = f, x || q(f), s == null || s(f);
318
- const m = -f * y;
319
- v.current.start({
320
- offset: m,
321
- config: g
322
- });
323
- }, [n, x, s, y]), b = E(() => {
324
- if (n === 0) return;
325
- const e = Math.min(p.current + 1, n - 1);
326
- _(e);
327
- }, [n, _]), O = E(() => {
328
- if (n === 0) return;
329
- const e = Math.max(p.current - 1, 0);
330
- _(e);
331
- }, [n, _]), d = E((e) => _(e), [_]);
332
- Mt(st, () => ({
333
- next: b,
334
- prev: O,
335
- goTo: d
336
- }), [b, O, d]), nt(() => {
337
- if (!z.current && n > 0) {
338
- const e = -R * y;
339
- v.current.start({
340
- offset: e,
341
- config: g
342
- });
343
- }
344
- }, [R, n, y]);
394
+ const Oe = Object.assign(jt(function(e, u) {
395
+ const t = _t.c(80), {
396
+ children: s,
397
+ gap: c,
398
+ direction: o,
399
+ index: k,
400
+ defaultIndex: H,
401
+ onIndexChange: d,
402
+ dragEnabled: gt,
403
+ dragSensitivity: At,
404
+ dragAxis: Tt,
405
+ dragConfig: E,
406
+ infinite: ot
407
+ } = e, T = c === void 0 ? pe : c, N = o === void 0 ? he : o, st = H === void 0 ? 0 : H, L = gt === void 0 ? !0 : gt, R = ot === void 0 ? !1 : ot, [mt, h] = zt(st), f = k !== void 0, g = f ? k : mt, C = nt(g);
408
+ let M, F;
409
+ t[0] !== g ? (M = () => {
410
+ C.current = g;
411
+ }, F = [g], t[0] = g, t[1] = M, t[2] = F) : (M = t[1], F = t[2]), St(M, F);
412
+ let S;
413
+ t[3] !== s ? (S = Wt.toArray(s), t[3] = s, t[4] = S) : S = t[4];
414
+ const q = S, y = q.filter(Ie);
415
+ let b;
416
+ t[5] !== q ? (b = q.filter(Ce), t[5] = q, t[6] = b) : b = t[6];
417
+ const r = b, i = y.length, G = nt(null), m = 1 + T, it = At ?? ve, pt = Tt ?? (N === "horizontal" ? "x" : "y");
418
+ let Y;
419
+ t[7] !== m ? (Y = (l) => Math.round(-l / m), t[7] = m, t[8] = Y) : Y = t[8];
420
+ const ht = Y;
421
+ let V;
422
+ t[9] !== i || t[10] !== R || t[11] !== m ? (V = (l, v) => {
423
+ let $ = Math.round(-l / m);
424
+ return $ = Et($, v - 1, v + 1), R ? ($ % i + i) % i : Et($, 0, i - 1);
425
+ }, t[9] = i, t[10] = R, t[11] = m, t[12] = V) : V = t[12];
426
+ const vt = V;
427
+ let j;
428
+ t[13] !== m ? (j = (l) => -l * m, t[13] = m, t[14] = j) : j = t[14];
429
+ const xt = j;
430
+ let z;
431
+ t[15] !== f || t[16] !== d ? (z = (l) => {
432
+ C.current = l, f || h(l), d == null || d(l);
433
+ }, t[15] = f, t[16] = d, t[17] = z) : z = t[17];
434
+ const Rt = z;
435
+ let P;
436
+ t[18] !== ht || t[19] !== vt || t[20] !== xt || t[21] !== i || t[22] !== pt || t[23] !== E || t[24] !== L || t[25] !== it || t[26] !== Rt || t[27] !== m ? (P = {
437
+ count: i,
438
+ dragEnabled: L,
439
+ dragAxis: pt,
440
+ dragSensitivity: it,
441
+ maxDragAmount: m,
442
+ dragConfig: E,
443
+ springConfig: Mt,
444
+ dragSpringConfig: xe,
445
+ calculateIndexFromOffset: ht,
446
+ calculateTargetIndex: vt,
447
+ calculateTargetOffset: xt,
448
+ onNavigate: Rt
449
+ }, t[18] = ht, t[19] = vt, t[20] = xt, t[21] = i, t[22] = pt, t[23] = E, t[24] = L, t[25] = it, t[26] = Rt, t[27] = m, t[28] = P) : P = t[28];
345
450
  const {
346
- gl: h
347
- } = Ft(), J = X ?? (r === "horizontal" ? "x" : "y");
348
- kt(({
349
- active: e,
350
- movement: [f, m],
351
- first: K,
352
- last: ft,
353
- event: G
354
- }) => {
355
- z.current = e;
356
- const U = G, B = J === "x" ? f : m;
357
- if (e && K && U.pointerId != null && (h.domElement.setPointerCapture(U.pointerId), h.domElement.style.cursor = "grabbing", j.current = A.current), !e && ft && U.pointerId != null) {
358
- try {
359
- h.domElement.releasePointerCapture(U.pointerId);
360
- } catch {
361
- }
362
- h.domElement.style.cursor = "grab";
363
- }
364
- const k = K ? A.current : j.current, L = Number(B), M = Number.isFinite(L) ? tt(L / it, -y, y) : 0;
365
- if (e)
366
- v.current.start({
367
- offset: k + M,
368
- config: te
369
- });
370
- else {
371
- const W = p.current, Q = k + M;
372
- let w = Math.round(-Q / y);
373
- w = tt(w, W - 1, W + 1);
374
- const T = tt(w, 0, n - 1);
375
- if (n === 0 || !Number.isFinite(T)) {
376
- v.current.start({
377
- offset: k,
378
- config: g
379
- });
380
- return;
381
- }
382
- p.current = T, x || q(T), s == null || s(T);
383
- const F = -T * y;
384
- v.current.start({
385
- offset: F,
386
- config: g
451
+ offset: ct,
452
+ springApi: x,
453
+ isDraggingRef: W,
454
+ currentOffsetRef: O
455
+ } = Jt(P);
456
+ let X;
457
+ t[29] !== i || t[30] !== R || t[31] !== f || t[32] !== m || t[33] !== d || t[34] !== x ? (X = (l) => {
458
+ if (i === 0)
459
+ return;
460
+ let v;
461
+ if (R ? v = (l % i + i) % i : v = Et(l, 0, i - 1), v === C.current)
462
+ return;
463
+ C.current = v, f || h(v), d == null || d(v);
464
+ const $ = -v * m;
465
+ x.start({
466
+ offset: $,
467
+ config: Mt
468
+ });
469
+ }, t[29] = i, t[30] = R, t[31] = f, t[32] = m, t[33] = d, t[34] = x, t[35] = X) : X = t[35];
470
+ const I = X;
471
+ let B;
472
+ t[36] !== i || t[37] !== I || t[38] !== R ? (B = () => {
473
+ if (i === 0)
474
+ return;
475
+ const l = R ? (C.current + 1) % i : Math.min(C.current + 1, i - 1);
476
+ I(l);
477
+ }, t[36] = i, t[37] = I, t[38] = R, t[39] = B) : B = t[39];
478
+ const _ = B;
479
+ let J;
480
+ t[40] !== i || t[41] !== I || t[42] !== R ? (J = () => {
481
+ if (i === 0)
482
+ return;
483
+ const l = R ? (C.current - 1 + i) % i : Math.max(C.current - 1, 0);
484
+ I(l);
485
+ }, t[40] = i, t[41] = I, t[42] = R, t[43] = J) : J = t[43];
486
+ const A = J;
487
+ let K;
488
+ t[44] !== I ? (K = (l) => I(l), t[44] = I, t[45] = K) : K = t[45];
489
+ const D = K;
490
+ let Q, Z;
491
+ t[46] !== D || t[47] !== _ || t[48] !== A ? (Q = () => ({
492
+ next: _,
493
+ prev: A,
494
+ goTo: D
495
+ }), Z = [_, A, D], t[46] = D, t[47] = _, t[48] = A, t[49] = Q, t[50] = Z) : (Q = t[49], Z = t[50]), Xt(u, Q, Z);
496
+ let tt, et;
497
+ t[51] !== g || t[52] !== i || t[53] !== W || t[54] !== m || t[55] !== x ? (tt = () => {
498
+ if (!W.current && i > 0) {
499
+ const l = -g * m;
500
+ x.start({
501
+ offset: l,
502
+ config: Mt
387
503
  });
388
504
  }
389
- }, {
390
- target: h.domElement,
391
- enabled: I,
392
- pointer: (a == null ? void 0 : a.pointer) ?? {
393
- touch: !0,
394
- capture: !0
395
- },
396
- axis: (a == null ? void 0 : a.axis) ?? J,
397
- touchAction: (a == null ? void 0 : a.touchAction) ?? "none",
398
- threshold: a == null ? void 0 : a.threshold,
399
- rubberband: a == null ? void 0 : a.rubberband
400
- }), nt(() => {
401
- if (!I) return;
402
- const e = h.domElement, f = e.style.touchAction, m = e.style.cursor;
403
- return e.style.touchAction = "none", e.style.cursor = "grab", () => {
404
- e.style.touchAction = f, e.style.cursor = m;
405
- };
406
- }, [I, h.domElement]), Gt(() => {
407
- if (!P.current) return;
408
- const e = lt.get();
409
- A.current = e, r === "horizontal" ? P.current.position.x = e : P.current.position.y = e;
410
- });
411
- const at = E((e) => ee(e, u, r), [u, r]), i = et(() => ({
412
- activeIndex: R,
413
- count: n,
414
- next: b,
415
- prev: O,
416
- goTo: d
417
- }), [R, n, b, O, d]);
418
- return /* @__PURE__ */ bt(qt.Provider, { value: i, children: [
419
- /* @__PURE__ */ D("group", { ref: P, children: Y.map((e, f) => {
420
- const m = at(f);
421
- return /* @__PURE__ */ D("group", { position: [...m], children: e }, e.key ?? f);
422
- }) }),
423
- ut
424
- ] });
505
+ }, et = [g, i, m, x, W], t[51] = g, t[52] = i, t[53] = W, t[54] = m, t[55] = x, t[56] = tt, t[57] = et) : (tt = t[56], et = t[57]), St(tt, et);
506
+ let lt;
507
+ t[58] !== O || t[59] !== N || t[60] !== ct ? (lt = () => {
508
+ if (!G.current)
509
+ return;
510
+ const l = ct.get();
511
+ O.current = l, N === "horizontal" ? G.current.position.x = l : G.current.position.y = l;
512
+ }, t[58] = O, t[59] = N, t[60] = ct, t[61] = lt) : lt = t[61], Bt(lt);
513
+ let rt;
514
+ t[62] !== N || t[63] !== T ? (rt = (l) => Re(l, T, N), t[62] = N, t[63] = T, t[64] = rt) : rt = t[64];
515
+ const It = rt;
516
+ let ut;
517
+ t[65] !== g || t[66] !== i || t[67] !== D || t[68] !== _ || t[69] !== A ? (ut = {
518
+ activeIndex: g,
519
+ count: i,
520
+ next: _,
521
+ prev: A,
522
+ goTo: D
523
+ }, t[65] = g, t[66] = i, t[67] = D, t[68] = _, t[69] = A, t[70] = ut) : ut = t[70];
524
+ const at = ut, Ct = Ft;
525
+ let U;
526
+ t[71] !== It ? (U = (l, v) => {
527
+ const $ = It(v);
528
+ return /* @__PURE__ */ dt("group", { position: [...$], children: l }, l.key ?? v);
529
+ }, t[71] = It, t[72] = U) : U = t[72];
530
+ const ft = y.map(U);
531
+ let a;
532
+ t[73] !== ft ? (a = /* @__PURE__ */ dt("group", { ref: G, children: ft }), t[73] = ft, t[74] = a) : a = t[74];
533
+ let p;
534
+ return t[75] !== at || t[76] !== Ct.Provider || t[77] !== a || t[78] !== r ? (p = /* @__PURE__ */ Yt(Ct.Provider, { value: at, children: [
535
+ a,
536
+ r
537
+ ] }), t[75] = at, t[76] = Ct.Provider, t[77] = a, t[78] = r, t[79] = p) : p = t[79], p;
538
+ }), {
539
+ NextTrigger: $t,
540
+ PrevTrigger: kt
425
541
  });
426
- Et.NextTrigger = yt;
427
- Et.PrevTrigger = Nt;
428
- const ie = Et;
542
+ function Ie(n) {
543
+ return yt(n) && n.type !== $t && n.type !== kt;
544
+ }
545
+ function Ce(n) {
546
+ return yt(n) && (n.type === $t || n.type === kt);
547
+ }
429
548
  export {
430
- ue as CircularCarousel,
431
- vt as CircularCarouselNextTrigger,
432
- _t as CircularCarouselPrevTrigger,
433
- ie as LinearCarousel,
434
- yt as LinearCarouselNextTrigger,
435
- Nt as LinearCarouselPrevTrigger,
436
- $t as useCarouselContext,
437
- Ht as useLinearCarouselContext
549
+ Se as CircularCarousel,
550
+ Gt as CircularCarouselNextTrigger,
551
+ Ut as CircularCarouselPrevTrigger,
552
+ Oe as LinearCarousel,
553
+ $t as LinearCarouselNextTrigger,
554
+ kt as LinearCarouselPrevTrigger,
555
+ Qt as useCarouselContext,
556
+ Zt as useLinearCarouselContext
438
557
  };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Clamps a value between a minimum and maximum.
3
+ */
4
+ export declare function clamp(value: number, min: number, max: number): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juniorxsound/react-three-components",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "3D carousel components for React Three Fiber",
5
5
  "author": "juniorxsound",
6
6
  "license": "MIT",