@jag-k/scriptable-jsx 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -262,14 +262,15 @@ function processContainerChildren(widget, children) {
262
262
  }
263
263
  case "image": {
264
264
  let init;
265
- if (child.props.image) {
266
- init = child.props.image;
265
+ const { data } = child.props || {};
266
+ if (typeof data === "string") {
267
+ init = Image.fromFile(child.props.fileURL);
267
268
  }
268
- else if (child.props.data) {
269
- init = Image.fromData(child.props.data);
269
+ else if (data.size) {
270
+ init = data;
270
271
  }
271
- else if (child.props.fileURL) {
272
- init = Image.fromFile(child.props.fileURL);
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
@@ -2,7 +2,7 @@
2
2
  "name": "@jag-k/scriptable-jsx",
3
3
  "description": "Create a Scriptable bundle from JSX",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
- "version": "1.0.1",
5
+ "version": "1.1.0",
6
6
  "author": {
7
7
  "email": "jag.konon@gmail.com",
8
8
  "name": "Jag_k",
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 ImageCommonProps extends Alienable {
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;