@juniorxsound/react-three-components 0.1.3 → 0.1.4

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 CHANGED
@@ -196,6 +196,49 @@ ref.current.goTo(2); // Go to specific index
196
196
 
197
197
  ---
198
198
 
199
+ ### useGLTFMaterialVariants
200
+
201
+ Parse and assign [KHR_materials_variants](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_variants) on an already-loaded glTF. Load the model with `useGLTF` (Drei), `useLoader(GLTFLoader, url)`, or your own loader; then pass the result. The hook applies the first variant initially (or pass `{ variant: "name" }` to avoid flashing). Returns `variants`, `activeVariant`, and `setVariant`. Suspends until the variant is applied—wrap in a `<Suspense>` boundary.
202
+
203
+ ```tsx
204
+ import { Suspense } from "react";
205
+ import { Canvas } from "@react-three/fiber";
206
+ import { useGLTF } from "@react-three/drei";
207
+ import { useGLTFMaterialVariants } from "@juniorxsound/react-three-components";
208
+
209
+ function Shoe() {
210
+ const gltf = useGLTF("/MaterialsVariantsShoe.gltf");
211
+ const { variants, activeVariant, setVariant } = useGLTFMaterialVariants(
212
+ gltf,
213
+ { variant: "midnight" }
214
+ );
215
+ return (
216
+ <group>
217
+ <primitive object={gltf.scene} />
218
+ {/* Use setVariant(name) to switch variants */}
219
+ </group>
220
+ );
221
+ }
222
+
223
+ function App() {
224
+ return (
225
+ <Canvas>
226
+ <Suspense fallback={null}>
227
+ <Shoe />
228
+ </Suspense>
229
+ </Canvas>
230
+ );
231
+ }
232
+ ```
233
+
234
+ | Return | Type | Description |
235
+ | ------------- | ---------- | ------------------------------------ |
236
+ | `variants` | `string[]` | Variant names from the extension. |
237
+ | `activeVariant` | `string \| null` | Currently active variant name. |
238
+ | `setVariant` | `(name: string) => void` | Switch to a variant by name. |
239
+
240
+ ---
241
+
199
242
  ## Context Hooks
200
243
 
201
244
  Access carousel state from any child component:
@@ -1,2 +1,3 @@
1
1
  export { useCarouselDrag, type DragConfig, type SpringConfig, type UseCarouselDragOptions, type UseCarouselDragReturn, } from "./useCarouselDrag";
2
2
  export { CarouselContext, useCarouselContext, type CarouselContextValue, } from "./useCarouselContext";
3
+ export { useGLTFMaterialVariants, type GLTFWithVariants, type UseGLTFMaterialVariantsOptions, type UseGLTFMaterialVariantsResult, } from "./useGLTFMaterialVariants";
@@ -0,0 +1,62 @@
1
+ import type { Group, Mesh } from "three";
2
+ /** KHR_materials_variants extension on the root glTF result. */
3
+ type VariantsExtension = {
4
+ variants: Array<{
5
+ name: string;
6
+ }>;
7
+ };
8
+ /**
9
+ * glTF result from useGLTF (Drei), useLoader(GLTFLoader, url), or GLTFLoader.loadAsync.
10
+ * Must include parser and userData.gltfExtensions for KHR_materials_variants.
11
+ */
12
+ export type GLTFWithVariants = {
13
+ scene: Group;
14
+ parser: {
15
+ getDependency: (type: string, index: number) => Promise<unknown>;
16
+ assignFinalMaterial: (mesh: Mesh) => void;
17
+ };
18
+ userData: {
19
+ gltfExtensions?: Record<string, VariantsExtension>;
20
+ };
21
+ };
22
+ /** Options for useGLTFMaterialVariants. */
23
+ export type UseGLTFMaterialVariantsOptions = {
24
+ /**
25
+ * Initial variant to apply on first load. Prevents flashing the first variant
26
+ * before switching. Defaults to the first variant in the model if omitted.
27
+ */
28
+ variant?: string;
29
+ /**
30
+ * Override for getVariantPromise (testing only). When provided, used instead
31
+ * of the default implementation so tests can avoid suspending.
32
+ */
33
+ getVariantPromise?: (gltf: GLTFWithVariants, variantName: string) => Promise<{
34
+ variantName: string;
35
+ }>;
36
+ };
37
+ /** Return value of useGLTFMaterialVariants. */
38
+ export type UseGLTFMaterialVariantsResult = {
39
+ /** Variant names from the extension, or empty if no extension. */
40
+ variants: string[];
41
+ /** Currently active variant name, or null if no variants. */
42
+ activeVariant: string | null;
43
+ /** Switch to a variant by name. Suspends until the variant is applied. */
44
+ setVariant: (variantName: string) => void;
45
+ };
46
+ /** Used internally and for testing. */
47
+ export declare function getVariantsExtension(gltf: GLTFWithVariants): VariantsExtension | null;
48
+ /**
49
+ * Parse and assign KHR_materials_variants on an already-loaded glTF.
50
+ * Load the model with useGLTF (Drei), useLoader(GLTFLoader, url), or your own
51
+ * loader; then pass the result here. Pass options.variant for the initial
52
+ * variant to avoid flashing. Call setVariant(name) to switch—both initial
53
+ * apply and setVariant suspend until the variant is applied. Wrap in a React
54
+ * Suspense boundary.
55
+ *
56
+ * @see https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_variants
57
+ * @param gltf - Loaded glTF (from useGLTF, useLoader(GLTFLoader, url), etc.)
58
+ * @param options - Optional initial variant (prevents flash on load)
59
+ * @returns variants, activeVariant, and setVariant (render gltf.scene yourself)
60
+ */
61
+ export declare function useGLTFMaterialVariants(gltf: GLTFWithVariants, options?: UseGLTFMaterialVariantsOptions): UseGLTFMaterialVariantsResult;
62
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export { CircularCarousel, CircularCarouselNextTrigger, CircularCarouselPrevTrigger, useCarouselContext, LinearCarousel, LinearCarouselNextTrigger, LinearCarouselPrevTrigger, useLinearCarouselContext, } from "./components";
2
+ export { useGLTFMaterialVariants, } from "./hooks";
2
3
  export type { CircularCarouselProps, CircularCarouselRef, CarouselContextValue, LinearCarouselProps, LinearCarouselRef, LinearCarouselContextValue, DragConfig, } from "./components";
4
+ export type { GLTFWithVariants, UseGLTFMaterialVariantsOptions, UseGLTFMaterialVariantsResult, } from "./hooks";
3
5
  export type { GroupProps } from "./types";
@@ -1,9 +1,9 @@
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 = {};
1
+ import { jsx as pt, jsxs as Yt } from "react/jsx-runtime";
2
+ import zt, { useRef as ct, useEffect as St, createContext as ee, useContext as ne, useState as Lt, use as re, forwardRef as Kt, Children as Wt, useImperativeHandle as Xt, isValidElement as Pt } from "react";
3
+ import { useThree as oe, useFrame as Bt } from "@react-three/fiber";
4
+ import { useSpring as se } from "@react-spring/web";
5
+ import { useDrag as ie } from "@use-gesture/react";
6
+ var yt = { exports: {} }, Ot = {};
7
7
  /**
8
8
  * @license React
9
9
  * react-compiler-runtime.production.js
@@ -13,16 +13,16 @@ var Ot = { exports: {} }, bt = {};
13
13
  * This source code is licensed under the MIT license found in the
14
14
  * LICENSE file in the root directory of this source tree.
15
15
  */
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;
16
+ var Ht;
17
+ function ce() {
18
+ if (Ht) return Ot;
19
+ Ht = 1;
20
+ var r = zt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
21
+ return Ot.c = function(e) {
22
+ return r.H.useMemoCache(e);
23
+ }, Ot;
24
24
  }
25
- var Pt = {};
25
+ var Dt = {};
26
26
  /**
27
27
  * @license React
28
28
  * react-compiler-runtime.development.js
@@ -32,110 +32,110 @@ var Pt = {};
32
32
  * This source code is licensed under the MIT license found in the
33
33
  * LICENSE file in the root directory of this source tree.
34
34
  */
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;
41
- return u === null && console.error(
35
+ var qt;
36
+ function le() {
37
+ return qt || (qt = 1, process.env.NODE_ENV !== "production" && (function() {
38
+ var r = zt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
39
+ Dt.c = function(e) {
40
+ var n = r.H;
41
+ return n === null && console.error(
42
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:
43
43
  1. You might have mismatching versions of React and the renderer (such as React DOM)
44
44
  2. You might be breaking the Rules of Hooks
45
45
  3. You might have more than one copy of React in the same app
46
46
  See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`
47
- ), u.useMemoCache(e);
47
+ ), n.useMemoCache(e);
48
48
  };
49
- })()), Pt;
49
+ })()), Dt;
50
50
  }
51
- var Ht;
52
- function ce() {
53
- return Ht || (Ht = 1, process.env.NODE_ENV === "production" ? Ot.exports = se() : Ot.exports = ie()), Ot.exports;
51
+ var wt;
52
+ function ae() {
53
+ return wt || (wt = 1, process.env.NODE_ENV === "production" ? yt.exports = ce() : yt.exports = le()), yt.exports;
54
54
  }
55
- var _t = ce();
56
- const w = 2 * Math.PI, le = 3, ue = "y", ae = 280, Dt = {
55
+ var At = ae();
56
+ const K = 2 * Math.PI, ue = 3, fe = "y", de = 280, Mt = {
57
57
  tension: 200,
58
58
  friction: 25
59
- }, fe = {
59
+ }, ge = {
60
60
  tension: 400,
61
61
  friction: 50
62
62
  };
63
- function Et(n, e, u) {
64
- return Math.max(e, Math.min(u, n));
63
+ function Nt(r, e, n) {
64
+ return Math.max(e, Math.min(n, r));
65
65
  }
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];
66
+ function me(r, e, n, t) {
67
+ const s = r / e * K, c = Math.cos(s) * n, o = Math.sin(s) * n, x = t === "y" ? [o, 0, c] : t === "x" ? [0, c, o] : [c, o, 0], y = t === "y" ? [0, Math.PI + s, 0] : t === "x" ? [Math.PI + s, 0, 0] : [0, 0, Math.PI + s];
68
68
  return {
69
- position: k,
70
- rotation: H
69
+ position: x,
70
+ rotation: y
71
71
  };
72
72
  }
73
- function Lt(n, e) {
74
- const u = Math.round((n - e) / w);
75
- return e + u * w;
73
+ function bt(r, e) {
74
+ const n = Math.round((r - e) / K);
75
+ return e + n * K;
76
76
  }
77
- function Jt(n) {
77
+ function Jt(r) {
78
78
  const {
79
79
  count: e,
80
- dragEnabled: u,
80
+ dragEnabled: n,
81
81
  dragAxis: t,
82
82
  dragSensitivity: s,
83
83
  maxDragAmount: c,
84
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(() => ({
85
+ springConfig: x,
86
+ dragSpringConfig: y,
87
+ calculateIndexFromOffset: f,
88
+ calculateTargetIndex: G,
89
+ calculateTargetOffset: V,
90
+ onNavigate: $
91
+ } = r, {
92
+ gl: C
93
+ } = oe(), [{
94
+ offset: D
95
+ }, R] = se(() => ({
96
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
97
+ })), I = ct(R);
98
+ I.current = R;
99
+ const lt = ct(!1), U = ct(0), T = ct(0), vt = ct(0);
100
+ return ie(({
101
+ active: v,
102
+ movement: [d, g],
103
+ first: E,
104
+ last: k
105
105
  }) => {
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);
106
+ lt.current = v;
107
+ const H = t === "x" ? d : g;
108
+ E && (T.current = U.current, vt.current = f(U.current)), v && E && (C.domElement.style.cursor = "grabbing"), !v && k && (C.domElement.style.cursor = "grab");
109
+ const P = T.current, z = Number(H);
110
+ let M = 0;
111
+ if (Number.isFinite(z)) {
112
+ const b = z / s;
113
+ M = Nt(b, -c, c);
114
114
  }
115
- if (h)
116
- N.current.start({
117
- offset: S + y,
118
- config: H
115
+ if (v)
116
+ I.current.start({
117
+ offset: P + M,
118
+ config: y
119
119
  });
120
120
  else {
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
121
+ const b = vt.current, i = P + M, l = G(i, b, M);
122
+ if (e === 0 || !Number.isFinite(l)) {
123
+ I.current.start({
124
+ offset: P,
125
+ config: x
126
126
  });
127
127
  return;
128
128
  }
129
- Tt(i);
130
- const G = At(i, r);
131
- N.current.start({
132
- offset: G,
133
- config: k
129
+ $(l);
130
+ const q = V(l, i);
131
+ I.current.start({
132
+ offset: q,
133
+ config: x
134
134
  });
135
135
  }
136
136
  }, {
137
- target: E.domElement,
138
- enabled: u,
137
+ target: C.domElement,
138
+ enabled: n,
139
139
  from: () => [0, 0],
140
140
  filterTaps: (o == null ? void 0 : o.filterTaps) ?? !0,
141
141
  threshold: (o == null ? void 0 : o.threshold) ?? 5,
@@ -147,411 +147,471 @@ function Jt(n) {
147
147
  touchAction: (o == null ? void 0 : o.touchAction) ?? "none",
148
148
  rubberband: o == null ? void 0 : o.rubberband
149
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;
150
+ if (!n) return;
151
+ const v = C.domElement, d = v.style.touchAction, g = v.style.cursor;
152
+ return v.style.touchAction = "none", v.style.cursor = "grab", () => {
153
+ v.style.touchAction = d, v.style.cursor = g;
154
154
  };
155
- }, [u, E.domElement]), {
156
- offset: ot,
157
- springApi: T,
158
- isDraggingRef: st,
159
- currentOffsetRef: L
155
+ }, [n, C.domElement]), {
156
+ offset: D,
157
+ springApi: R,
158
+ isDraggingRef: lt,
159
+ currentOffsetRef: U
160
160
  };
161
161
  }
162
- const Ft = te(null);
163
- function Kt(n) {
164
- const e = ee(Ft);
162
+ const Gt = ee(null);
163
+ function Qt(r) {
164
+ const e = ne(Gt);
165
165
  if (!e)
166
- throw new Error(`${n} compound components must be used within ${n}`);
166
+ throw new Error(`${r} compound components must be used within ${r}`);
167
167
  return e;
168
168
  }
169
- function Qt() {
170
- return Kt("CircularCarousel");
169
+ function Zt(r) {
170
+ var e, n;
171
+ return ((n = (e = r.userData) == null ? void 0 : e.gltfExtensions) == null ? void 0 : n.KHR_materials_variants) ?? null;
171
172
  }
172
- function Gt(n) {
173
- const e = _t.c(9), {
174
- next: u
175
- } = Qt();
173
+ function pe(r, e, n, t) {
174
+ const s = n.variants.findIndex((o) => o.name === t || o.name.includes(t));
175
+ if (s === -1) return Promise.resolve();
176
+ const c = [];
177
+ return r.traverse((o) => {
178
+ var G;
179
+ if (!("isMesh" in o) || !o.isMesh || !((G = o.userData) != null && G.gltfExtensions))
180
+ return;
181
+ const x = o, y = o.userData.gltfExtensions.KHR_materials_variants;
182
+ if (!y) return;
183
+ o.userData.originalMaterial || (o.userData.originalMaterial = x.material);
184
+ const f = y.mappings.find((V) => V.variants.includes(s));
185
+ f ? c.push(e.getDependency("material", f.material).then((V) => {
186
+ x.material = V, e.assignFinalMaterial(x);
187
+ })) : x.material = o.userData.originalMaterial;
188
+ }), Promise.all(c).then(() => {
189
+ });
190
+ }
191
+ function ve(r, e) {
192
+ const n = Zt(r);
193
+ return n ? pe(r.scene, r.parser, n, e).then(() => ({
194
+ variantName: e
195
+ })) : Promise.resolve({
196
+ variantName: e
197
+ });
198
+ }
199
+ function Me(r, e) {
200
+ const n = At.c(14);
201
+ let t;
202
+ if (n[0] !== r) {
203
+ const I = Zt(r);
204
+ t = I ? I.variants.map(he) : [], n[0] = r, n[1] = t;
205
+ } else
206
+ t = n[1];
207
+ const s = t, c = (e == null ? void 0 : e.variant) ?? s[0] ?? null, o = (e == null ? void 0 : e.getVariantPromise) ?? ve;
208
+ let x;
209
+ n[2] !== o || n[3] !== r || n[4] !== c || n[5] !== s.length ? (x = () => c && s.length > 0 ? o(r, c) : Promise.resolve({
210
+ variantName: null
211
+ }), n[2] = o, n[3] = r, n[4] = c, n[5] = s.length, n[6] = x) : x = n[6];
212
+ const [y, f] = Lt(x), V = re(y).variantName;
213
+ let $;
214
+ n[7] !== o || n[8] !== r ? ($ = (I) => {
215
+ f(o(r, I));
216
+ }, n[7] = o, n[8] = r, n[9] = $) : $ = n[9];
217
+ const C = $, D = s.length > 0 ? V : null;
218
+ let R;
219
+ return n[10] !== C || n[11] !== D || n[12] !== s ? (R = {
220
+ variants: s,
221
+ activeVariant: D,
222
+ setVariant: C
223
+ }, n[10] = C, n[11] = D, n[12] = s, n[13] = R) : R = n[13], R;
224
+ }
225
+ function he(r) {
226
+ return r.name;
227
+ }
228
+ function jt() {
229
+ return Qt("CircularCarousel");
230
+ }
231
+ function Vt(r) {
232
+ const e = At.c(9), {
233
+ next: n
234
+ } = jt();
176
235
  let t, s;
177
- e[0] !== n ? ({
236
+ e[0] !== r ? ({
178
237
  children: t,
179
238
  ...s
180
- } = n, e[0] = n, e[1] = t, e[2] = s) : (t = e[1], s = e[2]);
239
+ } = r, e[0] = r, e[1] = t, e[2] = s) : (t = e[1], s = e[2]);
181
240
  let c;
182
- e[3] !== u ? (c = () => u(), e[3] = u, e[4] = c) : c = e[4];
241
+ e[3] !== n ? (c = () => n(), e[3] = n, e[4] = c) : c = e[4];
183
242
  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;
243
+ return e[5] !== t || e[6] !== s || e[7] !== c ? (o = /* @__PURE__ */ pt("group", { onClick: c, ...s, children: t }), e[5] = t, e[6] = s, e[7] = c, e[8] = o) : o = e[8], o;
185
244
  }
186
- function Ut(n) {
187
- const e = _t.c(9), {
188
- prev: u
189
- } = Qt();
245
+ function $t(r) {
246
+ const e = At.c(9), {
247
+ prev: n
248
+ } = jt();
190
249
  let t, s;
191
- e[0] !== n ? ({
250
+ e[0] !== r ? ({
192
251
  children: t,
193
252
  ...s
194
- } = n, e[0] = n, e[1] = t, e[2] = s) : (t = e[1], s = e[2]);
253
+ } = r, e[0] = r, e[1] = t, e[2] = s) : (t = e[1], s = e[2]);
195
254
  let c;
196
- e[3] !== u ? (c = () => u(), e[3] = u, e[4] = c) : c = e[4];
255
+ e[3] !== n ? (c = () => n(), e[3] = n, e[4] = c) : c = e[4];
197
256
  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;
257
+ return e[5] !== t || e[6] !== s || e[7] !== c ? (o = /* @__PURE__ */ pt("group", { onClick: c, ...s, children: t }), e[5] = t, e[6] = s, e[7] = c, e[8] = o) : o = e[8], o;
199
258
  }
200
- const Se = Object.assign(jt(function(e, u) {
201
- const t = _t.c(76), {
259
+ const be = Object.assign(Kt(function(e, n) {
260
+ const t = At.c(76), {
202
261
  children: s,
203
262
  radius: c,
204
263
  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,
264
+ index: x,
265
+ defaultIndex: y,
266
+ onIndexChange: f,
267
+ dragEnabled: G,
268
+ dragSensitivity: V,
269
+ dragAxis: $,
270
+ dragConfig: C
271
+ } = e, D = c === void 0 ? ue : c, R = o === void 0 ? fe : o, I = y === void 0 ? 0 : y, lt = G === void 0 ? !0 : G, U = $ === void 0 ? "x" : $, [T, vt] = Lt(I), v = x !== void 0, d = v ? x : T, g = ct(d);
272
+ let E, k;
273
+ t[0] !== d ? (E = () => {
274
+ g.current = d;
275
+ }, k = [d], t[0] = d, t[1] = E, t[2] = k) : (E = t[1], k = t[2]), St(E, k);
276
+ let H;
277
+ t[3] !== s ? (H = Wt.toArray(s), t[3] = s, t[4] = H) : H = t[4];
278
+ const P = H, z = P.filter(xe);
279
+ let M;
280
+ t[5] !== P ? (M = P.filter(Re), t[5] = P, t[6] = M) : M = t[6];
281
+ const b = M, i = z.length, l = ct(null), q = i > 0 ? K / i : K, m = V ?? de / q;
282
+ let at;
283
+ t[7] !== i ? (at = (u) => (Math.round(-u / K * i) % i + i) % i, t[7] = i, t[8] = at) : at = t[8];
284
+ const ht = at;
285
+ let W;
286
+ t[9] !== i ? (W = (u, p, a) => {
287
+ const h = (p - 1 + i) % i, Y = (p + 1) % i;
288
+ let Et = (Math.round(-u / K * i) % i + i) % i;
289
+ return Et !== h && Et !== p && Et !== Y && (Et = a > 0 ? Y : a < 0 ? h : p), Et;
290
+ }, t[9] = i, t[10] = W) : W = t[10];
291
+ const xt = W;
292
+ let X;
293
+ t[11] !== i ? (X = (u, p) => {
294
+ const a = -(u / i) * K;
295
+ return bt(p, a);
296
+ }, t[11] = i, t[12] = X) : X = t[12];
297
+ const Rt = X;
298
+ let B;
299
+ t[13] !== v || t[14] !== f ? (B = (u) => {
300
+ g.current = u, v || vt(u), f == null || f(u);
301
+ }, t[13] = v, t[14] = f, t[15] = B) : B = t[15];
302
+ const It = B;
303
+ let J;
304
+ t[16] !== q || t[17] !== ht || t[18] !== xt || t[19] !== Rt || t[20] !== i || t[21] !== U || t[22] !== C || t[23] !== lt || t[24] !== m || t[25] !== It ? (J = {
305
+ count: i,
306
+ dragEnabled: lt,
307
+ dragAxis: U,
249
308
  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];
309
+ maxDragAmount: q,
310
+ dragConfig: C,
311
+ springConfig: Mt,
312
+ dragSpringConfig: ge,
313
+ calculateIndexFromOffset: ht,
314
+ calculateTargetIndex: xt,
315
+ calculateTargetOffset: Rt,
316
+ onNavigate: It
317
+ }, t[16] = q, t[17] = ht, t[18] = xt, t[19] = Rt, t[20] = i, t[21] = U, t[22] = C, t[23] = lt, t[24] = m, t[25] = It, t[26] = J) : J = t[26];
259
318
  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);
319
+ offset: _t,
320
+ springApi: F,
321
+ isDraggingRef: ut,
322
+ currentOffsetRef: _
323
+ } = Jt(J);
324
+ let Q;
325
+ t[27] !== i || t[28] !== _ || t[29] !== v || t[30] !== f || t[31] !== F ? (Q = (u) => {
326
+ const p = Nt(u, 0, i - 1);
268
327
  if (p === g.current)
269
328
  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
329
+ g.current = p, v || vt(p), f == null || f(p);
330
+ const a = -(p / i) * K, h = bt(_.current, a);
331
+ F.start({
332
+ offset: h,
333
+ config: Mt
275
334
  });
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
335
+ }, t[27] = i, t[28] = _, t[29] = v, t[30] = f, t[31] = F, t[32] = Q) : Q = t[32];
336
+ const O = Q;
337
+ let Z;
338
+ t[33] !== i || t[34] !== O ? (Z = () => {
339
+ i !== 0 && O((g.current + 1) % i);
340
+ }, t[33] = i, t[34] = O, t[35] = Z) : Z = t[35];
341
+ const A = Z;
342
+ let j;
343
+ t[36] !== i || t[37] !== O ? (j = () => {
344
+ i !== 0 && O((g.current - 1 + i) % i);
345
+ }, t[36] = i, t[37] = O, t[38] = j) : j = t[38];
346
+ const N = j;
347
+ let tt;
348
+ t[39] !== O ? (tt = (u) => O(u), t[39] = O, t[40] = tt) : tt = t[40];
349
+ const S = tt;
350
+ let et, L;
351
+ t[41] !== S || t[42] !== A || t[43] !== N ? (et = () => ({
352
+ next: A,
353
+ prev: N,
354
+ goTo: S
355
+ }), L = [A, N, S], t[41] = S, t[42] = A, t[43] = N, t[44] = et, t[45] = L) : (et = t[44], L = t[45]), Xt(n, et, L);
356
+ let nt, rt;
357
+ t[46] !== d || t[47] !== i || t[48] !== _ || t[49] !== ut || t[50] !== F ? (nt = () => {
358
+ if (!ut.current && i > 0) {
359
+ const u = -(d / i) * K, p = _.current, h = p === 0 && d !== 0 ? u : bt(p, u);
360
+ F.start({
361
+ offset: h,
362
+ config: Mt
304
363
  });
305
364
  }
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)
365
+ }, rt = [d, i, F, ut, _], t[46] = d, t[47] = i, t[48] = _, t[49] = ut, t[50] = F, t[51] = nt, t[52] = rt) : (nt = t[51], rt = t[52]), St(nt, rt);
366
+ let ot;
367
+ t[53] !== R || t[54] !== _ || t[55] !== _t ? (ot = () => {
368
+ if (!l.current)
310
369
  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) => {
370
+ const u = _t.get();
371
+ _.current = u, l.current.rotation[R] = u;
372
+ }, t[53] = R, t[54] = _, t[55] = _t, t[56] = ot) : ot = t[56], Bt(ot);
373
+ let st;
374
+ t[57] !== R || t[58] !== i || t[59] !== D ? (st = (u) => me(u, i, D, R), t[57] = R, t[58] = i, t[59] = D, t[60] = st) : st = t[60];
375
+ const ft = st;
376
+ let it;
377
+ t[61] !== d || t[62] !== i || t[63] !== S || t[64] !== A || t[65] !== N ? (it = {
378
+ activeIndex: d,
379
+ count: i,
380
+ next: A,
381
+ prev: N,
382
+ goTo: S
383
+ }, t[61] = d, t[62] = i, t[63] = S, t[64] = A, t[65] = N, t[66] = it) : it = t[66];
384
+ const Ct = it, dt = Gt;
385
+ let gt;
386
+ t[67] !== ft ? (gt = (u, p) => {
328
387
  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,
388
+ position: a,
389
+ rotation: h
390
+ } = ft(p);
391
+ return /* @__PURE__ */ pt("group", { position: a, rotation: h, children: u }, u.key ?? p);
392
+ }, t[67] = ft, t[68] = gt) : gt = t[68];
393
+ const Tt = z.map(gt);
394
+ let w;
395
+ t[69] !== Tt ? (w = /* @__PURE__ */ pt("group", { ref: l, children: Tt }), t[69] = Tt, t[70] = w) : w = t[70];
396
+ let mt;
397
+ return t[71] !== Ct || t[72] !== dt.Provider || t[73] !== w || t[74] !== b ? (mt = /* @__PURE__ */ Yt(dt.Provider, { value: Ct, children: [
398
+ w,
340
399
  b
341
- ] }), t[71] = It, t[72] = ut.Provider, t[73] = U, t[74] = b, t[75] = ft) : ft = t[75], ft;
400
+ ] }), t[71] = Ct, t[72] = dt.Provider, t[73] = w, t[74] = b, t[75] = mt) : mt = t[75], mt;
342
401
  }), {
343
- NextTrigger: Gt,
344
- PrevTrigger: Ut
402
+ NextTrigger: Vt,
403
+ PrevTrigger: $t
345
404
  });
346
- function ge(n) {
347
- return yt(n) && n.type !== Gt && n.type !== Ut;
405
+ function xe(r) {
406
+ return Pt(r) && r.type !== Vt && r.type !== $t;
348
407
  }
349
- function me(n) {
350
- return yt(n) && (n.type === Gt || n.type === Ut);
408
+ function Re(r) {
409
+ return Pt(r) && (r.type === Vt || r.type === $t);
351
410
  }
352
- const pe = 0.5, he = "horizontal", ve = 150, Mt = {
411
+ const Ie = 0.5, _e = "horizontal", Ce = 150, Ft = {
353
412
  tension: 200,
354
413
  friction: 25
355
- }, xe = {
414
+ }, Te = {
356
415
  tension: 400,
357
416
  friction: 50
358
417
  };
359
- function Re(n, e, u) {
360
- const t = n * (1 + e);
361
- return u === "horizontal" ? [t, 0, 0] : [0, t, 0];
418
+ function Ae(r, e, n) {
419
+ const t = r * (1 + e);
420
+ return n === "horizontal" ? [t, 0, 0] : [0, t, 0];
362
421
  }
363
- function Zt() {
364
- return Kt("LinearCarousel");
422
+ function te() {
423
+ return Qt("LinearCarousel");
365
424
  }
366
- function $t(n) {
367
- const e = _t.c(9), {
368
- next: u
369
- } = Zt();
425
+ function Ut(r) {
426
+ const e = At.c(9), {
427
+ next: n
428
+ } = te();
370
429
  let t, s;
371
- e[0] !== n ? ({
430
+ e[0] !== r ? ({
372
431
  children: t,
373
432
  ...s
374
- } = n, e[0] = n, e[1] = t, e[2] = s) : (t = e[1], s = e[2]);
433
+ } = r, e[0] = r, e[1] = t, e[2] = s) : (t = e[1], s = e[2]);
375
434
  let c;
376
- e[3] !== u ? (c = () => u(), e[3] = u, e[4] = c) : c = e[4];
435
+ e[3] !== n ? (c = () => n(), e[3] = n, e[4] = c) : c = e[4];
377
436
  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;
437
+ return e[5] !== t || e[6] !== s || e[7] !== c ? (o = /* @__PURE__ */ pt("group", { onClick: c, ...s, children: t }), e[5] = t, e[6] = s, e[7] = c, e[8] = o) : o = e[8], o;
379
438
  }
380
- function kt(n) {
381
- const e = _t.c(9), {
382
- prev: u
383
- } = Zt();
439
+ function kt(r) {
440
+ const e = At.c(9), {
441
+ prev: n
442
+ } = te();
384
443
  let t, s;
385
- e[0] !== n ? ({
444
+ e[0] !== r ? ({
386
445
  children: t,
387
446
  ...s
388
- } = n, e[0] = n, e[1] = t, e[2] = s) : (t = e[1], s = e[2]);
447
+ } = r, e[0] = r, e[1] = t, e[2] = s) : (t = e[1], s = e[2]);
389
448
  let c;
390
- e[3] !== u ? (c = () => u(), e[3] = u, e[4] = c) : c = e[4];
449
+ e[3] !== n ? (c = () => n(), e[3] = n, e[4] = c) : c = e[4];
391
450
  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;
451
+ return e[5] !== t || e[6] !== s || e[7] !== c ? (o = /* @__PURE__ */ pt("group", { onClick: c, ...s, children: t }), e[5] = t, e[6] = s, e[7] = c, e[8] = o) : o = e[8], o;
393
452
  }
394
- const Oe = Object.assign(jt(function(e, u) {
395
- const t = _t.c(80), {
453
+ const Fe = Object.assign(Kt(function(e, n) {
454
+ const t = At.c(80), {
396
455
  children: s,
397
456
  gap: c,
398
457
  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;
458
+ index: x,
459
+ defaultIndex: y,
460
+ onIndexChange: f,
461
+ dragEnabled: G,
462
+ dragSensitivity: V,
463
+ dragAxis: $,
464
+ dragConfig: C,
465
+ infinite: D
466
+ } = e, R = c === void 0 ? Ie : c, I = o === void 0 ? _e : o, lt = y === void 0 ? 0 : y, U = G === void 0 ? !0 : G, T = D === void 0 ? !1 : D, [vt, v] = Lt(lt), d = x !== void 0, g = d ? x : vt, E = ct(g);
467
+ let k, H;
468
+ t[0] !== g ? (k = () => {
469
+ E.current = g;
470
+ }, H = [g], t[0] = g, t[1] = k, t[2] = H) : (k = t[1], H = t[2]), St(k, H);
435
471
  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,
472
+ t[3] !== s ? (P = Wt.toArray(s), t[3] = s, t[4] = P) : P = t[4];
473
+ const z = P, M = z.filter(Ee);
474
+ let b;
475
+ t[5] !== z ? (b = z.filter(Ne), t[5] = z, t[6] = b) : b = t[6];
476
+ const i = b, l = M.length, q = ct(null), m = 1 + R, at = V ?? Ce, ht = $ ?? (I === "horizontal" ? "x" : "y");
477
+ let W;
478
+ t[7] !== m ? (W = (a) => Math.round(-a / m), t[7] = m, t[8] = W) : W = t[8];
479
+ const xt = W;
480
+ let X;
481
+ t[9] !== l || t[10] !== T || t[11] !== m ? (X = (a, h) => {
482
+ let Y = Math.round(-a / m);
483
+ return Y = Nt(Y, h - 1, h + 1), T ? (Y % l + l) % l : Nt(Y, 0, l - 1);
484
+ }, t[9] = l, t[10] = T, t[11] = m, t[12] = X) : X = t[12];
485
+ const Rt = X;
486
+ let B;
487
+ t[13] !== m ? (B = (a) => -a * m, t[13] = m, t[14] = B) : B = t[14];
488
+ const It = B;
489
+ let J;
490
+ t[15] !== d || t[16] !== f ? (J = (a) => {
491
+ E.current = a, d || v(a), f == null || f(a);
492
+ }, t[15] = d, t[16] = f, t[17] = J) : J = t[17];
493
+ const _t = J;
494
+ let F;
495
+ t[18] !== xt || t[19] !== Rt || t[20] !== It || t[21] !== l || t[22] !== ht || t[23] !== C || t[24] !== U || t[25] !== at || t[26] !== _t || t[27] !== m ? (F = {
496
+ count: l,
497
+ dragEnabled: U,
498
+ dragAxis: ht,
499
+ dragSensitivity: at,
441
500
  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];
501
+ dragConfig: C,
502
+ springConfig: Ft,
503
+ dragSpringConfig: Te,
504
+ calculateIndexFromOffset: xt,
505
+ calculateTargetIndex: Rt,
506
+ calculateTargetOffset: It,
507
+ onNavigate: _t
508
+ }, t[18] = xt, t[19] = Rt, t[20] = It, t[21] = l, t[22] = ht, t[23] = C, t[24] = U, t[25] = at, t[26] = _t, t[27] = m, t[28] = F) : F = t[28];
450
509
  const {
451
- offset: ct,
452
- springApi: x,
453
- isDraggingRef: W,
510
+ offset: ut,
511
+ springApi: _,
512
+ isDraggingRef: Q,
454
513
  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)
514
+ } = Jt(F);
515
+ let Z;
516
+ t[29] !== l || t[30] !== T || t[31] !== d || t[32] !== m || t[33] !== f || t[34] !== _ ? (Z = (a) => {
517
+ if (l === 0)
459
518
  return;
460
- let v;
461
- if (R ? v = (l % i + i) % i : v = Et(l, 0, i - 1), v === C.current)
519
+ let h;
520
+ if (T ? h = (a % l + l) % l : h = Nt(a, 0, l - 1), h === E.current)
462
521
  return;
463
- C.current = v, f || h(v), d == null || d(v);
464
- const $ = -v * m;
465
- x.start({
466
- offset: $,
467
- config: Mt
522
+ E.current = h, d || v(h), f == null || f(h);
523
+ const Y = -h * m;
524
+ _.start({
525
+ offset: Y,
526
+ config: Ft
468
527
  });
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)
528
+ }, t[29] = l, t[30] = T, t[31] = d, t[32] = m, t[33] = f, t[34] = _, t[35] = Z) : Z = t[35];
529
+ const A = Z;
530
+ let j;
531
+ t[36] !== l || t[37] !== A || t[38] !== T ? (j = () => {
532
+ if (l === 0)
474
533
  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)
534
+ const a = T ? (E.current + 1) % l : Math.min(E.current + 1, l - 1);
535
+ A(a);
536
+ }, t[36] = l, t[37] = A, t[38] = T, t[39] = j) : j = t[39];
537
+ const N = j;
538
+ let tt;
539
+ t[40] !== l || t[41] !== A || t[42] !== T ? (tt = () => {
540
+ if (l === 0)
482
541
  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
542
+ const a = T ? (E.current - 1 + l) % l : Math.max(E.current - 1, 0);
543
+ A(a);
544
+ }, t[40] = l, t[41] = A, t[42] = T, t[43] = tt) : tt = t[43];
545
+ const S = tt;
546
+ let et;
547
+ t[44] !== A ? (et = (a) => A(a), t[44] = A, t[45] = et) : et = t[45];
548
+ const L = et;
549
+ let nt, rt;
550
+ t[46] !== L || t[47] !== N || t[48] !== S ? (nt = () => ({
551
+ next: N,
552
+ prev: S,
553
+ goTo: L
554
+ }), rt = [N, S, L], t[46] = L, t[47] = N, t[48] = S, t[49] = nt, t[50] = rt) : (nt = t[49], rt = t[50]), Xt(n, nt, rt);
555
+ let ot, st;
556
+ t[51] !== g || t[52] !== l || t[53] !== Q || t[54] !== m || t[55] !== _ ? (ot = () => {
557
+ if (!Q.current && l > 0) {
558
+ const a = -g * m;
559
+ _.start({
560
+ offset: a,
561
+ config: Ft
503
562
  });
504
563
  }
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)
564
+ }, st = [g, l, m, _, Q], t[51] = g, t[52] = l, t[53] = Q, t[54] = m, t[55] = _, t[56] = ot, t[57] = st) : (ot = t[56], st = t[57]), St(ot, st);
565
+ let ft;
566
+ t[58] !== O || t[59] !== I || t[60] !== ut ? (ft = () => {
567
+ if (!q.current)
509
568
  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 = {
569
+ const a = ut.get();
570
+ O.current = a, I === "horizontal" ? q.current.position.x = a : q.current.position.y = a;
571
+ }, t[58] = O, t[59] = I, t[60] = ut, t[61] = ft) : ft = t[61], Bt(ft);
572
+ let it;
573
+ t[62] !== I || t[63] !== R ? (it = (a) => Ae(a, R, I), t[62] = I, t[63] = R, t[64] = it) : it = t[64];
574
+ const Ct = it;
575
+ let dt;
576
+ t[65] !== g || t[66] !== l || t[67] !== L || t[68] !== N || t[69] !== S ? (dt = {
518
577
  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];
578
+ count: l,
579
+ next: N,
580
+ prev: S,
581
+ goTo: L
582
+ }, t[65] = g, t[66] = l, t[67] = L, t[68] = N, t[69] = S, t[70] = dt) : dt = t[70];
583
+ const gt = dt, Tt = Gt;
584
+ let w;
585
+ t[71] !== Ct ? (w = (a, h) => {
586
+ const Y = Ct(h);
587
+ return /* @__PURE__ */ pt("group", { position: [...Y], children: a }, a.key ?? h);
588
+ }, t[71] = Ct, t[72] = w) : w = t[72];
589
+ const mt = M.map(w);
590
+ let u;
591
+ t[73] !== mt ? (u = /* @__PURE__ */ pt("group", { ref: q, children: mt }), t[73] = mt, t[74] = u) : u = t[74];
533
592
  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;
593
+ return t[75] !== gt || t[76] !== Tt.Provider || t[77] !== u || t[78] !== i ? (p = /* @__PURE__ */ Yt(Tt.Provider, { value: gt, children: [
594
+ u,
595
+ i
596
+ ] }), t[75] = gt, t[76] = Tt.Provider, t[77] = u, t[78] = i, t[79] = p) : p = t[79], p;
538
597
  }), {
539
- NextTrigger: $t,
598
+ NextTrigger: Ut,
540
599
  PrevTrigger: kt
541
600
  });
542
- function Ie(n) {
543
- return yt(n) && n.type !== $t && n.type !== kt;
601
+ function Ee(r) {
602
+ return Pt(r) && r.type !== Ut && r.type !== kt;
544
603
  }
545
- function Ce(n) {
546
- return yt(n) && (n.type === $t || n.type === kt);
604
+ function Ne(r) {
605
+ return Pt(r) && (r.type === Ut || r.type === kt);
547
606
  }
548
607
  export {
549
- Se as CircularCarousel,
550
- Gt as CircularCarouselNextTrigger,
551
- Ut as CircularCarouselPrevTrigger,
552
- Oe as LinearCarousel,
553
- $t as LinearCarouselNextTrigger,
608
+ be as CircularCarousel,
609
+ Vt as CircularCarouselNextTrigger,
610
+ $t as CircularCarouselPrevTrigger,
611
+ Fe as LinearCarousel,
612
+ Ut as LinearCarouselNextTrigger,
554
613
  kt as LinearCarouselPrevTrigger,
555
- Qt as useCarouselContext,
556
- Zt as useLinearCarouselContext
614
+ jt as useCarouselContext,
615
+ Me as useGLTFMaterialVariants,
616
+ te as useLinearCarouselContext
557
617
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juniorxsound/react-three-components",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "3D carousel components for React Three Fiber",
5
5
  "author": "juniorxsound",
6
6
  "license": "MIT",