@jag-k/scriptable-jsx 1.0.1 → 1.1.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/dist/index.js +7 -6
- package/package.json +1 -1
- package/types/widget.d.ts +2 -5
package/dist/index.js
CHANGED
@@ -262,14 +262,15 @@ function processContainerChildren(widget, children) {
|
|
262
262
|
}
|
263
263
|
case "image": {
|
264
264
|
let init;
|
265
|
-
|
266
|
-
|
265
|
+
const { data } = child.props || {};
|
266
|
+
if (typeof data === "string") {
|
267
|
+
init = Image.fromFile(child.props.fileURL);
|
267
268
|
}
|
268
|
-
else if (
|
269
|
-
init =
|
269
|
+
else if (data.size) {
|
270
|
+
init = data;
|
270
271
|
}
|
271
|
-
else
|
272
|
-
init = Image.
|
272
|
+
else {
|
273
|
+
init = Image.fromData(data);
|
273
274
|
}
|
274
275
|
const image = widget.addImage(init);
|
275
276
|
processImageProps(image, child.props || {});
|
package/package.json
CHANGED
package/types/widget.d.ts
CHANGED
@@ -62,7 +62,8 @@ export declare namespace JSX {
|
|
62
62
|
|
63
63
|
type ImageContentMode = "fitting" | "filling";
|
64
64
|
|
65
|
-
interface
|
65
|
+
interface ImageProps extends Alienable {
|
66
|
+
data: string /* file url */ | Image | Data;
|
66
67
|
size?: Size;
|
67
68
|
cornerRadius?: number;
|
68
69
|
resizable?: boolean;
|
@@ -75,10 +76,6 @@ export declare namespace JSX {
|
|
75
76
|
contentMode?: ImageContentMode;
|
76
77
|
}
|
77
78
|
|
78
|
-
type ImageProps =
|
79
|
-
& ImageCommonProps
|
80
|
-
& ({ data: Data } | { fileURL: string } | { image: Image });
|
81
|
-
|
82
79
|
interface DateProps extends TextProps {
|
83
80
|
date: Date | string | number;
|
84
81
|
style?: DateStyle;
|