@hanzogui/image 2.0.0-rc.41-hanzoai.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 (93) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/Image.cjs +64 -0
  3. package/dist/cjs/Image.native.js +35 -0
  4. package/dist/cjs/Image.native.js.map +1 -0
  5. package/dist/cjs/createImage.cjs +157 -0
  6. package/dist/cjs/createImage.native.js +161 -0
  7. package/dist/cjs/createImage.native.js.map +1 -0
  8. package/dist/cjs/index.cjs +21 -0
  9. package/dist/cjs/index.native.js +24 -0
  10. package/dist/cjs/index.native.js.map +1 -0
  11. package/dist/cjs/types.cjs +18 -0
  12. package/dist/cjs/types.native.js +21 -0
  13. package/dist/cjs/types.native.js.map +1 -0
  14. package/dist/cjs/v1/Image.cjs +101 -0
  15. package/dist/cjs/v1/Image.native.js +123 -0
  16. package/dist/cjs/v1/Image.native.js.map +1 -0
  17. package/dist/cjs/v1/index.cjs +20 -0
  18. package/dist/cjs/v1/index.native.js +23 -0
  19. package/dist/cjs/v1/index.native.js.map +1 -0
  20. package/dist/esm/Image.mjs +39 -0
  21. package/dist/esm/Image.mjs.map +1 -0
  22. package/dist/esm/Image.native.js +7 -0
  23. package/dist/esm/Image.native.js.map +1 -0
  24. package/dist/esm/createImage.mjs +132 -0
  25. package/dist/esm/createImage.mjs.map +1 -0
  26. package/dist/esm/createImage.native.js +133 -0
  27. package/dist/esm/createImage.native.js.map +1 -0
  28. package/dist/esm/index.js +3 -0
  29. package/dist/esm/index.js.map +1 -0
  30. package/dist/esm/index.mjs +3 -0
  31. package/dist/esm/index.mjs.map +1 -0
  32. package/dist/esm/index.native.js +3 -0
  33. package/dist/esm/index.native.js.map +1 -0
  34. package/dist/esm/types.mjs +2 -0
  35. package/dist/esm/types.mjs.map +1 -0
  36. package/dist/esm/types.native.js +2 -0
  37. package/dist/esm/types.native.js.map +1 -0
  38. package/dist/esm/v1/Image.mjs +65 -0
  39. package/dist/esm/v1/Image.mjs.map +1 -0
  40. package/dist/esm/v1/Image.native.js +84 -0
  41. package/dist/esm/v1/Image.native.js.map +1 -0
  42. package/dist/esm/v1/index.mjs +2 -0
  43. package/dist/esm/v1/index.mjs.map +1 -0
  44. package/dist/esm/v1/index.native.js +2 -0
  45. package/dist/esm/v1/index.native.js.map +1 -0
  46. package/dist/jsx/Image.mjs +39 -0
  47. package/dist/jsx/Image.mjs.map +1 -0
  48. package/dist/jsx/Image.native.js +35 -0
  49. package/dist/jsx/Image.native.js.map +1 -0
  50. package/dist/jsx/createImage.mjs +132 -0
  51. package/dist/jsx/createImage.mjs.map +1 -0
  52. package/dist/jsx/createImage.native.js +161 -0
  53. package/dist/jsx/createImage.native.js.map +1 -0
  54. package/dist/jsx/index.js +3 -0
  55. package/dist/jsx/index.js.map +1 -0
  56. package/dist/jsx/index.mjs +3 -0
  57. package/dist/jsx/index.mjs.map +1 -0
  58. package/dist/jsx/index.native.js +24 -0
  59. package/dist/jsx/index.native.js.map +1 -0
  60. package/dist/jsx/types.mjs +2 -0
  61. package/dist/jsx/types.mjs.map +1 -0
  62. package/dist/jsx/types.native.js +21 -0
  63. package/dist/jsx/types.native.js.map +1 -0
  64. package/dist/jsx/v1/Image.mjs +65 -0
  65. package/dist/jsx/v1/Image.mjs.map +1 -0
  66. package/dist/jsx/v1/Image.native.js +123 -0
  67. package/dist/jsx/v1/Image.native.js.map +1 -0
  68. package/dist/jsx/v1/index.mjs +2 -0
  69. package/dist/jsx/v1/index.mjs.map +1 -0
  70. package/dist/jsx/v1/index.native.js +23 -0
  71. package/dist/jsx/v1/index.native.js.map +1 -0
  72. package/package.json +53 -0
  73. package/src/Image.native.tsx +6 -0
  74. package/src/Image.tsx +41 -0
  75. package/src/createImage.tsx +245 -0
  76. package/src/index.ts +3 -0
  77. package/src/types.ts +54 -0
  78. package/src/v1/Image.tsx +144 -0
  79. package/src/v1/index.ts +1 -0
  80. package/types/Image.d.ts +3 -0
  81. package/types/Image.d.ts.map +1 -0
  82. package/types/Image.native.d.ts +16 -0
  83. package/types/Image.native.d.ts.map +1 -0
  84. package/types/createImage.d.ts +77 -0
  85. package/types/createImage.d.ts.map +1 -0
  86. package/types/index.d.ts +4 -0
  87. package/types/index.d.ts.map +1 -0
  88. package/types/types.d.ts +42 -0
  89. package/types/types.d.ts.map +1 -0
  90. package/types/v1/Image.d.ts +36 -0
  91. package/types/v1/Image.d.ts.map +1 -0
  92. package/types/v1/index.d.ts +2 -0
  93. package/types/v1/index.d.ts.map +1 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Nate Wienert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,64 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var Image_exports = {};
24
+ __export(Image_exports, {
25
+ Image: () => Image
26
+ });
27
+ module.exports = __toCommonJS(Image_exports);
28
+ var import_web = require("@hanzogui/web");
29
+ var import_jsx_runtime = require("react/jsx-runtime");
30
+ const StyledImage = (0, import_web.styled)(import_web.View, {
31
+ name: "Image",
32
+ render: "img"
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
+ }
57
+ });
58
+ const func = () => {};
59
+ Image.getSize = func;
60
+ Image.getSizeWithHeaders = func;
61
+ Image.prefetch = func;
62
+ Image.prefetchWithMetadata = func;
63
+ Image.abortPrefetch = func;
64
+ Image.queryCache = func;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
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, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
+ value: true
24
+ }), mod);
25
+ var Image_native_exports = {};
26
+ __export(Image_native_exports, {
27
+ Image: () => Image
28
+ });
29
+ module.exports = __toCommonJS(Image_native_exports);
30
+ var import_react_native = require("react-native");
31
+ var import_createImage = require("./createImage.native.js");
32
+ var Image = (0, import_createImage.createImage)({
33
+ Component: import_react_native.Image
34
+ });
35
+ //# sourceMappingURL=Image.native.js.map
@@ -0,0 +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":[]}
@@ -0,0 +1,157 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var createImage_exports = {};
24
+ __export(createImage_exports, {
25
+ createImage: () => createImage
26
+ });
27
+ module.exports = __toCommonJS(createImage_exports);
28
+ var import_web = require("@hanzogui/web");
29
+ var import_jsx_runtime = require("react/jsx-runtime");
30
+ const defaultObjectFitMap = objectFit => {
31
+ switch (objectFit) {
32
+ case "fill":
33
+ return "stretch";
34
+ case "none":
35
+ return "center";
36
+ case "scale-down":
37
+ return "contain";
38
+ case "contain":
39
+ return "contain";
40
+ default:
41
+ return "cover";
42
+ }
43
+ };
44
+ const defaultTransformSource = props => {
45
+ const {
46
+ src,
47
+ source,
48
+ width,
49
+ height
50
+ } = props;
51
+ if (source) return source;
52
+ if (src && typeof src !== "string") return src;
53
+ return {
54
+ uri: src,
55
+ width,
56
+ height
57
+ };
58
+ };
59
+ function createImage(options) {
60
+ const {
61
+ Component,
62
+ mapObjectFitToResizeMode = defaultObjectFitMap,
63
+ resizeModePropName = "resizeMode",
64
+ objectPositionPropName,
65
+ transformSource = defaultTransformSource
66
+ } = options;
67
+ const inlinePropsSet = /* @__PURE__ */new Set(["source", "placeholder", "transition", "contentFit", "contentPosition", "cachePolicy", "recyclingKey", "allowDownscaling", "autoplay", "blurRadius", "priority", "placeholderContentFit", "responsivePolicy", "onLoadStart", "onProgress", "onLoadEnd"]);
68
+ const StyledImage = (0, import_web.styled)(Component, {
69
+ name: "Image"
70
+ }, {
71
+ inlineProps: inlinePropsSet
72
+ });
73
+ const ImageComponent = StyledImage.styleable((incomingProps, ref) => {
74
+ const props = incomingProps;
75
+ const {
76
+ src,
77
+ width,
78
+ height,
79
+ borderRadius,
80
+ objectFit,
81
+ objectPosition,
82
+ // web only props - filter out on native
83
+ decoding,
84
+ elementTiming,
85
+ fetchpriority,
86
+ isMap,
87
+ loading,
88
+ sizes,
89
+ useMap,
90
+ onLoad,
91
+ onError,
92
+ ...rest
93
+ } = props;
94
+ const resolvedWidth = typeof width === "string" && width[0] === "$" ? (0, import_web.getTokenValue)(width, "size") : width;
95
+ const resolvedHeight = typeof height === "string" && height[0] === "$" ? (0, import_web.getTokenValue)(height, "size") : height;
96
+ const finalSource = transformSource({
97
+ src,
98
+ width: resolvedWidth,
99
+ height: resolvedHeight
100
+ });
101
+ const incomingStyle = Array.isArray(rest.style) ? Object.assign({}, ...rest.style.flat()) : rest.style;
102
+ const resolvedBorderRadius = typeof borderRadius === "string" && borderRadius[0] === "$" ? (0, import_web.getTokenValue)(borderRadius, "radius") : borderRadius;
103
+ const finalProps = {
104
+ ...rest,
105
+ source: finalSource,
106
+ style: {
107
+ ...incomingStyle,
108
+ ...(resolvedBorderRadius !== void 0 && {
109
+ borderRadius: resolvedBorderRadius
110
+ }),
111
+ ...(resolvedWidth !== void 0 && {
112
+ width: resolvedWidth
113
+ }),
114
+ ...(resolvedHeight !== void 0 && {
115
+ height: resolvedHeight
116
+ })
117
+ }
118
+ };
119
+ if (objectFit) {
120
+ finalProps[resizeModePropName] = mapObjectFitToResizeMode(objectFit);
121
+ }
122
+ if (objectPositionPropName && objectPosition) {
123
+ finalProps[objectPositionPropName] = objectPosition;
124
+ }
125
+ if (onLoad) {
126
+ finalProps.onLoad = e => {
127
+ const source = e?.nativeEvent?.source || e?.source || {};
128
+ onLoad({
129
+ target: {
130
+ naturalHeight: source?.height,
131
+ naturalWidth: source?.width
132
+ },
133
+ type: "load"
134
+ });
135
+ };
136
+ }
137
+ if (onError) {
138
+ finalProps.onError = () => {
139
+ onError({
140
+ type: "error"
141
+ });
142
+ };
143
+ }
144
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(Component, {
145
+ ref,
146
+ ...finalProps
147
+ });
148
+ });
149
+ const comp = Component;
150
+ ImageComponent.getSize = comp.getSize || (() => {});
151
+ ImageComponent.getSizeWithHeaders = comp.getSizeWithHeaders || (() => {});
152
+ ImageComponent.prefetch = comp.prefetch || (() => {});
153
+ ImageComponent.prefetchWithMetadata = comp.prefetchWithMetadata || (() => {});
154
+ ImageComponent.abortPrefetch = comp.abortPrefetch || (() => {});
155
+ ImageComponent.queryCache = comp.queryCache || (() => {});
156
+ return ImageComponent;
157
+ }
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
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, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
+ value: true
24
+ }), mod);
25
+ var createImage_exports = {};
26
+ __export(createImage_exports, {
27
+ createImage: () => createImage
28
+ });
29
+ module.exports = __toCommonJS(createImage_exports);
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ var import_web = require("@hanzogui/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;
77
+ var {
78
+ src,
79
+ width,
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
95
+ } = props;
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
102
+ });
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
112
+ }),
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) || {};
131
+ onLoad({
132
+ target: {
133
+ naturalHeight: source === null || source === void 0 ? void 0 : source.height,
134
+ naturalWidth: source === null || source === void 0 ? void 0 : source.width
135
+ },
136
+ type: "load"
137
+ });
138
+ };
139
+ }
140
+ if (onError) {
141
+ finalProps.onError = function () {
142
+ onError({
143
+ type: "error"
144
+ });
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;
160
+ }
161
+ //# sourceMappingURL=createImage.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","createImage_exports","__export","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","name","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","Object","assign","flat","resolvedBorderRadius","finalProps","e","_e_nativeEvent","nativeEvent","target","naturalHeight","naturalWidth","type","jsx","comp","getSize","getSizeWithHeaders","prefetch","prefetchWithMetadata","abortPrefetch","queryCache"],"sources":["../../src/createImage.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,mBAAA;AAAAC,QAAA,CAAAD,mBAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAsCT,YAAA,CAAAK,mBAAA;AAuO3B,IAAAK,kBAAA,GAAAC,OAAA;AA7LX,IAAAC,UAAM,GAAAD,OAAA,gBAAuB;AAC3B,IAAAE,mBAAmB,YAAAA,CAAAC,SAAA;EAAA,QACZA,SAAA;IACH,WAAO;MACT,OAAK;IACH,WAAO;MACT,OAAK;IACH,iBAAO;MACT,OAAK;IACH,cAAO;MACT;IACE;MACJ;EACF;AAEA;AAME,IAAAC,sBAAqB,YAAAA,CAAcC,KAAI;EACvC,IAAI;IAAAC,GAAA;IAAQC,MAAA;IAAOC,KAAA;IAAAC;EAAA,IAAAJ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;MAAQ;IACA;IACA,OACV,mBAAA3D,kBAAA,CAAA4D,GAAA,EAAA/C,SAAA;MACFc,GAAA;MAGA,GAAAyB;IACD;EAGD;EACA,IAAAS,IAAA,GAAAhD,SAAe;EAAkCW,cAAA,CAAAsC,OAAA,GAAAD,IAAA,CAAAC,OAAA,iBACjD;EAAuEtC,cAAA,CAAAuC,kBAAA,GAAAF,IAAA,CAAAE,kBAAA,iBACvE;EAAmDvC,cAAA,CAAAwC,QAAA,GAAAH,IAAA,CAAAG,QAAA,iBACnD;EAA2ExC,cAAA,CAAAyC,oBAAA,GAAAJ,IAAA,CAAAI,oBAAA,iBAC3E;EAA6DzC,cAAA,CAAA0C,aAAA,GAAAL,IAAA,CAAAK,aAAA,iBAC7D;EAAuD1C,cAAA,CAAA2C,UAAA,GAAAN,IAAA,CAAAM,UAAA,iBAEvD;EACF,OAAA3C,cAAA","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
+ get: () => from[key],
9
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
+ });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
+ value: true
17
+ }), mod);
18
+ var index_exports = {};
19
+ module.exports = __toCommonJS(index_exports);
20
+ __reExport(index_exports, require("./Image.cjs"), module.exports);
21
+ __reExport(index_exports, require("./createImage.cjs"), module.exports);
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __copyProps = (to, from, except, desc) => {
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
+ }
14
+ return to;
15
+ };
16
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
18
+ value: true
19
+ }), mod);
20
+ var index_exports = {};
21
+ module.exports = __toCommonJS(index_exports);
22
+ __reExport(index_exports, require("./Image.native.js"), module.exports);
23
+ __reExport(index_exports, require("./createImage.native.js"), module.exports);
24
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports","__reExport","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA;AACdG,UAAA,CAAAH,aAAA,EAAcI,OAAA,uBAAAH,MADd,CAAAC,OAAA","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
+ get: () => from[key],
9
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
+ });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
+ value: true
16
+ }), mod);
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __copyProps = (to, from, except, desc) => {
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
+ }
14
+ return to;
15
+ };
16
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
17
+ value: true
18
+ }), mod);
19
+ var types_exports = {};
20
+ module.exports = __toCommonJS(types_exports);
21
+ //# sourceMappingURL=types.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","types_exports"],"sources":["../../src/types.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA","ignoreList":[]}
@@ -0,0 +1,101 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
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, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
34
+ var Image_exports = {};
35
+ __export(Image_exports, {
36
+ Image: () => Image
37
+ });
38
+ module.exports = __toCommonJS(Image_exports);
39
+ var import_react = __toESM(require("react"), 1);
40
+ var import_constants = require("@hanzogui/constants");
41
+ var import_web = require("@hanzogui/web");
42
+ var import_react_native = require("react-native-web");
43
+ var import_jsx_runtime = require("react/jsx-runtime");
44
+ const StyledImage = (0, import_web.styled)(import_react_native.Image, {
45
+ name: "Image"
46
+ });
47
+ let hasWarned = false;
48
+ const Image = StyledImage.styleable((inProps, ref) => {
49
+ const [props, style] = (0, import_web.usePropsAndStyle)(inProps);
50
+ const {
51
+ src,
52
+ source,
53
+ objectFit,
54
+ ...rest
55
+ } = props;
56
+ if (process.env.NODE_ENV === "development") {
57
+ if (typeof src === "string") {
58
+ if (typeof props.width === "string" && props.width[0] !== "$" || typeof props.height === "string" && props.height[0] !== "$") {
59
+ if (!hasWarned) {
60
+ hasWarned = true;
61
+ 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.`);
62
+ }
63
+ }
64
+ }
65
+ }
66
+ let finalSource = typeof src === "string" ? {
67
+ uri: src,
68
+ ...(import_constants.isWeb && {
69
+ width: props.width || style?.width,
70
+ height: props.height || style?.height
71
+ })
72
+ } : source ?? src;
73
+ if (finalSource && typeof finalSource === "object") {
74
+ if (process.env.NODE_ENV === "development" && process.env.TAMAGUI_IMAGE_CHECK_ERROR) import_react.default.useEffect(() => {
75
+ async function run() {
76
+ if (typeof src === "string") try {
77
+ await fetch(src).then(res => res.text());
78
+ } catch (err) {
79
+ console.error(`Error loading image: ${src}`, {
80
+ props
81
+ });
82
+ }
83
+ }
84
+ run();
85
+ }, [src]);
86
+ if (finalSource["default"]) finalSource = finalSource["default"];
87
+ }
88
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.Image, {
89
+ resizeMode: objectFit,
90
+ ref,
91
+ source: finalSource,
92
+ style,
93
+ ...rest
94
+ });
95
+ });
96
+ Image.getSize = import_react_native.Image.getSize;
97
+ Image.getSizeWithHeaders = import_react_native.Image.getSizeWithHeaders;
98
+ Image.prefetch = import_react_native.Image.prefetch;
99
+ Image.prefetchWithMetadata = import_react_native.Image.prefetchWithMetadata;
100
+ Image.abortPrefetch = import_react_native.Image.abortPrefetch;
101
+ Image.queryCache = import_react_native.Image.queryCache;