@tamagui/image 2.1.0 → 2.2.0-1781071309197
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/esm/v1/Image.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { isWeb } from "@tamagui/constants";
|
|
3
3
|
import { styled, usePropsAndStyle } from "@tamagui/web";
|
|
4
|
-
import { Image as
|
|
4
|
+
import { Image as Image$1 } from "react-native-web";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
const StyledImage = styled(
|
|
6
|
+
const StyledImage = styled(Image$1, {
|
|
7
7
|
name: "Image"
|
|
8
8
|
});
|
|
9
9
|
let hasWarned = false;
|
|
@@ -47,7 +47,7 @@ const Image = StyledImage.styleable((inProps, ref) => {
|
|
|
47
47
|
}, [src]);
|
|
48
48
|
if (finalSource["default"]) finalSource = finalSource["default"];
|
|
49
49
|
}
|
|
50
|
-
return /* @__PURE__ */jsx(
|
|
50
|
+
return /* @__PURE__ */jsx(Image$1, {
|
|
51
51
|
resizeMode: objectFit,
|
|
52
52
|
ref,
|
|
53
53
|
source: finalSource,
|
|
@@ -55,11 +55,11 @@ const Image = StyledImage.styleable((inProps, ref) => {
|
|
|
55
55
|
...rest
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
|
-
Image.getSize =
|
|
59
|
-
Image.getSizeWithHeaders =
|
|
60
|
-
Image.prefetch =
|
|
61
|
-
Image.prefetchWithMetadata =
|
|
62
|
-
Image.abortPrefetch =
|
|
63
|
-
Image.queryCache =
|
|
58
|
+
Image.getSize = Image$1.getSize;
|
|
59
|
+
Image.getSizeWithHeaders = Image$1.getSizeWithHeaders;
|
|
60
|
+
Image.prefetch = Image$1.prefetch;
|
|
61
|
+
Image.prefetchWithMetadata = Image$1.prefetchWithMetadata;
|
|
62
|
+
Image.abortPrefetch = Image$1.abortPrefetch;
|
|
63
|
+
Image.queryCache = Image$1.queryCache;
|
|
64
64
|
export { Image };
|
|
65
65
|
//# sourceMappingURL=Image.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","isWeb","styled","usePropsAndStyle","Image","
|
|
1
|
+
{"version":3,"names":["React","isWeb","styled","usePropsAndStyle","Image","Image$1","jsx","StyledImage","name","hasWarned","styleable","inProps","ref","props","style","src","source","objectFit","rest","process","env","NODE_ENV","width","height","console","warn","finalSource","uri","TAMAGUI_IMAGE_CHECK_ERROR","useEffect","run","fetch","then","res","text","err","error","resizeMode","getSize","getSizeWithHeaders","prefetch","prefetchWithMetadata","abortPrefetch","queryCache"],"sources":["Image.mjs"],"sourcesContent":["import React from \"react\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { styled, usePropsAndStyle } from \"@tamagui/web\";\nimport { Image as Image$1 } from \"react-native-web\";\nimport { jsx } from \"react/jsx-runtime\";\n\nconst StyledImage = styled(Image$1, { name: \"Image\" });\nlet hasWarned = false;\nconst Image = StyledImage.styleable((inProps, ref) => {\n\tconst [props, style] = usePropsAndStyle(inProps);\n\tconst { src, source, objectFit, ...rest } = props;\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tif (typeof src === \"string\") {\n\t\t\tif (typeof props.width === \"string\" && props.width[0] !== \"$\" || typeof props.height === \"string\" && props.height[0] !== \"$\") {\n\t\t\t\tif (!hasWarned) {\n\t\t\t\t\thasWarned = true;\n\t\t\t\t\tconsole.warn(`React Native expects a numerical width/height. If you want to use a percent you must define the \"source\" prop with width, height, and uri.`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tlet finalSource = typeof src === \"string\" ? {\n\t\turi: src,\n\t\t...isWeb && {\n\t\t\twidth: props.width || style?.width,\n\t\t\theight: props.height || style?.height\n\t\t}\n\t} : source ?? src;\n\tif (finalSource && typeof finalSource === \"object\") {\n\t\tif (process.env.NODE_ENV === \"development\" && process.env.TAMAGUI_IMAGE_CHECK_ERROR) React.useEffect(() => {\n\t\t\tasync function run() {\n\t\t\t\tif (typeof src === \"string\") try {\n\t\t\t\t\tawait fetch(src).then((res) => res.text());\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.error(`Error loading image: ${src}`, { props });\n\t\t\t\t}\n\t\t\t}\n\t\t\trun();\n\t\t}, [src]);\n\t\tif (finalSource[\"default\"]) finalSource = finalSource[\"default\"];\n\t}\n\treturn /* @__PURE__ */ jsx(Image$1, {\n\t\tresizeMode: objectFit,\n\t\tref,\n\t\tsource: finalSource,\n\t\tstyle,\n\t\t...rest\n\t});\n});\nImage.getSize = Image$1.getSize;\nImage.getSizeWithHeaders = Image$1.getSizeWithHeaders;\nImage.prefetch = Image$1.prefetch;\nImage.prefetchWithMetadata = Image$1.prefetchWithMetadata;\nImage.abortPrefetch = Image$1.abortPrefetch;\nImage.queryCache = Image$1.queryCache;\n\nexport { Image };"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,cAAc;AACvD,SAASC,KAAK,IAAIC,OAAO,QAAQ,kBAAkB;AACnD,SAASC,GAAG,QAAQ,mBAAmB;AAEvC,MAAMC,WAAW,GAAGL,MAAM,CAACG,OAAO,EAAE;EAAEG,IAAI,EAAE;AAAQ,CAAC,CAAC;AACtD,IAAIC,SAAS,GAAG,KAAK;AACrB,MAAML,KAAK,GAAGG,WAAW,CAACG,SAAS,CAAC,CAACC,OAAO,EAAEC,GAAG,KAAK;EACrD,MAAM,CAACC,KAAK,EAAEC,KAAK,CAAC,GAAGX,gBAAgB,CAACQ,OAAO,CAAC;EAChD,MAAM;IAAEI,GAAG;IAAEC,MAAM;IAAEC,SAAS;IAAE,GAAGC;EAAK,CAAC,GAAGL,KAAK;EACjD,IAAIM,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;IAC3C,IAAI,OAAON,GAAG,KAAK,QAAQ,EAAE;MAC5B,IAAI,OAAO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AAW,GAAGA,WAAW,CAAC,SAAS,CAAC;EACjE;EACA,OAAO,eAAgBpB,GAAG,CAACD,OAAO,EAAE;IACnCgC,UAAU,EAAEpB,SAAS;IACrBL,GAAG;IACHI,MAAM,EAAEU,WAAW;IACnBZ,KAAK;IACL,GAAGI;EACJ,CAAC,CAAC;AACH,CAAC,CAAC;AACFd,KAAK,CAACkC,OAAO,GAAGjC,OAAO,CAACiC,OAAO;AAC/BlC,KAAK,CAACmC,kBAAkB,GAAGlC,OAAO,CAACkC,kBAAkB;AACrDnC,KAAK,CAACoC,QAAQ,GAAGnC,OAAO,CAACmC,QAAQ;AACjCpC,KAAK,CAACqC,oBAAoB,GAAGpC,OAAO,CAACoC,oBAAoB;AACzDrC,KAAK,CAACsC,aAAa,GAAGrC,OAAO,CAACqC,aAAa;AAC3CtC,KAAK,CAACuC,UAAU,GAAGtC,OAAO,CAACsC,UAAU;AAErC,SAASvC,KAAK","ignoreList":[]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { isWeb } from "@tamagui/constants";
|
|
4
4
|
import { styled, usePropsAndStyle } from "@tamagui/web";
|
|
5
|
-
import { Image as
|
|
5
|
+
import { Image as Image$1 } from "react-native";
|
|
6
6
|
function _type_of(obj) {
|
|
7
7
|
"@swc/helpers - typeof";
|
|
8
8
|
|
|
9
9
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
10
10
|
}
|
|
11
|
-
var StyledImage = styled(
|
|
11
|
+
var StyledImage = styled(Image$1, {
|
|
12
12
|
name: "Image"
|
|
13
13
|
});
|
|
14
14
|
var hasWarned = false;
|
|
@@ -66,7 +66,7 @@ var Image = StyledImage.styleable(function (inProps, ref) {
|
|
|
66
66
|
}, [src]);
|
|
67
67
|
if (finalSource["default"]) finalSource = finalSource["default"];
|
|
68
68
|
}
|
|
69
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */jsx(Image$1, {
|
|
70
70
|
resizeMode: objectFit,
|
|
71
71
|
ref,
|
|
72
72
|
source: finalSource,
|
|
@@ -74,11 +74,11 @@ var Image = StyledImage.styleable(function (inProps, ref) {
|
|
|
74
74
|
...rest
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
|
-
Image.getSize =
|
|
78
|
-
Image.getSizeWithHeaders =
|
|
79
|
-
Image.prefetch =
|
|
80
|
-
Image.prefetchWithMetadata =
|
|
81
|
-
Image.abortPrefetch =
|
|
82
|
-
Image.queryCache =
|
|
77
|
+
Image.getSize = Image$1.getSize;
|
|
78
|
+
Image.getSizeWithHeaders = Image$1.getSizeWithHeaders;
|
|
79
|
+
Image.prefetch = Image$1.prefetch;
|
|
80
|
+
Image.prefetchWithMetadata = Image$1.prefetchWithMetadata;
|
|
81
|
+
Image.abortPrefetch = Image$1.abortPrefetch;
|
|
82
|
+
Image.queryCache = Image$1.queryCache;
|
|
83
83
|
export { Image };
|
|
84
84
|
//# sourceMappingURL=Image.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["jsx","
|
|
1
|
+
{"version":3,"names":["jsx","React","isWeb","styled","usePropsAndStyle","Image","Image$1","_type_of","obj","Symbol","constructor","StyledImage","name","hasWarned","styleable","inProps","ref","props","style","src","source","objectFit","rest","process","env","NODE_ENV","width","height","console","warn","finalSource","uri","Array","isArray","_style","_style1","_width","_height","TAMAGUI_IMAGE_CHECK_ERROR","useEffect","run","fetch","then","res","text","err","error","resizeMode","getSize","getSizeWithHeaders","prefetch","prefetchWithMetadata","abortPrefetch","queryCache"],"sources":["Image.native.js"],"sourcesContent":["import { jsx } from \"react/jsx-runtime\";\nimport React from \"react\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { styled, usePropsAndStyle } from \"@tamagui/web\";\nimport { Image as Image$1 } from \"react-native\";\n\nfunction _type_of(obj) {\n\t\"@swc/helpers - typeof\";\n\treturn obj && typeof Symbol !== \"undefined\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n}\nvar StyledImage = styled(Image$1, { name: \"Image\" });\nvar hasWarned = false;\nvar Image = StyledImage.styleable(function(inProps, ref) {\n\tvar [props, style] = usePropsAndStyle(inProps);\n\tvar { src, source, objectFit, ...rest } = props;\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tif (typeof src === \"string\") {\n\t\t\tif (typeof props.width === \"string\" && props.width[0] !== \"$\" || typeof props.height === \"string\" && props.height[0] !== \"$\") {\n\t\t\t\tif (!hasWarned) {\n\t\t\t\t\thasWarned = true;\n\t\t\t\t\tconsole.warn(`React Native expects a numerical width/height. If you want to use a percent you must define the \"source\" prop with width, height, and uri.`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tvar finalSource = typeof src === \"string\" ? {\n\t\turi: src,\n\t\t...isWeb && {\n\t\t\twidth: props.width || (style === null || style === void 0 ? void 0 : style.width),\n\t\t\theight: props.height || (style === null || style === void 0 ? void 0 : style.height)\n\t\t}\n\t} : source !== null && source !== void 0 ? source : src;\n\tif (finalSource && (typeof finalSource === \"undefined\" ? \"undefined\" : _type_of(finalSource)) === \"object\") {\n\t\tif (!Array.isArray(finalSource)) {\n\t\t\tif (typeof finalSource.uri === \"number\") {\n\t\t\t\tfinalSource = finalSource.uri;\n\t\t\t\tif (source && (typeof source === \"undefined\" ? \"undefined\" : _type_of(source)) === \"object\" && !Array.isArray(source)) {\n\t\t\t\t\tvar _style, _style1;\n\t\t\t\t\tvar _width;\n\t\t\t\t\t(_width = (_style = style).width) !== null && _width !== void 0 || (_style.width = source.width);\n\t\t\t\t\tvar _height;\n\t\t\t\t\t(_height = (_style1 = style).height) !== null && _height !== void 0 || (_style1.height = source.height);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (process.env.NODE_ENV === \"development\" && process.env.TAMAGUI_IMAGE_CHECK_ERROR) React.useEffect(function() {\n\t\t\tasync function run() {\n\t\t\t\tif (typeof src === \"string\") try {\n\t\t\t\t\tawait fetch(src).then(function(res) {\n\t\t\t\t\t\treturn res.text();\n\t\t\t\t\t});\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.error(`Error loading image: ${src}`, { props });\n\t\t\t\t}\n\t\t\t}\n\t\t\trun();\n\t\t}, [src]);\n\t\tif (finalSource[\"default\"]) finalSource = finalSource[\"default\"];\n\t}\n\treturn /* @__PURE__ */ jsx(Image$1, {\n\t\tresizeMode: objectFit,\n\t\tref,\n\t\tsource: finalSource,\n\t\tstyle,\n\t\t...rest\n\t});\n});\nImage.getSize = Image$1.getSize;\nImage.getSizeWithHeaders = Image$1.getSizeWithHeaders;\nImage.prefetch = Image$1.prefetch;\nImage.prefetchWithMetadata = Image$1.prefetchWithMetadata;\nImage.abortPrefetch = Image$1.abortPrefetch;\nImage.queryCache = Image$1.queryCache;\n\nexport { Image };"],"mappings":"AAAA,SAASA,GAAG,QAAQ,mBAAmB;AACvC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,cAAc;AACvD,SAASC,KAAK,IAAIC,OAAO,QAAQ,cAAc;AAE/C,SAASC,QAAQA,CAACC,GAAG,EAAE;EACtB,uBAAuB;;EACvB,OAAOA,GAAG,IAAI,OAAOC,MAAM,KAAK,WAAW,IAAID,GAAG,CAACE,WAAW,KAAKD,MAAM,GAAG,QAAQ,GAAG,OAAOD,GAAG;AAClG;AACA,IAAIG,WAAW,GAAGR,MAAM,CAACG,OAAO,EAAE;EAAEM,IAAI,EAAE;AAAQ,CAAC,CAAC;AACpD,IAAIC,SAAS,GAAG,KAAK;AACrB,IAAIR,KAAK,GAAGM,WAAW,CAACG,SAAS,CAAC,UAASC,OAAO,EAAEC,GAAG,EAAE;EACxD,IAAI,CAACC,KAAK,EAAEC,KAAK,CAAC,GAAGd,gBAAgB,CAACW,OAAO,CAAC;EAC9C,IAAI;IAAEI,GAA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C,EAAEA,WAAW,GAAGA,WAAW,CAAC,SAAS,CAAC;EACjE;EACA,OAAO,eAAgB9B,GAAG,CAACM,OAAO,EAAE;IACnCyC,UAAU,EAAE1B,SAAS;IACrBL,GAAG;IACHI,MAAM,EAAEU,WAAW;IACnBZ,KAAK;IACL,GAAGI;EACJ,CAAC,CAAC;AACH,CAAC,CAAC;AACFjB,KAAK,CAAC2C,OAAO,GAAG1C,OAAO,CAAC0C,OAAO;AAC/B3C,KAAK,CAAC4C,kBAAkB,GAAG3C,OAAO,CAAC2C,kBAAkB;AACrD5C,KAAK,CAAC6C,QAAQ,GAAG5C,OAAO,CAAC4C,QAAQ;AACjC7C,KAAK,CAAC8C,oBAAoB,GAAG7C,OAAO,CAAC6C,oBAAoB;AACzD9C,KAAK,CAAC+C,aAAa,GAAG9C,OAAO,CAAC8C,aAAa;AAC3C/C,KAAK,CAACgD,UAAU,GAAG/C,OAAO,CAAC+C,UAAU;AAErC,SAAShD,KAAK","ignoreList":[]}
|
package/dist/jsx/v1/Image.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { isWeb } from "@tamagui/constants";
|
|
3
3
|
import { styled, usePropsAndStyle } from "@tamagui/web";
|
|
4
|
-
import { Image as
|
|
4
|
+
import { Image as Image$1 } from "react-native-web";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
const StyledImage = styled(
|
|
6
|
+
const StyledImage = styled(Image$1, {
|
|
7
7
|
name: "Image"
|
|
8
8
|
});
|
|
9
9
|
let hasWarned = false;
|
|
@@ -47,7 +47,7 @@ const Image = StyledImage.styleable((inProps, ref) => {
|
|
|
47
47
|
}, [src]);
|
|
48
48
|
if (finalSource["default"]) finalSource = finalSource["default"];
|
|
49
49
|
}
|
|
50
|
-
return /* @__PURE__ */jsx(
|
|
50
|
+
return /* @__PURE__ */jsx(Image$1, {
|
|
51
51
|
resizeMode: objectFit,
|
|
52
52
|
ref,
|
|
53
53
|
source: finalSource,
|
|
@@ -55,11 +55,11 @@ const Image = StyledImage.styleable((inProps, ref) => {
|
|
|
55
55
|
...rest
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
|
-
Image.getSize =
|
|
59
|
-
Image.getSizeWithHeaders =
|
|
60
|
-
Image.prefetch =
|
|
61
|
-
Image.prefetchWithMetadata =
|
|
62
|
-
Image.abortPrefetch =
|
|
63
|
-
Image.queryCache =
|
|
58
|
+
Image.getSize = Image$1.getSize;
|
|
59
|
+
Image.getSizeWithHeaders = Image$1.getSizeWithHeaders;
|
|
60
|
+
Image.prefetch = Image$1.prefetch;
|
|
61
|
+
Image.prefetchWithMetadata = Image$1.prefetchWithMetadata;
|
|
62
|
+
Image.abortPrefetch = Image$1.abortPrefetch;
|
|
63
|
+
Image.queryCache = Image$1.queryCache;
|
|
64
64
|
export { Image };
|
|
65
65
|
//# sourceMappingURL=Image.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","isWeb","styled","usePropsAndStyle","Image","
|
|
1
|
+
{"version":3,"names":["React","isWeb","styled","usePropsAndStyle","Image","Image$1","jsx","StyledImage","name","hasWarned","styleable","inProps","ref","props","style","src","source","objectFit","rest","process","env","NODE_ENV","width","height","console","warn","finalSource","uri","TAMAGUI_IMAGE_CHECK_ERROR","useEffect","run","fetch","then","res","text","err","error","resizeMode","getSize","getSizeWithHeaders","prefetch","prefetchWithMetadata","abortPrefetch","queryCache"],"sources":["Image.mjs"],"sourcesContent":["import React from \"react\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { styled, usePropsAndStyle } from \"@tamagui/web\";\nimport { Image as Image$1 } from \"react-native-web\";\nimport { jsx } from \"react/jsx-runtime\";\n\nconst StyledImage = styled(Image$1, { name: \"Image\" });\nlet hasWarned = false;\nconst Image = StyledImage.styleable((inProps, ref) => {\n\tconst [props, style] = usePropsAndStyle(inProps);\n\tconst { src, source, objectFit, ...rest } = props;\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tif (typeof src === \"string\") {\n\t\t\tif (typeof props.width === \"string\" && props.width[0] !== \"$\" || typeof props.height === \"string\" && props.height[0] !== \"$\") {\n\t\t\t\tif (!hasWarned) {\n\t\t\t\t\thasWarned = true;\n\t\t\t\t\tconsole.warn(`React Native expects a numerical width/height. If you want to use a percent you must define the \"source\" prop with width, height, and uri.`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tlet finalSource = typeof src === \"string\" ? {\n\t\turi: src,\n\t\t...isWeb && {\n\t\t\twidth: props.width || style?.width,\n\t\t\theight: props.height || style?.height\n\t\t}\n\t} : source ?? src;\n\tif (finalSource && typeof finalSource === \"object\") {\n\t\tif (process.env.NODE_ENV === \"development\" && process.env.TAMAGUI_IMAGE_CHECK_ERROR) React.useEffect(() => {\n\t\t\tasync function run() {\n\t\t\t\tif (typeof src === \"string\") try {\n\t\t\t\t\tawait fetch(src).then((res) => res.text());\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.error(`Error loading image: ${src}`, { props });\n\t\t\t\t}\n\t\t\t}\n\t\t\trun();\n\t\t}, [src]);\n\t\tif (finalSource[\"default\"]) finalSource = finalSource[\"default\"];\n\t}\n\treturn /* @__PURE__ */ jsx(Image$1, {\n\t\tresizeMode: objectFit,\n\t\tref,\n\t\tsource: finalSource,\n\t\tstyle,\n\t\t...rest\n\t});\n});\nImage.getSize = Image$1.getSize;\nImage.getSizeWithHeaders = Image$1.getSizeWithHeaders;\nImage.prefetch = Image$1.prefetch;\nImage.prefetchWithMetadata = Image$1.prefetchWithMetadata;\nImage.abortPrefetch = Image$1.abortPrefetch;\nImage.queryCache = Image$1.queryCache;\n\nexport { Image };"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,cAAc;AACvD,SAASC,KAAK,IAAIC,OAAO,QAAQ,kBAAkB;AACnD,SAASC,GAAG,QAAQ,m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|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -8,9 +8,7 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"type": "module",
|
|
11
|
-
"sideEffects":
|
|
12
|
-
"*.css"
|
|
13
|
-
],
|
|
11
|
+
"sideEffects": false,
|
|
14
12
|
"main": "dist/cjs",
|
|
15
13
|
"module": "dist/esm",
|
|
16
14
|
"types": "./types/index.d.ts",
|
|
@@ -36,12 +34,12 @@
|
|
|
36
34
|
"clean:build": "tamagui-build clean:build"
|
|
37
35
|
},
|
|
38
36
|
"dependencies": {
|
|
39
|
-
"@tamagui/constants": "2.
|
|
40
|
-
"@tamagui/core": "2.
|
|
41
|
-
"@tamagui/web": "2.
|
|
37
|
+
"@tamagui/constants": "2.2.0-1781071309197",
|
|
38
|
+
"@tamagui/core": "2.2.0-1781071309197",
|
|
39
|
+
"@tamagui/web": "2.2.0-1781071309197"
|
|
42
40
|
},
|
|
43
41
|
"devDependencies": {
|
|
44
|
-
"@tamagui/build": "2.
|
|
42
|
+
"@tamagui/build": "2.2.0-1781071309197",
|
|
45
43
|
"react": ">=19",
|
|
46
44
|
"react-native": "0.83.2"
|
|
47
45
|
},
|