@tamagui/image 1.113.1 → 1.114.0

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.
@@ -4,36 +4,29 @@ import { isWeb } from "@tamagui/constants";
4
4
  import { styled, usePropsAndStyle } from "@tamagui/core";
5
5
  import { Image as RNImage } from "react-native";
6
6
  var StyledImage = styled(RNImage, {
7
- name: "Image"
8
- }),
9
- hasWarned = !1,
10
- Image = StyledImage.styleable(function (inProps, ref) {
11
- var [props, style] = usePropsAndStyle(inProps),
12
- {
13
- src,
14
- source,
15
- objectFit,
16
- ...rest
17
- } = props;
18
- process.env.NODE_ENV === "development" && typeof src == "string" && (typeof props.width == "string" && props.width[0] !== "$" || typeof props.height == "string" && props.height[0] !== "$") && (hasWarned || (hasWarned = !0, console.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.')));
19
- var finalSource = typeof src == "string" ? {
20
- uri: src,
21
- ...(isWeb && {
22
- width: props.width || style?.width,
23
- height: props.height || style?.height
24
- })
25
- } : source ?? src;
26
- if (finalSource && typeof finalSource == "object") {
27
- if (!Array.isArray(finalSource) && typeof finalSource.uri == "number" && (finalSource = finalSource.uri, source && typeof source == "object" && !Array.isArray(source))) {
28
- var _style, _style1, _width;
29
- (_width = (_style = style).width) !== null && _width !== void 0 || (_style.width = source.width);
30
- var _height;
31
- (_height = (_style1 = style).height) !== null && _height !== void 0 || (_style1.height = source.height);
32
- }
33
- process.env.NODE_ENV === "development" && process.env.TAMAGUI_IMAGE_CHECK_ERROR && React.useEffect(function () {
34
- async function run() {
35
- if (typeof src == "string") try {
36
- await fetch(src).then(function (res) {
7
+ name: "Image"
8
+ }), hasWarned = !1, Image = StyledImage.styleable(function(inProps, ref) {
9
+ var [props, style] = usePropsAndStyle(inProps), { src, source, objectFit, ...rest } = props;
10
+ process.env.NODE_ENV === "development" && typeof src == "string" && (typeof props.width == "string" && props.width[0] !== "$" || typeof props.height == "string" && props.height[0] !== "$") && (hasWarned || (hasWarned = !0, console.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.')));
11
+ var finalSource = typeof src == "string" ? {
12
+ uri: src,
13
+ ...isWeb && {
14
+ width: props.width || style?.width,
15
+ height: props.height || style?.height
16
+ }
17
+ } : source ?? src;
18
+ if (finalSource && typeof finalSource == "object") {
19
+ if (!Array.isArray(finalSource) && typeof finalSource.uri == "number" && (finalSource = finalSource.uri, source && typeof source == "object" && !Array.isArray(source))) {
20
+ var _style, _style1, _width;
21
+ (_width = (_style = style).width) !== null && _width !== void 0 || (_style.width = source.width);
22
+ var _height;
23
+ (_height = (_style1 = style).height) !== null && _height !== void 0 || (_style1.height = source.height);
24
+ }
25
+ process.env.NODE_ENV === "development" && process.env.TAMAGUI_IMAGE_CHECK_ERROR && React.useEffect(function() {
26
+ async function run() {
27
+ if (typeof src == "string")
28
+ try {
29
+ await fetch(src).then(function(res) {
37
30
  return res.text();
38
31
  });
39
32
  } catch {
@@ -41,23 +34,27 @@ var StyledImage = styled(RNImage, {
41
34
  props
42
35
  });
43
36
  }
44
- }
45
- run();
46
- }, [src]), finalSource.default && (finalSource = finalSource.default);
47
- }
48
- return /* @__PURE__ */_jsx(RNImage, {
49
- resizeMode: objectFit,
50
- ref,
51
- source: finalSource,
52
- style,
53
- ...rest
54
- });
37
+ }
38
+ run();
39
+ }, [
40
+ src
41
+ ]), finalSource.default && (finalSource = finalSource.default);
42
+ }
43
+ return /* @__PURE__ */ _jsx(RNImage, {
44
+ resizeMode: objectFit,
45
+ ref,
46
+ source: finalSource,
47
+ style,
48
+ ...rest
55
49
  });
50
+ });
56
51
  Image.getSize = RNImage.getSize;
57
52
  Image.getSizeWithHeaders = RNImage.getSizeWithHeaders;
58
53
  Image.prefetch = RNImage.prefetch;
59
54
  Image.prefetchWithMetadata = RNImage.prefetchWithMetadata;
60
55
  Image.abortPrefetch = RNImage.abortPrefetch;
61
56
  Image.queryCache = RNImage.queryCache;
62
- export { Image };
63
- //# sourceMappingURL=Image.native.js.map
57
+ export {
58
+ Image
59
+ };
60
+ //# sourceMappingURL=Image.js.map
@@ -1 +1,6 @@
1
- {"version":3,"names":["jsx","_jsx","React","isWeb","styled","usePropsAndStyle","Image","RNImage","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","error","default","resizeMode"],"sources":["../../src/Image.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAAOA,GAAA,IAAAC,IAAW;AAClB,OAAAC,KAAS,aAAa;AAQtB,SAASC,KAAA,QAAQ,oBAAwB;AAEzC,SAASC,MAAA,EAAAC,gBAAwB;AAiH7B,SAAAC,KAAA,IAAAC,OAAA;AA/GJ,IAAAC,WAAM,GAAAJ,MAAc,CAAAG,OAAO;IACzBE,IAAA,EAAM;EACR,CAAC;EAAAC,SAAA;EAAAJ,KAAA,GAAAE,WAAA,CAAAG,SAAA,WAAAC,OAAA,EAAAC,GAAA;IAmCD,IAAI,CAAAC,KAAA,EAAAC,KAAY,IAAAV,gBAAA,CAAAO,OAAA;MAAA;QAAAI,GAAA;QAAAC,MAAA;QAAAC,SAAA;QAAA,GAAAC;MAAA,IAAAL,KAAA;IAETM,OAAM,CAAAC,GAAA,CAAQC,QAAA,KAAY,aAAuB,WAASN,GAAQ,wBAAAF,KAAA,CAAAS,KAAA,gBAAAT,KAAA,CAAAS,KAAA,sBAAAT,KAAA,CAAAU,MAAA,gBAAAV,KAAA,CAAAU,MAAA,iBAAAd,SAAA,KAAAA,SAAA,OAAAe,OAAA,CAAAC,IAAA;IACvE,IAAAC,WAAc,UAASX,GAAA,YAAiB;MAGpCY,GAAA,EAAAZ,GAAQ;MASF,IAAAb,KAAA;QACFoB,KAAA,EAAAT,KAAA,CAAAS,KAAA,IAAAR,KAAA,EAAAQ,KAAA;QAMJC,MAAA,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J,QAAQC,IAAIC,aAAa,iBAAiBF,QAAQC,IAAIU,6BAExD7B,MAAM8B,UAAU,WAAA;AACd,qBAAeC,MAAAA;AACb,YAAI,OAAOjB,OAAQ;AACjB,cAAI;AACF,kBAAMkB,MAAMlB,GAAAA,EAAKmB,KAAK,SAACC,KAAAA;qBAAQA,IAAIC,KAAI;;UACzC,QAAc;AACZZ,oBAAQa,MAAM,wBAAwBtB,GAAAA,IAAO;cAAEF;YAAM,CAAA;UACvD;MAEJ;AAEAmB,UAAAA;IACF,GAAG;MAACjB;KAAI,GAINW,YAAY,YACdA,cAAcA,YAAY;EAE9B;AAGA,SACE,qBAACpB,SAAAA;IACCgC,YAAYrB;IACZL;IACAI,QAAQU;IACRZ;IACC,GAAII;;AAGX,CAAA;AAEAb,MAAMkC,UAAUjC,QAAQiC;AACxBlC,MAAMmC,qBAAqBlC,QAAQkC;AACnCnC,MAAMoC,WAAWnC,QAAQmC;AACzBpC,MAAMqC,uBAAuBpC,QAAQoC;AACrCrC,MAAMsC,gBAAgBrC,QAAQqC;AAC9BtC,MAAMuC,aAAatC,QAAQsC;",
5
+ "names": ["React", "isWeb", "styled", "usePropsAndStyle", "Image", "RNImage", "StyledImage", "name", "hasWarned", "styleable", "inProps", "ref", "props", "style", "src", "source", "objectFit", "rest", "process", "env", "NODE_ENV", "width", "height", "console", "warn", "finalSource", "uri", "Array", "isArray", "TAMAGUI_IMAGE_CHECK_ERROR", "useEffect", "run", "fetch", "then", "res", "text", "error", "resizeMode", "getSize", "getSizeWithHeaders", "prefetch", "prefetchWithMetadata", "abortPrefetch", "queryCache"]
6
+ }
@@ -1,2 +1,2 @@
1
- export * from "./Image.native.js";
2
- //# sourceMappingURL=index.native.js.map
1
+ export * from "./Image";
2
+ //# sourceMappingURL=index.js.map
@@ -1 +1,6 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/code/ui/image/src/index.ts"],
4
+ "mappings": "AAAA,cAAc;",
5
+ "names": []
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/image",
3
- "version": "1.113.1",
3
+ "version": "1.114.0",
4
4
  "sideEffects": [
5
5
  "*.css"
6
6
  ],
@@ -33,14 +33,14 @@
33
33
  }
34
34
  },
35
35
  "dependencies": {
36
- "@tamagui/constants": "1.113.1",
37
- "@tamagui/core": "1.113.1"
36
+ "@tamagui/constants": "1.114.0",
37
+ "@tamagui/core": "1.114.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "react": "*"
41
41
  },
42
42
  "devDependencies": {
43
- "@tamagui/build": "1.113.1",
43
+ "@tamagui/build": "1.114.0",
44
44
  "react": "^18.2.0 || ^19.0.0",
45
45
  "react-native": "0.74.1"
46
46
  },