@hanzogui/image 3.0.2 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/LICENSE +40 -19
  2. package/dist/cjs/Image.cjs +43 -41
  3. package/dist/cjs/Image.native.js +17 -15
  4. package/dist/cjs/Image.native.js.map +1 -1
  5. package/dist/cjs/createImage.cjs +123 -94
  6. package/dist/cjs/createImage.native.js +128 -101
  7. package/dist/cjs/createImage.native.js.map +1 -1
  8. package/dist/cjs/index.cjs +7 -5
  9. package/dist/cjs/index.native.js +7 -5
  10. package/dist/cjs/index.native.js.map +1 -1
  11. package/dist/cjs/types.cjs +7 -5
  12. package/dist/cjs/types.native.js +7 -5
  13. package/dist/cjs/types.native.js.map +1 -1
  14. package/dist/cjs/v1/Image.cjs +65 -50
  15. package/dist/cjs/v1/Image.native.js +92 -74
  16. package/dist/cjs/v1/Image.native.js.map +1 -1
  17. package/dist/cjs/v1/index.cjs +7 -5
  18. package/dist/cjs/v1/index.native.js +7 -5
  19. package/dist/cjs/v1/index.native.js.map +1 -1
  20. package/dist/esm/Image.mjs +28 -28
  21. package/dist/esm/Image.mjs.map +1 -1
  22. package/dist/esm/createImage.mjs +109 -82
  23. package/dist/esm/createImage.mjs.map +1 -1
  24. package/dist/esm/createImage.native.js +113 -88
  25. package/dist/esm/createImage.native.js.map +1 -1
  26. package/dist/esm/v1/Image.mjs +34 -21
  27. package/dist/esm/v1/Image.mjs.map +1 -1
  28. package/dist/esm/v1/Image.native.js +62 -46
  29. package/dist/esm/v1/Image.native.js.map +1 -1
  30. package/dist/jsx/Image.mjs +28 -28
  31. package/dist/jsx/Image.mjs.map +1 -1
  32. package/dist/jsx/Image.native.js +17 -15
  33. package/dist/jsx/Image.native.js.map +1 -1
  34. package/dist/jsx/createImage.mjs +109 -82
  35. package/dist/jsx/createImage.mjs.map +1 -1
  36. package/dist/jsx/createImage.native.js +128 -101
  37. package/dist/jsx/createImage.native.js.map +1 -1
  38. package/dist/jsx/index.native.js +7 -5
  39. package/dist/jsx/types.native.js +7 -5
  40. package/dist/jsx/v1/Image.mjs +34 -21
  41. package/dist/jsx/v1/Image.mjs.map +1 -1
  42. package/dist/jsx/v1/Image.native.js +92 -74
  43. package/dist/jsx/v1/Image.native.js.map +1 -1
  44. package/dist/jsx/v1/index.native.js +7 -5
  45. package/package.json +13 -10
  46. package/src/createImage.tsx +11 -2
  47. package/src/v1/Image.tsx +2 -2
  48. package/types/Image.d.ts.map +1 -0
  49. package/types/Image.native.d.ts +2 -2
  50. package/types/Image.native.d.ts.map +1 -0
  51. package/types/createImage.d.ts +3 -3
  52. package/types/createImage.d.ts.map +1 -0
  53. package/types/index.d.ts.map +1 -0
  54. package/types/types.d.ts +1 -1
  55. package/types/types.d.ts.map +1 -0
  56. package/types/v1/Image.d.ts +2 -2
  57. package/types/v1/Image.d.ts.map +1 -0
  58. package/types/v1/index.d.ts.map +1 -0
@@ -5,130 +5,157 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
23
+ value: true
22
24
  }), mod);
23
25
  var createImage_exports = {};
24
26
  __export(createImage_exports, {
25
27
  createImage: () => createImage
26
28
  });
27
29
  module.exports = __toCommonJS(createImage_exports);
28
- var import_jsx_runtime = require("react/jsx-runtime"),
29
- import_gui_web = require("@hanzogui/web"),
30
- defaultObjectFitMap = function (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
- defaultTransformSource = function (props) {
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;
45
77
  var {
46
78
  src,
47
- source,
48
79
  width,
49
- height
80
+ height,
81
+ borderRadius,
82
+ objectFit,
83
+ objectPosition,
84
+ // web only props - filter out on native
85
+ decoding,
86
+ elementTiming,
87
+ fetchpriority,
88
+ isMap,
89
+ loading,
90
+ sizes,
91
+ useMap,
92
+ onLoad,
93
+ onError,
94
+ ...rest
50
95
  } = props;
51
- return source || (src && typeof src != "string" ? src : {
52
- uri: src,
53
- width,
54
- height
96
+ var resolvedWidth = typeof width === "string" && width[0] === "$" ? (0, import_web.getTokenValue)(width, "size") : width;
97
+ var resolvedHeight = typeof height === "string" && height[0] === "$" ? (0, import_web.getTokenValue)(height, "size") : height;
98
+ var finalSource = transformSource({
99
+ src,
100
+ width: resolvedWidth,
101
+ height: resolvedHeight
55
102
  });
56
- };
57
- function createImage(options) {
58
- var {
59
- Component,
60
- mapObjectFitToResizeMode = defaultObjectFitMap,
61
- resizeModePropName = "resizeMode",
62
- objectPositionPropName,
63
- transformSource = defaultTransformSource
64
- } = options,
65
- inlinePropsSet = /* @__PURE__ */new Set(["source", "placeholder", "transition", "contentFit", "contentPosition", "cachePolicy", "recyclingKey", "allowDownscaling", "autoplay", "blurRadius", "priority", "placeholderContentFit", "responsivePolicy", "onLoadStart", "onProgress", "onLoadEnd"]),
66
- StyledImage = (0, import_gui_web.styled)(Component, {
67
- name: "Image"
68
- }, {
69
- inlineProps: inlinePropsSet
70
- }),
71
- ImageComponent = StyledImage.styleable(function (incomingProps, ref) {
72
- var props = incomingProps,
73
- {
74
- src,
75
- width,
76
- height,
77
- objectFit,
78
- objectPosition,
79
- // web only props - filter out on native
80
- decoding,
81
- elementTiming,
82
- fetchpriority,
83
- isMap,
84
- loading,
85
- sizes,
86
- useMap,
87
- onLoad,
88
- onError,
89
- ...rest
90
- } = props,
91
- resolvedWidth = typeof width == "string" && width[0] === "$" ? (0, import_gui_web.getTokenValue)(width) : width,
92
- resolvedHeight = typeof height == "string" && height[0] === "$" ? (0, import_gui_web.getTokenValue)(height) : height,
93
- finalSource = transformSource({
94
- src,
95
- width: resolvedWidth,
96
- height: resolvedHeight
103
+ var incomingStyle = Array.isArray(rest.style) ? Object.assign({}, ...rest.style.flat()) : rest.style;
104
+ var resolvedBorderRadius = typeof borderRadius === "string" && borderRadius[0] === "$" ? (0, import_web.getTokenValue)(borderRadius, "radius") : borderRadius;
105
+ var finalProps = {
106
+ ...rest,
107
+ source: finalSource,
108
+ style: {
109
+ ...incomingStyle,
110
+ ...(resolvedBorderRadius !== void 0 && {
111
+ borderRadius: resolvedBorderRadius
97
112
  }),
98
- incomingStyle = Array.isArray(rest.style) ? Object.assign({}, ...rest.style.flat()) : rest.style,
99
- finalProps = {
100
- ...rest,
101
- source: finalSource,
102
- style: {
103
- ...incomingStyle,
104
- ...(resolvedWidth !== void 0 && {
105
- width: resolvedWidth
106
- }),
107
- ...(resolvedHeight !== void 0 && {
108
- height: resolvedHeight
109
- })
110
- }
111
- };
112
- return objectFit && (finalProps[resizeModePropName] = mapObjectFitToResizeMode(objectFit)), objectPositionPropName && objectPosition && (finalProps[objectPositionPropName] = objectPosition), onLoad && (finalProps.onLoad = function (e) {
113
- var _e_nativeEvent,
114
- source = (e == null || (_e_nativeEvent = e.nativeEvent) === null || _e_nativeEvent === void 0 ? void 0 : _e_nativeEvent.source) || e?.source || {};
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) || {};
115
131
  onLoad({
116
132
  target: {
117
- naturalHeight: source?.height,
118
- naturalWidth: source?.width
133
+ naturalHeight: source === null || source === void 0 ? void 0 : source.height,
134
+ naturalWidth: source === null || source === void 0 ? void 0 : source.width
119
135
  },
120
136
  type: "load"
121
137
  });
122
- }), onError && (finalProps.onError = function () {
138
+ };
139
+ }
140
+ if (onError) {
141
+ finalProps.onError = function () {
123
142
  onError({
124
143
  type: "error"
125
144
  });
126
- }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(Component, {
127
- ref,
128
- ...finalProps
129
- });
130
- }),
131
- comp = Component;
132
- return ImageComponent.getSize = comp.getSize || function () {}, ImageComponent.getSizeWithHeaders = comp.getSizeWithHeaders || function () {}, ImageComponent.prefetch = comp.prefetch || function () {}, ImageComponent.prefetchWithMetadata = comp.prefetchWithMetadata || function () {}, ImageComponent.abortPrefetch = comp.abortPrefetch || function () {}, ImageComponent.queryCache = comp.queryCache || function () {}, ImageComponent;
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;
133
160
  }
134
161
  //# sourceMappingURL=createImage.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","createImage_exports","__export","createImage","module","exports","import_jsx_runtime","require","import_gui_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","objectPosition","decoding","elementTiming","fetchpriority","isMap","loading","sizes","useMap","onLoad","onError","rest","resolvedWidth","getTokenValue","resolvedHeight","finalSource","incomingStyle","Array","isArray","style","Object","assign","flat","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,GAAAT,YAAsC,CAAAK,mBA8N3B;AApLX,IAAAK,kBAAM,GAAAC,OAAuB,oBAAuC;EAAAC,cAAA,GAAAD,OAAA;EAAAE,mBAAA,YAAAA,CAAAC,SAAA;IAClE,QAAQA,SAAA;MACN,KAAK;QACH,OAAO;MACT,KAAK;QACH,OAAO;MACT,KAAK;QACH,OAAO;MACT,KAAK;QACH,OAAO;MACT;QACE,OAAO;IACX;EACF;EAEMC,sBAAA,GAAyB,SAAAA,CAACC,KAK1B;IACJ;MAAMC,GAAE;MAAAC,MAAK;MAAAC,KAAQ;MAAAC;IAAO,IAAOJ,KAAI;IACvC,OAAIE,MAAA,KACAD,GAAA,IAAO,OAAOA,GAAA,IAAQ,WAAiBA,GAAA,GACpC;MACLI,GAAA,EAAKJ,GAAA;MACLE,KAAA;MACAC;IACF;EACF;AAyBO,SAASb,YACde,OAAA,EACA;EACA;MAAMC,SAAA;MAAAC,wBAAA,GAAAX,mBAAA;MAAAY,kBAAA;MAAAC,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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,KAAA;EACnB,IAAIE,MAAA,EAAO,OAAOA,MAAA;EAClB,IAAAD,GAAO,WAAAA,GAAA,sBAAAA,GAAA;EAAA,OACA;IACLI,GAAA,EAAAJ,GAAA;IACAE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e;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":[]}
@@ -3,15 +3,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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, {
7
8
  get: () => from[key],
8
9
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
10
  });
10
- return to;
11
- },
12
- __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
15
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
- value: !0
16
+ value: true
15
17
  }), mod);
16
18
  var index_exports = {};
17
19
  module.exports = __toCommonJS(index_exports);
@@ -5,15 +5,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
9
10
  get: () => from[key],
10
11
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
12
  });
12
- return to;
13
- },
14
- __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ }
14
+ return to;
15
+ };
16
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
17
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
- value: !0
18
+ value: true
17
19
  }), mod);
18
20
  var index_exports = {};
19
21
  module.exports = __toCommonJS(index_exports);
@@ -1 +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":[]}
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":[]}
@@ -3,14 +3,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
- get: () => from[key],
8
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
- });
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
+ }
10
12
  return to;
11
13
  };
12
14
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
13
- value: !0
15
+ value: true
14
16
  }), mod);
15
17
  var types_exports = {};
16
18
  module.exports = __toCommonJS(types_exports);
@@ -5,14 +5,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
- get: () => from[key],
10
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
- });
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
12
14
  return to;
13
15
  };
14
16
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
- value: !0
17
+ value: true
16
18
  }), mod);
17
19
  var types_exports = {};
18
20
  module.exports = __toCommonJS(types_exports);
@@ -1 +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":[]}
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":[]}
@@ -2,75 +2,90 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
23
+ // 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);
32
34
  var Image_exports = {};
33
35
  __export(Image_exports, {
34
36
  Image: () => Image
35
37
  });
36
38
  module.exports = __toCommonJS(Image_exports);
37
- var import_react = __toESM(require("react"), 1),
38
- import_gui_constants = require("@hanzogui/constants"),
39
- import_gui_web = require("@hanzogui/web"),
40
- import_react_native = require("react-native-web"),
41
- import_jsx_runtime = require("react/jsx-runtime");
42
- const StyledImage = (0, import_gui_web.styled)(import_react_native.Image, {
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, {
43
45
  name: "Image"
44
46
  });
45
- let hasWarned = !1;
47
+ let hasWarned = false;
46
48
  const Image = StyledImage.styleable((inProps, ref) => {
47
- const [props, style] = (0, import_gui_web.usePropsAndStyle)(inProps),
48
- {
49
- src,
50
- source,
51
- objectFit,
52
- ...rest
53
- } = props;
54
- process.env.NODE_ENV === "development" && typeof src == "string" && (typeof props.width == "string" && props.width[0] !== "$" || typeof props.height == "string" && props.height[0] !== "$") && (hasWarned || (hasWarned = !0, console.warn('React Native expects a numerical width/height. If you want to use a percent you must define the "source" prop with width, height, and uri.')));
55
- let finalSource = typeof src == "string" ? {
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" ? {
56
67
  uri: src,
57
- ...(import_gui_constants.isWeb && {
68
+ ...(import_constants.isWeb && {
58
69
  width: props.width || style?.width,
59
70
  height: props.height || style?.height
60
71
  })
61
72
  } : source ?? src;
62
- return finalSource && typeof finalSource == "object" && (process.env.NODE_ENV === "development" && process.env.HANZO_GUI_IMAGE_CHECK_ERROR && import_react.default.useEffect(() => {
63
- async function run() {
64
- if (typeof src == "string") try {
65
- await fetch(src).then(res => res.text());
66
- } catch {
67
- console.error(`Error loading image: ${src}`, {
68
- props
69
- });
73
+ if (finalSource && typeof finalSource === "object") {
74
+ if (process.env.NODE_ENV === "development" && process.env.GUI_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
+ }
70
83
  }
71
- }
72
- run();
73
- }, [src]), finalSource.default && (finalSource = finalSource.default)), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.Image, {
84
+ run();
85
+ }, [src]);
86
+ if (finalSource["default"]) finalSource = finalSource["default"];
87
+ }
88
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.Image, {
74
89
  resizeMode: objectFit,
75
90
  ref,
76
91
  source: finalSource,