@tamagui/image 2.0.0-rc.4 → 2.0.0-rc.40
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/cjs/Image.cjs +42 -40
- package/dist/cjs/Image.native.js +17 -15
- package/dist/cjs/Image.native.js.map +1 -1
- package/dist/cjs/createImage.cjs +123 -88
- package/dist/cjs/createImage.native.js +128 -95
- package/dist/cjs/createImage.native.js.map +1 -1
- package/dist/cjs/index.cjs +7 -5
- package/dist/cjs/index.native.js +7 -5
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/types.cjs +7 -5
- package/dist/cjs/types.native.js +7 -5
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/v1/Image.cjs +63 -48
- package/dist/cjs/v1/Image.native.js +91 -73
- package/dist/cjs/v1/Image.native.js.map +1 -1
- package/dist/cjs/v1/index.cjs +7 -5
- package/dist/cjs/v1/index.native.js +7 -5
- package/dist/cjs/v1/index.native.js.map +1 -1
- package/dist/esm/Image.mjs +28 -28
- package/dist/esm/Image.mjs.map +1 -1
- package/dist/esm/createImage.mjs +109 -76
- package/dist/esm/createImage.mjs.map +1 -1
- package/dist/esm/createImage.native.js +113 -82
- package/dist/esm/createImage.native.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -6
- package/dist/esm/v1/Image.mjs +34 -21
- package/dist/esm/v1/Image.mjs.map +1 -1
- package/dist/esm/v1/Image.native.js +62 -46
- package/dist/esm/v1/Image.native.js.map +1 -1
- package/dist/jsx/Image.mjs +28 -28
- package/dist/jsx/Image.mjs.map +1 -1
- package/dist/jsx/Image.native.js +17 -15
- package/dist/jsx/Image.native.js.map +1 -1
- package/dist/jsx/createImage.mjs +109 -76
- package/dist/jsx/createImage.mjs.map +1 -1
- package/dist/jsx/createImage.native.js +128 -95
- package/dist/jsx/createImage.native.js.map +1 -1
- package/dist/jsx/index.js +2 -2
- package/dist/jsx/index.js.map +1 -6
- package/dist/jsx/index.native.js +7 -5
- package/dist/jsx/types.native.js +7 -5
- package/dist/jsx/v1/Image.mjs +34 -21
- package/dist/jsx/v1/Image.mjs.map +1 -1
- package/dist/jsx/v1/Image.native.js +91 -73
- package/dist/jsx/v1/Image.native.js.map +1 -1
- package/dist/jsx/v1/index.native.js +7 -5
- package/package.json +9 -12
- package/src/createImage.tsx +20 -6
- package/src/types.ts +1 -1
- package/types/Image.native.d.ts +1 -1
- package/types/createImage.d.ts +2 -2
- package/types/createImage.d.ts.map +1 -1
- package/types/types.d.ts +1 -1
- package/types/types.d.ts.map +1 -1
- package/dist/cjs/Image.js +0 -55
- package/dist/cjs/Image.js.map +0 -6
- package/dist/cjs/createImage.js +0 -127
- package/dist/cjs/createImage.js.map +0 -6
- package/dist/cjs/index.js +0 -16
- package/dist/cjs/index.js.map +0 -6
- package/dist/cjs/types.js +0 -14
- package/dist/cjs/types.js.map +0 -6
- package/dist/cjs/v1/Image.js +0 -72
- package/dist/cjs/v1/Image.js.map +0 -6
- package/dist/cjs/v1/index.js +0 -15
- package/dist/cjs/v1/index.js.map +0 -6
- package/dist/esm/Image.js +0 -40
- package/dist/esm/Image.js.map +0 -6
- package/dist/esm/createImage.js +0 -112
- package/dist/esm/createImage.js.map +0 -6
- package/dist/esm/types.js +0 -1
- package/dist/esm/types.js.map +0 -6
- package/dist/esm/v1/Image.js +0 -52
- package/dist/esm/v1/Image.js.map +0 -6
- package/dist/esm/v1/index.js +0 -2
- package/dist/esm/v1/index.js.map +0 -6
- package/dist/jsx/Image.js +0 -40
- package/dist/jsx/Image.js.map +0 -6
- package/dist/jsx/createImage.js +0 -112
- package/dist/jsx/createImage.js.map +0 -6
- package/dist/jsx/types.js +0 -1
- package/dist/jsx/types.js.map +0 -6
- package/dist/jsx/v1/Image.js +0 -52
- package/dist/jsx/v1/Image.js.map +0 -6
- package/dist/jsx/v1/index.js +0 -2
- package/dist/jsx/v1/index.js.map +0 -6
|
@@ -5,124 +5,157 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
23
|
+
value: true
|
|
22
24
|
}), mod);
|
|
23
25
|
var createImage_exports = {};
|
|
24
26
|
__export(createImage_exports, {
|
|
25
27
|
createImage: () => createImage
|
|
26
28
|
});
|
|
27
29
|
module.exports = __toCommonJS(createImage_exports);
|
|
28
|
-
var import_jsx_runtime = require("react/jsx-runtime")
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
var import_web = require("@tamagui/web");
|
|
32
|
+
var defaultObjectFitMap = function (objectFit) {
|
|
33
|
+
switch (objectFit) {
|
|
34
|
+
case "fill":
|
|
35
|
+
return "stretch";
|
|
36
|
+
case "none":
|
|
37
|
+
return "center";
|
|
38
|
+
case "scale-down":
|
|
39
|
+
return "contain";
|
|
40
|
+
case "contain":
|
|
41
|
+
return "contain";
|
|
42
|
+
default:
|
|
43
|
+
return "cover";
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var defaultTransformSource = function (props) {
|
|
47
|
+
var {
|
|
48
|
+
src,
|
|
49
|
+
source,
|
|
50
|
+
width,
|
|
51
|
+
height
|
|
52
|
+
} = props;
|
|
53
|
+
if (source) return source;
|
|
54
|
+
if (src && typeof src !== "string") return src;
|
|
55
|
+
return {
|
|
56
|
+
uri: src,
|
|
57
|
+
width,
|
|
58
|
+
height
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
function createImage(options) {
|
|
62
|
+
var {
|
|
63
|
+
Component,
|
|
64
|
+
mapObjectFitToResizeMode = defaultObjectFitMap,
|
|
65
|
+
resizeModePropName = "resizeMode",
|
|
66
|
+
objectPositionPropName,
|
|
67
|
+
transformSource = defaultTransformSource
|
|
68
|
+
} = options;
|
|
69
|
+
var inlinePropsSet = /* @__PURE__ */new Set(["source", "placeholder", "transition", "contentFit", "contentPosition", "cachePolicy", "recyclingKey", "allowDownscaling", "autoplay", "blurRadius", "priority", "placeholderContentFit", "responsivePolicy", "onLoadStart", "onProgress", "onLoadEnd"]);
|
|
70
|
+
var StyledImage = (0, import_web.styled)(Component, {
|
|
71
|
+
name: "Image"
|
|
72
|
+
}, {
|
|
73
|
+
inlineProps: inlinePropsSet
|
|
74
|
+
});
|
|
75
|
+
var ImageComponent = StyledImage.styleable(function (incomingProps, ref) {
|
|
76
|
+
var props = incomingProps;
|
|
45
77
|
var {
|
|
46
78
|
src,
|
|
47
|
-
source,
|
|
48
79
|
width,
|
|
49
|
-
height
|
|
80
|
+
height,
|
|
81
|
+
borderRadius,
|
|
82
|
+
objectFit,
|
|
83
|
+
objectPosition,
|
|
84
|
+
// web only props - filter out on native
|
|
85
|
+
decoding,
|
|
86
|
+
elementTiming,
|
|
87
|
+
fetchpriority,
|
|
88
|
+
isMap,
|
|
89
|
+
loading,
|
|
90
|
+
sizes,
|
|
91
|
+
useMap,
|
|
92
|
+
onLoad,
|
|
93
|
+
onError,
|
|
94
|
+
...rest
|
|
50
95
|
} = props;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
96
|
+
var resolvedWidth = typeof width === "string" && width[0] === "$" ? (0, import_web.getTokenValue)(width, "size") : width;
|
|
97
|
+
var resolvedHeight = typeof height === "string" && height[0] === "$" ? (0, import_web.getTokenValue)(height, "size") : height;
|
|
98
|
+
var finalSource = transformSource({
|
|
99
|
+
src,
|
|
100
|
+
width: resolvedWidth,
|
|
101
|
+
height: resolvedHeight
|
|
55
102
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
inlinePropsSet = /* @__PURE__ */new Set(["source", "placeholder", "transition", "contentFit", "contentPosition", "cachePolicy", "recyclingKey", "allowDownscaling", "autoplay", "blurRadius", "priority", "placeholderContentFit", "responsivePolicy", "onLoadStart", "onProgress", "onLoadEnd"]),
|
|
66
|
-
StyledImage = (0, import_web.styled)(Component, {
|
|
67
|
-
name: "Image"
|
|
68
|
-
}, {
|
|
69
|
-
inlineProps: inlinePropsSet
|
|
70
|
-
}),
|
|
71
|
-
ImageComponent = StyledImage.styleable(function (incomingProps, ref) {
|
|
72
|
-
var props = incomingProps,
|
|
73
|
-
{
|
|
74
|
-
src,
|
|
75
|
-
width,
|
|
76
|
-
height,
|
|
77
|
-
objectFit,
|
|
78
|
-
objectPosition,
|
|
79
|
-
// web only props - filter out on native
|
|
80
|
-
decoding,
|
|
81
|
-
elementTiming,
|
|
82
|
-
fetchpriority,
|
|
83
|
-
isMap,
|
|
84
|
-
loading,
|
|
85
|
-
sizes,
|
|
86
|
-
useMap,
|
|
87
|
-
onLoad,
|
|
88
|
-
onError,
|
|
89
|
-
...rest
|
|
90
|
-
} = props,
|
|
91
|
-
resolvedWidth = typeof width == "string" && width[0] === "$" ? (0, import_web.getTokenValue)(width) : width,
|
|
92
|
-
resolvedHeight = typeof height == "string" && height[0] === "$" ? (0, import_web.getTokenValue)(height) : height,
|
|
93
|
-
finalSource = transformSource({
|
|
94
|
-
src,
|
|
95
|
-
width: resolvedWidth,
|
|
96
|
-
height: resolvedHeight
|
|
103
|
+
var incomingStyle = Array.isArray(rest.style) ? Object.assign({}, ...rest.style.flat()) : rest.style;
|
|
104
|
+
var resolvedBorderRadius = typeof borderRadius === "string" && borderRadius[0] === "$" ? (0, import_web.getTokenValue)(borderRadius, "radius") : borderRadius;
|
|
105
|
+
var finalProps = {
|
|
106
|
+
...rest,
|
|
107
|
+
source: finalSource,
|
|
108
|
+
style: {
|
|
109
|
+
...incomingStyle,
|
|
110
|
+
...(resolvedBorderRadius !== void 0 && {
|
|
111
|
+
borderRadius: resolvedBorderRadius
|
|
97
112
|
}),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
113
|
+
...(resolvedWidth !== void 0 && {
|
|
114
|
+
width: resolvedWidth
|
|
115
|
+
}),
|
|
116
|
+
...(resolvedHeight !== void 0 && {
|
|
117
|
+
height: resolvedHeight
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
if (objectFit) {
|
|
122
|
+
finalProps[resizeModePropName] = mapObjectFitToResizeMode(objectFit);
|
|
123
|
+
}
|
|
124
|
+
if (objectPositionPropName && objectPosition) {
|
|
125
|
+
finalProps[objectPositionPropName] = objectPosition;
|
|
126
|
+
}
|
|
127
|
+
if (onLoad) {
|
|
128
|
+
finalProps.onLoad = function (e) {
|
|
129
|
+
var _e_nativeEvent;
|
|
130
|
+
var source = (e === null || e === void 0 ? void 0 : (_e_nativeEvent = e.nativeEvent) === null || _e_nativeEvent === void 0 ? void 0 : _e_nativeEvent.source) || (e === null || e === void 0 ? void 0 : e.source) || {};
|
|
109
131
|
onLoad({
|
|
110
132
|
target: {
|
|
111
|
-
naturalHeight: source
|
|
112
|
-
naturalWidth: source
|
|
133
|
+
naturalHeight: source === null || source === void 0 ? void 0 : source.height,
|
|
134
|
+
naturalWidth: source === null || source === void 0 ? void 0 : source.width
|
|
113
135
|
},
|
|
114
136
|
type: "load"
|
|
115
137
|
});
|
|
116
|
-
}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
if (onError) {
|
|
141
|
+
finalProps.onError = function () {
|
|
117
142
|
onError({
|
|
118
143
|
type: "error"
|
|
119
144
|
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(Component, {
|
|
148
|
+
ref,
|
|
149
|
+
...finalProps
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
var comp = Component;
|
|
153
|
+
ImageComponent.getSize = comp.getSize || function () {};
|
|
154
|
+
ImageComponent.getSizeWithHeaders = comp.getSizeWithHeaders || function () {};
|
|
155
|
+
ImageComponent.prefetch = comp.prefetch || function () {};
|
|
156
|
+
ImageComponent.prefetchWithMetadata = comp.prefetchWithMetadata || function () {};
|
|
157
|
+
ImageComponent.abortPrefetch = comp.abortPrefetch || function () {};
|
|
158
|
+
ImageComponent.queryCache = comp.queryCache || function () {};
|
|
159
|
+
return ImageComponent;
|
|
127
160
|
}
|
|
128
161
|
//# sourceMappingURL=createImage.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","createImage_exports","createImage","module","exports","import_jsx_runtime","require","import_web","defaultObjectFitMap","objectFit","defaultTransformSource","props","src","source","width","height","uri","options","Component","mapObjectFitToResizeMode","resizeModePropName","objectPositionPropName","transformSource","inlinePropsSet","Set","StyledImage","styled","inlineProps","ImageComponent","styleable","incomingProps","ref","objectPosition","decoding","elementTiming","fetchpriority","isMap","loading","sizes","useMap","onLoad","onError","rest","resolvedWidth","getTokenValue","resolvedHeight","finalSource","
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","createImage_exports","createImage","module","exports","import_jsx_runtime","require","import_web","defaultObjectFitMap","objectFit","defaultTransformSource","props","src","source","width","height","uri","options","Component","mapObjectFitToResizeMode","resizeModePropName","objectPositionPropName","transformSource","inlinePropsSet","Set","StyledImage","styled","inlineProps","ImageComponent","styleable","incomingProps","ref","borderRadius","objectPosition","decoding","elementTiming","fetchpriority","isMap","loading","sizes","useMap","onLoad","onError","rest","resolvedWidth","getTokenValue","resolvedHeight","finalSource","incomingStyle","Array","isArray","style","assign","flat","resolvedBorderRadius","finalProps","e","_e_nativeEvent","nativeEvent","naturalHeight","naturalWidth","type"],"sources":["../../src/createImage.tsx"],"sourcesContent":[null],"mappings":"AAAA,YAAS;;AAuOE,IAAAA,SAAA,GAAAC,MAAA,CAAAC,cAAA;AA7LX,IAAAC,gBAAM,GAAAF,MAAuB,CAAAG,wBAAuC;AAClE,IAAAC,iBAAmB,GAAAJ,MAAA,CAAAK,mBAAA;AAAA,IACjBC,YAAK,GAAAN,MAAA,CAAAO,SAAA,CAAAC,cAAA;AACH,IAAAC,QAAA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A,CAAAb,OAAA;QAEvDA,OAAO;UACTmB,IAAA","ignoreList":[]}
|
package/dist/jsx/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./Image";
|
|
2
|
-
export * from "./createImage";
|
|
1
|
+
export * from "./Image.mjs";
|
|
2
|
+
export * from "./createImage.mjs";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/jsx/index.js.map
CHANGED
package/dist/jsx/index.native.js
CHANGED
|
@@ -5,15 +5,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
9
10
|
get: () => from[key],
|
|
10
11
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
12
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
17
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value:
|
|
18
|
+
value: true
|
|
17
19
|
}), mod);
|
|
18
20
|
var index_exports = {};
|
|
19
21
|
module.exports = __toCommonJS(index_exports);
|
package/dist/jsx/types.native.js
CHANGED
|
@@ -5,14 +5,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
10
|
+
get: () => from[key],
|
|
11
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
12
|
+
});
|
|
13
|
+
}
|
|
12
14
|
return to;
|
|
13
15
|
};
|
|
14
16
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
15
|
-
value:
|
|
17
|
+
value: true
|
|
16
18
|
}), mod);
|
|
17
19
|
var types_exports = {};
|
|
18
20
|
module.exports = __toCommonJS(types_exports);
|
package/dist/jsx/v1/Image.mjs
CHANGED
|
@@ -6,35 +6,48 @@ import { jsx } from "react/jsx-runtime";
|
|
|
6
6
|
const StyledImage = styled(RNImage, {
|
|
7
7
|
name: "Image"
|
|
8
8
|
});
|
|
9
|
-
let hasWarned =
|
|
9
|
+
let hasWarned = false;
|
|
10
10
|
const Image = StyledImage.styleable((inProps, ref) => {
|
|
11
|
-
const [props, style] = usePropsAndStyle(inProps)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
process.env.NODE_ENV === "development"
|
|
19
|
-
|
|
11
|
+
const [props, style] = usePropsAndStyle(inProps);
|
|
12
|
+
const {
|
|
13
|
+
src,
|
|
14
|
+
source,
|
|
15
|
+
objectFit,
|
|
16
|
+
...rest
|
|
17
|
+
} = props;
|
|
18
|
+
if (process.env.NODE_ENV === "development") {
|
|
19
|
+
if (typeof src === "string") {
|
|
20
|
+
if (typeof props.width === "string" && props.width[0] !== "$" || typeof props.height === "string" && props.height[0] !== "$") {
|
|
21
|
+
if (!hasWarned) {
|
|
22
|
+
hasWarned = true;
|
|
23
|
+
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.`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
let finalSource = typeof src === "string" ? {
|
|
20
29
|
uri: src,
|
|
21
30
|
...(isWeb && {
|
|
22
31
|
width: props.width || style?.width,
|
|
23
32
|
height: props.height || style?.height
|
|
24
33
|
})
|
|
25
34
|
} : source ?? src;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
if (finalSource && typeof finalSource === "object") {
|
|
36
|
+
if (process.env.NODE_ENV === "development" && process.env.TAMAGUI_IMAGE_CHECK_ERROR) React.useEffect(() => {
|
|
37
|
+
async function run() {
|
|
38
|
+
if (typeof src === "string") try {
|
|
39
|
+
await fetch(src).then(res => res.text());
|
|
40
|
+
} catch (err) {
|
|
41
|
+
console.error(`Error loading image: ${src}`, {
|
|
42
|
+
props
|
|
43
|
+
});
|
|
44
|
+
}
|
|
34
45
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
run();
|
|
47
|
+
}, [src]);
|
|
48
|
+
if (finalSource["default"]) finalSource = finalSource["default"];
|
|
49
|
+
}
|
|
50
|
+
return /* @__PURE__ */jsx(RNImage, {
|
|
38
51
|
resizeMode: objectFit,
|
|
39
52
|
ref,
|
|
40
53
|
source: finalSource,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","isWeb","styled","usePropsAndStyle","Image","RNImage","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","
|
|
1
|
+
{"version":3,"names":["React","isWeb","styled","usePropsAndStyle","Image","RNImage","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":["../../../src/v1/Image.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAClB,SAASC,KAAA,QAAa;AAQtB,SAASC,MAAA,EAAQC,gBAAA,QAAwB;AAEzC,SAASC,KAAA,IAASC,OAAA,QAAe;AAqH7B,SAAAC,GAAA;AAnHJ,MAAMC,WAAA,GAAcL,MAAA,CAAOG,OAAA,EAAS;EAAAG,IAAA;AAAA;AAAA,IAClCC,SAAM;AACR,MAACL,KAAA,GAAAG,WAAA,CAAAG,SAAA,EAAAC,OAAA,EAAAC,GAAA;EAmCD,MAAI,CAAAC,KAAA,EAAAC,KAAY,IAAAX,gBAAA,CAAAQ,OAAA;EAMT,MAAM;IAAAI,GAAA;IAAQC,MAAA;IAAAC,SAAY;IAAA,GAAsBC;EAAC,IAAAL,KAAS;EAC/D,IAAAM,OAAO,CAAAC,GAAO,CAAAC,QAAS,kBAAiB;IACxC,WAAQN,GAAK,aAAQ;MAErB,IAAI,OAAQF,KAAI,CAAAS,KAAA,aAAa,IAAAT,KAAe,CAAAS,KAAA,sBAAAT,KAAA,CAAAU,MAAA,iBAAAV,KAAA,CAAAU,MAAA;QAC1C,IAAI,CAAAd,SAAO;UACTA,SACG,GAAO;UAGRe,OAAI,CAACC,IAAA,6IAAW;QACd;MACA;IAAQ;EACN;EACF,IAAAC,WACF,UAAAX,GAAA;IAAAY,GAAA,EACFZ,GAAA;IAAA,IACFd,KAAA;MACFqB,KAAA,EAAAT,KAAA,CAAAS,KAAA,IAAAR,KAAA,EAAAQ,KAAA;MAEAC,MAAI,EAAAV,KAAA,CAAAU,MACF,IAAOT,KAAA,EAAAS;IACH;EACO,IACLP,MAAI,IAAAD,GAAS;EAAA,IAAAW,WACJ,IAAM,OAAAA,WAAgB;IAAA,IAC7BP,OAAA,CAAQC,GAAA,CAAAC,QAAM,KAAU,aAAO,IAAAF,OAAA,CAAAC,GAAA,CAAAQ,yBAAA,EAAA5B,KAAA,CAAA6B,SAAA;MAAA,eACjCC,IAAA;QACF,IACC,OAAAf,GAAU;UAEjB,MAAIgB,KAAA,CAAAhB,GAAA,CAAe,CAAAiB,IAAA,CAAOC,GAAA,IAAAA,GAAA,CAAAC,IAAgB;QACxC,SAAIC,GAAQ;UAEVX,OAAK,CAAAY,KAAM,yBAAsBrB,GAAA;YAAAF;UAAA;QAC/B;MACE;MACAiB,GAAA;IAEE,IAAAf,GAAA;IAEA,IAAAW,WAAA,CAAM,YAAWA,WAAO,GAAAA,WAAA;EAAA;EAC1B,OACF,eAAApB,GAAA,CAAAD,OAAA;IAAAgC,UACF,EAAApB,SAAA;IAAAL,GACF;IAEAI,MAAI,EAAAU,WAAY;IAEdZ,KAAA;IACE,GAAAI;EACE;AACE;AACEd,KAAA,CAAAkC,OAAA,GAAAjC,OAAM,CAAAiC,OAAW;AAAwBlC,KAAA,CAAAmC,kBAClC,GAAKlC,OAAA,CAAAkC,kBAAA;AACZnC,KAAA,CAAAoC,QAAA,GAAAnC,OAAQ,CAAAmC,QAAM;AAAwCpC,KAAA,CAAAqC,oBACxD,GAAApC,OAAA,CAAAoC,oBAAA;AAAArC,KAAA,CAAAsC,aACF,GAAArC,OAAA,CAAAqC,aAAA;AAAAtC,KAAA,CAAAuC,UACF,GAAAtC,OAAA,CAAAsC,UAAA;AAEA,SAAAvC,KAAI","ignoreList":[]}
|
|
@@ -4,98 +4,116 @@ var __create = Object.create;
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
8
|
-
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
18
|
get: () => from[key],
|
|
18
19
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
22
24
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
+
value: true
|
|
35
|
+
}), mod);
|
|
34
36
|
var Image_exports = {};
|
|
35
37
|
__export(Image_exports, {
|
|
36
38
|
Image: () => Image
|
|
37
39
|
});
|
|
38
40
|
module.exports = __toCommonJS(Image_exports);
|
|
39
|
-
var import_jsx_runtime = require("react/jsx-runtime")
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var import_react = __toESM(require("react"), 1);
|
|
43
|
+
var import_constants = require("@tamagui/constants");
|
|
44
|
+
var import_web = require("@tamagui/web");
|
|
45
|
+
var import_react_native = require("react-native");
|
|
44
46
|
function _type_of(obj) {
|
|
45
47
|
"@swc/helpers - typeof";
|
|
46
48
|
|
|
47
|
-
return obj && typeof Symbol
|
|
49
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
48
50
|
}
|
|
49
51
|
var StyledImage = (0, import_web.styled)(import_react_native.Image, {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} : source ?? src;
|
|
69
|
-
if (finalSource && (typeof finalSource > "u" ? "undefined" : _type_of(finalSource)) === "object") {
|
|
70
|
-
if (!Array.isArray(finalSource) && typeof finalSource.uri == "number" && (finalSource = finalSource.uri, source && (typeof source > "u" ? "undefined" : _type_of(source)) === "object" && !Array.isArray(source))) {
|
|
71
|
-
var _style, _style1, _width;
|
|
72
|
-
(_width = (_style = style).width) !== null && _width !== void 0 || (_style.width = source.width);
|
|
73
|
-
var _height;
|
|
74
|
-
(_height = (_style1 = style).height) !== null && _height !== void 0 || (_style1.height = source.height);
|
|
52
|
+
name: "Image"
|
|
53
|
+
});
|
|
54
|
+
var hasWarned = false;
|
|
55
|
+
var Image = StyledImage.styleable(function (inProps, ref) {
|
|
56
|
+
var [props, style] = (0, import_web.usePropsAndStyle)(inProps);
|
|
57
|
+
var {
|
|
58
|
+
src,
|
|
59
|
+
source,
|
|
60
|
+
objectFit,
|
|
61
|
+
...rest
|
|
62
|
+
} = props;
|
|
63
|
+
if (process.env.NODE_ENV === "development") {
|
|
64
|
+
if (typeof src === "string") {
|
|
65
|
+
if (typeof props.width === "string" && props.width[0] !== "$" || typeof props.height === "string" && props.height[0] !== "$") {
|
|
66
|
+
if (!hasWarned) {
|
|
67
|
+
hasWarned = true;
|
|
68
|
+
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.`);
|
|
69
|
+
}
|
|
75
70
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
var finalSource = typeof src === "string" ? {
|
|
74
|
+
uri: src,
|
|
75
|
+
...(import_constants.isWeb && {
|
|
76
|
+
width: props.width || (style === null || style === void 0 ? void 0 : style.width),
|
|
77
|
+
height: props.height || (style === null || style === void 0 ? void 0 : style.height)
|
|
78
|
+
})
|
|
79
|
+
} : source !== null && source !== void 0 ? source : src;
|
|
80
|
+
if (finalSource && (typeof finalSource === "undefined" ? "undefined" : _type_of(finalSource)) === "object") {
|
|
81
|
+
if (!Array.isArray(finalSource)) {
|
|
82
|
+
if (typeof finalSource.uri === "number") {
|
|
83
|
+
finalSource = finalSource.uri;
|
|
84
|
+
if (source && (typeof source === "undefined" ? "undefined" : _type_of(source)) === "object" && !Array.isArray(source)) {
|
|
85
|
+
var _style, _style1;
|
|
86
|
+
var _width;
|
|
87
|
+
(_width = (_style = style).width) !== null && _width !== void 0 || (_style.width = source.width);
|
|
88
|
+
var _height;
|
|
89
|
+
(_height = (_style1 = style).height) !== null && _height !== void 0 || (_style1.height = source.height);
|
|
87
90
|
}
|
|
88
|
-
|
|
89
|
-
}, [src]), finalSource.default && (finalSource = finalSource.default);
|
|
91
|
+
}
|
|
90
92
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
if (process.env.NODE_ENV === "development" && process.env.TAMAGUI_IMAGE_CHECK_ERROR) import_react.default.useEffect(function () {
|
|
94
|
+
async function run() {
|
|
95
|
+
if (typeof src === "string") try {
|
|
96
|
+
await fetch(src).then(function (res) {
|
|
97
|
+
return res.text();
|
|
98
|
+
});
|
|
99
|
+
} catch (err) {
|
|
100
|
+
console.error(`Error loading image: ${src}`, {
|
|
101
|
+
props
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
run();
|
|
106
|
+
}, [src]);
|
|
107
|
+
if (finalSource["default"]) finalSource = finalSource["default"];
|
|
108
|
+
}
|
|
109
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.Image, {
|
|
110
|
+
resizeMode: objectFit,
|
|
111
|
+
ref,
|
|
112
|
+
source: finalSource,
|
|
113
|
+
style,
|
|
114
|
+
...rest
|
|
98
115
|
});
|
|
116
|
+
});
|
|
99
117
|
Image.getSize = import_react_native.Image.getSize;
|
|
100
118
|
Image.getSizeWithHeaders = import_react_native.Image.getSizeWithHeaders;
|
|
101
119
|
Image.prefetch = import_react_native.Image.prefetch;
|