@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.
Files changed (92) hide show
  1. package/dist/cjs/Image.cjs +25 -45
  2. package/dist/cjs/Image.native.cjs +29 -0
  3. package/dist/cjs/Image.native.js +16 -20
  4. package/dist/cjs/Image.native.js.map +1 -1
  5. package/dist/cjs/createImage.cjs +112 -145
  6. package/dist/cjs/createImage.native.cjs +133 -0
  7. package/dist/cjs/createImage.native.js +116 -145
  8. package/dist/cjs/createImage.native.js.map +1 -1
  9. package/dist/cjs/index.cjs +10 -11
  10. package/dist/cjs/index.native.cjs +22 -0
  11. package/dist/cjs/index.native.js +10 -10
  12. package/dist/cjs/index.native.js.map +1 -1
  13. package/dist/cjs/types.cjs +10 -11
  14. package/dist/cjs/types.native.cjs +19 -0
  15. package/dist/cjs/types.native.js +10 -10
  16. package/dist/cjs/types.native.js.map +1 -1
  17. package/dist/esm/Image.mjs +13 -28
  18. package/dist/esm/Image.mjs.map +1 -1
  19. package/dist/esm/Image.native.js +4 -4
  20. package/dist/esm/Image.native.js.map +1 -1
  21. package/dist/esm/createImage.mjs +100 -128
  22. package/dist/esm/createImage.mjs.map +1 -1
  23. package/dist/esm/createImage.native.js +105 -130
  24. package/dist/esm/createImage.native.js.map +1 -1
  25. package/dist/esm/index.js +3 -3
  26. package/dist/esm/index.mjs +3 -3
  27. package/dist/esm/index.native.js +3 -3
  28. package/dist/esm/types.mjs +0 -2
  29. package/dist/esm/types.native.js +0 -2
  30. package/dist/jsx/Image.mjs +13 -28
  31. package/dist/jsx/Image.mjs.map +1 -1
  32. package/dist/jsx/Image.native.cjs +29 -0
  33. package/dist/jsx/Image.native.js +16 -20
  34. package/dist/jsx/Image.native.js.map +1 -1
  35. package/dist/jsx/createImage.mjs +100 -128
  36. package/dist/jsx/createImage.mjs.map +1 -1
  37. package/dist/jsx/createImage.native.cjs +133 -0
  38. package/dist/jsx/createImage.native.js +116 -145
  39. package/dist/jsx/createImage.native.js.map +1 -1
  40. package/dist/jsx/index.js +3 -3
  41. package/dist/jsx/index.mjs +3 -3
  42. package/dist/jsx/index.native.cjs +22 -0
  43. package/dist/jsx/index.native.js +10 -10
  44. package/dist/jsx/index.native.js.map +1 -1
  45. package/dist/jsx/types.mjs +0 -2
  46. package/dist/jsx/types.native.cjs +19 -0
  47. package/dist/jsx/types.native.js +10 -10
  48. package/dist/jsx/types.native.js.map +1 -1
  49. package/package.json +8 -7
  50. package/src/Image.tsx +5 -4
  51. package/src/createImage.tsx +99 -89
  52. package/types/Image.d.ts.map +1 -1
  53. package/types/Image.native.d.ts +4 -4
  54. package/types/Image.native.d.ts.map +1 -1
  55. package/types/createImage.d.ts +4 -4
  56. package/types/createImage.d.ts.map +1 -1
  57. package/dist/cjs/v1/Image.cjs +0 -101
  58. package/dist/cjs/v1/Image.native.js +0 -123
  59. package/dist/cjs/v1/Image.native.js.map +0 -1
  60. package/dist/cjs/v1/index.cjs +0 -20
  61. package/dist/cjs/v1/index.native.js +0 -23
  62. package/dist/cjs/v1/index.native.js.map +0 -1
  63. package/dist/esm/index.js.map +0 -1
  64. package/dist/esm/index.mjs.map +0 -1
  65. package/dist/esm/index.native.js.map +0 -1
  66. package/dist/esm/types.mjs.map +0 -1
  67. package/dist/esm/types.native.js.map +0 -1
  68. package/dist/esm/v1/Image.mjs +0 -65
  69. package/dist/esm/v1/Image.mjs.map +0 -1
  70. package/dist/esm/v1/Image.native.js +0 -84
  71. package/dist/esm/v1/Image.native.js.map +0 -1
  72. package/dist/esm/v1/index.mjs +0 -2
  73. package/dist/esm/v1/index.mjs.map +0 -1
  74. package/dist/esm/v1/index.native.js +0 -2
  75. package/dist/esm/v1/index.native.js.map +0 -1
  76. package/dist/jsx/index.js.map +0 -1
  77. package/dist/jsx/index.mjs.map +0 -1
  78. package/dist/jsx/types.mjs.map +0 -1
  79. package/dist/jsx/v1/Image.mjs +0 -65
  80. package/dist/jsx/v1/Image.mjs.map +0 -1
  81. package/dist/jsx/v1/Image.native.js +0 -123
  82. package/dist/jsx/v1/Image.native.js.map +0 -1
  83. package/dist/jsx/v1/index.mjs +0 -2
  84. package/dist/jsx/v1/index.mjs.map +0 -1
  85. package/dist/jsx/v1/index.native.js +0 -23
  86. package/dist/jsx/v1/index.native.js.map +0 -1
  87. package/src/v1/Image.tsx +0 -144
  88. package/src/v1/index.ts +0 -1
  89. package/types/v1/Image.d.ts +0 -36
  90. package/types/v1/Image.d.ts.map +0 -1
  91. package/types/v1/index.d.ts +0 -2
  92. package/types/v1/index.d.ts.map +0 -1
@@ -1,39 +1,24 @@
1
- import { View, styled } from "@tamagui/web";
1
+ import { View, createStyledHOC, styled } from "@tamagui/web";
2
2
  import { jsx } from "react/jsx-runtime";
3
+
3
4
  const StyledImage = styled(View, {
4
- name: "Image",
5
- render: "img"
5
+ displayName: "Image",
6
+ render: "img"
6
7
  });
7
- const Image = StyledImage.styleable((inProps, ref) => {
8
- const {
9
- // exclude native only props
10
- blurRadius,
11
- capInsets,
12
- defaultSource,
13
- fadeDuration,
14
- loadingIndicatorSource,
15
- onLoadEnd,
16
- onPartialLoad,
17
- progressiveRenderingEnabled,
18
- resizeMethod,
19
- tintColor,
20
- ...rest
21
- } = inProps;
22
- return /* @__PURE__ */jsx(StyledImage, {
23
- ref,
24
- ...rest
25
- });
26
- }, {
27
- staticConfig: {
28
- memo: true
29
- }
30
- });
31
- const func = () => {};
8
+ const Image = createStyledHOC(StyledImage, (inProps, ref) => {
9
+ const { blurRadius, capInsets, defaultSource, fadeDuration, loadingIndicatorSource, onLoadEnd, onPartialLoad, progressiveRenderingEnabled, resizeMethod, tintColor, ...rest } = inProps;
10
+ return /* @__PURE__ */ jsx(StyledImage, {
11
+ ref,
12
+ ...rest
13
+ });
14
+ }, { staticConfig: { memo: true } });
15
+ const func = (() => {});
32
16
  Image.getSize = func;
33
17
  Image.getSizeWithHeaders = func;
34
18
  Image.prefetch = func;
35
19
  Image.prefetchWithMetadata = func;
36
20
  Image.abortPrefetch = func;
37
21
  Image.queryCache = func;
22
+
38
23
  export { Image };
39
24
  //# sourceMappingURL=Image.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["View","styled","jsx","StyledImage","name","render","Image","styleable","inProps","ref","blurRadius","capInsets","defaultSource","fadeDuration","loadingIndicatorSource","onLoadEnd","onPartialLoad","progressiveRenderingEnabled","resizeMethod","tintColor","rest","staticConfig","memo","func","getSize","getSizeWithHeaders","prefetch","prefetchWithMetadata","abortPrefetch","queryCache"],"sources":["../../src/Image.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,IAAA,EAAMC,MAAA,QAAc;AAwBlB,SAAAC,GAAA;AArBX,MAAMC,WAAA,GAAcF,MAAA,CAAOD,IAAA,EAAM;EAC/BI,IAAA,EAAM;EACNC,MAAA,EAAQ;AACV,CAAC;AAEM,MAAMC,KAAA,GAAQH,WAAA,CAAYI,SAAA,CAC/B,CAACC,OAAA,EAASC,GAAA,KAAQ;EAChB,MAAM;IAAA;IAEJC,UAAA;IACAC,SAAA;IACAC,aAAA;IACAC,YAAA;IACAC,sBAAA;IACAC,SAAA;IACAC,aAAA;IACAC,2BAAA;IACAC,YAAA;IACAC,SAAA;IACA,GAAGC;EACL,IAAIZ,OAAA;EACJ,OAAO,eAAAN,GAAA,CAACC,WAAA;IAAYM,GAAA;IAAW,GAAGW;EAAA,CAAM;AAC1C,GACA;EACEC,YAAA,EAAc;IACZC,IAAA,EAAM;EACR;AACF,CACF;AAEA,MAAMC,IAAA,GAAQA,CAAA,KAAM,CAAC;AAErBjB,KAAA,CAAMkB,OAAA,GAAUD,IAAA;AAChBjB,KAAA,CAAMmB,kBAAA,GAAqBF,IAAA;AAC3BjB,KAAA,CAAMoB,QAAA,GAAWH,IAAA;AACjBjB,KAAA,CAAMqB,oBAAA,GAAuBJ,IAAA;AAC7BjB,KAAA,CAAMsB,aAAA,GAAgBL,IAAA;AACtBjB,KAAA,CAAMuB,UAAA,GAAaN,IAAA","ignoreList":[]}
1
+ {"version":3,"file":"Image.js","names":[],"sources":["jsx/Image.js"],"sourcesContent":["import { createStyledHOC, View, styled } from \"@tamagui/web\";\nimport { jsx } from \"react/jsx-runtime\";\nconst StyledImage = styled(View, {\n displayName: \"Image\",\n render: \"img\"\n});\nconst Image = createStyledHOC(\n StyledImage,\n (inProps, ref) => {\n const {\n // exclude native only props\n blurRadius,\n capInsets,\n defaultSource,\n fadeDuration,\n loadingIndicatorSource,\n onLoadEnd,\n onPartialLoad,\n progressiveRenderingEnabled,\n resizeMethod,\n tintColor,\n ...rest\n } = inProps;\n return /* @__PURE__ */ jsx(StyledImage, { ref, ...rest });\n },\n {\n staticConfig: {\n memo: true\n }\n }\n);\nconst func = (() => {\n});\nImage.getSize = func;\nImage.getSizeWithHeaders = func;\nImage.prefetch = func;\nImage.prefetchWithMetadata = func;\nImage.abortPrefetch = func;\nImage.queryCache = func;\nexport {\n Image\n};\n//# sourceMappingURL=Image.js.map\n"],"mappings":";;;;AAEA,MAAM,cAAc,OAAO,MAAM;CAC/B,aAAa;CACb,QAAQ;AACV,CAAC;AACD,MAAM,QAAQ,gBACZ,cACC,SAAS,QAAQ;CAChB,MAAM,EAEJ,YACA,WACA,eACA,cACA,wBACA,WACA,eACA,6BACA,cACA,WACA,GAAG,SACD;CACJ,OAAuB,oBAAI,aAAa;EAAE;EAAK,GAAG;CAAK,CAAC;AAC1D,GACA,EACE,cAAc,EACZ,MAAM,KACR,EACF,CACF;AACA,MAAM,cAAc,CACpB;AACA,MAAM,UAAU;AAChB,MAAM,qBAAqB;AAC3B,MAAM,WAAW;AACjB,MAAM,uBAAuB;AAC7B,MAAM,gBAAgB;AACtB,MAAM,aAAa"}
@@ -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 });
@@ -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
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
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
- 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, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
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
- Component: import_react_native.Image
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,"names":["Image_native_exports","__export","Image","module","exports","__toCommonJS","import_react_native","require","import_createImage","createImage","Component"],"sources":["../../src/Image.native.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,oBAAA;AAAAC,QAAA,CAAAD,oBAAA;EAAAE,KAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,oBAAA;AAAA,IAAAM,mBAAA,GAAiCC,OAAA;AACjC,IAAAC,kBAAA,GAA4BD,OAAA;AACrB,IAAIL,KAAA,OAAQM,kBAAA,CAAAC,WAAA,EAAY;EAC3BC,SAAA,EAAWJ,mBAAA,CAAAJ;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Image.native.js","names":[],"sources":["jsx/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"}
@@ -1,135 +1,107 @@
1
- import { getTokenValue, styled } from "@tamagui/web";
1
+ import { createStyledHOC, getTokenValue, styled } from "@tamagui/web";
2
2
  import { jsx } from "react/jsx-runtime";
3
- const defaultObjectFitMap = objectFit => {
4
- switch (objectFit) {
5
- case "fill":
6
- return "stretch";
7
- case "none":
8
- return "center";
9
- case "scale-down":
10
- return "contain";
11
- case "contain":
12
- return "contain";
13
- default:
14
- return "cover";
15
- }
3
+
4
+ const defaultObjectFitMap = (objectFit) => {
5
+ switch (objectFit) {
6
+ case "fill": return "stretch";
7
+ case "none": return "center";
8
+ case "scale-down": return "contain";
9
+ case "contain": return "contain";
10
+ default: return "cover";
11
+ }
16
12
  };
17
- const defaultTransformSource = props => {
18
- const {
19
- src,
20
- source
21
- } = props;
22
- if (typeof src === "string") {
23
- return {
24
- uri: src
25
- };
26
- }
27
- if (source !== void 0 && source !== null) return source;
28
- if (src !== void 0 && src !== null) return src;
29
- return {
30
- uri: src
31
- };
13
+ const defaultTransformSource = (props) => {
14
+ const { src, source } = props;
15
+ if (typeof src === "string") {
16
+ return { uri: src };
17
+ }
18
+ if (source !== void 0 && source !== null) return source;
19
+ if (src !== void 0 && src !== null) return src;
20
+ return { uri: src };
32
21
  };
33
22
  function createImage(options) {
34
- const {
35
- Component,
36
- mapObjectFitToResizeMode = defaultObjectFitMap,
37
- resizeModePropName = "resizeMode",
38
- objectPositionPropName,
39
- transformSource = defaultTransformSource
40
- } = options;
41
- const inlinePropsSet = /* @__PURE__ */new Set(["source", "placeholder", "transition", "contentFit", "contentPosition", "cachePolicy", "recyclingKey", "allowDownscaling", "autoplay", "blurRadius", "priority", "placeholderContentFit", "responsivePolicy", "onLoadStart", "onProgress", "onLoadEnd"]);
42
- const StyledImage = styled(Component, {
43
- name: "Image"
44
- }, {
45
- inlineProps: inlinePropsSet
46
- });
47
- const ImageComponent = StyledImage.styleable((incomingProps, ref) => {
48
- const props = incomingProps;
49
- const {
50
- src,
51
- source,
52
- width,
53
- height,
54
- borderRadius,
55
- objectFit,
56
- objectPosition,
57
- // web only props - filter out on native
58
- decoding,
59
- elementTiming,
60
- fetchpriority,
61
- isMap,
62
- loading,
63
- sizes,
64
- useMap,
65
- onLoad,
66
- onError,
67
- ...rest
68
- } = props;
69
- const resolvedWidth = typeof width === "string" && width[0] === "$" ? getTokenValue(width, "size") : width;
70
- const resolvedHeight = typeof height === "string" && height[0] === "$" ? getTokenValue(height, "size") : 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" && borderRadius[0] === "$" ? getTokenValue(borderRadius, "radius") : borderRadius;
79
- const finalProps = {
80
- ...rest,
81
- source: finalSource,
82
- style: {
83
- ...incomingStyle,
84
- ...(resolvedBorderRadius !== void 0 && {
85
- borderRadius: resolvedBorderRadius
86
- }),
87
- ...(resolvedWidth !== void 0 && {
88
- width: resolvedWidth
89
- }),
90
- ...(resolvedHeight !== void 0 && {
91
- height: resolvedHeight
92
- })
93
- }
94
- };
95
- if (objectFit) {
96
- finalProps[resizeModePropName] = mapObjectFitToResizeMode(objectFit);
97
- }
98
- if (objectPositionPropName && objectPosition) {
99
- finalProps[objectPositionPropName] = objectPosition;
100
- }
101
- if (onLoad) {
102
- finalProps.onLoad = e => {
103
- const source2 = e?.nativeEvent?.source || e?.source || {};
104
- onLoad({
105
- target: {
106
- naturalHeight: source2?.height,
107
- naturalWidth: source2?.width
108
- },
109
- type: "load"
110
- });
111
- };
112
- }
113
- if (onError) {
114
- finalProps.onError = () => {
115
- onError({
116
- type: "error"
117
- });
118
- };
119
- }
120
- return /* @__PURE__ */jsx(StyledImage, {
121
- ref,
122
- ...finalProps
123
- });
124
- });
125
- const comp = Component;
126
- ImageComponent.getSize = comp.getSize || (() => {});
127
- ImageComponent.getSizeWithHeaders = comp.getSizeWithHeaders || (() => {});
128
- ImageComponent.prefetch = comp.prefetch || (() => {});
129
- ImageComponent.prefetchWithMetadata = comp.prefetchWithMetadata || (() => {});
130
- ImageComponent.abortPrefetch = comp.abortPrefetch || (() => {});
131
- ImageComponent.queryCache = comp.queryCache || (() => {});
132
- return ImageComponent;
23
+ const { Component, mapObjectFitToResizeMode = defaultObjectFitMap, resizeModePropName = "resizeMode", objectPositionPropName, transformSource = defaultTransformSource } = options;
24
+ const inlinePropsSet = /* @__PURE__ */ new Set([
25
+ "source",
26
+ "placeholder",
27
+ "transition",
28
+ "contentFit",
29
+ "contentPosition",
30
+ "cachePolicy",
31
+ "recyclingKey",
32
+ "allowDownscaling",
33
+ "autoplay",
34
+ "blurRadius",
35
+ "priority",
36
+ "placeholderContentFit",
37
+ "responsivePolicy",
38
+ "onLoadStart",
39
+ "onProgress",
40
+ "onLoadEnd"
41
+ ]);
42
+ const StyledImage = styled(Component, { displayName: "Image" }, { inlineProps: inlinePropsSet });
43
+ const ImageComponent = createStyledHOC(StyledImage, (incomingProps, ref) => {
44
+ const props = incomingProps;
45
+ const { src, source, width, height, borderRadius, objectFit, objectPosition, decoding, elementTiming, fetchpriority, isMap, loading, sizes, useMap, onLoad, onError, ...rest } = props;
46
+ const resolvedWidth = typeof width === "string" ? getTokenValue(width, "size") ?? width : width;
47
+ const resolvedHeight = typeof height === "string" ? getTokenValue(height, "size") ?? height : height;
48
+ const finalSource = transformSource({
49
+ src,
50
+ source,
51
+ width: resolvedWidth,
52
+ height: resolvedHeight
53
+ });
54
+ const incomingStyle = Array.isArray(rest.style) ? Object.assign({}, ...rest.style.flat()) : rest.style;
55
+ const resolvedBorderRadius = typeof borderRadius === "string" ? getTokenValue(borderRadius, "radius") ?? borderRadius : borderRadius;
56
+ const finalProps = {
57
+ ...rest,
58
+ source: finalSource,
59
+ style: {
60
+ ...incomingStyle,
61
+ ...resolvedBorderRadius !== void 0 && { borderRadius: resolvedBorderRadius },
62
+ ...resolvedWidth !== void 0 && { width: resolvedWidth },
63
+ ...resolvedHeight !== void 0 && { height: resolvedHeight },
64
+ ...objectFit !== void 0 && { objectFit },
65
+ ...objectPosition !== void 0 && { objectPosition }
66
+ }
67
+ };
68
+ if (objectFit) {
69
+ finalProps[resizeModePropName] = mapObjectFitToResizeMode(objectFit);
70
+ }
71
+ if (objectPositionPropName && objectPosition) {
72
+ finalProps[objectPositionPropName] = objectPosition;
73
+ }
74
+ if (onLoad) {
75
+ finalProps.onLoad = (e) => {
76
+ const source2 = e?.nativeEvent?.source || e?.source || {};
77
+ onLoad({
78
+ target: {
79
+ naturalHeight: source2?.height,
80
+ naturalWidth: source2?.width
81
+ },
82
+ type: "load"
83
+ });
84
+ };
85
+ }
86
+ if (onError) {
87
+ finalProps.onError = () => {
88
+ onError({ type: "error" });
89
+ };
90
+ }
91
+ return /* @__PURE__ */ jsx(StyledImage, {
92
+ ref,
93
+ ...finalProps
94
+ });
95
+ });
96
+ const comp = Component;
97
+ ImageComponent.getSize = comp.getSize || (() => {});
98
+ ImageComponent.getSizeWithHeaders = comp.getSizeWithHeaders || (() => {});
99
+ ImageComponent.prefetch = comp.prefetch || (() => {});
100
+ ImageComponent.prefetchWithMetadata = comp.prefetchWithMetadata || (() => {});
101
+ ImageComponent.abortPrefetch = comp.abortPrefetch || (() => {});
102
+ ImageComponent.queryCache = comp.queryCache || (() => {});
103
+ return ImageComponent;
133
104
  }
105
+
134
106
  export { createImage };
135
107
  //# sourceMappingURL=createImage.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["getTokenValue","styled","jsx","defaultObjectFitMap","objectFit","defaultTransformSource","props","src","source","uri","createImage","options","Component","mapObjectFitToResizeMode","resizeModePropName","objectPositionPropName","transformSource","inlinePropsSet","Set","StyledImage","name","inlineProps","ImageComponent","styleable","incomingProps","ref","width","height","borderRadius","objectPosition","decoding","elementTiming","fetchpriority","isMap","loading","sizes","useMap","onLoad","onError","rest","resolvedWidth","resolvedHeight","finalSource","incomingStyle","Array","isArray","style","Object","assign","flat","resolvedBorderRadius","finalProps","e","nativeEvent","target","naturalHeight","naturalWidth","type","comp","getSize","getSizeWithHeaders","prefetch","prefetchWithMetadata","abortPrefetch","queryCache"],"sources":["../../src/createImage.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,aAAA,EAAeC,MAAA,QAAc;AA2O3B,SAAAC,GAAA;AAjMX,MAAMC,mBAAA,GAAuBC,SAAA,IAAuC;EAClE,QAAQA,SAAA;IACN,KAAK;MACH,OAAO;IACT,KAAK;MACH,OAAO;IACT,KAAK;MACH,OAAO;IACT,KAAK;MACH,OAAO;IACT;MACE,OAAO;EACX;AACF;AAEA,MAAMC,sBAAA,GAA0BC,KAAA,IAK1B;EACJ,MAAM;IAAEC,GAAA;IAAKC;EAAO,IAAIF,KAAA;EACxB,IAAI,OAAOC,GAAA,KAAQ,UAAU;IAC3B,OAAO;MACLE,GAAA,EAAKF;IACP;EACF;EACA,IAAIC,MAAA,KAAW,UAAaA,MAAA,KAAW,MAAM,OAAOA,MAAA;EACpD,IAAID,GAAA,KAAQ,UAAaA,GAAA,KAAQ,MAAM,OAAOA,GAAA;EAC9C,OAAO;IACLE,GAAA,EAAKF;EACP;AACF;AAyBO,SAASG,YACdC,OAAA,EACA;EACA,MAAM;IACJC,SAAA;IACAC,wBAAA,GAA2BV,mBAAA;IAC3BW,kBAAA,GAAqB;IACrBC,sBAAA;IACAC,eAAA,GAAkBX;EACpB,IAAIM,OAAA;EAGJ,MAAMM,cAAA,GAAiB,mBAAIC,GAAA,CAAI,CAC7B,UACA,eACA,cACA,cACA,mBACA,eACA,gBACA,oBACA,YACA,cACA,YACA,yBACA,oBACA,eACA,cACA,YACD;EAED,MAAMC,WAAA,GAAclB,MAAA,CAClBW,SAAA,EACA;IACEQ,IAAA,EAAM;EACR,GACA;IACE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,oBAAA,KAAyB,MAAM,CAAC;EAC3ExC,cAAA,CAAeyC,aAAA,GAAgBL,IAAA,CAAKK,aAAA,KAAkB,MAAM,CAAC;EAC7DzC,cAAA,CAAe0C,UAAA,GAAaN,IAAA,CAAKM,UAAA,KAAe,MAAM,CAAC;EAEvD,OAAO1C,cAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"createImage.js","names":[],"sources":["jsx/createImage.js"],"sourcesContent":["import { createStyledHOC, getTokenValue, styled } from \"@tamagui/web\";\nimport { jsx } from \"react/jsx-runtime\";\nconst defaultObjectFitMap = (objectFit) => {\n switch (objectFit) {\n case \"fill\":\n return \"stretch\";\n case \"none\":\n return \"center\";\n case \"scale-down\":\n return \"contain\";\n case \"contain\":\n return \"contain\";\n default:\n return \"cover\";\n }\n};\nconst defaultTransformSource = (props) => {\n const { src, source } = props;\n if (typeof src === \"string\") {\n return {\n uri: src\n };\n }\n if (source !== void 0 && source !== null) return source;\n if (src !== void 0 && src !== null) return src;\n return {\n uri: src\n };\n};\nfunction createImage(options) {\n const {\n Component,\n mapObjectFitToResizeMode = defaultObjectFitMap,\n resizeModePropName = \"resizeMode\",\n objectPositionPropName,\n transformSource = defaultTransformSource\n } = options;\n const inlinePropsSet = /* @__PURE__ */ new Set([\n \"source\",\n \"placeholder\",\n \"transition\",\n \"contentFit\",\n \"contentPosition\",\n \"cachePolicy\",\n \"recyclingKey\",\n \"allowDownscaling\",\n \"autoplay\",\n \"blurRadius\",\n \"priority\",\n \"placeholderContentFit\",\n \"responsivePolicy\",\n \"onLoadStart\",\n \"onProgress\",\n \"onLoadEnd\"\n ]);\n const StyledImage = styled(\n Component,\n {\n displayName: \"Image\"\n },\n {\n inlineProps: inlinePropsSet\n }\n );\n const ImageComponent = createStyledHOC(\n StyledImage,\n (incomingProps, ref) => {\n const props = incomingProps;\n const {\n src,\n source,\n width,\n height,\n borderRadius,\n objectFit,\n objectPosition,\n // web only props - filter out on native\n decoding,\n elementTiming,\n fetchpriority,\n isMap,\n loading,\n sizes,\n useMap,\n onLoad,\n onError,\n ...rest\n } = props;\n const resolvedWidth = typeof width === \"string\" ? getTokenValue(width, \"size\") ?? width : width;\n const resolvedHeight = typeof height === \"string\" ? getTokenValue(height, \"size\") ?? height : height;\n const finalSource = transformSource({\n src,\n source,\n width: resolvedWidth,\n height: resolvedHeight\n });\n const incomingStyle = Array.isArray(rest.style) ? Object.assign({}, ...rest.style.flat()) : rest.style;\n const resolvedBorderRadius = typeof borderRadius === \"string\" ? getTokenValue(borderRadius, \"radius\") ?? borderRadius : borderRadius;\n const finalProps = {\n ...rest,\n source: finalSource,\n style: {\n ...incomingStyle,\n ...resolvedBorderRadius !== void 0 && {\n borderRadius: resolvedBorderRadius\n },\n ...resolvedWidth !== void 0 && { width: resolvedWidth },\n ...resolvedHeight !== void 0 && { height: resolvedHeight },\n // RN 0.76+ reads objectFit from style natively on Image; harmless on older.\n // Also forwarded to the resize-mode prop below for back-compat / non-RN components.\n ...objectFit !== void 0 && { objectFit },\n // RN doesn't currently read objectPosition from style; expo-image uses\n // contentPosition (handled via objectPositionPropName below). Forwarding\n // through style is a no-op there but matches CSS shape and is forward-compatible.\n ...objectPosition !== void 0 && { objectPosition }\n }\n };\n if (objectFit) {\n finalProps[resizeModePropName] = mapObjectFitToResizeMode(objectFit);\n }\n if (objectPositionPropName && objectPosition) {\n finalProps[objectPositionPropName] = objectPosition;\n }\n if (onLoad) {\n finalProps.onLoad = (e) => {\n const source2 = e?.nativeEvent?.source || e?.source || {};\n onLoad({\n target: {\n naturalHeight: source2?.height,\n naturalWidth: source2?.width\n },\n type: \"load\"\n });\n };\n }\n if (onError) {\n finalProps.onError = () => {\n onError({\n type: \"error\"\n });\n };\n }\n return /* @__PURE__ */ jsx(StyledImage, { ref, ...finalProps });\n }\n );\n const comp = Component;\n ImageComponent.getSize = comp.getSize || (() => {\n });\n ImageComponent.getSizeWithHeaders = comp.getSizeWithHeaders || (() => {\n });\n ImageComponent.prefetch = comp.prefetch || (() => {\n });\n ImageComponent.prefetchWithMetadata = comp.prefetchWithMetadata || (() => {\n });\n ImageComponent.abortPrefetch = comp.abortPrefetch || (() => {\n });\n ImageComponent.queryCache = comp.queryCache || (() => {\n });\n return ImageComponent;\n}\nexport {\n createImage\n};\n//# sourceMappingURL=createImage.js.map\n"],"mappings":";;;;AAEA,MAAM,uBAAuB,cAAc;CACzC,QAAQ,WAAR;EACE,KAAK,QACH,OAAO;EACT,KAAK,QACH,OAAO;EACT,KAAK,cACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AACA,MAAM,0BAA0B,UAAU;CACxC,MAAM,EAAE,KAAK,WAAW;CACxB,IAAI,OAAO,QAAQ,UAAU;EAC3B,OAAO,EACL,KAAK,IACP;CACF;CACA,IAAI,WAAW,KAAK,KAAK,WAAW,MAAM,OAAO;CACjD,IAAI,QAAQ,KAAK,KAAK,QAAQ,MAAM,OAAO;CAC3C,OAAO,EACL,KAAK,IACP;AACF;AACA,SAAS,YAAY,SAAS;CAC5B,MAAM,EACJ,WACA,2BAA2B,qBAC3B,qBAAqB,cACrB,wBACA,kBAAkB,2BAChB;CACJ,MAAM,iCAAiC,IAAI,IAAI;EAC7C;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,MAAM,cAAc,OAClB,WACA,EACE,aAAa,QACf,GACA,EACE,aAAa,eACf,CACF;CACA,MAAM,iBAAiB,gBACrB,cACC,eAAe,QAAQ;EACtB,MAAM,QAAQ;EACd,MAAM,EACJ,KACA,QACA,OACA,QACA,cACA,WACA,gBAEA,UACA,eACA,eACA,OACA,SACA,OACA,QACA,QACA,SACA,GAAG,SACD;EACJ,MAAM,gBAAgB,OAAO,UAAU,WAAW,cAAc,OAAO,MAAM,KAAK,QAAQ;EAC1F,MAAM,iBAAiB,OAAO,WAAW,WAAW,cAAc,QAAQ,MAAM,KAAK,SAAS;EAC9F,MAAM,cAAc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aAAa,KAAK,qBAAqB,CACtD;CACA,OAAO;AACT"}
@@ -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
+ }