@tamagui/image 1.114.3 → 1.115.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.
@@ -2,71 +2,85 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
6
7
  var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
15
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
21
  // If the importer is in node compatibility mode or this is not an ESM
17
22
  // file that has been converted to a CommonJS file using a Babel-
18
23
  // compatible transform (i.e. "__esModule" has not been set), then set
19
24
  // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
23
32
  var Image_exports = {};
24
33
  __export(Image_exports, {
25
34
  Image: () => Image
26
35
  });
27
36
  module.exports = __toCommonJS(Image_exports);
28
- var import_react = __toESM(require("react")), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_react_native = require("react-native-web"), import_jsx_runtime = require("react/jsx-runtime");
37
+ var import_react = __toESM(require("react")),
38
+ import_constants = require("@tamagui/constants"),
39
+ import_core = require("@tamagui/core"),
40
+ import_react_native = require("react-native-web"),
41
+ import_jsx_runtime = require("react/jsx-runtime");
29
42
  const StyledImage = (0, import_core.styled)(import_react_native.Image, {
30
43
  name: "Image"
31
44
  });
32
45
  let hasWarned = !1;
33
46
  const Image = StyledImage.styleable((inProps, ref) => {
34
- const [props, style] = (0, import_core.usePropsAndStyle)(inProps), { src, source, objectFit, ...rest } = props;
35
- 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(
36
- '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.'
37
- )));
47
+ const [props, style] = (0, import_core.usePropsAndStyle)(inProps),
48
+ {
49
+ src,
50
+ source,
51
+ objectFit,
52
+ ...rest
53
+ } = props;
54
+ 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.')));
38
55
  let finalSource = typeof src == "string" ? {
39
56
  uri: src,
40
- ...import_constants.isWeb && {
57
+ ...(import_constants.isWeb && {
41
58
  width: props.width || style?.width,
42
59
  height: props.height || style?.height
43
- }
60
+ })
44
61
  } : source ?? src;
45
62
  return finalSource && typeof finalSource == "object" && (process.env.NODE_ENV === "development" && process.env.TAMAGUI_IMAGE_CHECK_ERROR && import_react.default.useEffect(() => {
46
63
  async function run() {
47
- if (typeof src == "string")
48
- try {
49
- await fetch(src).then((res) => res.text());
50
- } catch {
51
- console.error(`Error loading image: ${src}`, { props });
52
- }
64
+ if (typeof src == "string") try {
65
+ await fetch(src).then(res => res.text());
66
+ } catch {
67
+ console.error(`Error loading image: ${src}`, {
68
+ props
69
+ });
70
+ }
53
71
  }
54
72
  run();
55
- }, [src]), finalSource.default && (finalSource = finalSource.default)), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
56
- import_react_native.Image,
57
- {
58
- resizeMode: objectFit,
59
- ref,
60
- source: finalSource,
61
- style,
62
- ...rest
63
- }
64
- );
73
+ }, [src]), finalSource.default && (finalSource = finalSource.default)), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.Image, {
74
+ resizeMode: objectFit,
75
+ ref,
76
+ source: finalSource,
77
+ style,
78
+ ...rest
79
+ });
65
80
  });
66
81
  Image.getSize = import_react_native.Image.getSize;
67
82
  Image.getSizeWithHeaders = import_react_native.Image.getSizeWithHeaders;
68
83
  Image.prefetch = import_react_native.Image.prefetch;
69
84
  Image.prefetchWithMetadata = import_react_native.Image.prefetchWithMetadata;
70
85
  Image.abortPrefetch = import_react_native.Image.abortPrefetch;
71
- Image.queryCache = import_react_native.Image.queryCache;
72
- //# sourceMappingURL=Image.js.map
86
+ Image.queryCache = import_react_native.Image.queryCache;
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
+ get: () => from[key],
8
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
+ });
10
+ return to;
11
+ },
12
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
+ value: !0
15
+ }), mod);
16
+ var src_exports = {};
17
+ module.exports = __toCommonJS(src_exports);
18
+ __reExport(src_exports, require("./Image.cjs"), module.exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/image",
3
- "version": "1.114.3",
3
+ "version": "1.115.0",
4
4
  "sideEffects": [
5
5
  "*.css"
6
6
  ],
@@ -29,18 +29,19 @@
29
29
  "react-native": "./dist/cjs/index.native.js",
30
30
  "types": "./types/index.d.ts",
31
31
  "import": "./dist/esm/index.mjs",
32
- "require": "./dist/cjs/index.js"
32
+ "require": "./dist/cjs/index.cjs",
33
+ "default": "./dist/cjs/index.native.js"
33
34
  }
34
35
  },
35
36
  "dependencies": {
36
- "@tamagui/constants": "1.114.3",
37
- "@tamagui/core": "1.114.3"
37
+ "@tamagui/constants": "1.115.0",
38
+ "@tamagui/core": "1.115.0"
38
39
  },
39
40
  "peerDependencies": {
40
41
  "react": "*"
41
42
  },
42
43
  "devDependencies": {
43
- "@tamagui/build": "1.114.3",
44
+ "@tamagui/build": "1.115.0",
44
45
  "react": "^18.2.0 || ^19.0.0",
45
46
  "react-native": "0.74.1"
46
47
  },
package/dist/cjs/index.js DELETED
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function")
7
- for (let key of __getOwnPropNames(from))
8
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
- return to;
10
- }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
- var src_exports = {};
13
- module.exports = __toCommonJS(src_exports);
14
- __reExport(src_exports, require("./Image"), module.exports);
15
- //# sourceMappingURL=index.js.map
File without changes
File without changes