@shopify/shop-minis-react 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index10.js +2 -2
- package/dist/_virtual/index5.js +2 -3
- package/dist/_virtual/index5.js.map +1 -1
- package/dist/_virtual/index6.js +3 -2
- package/dist/_virtual/index6.js.map +1 -1
- package/dist/_virtual/index7.js +2 -3
- package/dist/_virtual/index7.js.map +1 -1
- package/dist/_virtual/index8.js +3 -2
- package/dist/_virtual/index8.js.map +1 -1
- package/dist/_virtual/index9.js +2 -2
- package/dist/components/atoms/list.js +106 -41
- package/dist/components/atoms/list.js.map +1 -1
- package/dist/components/commerce/add-to-cart.js +82 -0
- package/dist/components/commerce/add-to-cart.js.map +1 -0
- package/dist/components/{atoms → commerce}/favorite-button.js +1 -1
- package/dist/components/commerce/favorite-button.js.map +1 -0
- package/dist/components/commerce/product-card.js +10 -10
- package/dist/components/commerce/product-card.js.map +1 -1
- package/dist/components/commerce/product-link.js +6 -6
- package/dist/components/commerce/product-link.js.map +1 -1
- package/dist/index.js +276 -274
- package/dist/index.js.map +1 -1
- package/dist/internal/components/refresh-indicator.js +83 -0
- package/dist/internal/components/refresh-indicator.js.map +1 -0
- package/dist/internal/usePullToRefresh.js +149 -0
- package/dist/internal/usePullToRefresh.js.map +1 -0
- package/dist/internal/utils/virtuoso-dom.js +20 -0
- package/dist/internal/utils/virtuoso-dom.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/color-string@1.9.1/node_modules/color-string/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/motion@12.17.3_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/PopChild.js +55 -0
- package/dist/shop-minis-react/node_modules/.pnpm/motion@12.17.3_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/PopChild.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/motion@12.17.3_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +35 -0
- package/dist/shop-minis-react/node_modules/.pnpm/motion@12.17.3_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/motion@12.17.3_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/index.js +46 -0
- package/dist/shop-minis-react/node_modules/.pnpm/motion@12.17.3_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/motion@12.17.3_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/utils.js +13 -0
- package/dist/shop-minis-react/node_modules/.pnpm/motion@12.17.3_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/utils.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/mpd-parser@1.3.1/node_modules/mpd-parser/dist/mpd-parser.es.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/simple-swizzle@0.2.2/node_modules/simple-swizzle/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/package.json +1 -1
- package/src/components/atoms/list.tsx +97 -12
- package/src/components/commerce/add-to-cart.test.tsx +73 -0
- package/src/components/commerce/add-to-cart.tsx +132 -0
- package/src/components/{atoms → commerce}/favorite-button.tsx +1 -1
- package/src/components/commerce/product-card.tsx +2 -1
- package/src/components/commerce/product-link.tsx +2 -1
- package/src/components/index.ts +2 -1
- package/src/internal/components/refresh-indicator.tsx +103 -0
- package/src/internal/usePullToRefresh.ts +286 -0
- package/src/internal/utils/virtuoso-dom.ts +26 -0
- package/src/stories/AddToCart.stories.tsx +186 -0
- package/src/stories/FavoriteButton.stories.tsx +2 -2
- package/src/stories/PullToRefreshList.stories.tsx +122 -0
- package/src/styles/animations.css +54 -0
- package/dist/components/atoms/favorite-button.js.map +0 -1
- /package/src/components/{atoms → commerce}/favorite-button.test.tsx +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as x, useState as y, useEffect as h } from "react";
|
|
3
|
+
import { cn as o } from "../../lib/utils.js";
|
|
4
|
+
const b = x(({ pullDistance: l, threshold: i, isRefreshing: t, canRefresh: n, className: m }, c) => {
|
|
5
|
+
const [a, s] = y(!1), e = Math.min(l / i, 1), p = 0.54 + e * (1 - 0.54), u = t ? 1 : 0.5 + e * 0.5, d = t ? 1 : Math.min(e * 1.5, 1), f = t ? 0 : e * 3;
|
|
6
|
+
return h(() => {
|
|
7
|
+
if (t && !a) {
|
|
8
|
+
s(!0);
|
|
9
|
+
const w = setTimeout(() => s(!1), 360);
|
|
10
|
+
return () => clearTimeout(w);
|
|
11
|
+
}
|
|
12
|
+
}, [t, a]), /* @__PURE__ */ r(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
ref: c,
|
|
16
|
+
className: o(
|
|
17
|
+
"flex items-center justify-center w-full h-full",
|
|
18
|
+
"transition-all duration-200 ease-out",
|
|
19
|
+
m
|
|
20
|
+
),
|
|
21
|
+
style: {
|
|
22
|
+
transform: `translateY(${f}px)`
|
|
23
|
+
},
|
|
24
|
+
children: /* @__PURE__ */ r(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: o(
|
|
28
|
+
"flex flex-col items-center space-y-2 rounded-full px-4 py-2 backdrop-blur-sm transition-all duration-200",
|
|
29
|
+
n || t ? "bg-primary/20 border-2 border-primary/40" : "bg-background/90"
|
|
30
|
+
),
|
|
31
|
+
style: {
|
|
32
|
+
opacity: d,
|
|
33
|
+
transform: `scale(${u})`
|
|
34
|
+
},
|
|
35
|
+
children: /* @__PURE__ */ r(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: o(
|
|
39
|
+
"h-8 w-8 transition-all duration-200",
|
|
40
|
+
a && "animate-bump"
|
|
41
|
+
),
|
|
42
|
+
children: /* @__PURE__ */ r(
|
|
43
|
+
"svg",
|
|
44
|
+
{
|
|
45
|
+
viewBox: "0 0 52 58",
|
|
46
|
+
fill: "none",
|
|
47
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
48
|
+
className: o(
|
|
49
|
+
"h-full w-full transition-colors duration-200",
|
|
50
|
+
n || t ? "text-primary" : "text-muted-foreground"
|
|
51
|
+
),
|
|
52
|
+
children: /* @__PURE__ */ r(
|
|
53
|
+
"path",
|
|
54
|
+
{
|
|
55
|
+
className: o(
|
|
56
|
+
"shop-spinner-path",
|
|
57
|
+
!t && "shop-spinner-progress",
|
|
58
|
+
t && "animate-shop-spin"
|
|
59
|
+
),
|
|
60
|
+
d: "M3 13C5 11.75 10.4968 6.92307 21.5 6.4999C34.5 5.99993 42 13 45 23C48.3 34 42.9211 48.1335 30.5 51C17.5 54 6.6 46 6 37C5.46667 29 10.5 25 14 23",
|
|
61
|
+
stroke: "currentColor",
|
|
62
|
+
strokeWidth: "8",
|
|
63
|
+
strokeLinecap: "square",
|
|
64
|
+
strokeLinejoin: "miter",
|
|
65
|
+
style: {
|
|
66
|
+
"--spinner-progress": t ? "1" : p
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
b.displayName = "RefreshIndicator";
|
|
80
|
+
export {
|
|
81
|
+
b as RefreshIndicator
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=refresh-indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refresh-indicator.js","sources":["../../../src/internal/components/refresh-indicator.tsx"],"sourcesContent":["import {forwardRef, useEffect, useState} from 'react'\n\nimport {cn} from '../../lib/utils'\n\nexport interface PullToRefreshIndicatorProps {\n pullDistance: number\n threshold: number\n isRefreshing: boolean\n canRefresh: boolean\n className?: string\n}\n\nexport const RefreshIndicator = forwardRef<\n HTMLDivElement,\n PullToRefreshIndicatorProps\n>(({pullDistance, threshold, isRefreshing, canRefresh, className}, ref) => {\n const [showBumpAnimation, setShowBumpAnimation] = useState(false)\n\n const progress = Math.min(pullDistance / threshold, 1)\n\n const spinnerProgress = 0.54 + progress * (1 - 0.54)\n\n const scale = isRefreshing ? 1 : 0.5 + progress * 0.5\n\n const opacity = isRefreshing ? 1 : Math.min(progress * 1.5, 1)\n\n const translateY = isRefreshing ? 0 : progress * 3\n\n useEffect(() => {\n if (isRefreshing && !showBumpAnimation) {\n setShowBumpAnimation(true)\n const timer = setTimeout(() => setShowBumpAnimation(false), 360)\n return () => clearTimeout(timer)\n }\n return undefined\n }, [isRefreshing, showBumpAnimation])\n\n return (\n <div\n ref={ref}\n className={cn(\n 'flex items-center justify-center w-full h-full',\n 'transition-all duration-200 ease-out',\n className\n )}\n style={{\n transform: `translateY(${translateY}px)`,\n }}\n >\n <div\n className={cn(\n 'flex flex-col items-center space-y-2 rounded-full px-4 py-2 backdrop-blur-sm transition-all duration-200',\n canRefresh || isRefreshing\n ? 'bg-primary/20 border-2 border-primary/40'\n : 'bg-background/90'\n )}\n style={{\n opacity,\n transform: `scale(${scale})`,\n }}\n >\n <div\n className={cn(\n 'h-8 w-8 transition-all duration-200',\n showBumpAnimation && 'animate-bump'\n )}\n >\n <svg\n viewBox=\"0 0 52 58\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={cn(\n 'h-full w-full transition-colors duration-200',\n canRefresh || isRefreshing\n ? 'text-primary'\n : 'text-muted-foreground'\n )}\n >\n <path\n className={cn(\n 'shop-spinner-path',\n !isRefreshing && 'shop-spinner-progress',\n isRefreshing && 'animate-shop-spin'\n )}\n d=\"M3 13C5 11.75 10.4968 6.92307 21.5 6.4999C34.5 5.99993 42 13 45 23C48.3 34 42.9211 48.1335 30.5 51C17.5 54 6.6 46 6 37C5.46667 29 10.5 25 14 23\"\n stroke=\"currentColor\"\n strokeWidth=\"8\"\n strokeLinecap=\"square\"\n strokeLinejoin=\"miter\"\n style={\n {\n '--spinner-progress': isRefreshing ? '1' : spinnerProgress,\n } as React.CSSProperties\n }\n />\n </svg>\n </div>\n </div>\n </div>\n )\n})\n\nRefreshIndicator.displayName = 'RefreshIndicator'\n"],"names":["RefreshIndicator","forwardRef","pullDistance","threshold","isRefreshing","canRefresh","className","ref","showBumpAnimation","setShowBumpAnimation","useState","progress","spinnerProgress","scale","opacity","translateY","useEffect","timer","jsx","cn"],"mappings":";;;AAYa,MAAAA,IAAmBC,EAG9B,CAAC,EAAC,cAAAC,GAAc,WAAAC,GAAW,cAAAC,GAAc,YAAAC,GAAY,WAAAC,EAAS,GAAGC,MAAQ;AACzE,QAAM,CAACC,GAAmBC,CAAoB,IAAIC,EAAS,EAAK,GAE1DC,IAAW,KAAK,IAAIT,IAAeC,GAAW,CAAC,GAE/CS,IAAkB,OAAOD,KAAY,IAAI,OAEzCE,IAAQT,IAAe,IAAI,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c;AAAA,sBACd,gBAAe;AAAA,sBACf,OACE;AAAA,wBACE,sBAAsBA,IAAe,MAAMQ;AAAA,sBAAA;AAAA,oBAC7C;AAAA,kBAAA;AAAA,gBAEJ;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAEJ,CAAC;AAEDZ,EAAiB,cAAc;"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { useState as M, useRef as P, useCallback as o, useEffect as O } from "react";
|
|
2
|
+
const _ = 200, H = 400;
|
|
3
|
+
function U({
|
|
4
|
+
onRefresh: g,
|
|
5
|
+
threshold: R = _,
|
|
6
|
+
indicatorThreshold: p = 0,
|
|
7
|
+
enabled: E = !1
|
|
8
|
+
}) {
|
|
9
|
+
const [Y, u] = M({
|
|
10
|
+
isPulling: !1,
|
|
11
|
+
pullDistance: 0,
|
|
12
|
+
canRefresh: !1
|
|
13
|
+
}), i = P(0), F = P(0), f = P(null), e = P(null), a = P(!1), A = o(
|
|
14
|
+
(n) => {
|
|
15
|
+
!E || !f.current || a.current || (e.current && (cancelAnimationFrame(e.current), e.current = null), u((t) => {
|
|
16
|
+
const r = f.current;
|
|
17
|
+
if (!r) return t;
|
|
18
|
+
if (r.scrollTop <= 0) {
|
|
19
|
+
const h = n.touches[0];
|
|
20
|
+
i.current = h.clientY;
|
|
21
|
+
} else
|
|
22
|
+
return i.current = 0, {
|
|
23
|
+
...t,
|
|
24
|
+
isPulling: !1,
|
|
25
|
+
pullDistance: 0,
|
|
26
|
+
canRefresh: !1
|
|
27
|
+
};
|
|
28
|
+
return t;
|
|
29
|
+
}));
|
|
30
|
+
},
|
|
31
|
+
[E]
|
|
32
|
+
), S = o(
|
|
33
|
+
(n, t) => {
|
|
34
|
+
!E || !f.current || i.current === 0 || u((r) => {
|
|
35
|
+
if (a.current)
|
|
36
|
+
return r;
|
|
37
|
+
const c = f.current;
|
|
38
|
+
if (!c) return r;
|
|
39
|
+
const h = c.scrollTop <= 0;
|
|
40
|
+
F.current = n;
|
|
41
|
+
const s = F.current - i.current;
|
|
42
|
+
if (h && s > 0) {
|
|
43
|
+
const l = s, m = l >= p;
|
|
44
|
+
if (m && t && t(), m || r.isPulling) {
|
|
45
|
+
const D = l > R ? R + (l - R) * 0.5 : l;
|
|
46
|
+
return {
|
|
47
|
+
...r,
|
|
48
|
+
isPulling: m,
|
|
49
|
+
pullDistance: D,
|
|
50
|
+
canRefresh: l >= R
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return r;
|
|
54
|
+
} else if (r.isPulling)
|
|
55
|
+
return {
|
|
56
|
+
...r,
|
|
57
|
+
isPulling: !1,
|
|
58
|
+
pullDistance: 0,
|
|
59
|
+
canRefresh: !1
|
|
60
|
+
};
|
|
61
|
+
return r;
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
[R, p, E]
|
|
65
|
+
), L = o(
|
|
66
|
+
(n) => {
|
|
67
|
+
if (a.current) return;
|
|
68
|
+
const t = n.touches[0];
|
|
69
|
+
t && i.current !== 0 && S(t.clientY, () => n.preventDefault());
|
|
70
|
+
},
|
|
71
|
+
[S]
|
|
72
|
+
), v = o(() => {
|
|
73
|
+
a.current = !1;
|
|
74
|
+
}, []), w = o((n) => {
|
|
75
|
+
e.current && (cancelAnimationFrame(e.current), e.current = null);
|
|
76
|
+
let t = n;
|
|
77
|
+
if (t === void 0 && u((s) => (t = s.pullDistance, s)), !t || t <= 0) {
|
|
78
|
+
u((s) => ({
|
|
79
|
+
...s,
|
|
80
|
+
pullDistance: 0,
|
|
81
|
+
canRefresh: !1,
|
|
82
|
+
isPulling: !1
|
|
83
|
+
}));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const r = H, c = Date.now(), h = () => {
|
|
87
|
+
const s = Date.now() - c, T = Math.min(s / r, 1), l = 1 - (1 - T) ** 3, m = t * (1 - l);
|
|
88
|
+
u((D) => ({
|
|
89
|
+
...D,
|
|
90
|
+
pullDistance: m,
|
|
91
|
+
canRefresh: T < 1 ? D.canRefresh : !1
|
|
92
|
+
})), T < 1 ? e.current = requestAnimationFrame(h) : (e.current = null, u((D) => ({
|
|
93
|
+
...D,
|
|
94
|
+
pullDistance: 0,
|
|
95
|
+
canRefresh: !1,
|
|
96
|
+
isPulling: !1
|
|
97
|
+
})));
|
|
98
|
+
};
|
|
99
|
+
e.current = requestAnimationFrame(h);
|
|
100
|
+
}, []), d = o(async () => {
|
|
101
|
+
if (a.current) {
|
|
102
|
+
i.current = 0;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
i.current = 0, e.current && (cancelAnimationFrame(e.current), e.current = null);
|
|
106
|
+
let n = !1, t = 0;
|
|
107
|
+
const r = a.current;
|
|
108
|
+
if (u((c) => (n = c.canRefresh && !r, t = c.pullDistance, {
|
|
109
|
+
...c,
|
|
110
|
+
isPulling: !1
|
|
111
|
+
})), t <= 0) {
|
|
112
|
+
u((c) => ({
|
|
113
|
+
...c,
|
|
114
|
+
pullDistance: 0,
|
|
115
|
+
canRefresh: !1
|
|
116
|
+
}));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (n && g) {
|
|
120
|
+
a.current = !0;
|
|
121
|
+
try {
|
|
122
|
+
await g();
|
|
123
|
+
} catch (c) {
|
|
124
|
+
console.error("Pull to refresh failed:", c);
|
|
125
|
+
}
|
|
126
|
+
v();
|
|
127
|
+
}
|
|
128
|
+
w(t);
|
|
129
|
+
}, [g, w, v]), I = o(
|
|
130
|
+
(n) => {
|
|
131
|
+
if (n)
|
|
132
|
+
return f.current = n, n.addEventListener("touchstart", A, { passive: !1 }), n.addEventListener("touchmove", L, { passive: !1 }), n.addEventListener("touchend", d), n.addEventListener("touchcancel", d), () => {
|
|
133
|
+
n.removeEventListener("touchstart", A), n.removeEventListener("touchmove", L), n.removeEventListener("touchend", d), n.removeEventListener("touchcancel", d);
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
[A, L, d]
|
|
137
|
+
);
|
|
138
|
+
return O(() => () => {
|
|
139
|
+
e.current && (cancelAnimationFrame(e.current), e.current = null);
|
|
140
|
+
}, []), {
|
|
141
|
+
state: Y,
|
|
142
|
+
bindToElement: I,
|
|
143
|
+
containerRef: f
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
export {
|
|
147
|
+
U as usePullToRefresh
|
|
148
|
+
};
|
|
149
|
+
//# sourceMappingURL=usePullToRefresh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePullToRefresh.js","sources":["../../src/internal/usePullToRefresh.ts"],"sourcesContent":["import {useCallback, useEffect, useRef, useState} from 'react'\n\nconst DEFAULT_REFRESH_PULL_THRESHOLD = 200\nconst ANIMATION_DURATION = 400\n\nexport interface UsePullToRefreshOptions {\n onRefresh?: () => Promise<void>\n threshold?: number\n indicatorThreshold?: number\n enabled?: boolean\n}\n\nexport interface PullToRefreshState {\n isPulling: boolean\n pullDistance: number\n canRefresh: boolean\n}\n\nexport function usePullToRefresh({\n onRefresh,\n threshold = DEFAULT_REFRESH_PULL_THRESHOLD,\n indicatorThreshold = 0,\n enabled = false,\n}: UsePullToRefreshOptions) {\n const [state, setState] = useState<PullToRefreshState>({\n isPulling: false,\n pullDistance: 0,\n canRefresh: false,\n })\n\n const startY = useRef(0)\n const currentY = useRef(0)\n const containerRef = useRef<HTMLElement | null>(null)\n const animationRef = useRef<number | null>(null)\n const isRefreshingRef = useRef(false)\n\n const handleTouchStart = useCallback(\n (event: TouchEvent) => {\n if (!enabled || !containerRef.current || isRefreshingRef.current) return\n\n if (animationRef.current) {\n cancelAnimationFrame(animationRef.current)\n animationRef.current = null\n }\n\n setState(prev => {\n const container = containerRef.current\n if (!container) return prev\n\n const isAtTop = container.scrollTop <= 0\n\n if (isAtTop) {\n const touch = event.touches[0]\n startY.current = touch.clientY\n } else {\n startY.current = 0\n return {\n ...prev,\n isPulling: false,\n pullDistance: 0,\n canRefresh: false,\n }\n }\n\n return prev\n })\n },\n [enabled]\n )\n\n const handleMove = useCallback(\n (clientY: number, preventDefault?: () => void) => {\n if (!enabled || !containerRef.current || startY.current === 0) {\n return\n }\n\n setState(prev => {\n if (isRefreshingRef.current) {\n return prev\n }\n\n const container = containerRef.current\n if (!container) return prev\n\n const isAtTop = container.scrollTop <= 0\n currentY.current = clientY\n const deltaY = currentY.current - startY.current\n const isValidPull = isAtTop && deltaY > 0\n\n if (isValidPull) {\n const pullDistance = deltaY\n const shouldShowIndicator = pullDistance >= indicatorThreshold\n\n if (shouldShowIndicator && preventDefault) {\n preventDefault()\n }\n\n if (shouldShowIndicator || prev.isPulling) {\n const elasticDistance =\n pullDistance > threshold\n ? threshold + (pullDistance - threshold) * 0.5\n : pullDistance\n\n return {\n ...prev,\n isPulling: shouldShowIndicator,\n pullDistance: elasticDistance,\n canRefresh: pullDistance >= threshold,\n }\n }\n\n return prev\n } else if (prev.isPulling) {\n return {\n ...prev,\n isPulling: false,\n pullDistance: 0,\n canRefresh: false,\n }\n }\n\n return prev\n })\n },\n [threshold, indicatorThreshold, enabled]\n )\n\n const handleTouchMove = useCallback(\n (event: TouchEvent) => {\n if (isRefreshingRef.current) return\n\n const touch = event.touches[0]\n if (!touch) return\n\n if (startY.current !== 0) {\n handleMove(touch.clientY, () => event.preventDefault())\n }\n },\n [handleMove]\n )\n\n const resetRefreshingState = useCallback(() => {\n isRefreshingRef.current = false\n }, [])\n\n const animatePullDistanceToZero = useCallback((fromDistance?: number) => {\n if (animationRef.current) {\n cancelAnimationFrame(animationRef.current)\n animationRef.current = null\n }\n\n let startDistance = fromDistance\n if (startDistance === undefined) {\n setState(prev => {\n startDistance = prev.pullDistance\n return prev\n })\n }\n\n if (!startDistance || startDistance <= 0) {\n setState(prev => ({\n ...prev,\n pullDistance: 0,\n canRefresh: false,\n isPulling: false,\n }))\n return\n }\n\n const duration = ANIMATION_DURATION\n const startTime = Date.now()\n\n const animate = () => {\n const elapsed = Date.now() - startTime\n const progress = Math.min(elapsed / duration, 1)\n\n const easeOut = 1 - (1 - progress) ** 3\n const currentDistance = startDistance! * (1 - easeOut)\n\n setState(prev => ({\n ...prev,\n pullDistance: currentDistance,\n canRefresh: progress < 1 ? prev.canRefresh : false,\n }))\n\n if (progress < 1) {\n animationRef.current = requestAnimationFrame(animate)\n } else {\n animationRef.current = null\n setState(prev => ({\n ...prev,\n pullDistance: 0,\n canRefresh: false,\n isPulling: false,\n }))\n }\n }\n\n animationRef.current = requestAnimationFrame(animate)\n }, [])\n\n const handleEnd = useCallback(async () => {\n if (isRefreshingRef.current) {\n startY.current = 0\n return\n }\n\n startY.current = 0\n\n if (animationRef.current) {\n cancelAnimationFrame(animationRef.current)\n animationRef.current = null\n }\n\n let shouldRefresh = false\n let currentPullDistance = 0\n const wasRefreshing = isRefreshingRef.current\n\n setState(prev => {\n shouldRefresh = prev.canRefresh && !wasRefreshing\n currentPullDistance = prev.pullDistance\n\n return {\n ...prev,\n isPulling: false,\n }\n })\n\n if (currentPullDistance <= 0) {\n setState(prev => ({\n ...prev,\n pullDistance: 0,\n canRefresh: false,\n }))\n return\n }\n\n if (shouldRefresh && onRefresh) {\n isRefreshingRef.current = true\n try {\n await onRefresh()\n } catch (error) {\n console.error('Pull to refresh failed:', error)\n }\n resetRefreshingState()\n }\n\n animatePullDistanceToZero(currentPullDistance)\n }, [onRefresh, animatePullDistanceToZero, resetRefreshingState])\n\n const bindToElement = useCallback(\n (element: HTMLElement | null) => {\n if (!element) return\n\n containerRef.current = element\n\n element.addEventListener('touchstart', handleTouchStart, {passive: false})\n element.addEventListener('touchmove', handleTouchMove, {passive: false})\n element.addEventListener('touchend', handleEnd)\n element.addEventListener('touchcancel', handleEnd)\n\n return () => {\n element.removeEventListener('touchstart', handleTouchStart)\n element.removeEventListener('touchmove', handleTouchMove)\n element.removeEventListener('touchend', handleEnd)\n element.removeEventListener('touchcancel', handleEnd)\n }\n },\n [handleTouchStart, handleTouchMove, handleEnd]\n )\n\n useEffect(() => {\n return () => {\n if (animationRef.current) {\n cancelAnimationFrame(animationRef.current)\n animationRef.current = null\n }\n }\n }, [])\n\n return {\n state,\n bindToElement,\n containerRef,\n }\n}\n"],"names":["DEFAULT_REFRESH_PULL_THRESHOLD","ANIMATION_DURATION","usePullToRefresh","onRefresh","threshold","indicatorThreshold","enabled","state","setState","useState","startY","useRef","currentY","containerRef","animationRef","isRefreshingRef","handleTouchStart","useCallback","event","prev","container","touch","handleMove","clientY","preventDefault","isAtTop","deltaY","pullDistance","shouldShowIndicator","elasticDistance","handleTouchMove","resetRefreshingState","animatePullDistanceToZero","fromDistance","startDistance","duration","startTime","animate","elapsed","progress","easeOut","currentDistance","handleEnd","shouldRefresh","currentPullDistance","wasRefreshing","error","bindToElement","element","useEffect"],"mappings":";AAEA,MAAMA,IAAiC,KACjCC,IAAqB;AAepB,SAASC,EAAiB;AAAA,EAC/B,WAAAC;AAAA,EACA,WAAAC,IAAYJ;AAAA,EACZ,oBAAAK,IAAqB;AAAA,EACrB,SAAAC,IAAU;AACZ,GAA4B;AAC1B,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAA6B;AAAA,IACrD,WAAW;AAAA,IACX,cAAc;AAAA,IACd,YAAY;AAAA,EAAA,CACb,GAEKC,IAASC,EAAO,CAAC,GACjBC,IAAWD,EAAO,CAAC,GACnBE,IAAeF,EAA2B,IAAI,GAC9CG,IAAeH,EAAsB,IAAI,GACzCI,IAAkBJ,EAAO,EAAK,GAE9BK,IAAmBC;AAAA,IACvB,CAACC,MAAsB;AACrB,MAAI,CAACZ,KAAW,CAACO,EAAa,WAAWE,EAAgB,YAErDD,EAAa,YACf,qBAAqBA,EAAa,OAAO,GACzCA,EAAa,UAAU,OAGzBN,EAAS,CAAQW,MAAA;AACf,cAAMC,IAAYP,EAAa;AAC3B,YAAA,CAACO,EAAkB,QAAAD;AAIvB,YAFgBC,EAAU,aAAa,GAE1B;AACL,gBAAAC,IAAQH,EAAM,QAAQ,CAAC;AAC7B,UAAAR,EAAO,UAAUW,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A,EAC/C;AAEA,SAAAO,EAAU,MACD,MAAM;AACX,IAAInC,EAAa,YACf,qBAAqBA,EAAa,OAAO,GACzCA,EAAa,UAAU;AAAA,EAE3B,GACC,EAAE,GAEE;AAAA,IACL,OAAAP;AAAA,IACA,eAAAwC;AAAA,IACA,cAAAlC;AAAA,EACF;AACF;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const c = (o) => {
|
|
2
|
+
const t = "[data-virtuoso-scroller]";
|
|
3
|
+
let l = null;
|
|
4
|
+
if (l = o.querySelector(t), l) return l;
|
|
5
|
+
if (!l) {
|
|
6
|
+
const s = Array.from(o.querySelectorAll("div"));
|
|
7
|
+
for (const e of s) {
|
|
8
|
+
const r = window.getComputedStyle(e);
|
|
9
|
+
if (r.overflowY === "auto" || r.overflowY === "scroll") {
|
|
10
|
+
l = e;
|
|
11
|
+
break;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return l || o;
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
c as findVirtuosoScrollableElement
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=virtuoso-dom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtuoso-dom.js","sources":["../../../src/internal/utils/virtuoso-dom.ts"],"sourcesContent":["// For finding the scrollable element within a container for pull-to-refresh functionality.\n\nexport const findVirtuosoScrollableElement = (\n container: HTMLElement\n): HTMLElement => {\n const selector = '[data-virtuoso-scroller]'\n\n let scrollableElement: HTMLElement | null = null\n\n scrollableElement = container.querySelector(selector) as HTMLElement\n\n if (scrollableElement) return scrollableElement\n\n if (!scrollableElement) {\n const allDivs = Array.from(container.querySelectorAll('div'))\n for (const div of allDivs) {\n const style = window.getComputedStyle(div)\n if (style.overflowY === 'auto' || style.overflowY === 'scroll') {\n scrollableElement = div as HTMLElement\n break\n }\n }\n }\n\n return scrollableElement || container\n}\n"],"names":["findVirtuosoScrollableElement","container","selector","scrollableElement","allDivs","div","style"],"mappings":"AAEa,MAAAA,IAAgC,CAC3CC,MACgB;AAChB,QAAMC,IAAW;AAEjB,MAAIC,IAAwC;AAI5C,MAFoBA,IAAAF,EAAU,cAAcC,CAAQ,GAEhDC,EAA0B,QAAAA;AAE9B,MAAI,CAACA,GAAmB;AACtB,UAAMC,IAAU,MAAM,KAAKH,EAAU,iBAAiB,KAAK,CAAC;AAC5D,eAAWI,KAAOD,GAAS;AACnB,YAAAE,IAAQ,OAAO,iBAAiBD,CAAG;AACzC,UAAIC,EAAM,cAAc,UAAUA,EAAM,cAAc,UAAU;AAC1C,QAAAH,IAAAE;AACpB;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAGF,SAAOF,KAAqBF;AAC9B;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as q } from "../../../../../../../../_virtual/
|
|
1
|
+
import { __module as q } from "../../../../../../../../_virtual/index5.js";
|
|
2
2
|
import { __require as F } from "../../../../../global@4.4.0/node_modules/global/window.js";
|
|
3
3
|
import { __require as N } from "../../../../../@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/extends.js";
|
|
4
4
|
import { __require as J } from "../../../../../is-function@1.0.2/node_modules/is-function/index.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as p } from "../../../../../../_virtual/
|
|
1
|
+
import { __module as p } from "../../../../../../_virtual/index7.js";
|
|
2
2
|
import { __require as F } from "../../../color-name@1.1.4/node_modules/color-name/index.js";
|
|
3
3
|
import { __require as x } from "../../../simple-swizzle@0.2.2/node_modules/simple-swizzle/index.js";
|
|
4
4
|
var M;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import * as c from "react";
|
|
3
|
+
import { useId as x, useRef as d, useContext as C, useInsertionEffect as R } from "react";
|
|
4
|
+
import { MotionConfigContext as $ } from "../../context/MotionConfigContext.js";
|
|
5
|
+
import { isHTMLElement as w } from "../../../../../motion-dom/dist/es/utils/is-html-element.js";
|
|
6
|
+
class P extends c.Component {
|
|
7
|
+
getSnapshotBeforeUpdate(i) {
|
|
8
|
+
const e = this.props.childRef.current;
|
|
9
|
+
if (e && i.isPresent && !this.props.isPresent) {
|
|
10
|
+
const r = e.offsetParent, o = w(r) && r.offsetWidth || 0, t = this.props.sizeRef.current;
|
|
11
|
+
t.height = e.offsetHeight || 0, t.width = e.offsetWidth || 0, t.top = e.offsetTop, t.left = e.offsetLeft, t.right = o - t.width - t.left;
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Required with getSnapshotBeforeUpdate to stop React complaining.
|
|
17
|
+
*/
|
|
18
|
+
componentDidUpdate() {
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
return this.props.children;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function W({ children: s, isPresent: i, anchorX: e }) {
|
|
25
|
+
const r = x(), o = d(null), t = d({
|
|
26
|
+
width: 0,
|
|
27
|
+
height: 0,
|
|
28
|
+
top: 0,
|
|
29
|
+
left: 0,
|
|
30
|
+
right: 0
|
|
31
|
+
}), { nonce: p } = C($);
|
|
32
|
+
return R(() => {
|
|
33
|
+
const { width: f, height: h, top: l, left: m, right: a } = t.current;
|
|
34
|
+
if (i || !o.current || !f || !h)
|
|
35
|
+
return;
|
|
36
|
+
const u = e === "left" ? `left: ${m}` : `right: ${a}`;
|
|
37
|
+
o.current.dataset.motionPopId = r;
|
|
38
|
+
const n = document.createElement("style");
|
|
39
|
+
return p && (n.nonce = p), document.head.appendChild(n), n.sheet && n.sheet.insertRule(`
|
|
40
|
+
[data-motion-pop-id="${r}"] {
|
|
41
|
+
position: absolute !important;
|
|
42
|
+
width: ${f}px !important;
|
|
43
|
+
height: ${h}px !important;
|
|
44
|
+
${u}px !important;
|
|
45
|
+
top: ${l}px !important;
|
|
46
|
+
}
|
|
47
|
+
`), () => {
|
|
48
|
+
document.head.contains(n) && document.head.removeChild(n);
|
|
49
|
+
};
|
|
50
|
+
}, [i]), g(P, { isPresent: i, childRef: o, sizeRef: t, children: c.cloneElement(s, { ref: o }) });
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
W as PopChild
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=PopChild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PopChild.js","sources":["../../../../../../../../../../../../../../node_modules/.pnpm/motion@12.17.3_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs"],"sourcesContent":["\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport * as React from 'react';\nimport { useId, useRef, useContext, useInsertionEffect } from 'react';\nimport { MotionConfigContext } from '../../context/MotionConfigContext.mjs';\nimport { isHTMLElement } from '../../../../../motion-dom/dist/es/utils/is-html-element.mjs';\n\n/**\n * Measurement functionality has to be within a separate component\n * to leverage snapshot lifecycle.\n */\nclass PopChildMeasure extends React.Component {\n getSnapshotBeforeUpdate(prevProps) {\n const element = this.props.childRef.current;\n if (element && prevProps.isPresent && !this.props.isPresent) {\n const parent = element.offsetParent;\n const parentWidth = isHTMLElement(parent)\n ? parent.offsetWidth || 0\n : 0;\n const size = this.props.sizeRef.current;\n size.height = element.offsetHeight || 0;\n size.width = element.offsetWidth || 0;\n size.top = element.offsetTop;\n size.left = element.offsetLeft;\n size.right = parentWidth - size.width - size.left;\n }\n return null;\n }\n /**\n * Required with getSnapshotBeforeUpdate to stop React complaining.\n */\n componentDidUpdate() { }\n render() {\n return this.props.children;\n }\n}\nfunction PopChild({ children, isPresent, anchorX }) {\n const id = useId();\n const ref = useRef(null);\n const size = useRef({\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n right: 0,\n });\n const { nonce } = useContext(MotionConfigContext);\n /**\n * We create and inject a style block so we can apply this explicit\n * sizing in a non-destructive manner by just deleting the style block.\n *\n * We can't apply size via render as the measurement happens\n * in getSnapshotBeforeUpdate (post-render), likewise if we apply the\n * styles directly on the DOM node, we might be overwriting\n * styles set via the style prop.\n */\n useInsertionEffect(() => {\n const { width, height, top, left, right } = size.current;\n if (isPresent || !ref.current || !width || !height)\n return;\n const x = anchorX === \"left\" ? `left: ${left}` : `right: ${right}`;\n ref.current.dataset.motionPopId = id;\n const style = document.createElement(\"style\");\n if (nonce)\n style.nonce = nonce;\n document.head.appendChild(style);\n if (style.sheet) {\n style.sheet.insertRule(`\n [data-motion-pop-id=\"${id}\"] {\n position: absolute !important;\n width: ${width}px !important;\n height: ${height}px !important;\n ${x}px !important;\n top: ${top}px !important;\n }\n `);\n }\n return () => {\n if (document.head.contains(style)) {\n document.head.removeChild(style);\n }\n };\n }, [isPresent]);\n return (jsx(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, children: React.cloneElement(children, { ref }) }));\n}\n\nexport { PopChild };\n"],"names":["PopChildMeasure","React","prevProps","element","parent","parentWidth","isHTMLElement","size","PopChild","children","isPresent","anchorX","id","useId","ref","useRef","nonce","useContext","MotionConfigContext","useInsertionEffect","width","height","top","left","right","x","style","jsx"],"mappings":";;;;;AAWA,MAAMA,UAAwBC,EAAM,UAAU;AAAA,EAC1C,wBAAwBC,GAAW;AAC/B,UAAMC,IAAU,KAAK,MAAM,SAAS;AACpC,QAAIA,KAAWD,EAAU,aAAa,CAAC,KAAK,MAAM,WAAW;AACzD,YAAME,IAASD,EAAQ,cACjBE,IAAcC,EAAcF,CAAM,KAClCA,EAAO,eAAe,GAEtBG,IAAO,KAAK,MAAM,QAAQ;AAChC,MAAAA,EAAK,SAASJ,EAAQ,gBAAgB,GACtCI,EAAK,QAAQJ,EAAQ,eAAe,GACpCI,EAAK,MAAMJ,EAAQ,WACnBI,EAAK,OAAOJ,EAAQ,YACpBI,EAAK,QAAQF,IAAcE,EAAK,QAAQA,EAAK;AAAA,IACzD;AACQ,WAAO;AAAA,EACf;AAAA;AAAA;AAAA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 +1,35 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import * as C from "react";
|
|
3
|
+
import { useId as v, useMemo as c } from "react";
|
|
4
|
+
import { PresenceContext as M } from "../../context/PresenceContext.js";
|
|
5
|
+
import { useConstant as w } from "../../utils/use-constant.js";
|
|
6
|
+
import { PopChild as x } from "./PopChild.js";
|
|
7
|
+
const X = ({ children: f, initial: i, isPresent: r, onExitComplete: t, custom: m, presenceAffectsLayout: p, mode: l, anchorX: d }) => {
|
|
8
|
+
const e = w(R), h = v();
|
|
9
|
+
let u = !0, s = c(() => (u = !1, {
|
|
10
|
+
id: h,
|
|
11
|
+
initial: i,
|
|
12
|
+
isPresent: r,
|
|
13
|
+
custom: m,
|
|
14
|
+
onExitComplete: (o) => {
|
|
15
|
+
e.set(o, !0);
|
|
16
|
+
for (const n of e.values())
|
|
17
|
+
if (!n)
|
|
18
|
+
return;
|
|
19
|
+
t && t();
|
|
20
|
+
},
|
|
21
|
+
register: (o) => (e.set(o, !1), () => e.delete(o))
|
|
22
|
+
}), [r, e, t]);
|
|
23
|
+
return p && u && (s = { ...s }), c(() => {
|
|
24
|
+
e.forEach((o, n) => e.set(n, !1));
|
|
25
|
+
}, [r]), C.useEffect(() => {
|
|
26
|
+
!r && !e.size && t && t();
|
|
27
|
+
}, [r]), l === "popLayout" && (f = a(x, { isPresent: r, anchorX: d, children: f })), a(M.Provider, { value: s, children: f });
|
|
28
|
+
};
|
|
29
|
+
function R() {
|
|
30
|
+
return /* @__PURE__ */ new Map();
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
X as PresenceChild
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=PresenceChild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PresenceChild.js","sources":["../../../../../../../../../../../../../../node_modules/.pnpm/motion@12.17.3_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs"],"sourcesContent":["\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport * as React from 'react';\nimport { useId, useMemo } from 'react';\nimport { PresenceContext } from '../../context/PresenceContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { PopChild } from './PopChild.mjs';\n\nconst PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, }) => {\n const presenceChildren = useConstant(newChildrenMap);\n const id = useId();\n let isReusedContext = true;\n let context = useMemo(() => {\n isReusedContext = false;\n return {\n id,\n initial,\n isPresent,\n custom,\n onExitComplete: (childId) => {\n presenceChildren.set(childId, true);\n for (const isComplete of presenceChildren.values()) {\n if (!isComplete)\n return; // can stop searching when any is incomplete\n }\n onExitComplete && onExitComplete();\n },\n register: (childId) => {\n presenceChildren.set(childId, false);\n return () => presenceChildren.delete(childId);\n },\n };\n }, [isPresent, presenceChildren, onExitComplete]);\n /**\n * If the presence of a child affects the layout of the components around it,\n * we want to make a new context value to ensure they get re-rendered\n * so they can detect that layout change.\n */\n if (presenceAffectsLayout && isReusedContext) {\n context = { ...context };\n }\n useMemo(() => {\n presenceChildren.forEach((_, key) => presenceChildren.set(key, false));\n }, [isPresent]);\n /**\n * If there's no `motion` components to fire exit animations, we want to remove this\n * component immediately.\n */\n React.useEffect(() => {\n !isPresent &&\n !presenceChildren.size &&\n onExitComplete &&\n onExitComplete();\n }, [isPresent]);\n if (mode === \"popLayout\") {\n children = (jsx(PopChild, { isPresent: isPresent, anchorX: anchorX, children: children }));\n }\n return (jsx(PresenceContext.Provider, { value: context, children: children }));\n};\nfunction newChildrenMap() {\n return new Map();\n}\n\nexport { PresenceChild };\n"],"names":["PresenceChild","children","initial","isPresent","onExitComplete","custom","presenceAffectsLayout","mode","anchorX","presenceChildren","useConstant","newChildrenMap","id","useId","isReusedContext","context","useMemo","childId","isComplete","_","key","React","jsx","PopChild","PresenceContext"],"mappings":";;;;;;AAQK,MAACA,IAAgB,C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ime";
|
|
2
|
+
import { useMemo as M, useRef as g, useState as E, useContext as N } from "react";
|
|
3
|
+
import { LayoutGroupContext as T } from "../../context/LayoutGroupContext.js";
|
|
4
|
+
import { useConstant as F } from "../../utils/use-constant.js";
|
|
5
|
+
import { useIsomorphicLayoutEffect as G } from "../../utils/use-isomorphic-effect.js";
|
|
6
|
+
import { PresenceChild as O } from "./PresenceChild.js";
|
|
7
|
+
import { usePresence as S } from "./use-presence.js";
|
|
8
|
+
import { onlyElements as w, getChildKey as c } from "./utils.js";
|
|
9
|
+
const J = ({ children: m, custom: v, initial: R = !0, onExitComplete: a, presenceAffectsLayout: k = !0, mode: f = "sync", propagate: l = !1, anchorX: A = "left" }) => {
|
|
10
|
+
const [h, L] = S(l), n = M(() => w(m), [m]), o = l && !h ? [] : n.map(c), p = g(!0), C = g(n), s = F(() => /* @__PURE__ */ new Map()), [b, j] = E(n), [r, y] = E(n);
|
|
11
|
+
G(() => {
|
|
12
|
+
p.current = !1, C.current = n;
|
|
13
|
+
for (let t = 0; t < r.length; t++) {
|
|
14
|
+
const e = c(r[t]);
|
|
15
|
+
o.includes(e) ? s.delete(e) : s.get(e) !== !0 && s.set(e, !1);
|
|
16
|
+
}
|
|
17
|
+
}, [r, o.length, o.join("-")]);
|
|
18
|
+
const u = [];
|
|
19
|
+
if (n !== b) {
|
|
20
|
+
let t = [...n];
|
|
21
|
+
for (let e = 0; e < r.length; e++) {
|
|
22
|
+
const i = r[e], d = c(i);
|
|
23
|
+
o.includes(d) || (t.splice(e, 0, i), u.push(i));
|
|
24
|
+
}
|
|
25
|
+
return f === "wait" && u.length && (t = u), y(w(t)), j(n), null;
|
|
26
|
+
}
|
|
27
|
+
process.env.NODE_ENV !== "production" && f === "wait" && r.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
|
|
28
|
+
const { forceRender: D } = N(T);
|
|
29
|
+
return P(K, { children: r.map((t) => {
|
|
30
|
+
const e = c(t), i = l && !h ? !1 : n === r || o.includes(e), d = () => {
|
|
31
|
+
if (s.has(e))
|
|
32
|
+
s.set(e, !0);
|
|
33
|
+
else
|
|
34
|
+
return;
|
|
35
|
+
let x = !0;
|
|
36
|
+
s.forEach((I) => {
|
|
37
|
+
I || (x = !1);
|
|
38
|
+
}), x && (D?.(), y(C.current), l && L?.(), a && a());
|
|
39
|
+
};
|
|
40
|
+
return P(O, { isPresent: i, initial: !p.current || R ? void 0 : !1, custom: v, presenceAffectsLayout: k, mode: f, onExitComplete: i ? void 0 : d, anchorX: A, children: t }, e);
|
|
41
|
+
}) });
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
J as AnimatePresence
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../../../../../../../node_modules/.pnpm/motion@12.17.3_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs"],"sourcesContent":["\"use client\";\nimport { jsx, Fragment } from 'react/jsx-runtime';\nimport { useMemo, useRef, useState, useContext } from 'react';\nimport { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';\nimport { PresenceChild } from './PresenceChild.mjs';\nimport { usePresence } from './use-presence.mjs';\nimport { onlyElements, getChildKey } from './utils.mjs';\n\n/**\n * `AnimatePresence` enables the animation of components that have been removed from the tree.\n *\n * When adding/removing more than a single child, every child **must** be given a unique `key` prop.\n *\n * Any `motion` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```jsx\n * import { motion, AnimatePresence } from 'framer-motion'\n *\n * export const Items = ({ items }) => (\n * <AnimatePresence>\n * {items.map(item => (\n * <motion.div\n * key={item.id}\n * initial={{ opacity: 0 }}\n * animate={{ opacity: 1 }}\n * exit={{ opacity: 0 }}\n * />\n * ))}\n * </AnimatePresence>\n * )\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * If a child contains multiple `motion` components with `exit` props, it will only unmount the child\n * once all `motion` components have finished animating out. Likewise, any components using\n * `usePresence` all need to call `safeToRemove`.\n *\n * @public\n */\nconst AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = \"sync\", propagate = false, anchorX = \"left\", }) => {\n const [isParentPresent, safeToRemove] = usePresence(propagate);\n /**\n * Filter any children that aren't ReactElements. We can only track components\n * between renders with a props.key.\n */\n const presentChildren = useMemo(() => onlyElements(children), [children]);\n /**\n * Track the keys of the currently rendered children. This is used to\n * determine which children are exiting.\n */\n const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey);\n /**\n * If `initial={false}` we only want to pass this to components in the first render.\n */\n const isInitialRender = useRef(true);\n /**\n * A ref containing the currently present children. When all exit animations\n * are complete, we use this to re-render the component with the latest children\n * *committed* rather than the latest children *rendered*.\n */\n const pendingPresentChildren = useRef(presentChildren);\n /**\n * Track which exiting children have finished animating out.\n */\n const exitComplete = useConstant(() => new Map());\n /**\n * Save children to render as React state. To ensure this component is concurrent-safe,\n * we check for exiting children via an effect.\n */\n const [diffedChildren, setDiffedChildren] = useState(presentChildren);\n const [renderedChildren, setRenderedChildren] = useState(presentChildren);\n useIsomorphicLayoutEffect(() => {\n isInitialRender.current = false;\n pendingPresentChildren.current = presentChildren;\n /**\n * Update complete status of exiting children.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const key = getChildKey(renderedChildren[i]);\n if (!presentKeys.includes(key)) {\n if (exitComplete.get(key) !== true) {\n exitComplete.set(key, false);\n }\n }\n else {\n exitComplete.delete(key);\n }\n }\n }, [renderedChildren, presentKeys.length, presentKeys.join(\"-\")]);\n const exitingChildren = [];\n if (presentChildren !== diffedChildren) {\n let nextChildren = [...presentChildren];\n /**\n * Loop through all the currently rendered components and decide which\n * are exiting.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const child = renderedChildren[i];\n const key = getChildKey(child);\n if (!presentKeys.includes(key)) {\n nextChildren.splice(i, 0, child);\n exitingChildren.push(child);\n }\n }\n /**\n * If we're in \"wait\" mode, and we have exiting children, we want to\n * only render these until they've all exited.\n */\n if (mode === \"wait\" && exitingChildren.length) {\n nextChildren = exitingChildren;\n }\n setRenderedChildren(onlyElements(nextChildren));\n setDiffedChildren(presentChildren);\n /**\n * Early return to ensure once we've set state with the latest diffed\n * children, we can immediately re-render.\n */\n return null;\n }\n if (process.env.NODE_ENV !== \"production\" &&\n mode === \"wait\" &&\n renderedChildren.length > 1) {\n console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to \"wait\". This will lead to odd visual behaviour.`);\n }\n /**\n * If we've been provided a forceRender function by the LayoutGroupContext,\n * we can use it to force a re-render amongst all surrounding components once\n * all components have finished animating out.\n */\n const { forceRender } = useContext(LayoutGroupContext);\n return (jsx(Fragment, { children: renderedChildren.map((child) => {\n const key = getChildKey(child);\n const isPresent = propagate && !isParentPresent\n ? false\n : presentChildren === renderedChildren ||\n presentKeys.includes(key);\n const onExit = () => {\n if (exitComplete.has(key)) {\n exitComplete.set(key, true);\n }\n else {\n return;\n }\n let isEveryExitComplete = true;\n exitComplete.forEach((isExitComplete) => {\n if (!isExitComplete)\n isEveryExitComplete = false;\n });\n if (isEveryExitComplete) {\n forceRender?.();\n setRenderedChildren(pendingPresentChildren.current);\n propagate && safeToRemove?.();\n onExitComplete && onExitComplete();\n }\n };\n return (jsx(PresenceChild, { isPresent: isPresent, initial: !isInitialRender.current || initial\n ? undefined\n : false, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode, onExitComplete: isPresent ? undefined : onExit, anchorX: anchorX, children: child }, key));\n }) }));\n};\n\nexport { AnimatePresence };\n"],"names":["AnimatePresence","children","custom","initial","onExitComplete","presenceAffectsLayout","mode","propagate","anchorX","isParentPresent","safeToRemove","usePresence","presentChildren","useMemo","onlyElements","presentKeys","getChildKey","isInitialRender","useRef","pendingPresentChildren","exitComplete","useConstant","diffedChildren","setDiffedChildren","useState","renderedChildren","setRenderedChildren","useIsomorphicLayoutEffect","i","key","exitingChildren","nextChildren","child","forceRender","useContext","LayoutGroupContext","jsx","Fragment","isPresent","onExit","isEveryExitComplete","isExitComplete","PresenceChild"],"mappings":";;;;;;;;AA2CK,MAACA,IAAkB,CAAC,EAAE,UAAAC,GAAU,QAAAC,GAAQ,SAAAC,IAAU,IAAM,gBAAAC,GAAgB,uBAAAC,IAAwB,IAAM,MAAAC,IAAO,QAAQ,WAAAC,IAAY,IAAO,SAAAC,IAAU,aAAc;AACjK,QAAM,CAACC,GAAiBC,CAAY,IAAIC,EAAYJ,CAAS,GAKvDK,IAAkBC,EAAQ,MAAMC,EAAab,CAAQ,GAAG,CAACA,CAAQ,CAAC,GAKlEc,IAAcR,KAAa,CAACE,IAAkB,CAAA,IAAKG,EAAgB,IAAII,CAAW,GAIlFC,IAAkBC,EAAO,EAAI,GAM7BC,IAAyBD,EAAON,CAAe,GAI/CQ,IAAeC,EAAY,MAAM,oBAAI,IAAG,CAAE,GAK1C,CAACC,GAAgBC,CAAiB,IAAIC,EAASZ,CAAe,GAC9D,CAACa,GAAkBC,CAAmB,IAAIF,EAASZ,CAAe;AACxE,EAAAe,EAA0B,MAAM;AAC5B,IAAAV,EAAgB,UAAU,IAC1BE,EAAuB,UAAUP;AAIjC,aAASgB,IAAI,GAAGA,IAAIH,EAAiB,QAAQG,KAAK;AAC9C,YAAMC,IAAMb,EAAYS,EAAiBG,CAAC,CAAC;AAC3C,MAAKb,EAAY,SAASc,CAAG,IAMzBT,EAAa,OAAOS,CAAG,IALnBT,EAAa,IAAIS,CAAG,MAAM,MAC1BT,EAAa,IAAIS,GAAK,EAAK;AAAA,IAM/C;AAAA,EACA,GAAO,CAACJ,GAAkBV,EAAY,QAAQA,EAAY,KAAK,GAAG,CAAC,CAAC;AAChE,QAAMe,IAAkB,CAAE;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gC,IAAY,SAAYC,GAAQ,SAAS/B,GAAS,UAAUwB,EAAO,GAAEH,CAAG;AAAA,EACtL,CAAA,GAAG;AACZ;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Children as o, isValidElement as r } from "react";
|
|
2
|
+
const l = (e) => e.key || "";
|
|
3
|
+
function f(e) {
|
|
4
|
+
const t = [];
|
|
5
|
+
return o.forEach(e, (n) => {
|
|
6
|
+
r(n) && t.push(n);
|
|
7
|
+
}), t;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
l as getChildKey,
|
|
11
|
+
f as onlyElements
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../../../../../../../../../../node_modules/.pnpm/motion@12.17.3_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/utils.mjs"],"sourcesContent":["import { Children, isValidElement } from 'react';\n\nconst getChildKey = (child) => child.key || \"\";\nfunction onlyElements(children) {\n const filtered = [];\n // We use forEach here instead of map as map mutates the component key by preprending `.$`\n Children.forEach(children, (child) => {\n if (isValidElement(child))\n filtered.push(child);\n });\n return filtered;\n}\n\nexport { getChildKey, onlyElements };\n"],"names":["getChildKey","child","onlyElements","children","filtered","Children","isValidElement"],"mappings":";AAEK,MAACA,IAAc,CAACC,MAAUA,EAAM,OAAO;AAC5C,SAASC,EAAaC,GAAU;AAC5B,QAAMC,IAAW,CAAE;AAEnB,SAAAC,EAAS,QAAQF,GAAU,CAACF,MAAU;AAClC,IAAIK,EAAeL,CAAK,KACpBG,EAAS,KAAKH,CAAK;AAAA,EAC/B,CAAK,GACMG;AACX;","x_google_ignoreList":[0]}
|
|
@@ -2,7 +2,7 @@ import L from "../../../../@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-ut
|
|
|
2
2
|
import T from "../../../../../../../_virtual/window.js";
|
|
3
3
|
import { forEachMediaGroup as Z } from "../../../../@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/media-groups.js";
|
|
4
4
|
import J from "../../../../@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js";
|
|
5
|
-
import { l as Q } from "../../../../../../../_virtual/
|
|
5
|
+
import { l as Q } from "../../../../../../../_virtual/index6.js";
|
|
6
6
|
/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */
|
|
7
7
|
const w = (e) => !!e && typeof e == "object", E = (...e) => e.reduce((n, t) => (typeof t != "object" || Object.keys(t).forEach((r) => {
|
|
8
8
|
Array.isArray(n[r]) && Array.isArray(t[r]) ? n[r] = n[r].concat(t[r]) : w(n[r]) && w(t[r]) ? n[r] = E(n[r], t[r]) : n[r] = t[r];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as r } from "../../../../../../../_virtual/
|
|
1
|
+
import { __module as r } from "../../../../../../../_virtual/index11.js";
|
|
2
2
|
import { __require as o } from "../cjs/use-sync-external-store-shim.production.js";
|
|
3
3
|
import { __require as i } from "../cjs/use-sync-external-store-shim.development.js";
|
|
4
4
|
var e;
|