@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.
- package/LICENSE +40 -19
- package/dist/cjs/Image.cjs +43 -41
- package/dist/cjs/Image.native.js +17 -15
- package/dist/cjs/Image.native.js.map +1 -1
- package/dist/cjs/createImage.cjs +123 -94
- package/dist/cjs/createImage.native.js +128 -101
- package/dist/cjs/createImage.native.js.map +1 -1
- package/dist/cjs/index.cjs +7 -5
- package/dist/cjs/index.native.js +7 -5
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/types.cjs +7 -5
- package/dist/cjs/types.native.js +7 -5
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/v1/Image.cjs +65 -50
- package/dist/cjs/v1/Image.native.js +92 -74
- package/dist/cjs/v1/Image.native.js.map +1 -1
- package/dist/cjs/v1/index.cjs +7 -5
- package/dist/cjs/v1/index.native.js +7 -5
- package/dist/cjs/v1/index.native.js.map +1 -1
- package/dist/esm/Image.mjs +28 -28
- package/dist/esm/Image.mjs.map +1 -1
- package/dist/esm/createImage.mjs +109 -82
- package/dist/esm/createImage.mjs.map +1 -1
- package/dist/esm/createImage.native.js +113 -88
- package/dist/esm/createImage.native.js.map +1 -1
- package/dist/esm/v1/Image.mjs +34 -21
- package/dist/esm/v1/Image.mjs.map +1 -1
- package/dist/esm/v1/Image.native.js +62 -46
- package/dist/esm/v1/Image.native.js.map +1 -1
- package/dist/jsx/Image.mjs +28 -28
- package/dist/jsx/Image.mjs.map +1 -1
- package/dist/jsx/Image.native.js +17 -15
- package/dist/jsx/Image.native.js.map +1 -1
- package/dist/jsx/createImage.mjs +109 -82
- package/dist/jsx/createImage.mjs.map +1 -1
- package/dist/jsx/createImage.native.js +128 -101
- package/dist/jsx/createImage.native.js.map +1 -1
- package/dist/jsx/index.native.js +7 -5
- package/dist/jsx/types.native.js +7 -5
- package/dist/jsx/v1/Image.mjs +34 -21
- package/dist/jsx/v1/Image.mjs.map +1 -1
- package/dist/jsx/v1/Image.native.js +92 -74
- package/dist/jsx/v1/Image.native.js.map +1 -1
- package/dist/jsx/v1/index.native.js +7 -5
- package/package.json +13 -10
- package/src/createImage.tsx +11 -2
- package/src/v1/Image.tsx +2 -2
- package/types/Image.d.ts.map +1 -0
- package/types/Image.native.d.ts +2 -2
- package/types/Image.native.d.ts.map +1 -0
- package/types/createImage.d.ts +3 -3
- package/types/createImage.d.ts.map +1 -0
- package/types/index.d.ts.map +1 -0
- package/types/types.d.ts +1 -1
- package/types/types.d.ts.map +1 -0
- package/types/v1/Image.d.ts +2 -2
- package/types/v1/Image.d.ts.map +1 -0
- 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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
23
|
+
value: true
|
|
22
24
|
}), mod);
|
|
23
25
|
var createImage_exports = {};
|
|
24
26
|
__export(createImage_exports, {
|
|
25
27
|
createImage: () => createImage
|
|
26
28
|
});
|
|
27
29
|
module.exports = __toCommonJS(createImage_exports);
|
|
28
|
-
var import_jsx_runtime = require("react/jsx-runtime")
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
var import_web = require("@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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
96
|
+
var resolvedWidth = typeof width === "string" && width[0] === "$" ? (0, import_web.getTokenValue)(width, "size") : width;
|
|
97
|
+
var resolvedHeight = typeof height === "string" && height[0] === "$" ? (0, import_web.getTokenValue)(height, "size") : height;
|
|
98
|
+
var finalSource = transformSource({
|
|
99
|
+
src,
|
|
100
|
+
width: resolvedWidth,
|
|
101
|
+
height: resolvedHeight
|
|
55
102
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
inlinePropsSet = /* @__PURE__ */new Set(["source", "placeholder", "transition", "contentFit", "contentPosition", "cachePolicy", "recyclingKey", "allowDownscaling", "autoplay", "blurRadius", "priority", "placeholderContentFit", "responsivePolicy", "onLoadStart", "onProgress", "onLoadEnd"]),
|
|
66
|
-
StyledImage = (0, import_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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
|
118
|
-
naturalWidth: source
|
|
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
|
-
}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
if (onError) {
|
|
141
|
+
finalProps.onError = function () {
|
|
123
142
|
onError({
|
|
124
143
|
type: "error"
|
|
125
144
|
});
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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","
|
|
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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f,MAAA,aAAAgB,CAAA;QACb,IAAAC,cAAA;QAGI,IAAA9C,MAAQ,IAAA6C,CAAA,aAAAA,CAAA,wBAAAC,cAAA,GAAAD,CAAA,CAAAE,WAAA,cAAAD,cAAA,uBAAAA,cAAA,CAAA9C,MAAA,MAAA6C,CAAA,aAAAA,CAAA,uBAAAA,CAAA,CAAA7C,MAAA;QACV6B,MAAA;UACEmB,MAAM;YACNC,aAAO,EAAAjD,MAAA,aAAAA,MAAA,uBAAAA,MAAA,CAAAE,MAAA;YACLgD,YAAQ,EAAAlD,MAAA,aAAAA,MAAA,uBAAAA,MAAA,CAAAC;UAAA;UACiBkD,IACvB;QAAsB,EACxB;MAAA;IACM;IACA,IACVrB,OAAA;MACFc,UAAA,CAAAd,OAAA;QAGIA,OAAA;UACFqB,IAAA;QACE;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":[]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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:
|
|
16
|
+
value: true
|
|
15
17
|
}), mod);
|
|
16
18
|
var index_exports = {};
|
|
17
19
|
module.exports = __toCommonJS(index_exports);
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -5,15 +5,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
9
10
|
get: () => from[key],
|
|
10
11
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
12
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
17
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value:
|
|
18
|
+
value: true
|
|
17
19
|
}), mod);
|
|
18
20
|
var index_exports = {};
|
|
19
21
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports","__reExport","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"
|
|
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":[]}
|
package/dist/cjs/types.cjs
CHANGED
|
@@ -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
|
|
7
|
-
|
|
8
|
-
|
|
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:
|
|
15
|
+
value: true
|
|
14
16
|
}), mod);
|
|
15
17
|
var types_exports = {};
|
|
16
18
|
module.exports = __toCommonJS(types_exports);
|
package/dist/cjs/types.native.js
CHANGED
|
@@ -5,14 +5,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
10
|
+
get: () => from[key],
|
|
11
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
12
|
+
});
|
|
13
|
+
}
|
|
12
14
|
return to;
|
|
13
15
|
};
|
|
14
16
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
15
|
-
value:
|
|
17
|
+
value: true
|
|
16
18
|
}), mod);
|
|
17
19
|
var types_exports = {};
|
|
18
20
|
module.exports = __toCommonJS(types_exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","types_exports"],"sources":["../../src/types.ts"],"sourcesContent":[null],"mappings":"
|
|
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":[]}
|
package/dist/cjs/v1/Image.cjs
CHANGED
|
@@ -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
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const StyledImage = (0,
|
|
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 =
|
|
47
|
+
let hasWarned = false;
|
|
46
48
|
const Image = StyledImage.styleable((inProps, ref) => {
|
|
47
|
-
const [props, style] = (0,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
process.env.NODE_ENV === "development"
|
|
55
|
-
|
|
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
|
-
...(
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
73
|
-
|
|
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,
|