@shopify/shop-minis-react 0.0.17 → 0.0.19
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/index3.js +6 -0
- package/dist/_virtual/index3.js.map +1 -0
- package/dist/_virtual/index4.js +5 -0
- package/dist/_virtual/index4.js.map +1 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js +5 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js.map +1 -0
- package/dist/_virtual/use-sync-external-store-shim.production.js +5 -0
- package/dist/_virtual/use-sync-external-store-shim.production.js.map +1 -0
- package/dist/components/atoms/alert-dialog.js +41 -0
- package/dist/components/atoms/alert-dialog.js.map +1 -0
- package/dist/components/atoms/thumbhash-image.js +54 -0
- package/dist/components/atoms/thumbhash-image.js.map +1 -0
- package/dist/components/commerce/merchant-card-skeleton.js +29 -0
- package/dist/components/commerce/merchant-card-skeleton.js.map +1 -0
- package/dist/components/commerce/merchant-card.js +28 -22
- package/dist/components/commerce/merchant-card.js.map +1 -1
- package/dist/components/commerce/product-card-skeleton.js +20 -0
- package/dist/components/commerce/product-card-skeleton.js.map +1 -0
- package/dist/components/commerce/product-card.js +105 -78
- package/dist/components/commerce/product-card.js.map +1 -1
- package/dist/components/navigation/transition-container.js +8 -0
- package/dist/components/navigation/transition-container.js.map +1 -0
- package/dist/components/navigation/transition-link.js +27 -0
- package/dist/components/navigation/transition-link.js.map +1 -0
- package/dist/components/ui/avatar.js +54 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/skeleton.js +16 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/hooks/navigation/useNavigateWithTransition.js +43 -0
- package/dist/hooks/navigation/useNavigateWithTransition.js.map +1 -0
- package/dist/hooks/navigation/useViewTransitions.js +45 -0
- package/dist/hooks/navigation/useViewTransitions.js.map +1 -0
- package/dist/index.js +215 -192
- package/dist/index.js.map +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/@radix-ui_react-avatar@1.1.10_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1._hkz57sehyui4ndfh3rsqwxftli/node_modules/@radix-ui/react-avatar/dist/index.js +77 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@radix-ui_react-avatar@1.1.10_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1._hkz57sehyui4ndfh3rsqwxftli/node_modules/@radix-ui/react-avatar/dist/index.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 +16 -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.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/js-base64@3.7.7/node_modules/js-base64/base64.js +21 -0
- package/dist/shop-minis-react/node_modules/.pnpm/js-base64@3.7.7/node_modules/js-base64/base64.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/react-router@7.7.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-router/dist/development/chunk-EF7DTUVF.js +1298 -0
- package/dist/shop-minis-react/node_modules/.pnpm/react-router@7.7.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-router/dist/development/chunk-EF7DTUVF.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js +145 -0
- package/dist/shop-minis-react/node_modules/.pnpm/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js.map +1 -0
- 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/cjs/use-sync-external-store-shim.development.js +68 -0
- 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/cjs/use-sync-external-store-shim.development.js.map +1 -0
- 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/cjs/use-sync-external-store-shim.production.js +56 -0
- 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/cjs/use-sync-external-store-shim.production.js.map +1 -0
- 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 +11 -0
- 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.map +1 -0
- package/dist/types/index.js +10 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/image.js +15 -0
- package/dist/utils/image.js.map +1 -0
- package/package.json +13 -3
- package/src/components/atoms/alert-dialog.tsx +67 -0
- package/src/components/atoms/thumbhash-image.tsx +66 -0
- package/src/components/commerce/merchant-card-skeleton.tsx +31 -0
- package/src/components/commerce/merchant-card.tsx +5 -2
- package/src/components/commerce/product-card-skeleton.tsx +30 -0
- package/src/components/commerce/product-card.tsx +49 -8
- package/src/components/index.ts +9 -0
- package/src/components/navigation/transition-container.tsx +7 -0
- package/src/components/navigation/transition-link.tsx +48 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/navigation/useNavigateWithTransition.ts +62 -0
- package/src/hooks/navigation/useViewTransitions.ts +79 -0
- package/src/index.css +1 -0
- package/src/mocks.ts +8 -2
- package/src/stories/Accordion.stories.tsx +124 -0
- package/src/stories/Alert.stories.tsx +38 -0
- package/src/stories/AlertDialog.stories.tsx +48 -0
- package/src/stories/Avatar.stories.tsx +29 -0
- package/src/stories/Badge.stories.tsx +46 -0
- package/src/stories/Button.stories.tsx +81 -0
- package/src/stories/Card.stories.tsx +40 -0
- package/src/stories/Checkbox.stories.tsx +44 -0
- package/src/stories/FavoriteButton.stories.tsx +58 -0
- package/src/stories/IconButton.stories.tsx +68 -0
- package/src/stories/Input.stories.tsx +44 -0
- package/src/stories/Label.stories.tsx +19 -0
- package/src/stories/MerchantCard.stories.tsx +55 -0
- package/src/stories/ProductCard.stories.tsx +85 -0
- package/src/stories/ProductLink.stories.tsx +46 -0
- package/src/stories/Progress.stories.tsx +30 -0
- package/src/stories/RadioGroup.stories.tsx +51 -0
- package/src/stories/Select.stories.tsx +85 -0
- package/src/stories/Skeleton.stories.tsx +19 -0
- package/src/stories/Toaster.stories.tsx +46 -0
- package/src/stories/Touchable.stories.tsx +40 -0
- package/src/styles/animations.css +90 -0
- package/src/styles/globals.css +8 -0
- package/src/styles/theme.css +1 -1
- package/src/types/index.ts +7 -1
- package/src/utils/image.ts +18 -0
package/dist/shop-minis-react/node_modules/.pnpm/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
function W(t) {
|
|
2
|
+
let { PI: r, min: p, max: l, cos: u, round: c } = Math, _ = t[0] | t[1] << 8 | t[2] << 16, n = t[3] | t[4] << 8, s = (_ & 63) / 63, y = (_ >> 6 & 63) / 31.5 - 1, i = (_ >> 12 & 63) / 31.5 - 1, a = (_ >> 18 & 31) / 31, o = _ >> 23, v = (n >> 3 & 63) / 63, z = (n >> 9 & 63) / 63, G = n >> 15, B = l(3, G ? o ? 5 : 7 : n & 7), A = l(3, G ? n & 7 : o ? 5 : 7), E = o ? (t[5] & 15) / 15 : 1, F = (t[5] >> 4) / 15, J = o ? 6 : 5, I = 0, j = (L, x, R) => {
|
|
3
|
+
let m = [];
|
|
4
|
+
for (let b = 0; b < x; b++)
|
|
5
|
+
for (let g = b ? 0 : 1; g * x < L * (x - b); g++)
|
|
6
|
+
m.push(((t[J + (I >> 1)] >> ((I++ & 1) << 2) & 15) / 7.5 - 1) * R);
|
|
7
|
+
return m;
|
|
8
|
+
}, K = j(B, A, a), N = j(3, 3, v * 1.25), O = j(3, 3, z * 1.25), Q = o && j(5, 5, F), C = X(t), H = c(C > 1 ? 32 : 32 * C), U = c(C > 1 ? 32 / C : 32), q = new Uint8Array(H * U * 4), w = [], D = [];
|
|
9
|
+
for (let L = 0, x = 0; L < U; L++)
|
|
10
|
+
for (let R = 0; R < H; R++, x += 4) {
|
|
11
|
+
let m = s, b = y, g = i, M = E;
|
|
12
|
+
for (let e = 0, f = l(B, o ? 5 : 3); e < f; e++)
|
|
13
|
+
w[e] = u(r / H * (R + 0.5) * e);
|
|
14
|
+
for (let e = 0, f = l(A, o ? 5 : 3); e < f; e++)
|
|
15
|
+
D[e] = u(r / U * (L + 0.5) * e);
|
|
16
|
+
for (let e = 0, f = 0; e < A; e++)
|
|
17
|
+
for (let d = e ? 0 : 1, T = D[e] * 2; d * A < B * (A - e); d++, f++)
|
|
18
|
+
m += K[f] * w[d] * T;
|
|
19
|
+
for (let e = 0, f = 0; e < 3; e++)
|
|
20
|
+
for (let d = e ? 0 : 1, T = D[e] * 2; d < 3 - e; d++, f++) {
|
|
21
|
+
let k = w[d] * T;
|
|
22
|
+
b += N[f] * k, g += O[f] * k;
|
|
23
|
+
}
|
|
24
|
+
if (o)
|
|
25
|
+
for (let e = 0, f = 0; e < 5; e++)
|
|
26
|
+
for (let d = e ? 0 : 1, T = D[e] * 2; d < 5 - e; d++, f++)
|
|
27
|
+
M += Q[f] * w[d] * T;
|
|
28
|
+
let P = m - 2 / 3 * b, S = (3 * m - P + g) / 2, V = S - g;
|
|
29
|
+
q[x] = l(0, 255 * p(1, S)), q[x + 1] = l(0, 255 * p(1, V)), q[x + 2] = l(0, 255 * p(1, P)), q[x + 3] = l(0, 255 * p(1, M));
|
|
30
|
+
}
|
|
31
|
+
return { w: H, h: U, rgba: q };
|
|
32
|
+
}
|
|
33
|
+
function X(t) {
|
|
34
|
+
let r = t[3], p = t[2] & 128, l = t[4] & 128, u = l ? p ? 5 : 7 : r & 7, c = l ? r & 7 : p ? 5 : 7;
|
|
35
|
+
return u / c;
|
|
36
|
+
}
|
|
37
|
+
function Y(t, r, p) {
|
|
38
|
+
let l = t * 4 + 1, u = 6 + r * (5 + l), c = [
|
|
39
|
+
137,
|
|
40
|
+
80,
|
|
41
|
+
78,
|
|
42
|
+
71,
|
|
43
|
+
13,
|
|
44
|
+
10,
|
|
45
|
+
26,
|
|
46
|
+
10,
|
|
47
|
+
0,
|
|
48
|
+
0,
|
|
49
|
+
0,
|
|
50
|
+
13,
|
|
51
|
+
73,
|
|
52
|
+
72,
|
|
53
|
+
68,
|
|
54
|
+
82,
|
|
55
|
+
0,
|
|
56
|
+
0,
|
|
57
|
+
t >> 8,
|
|
58
|
+
t & 255,
|
|
59
|
+
0,
|
|
60
|
+
0,
|
|
61
|
+
r >> 8,
|
|
62
|
+
r & 255,
|
|
63
|
+
8,
|
|
64
|
+
6,
|
|
65
|
+
0,
|
|
66
|
+
0,
|
|
67
|
+
0,
|
|
68
|
+
0,
|
|
69
|
+
0,
|
|
70
|
+
0,
|
|
71
|
+
0,
|
|
72
|
+
u >>> 24,
|
|
73
|
+
u >> 16 & 255,
|
|
74
|
+
u >> 8 & 255,
|
|
75
|
+
u & 255,
|
|
76
|
+
73,
|
|
77
|
+
68,
|
|
78
|
+
65,
|
|
79
|
+
84,
|
|
80
|
+
120,
|
|
81
|
+
1
|
|
82
|
+
], _ = [
|
|
83
|
+
0,
|
|
84
|
+
498536548,
|
|
85
|
+
997073096,
|
|
86
|
+
651767980,
|
|
87
|
+
1994146192,
|
|
88
|
+
1802195444,
|
|
89
|
+
1303535960,
|
|
90
|
+
1342533948,
|
|
91
|
+
-306674912,
|
|
92
|
+
-267414716,
|
|
93
|
+
-690576408,
|
|
94
|
+
-882789492,
|
|
95
|
+
-1687895376,
|
|
96
|
+
-2032938284,
|
|
97
|
+
-1609899400,
|
|
98
|
+
-1111625188
|
|
99
|
+
], n = 1, s = 0;
|
|
100
|
+
for (let y = 0, i = 0, a = l - 1; y < r; y++, a += l - 1)
|
|
101
|
+
for (c.push(y + 1 < r ? 0 : 1, l & 255, l >> 8, ~l & 255, l >> 8 ^ 255, 0), s = (s + n) % 65521; i < a; i++) {
|
|
102
|
+
let o = p[i] & 255;
|
|
103
|
+
c.push(o), n = (n + o) % 65521, s = (s + n) % 65521;
|
|
104
|
+
}
|
|
105
|
+
c.push(
|
|
106
|
+
s >> 8,
|
|
107
|
+
s & 255,
|
|
108
|
+
n >> 8,
|
|
109
|
+
n & 255,
|
|
110
|
+
0,
|
|
111
|
+
0,
|
|
112
|
+
0,
|
|
113
|
+
0,
|
|
114
|
+
0,
|
|
115
|
+
0,
|
|
116
|
+
0,
|
|
117
|
+
0,
|
|
118
|
+
73,
|
|
119
|
+
69,
|
|
120
|
+
78,
|
|
121
|
+
68,
|
|
122
|
+
174,
|
|
123
|
+
66,
|
|
124
|
+
96,
|
|
125
|
+
130
|
|
126
|
+
);
|
|
127
|
+
for (let [y, i] of [[12, 29], [37, 41 + u]]) {
|
|
128
|
+
let a = -1;
|
|
129
|
+
for (let o = y; o < i; o++)
|
|
130
|
+
a ^= c[o], a = a >>> 4 ^ _[a & 15], a = a >>> 4 ^ _[a & 15];
|
|
131
|
+
a = ~a, c[i++] = a >>> 24, c[i++] = a >> 16 & 255, c[i++] = a >> 8 & 255, c[i++] = a & 255;
|
|
132
|
+
}
|
|
133
|
+
return "data:image/png;base64," + btoa(String.fromCharCode(...c));
|
|
134
|
+
}
|
|
135
|
+
function Z(t) {
|
|
136
|
+
let r = W(t);
|
|
137
|
+
return Y(r.w, r.h, r.rgba);
|
|
138
|
+
}
|
|
139
|
+
export {
|
|
140
|
+
Y as rgbaToDataURL,
|
|
141
|
+
X as thumbHashToApproximateAspectRatio,
|
|
142
|
+
Z as thumbHashToDataURL,
|
|
143
|
+
W as thumbHashToRGBA
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=thumbhash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thumbhash.js","sources":["../../../../../../../node_modules/.pnpm/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js"],"sourcesContent":["/**\n * Encodes an RGBA image to a ThumbHash. RGB should not be premultiplied by A.\n *\n * @param w The width of the input image. Must be ≤100px.\n * @param h The height of the input image. Must be ≤100px.\n * @param rgba The pixels in the input image, row-by-row. Must have w*h*4 elements.\n * @returns The ThumbHash as a Uint8Array.\n */\nexport function rgbaToThumbHash(w, h, rgba) {\n // Encoding an image larger than 100x100 is slow with no benefit\n if (w > 100 || h > 100) throw new Error(`${w}x${h} doesn't fit in 100x100`)\n let { PI, round, max, cos, abs } = Math\n\n // Determine the average color\n let avg_r = 0, avg_g = 0, avg_b = 0, avg_a = 0\n for (let i = 0, j = 0; i < w * h; i++, j += 4) {\n let alpha = rgba[j + 3] / 255\n avg_r += alpha / 255 * rgba[j]\n avg_g += alpha / 255 * rgba[j + 1]\n avg_b += alpha / 255 * rgba[j + 2]\n avg_a += alpha\n }\n if (avg_a) {\n avg_r /= avg_a\n avg_g /= avg_a\n avg_b /= avg_a\n }\n\n let hasAlpha = avg_a < w * h\n let l_limit = hasAlpha ? 5 : 7 // Use fewer luminance bits if there's alpha\n let lx = max(1, round(l_limit * w / max(w, h)))\n let ly = max(1, round(l_limit * h / max(w, h)))\n let l = [] // luminance\n let p = [] // yellow - blue\n let q = [] // red - green\n let a = [] // alpha\n\n // Convert the image from RGBA to LPQA (composite atop the average color)\n for (let i = 0, j = 0; i < w * h; i++, j += 4) {\n let alpha = rgba[j + 3] / 255\n let r = avg_r * (1 - alpha) + alpha / 255 * rgba[j]\n let g = avg_g * (1 - alpha) + alpha / 255 * rgba[j + 1]\n let b = avg_b * (1 - alpha) + alpha / 255 * rgba[j + 2]\n l[i] = (r + g + b) / 3\n p[i] = (r + g) / 2 - b\n q[i] = r - g\n a[i] = alpha\n }\n\n // Encode using the DCT into DC (constant) and normalized AC (varying) terms\n let encodeChannel = (channel, nx, ny) => {\n let dc = 0, ac = [], scale = 0, fx = []\n for (let cy = 0; cy < ny; cy++) {\n for (let cx = 0; cx * ny < nx * (ny - cy); cx++) {\n let f = 0\n for (let x = 0; x < w; x++)\n fx[x] = cos(PI / w * cx * (x + 0.5))\n for (let y = 0; y < h; y++)\n for (let x = 0, fy = cos(PI / h * cy * (y + 0.5)); x < w; x++)\n f += channel[x + y * w] * fx[x] * fy\n f /= w * h\n if (cx || cy) {\n ac.push(f)\n scale = max(scale, abs(f))\n } else {\n dc = f\n }\n }\n }\n if (scale)\n for (let i = 0; i < ac.length; i++)\n ac[i] = 0.5 + 0.5 / scale * ac[i]\n return [dc, ac, scale]\n }\n let [l_dc, l_ac, l_scale] = encodeChannel(l, max(3, lx), max(3, ly))\n let [p_dc, p_ac, p_scale] = encodeChannel(p, 3, 3)\n let [q_dc, q_ac, q_scale] = encodeChannel(q, 3, 3)\n let [a_dc, a_ac, a_scale] = hasAlpha ? encodeChannel(a, 5, 5) : []\n\n // Write the constants\n let isLandscape = w > h\n let header24 = round(63 * l_dc) | (round(31.5 + 31.5 * p_dc) << 6) | (round(31.5 + 31.5 * q_dc) << 12) | (round(31 * l_scale) << 18) | (hasAlpha << 23)\n let header16 = (isLandscape ? ly : lx) | (round(63 * p_scale) << 3) | (round(63 * q_scale) << 9) | (isLandscape << 15)\n let hash = [header24 & 255, (header24 >> 8) & 255, header24 >> 16, header16 & 255, header16 >> 8]\n let ac_start = hasAlpha ? 6 : 5\n let ac_index = 0\n if (hasAlpha) hash.push(round(15 * a_dc) | (round(15 * a_scale) << 4))\n\n // Write the varying factors\n for (let ac of hasAlpha ? [l_ac, p_ac, q_ac, a_ac] : [l_ac, p_ac, q_ac])\n for (let f of ac)\n hash[ac_start + (ac_index >> 1)] |= round(15 * f) << ((ac_index++ & 1) << 2)\n return new Uint8Array(hash)\n}\n\n/**\n * Decodes a ThumbHash to an RGBA image. RGB is not be premultiplied by A.\n *\n * @param hash The bytes of the ThumbHash.\n * @returns The width, height, and pixels of the rendered placeholder image.\n */\nexport function thumbHashToRGBA(hash) {\n let { PI, min, max, cos, round } = Math\n\n // Read the constants\n let header24 = hash[0] | (hash[1] << 8) | (hash[2] << 16)\n let header16 = hash[3] | (hash[4] << 8)\n let l_dc = (header24 & 63) / 63\n let p_dc = ((header24 >> 6) & 63) / 31.5 - 1\n let q_dc = ((header24 >> 12) & 63) / 31.5 - 1\n let l_scale = ((header24 >> 18) & 31) / 31\n let hasAlpha = header24 >> 23\n let p_scale = ((header16 >> 3) & 63) / 63\n let q_scale = ((header16 >> 9) & 63) / 63\n let isLandscape = header16 >> 15\n let lx = max(3, isLandscape ? hasAlpha ? 5 : 7 : header16 & 7)\n let ly = max(3, isLandscape ? header16 & 7 : hasAlpha ? 5 : 7)\n let a_dc = hasAlpha ? (hash[5] & 15) / 15 : 1\n let a_scale = (hash[5] >> 4) / 15\n\n // Read the varying factors (boost saturation by 1.25x to compensate for quantization)\n let ac_start = hasAlpha ? 6 : 5\n let ac_index = 0\n let decodeChannel = (nx, ny, scale) => {\n let ac = []\n for (let cy = 0; cy < ny; cy++)\n for (let cx = cy ? 0 : 1; cx * ny < nx * (ny - cy); cx++)\n ac.push((((hash[ac_start + (ac_index >> 1)] >> ((ac_index++ & 1) << 2)) & 15) / 7.5 - 1) * scale)\n return ac\n }\n let l_ac = decodeChannel(lx, ly, l_scale)\n let p_ac = decodeChannel(3, 3, p_scale * 1.25)\n let q_ac = decodeChannel(3, 3, q_scale * 1.25)\n let a_ac = hasAlpha && decodeChannel(5, 5, a_scale)\n\n // Decode using the DCT into RGB\n let ratio = thumbHashToApproximateAspectRatio(hash)\n let w = round(ratio > 1 ? 32 : 32 * ratio)\n let h = round(ratio > 1 ? 32 / ratio : 32)\n let rgba = new Uint8Array(w * h * 4), fx = [], fy = []\n for (let y = 0, i = 0; y < h; y++) {\n for (let x = 0; x < w; x++, i += 4) {\n let l = l_dc, p = p_dc, q = q_dc, a = a_dc\n\n // Precompute the coefficients\n for (let cx = 0, n = max(lx, hasAlpha ? 5 : 3); cx < n; cx++)\n fx[cx] = cos(PI / w * (x + 0.5) * cx)\n for (let cy = 0, n = max(ly, hasAlpha ? 5 : 3); cy < n; cy++)\n fy[cy] = cos(PI / h * (y + 0.5) * cy)\n\n // Decode L\n for (let cy = 0, j = 0; cy < ly; cy++)\n for (let cx = cy ? 0 : 1, fy2 = fy[cy] * 2; cx * ly < lx * (ly - cy); cx++, j++)\n l += l_ac[j] * fx[cx] * fy2\n\n // Decode P and Q\n for (let cy = 0, j = 0; cy < 3; cy++) {\n for (let cx = cy ? 0 : 1, fy2 = fy[cy] * 2; cx < 3 - cy; cx++, j++) {\n let f = fx[cx] * fy2\n p += p_ac[j] * f\n q += q_ac[j] * f\n }\n }\n\n // Decode A\n if (hasAlpha)\n for (let cy = 0, j = 0; cy < 5; cy++)\n for (let cx = cy ? 0 : 1, fy2 = fy[cy] * 2; cx < 5 - cy; cx++, j++)\n a += a_ac[j] * fx[cx] * fy2\n\n // Convert to RGB\n let b = l - 2 / 3 * p\n let r = (3 * l - b + q) / 2\n let g = r - q\n rgba[i] = max(0, 255 * min(1, r))\n rgba[i + 1] = max(0, 255 * min(1, g))\n rgba[i + 2] = max(0, 255 * min(1, b))\n rgba[i + 3] = max(0, 255 * min(1, a))\n }\n }\n return { w, h, rgba }\n}\n\n/**\n * Extracts the average color from a ThumbHash. RGB is not be premultiplied by A.\n *\n * @param hash The bytes of the ThumbHash.\n * @returns The RGBA values for the average color. Each value ranges from 0 to 1.\n */\nexport function thumbHashToAverageRGBA(hash) {\n let { min, max } = Math\n let header = hash[0] | (hash[1] << 8) | (hash[2] << 16)\n let l = (header & 63) / 63\n let p = ((header >> 6) & 63) / 31.5 - 1\n let q = ((header >> 12) & 63) / 31.5 - 1\n let hasAlpha = header >> 23\n let a = hasAlpha ? (hash[5] & 15) / 15 : 1\n let b = l - 2 / 3 * p\n let r = (3 * l - b + q) / 2\n let g = r - q\n return {\n r: max(0, min(1, r)),\n g: max(0, min(1, g)),\n b: max(0, min(1, b)),\n a\n }\n}\n\n/**\n * Extracts the approximate aspect ratio of the original image.\n *\n * @param hash The bytes of the ThumbHash.\n * @returns The approximate aspect ratio (i.e. width / height).\n */\nexport function thumbHashToApproximateAspectRatio(hash) {\n let header = hash[3]\n let hasAlpha = hash[2] & 0x80\n let isLandscape = hash[4] & 0x80\n let lx = isLandscape ? hasAlpha ? 5 : 7 : header & 7\n let ly = isLandscape ? header & 7 : hasAlpha ? 5 : 7\n return lx / ly\n}\n\n/**\n * Encodes an RGBA image to a PNG data URL. RGB should not be premultiplied by\n * A. This is optimized for speed and simplicity and does not optimize for size\n * at all. This doesn't do any compression (all values are stored uncompressed).\n *\n * @param w The width of the input image. Must be ≤100px.\n * @param h The height of the input image. Must be ≤100px.\n * @param rgba The pixels in the input image, row-by-row. Must have w*h*4 elements.\n * @returns A data URL containing a PNG for the input image.\n */\nexport function rgbaToDataURL(w, h, rgba) {\n let row = w * 4 + 1\n let idat = 6 + h * (5 + row)\n let bytes = [\n 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0,\n w >> 8, w & 255, 0, 0, h >> 8, h & 255, 8, 6, 0, 0, 0, 0, 0, 0, 0,\n idat >>> 24, (idat >> 16) & 255, (idat >> 8) & 255, idat & 255,\n 73, 68, 65, 84, 120, 1\n ]\n let table = [\n 0, 498536548, 997073096, 651767980, 1994146192, 1802195444, 1303535960,\n 1342533948, -306674912, -267414716, -690576408, -882789492, -1687895376,\n -2032938284, -1609899400, -1111625188\n ]\n let a = 1, b = 0\n for (let y = 0, i = 0, end = row - 1; y < h; y++, end += row - 1) {\n bytes.push(y + 1 < h ? 0 : 1, row & 255, row >> 8, ~row & 255, (row >> 8) ^ 255, 0)\n for (b = (b + a) % 65521; i < end; i++) {\n let u = rgba[i] & 255\n bytes.push(u)\n a = (a + u) % 65521\n b = (b + a) % 65521\n }\n }\n bytes.push(\n b >> 8, b & 255, a >> 8, a & 255, 0, 0, 0, 0,\n 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130\n )\n for (let [start, end] of [[12, 29], [37, 41 + idat]]) {\n let c = ~0\n for (let i = start; i < end; i++) {\n c ^= bytes[i]\n c = (c >>> 4) ^ table[c & 15]\n c = (c >>> 4) ^ table[c & 15]\n }\n c = ~c\n bytes[end++] = c >>> 24\n bytes[end++] = (c >> 16) & 255\n bytes[end++] = (c >> 8) & 255\n bytes[end++] = c & 255\n }\n return 'data:image/png;base64,' + btoa(String.fromCharCode(...bytes))\n}\n\n/**\n * Decodes a ThumbHash to a PNG data URL. This is a convenience function that\n * just calls \"thumbHashToRGBA\" followed by \"rgbaToDataURL\".\n *\n * @param hash The bytes of the ThumbHash.\n * @returns A data URL containing a PNG for the rendered ThumbHash.\n */\nexport function thumbHashToDataURL(hash) {\n let image = thumbHashToRGBA(hash)\n return rgbaToDataURL(image.w, image.h, image.rgba)\n}\n"],"names":["thumbHashToRGBA","hash","PI","min","max","cos","round","header24","header16","l_dc","p_dc","q_dc","l_scale","hasAlpha","p_scale","q_scale","isLandscape","lx","ly","a_dc","a_scale","ac_start","ac_index","decodeChannel","nx","ny","scale","ac","cy","cx","l_ac","p_ac","q_ac","a_ac","ratio","thumbHashToApproximateAspectRatio","w","h","rgba","fx","fy","y","i","x","l","p","q","a","n","j","fy2","f","b","r","g","header","rgbaToDataURL","row","idat","bytes","table","end","u","start","c","thumbHashToDataURL","image"],"mappings":"AAqGO,SAASA,EAAgBC,GAAM;AACpC,MAAI,EAAE,IAAAC,GAAI,KAAAC,GAAK,KAAAC,GAAK,KAAAC,GAAK,OAAAC,EAAK,IAAK,MAG/BC,IAAWN,EAAK,CAAC,IAAKA,EAAK,CAAC,KAAK,IAAMA,EAAK,CAAC,KAAK,IAClDO,IAAWP,EAAK,CAAC,IAAKA,EAAK,CAAC,KAAK,GACjCQ,KAAQF,IAAW,MAAM,IACzBG,KAASH,KAAY,IAAK,MAAM,OAAO,GACvCI,KAASJ,KAAY,KAAM,MAAM,OAAO,GACxCK,KAAYL,KAAY,KAAM,MAAM,IACpCM,IAAWN,KAAY,IACv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AG;AACpD,QAAIM,IAAI;AACR,aAAStB,IAAIqB,GAAOrB,IAAImB,GAAKnB;AAC3B,MAAAsB,KAAKL,EAAMjB,CAAC,GACZsB,IAAKA,MAAM,IAAKJ,EAAMI,IAAI,EAAE,GAC5BA,IAAKA,MAAM,IAAKJ,EAAMI,IAAI,EAAE;AAE9B,IAAAA,IAAI,CAACA,GACLL,EAAME,GAAK,IAAIG,MAAM,IACrBL,EAAME,GAAK,IAAKG,KAAK,KAAM,KAC3BL,EAAME,GAAK,IAAKG,KAAK,IAAK,KAC1BL,EAAME,GAAK,IAAIG,IAAI;AAAA,EACvB;AACE,SAAO,2BAA2B,KAAK,OAAO,aAAa,GAAGL,CAAK,CAAC;AACtE;AASO,SAASM,EAAmBhE,GAAM;AACvC,MAAIiE,IAAQlE,EAAgBC,CAAI;AAChC,SAAOuD,EAAcU,EAAM,GAAGA,EAAM,GAAGA,EAAM,IAAI;AACnD;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { __exports as s } from "../../../../../../../_virtual/use-sync-external-store-shim.development.js";
|
|
2
|
+
import h from "react";
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
5
|
+
* use-sync-external-store-shim.development.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
var l;
|
|
13
|
+
function A() {
|
|
14
|
+
return l ? s : (l = 1, process.env.NODE_ENV !== "production" && function() {
|
|
15
|
+
function d(e, t) {
|
|
16
|
+
return e === t && (e !== 0 || 1 / e === 1 / t) || e !== e && t !== t;
|
|
17
|
+
}
|
|
18
|
+
function S(e, t) {
|
|
19
|
+
f || o.startTransition === void 0 || (f = !0, console.error(
|
|
20
|
+
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
21
|
+
));
|
|
22
|
+
var r = t();
|
|
23
|
+
if (!c) {
|
|
24
|
+
var u = t();
|
|
25
|
+
_(r, u) || (console.error(
|
|
26
|
+
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
27
|
+
), c = !0);
|
|
28
|
+
}
|
|
29
|
+
u = p({
|
|
30
|
+
inst: { value: r, getSnapshot: t }
|
|
31
|
+
});
|
|
32
|
+
var n = u[0].inst, i = u[1];
|
|
33
|
+
return L(
|
|
34
|
+
function() {
|
|
35
|
+
n.value = r, n.getSnapshot = t, a(n) && i({ inst: n });
|
|
36
|
+
},
|
|
37
|
+
[e, r, t]
|
|
38
|
+
), E(
|
|
39
|
+
function() {
|
|
40
|
+
return a(n) && i({ inst: n }), e(function() {
|
|
41
|
+
a(n) && i({ inst: n });
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
[e]
|
|
45
|
+
), y(r), r;
|
|
46
|
+
}
|
|
47
|
+
function a(e) {
|
|
48
|
+
var t = e.getSnapshot;
|
|
49
|
+
e = e.value;
|
|
50
|
+
try {
|
|
51
|
+
var r = t();
|
|
52
|
+
return !_(e, r);
|
|
53
|
+
} catch {
|
|
54
|
+
return !0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function O(e, t) {
|
|
58
|
+
return t();
|
|
59
|
+
}
|
|
60
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
61
|
+
var o = h, _ = typeof Object.is == "function" ? Object.is : d, p = o.useState, E = o.useEffect, L = o.useLayoutEffect, y = o.useDebugValue, f = !1, c = !1, v = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? O : S;
|
|
62
|
+
s.useSyncExternalStore = o.useSyncExternalStore !== void 0 ? o.useSyncExternalStore : v, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
63
|
+
}(), s);
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
A as __require
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=use-sync-external-store-shim.development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-sync-external-store-shim.development.js","sources":["../../../../../../../../node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n }\n function useSyncExternalStore$2(subscribe, getSnapshot) {\n didWarnOld18Alpha ||\n void 0 === React.startTransition ||\n ((didWarnOld18Alpha = !0),\n console.error(\n \"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.\"\n ));\n var value = getSnapshot();\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n objectIs(value, cachedValue) ||\n (console.error(\n \"The result of getSnapshot should be cached to avoid an infinite loop\"\n ),\n (didWarnUncachedGetSnapshot = !0));\n }\n cachedValue = useState({\n inst: { value: value, getSnapshot: getSnapshot }\n });\n var inst = cachedValue[0].inst,\n forceUpdate = cachedValue[1];\n useLayoutEffect(\n function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n },\n [subscribe, value, getSnapshot]\n );\n useEffect(\n function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n });\n },\n [subscribe]\n );\n useDebugValue(value);\n return value;\n }\n function checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n }\n function useSyncExternalStore$1(subscribe, getSnapshot) {\n return getSnapshot();\n }\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());\n var React = require(\"react\"),\n objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue,\n didWarnOld18Alpha = !1,\n didWarnUncachedGetSnapshot = !1,\n shim =\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ? useSyncExternalStore$1\n : useSyncExternalStore$2;\n exports.useSyncExternalStore =\n void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());\n })();\n"],"names":["is","x","y","useSyncExternalStore$2","subscribe","getSnapshot","didWarnOld18Alpha","React","value","didWarnUncachedGetSnapshot","cachedValue","objectIs","useState","inst","forceUpdate","useLayoutEffect","checkIfSnapshotChanged","useEffect","useDebugValue","latestGetSnapshot","nextValue","useSyncExternalStore$1","require$$0","shim","useS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YAAIO,IAAYD,EAAmB;AACnC,eAAO,CAACR,EAASE,GAAMO,CAAS;AAAA,MACjC,QAAe;AACd,eAAO;AAAA,MACf;AAAA,IACA;AACI,aAASC,EAAuBjB,GAAWC,GAAa;AACtD,aAAOA,EAAa;AAAA,IAC1B;AACI,IAAgB,OAAO,iCAAvB,OAEI,OAAO,+BAA+B,+BADxC,cAEA,+BAA+B,4BAA4B,OAAO;AACpE,QAAIE,IAAQe,GACVX,IAA0B,OAAO,OAAO,MAA7B,aAAkC,OAAO,KAAKX,GACzDY,IAAWL,EAAM,UACjBU,IAAYV,EAAM,WAClBQ,IAAkBR,EAAM,iBACxBW,IAAgBX,EAAM,eACtBD,IAAoB,IACpBG,IAA6B,IAC7Bc,IACkB,OAAO,SAAvB,OACgB,OAAO,OAAO,WAA9B,OACgB,OAAO,OAAO,SAAS,gBAAvC,MACIF,IACAlB;AACR,IAAAqB,EAA4B,uBACfjB,EAAM,yBAAjB,SAAwCA,EAAM,uBAAuBgB,GACvD,OAAO,iCAAvB,OAEI,OAAO,+BAA+B,8BADxC,cAEA,+BAA+B,2BAA2B,OAAO;AAAA,EACvE,EAAM;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { __exports as i } from "../../../../../../../_virtual/use-sync-external-store-shim.production.js";
|
|
2
|
+
import h from "react";
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
5
|
+
* use-sync-external-store-shim.production.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
var f;
|
|
13
|
+
function x() {
|
|
14
|
+
if (f) return i;
|
|
15
|
+
f = 1;
|
|
16
|
+
var u = h;
|
|
17
|
+
function s(e, t) {
|
|
18
|
+
return e === t && (e !== 0 || 1 / e === 1 / t) || e !== e && t !== t;
|
|
19
|
+
}
|
|
20
|
+
var S = typeof Object.is == "function" ? Object.is : s, d = u.useState, l = u.useEffect, p = u.useLayoutEffect, E = u.useDebugValue;
|
|
21
|
+
function v(e, t) {
|
|
22
|
+
var r = t(), a = d({ inst: { value: r, getSnapshot: t } }), n = a[0].inst, c = a[1];
|
|
23
|
+
return p(
|
|
24
|
+
function() {
|
|
25
|
+
n.value = r, n.getSnapshot = t, o(n) && c({ inst: n });
|
|
26
|
+
},
|
|
27
|
+
[e, r, t]
|
|
28
|
+
), l(
|
|
29
|
+
function() {
|
|
30
|
+
return o(n) && c({ inst: n }), e(function() {
|
|
31
|
+
o(n) && c({ inst: n });
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
[e]
|
|
35
|
+
), E(r), r;
|
|
36
|
+
}
|
|
37
|
+
function o(e) {
|
|
38
|
+
var t = e.getSnapshot;
|
|
39
|
+
e = e.value;
|
|
40
|
+
try {
|
|
41
|
+
var r = t();
|
|
42
|
+
return !S(e, r);
|
|
43
|
+
} catch {
|
|
44
|
+
return !0;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function y(e, t) {
|
|
48
|
+
return t();
|
|
49
|
+
}
|
|
50
|
+
var m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? y : v;
|
|
51
|
+
return i.useSyncExternalStore = u.useSyncExternalStore !== void 0 ? u.useSyncExternalStore : m, i;
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
x as __require
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=use-sync-external-store-shim.production.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-sync-external-store-shim.production.js","sources":["../../../../../../../../node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nfunction useSyncExternalStore$2(subscribe, getSnapshot) {\n var value = getSnapshot(),\n _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1];\n useLayoutEffect(\n function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n },\n [subscribe, value, getSnapshot]\n );\n useEffect(\n function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n });\n },\n [subscribe]\n );\n useDebugValue(value);\n return value;\n}\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n}\nfunction useSyncExternalStore$1(subscribe, getSnapshot) {\n return getSnapshot();\n}\nvar shim =\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ? useSyncExternalStore$1\n : useSyncExternalStore$2;\nexports.useSyncExternalStore =\n void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n"],"names":["React","require$$0","is","x","y","objectIs","useState","useEffect","useLayoutEffect","useDebugValue","useSyncExternalStore$2","subscribe","getSnapshot","value","_useState","inst","forceUpdate","checkIfSnapshotChanged","latestGetSnapshot","nextValue","useSyncExternalStore$1","shim","useSyncExternalStoreShim_production"],"mappings":";;;;;;;;;;;;;;;AAWA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AACA,MAAIS,IACc,OAAO,SAAvB,OACgB,OAAO,OAAO,WAA9B,OACgB,OAAO,OAAO,SAAS,gBAAvC,MACID,IACAV;AACsB,SAAAY,EAAA,uBACftB,EAAM,yBAAjB,SAAwCA,EAAM,uBAAuBqB;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __module as r } from "../../../../../../../_virtual/index4.js";
|
|
2
|
+
import { __require as o } from "../cjs/use-sync-external-store-shim.production.js";
|
|
3
|
+
import { __require as i } from "../cjs/use-sync-external-store-shim.development.js";
|
|
4
|
+
var e;
|
|
5
|
+
function u() {
|
|
6
|
+
return e ? r.exports : (e = 1, process.env.NODE_ENV === "production" ? r.exports = o() : r.exports = i(), r.exports);
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
u as __require
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/shim/index.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n"],"names":["shimModule","require$$0","require$$1"],"mappings":";;;;;iCAEI,QAAQ,IAAI,aAAa,eAC3BA,EAAA,UAAiBC,EAA4D,IAE7ED,EAAA,UAAiBE,EAA6D;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/types/index.ts"],"sourcesContent":["export * from '@shopify/shop-minis-platform'\n\nexport interface BaseComponentProps {\n className?: string\n children?: React.ReactNode\n}\n\n// Theme types\nexport interface ThemeConfig {\n colors?: {[key: string]: string}\n spacing?: {[key: string]: string}\n typography?: {[key: string]: string}\n}\n\n// Navigation\nexport const DATA_NAVIGATION_TYPE_ATTRIBUTE = 'data-navigation-type' as const\nexport const NAVIGATION_TYPES = {\n forward: 'forward',\n backward: 'backward',\n none: 'none',\n} as const\n"],"names":["DATA_NAVIGATION_TYPE_ATTRIBUTE","NAVIGATION_TYPES"],"mappings":"AAeO,MAAMA,IAAiC,wBACjCC,IAAmB;AAAA,EAC9B,SAAS;AAAA,EACT,UAAU;AAAA,EACV,MAAM;AACR;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { toUint8Array as o } from "../shop-minis-react/node_modules/.pnpm/js-base64@3.7.7/node_modules/js-base64/base64.js";
|
|
2
|
+
import { thumbHashToDataURL as a } from "../shop-minis-react/node_modules/.pnpm/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js";
|
|
3
|
+
function n(r) {
|
|
4
|
+
if (r)
|
|
5
|
+
try {
|
|
6
|
+
const t = o(r);
|
|
7
|
+
return a(t);
|
|
8
|
+
} catch (t) {
|
|
9
|
+
console.warn("Failed to decode thumbhash to data URL", t);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
n as getThumbhashDataURL
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","sources":["../../src/utils/image.ts"],"sourcesContent":["import {toUint8Array} from 'js-base64'\nimport {thumbHashToDataURL} from 'thumbhash'\n\n/**\n * Converts a thumbhash string to a data URL for use as an image placeholder\n * @param thumbhash Base64 encoded thumbhash string\n * @returns Data URL that can be used as image source or undefined if conversion fails\n */\nexport function getThumbhashDataURL(thumbhash?: string): string | undefined {\n if (!thumbhash) return\n\n try {\n const thumbhashArray = toUint8Array(thumbhash)\n return thumbHashToDataURL(thumbhashArray)\n } catch (error) {\n console.warn('Failed to decode thumbhash to data URL', error)\n }\n}\n"],"names":["getThumbhashDataURL","thumbhash","thumbhashArray","toUint8Array","thumbHashToDataURL","error"],"mappings":";;AAQO,SAASA,EAAoBC,GAAwC;AAC1E,MAAKA;AAED,QAAA;AACI,YAAAC,IAAiBC,EAAaF,CAAS;AAC7C,aAAOG,EAAmBF,CAAc;AAAA,aACjCG,GAAO;AACN,cAAA,KAAK,0CAA0CA,CAAK;AAAA,IAAA;AAEhE;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopify/shop-minis-react",
|
|
3
3
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.19",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -38,33 +38,41 @@
|
|
|
38
38
|
"typescript": ">=5.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@shopify/shop-minis-platform": "0.0.
|
|
41
|
+
"@shopify/shop-minis-platform": "0.0.6",
|
|
42
42
|
"@tailwindcss/vite": "4.1.8",
|
|
43
43
|
"@types/url-parse": "1.4.9",
|
|
44
44
|
"@vitejs/plugin-react": "4.5.1",
|
|
45
45
|
"class-variance-authority": "0.7.1",
|
|
46
46
|
"clsx": "2.1.1",
|
|
47
47
|
"embla-carousel-react": "8.6.0",
|
|
48
|
+
"js-base64": "^3.7.7",
|
|
48
49
|
"lodash": "4.17.21",
|
|
49
50
|
"lucide-react": "0.513.0",
|
|
50
51
|
"motion": "12.17.3",
|
|
51
52
|
"next-themes": "0.4.6",
|
|
52
53
|
"radix-ui": "1.4.2",
|
|
53
54
|
"react-resizable-panels": "3.0.2",
|
|
55
|
+
"react-router": "^7.7.0",
|
|
54
56
|
"sonner": "2.0.5",
|
|
55
57
|
"tailwind-merge": "2.6.0",
|
|
56
58
|
"tailwindcss": "4.1.8",
|
|
59
|
+
"thumbhash": "^0.1.1",
|
|
57
60
|
"tw-animate-css": "1.3.4",
|
|
58
61
|
"url-parse": "1.5.10",
|
|
59
62
|
"vaul": "1.1.2"
|
|
60
63
|
},
|
|
61
64
|
"devDependencies": {
|
|
62
65
|
"@shopify/generate-docs": "^0.16.6",
|
|
66
|
+
"@storybook/addon-docs": "^9.0.16",
|
|
67
|
+
"@storybook/react-vite": "^9.0.16",
|
|
63
68
|
"@types/node": "^20.12.1",
|
|
64
69
|
"@types/react": "^19.1.6",
|
|
65
70
|
"@types/react-dom": "^19.1.2",
|
|
71
|
+
"eslint": "^9.31.0",
|
|
72
|
+
"eslint-plugin-storybook": "^9.0.16",
|
|
66
73
|
"react": "^19.1.0",
|
|
67
74
|
"react-dom": "^19.1.0",
|
|
75
|
+
"storybook": "^9.0.16",
|
|
68
76
|
"typescript": "^5.8.3",
|
|
69
77
|
"vite": "^6.3.3",
|
|
70
78
|
"vite-plugin-dts": "^4.3.0"
|
|
@@ -92,6 +100,8 @@
|
|
|
92
100
|
"build": "vite build --mode lib",
|
|
93
101
|
"build:watch": "vite build --mode lib --watch",
|
|
94
102
|
"type-check": "tsc --noEmit",
|
|
95
|
-
"clean": "rm -rf dist"
|
|
103
|
+
"clean": "rm -rf dist",
|
|
104
|
+
"storybook": "storybook dev -p 6006",
|
|
105
|
+
"build-storybook": "storybook build"
|
|
96
106
|
}
|
|
97
107
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {useState} from 'react'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AlertDialogTrigger,
|
|
5
|
+
AlertDialogContent,
|
|
6
|
+
AlertDialogHeader,
|
|
7
|
+
AlertDialogTitle,
|
|
8
|
+
AlertDialogDescription,
|
|
9
|
+
AlertDialogFooter,
|
|
10
|
+
AlertDialogCancel,
|
|
11
|
+
AlertDialogAction,
|
|
12
|
+
AlertDialog as AlertDialogPrimitive,
|
|
13
|
+
} from '../ui/alert-dialog'
|
|
14
|
+
|
|
15
|
+
export const AlertDialogAtom = ({
|
|
16
|
+
children,
|
|
17
|
+
title,
|
|
18
|
+
description,
|
|
19
|
+
cancelButtonText,
|
|
20
|
+
confirmationButtonText,
|
|
21
|
+
open,
|
|
22
|
+
onOpenChange,
|
|
23
|
+
onConfirmationAction,
|
|
24
|
+
}: {
|
|
25
|
+
/** The trigger element that opens the alert dialog */
|
|
26
|
+
children: React.ReactNode
|
|
27
|
+
/** The title text shown in the alert dialog header */
|
|
28
|
+
title: string
|
|
29
|
+
/** The description text shown in the alert dialog body */
|
|
30
|
+
description: string
|
|
31
|
+
/** The text shown in the cancel button */
|
|
32
|
+
cancelButtonText: string
|
|
33
|
+
/** The text shown in the confirmation button */
|
|
34
|
+
confirmationButtonText: string
|
|
35
|
+
/** Whether the alert dialog is open */
|
|
36
|
+
open: boolean
|
|
37
|
+
/** Callback fired when the alert dialog open state changes */
|
|
38
|
+
onOpenChange: (open: boolean) => void
|
|
39
|
+
/** Callback fired when the confirmation button is clicked */
|
|
40
|
+
onConfirmationAction: () => void
|
|
41
|
+
}) => {
|
|
42
|
+
const [isOpen, setIsOpen] = useState(open)
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<AlertDialogPrimitive
|
|
46
|
+
open={isOpen}
|
|
47
|
+
onOpenChange={open => {
|
|
48
|
+
setIsOpen(open)
|
|
49
|
+
onOpenChange(open)
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<AlertDialogTrigger asChild>{children}</AlertDialogTrigger>
|
|
53
|
+
<AlertDialogContent>
|
|
54
|
+
<AlertDialogHeader>
|
|
55
|
+
<AlertDialogTitle>{title}</AlertDialogTitle>
|
|
56
|
+
<AlertDialogDescription>{description}</AlertDialogDescription>
|
|
57
|
+
</AlertDialogHeader>
|
|
58
|
+
<AlertDialogFooter>
|
|
59
|
+
<AlertDialogCancel>{cancelButtonText}</AlertDialogCancel>
|
|
60
|
+
<AlertDialogAction onClick={onConfirmationAction}>
|
|
61
|
+
{confirmationButtonText}
|
|
62
|
+
</AlertDialogAction>
|
|
63
|
+
</AlertDialogFooter>
|
|
64
|
+
</AlertDialogContent>
|
|
65
|
+
</AlertDialogPrimitive>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
2
|
+
import {ImgHTMLAttributes, useCallback, useMemo, memo, useState} from 'react'
|
|
3
|
+
|
|
4
|
+
import {cn} from '../../lib/utils'
|
|
5
|
+
import {getThumbhashDataURL} from '../../utils/image'
|
|
6
|
+
|
|
7
|
+
type ThumbhashImageProps = ImgHTMLAttributes<HTMLImageElement> & {
|
|
8
|
+
src: string
|
|
9
|
+
thumbhash: string
|
|
10
|
+
alt?: string | null
|
|
11
|
+
aspectRatio?: number | string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ThumbhashImage = memo(function ThumbhashImage(
|
|
15
|
+
props: ThumbhashImageProps
|
|
16
|
+
) {
|
|
17
|
+
const {
|
|
18
|
+
src,
|
|
19
|
+
alt,
|
|
20
|
+
thumbhash,
|
|
21
|
+
onLoad,
|
|
22
|
+
className,
|
|
23
|
+
style,
|
|
24
|
+
aspectRatio = 'auto',
|
|
25
|
+
...restProps
|
|
26
|
+
} = props
|
|
27
|
+
|
|
28
|
+
const [isLoaded, setIsLoaded] = useState(false)
|
|
29
|
+
|
|
30
|
+
const dataURL = useMemo(
|
|
31
|
+
() => getThumbhashDataURL(thumbhash ?? undefined),
|
|
32
|
+
[thumbhash]
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
const handleLoad = useCallback(
|
|
36
|
+
(event: React.SyntheticEvent<HTMLImageElement, Event>) => {
|
|
37
|
+
setIsLoaded(true)
|
|
38
|
+
onLoad?.(event)
|
|
39
|
+
},
|
|
40
|
+
[onLoad]
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
className={cn('relative w-full ', className)}
|
|
46
|
+
style={{
|
|
47
|
+
...style,
|
|
48
|
+
aspectRatio,
|
|
49
|
+
backgroundImage: dataURL ? `url(${dataURL})` : undefined,
|
|
50
|
+
backgroundSize: 'cover',
|
|
51
|
+
backgroundPosition: 'center',
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<img
|
|
55
|
+
className={cn(
|
|
56
|
+
'absolute inset-0 w-full h-full opacity-0 object-cover',
|
|
57
|
+
isLoaded && 'opacity-100'
|
|
58
|
+
)}
|
|
59
|
+
src={src}
|
|
60
|
+
alt={alt}
|
|
61
|
+
onLoad={handleLoad}
|
|
62
|
+
{...restProps}
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
)
|
|
66
|
+
})
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import {cn} from '../../lib/utils'
|
|
4
|
+
import {Skeleton} from '../ui/skeleton'
|
|
5
|
+
|
|
6
|
+
interface MerchantCardSkeletonProps extends React.ComponentProps<'div'> {}
|
|
7
|
+
|
|
8
|
+
function MerchantCardSkeleton({
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: MerchantCardSkeletonProps) {
|
|
12
|
+
return (
|
|
13
|
+
<div
|
|
14
|
+
className={cn(
|
|
15
|
+
'relative w-full aspect-square overflow-hidden rounded-xl border border-gray-100',
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
>
|
|
20
|
+
<div className="w-full h-2/3">
|
|
21
|
+
<Skeleton className="w-full h-full" />
|
|
22
|
+
</div>
|
|
23
|
+
<div className="mt-3 mb-3 ml-3">
|
|
24
|
+
<Skeleton className="mb-2 h-4 w-2/3" />
|
|
25
|
+
<Skeleton className="mb-2 h-5 w-1/3" />
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export {MerchantCardSkeleton}
|
|
@@ -202,6 +202,7 @@ function MerchantCardRating({
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
export interface MerchantCardProps {
|
|
205
|
+
variant?: 'default' | 'compact'
|
|
205
206
|
shop: Shop
|
|
206
207
|
touchable?: boolean
|
|
207
208
|
}
|
|
@@ -225,8 +226,10 @@ function MerchantCard({shop, touchable = true}: MerchantCardProps) {
|
|
|
225
226
|
return (
|
|
226
227
|
<MerchantCardRoot touchable={touchable} onPress={handlePress}>
|
|
227
228
|
<MerchantCardImageContainer>
|
|
228
|
-
|
|
229
|
-
|
|
229
|
+
<MerchantCardImage
|
|
230
|
+
src={visualTheme?.featuredImages?.[0]?.url}
|
|
231
|
+
alt={`${name} featured image`}
|
|
232
|
+
/>
|
|
230
233
|
<MerchantCardLogo
|
|
231
234
|
src={visualTheme?.logoImage?.url}
|
|
232
235
|
alt={`${name} logo`}
|