@tamagui/image 2.7.7 → 3.0.0-beta.643.1
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 +25 -45
- package/dist/cjs/Image.native.cjs +29 -0
- package/dist/cjs/Image.native.js +16 -20
- package/dist/cjs/Image.native.js.map +1 -1
- package/dist/cjs/createImage.cjs +112 -145
- package/dist/cjs/createImage.native.cjs +133 -0
- package/dist/cjs/createImage.native.js +116 -145
- package/dist/cjs/createImage.native.js.map +1 -1
- package/dist/cjs/index.cjs +10 -11
- package/dist/cjs/index.native.cjs +22 -0
- package/dist/cjs/index.native.js +10 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/types.cjs +10 -11
- package/dist/cjs/types.native.cjs +19 -0
- package/dist/cjs/types.native.js +10 -10
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/esm/Image.mjs +13 -28
- package/dist/esm/Image.mjs.map +1 -1
- package/dist/esm/Image.native.js +4 -4
- package/dist/esm/Image.native.js.map +1 -1
- package/dist/esm/createImage.mjs +100 -128
- package/dist/esm/createImage.mjs.map +1 -1
- package/dist/esm/createImage.native.js +105 -130
- package/dist/esm/createImage.native.js.map +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/index.native.js +3 -3
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.native.js +0 -2
- package/dist/jsx/Image.mjs +13 -28
- package/dist/jsx/Image.mjs.map +1 -1
- package/dist/jsx/Image.native.cjs +29 -0
- package/dist/jsx/Image.native.js +16 -20
- package/dist/jsx/Image.native.js.map +1 -1
- package/dist/jsx/createImage.mjs +100 -128
- package/dist/jsx/createImage.mjs.map +1 -1
- package/dist/jsx/createImage.native.cjs +133 -0
- package/dist/jsx/createImage.native.js +116 -145
- package/dist/jsx/createImage.native.js.map +1 -1
- package/dist/jsx/index.js +3 -3
- package/dist/jsx/index.mjs +3 -3
- package/dist/jsx/index.native.cjs +22 -0
- package/dist/jsx/index.native.js +10 -10
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/types.mjs +0 -2
- package/dist/jsx/types.native.cjs +19 -0
- package/dist/jsx/types.native.js +10 -10
- package/dist/jsx/types.native.js.map +1 -1
- package/package.json +8 -7
- package/src/Image.tsx +5 -4
- package/src/createImage.tsx +99 -89
- package/types/Image.d.ts.map +1 -1
- package/types/Image.native.d.ts +4 -4
- package/types/Image.native.d.ts.map +1 -1
- package/types/createImage.d.ts +4 -4
- package/types/createImage.d.ts.map +1 -1
- package/dist/cjs/v1/Image.cjs +0 -101
- package/dist/cjs/v1/Image.native.js +0 -123
- package/dist/cjs/v1/Image.native.js.map +0 -1
- package/dist/cjs/v1/index.cjs +0 -20
- package/dist/cjs/v1/index.native.js +0 -23
- package/dist/cjs/v1/index.native.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
- package/dist/esm/types.native.js.map +0 -1
- package/dist/esm/v1/Image.mjs +0 -65
- package/dist/esm/v1/Image.mjs.map +0 -1
- package/dist/esm/v1/Image.native.js +0 -84
- package/dist/esm/v1/Image.native.js.map +0 -1
- package/dist/esm/v1/index.mjs +0 -2
- package/dist/esm/v1/index.mjs.map +0 -1
- package/dist/esm/v1/index.native.js +0 -2
- package/dist/esm/v1/index.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
- package/dist/jsx/types.mjs.map +0 -1
- package/dist/jsx/v1/Image.mjs +0 -65
- package/dist/jsx/v1/Image.mjs.map +0 -1
- package/dist/jsx/v1/Image.native.js +0 -123
- package/dist/jsx/v1/Image.native.js.map +0 -1
- package/dist/jsx/v1/index.mjs +0 -2
- package/dist/jsx/v1/index.mjs.map +0 -1
- package/dist/jsx/v1/index.native.js +0 -23
- package/dist/jsx/v1/index.native.js.map +0 -1
- package/src/v1/Image.tsx +0 -144
- package/src/v1/index.ts +0 -1
- package/types/v1/Image.d.ts +0 -36
- package/types/v1/Image.d.ts.map +0 -1
- package/types/v1/index.d.ts +0 -2
- package/types/v1/index.d.ts.map +0 -1
package/dist/cjs/Image.cjs
CHANGED
|
@@ -1,64 +1,44 @@
|
|
|
1
|
+
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
for (var name in all) __defProp(target, name, {
|
|
8
|
+
get: all[name],
|
|
9
|
+
enumerable: true
|
|
10
|
+
});
|
|
10
11
|
};
|
|
11
12
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
19
20
|
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
22
|
var Image_exports = {};
|
|
24
|
-
__export(Image_exports, {
|
|
25
|
-
Image: () => Image
|
|
26
|
-
});
|
|
23
|
+
__export(Image_exports, { Image: () => Image });
|
|
27
24
|
module.exports = __toCommonJS(Image_exports);
|
|
28
25
|
var import_web = require("@tamagui/web");
|
|
29
26
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
27
|
const StyledImage = (0, import_web.styled)(import_web.View, {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
const Image = StyledImage.styleable((inProps, ref) => {
|
|
35
|
-
const {
|
|
36
|
-
// exclude native only props
|
|
37
|
-
blurRadius,
|
|
38
|
-
capInsets,
|
|
39
|
-
defaultSource,
|
|
40
|
-
fadeDuration,
|
|
41
|
-
loadingIndicatorSource,
|
|
42
|
-
onLoadEnd,
|
|
43
|
-
onPartialLoad,
|
|
44
|
-
progressiveRenderingEnabled,
|
|
45
|
-
resizeMethod,
|
|
46
|
-
tintColor,
|
|
47
|
-
...rest
|
|
48
|
-
} = inProps;
|
|
49
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(StyledImage, {
|
|
50
|
-
ref,
|
|
51
|
-
...rest
|
|
52
|
-
});
|
|
53
|
-
}, {
|
|
54
|
-
staticConfig: {
|
|
55
|
-
memo: true
|
|
56
|
-
}
|
|
28
|
+
displayName: "Image",
|
|
29
|
+
render: "img"
|
|
57
30
|
});
|
|
58
|
-
const
|
|
31
|
+
const Image = (0, import_web.createStyledHOC)(StyledImage, (inProps, ref) => {
|
|
32
|
+
const { blurRadius, capInsets, defaultSource, fadeDuration, loadingIndicatorSource, onLoadEnd, onPartialLoad, progressiveRenderingEnabled, resizeMethod, tintColor, ...rest } = inProps;
|
|
33
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledImage, {
|
|
34
|
+
ref,
|
|
35
|
+
...rest
|
|
36
|
+
});
|
|
37
|
+
}, { staticConfig: { memo: true } });
|
|
38
|
+
const func = (() => {});
|
|
59
39
|
Image.getSize = func;
|
|
60
40
|
Image.getSizeWithHeaders = func;
|
|
61
41
|
Image.prefetch = func;
|
|
62
42
|
Image.prefetchWithMetadata = func;
|
|
63
43
|
Image.abortPrefetch = func;
|
|
64
|
-
Image.queryCache = func;
|
|
44
|
+
Image.queryCache = func;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var Image_native_exports = {};
|
|
25
|
+
__export(Image_native_exports, { Image: () => Image });
|
|
26
|
+
module.exports = __toCommonJS(Image_native_exports);
|
|
27
|
+
var import_react_native = require("react-native");
|
|
28
|
+
var import_createImage = require("./createImage.native.js");
|
|
29
|
+
var Image = (0, import_createImage.createImage)({ Component: import_react_native.Image });
|
package/dist/cjs/Image.native.js
CHANGED
|
@@ -1,35 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
12
13
|
};
|
|
13
14
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
21
22
|
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
24
|
var Image_native_exports = {};
|
|
26
|
-
__export(Image_native_exports, {
|
|
27
|
-
Image: () => Image
|
|
28
|
-
});
|
|
25
|
+
__export(Image_native_exports, { Image: () => Image });
|
|
29
26
|
module.exports = __toCommonJS(Image_native_exports);
|
|
30
27
|
var import_react_native = require("react-native");
|
|
31
28
|
var import_createImage = require("./createImage.native.js");
|
|
32
|
-
var Image = (0, import_createImage.createImage)({
|
|
33
|
-
|
|
34
|
-
});
|
|
29
|
+
var Image = (0, import_createImage.createImage)({ Component: import_react_native.Image });
|
|
30
|
+
|
|
35
31
|
//# sourceMappingURL=Image.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Image.native.js","names":[],"sources":["cjs/Image.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Image_native_exports = {};\n__export(Image_native_exports, {\n Image: () => Image\n});\nmodule.exports = __toCommonJS(Image_native_exports);\nvar import_react_native = require(\"react-native\");\nvar import_createImage = require(\"./createImage\");\nvar Image = (0, import_createImage.createImage)({\n Component: import_react_native.Image\n});\n//# sourceMappingURL=Image.native.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,uBAAuB,CAAC;AAC5B,SAAS,sBAAsB,EAC7B,aAAa,MACf,CAAC;AACD,OAAO,UAAU,aAAa,oBAAoB;AAClD,IAAI,sBAAsB,QAAQ,cAAc;AAChD,IAAI,qBAAqB,QAAQ,yBAAe;AAChD,IAAI,SAAS,GAAG,mBAAmB,aAAa,EAC9C,WAAW,oBAAoB,MACjC,CAAC"}
|
package/dist/cjs/createImage.cjs
CHANGED
|
@@ -1,160 +1,127 @@
|
|
|
1
|
+
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
for (var name in all) __defProp(target, name, {
|
|
8
|
+
get: all[name],
|
|
9
|
+
enumerable: true
|
|
10
|
+
});
|
|
10
11
|
};
|
|
11
12
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
19
20
|
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
22
|
var createImage_exports = {};
|
|
24
|
-
__export(createImage_exports, {
|
|
25
|
-
createImage: () => createImage
|
|
26
|
-
});
|
|
23
|
+
__export(createImage_exports, { createImage: () => createImage });
|
|
27
24
|
module.exports = __toCommonJS(createImage_exports);
|
|
28
25
|
var import_web = require("@tamagui/web");
|
|
29
26
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
-
const defaultObjectFitMap = objectFit => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
case "contain":
|
|
39
|
-
return "contain";
|
|
40
|
-
default:
|
|
41
|
-
return "cover";
|
|
42
|
-
}
|
|
27
|
+
const defaultObjectFitMap = (objectFit) => {
|
|
28
|
+
switch (objectFit) {
|
|
29
|
+
case "fill": return "stretch";
|
|
30
|
+
case "none": return "center";
|
|
31
|
+
case "scale-down": return "contain";
|
|
32
|
+
case "contain": return "contain";
|
|
33
|
+
default: return "cover";
|
|
34
|
+
}
|
|
43
35
|
};
|
|
44
|
-
const defaultTransformSource = props => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
if (source !== void 0 && source !== null) return source;
|
|
55
|
-
if (src !== void 0 && src !== null) return src;
|
|
56
|
-
return {
|
|
57
|
-
uri: src
|
|
58
|
-
};
|
|
36
|
+
const defaultTransformSource = (props) => {
|
|
37
|
+
const { src, source } = props;
|
|
38
|
+
if (typeof src === "string") {
|
|
39
|
+
return { uri: src };
|
|
40
|
+
}
|
|
41
|
+
if (source !== void 0 && source !== null) return source;
|
|
42
|
+
if (src !== void 0 && src !== null) return src;
|
|
43
|
+
return { uri: src };
|
|
59
44
|
};
|
|
60
45
|
function createImage(options) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
type: "error"
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(StyledImage, {
|
|
148
|
-
ref,
|
|
149
|
-
...finalProps
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
const comp = Component;
|
|
153
|
-
ImageComponent.getSize = comp.getSize || (() => {});
|
|
154
|
-
ImageComponent.getSizeWithHeaders = comp.getSizeWithHeaders || (() => {});
|
|
155
|
-
ImageComponent.prefetch = comp.prefetch || (() => {});
|
|
156
|
-
ImageComponent.prefetchWithMetadata = comp.prefetchWithMetadata || (() => {});
|
|
157
|
-
ImageComponent.abortPrefetch = comp.abortPrefetch || (() => {});
|
|
158
|
-
ImageComponent.queryCache = comp.queryCache || (() => {});
|
|
159
|
-
return ImageComponent;
|
|
160
|
-
}
|
|
46
|
+
const { Component, mapObjectFitToResizeMode = defaultObjectFitMap, resizeModePropName = "resizeMode", objectPositionPropName, transformSource = defaultTransformSource } = options;
|
|
47
|
+
const inlinePropsSet = /* @__PURE__ */ new Set([
|
|
48
|
+
"source",
|
|
49
|
+
"placeholder",
|
|
50
|
+
"transition",
|
|
51
|
+
"contentFit",
|
|
52
|
+
"contentPosition",
|
|
53
|
+
"cachePolicy",
|
|
54
|
+
"recyclingKey",
|
|
55
|
+
"allowDownscaling",
|
|
56
|
+
"autoplay",
|
|
57
|
+
"blurRadius",
|
|
58
|
+
"priority",
|
|
59
|
+
"placeholderContentFit",
|
|
60
|
+
"responsivePolicy",
|
|
61
|
+
"onLoadStart",
|
|
62
|
+
"onProgress",
|
|
63
|
+
"onLoadEnd"
|
|
64
|
+
]);
|
|
65
|
+
const StyledImage = (0, import_web.styled)(Component, { displayName: "Image" }, { inlineProps: inlinePropsSet });
|
|
66
|
+
const ImageComponent = (0, import_web.createStyledHOC)(StyledImage, (incomingProps, ref) => {
|
|
67
|
+
const props = incomingProps;
|
|
68
|
+
const { src, source, width, height, borderRadius, objectFit, objectPosition, decoding, elementTiming, fetchpriority, isMap, loading, sizes, useMap, onLoad, onError, ...rest } = props;
|
|
69
|
+
const resolvedWidth = typeof width === "string" ? (0, import_web.getTokenValue)(width, "size") ?? width : width;
|
|
70
|
+
const resolvedHeight = typeof height === "string" ? (0, import_web.getTokenValue)(height, "size") ?? height : height;
|
|
71
|
+
const finalSource = transformSource({
|
|
72
|
+
src,
|
|
73
|
+
source,
|
|
74
|
+
width: resolvedWidth,
|
|
75
|
+
height: resolvedHeight
|
|
76
|
+
});
|
|
77
|
+
const incomingStyle = Array.isArray(rest.style) ? Object.assign({}, ...rest.style.flat()) : rest.style;
|
|
78
|
+
const resolvedBorderRadius = typeof borderRadius === "string" ? (0, import_web.getTokenValue)(borderRadius, "radius") ?? borderRadius : borderRadius;
|
|
79
|
+
const finalProps = {
|
|
80
|
+
...rest,
|
|
81
|
+
source: finalSource,
|
|
82
|
+
style: {
|
|
83
|
+
...incomingStyle,
|
|
84
|
+
...resolvedBorderRadius !== void 0 && { borderRadius: resolvedBorderRadius },
|
|
85
|
+
...resolvedWidth !== void 0 && { width: resolvedWidth },
|
|
86
|
+
...resolvedHeight !== void 0 && { height: resolvedHeight },
|
|
87
|
+
...objectFit !== void 0 && { objectFit },
|
|
88
|
+
...objectPosition !== void 0 && { objectPosition }
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
if (objectFit) {
|
|
92
|
+
finalProps[resizeModePropName] = mapObjectFitToResizeMode(objectFit);
|
|
93
|
+
}
|
|
94
|
+
if (objectPositionPropName && objectPosition) {
|
|
95
|
+
finalProps[objectPositionPropName] = objectPosition;
|
|
96
|
+
}
|
|
97
|
+
if (onLoad) {
|
|
98
|
+
finalProps.onLoad = (e) => {
|
|
99
|
+
const source2 = e?.nativeEvent?.source || e?.source || {};
|
|
100
|
+
onLoad({
|
|
101
|
+
target: {
|
|
102
|
+
naturalHeight: source2?.height,
|
|
103
|
+
naturalWidth: source2?.width
|
|
104
|
+
},
|
|
105
|
+
type: "load"
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (onError) {
|
|
110
|
+
finalProps.onError = () => {
|
|
111
|
+
onError({ type: "error" });
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledImage, {
|
|
115
|
+
ref,
|
|
116
|
+
...finalProps
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
const comp = Component;
|
|
120
|
+
ImageComponent.getSize = comp.getSize || (() => {});
|
|
121
|
+
ImageComponent.getSizeWithHeaders = comp.getSizeWithHeaders || (() => {});
|
|
122
|
+
ImageComponent.prefetch = comp.prefetch || (() => {});
|
|
123
|
+
ImageComponent.prefetchWithMetadata = comp.prefetchWithMetadata || (() => {});
|
|
124
|
+
ImageComponent.abortPrefetch = comp.abortPrefetch || (() => {});
|
|
125
|
+
ImageComponent.queryCache = comp.queryCache || (() => {});
|
|
126
|
+
return ImageComponent;
|
|
127
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var createImage_exports = {};
|
|
25
|
+
__export(createImage_exports, { createImage: () => createImage });
|
|
26
|
+
module.exports = __toCommonJS(createImage_exports);
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
var import_web = require("@tamagui/web");
|
|
29
|
+
var defaultObjectFitMap = function(objectFit) {
|
|
30
|
+
switch (objectFit) {
|
|
31
|
+
case "fill": return "stretch";
|
|
32
|
+
case "none": return "center";
|
|
33
|
+
case "scale-down": return "contain";
|
|
34
|
+
case "contain": return "contain";
|
|
35
|
+
default: return "cover";
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var defaultTransformSource = function(props) {
|
|
39
|
+
var { src, source } = props;
|
|
40
|
+
if (typeof src === "string") {
|
|
41
|
+
return { uri: src };
|
|
42
|
+
}
|
|
43
|
+
if (source !== void 0 && source !== null) return source;
|
|
44
|
+
if (src !== void 0 && src !== null) return src;
|
|
45
|
+
return { uri: src };
|
|
46
|
+
};
|
|
47
|
+
function createImage(options) {
|
|
48
|
+
var { Component, mapObjectFitToResizeMode = defaultObjectFitMap, resizeModePropName = "resizeMode", objectPositionPropName, transformSource = defaultTransformSource } = options;
|
|
49
|
+
var inlinePropsSet = /* @__PURE__ */ new Set([
|
|
50
|
+
"source",
|
|
51
|
+
"placeholder",
|
|
52
|
+
"transition",
|
|
53
|
+
"contentFit",
|
|
54
|
+
"contentPosition",
|
|
55
|
+
"cachePolicy",
|
|
56
|
+
"recyclingKey",
|
|
57
|
+
"allowDownscaling",
|
|
58
|
+
"autoplay",
|
|
59
|
+
"blurRadius",
|
|
60
|
+
"priority",
|
|
61
|
+
"placeholderContentFit",
|
|
62
|
+
"responsivePolicy",
|
|
63
|
+
"onLoadStart",
|
|
64
|
+
"onProgress",
|
|
65
|
+
"onLoadEnd"
|
|
66
|
+
]);
|
|
67
|
+
var StyledImage = (0, import_web.styled)(Component, { displayName: "Image" }, { inlineProps: inlinePropsSet });
|
|
68
|
+
var ImageComponent = (0, import_web.createStyledHOC)(StyledImage, function(incomingProps, ref) {
|
|
69
|
+
var props = incomingProps;
|
|
70
|
+
var { src, source, width, height, borderRadius, objectFit, objectPosition, decoding, elementTiming, fetchpriority, isMap, loading, sizes, useMap, onLoad, onError, ...rest } = props;
|
|
71
|
+
var _getTokenValue;
|
|
72
|
+
var resolvedWidth = typeof width === "string" ? (_getTokenValue = (0, import_web.getTokenValue)(width, "size")) !== null && _getTokenValue !== void 0 ? _getTokenValue : width : width;
|
|
73
|
+
var _getTokenValue1;
|
|
74
|
+
var resolvedHeight = typeof height === "string" ? (_getTokenValue1 = (0, import_web.getTokenValue)(height, "size")) !== null && _getTokenValue1 !== void 0 ? _getTokenValue1 : height : height;
|
|
75
|
+
var finalSource = transformSource({
|
|
76
|
+
src,
|
|
77
|
+
source,
|
|
78
|
+
width: resolvedWidth,
|
|
79
|
+
height: resolvedHeight
|
|
80
|
+
});
|
|
81
|
+
var incomingStyle = Array.isArray(rest.style) ? Object.assign({}, ...rest.style.flat()) : rest.style;
|
|
82
|
+
var _getTokenValue2;
|
|
83
|
+
var resolvedBorderRadius = typeof borderRadius === "string" ? (_getTokenValue2 = (0, import_web.getTokenValue)(borderRadius, "radius")) !== null && _getTokenValue2 !== void 0 ? _getTokenValue2 : borderRadius : borderRadius;
|
|
84
|
+
var finalProps = {
|
|
85
|
+
...rest,
|
|
86
|
+
source: finalSource,
|
|
87
|
+
style: {
|
|
88
|
+
...incomingStyle,
|
|
89
|
+
...resolvedBorderRadius !== void 0 && { borderRadius: resolvedBorderRadius },
|
|
90
|
+
...resolvedWidth !== void 0 && { width: resolvedWidth },
|
|
91
|
+
...resolvedHeight !== void 0 && { height: resolvedHeight },
|
|
92
|
+
...objectFit !== void 0 && { objectFit },
|
|
93
|
+
...objectPosition !== void 0 && { objectPosition }
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
if (objectFit) {
|
|
97
|
+
finalProps[resizeModePropName] = mapObjectFitToResizeMode(objectFit);
|
|
98
|
+
}
|
|
99
|
+
if (objectPositionPropName && objectPosition) {
|
|
100
|
+
finalProps[objectPositionPropName] = objectPosition;
|
|
101
|
+
}
|
|
102
|
+
if (onLoad) {
|
|
103
|
+
finalProps.onLoad = function(e) {
|
|
104
|
+
var _e_nativeEvent;
|
|
105
|
+
var source2 = (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) || {};
|
|
106
|
+
onLoad({
|
|
107
|
+
target: {
|
|
108
|
+
naturalHeight: source2 === null || source2 === void 0 ? void 0 : source2.height,
|
|
109
|
+
naturalWidth: source2 === null || source2 === void 0 ? void 0 : source2.width
|
|
110
|
+
},
|
|
111
|
+
type: "load"
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (onError) {
|
|
116
|
+
finalProps.onError = function() {
|
|
117
|
+
onError({ type: "error" });
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledImage, {
|
|
121
|
+
ref,
|
|
122
|
+
...finalProps
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
var comp = Component;
|
|
126
|
+
ImageComponent.getSize = comp.getSize || function() {};
|
|
127
|
+
ImageComponent.getSizeWithHeaders = comp.getSizeWithHeaders || function() {};
|
|
128
|
+
ImageComponent.prefetch = comp.prefetch || function() {};
|
|
129
|
+
ImageComponent.prefetchWithMetadata = comp.prefetchWithMetadata || function() {};
|
|
130
|
+
ImageComponent.abortPrefetch = comp.abortPrefetch || function() {};
|
|
131
|
+
ImageComponent.queryCache = comp.queryCache || function() {};
|
|
132
|
+
return ImageComponent;
|
|
133
|
+
}
|