@tamagui/image 1.0.1-beta.67 → 1.0.1-beta.70

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/cjs/Image.js CHANGED
@@ -1,6 +1,8 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
7
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
8
  var __getProtoOf = Object.getPrototypeOf;
@@ -18,6 +20,7 @@ var __spreadValues = (a, b) => {
18
20
  }
19
21
  return a;
20
22
  };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
24
  var __objRest = (source, exclude) => {
22
25
  var target = {};
23
26
  for (var prop in source)
@@ -56,22 +59,23 @@ import_react.default["createElement"];
56
59
  const StyledImage = (0, import_core.styled)(import_react_native.Image, {
57
60
  name: "Image",
58
61
  position: "relative",
59
- source: { uri: "" }
62
+ source: { uri: "" },
63
+ zIndex: 1
60
64
  }, {
61
65
  inlineProps: /* @__PURE__ */ new Set(["src", "width", "height"])
62
66
  });
63
67
  const Image = StyledImage.extractable((inProps) => {
64
68
  const props = (0, import_core.getExpandedShorthands)(inProps);
65
69
  const _a = props, { src, width = 100, height = 100 } = _a, rest = __objRest(_a, ["src", "width", "height"]);
66
- const source = typeof src === "string" ? { uri: src, width, height } : src;
70
+ const source = typeof src === "string" ? __spreadValues({ uri: src }, import_core.isWeb && { width, height }) : src;
67
71
  const defaultSource = Array.isArray(source) ? source[0] : source;
68
72
  if (!defaultSource) {
69
73
  return null;
70
74
  }
71
- return /* @__PURE__ */ import_react.default.createElement(StyledImage, __spreadValues({
75
+ return /* @__PURE__ */ import_react.default.createElement(StyledImage, __spreadValues(__spreadProps(__spreadValues({}, !import_core.isWeb && { style: { width, height } }), {
72
76
  defaultSource,
73
77
  source
74
- }, rest));
78
+ }), rest));
75
79
  });
76
80
  // Annotate the CommonJS export names for ESM import in node:
77
81
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Image.tsx"],
4
- "sourcesContent": ["import { GetProps, StackProps, getExpandedShorthands, styled } from '@tamagui/core'\nimport React from 'react'\nimport { Image as RNImage } from 'react-native'\n\nReact['createElement']\n\nconst StyledImage = styled(\n RNImage,\n {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n },\n {\n inlineProps: new Set(['src', 'width', 'height']),\n }\n)\n\ntype StyledImageProps = GetProps<typeof StyledImage>\n\ntype BaseProps = Omit<StyledImageProps, 'source' | 'width' | 'height' | 'style' | 'onLayout'> & {\n width: number\n height: number\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) => {\n const props = getExpandedShorthands(inProps)\n const { src, width = 100, height = 100, ...rest } = props\n const source = typeof src === 'string' ? { uri: src, width, height } : src\n const defaultSource = Array.isArray(source) ? source[0] : source\n\n if (!defaultSource) {\n // placeholder with customizability\n return null\n }\n\n // must set defaultSource to allow SSR, default it to the same as src\n // @ts-ignore we pass all react-native-web props down\n return <StyledImage defaultSource={defaultSource} source={source} {...rest} />\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAoE;AACpE,mBAAkB;AAClB,0BAAiC;AAEjC,qBAAM;AAEN,MAAM,cAAc,wBAClB,2BACA;AAAA,EACE,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AACpB,GACA;AAAA,EACE,aAAa,oBAAI,IAAI,CAAC,OAAO,SAAS,QAAQ,CAAC;AACjD,CACF;AAYO,MAAM,QAA8B,YAAY,YAAY,CAAC,YAAY;AAC9E,QAAM,QAAQ,uCAAsB,OAAO;AAC3C,QAAoD,YAA5C,OAAK,QAAQ,KAAK,SAAS,QAAiB,IAAT,iBAAS,IAAT,CAAnC,OAAK,SAAa;AAC1B,QAAM,SAAS,OAAO,QAAQ,WAAW,EAAE,KAAK,KAAK,OAAO,OAAO,IAAI;AACvE,QAAM,gBAAgB,MAAM,QAAQ,MAAM,IAAI,OAAO,KAAK;AAE1D,MAAI,CAAC,eAAe;AAElB,WAAO;AAAA,EACT;AAIA,SAAO,mDAAC;AAAA,IAAY;AAAA,IAA8B;AAAA,KAAoB,KAAM;AAC9E,CAAC;",
4
+ "sourcesContent": ["import { GetProps, StackProps, getExpandedShorthands, isWeb, styled } from '@tamagui/core'\nimport React from 'react'\nimport { Image as RNImage } from 'react-native'\n\nReact['createElement']\n\nconst StyledImage = styled(\n RNImage,\n {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n zIndex: 1,\n },\n {\n inlineProps: new Set(['src', 'width', 'height']),\n }\n)\n\ntype StyledImageProps = GetProps<typeof StyledImage>\n\ntype BaseProps = Omit<StyledImageProps, 'source' | 'width' | 'height' | 'style' | 'onLayout'> & {\n width: number\n height: number\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) => {\n const props = getExpandedShorthands(inProps)\n const { src, width = 100, height = 100, ...rest } = props\n const source = typeof src === 'string' ? { uri: src, ...(isWeb && { width, height }) } : src\n const defaultSource = Array.isArray(source) ? source[0] : source\n\n if (!defaultSource) {\n // placeholder with customizability\n return null\n }\n\n // must set defaultSource to allow SSR, default it to the same as src\n return (\n <StyledImage\n {...(!isWeb && { style: { width, height } })}\n defaultSource={defaultSource}\n source={source}\n {...(rest as any)}\n />\n )\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2E;AAC3E,mBAAkB;AAClB,0BAAiC;AAEjC,qBAAM;AAEN,MAAM,cAAc,wBAClB,2BACA;AAAA,EACE,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AAAA,EAClB,QAAQ;AACV,GACA;AAAA,EACE,aAAa,oBAAI,IAAI,CAAC,OAAO,SAAS,QAAQ,CAAC;AACjD,CACF;AAYO,MAAM,QAA8B,YAAY,YAAY,CAAC,YAAY;AAC9E,QAAM,QAAQ,uCAAsB,OAAO;AAC3C,QAAoD,YAA5C,OAAK,QAAQ,KAAK,SAAS,QAAiB,IAAT,iBAAS,IAAT,CAAnC,OAAK,SAAa;AAC1B,QAAM,SAAS,OAAO,QAAQ,WAAW,iBAAE,KAAK,OAAS,qBAAS,EAAE,OAAO,OAAO,KAAO;AACzF,QAAM,gBAAgB,MAAM,QAAQ,MAAM,IAAI,OAAO,KAAK;AAE1D,MAAI,CAAC,eAAe;AAElB,WAAO;AAAA,EACT;AAGA,SACE,mDAAC,6DACM,CAAC,qBAAS,EAAE,OAAO,EAAE,OAAO,OAAO,EAAE,IAD3C;AAAA,IAEC;AAAA,IACA;AAAA,MACK,KACP;AAEJ,CAAC;",
6
6
  "names": []
7
7
  }
package/dist/esm/Image.js CHANGED
@@ -1,23 +1,25 @@
1
- import { getExpandedShorthands, styled } from "@tamagui/core";
1
+ import { getExpandedShorthands, isWeb, styled } from "@tamagui/core";
2
2
  import React from "react";
3
3
  import { Image as RNImage } from "react-native";
4
4
  React["createElement"];
5
5
  const StyledImage = styled(RNImage, {
6
6
  name: "Image",
7
7
  position: "relative",
8
- source: { uri: "" }
8
+ source: { uri: "" },
9
+ zIndex: 1
9
10
  }, {
10
11
  inlineProps: /* @__PURE__ */ new Set(["src", "width", "height"])
11
12
  });
12
13
  const Image = StyledImage.extractable((inProps) => {
13
14
  const props = getExpandedShorthands(inProps);
14
15
  const { src, width = 100, height = 100, ...rest } = props;
15
- const source = typeof src === "string" ? { uri: src, width, height } : src;
16
+ const source = typeof src === "string" ? { uri: src, ...isWeb && { width, height } } : src;
16
17
  const defaultSource = Array.isArray(source) ? source[0] : source;
17
18
  if (!defaultSource) {
18
19
  return null;
19
20
  }
20
21
  return /* @__PURE__ */ React.createElement(StyledImage, {
22
+ ...!isWeb && { style: { width, height } },
21
23
  defaultSource,
22
24
  source,
23
25
  ...rest
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Image.tsx"],
4
- "sourcesContent": ["import { GetProps, StackProps, getExpandedShorthands, styled } from '@tamagui/core'\nimport React from 'react'\nimport { Image as RNImage } from 'react-native'\n\nReact['createElement']\n\nconst StyledImage = styled(\n RNImage,\n {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n },\n {\n inlineProps: new Set(['src', 'width', 'height']),\n }\n)\n\ntype StyledImageProps = GetProps<typeof StyledImage>\n\ntype BaseProps = Omit<StyledImageProps, 'source' | 'width' | 'height' | 'style' | 'onLayout'> & {\n width: number\n height: number\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) => {\n const props = getExpandedShorthands(inProps)\n const { src, width = 100, height = 100, ...rest } = props\n const source = typeof src === 'string' ? { uri: src, width, height } : src\n const defaultSource = Array.isArray(source) ? source[0] : source\n\n if (!defaultSource) {\n // placeholder with customizability\n return null\n }\n\n // must set defaultSource to allow SSR, default it to the same as src\n // @ts-ignore we pass all react-native-web props down\n return <StyledImage defaultSource={defaultSource} source={source} {...rest} />\n})\n"],
5
- "mappings": "AAAA;AACA;AACA;AAEA,MAAM;AAEN,MAAM,cAAc,OAClB,SACA;AAAA,EACE,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AACpB,GACA;AAAA,EACE,aAAa,oBAAI,IAAI,CAAC,OAAO,SAAS,QAAQ,CAAC;AACjD,CACF;AAYO,MAAM,QAA8B,YAAY,YAAY,CAAC,YAAY;AAC9E,QAAM,QAAQ,sBAAsB,OAAO;AAC3C,QAAM,EAAE,KAAK,QAAQ,KAAK,SAAS,QAAQ,SAAS;AACpD,QAAM,SAAS,OAAO,QAAQ,WAAW,EAAE,KAAK,KAAK,OAAO,OAAO,IAAI;AACvE,QAAM,gBAAgB,MAAM,QAAQ,MAAM,IAAI,OAAO,KAAK;AAE1D,MAAI,CAAC,eAAe;AAElB,WAAO;AAAA,EACT;AAIA,SAAO,oCAAC;AAAA,IAAY;AAAA,IAA8B;AAAA,IAAiB,GAAG;AAAA,GAAM;AAC9E,CAAC;",
4
+ "sourcesContent": ["import { GetProps, StackProps, getExpandedShorthands, isWeb, styled } from '@tamagui/core'\nimport React from 'react'\nimport { Image as RNImage } from 'react-native'\n\nReact['createElement']\n\nconst StyledImage = styled(\n RNImage,\n {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n zIndex: 1,\n },\n {\n inlineProps: new Set(['src', 'width', 'height']),\n }\n)\n\ntype StyledImageProps = GetProps<typeof StyledImage>\n\ntype BaseProps = Omit<StyledImageProps, 'source' | 'width' | 'height' | 'style' | 'onLayout'> & {\n width: number\n height: number\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) => {\n const props = getExpandedShorthands(inProps)\n const { src, width = 100, height = 100, ...rest } = props\n const source = typeof src === 'string' ? { uri: src, ...(isWeb && { width, height }) } : src\n const defaultSource = Array.isArray(source) ? source[0] : source\n\n if (!defaultSource) {\n // placeholder with customizability\n return null\n }\n\n // must set defaultSource to allow SSR, default it to the same as src\n return (\n <StyledImage\n {...(!isWeb && { style: { width, height } })}\n defaultSource={defaultSource}\n source={source}\n {...(rest as any)}\n />\n )\n})\n"],
5
+ "mappings": "AAAA;AACA;AACA;AAEA,MAAM;AAEN,MAAM,cAAc,OAClB,SACA;AAAA,EACE,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AAAA,EAClB,QAAQ;AACV,GACA;AAAA,EACE,aAAa,oBAAI,IAAI,CAAC,OAAO,SAAS,QAAQ,CAAC;AACjD,CACF;AAYO,MAAM,QAA8B,YAAY,YAAY,CAAC,YAAY;AAC9E,QAAM,QAAQ,sBAAsB,OAAO;AAC3C,QAAM,EAAE,KAAK,QAAQ,KAAK,SAAS,QAAQ,SAAS;AACpD,QAAM,SAAS,OAAO,QAAQ,WAAW,EAAE,KAAK,KAAK,GAAI,SAAS,EAAE,OAAO,OAAO,EAAG,IAAI;AACzF,QAAM,gBAAgB,MAAM,QAAQ,MAAM,IAAI,OAAO,KAAK;AAE1D,MAAI,CAAC,eAAe;AAElB,WAAO;AAAA,EACT;AAGA,SACE,oCAAC;AAAA,IACE,GAAI,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,OAAO,EAAE;AAAA,IAC1C;AAAA,IACA;AAAA,IACC,GAAI;AAAA,GACP;AAEJ,CAAC;",
6
6
  "names": []
7
7
  }
package/dist/jsx/Image.js CHANGED
@@ -1,23 +1,24 @@
1
- import { getExpandedShorthands, styled } from "@tamagui/core";
1
+ import { getExpandedShorthands, isWeb, styled } from "@tamagui/core";
2
2
  import React from "react";
3
3
  import { Image as RNImage } from "react-native";
4
4
  React["createElement"];
5
5
  const StyledImage = styled(RNImage, {
6
6
  name: "Image",
7
7
  position: "relative",
8
- source: { uri: "" }
8
+ source: { uri: "" },
9
+ zIndex: 1
9
10
  }, {
10
11
  inlineProps: /* @__PURE__ */ new Set(["src", "width", "height"])
11
12
  });
12
13
  const Image = StyledImage.extractable((inProps) => {
13
14
  const props = getExpandedShorthands(inProps);
14
15
  const { src, width = 100, height = 100, ...rest } = props;
15
- const source = typeof src === "string" ? { uri: src, width, height } : src;
16
+ const source = typeof src === "string" ? { uri: src, ...isWeb && { width, height } } : src;
16
17
  const defaultSource = Array.isArray(source) ? source[0] : source;
17
18
  if (!defaultSource) {
18
19
  return null;
19
20
  }
20
- return <StyledImage defaultSource={defaultSource} source={source} {...rest} />;
21
+ return <StyledImage {...!isWeb && { style: { width, height } }} defaultSource={defaultSource} source={source} {...rest} />;
21
22
  });
22
23
  export {
23
24
  Image
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/image",
3
- "version": "1.0.1-beta.67",
3
+ "version": "1.0.1-beta.70",
4
4
  "sideEffects": true,
5
5
  "source": "src/index.ts",
6
6
  "types": "./types/index.d.ts",
@@ -19,14 +19,14 @@
19
19
  "clean:build": "tamagui-build clean:build"
20
20
  },
21
21
  "dependencies": {
22
- "@tamagui/core": "^1.0.1-beta.67"
22
+ "@tamagui/core": "^1.0.1-beta.70"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": "*",
26
26
  "react-native": "*"
27
27
  },
28
28
  "devDependencies": {
29
- "@tamagui/build": "^1.0.1-beta.67",
29
+ "@tamagui/build": "^1.0.1-beta.70",
30
30
  "react": "*",
31
31
  "react-native": "*"
32
32
  },
package/src/Image.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { GetProps, StackProps, getExpandedShorthands, styled } from '@tamagui/core'
1
+ import { GetProps, StackProps, getExpandedShorthands, isWeb, styled } from '@tamagui/core'
2
2
  import React from 'react'
3
3
  import { Image as RNImage } from 'react-native'
4
4
 
@@ -10,6 +10,7 @@ const StyledImage = styled(
10
10
  name: 'Image',
11
11
  position: 'relative',
12
12
  source: { uri: '' },
13
+ zIndex: 1,
13
14
  },
14
15
  {
15
16
  inlineProps: new Set(['src', 'width', 'height']),
@@ -29,7 +30,7 @@ export type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>
29
30
  export const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) => {
30
31
  const props = getExpandedShorthands(inProps)
31
32
  const { src, width = 100, height = 100, ...rest } = props
32
- const source = typeof src === 'string' ? { uri: src, width, height } : src
33
+ const source = typeof src === 'string' ? { uri: src, ...(isWeb && { width, height }) } : src
33
34
  const defaultSource = Array.isArray(source) ? source[0] : source
34
35
 
35
36
  if (!defaultSource) {
@@ -38,6 +39,12 @@ export const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) =>
38
39
  }
39
40
 
40
41
  // must set defaultSource to allow SSR, default it to the same as src
41
- // @ts-ignore we pass all react-native-web props down
42
- return <StyledImage defaultSource={defaultSource} source={source} {...rest} />
42
+ return (
43
+ <StyledImage
44
+ {...(!isWeb && { style: { width, height } })}
45
+ defaultSource={defaultSource}
46
+ source={source}
47
+ {...(rest as any)}
48
+ />
49
+ )
43
50
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../src/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAiC,MAAM,eAAe,CAAA;AACnF,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,QAAA,MAAM,WAAW;;;;;;;;EAUhB,CAAA;AAED,aAAK,gBAAgB,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAA;AAEpD,aAAK,SAAS,GAAG,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC,GAAG;IAC9F,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;CACzC,CAAA;AAED,oBAAY,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,SAAS,CAAC,CAAA;AAEtE,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAcrC,CAAA"}
1
+ {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../src/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAwC,MAAM,eAAe,CAAA;AAC1F,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,QAAA,MAAM,WAAW;;;;;;;;EAWhB,CAAA;AAED,aAAK,gBAAgB,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAA;AAEpD,aAAK,SAAS,GAAG,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC,GAAG;IAC9F,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;CACzC,CAAA;AAED,oBAAY,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,SAAS,CAAC,CAAA;AAEtE,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAoBrC,CAAA"}