@draftbit/core 50.6.4-8a5d9a.2 → 50.6.4-9f92d3.2

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.
@@ -1 +1 @@
1
- import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["source","resizeMode","style","placeholder","transition","contentFit","contentPosition","cachePolicy","allowDownscaling","recyclingKey"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/ExpoImage.tsx";import React from"react";import{StyleSheet}from"react-native";import{Image}from"expo-image";import Config from"./Config";import AspectRatio from"./AspectRatio";import{jsx as _jsx}from"react/jsx-runtime";var generateDimensions=function generateDimensions(_ref){var aspectRatio=_ref.aspectRatio,width=_ref.width,height=_ref.height;if(aspectRatio&&!width&&!height){return{aspectRatio:aspectRatio,width:"100%"};}if(aspectRatio&&height){return{aspectRatio:aspectRatio,height:height,width:aspectRatio*height};}if(aspectRatio&&width){return{aspectRatio:aspectRatio,width:width,height:width/aspectRatio};}return{width:width,height:height};};var resizeModeToContentFit=function resizeModeToContentFit(resizeMode){var _mapping$resizeMode;var mapping={cover:"cover",contain:"contain",stretch:"fill",repeat:"none",center:"scale-down"};return(_mapping$resizeMode=mapping[resizeMode])!=null?_mapping$resizeMode:"cover";};var ExpoImage=function ExpoImage(_ref2){var source=_ref2.source,_ref2$resizeMode=_ref2.resizeMode,resizeMode=_ref2$resizeMode===void 0?"cover":_ref2$resizeMode,style=_ref2.style,placeholder=_ref2.placeholder,_ref2$transition=_ref2.transition,transition=_ref2$transition===void 0?300:_ref2$transition,_ref2$contentFit=_ref2.contentFit,contentFit=_ref2$contentFit===void 0?"cover":_ref2$contentFit,_ref2$contentPosition=_ref2.contentPosition,contentPosition=_ref2$contentPosition===void 0?"center":_ref2$contentPosition,_ref2$cachePolicy=_ref2.cachePolicy,cachePolicy=_ref2$cachePolicy===void 0?"memory-disk":_ref2$cachePolicy,_ref2$allowDownscalin=_ref2.allowDownscaling,allowDownscaling=_ref2$allowDownscalin===void 0?true:_ref2$allowDownscalin,recyclingKey=_ref2.recyclingKey,props=_objectWithoutProperties(_ref2,_excluded);var imageSource=source===null||source===undefined?Config.placeholderImageURL:source;var styles=StyleSheet.flatten(style||{});var _generateDimensions=generateDimensions(styles),aspectRatio=_generateDimensions.aspectRatio,width=_generateDimensions.width,height=_generateDimensions.height;var finalContentFit=resizeMode?resizeModeToContentFit(resizeMode):contentFit;if(aspectRatio){return _jsx(AspectRatio,{style:[style,{width:width,height:height,aspectRatio:aspectRatio}],children:_jsx(Image,Object.assign({},props,{source:imageSource,contentFit:finalContentFit,placeholder:placeholder,transition:transition,contentPosition:contentPosition,cachePolicy:cachePolicy,allowDownscaling:allowDownscaling,recyclingKey:recyclingKey,style:[style,{height:"100%",width:"100%"}]}))});}return _jsx(Image,Object.assign({},props,{source:source,contentFit:finalContentFit,placeholder:placeholder,transition:transition,contentPosition:contentPosition,cachePolicy:cachePolicy,allowDownscaling:allowDownscaling,recyclingKey:recyclingKey,style:style}));};export default ExpoImage;
1
+ import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["source","resizeMode","style","transitionDuration","transitionEffect","transitionTiming","contentFit","contentPosition","cachePolicy","allowDownscaling","blurRadius","blurhash"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/ExpoImage.tsx";import React from"react";import{StyleSheet}from"react-native";import{Image}from"expo-image";import Config from"./Config";import AspectRatio from"./AspectRatio";import{jsx as _jsx}from"react/jsx-runtime";var generateDimensions=function generateDimensions(_ref){var aspectRatio=_ref.aspectRatio,width=_ref.width,height=_ref.height;if(aspectRatio&&!width&&!height){return{aspectRatio:aspectRatio,width:"100%"};}if(aspectRatio&&height){return{aspectRatio:aspectRatio,height:height,width:aspectRatio*height};}if(aspectRatio&&width){return{aspectRatio:aspectRatio,width:width,height:width/aspectRatio};}return{width:width,height:height};};var resizeModeToContentFit=function resizeModeToContentFit(resizeMode){var _mapping$resizeMode;var mapping={cover:"cover",contain:"contain",stretch:"fill",repeat:"none",center:"scale-down"};return(_mapping$resizeMode=mapping[resizeMode])!=null?_mapping$resizeMode:"cover";};var ExpoImage=function ExpoImage(_ref2){var source=_ref2.source,_ref2$resizeMode=_ref2.resizeMode,resizeMode=_ref2$resizeMode===void 0?"cover":_ref2$resizeMode,style=_ref2.style,_ref2$transitionDurat=_ref2.transitionDuration,transitionDuration=_ref2$transitionDurat===void 0?300:_ref2$transitionDurat,_ref2$transitionEffec=_ref2.transitionEffect,transitionEffect=_ref2$transitionEffec===void 0?"cross-dissolve":_ref2$transitionEffec,_ref2$transitionTimin=_ref2.transitionTiming,transitionTiming=_ref2$transitionTimin===void 0?"ease-in-out":_ref2$transitionTimin,_ref2$contentFit=_ref2.contentFit,contentFit=_ref2$contentFit===void 0?"cover":_ref2$contentFit,_ref2$contentPosition=_ref2.contentPosition,contentPosition=_ref2$contentPosition===void 0?"center":_ref2$contentPosition,_ref2$cachePolicy=_ref2.cachePolicy,cachePolicy=_ref2$cachePolicy===void 0?"memory-disk":_ref2$cachePolicy,_ref2$allowDownscalin=_ref2.allowDownscaling,allowDownscaling=_ref2$allowDownscalin===void 0?true:_ref2$allowDownscalin,blurRadius=_ref2.blurRadius,blurhash=_ref2.blurhash,props=_objectWithoutProperties(_ref2,_excluded);var imageSource=source===null||source===undefined?Config.placeholderImageURL:source;var styles=StyleSheet.flatten(style||{});var _generateDimensions=generateDimensions(styles),aspectRatio=_generateDimensions.aspectRatio,width=_generateDimensions.width,height=_generateDimensions.height;var finalContentFit=resizeMode?resizeModeToContentFit(resizeMode):contentFit;var transition={timing:transitionTiming,duration:transitionDuration,effect:transitionEffect};if(aspectRatio){return _jsx(AspectRatio,{style:[style,{width:width,height:height,aspectRatio:aspectRatio}],children:_jsx(Image,Object.assign({},props,{source:imageSource,contentFit:finalContentFit,placeholder:{blurhash:blurhash},transition:transition,contentPosition:contentPosition,cachePolicy:cachePolicy,allowDownscaling:allowDownscaling,blurRadius:blurRadius,style:[style,{height:"100%",width:"100%"}]}))});}return _jsx(Image,Object.assign({},props,{source:source,contentFit:finalContentFit,placeholder:{blurhash:blurhash},transition:transition,contentPosition:contentPosition,cachePolicy:cachePolicy,allowDownscaling:allowDownscaling,blurRadius:blurRadius,style:style}));};export default ExpoImage;
@@ -1,20 +1,15 @@
1
1
  import React from "react";
2
2
  import { ImageContentPosition, ImageProps as ExpoImageProps } from "expo-image";
3
3
  interface ExtendedImageProps extends ExpoImageProps {
4
- placeholder?: {
5
- blurhash?: string;
6
- thumbhash?: string;
7
- };
8
- transition?: number | {
9
- duration?: number;
10
- effect?: "cross-dissolve" | "flip-from-top" | "flip-from-right" | "flip-from-bottom" | "flip-from-left" | "curl-up" | "curl-down";
11
- timing?: "ease-in-out" | "ease-in" | "ease-out" | "linear";
12
- };
4
+ transitionDuration?: number;
5
+ transitionEffect?: "cross-dissolve" | "flip-from-top" | "flip-from-right" | "flip-from-bottom" | "flip-from-left" | "curl-up" | "curl-down";
6
+ transitionTiming?: "ease-in-out" | "ease-in" | "ease-out" | "linear";
13
7
  contentFit?: "cover" | "contain" | "fill" | "none" | "scale-down";
14
8
  contentPosition?: ImageContentPosition;
15
9
  cachePolicy?: "none" | "disk" | "memory" | "memory-disk";
16
10
  allowDownscaling?: boolean;
17
- recyclingKey?: string;
11
+ blurRadius?: number;
12
+ blurhash?: string;
18
13
  }
19
14
  declare const ExpoImage: React.FC<ExtendedImageProps>;
20
15
  export default ExpoImage;
@@ -37,7 +37,7 @@ const resizeModeToContentFit = (resizeMode) => {
37
37
  };
38
38
  return (_a = mapping[resizeMode]) !== null && _a !== void 0 ? _a : "cover";
39
39
  };
40
- const ExpoImage = ({ source, resizeMode = "cover", style, placeholder, transition = 300, contentFit = "cover", contentPosition = "center", cachePolicy = "memory-disk", allowDownscaling = true, recyclingKey, ...props }) => {
40
+ const ExpoImage = ({ source, resizeMode = "cover", style, transitionDuration = 300, transitionEffect = "cross-dissolve", transitionTiming = "ease-in-out", contentFit = "cover", contentPosition = "center", cachePolicy = "memory-disk", allowDownscaling = true, blurRadius, blurhash, ...props }) => {
41
41
  let imageSource = source === null || source === undefined
42
42
  ? Config.placeholderImageURL
43
43
  : source;
@@ -46,9 +46,16 @@ const ExpoImage = ({ source, resizeMode = "cover", style, placeholder, transitio
46
46
  const finalContentFit = resizeMode
47
47
  ? resizeModeToContentFit(resizeMode)
48
48
  : contentFit;
49
+ const transition = {
50
+ timing: transitionTiming,
51
+ duration: transitionDuration,
52
+ effect: transitionEffect,
53
+ };
49
54
  if (aspectRatio) {
50
55
  return (React.createElement(AspectRatio, { style: [style, { width, height, aspectRatio }] },
51
- React.createElement(Image, { ...props, source: imageSource, contentFit: finalContentFit, placeholder: placeholder, transition: transition, contentPosition: contentPosition, cachePolicy: cachePolicy, allowDownscaling: allowDownscaling, recyclingKey: recyclingKey, style: [
56
+ React.createElement(Image, { ...props, source: imageSource, contentFit: finalContentFit, placeholder: {
57
+ blurhash,
58
+ }, transition: transition, contentPosition: contentPosition, cachePolicy: cachePolicy, allowDownscaling: allowDownscaling, blurRadius: blurRadius, style: [
52
59
  style,
53
60
  {
54
61
  height: "100%",
@@ -56,7 +63,9 @@ const ExpoImage = ({ source, resizeMode = "cover", style, placeholder, transitio
56
63
  },
57
64
  ] })));
58
65
  }
59
- return (React.createElement(Image, { ...props, source: source, contentFit: finalContentFit, placeholder: placeholder, transition: transition, contentPosition: contentPosition, cachePolicy: cachePolicy, allowDownscaling: allowDownscaling, recyclingKey: recyclingKey, style: style }));
66
+ return (React.createElement(Image, { ...props, source: source, contentFit: finalContentFit, placeholder: {
67
+ blurhash,
68
+ }, transition: transition, contentPosition: contentPosition, cachePolicy: cachePolicy, allowDownscaling: allowDownscaling, blurRadius: blurRadius, style: style }));
60
69
  };
61
70
  export default ExpoImage;
62
71
  //# sourceMappingURL=ExpoImage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoImage.js","sourceRoot":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