@shopify/shop-minis-react 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index10.js +2 -2
- package/dist/_virtual/index4.js +3 -2
- package/dist/_virtual/index4.js.map +1 -1
- package/dist/_virtual/index5.js +2 -3
- package/dist/_virtual/index5.js.map +1 -1
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index9.js +2 -2
- package/dist/components/atoms/image.js +44 -32
- package/dist/components/atoms/image.js.map +1 -1
- 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/mpd-parser@1.3.1/node_modules/mpd-parser/dist/mpd-parser.es.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/image.tsx +33 -3
package/dist/_virtual/index10.js
CHANGED
package/dist/_virtual/index4.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { __require as r } from "../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";
|
|
2
|
+
var i = r();
|
|
2
3
|
export {
|
|
3
|
-
|
|
4
|
+
i as s
|
|
4
5
|
};
|
|
5
6
|
//# sourceMappingURL=index4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index4.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index4.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/dist/_virtual/index5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index5.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index5.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/_virtual/index6.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __require as r } from "../shop-minis-react/node_modules/.pnpm
|
|
1
|
+
import { __require as r } from "../shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/index.js";
|
|
2
2
|
var i = r();
|
|
3
3
|
export {
|
|
4
|
-
i as
|
|
4
|
+
i as l
|
|
5
5
|
};
|
|
6
6
|
//# sourceMappingURL=index6.js.map
|
package/dist/_virtual/index9.js
CHANGED
|
@@ -1,52 +1,64 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { getThumbhashDataURL as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { memo as v, useState as i, useEffect as k, useMemo as u, useCallback as I } from "react";
|
|
3
|
+
import { cn as m } from "../../lib/utils.js";
|
|
4
|
+
import { getThumbhashDataURL as j, getResizedImageUrl as y } from "../../utils/image.js";
|
|
5
|
+
const O = v(function(d) {
|
|
6
6
|
const {
|
|
7
|
-
src:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
7
|
+
src: r,
|
|
8
|
+
file: t,
|
|
9
|
+
thumbhash: a,
|
|
10
|
+
onLoad: s,
|
|
11
|
+
className: b,
|
|
12
|
+
style: f,
|
|
13
|
+
aspectRatio: g = "auto",
|
|
14
|
+
...h
|
|
15
|
+
} = d, [L, p] = i(!1), [o, c] = i(null);
|
|
16
|
+
k(() => {
|
|
17
|
+
if (!t) {
|
|
18
|
+
c(null);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const e = URL.createObjectURL(t);
|
|
22
|
+
return c(e), () => {
|
|
23
|
+
URL.revokeObjectURL(e);
|
|
24
|
+
};
|
|
25
|
+
}, [t]);
|
|
26
|
+
const l = u(
|
|
27
|
+
() => j(a ?? void 0),
|
|
21
28
|
[a]
|
|
22
|
-
),
|
|
23
|
-
|
|
29
|
+
), U = I(
|
|
30
|
+
(e) => {
|
|
31
|
+
p(!0), s?.(e);
|
|
32
|
+
},
|
|
33
|
+
[s]
|
|
34
|
+
), R = u(() => o || y(r), [o, r]);
|
|
35
|
+
return /* @__PURE__ */ n(
|
|
24
36
|
"div",
|
|
25
37
|
{
|
|
26
|
-
className:
|
|
38
|
+
className: m("relative w-full ", b),
|
|
27
39
|
style: {
|
|
28
|
-
...
|
|
29
|
-
aspectRatio:
|
|
30
|
-
backgroundImage:
|
|
40
|
+
...f,
|
|
41
|
+
aspectRatio: g,
|
|
42
|
+
backgroundImage: l ? `url(${l})` : void 0,
|
|
31
43
|
backgroundSize: "cover",
|
|
32
44
|
backgroundPosition: "center"
|
|
33
45
|
},
|
|
34
|
-
children: /* @__PURE__ */
|
|
46
|
+
children: /* @__PURE__ */ n(
|
|
35
47
|
"img",
|
|
36
48
|
{
|
|
37
|
-
className:
|
|
49
|
+
className: m(
|
|
38
50
|
"absolute inset-0 opacity-0 size-full object-cover",
|
|
39
|
-
|
|
51
|
+
L && "opacity-100"
|
|
40
52
|
),
|
|
41
|
-
src:
|
|
42
|
-
onLoad:
|
|
43
|
-
...
|
|
53
|
+
src: R,
|
|
54
|
+
onLoad: U,
|
|
55
|
+
...h
|
|
44
56
|
}
|
|
45
57
|
)
|
|
46
58
|
}
|
|
47
59
|
);
|
|
48
60
|
});
|
|
49
61
|
export {
|
|
50
|
-
|
|
62
|
+
O as Image
|
|
51
63
|
};
|
|
52
64
|
//# sourceMappingURL=image.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","sources":["../../../src/components/atoms/image.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/alt-text */\n/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport {ImgHTMLAttributes
|
|
1
|
+
{"version":3,"file":"image.js","sources":["../../../src/components/atoms/image.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/alt-text */\n/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport {\n ImgHTMLAttributes,\n useCallback,\n useMemo,\n memo,\n useState,\n useEffect,\n} from 'react'\n\nimport {cn} from '../../lib/utils'\nimport {getThumbhashDataURL, getResizedImageUrl} from '../../utils'\n\ntype ImageProps = ImgHTMLAttributes<HTMLImageElement> & {\n src?: string\n file?: File\n thumbhash?: string | null\n aspectRatio?: number | string\n}\n\nexport const Image = memo(function Image(props: ImageProps) {\n const {\n src,\n file,\n thumbhash,\n onLoad,\n className,\n style,\n aspectRatio = 'auto',\n ...restProps\n } = props\n\n const [isLoaded, setIsLoaded] = useState(false)\n const [blobUrl, setBlobUrl] = useState<string | null>(null)\n\n // Create and manage blob URL for File objects\n useEffect(() => {\n if (!file) {\n setBlobUrl(null)\n return\n }\n\n const url = URL.createObjectURL(file)\n setBlobUrl(url)\n\n // Cleanup on unmount or when file changes\n return () => {\n URL.revokeObjectURL(url)\n }\n }, [file])\n\n const thumbhashDataURL = useMemo(\n () => getThumbhashDataURL(thumbhash ?? undefined),\n [thumbhash]\n )\n\n const handleLoad = useCallback(\n (event: React.SyntheticEvent<HTMLImageElement, Event>) => {\n setIsLoaded(true)\n onLoad?.(event)\n },\n [onLoad]\n )\n\n // Use blob URL if file is provided, otherwise use src\n const imageSrc = useMemo(() => {\n if (blobUrl) return blobUrl\n return getResizedImageUrl(src)\n }, [blobUrl, src])\n\n return (\n <div\n className={cn('relative w-full ', className)}\n style={{\n ...style,\n aspectRatio,\n backgroundImage: thumbhashDataURL\n ? `url(${thumbhashDataURL})`\n : undefined,\n backgroundSize: 'cover',\n backgroundPosition: 'center',\n }}\n >\n <img\n className={cn(\n 'absolute inset-0 opacity-0 size-full object-cover',\n isLoaded && 'opacity-100'\n )}\n src={imageSrc}\n onLoad={handleLoad}\n {...restProps}\n />\n </div>\n )\n})\n"],"names":["Image","memo","props","src","file","thumbhash","onLoad","className","style","aspectRatio","restProps","isLoaded","setIsLoaded","useState","blobUrl","setBlobUrl","useEffect","url","thumbhashDataURL","useMemo","getThumbhashDataURL","handleLoad","useCallback","event","imageSrc","getResizedImageUrl","jsx","cn"],"mappings":";;;;AAqBO,MAAMA,IAAQC,EAAK,SAAeC,GAAmB;AACpD,QAAA;AAAA,IACJ,KAAAC;AAAA,IACA,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,WAAAC;AAAA,IACA,OAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,GAAGC;AAAA,EAAA,IACDR,GAEE,CAACS,GAAUC,CAAW,IAAIC,EAAS,EAAK,GACxC,CAACC,GAASC,CAAU,IAAIF,EAAwB,IAAI;AAG1D,EAAAG,EAAU,MAAM;AACd,QAAI,CAACZ,GAAM;AACT,MAAAW,EAAW,IAAI;AACf;AAAA,IAAA;AAGI,UAAAE,IAAM,IAAI,gBAAgBb,CAAI;AACpC,WAAAW,EAAWE,CAAG,GAGP,MAAM;AACX,UAAI,gBAAgBA,CAAG;AAAA,IACzB;AAAA,EAAA,GACC,CAACb,CAAI,CAAC;AAET,QAAMc,IAAmBC;AAAA,IACvB,MAAMC,EAAoBf,KAAa,MAAS;AAAA,IAChD,CAACA,CAAS;AAAA,EACZ,GAEMgB,IAAaC;AAAA,IACjB,CAACC,MAAyD;AACxD,MAAAX,EAAY,EAAI,GAChBN,IAASiB,CAAK;AAAA,IAChB;AAAA,IACA,CAACjB,CAAM;AAAA,EACT,GAGMkB,IAAWL,EAAQ,MACnBL,KACGW,EAAmBtB,CAAG,GAC5B,CAACW,GAASX,CAAG,CAAC;AAGf,SAAA,gBAAAuB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAG,oBAAoBpB,CAAS;AAAA,MAC3C,OAAO;AAAA,QACL,GAAGC;AAAA,QACH,aAAAC;AAAA,QACA,iBAAiBS,IACb,OAAOA,CAAgB,MACvB;AAAA,QACJ,gBAAgB;AAAA,QAChB,oBAAoB;AAAA,MACtB;AAAA,MAEA,UAAA,gBAAAQ;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWC;AAAA,YACT;AAAA,YACAhB,KAAY;AAAA,UACd;AAAA,UACA,KAAKa;AAAA,UACL,QAAQH;AAAA,UACP,GAAGX;AAAA,QAAA;AAAA,MAAA;AAAA,IACN;AAAA,EACF;AAEJ,CAAC;"}
|
|
@@ -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";
|
|
@@ -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/index9.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;
|
package/package.json
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
/* eslint-disable jsx-a11y/alt-text */
|
|
2
2
|
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
ImgHTMLAttributes,
|
|
5
|
+
useCallback,
|
|
6
|
+
useMemo,
|
|
7
|
+
memo,
|
|
8
|
+
useState,
|
|
9
|
+
useEffect,
|
|
10
|
+
} from 'react'
|
|
4
11
|
|
|
5
12
|
import {cn} from '../../lib/utils'
|
|
6
13
|
import {getThumbhashDataURL, getResizedImageUrl} from '../../utils'
|
|
7
14
|
|
|
8
15
|
type ImageProps = ImgHTMLAttributes<HTMLImageElement> & {
|
|
9
16
|
src?: string
|
|
17
|
+
file?: File
|
|
10
18
|
thumbhash?: string | null
|
|
11
19
|
aspectRatio?: number | string
|
|
12
20
|
}
|
|
@@ -14,6 +22,7 @@ type ImageProps = ImgHTMLAttributes<HTMLImageElement> & {
|
|
|
14
22
|
export const Image = memo(function Image(props: ImageProps) {
|
|
15
23
|
const {
|
|
16
24
|
src,
|
|
25
|
+
file,
|
|
17
26
|
thumbhash,
|
|
18
27
|
onLoad,
|
|
19
28
|
className,
|
|
@@ -23,6 +32,23 @@ export const Image = memo(function Image(props: ImageProps) {
|
|
|
23
32
|
} = props
|
|
24
33
|
|
|
25
34
|
const [isLoaded, setIsLoaded] = useState(false)
|
|
35
|
+
const [blobUrl, setBlobUrl] = useState<string | null>(null)
|
|
36
|
+
|
|
37
|
+
// Create and manage blob URL for File objects
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!file) {
|
|
40
|
+
setBlobUrl(null)
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const url = URL.createObjectURL(file)
|
|
45
|
+
setBlobUrl(url)
|
|
46
|
+
|
|
47
|
+
// Cleanup on unmount or when file changes
|
|
48
|
+
return () => {
|
|
49
|
+
URL.revokeObjectURL(url)
|
|
50
|
+
}
|
|
51
|
+
}, [file])
|
|
26
52
|
|
|
27
53
|
const thumbhashDataURL = useMemo(
|
|
28
54
|
() => getThumbhashDataURL(thumbhash ?? undefined),
|
|
@@ -37,7 +63,11 @@ export const Image = memo(function Image(props: ImageProps) {
|
|
|
37
63
|
[onLoad]
|
|
38
64
|
)
|
|
39
65
|
|
|
40
|
-
|
|
66
|
+
// Use blob URL if file is provided, otherwise use src
|
|
67
|
+
const imageSrc = useMemo(() => {
|
|
68
|
+
if (blobUrl) return blobUrl
|
|
69
|
+
return getResizedImageUrl(src)
|
|
70
|
+
}, [blobUrl, src])
|
|
41
71
|
|
|
42
72
|
return (
|
|
43
73
|
<div
|
|
@@ -57,7 +87,7 @@ export const Image = memo(function Image(props: ImageProps) {
|
|
|
57
87
|
'absolute inset-0 opacity-0 size-full object-cover',
|
|
58
88
|
isLoaded && 'opacity-100'
|
|
59
89
|
)}
|
|
60
|
-
src={
|
|
90
|
+
src={imageSrc}
|
|
61
91
|
onLoad={handleLoad}
|
|
62
92
|
{...restProps}
|
|
63
93
|
/>
|