@hanzogui/image 2.0.0-rc.41-hanzoai.1

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.
Files changed (93) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/Image.cjs +64 -0
  3. package/dist/cjs/Image.native.js +35 -0
  4. package/dist/cjs/Image.native.js.map +1 -0
  5. package/dist/cjs/createImage.cjs +157 -0
  6. package/dist/cjs/createImage.native.js +161 -0
  7. package/dist/cjs/createImage.native.js.map +1 -0
  8. package/dist/cjs/index.cjs +21 -0
  9. package/dist/cjs/index.native.js +24 -0
  10. package/dist/cjs/index.native.js.map +1 -0
  11. package/dist/cjs/types.cjs +18 -0
  12. package/dist/cjs/types.native.js +21 -0
  13. package/dist/cjs/types.native.js.map +1 -0
  14. package/dist/cjs/v1/Image.cjs +101 -0
  15. package/dist/cjs/v1/Image.native.js +123 -0
  16. package/dist/cjs/v1/Image.native.js.map +1 -0
  17. package/dist/cjs/v1/index.cjs +20 -0
  18. package/dist/cjs/v1/index.native.js +23 -0
  19. package/dist/cjs/v1/index.native.js.map +1 -0
  20. package/dist/esm/Image.mjs +39 -0
  21. package/dist/esm/Image.mjs.map +1 -0
  22. package/dist/esm/Image.native.js +7 -0
  23. package/dist/esm/Image.native.js.map +1 -0
  24. package/dist/esm/createImage.mjs +132 -0
  25. package/dist/esm/createImage.mjs.map +1 -0
  26. package/dist/esm/createImage.native.js +133 -0
  27. package/dist/esm/createImage.native.js.map +1 -0
  28. package/dist/esm/index.js +3 -0
  29. package/dist/esm/index.js.map +1 -0
  30. package/dist/esm/index.mjs +3 -0
  31. package/dist/esm/index.mjs.map +1 -0
  32. package/dist/esm/index.native.js +3 -0
  33. package/dist/esm/index.native.js.map +1 -0
  34. package/dist/esm/types.mjs +2 -0
  35. package/dist/esm/types.mjs.map +1 -0
  36. package/dist/esm/types.native.js +2 -0
  37. package/dist/esm/types.native.js.map +1 -0
  38. package/dist/esm/v1/Image.mjs +65 -0
  39. package/dist/esm/v1/Image.mjs.map +1 -0
  40. package/dist/esm/v1/Image.native.js +84 -0
  41. package/dist/esm/v1/Image.native.js.map +1 -0
  42. package/dist/esm/v1/index.mjs +2 -0
  43. package/dist/esm/v1/index.mjs.map +1 -0
  44. package/dist/esm/v1/index.native.js +2 -0
  45. package/dist/esm/v1/index.native.js.map +1 -0
  46. package/dist/jsx/Image.mjs +39 -0
  47. package/dist/jsx/Image.mjs.map +1 -0
  48. package/dist/jsx/Image.native.js +35 -0
  49. package/dist/jsx/Image.native.js.map +1 -0
  50. package/dist/jsx/createImage.mjs +132 -0
  51. package/dist/jsx/createImage.mjs.map +1 -0
  52. package/dist/jsx/createImage.native.js +161 -0
  53. package/dist/jsx/createImage.native.js.map +1 -0
  54. package/dist/jsx/index.js +3 -0
  55. package/dist/jsx/index.js.map +1 -0
  56. package/dist/jsx/index.mjs +3 -0
  57. package/dist/jsx/index.mjs.map +1 -0
  58. package/dist/jsx/index.native.js +24 -0
  59. package/dist/jsx/index.native.js.map +1 -0
  60. package/dist/jsx/types.mjs +2 -0
  61. package/dist/jsx/types.mjs.map +1 -0
  62. package/dist/jsx/types.native.js +21 -0
  63. package/dist/jsx/types.native.js.map +1 -0
  64. package/dist/jsx/v1/Image.mjs +65 -0
  65. package/dist/jsx/v1/Image.mjs.map +1 -0
  66. package/dist/jsx/v1/Image.native.js +123 -0
  67. package/dist/jsx/v1/Image.native.js.map +1 -0
  68. package/dist/jsx/v1/index.mjs +2 -0
  69. package/dist/jsx/v1/index.mjs.map +1 -0
  70. package/dist/jsx/v1/index.native.js +23 -0
  71. package/dist/jsx/v1/index.native.js.map +1 -0
  72. package/package.json +53 -0
  73. package/src/Image.native.tsx +6 -0
  74. package/src/Image.tsx +41 -0
  75. package/src/createImage.tsx +245 -0
  76. package/src/index.ts +3 -0
  77. package/src/types.ts +54 -0
  78. package/src/v1/Image.tsx +144 -0
  79. package/src/v1/index.ts +1 -0
  80. package/types/Image.d.ts +3 -0
  81. package/types/Image.d.ts.map +1 -0
  82. package/types/Image.native.d.ts +16 -0
  83. package/types/Image.native.d.ts.map +1 -0
  84. package/types/createImage.d.ts +77 -0
  85. package/types/createImage.d.ts.map +1 -0
  86. package/types/index.d.ts +4 -0
  87. package/types/index.d.ts.map +1 -0
  88. package/types/types.d.ts +42 -0
  89. package/types/types.d.ts.map +1 -0
  90. package/types/v1/Image.d.ts +36 -0
  91. package/types/v1/Image.d.ts.map +1 -0
  92. package/types/v1/index.d.ts +2 -0
  93. package/types/v1/index.d.ts.map +1 -0
@@ -0,0 +1,144 @@
1
+ import React from 'react'
2
+ import { isWeb } from '@hanzogui/constants'
3
+ import type {
4
+ GetProps,
5
+ RadiusTokens,
6
+ SizeTokens,
7
+ ViewProps,
8
+ ThemeValueFallback,
9
+ } from '@hanzogui/web'
10
+ import { styled, usePropsAndStyle } from '@hanzogui/web'
11
+ import type { FC } from 'react'
12
+ import { Image as RNImage } from 'react-native'
13
+
14
+ const StyledImage = styled(RNImage, {
15
+ name: 'Image',
16
+ })
17
+
18
+ type StyledImageProps = Omit<GetProps<typeof StyledImage>, 'borderRadius'> & {
19
+ borderRadius?: RadiusTokens
20
+ }
21
+
22
+ type BaseProps = Omit<
23
+ StyledImageProps,
24
+ 'width' | 'height' | 'style' | 'onLayout' | 'resizeMode'
25
+ > & {
26
+ width?: string | number | SizeTokens | ThemeValueFallback
27
+ height?: string | number | SizeTokens | ThemeValueFallback
28
+
29
+ /**
30
+ * @deprecated use `source` instead to disambiguate width/height style from width/height of the actual image
31
+ */
32
+ src?: string | StyledImageProps['source']
33
+ /** @deprecated use objectFit instead */
34
+ resizeMode?: StyledImageProps['resizeMode']
35
+ objectFit?: React.CSSProperties['objectFit']
36
+ }
37
+
38
+ export type ImageProps = BaseProps & Omit<ViewProps, keyof BaseProps>
39
+
40
+ type RNImageType = typeof RNImage
41
+
42
+ type ImageType = FC<ImageProps> & {
43
+ getSize: RNImageType['getSize']
44
+ getSizeWithHeaders: RNImageType['getSizeWithHeaders']
45
+ prefetch: RNImageType['prefetch']
46
+ prefetchWithMetadata: RNImageType['prefetchWithMetadata']
47
+ abortPrefetch: RNImageType['abortPrefetch']
48
+ queryCache: RNImageType['queryCache']
49
+ }
50
+
51
+ let hasWarned = false
52
+
53
+ /**
54
+ * @summary An image is a component that displays an image.
55
+ * @see — Docs https://hanzogui.dev/ui/image
56
+ */
57
+ export const Image = StyledImage.styleable<ImageProps>((inProps, ref) => {
58
+ const [props, style] = usePropsAndStyle(inProps)
59
+ const { src, source, objectFit, ...rest } = props
60
+
61
+ if (process.env.NODE_ENV === 'development') {
62
+ if (typeof src === 'string') {
63
+ if (
64
+ (typeof props.width === 'string' && props.width[0] !== '$') ||
65
+ (typeof props.height === 'string' && props.height[0] !== '$')
66
+ ) {
67
+ if (!hasWarned) {
68
+ hasWarned = true
69
+ console.warn(
70
+ `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.`
71
+ )
72
+ }
73
+ }
74
+ }
75
+ }
76
+
77
+ let finalSource =
78
+ typeof src === 'string'
79
+ ? {
80
+ uri: src,
81
+ ...(isWeb && {
82
+ width: props.width || style?.width,
83
+ height: props.height || style?.height,
84
+ }),
85
+ }
86
+ : (source ?? src)
87
+
88
+ if (finalSource && typeof finalSource === 'object') {
89
+ if (process.env.TAMAGUI_TARGET === 'native') {
90
+ // fix: normalize import style images
91
+ if (!Array.isArray(finalSource)) {
92
+ if (typeof finalSource.uri === 'number') {
93
+ finalSource = finalSource.uri
94
+ if (source && typeof source === 'object' && !Array.isArray(source)) {
95
+ // @ts-ignore
96
+ style.width ??= source.width
97
+ // @ts-ignore
98
+ style.height ??= source.height
99
+ }
100
+ }
101
+ }
102
+ }
103
+
104
+ if (process.env.NODE_ENV === 'development' && process.env.TAMAGUI_IMAGE_CHECK_ERROR) {
105
+ // lets add an onload timeout and warning if it fails to load in console
106
+ React.useEffect(() => {
107
+ async function run() {
108
+ if (typeof src === 'string') {
109
+ try {
110
+ await fetch(src).then((res) => res.text())
111
+ } catch (err) {
112
+ console.error(`Error loading image: ${src}`, { props })
113
+ }
114
+ }
115
+ }
116
+
117
+ run()
118
+ }, [src])
119
+ }
120
+
121
+ // require compat across native/web
122
+ if (finalSource['default']) {
123
+ finalSource = finalSource['default']
124
+ }
125
+ }
126
+
127
+ // must set defaultSource to allow SSR, default it to the same as src
128
+ return (
129
+ <RNImage
130
+ resizeMode={objectFit}
131
+ ref={ref}
132
+ source={finalSource}
133
+ style={style}
134
+ {...(rest as any)}
135
+ />
136
+ )
137
+ }) as any as ImageType
138
+
139
+ Image.getSize = RNImage.getSize
140
+ Image.getSizeWithHeaders = RNImage.getSizeWithHeaders
141
+ Image.prefetch = RNImage.prefetch
142
+ Image.prefetchWithMetadata = RNImage.prefetchWithMetadata
143
+ Image.abortPrefetch = RNImage.abortPrefetch
144
+ Image.queryCache = RNImage.queryCache
@@ -0,0 +1 @@
1
+ export * from './Image'
@@ -0,0 +1,3 @@
1
+ import type { ImageType } from './types';
2
+ export declare const Image: ImageType;
3
+ //# sourceMappingURL=Image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../src/Image.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,SAAS,CAAA;AAOpD,eAAO,MAAM,KAAK,EAuBF,SAAS,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { Image as RNImage } from 'react-native';
2
+ export declare const Image: import("react").FC<Partial<import("./types").ImageProps>> & {
3
+ getSize: typeof RNImage.getSize;
4
+ getSizeWithHeaders: typeof RNImage.getSizeWithHeaders;
5
+ prefetch: typeof RNImage.prefetch;
6
+ prefetchWithMetadata: typeof RNImage.prefetchWithMetadata;
7
+ abortPrefetch: typeof RNImage.abortPrefetch | undefined;
8
+ queryCache: typeof RNImage.queryCache | undefined;
9
+ } & import("react").FC<import("@hanzogui/web").StackNonStyleProps & import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase> & import("@hanzogui/web").WithShorthands<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase>> & import("@hanzogui/web").WithPseudoProps<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase> & import("@hanzogui/web").WithShorthands<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase>>> & import("@hanzogui/web").WithMediaProps<import("@hanzogui/web").WithThemeShorthandsAndPseudos<import("@hanzogui/web").StackStyleBase, {}>> & Omit<import("react-native").ImageProps, `$${string}` | `$${number}` | import("@hanzogui/web").GroupMediaKeys | `$theme-${string}` | `$theme-${number}` | keyof import("@hanzogui/web").StackStyleBase | keyof import("@hanzogui/web").StackNonStyleProps | keyof import("@hanzogui/web").WithPseudoProps<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase> & import("@hanzogui/web").WithShorthands<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase>>> | "source" | "resizeMode"> & {
10
+ src?: string | number;
11
+ source?: import("react-native").ImageSourcePropType;
12
+ resizeMode?: import("react-native").ImageResizeMode;
13
+ objectFit?: React.CSSProperties["objectFit"];
14
+ objectPosition?: React.CSSProperties["objectPosition"];
15
+ } & Omit<import("react").ImgHTMLAttributes<HTMLImageElement>, `$${string}` | `$${number}` | import("@hanzogui/web").GroupMediaKeys | `$theme-${string}` | `$theme-${number}` | keyof import("@hanzogui/web").StackStyleBase | keyof import("@hanzogui/web").StackNonStyleProps | keyof import("@hanzogui/web").WithPseudoProps<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase> & import("@hanzogui/web").WithShorthands<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase>>> | "src"> & Omit<import("react").ImgHTMLAttributes<HTMLImageElement>, "style" | "height" | "width" | "src"> & Omit<import("react-native").ImageProps, `$${string}` | `$${number}` | import("@hanzogui/web").GroupMediaKeys | `$theme-${string}` | `$theme-${number}` | "onLayout" | "rel" | "dir" | keyof import("@hanzogui/web").StackStyleBase | keyof import("@hanzogui/web").StackNonStyleProps | keyof import("@hanzogui/web").WithPseudoProps<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase> & import("@hanzogui/web").WithShorthands<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase>>> | "source" | "resizeMode" | "onError" | "onLoad" | "onLoadEnd" | "onLoadStart" | "progressiveRenderingEnabled" | "src" | "srcSet" | "loadingIndicatorSource" | "defaultSource" | "alt" | "crossOrigin" | "tintColor" | "referrerPolicy" | "blurRadius" | "capInsets" | "onProgress" | "onPartialLoad" | "resizeMethod" | "fadeDuration" | "objectPosition" | "decoding" | "fetchPriority" | "loading" | "sizes" | "useMap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "enterKeyHint" | "hidden" | "lang" | "nonce" | "slot" | "spellCheck" | "title" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-invalid" | "aria-keyshortcuts" | "aria-level" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-setsize" | "aria-sort" | "onCopyCapture" | "onCutCapture" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInputCapture" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoadCapture" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenuCapture" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeaveCapture" | "onDragOverCapture" | "onDragStartCapture" | "onDropCapture" | "onMouseDownCapture" | "onMouseMoveCapture" | "onMouseOutCapture" | "onMouseOverCapture" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancelCapture" | "onTouchMoveCapture" | "onTouchStartCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture">>;
16
+ //# sourceMappingURL=Image.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Image.native.d.ts","sourceRoot":"","sources":["../src/Image.native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,cAAc,CAAA;AAG/C,eAAO,MAAM,KAAK;;;;;;;;;;;;;k2KAEhB,CAAA"}
@@ -0,0 +1,77 @@
1
+ import type { ComponentType } from 'react';
2
+ import type { ImageResizeMode } from 'react-native';
3
+ import type { ImageProps } from './types';
4
+ type GetProps<T> = T extends ComponentType<infer P> ? P : never;
5
+ export type CreateImageOptions<C extends ComponentType<any>> = {
6
+ /**
7
+ * The underlying image component to use.
8
+ * Can be React Native Image, expo-image, react-native-fast-image, or any compatible component.
9
+ */
10
+ Component: C;
11
+ /**
12
+ * Map objectFit CSS values to the component's resize mode prop.
13
+ * Default maps to React Native's resizeMode.
14
+ */
15
+ mapObjectFitToResizeMode?: (objectFit: string) => string;
16
+ /**
17
+ * The prop name used for resize mode.
18
+ * Default: 'resizeMode' (React Native)
19
+ * expo-image uses: 'contentFit'
20
+ */
21
+ resizeModePropName?: string;
22
+ /**
23
+ * The prop name used for object position.
24
+ * Default: undefined (React Native doesn't support it)
25
+ * expo-image uses: 'contentPosition'
26
+ */
27
+ objectPositionPropName?: string;
28
+ /**
29
+ * Custom source transformation.
30
+ * Useful for expo-image which has a different source format.
31
+ */
32
+ transformSource?: (props: {
33
+ src?: string | number;
34
+ source?: any;
35
+ width?: any;
36
+ height?: any;
37
+ }) => any;
38
+ };
39
+ /**
40
+ * Create a custom Image component with a pluggable underlying implementation.
41
+ *
42
+ * @example
43
+ * Using with expo-image
44
+ * import { Image as ExpoImage } from 'expo-image'
45
+ * import { createImage } from '@hanzogui/image'
46
+ *
47
+ * export const Image = createImage({
48
+ * Component: ExpoImage,
49
+ * resizeModePropName: 'contentFit',
50
+ * objectPositionPropName: 'contentPosition',
51
+ * })
52
+ *
53
+ * Now you get all expo-image props (transition, placeholder, etc.)
54
+ * plus Hanzogui's unified API (src, objectFit, objectPosition)
55
+ * <Image
56
+ * src="https://example.com/photo.jpg"
57
+ * objectFit="cover"
58
+ * transition={300}
59
+ * placeholder={blurhash}
60
+ * />
61
+ */
62
+ export declare function createImage<C extends ComponentType<any>>(options: CreateImageOptions<C>): import("react").FC<Partial<ImageProps>> & {
63
+ getSize: typeof import("react-native").Image.getSize;
64
+ getSizeWithHeaders: typeof import("react-native").Image.getSizeWithHeaders;
65
+ prefetch: typeof import("react-native").Image.prefetch;
66
+ prefetchWithMetadata: typeof import("react-native").Image.prefetchWithMetadata;
67
+ abortPrefetch: typeof import("react-native").Image.abortPrefetch | undefined;
68
+ queryCache: typeof import("react-native").Image.queryCache | undefined;
69
+ } & import("react").FC<import("@hanzogui/web").StackNonStyleProps & import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase> & import("@hanzogui/web").WithShorthands<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase>> & import("@hanzogui/web").WithPseudoProps<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase> & import("@hanzogui/web").WithShorthands<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase>>> & import("@hanzogui/web").WithMediaProps<import("@hanzogui/web").WithThemeShorthandsAndPseudos<import("@hanzogui/web").StackStyleBase, {}>> & Omit<import("react-native").ImageProps, `$${string}` | `$${number}` | import("@hanzogui/web").GroupMediaKeys | `$theme-${string}` | `$theme-${number}` | keyof import("@hanzogui/web").StackStyleBase | keyof import("@hanzogui/web").StackNonStyleProps | keyof import("@hanzogui/web").WithPseudoProps<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase> & import("@hanzogui/web").WithShorthands<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase>>> | "source" | "resizeMode"> & {
70
+ src?: string | number;
71
+ source?: import("react-native").ImageSourcePropType;
72
+ resizeMode?: ImageResizeMode;
73
+ objectFit?: React.CSSProperties["objectFit"];
74
+ objectPosition?: React.CSSProperties["objectPosition"];
75
+ } & Omit<import("react").ImgHTMLAttributes<HTMLImageElement>, `$${string}` | `$${number}` | import("@hanzogui/web").GroupMediaKeys | `$theme-${string}` | `$theme-${number}` | keyof import("@hanzogui/web").StackStyleBase | keyof import("@hanzogui/web").StackNonStyleProps | keyof import("@hanzogui/web").WithPseudoProps<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase> & import("@hanzogui/web").WithShorthands<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase>>> | "src"> & Omit<import("react").ImgHTMLAttributes<HTMLImageElement>, "style" | "height" | "width" | "src"> & Omit<GetProps<C>, `$${string}` | `$${number}` | import("@hanzogui/web").GroupMediaKeys | `$theme-${string}` | `$theme-${number}` | "onLayout" | "rel" | "dir" | keyof import("@hanzogui/web").StackStyleBase | keyof import("@hanzogui/web").StackNonStyleProps | keyof import("@hanzogui/web").WithPseudoProps<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase> & import("@hanzogui/web").WithShorthands<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase>>> | "source" | "resizeMode" | "onError" | "onLoad" | "onLoadEnd" | "onLoadStart" | "progressiveRenderingEnabled" | "src" | "srcSet" | "loadingIndicatorSource" | "defaultSource" | "alt" | "crossOrigin" | "tintColor" | "referrerPolicy" | "blurRadius" | "capInsets" | "onProgress" | "onPartialLoad" | "resizeMethod" | "fadeDuration" | "objectPosition" | "decoding" | "fetchPriority" | "loading" | "sizes" | "useMap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "enterKeyHint" | "hidden" | "lang" | "nonce" | "slot" | "spellCheck" | "title" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-invalid" | "aria-keyshortcuts" | "aria-level" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-setsize" | "aria-sort" | "onCopyCapture" | "onCutCapture" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInputCapture" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoadCapture" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenuCapture" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeaveCapture" | "onDragOverCapture" | "onDragStartCapture" | "onDropCapture" | "onMouseDownCapture" | "onMouseMoveCapture" | "onMouseOutCapture" | "onMouseOverCapture" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancelCapture" | "onTouchMoveCapture" | "onTouchStartCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture">>;
76
+ export {};
77
+ //# sourceMappingURL=createImage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createImage.d.ts","sourceRoot":"","sources":["../src/createImage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,SAAS,CAAA;AAEpD,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAE/D,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,aAAa,CAAC,GAAG,CAAC,IAAI;IAC7D;;;OAGG;IACH,SAAS,EAAE,CAAC,CAAA;IACZ;;;OAGG;IACH,wBAAwB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAA;IACxD;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE;QACxB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;QACrB,MAAM,CAAC,EAAE,GAAG,CAAA;QACZ,KAAK,CAAC,EAAE,GAAG,CAAA;QACX,MAAM,CAAC,EAAE,GAAG,CAAA;KACb,KAAK,GAAG,CAAA;CACV,CAAA;AAiCD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,aAAa,CAAC,GAAG,CAAC,EACtD,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC;;;;;;;;;;;;;60KAmJ/B"}
@@ -0,0 +1,4 @@
1
+ export * from './Image';
2
+ export * from './createImage';
3
+ export type { ImageProps, ImageType } from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAC7B,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1,42 @@
1
+ import type { ViewProps } from '@hanzogui/web';
2
+ import type { ImageResizeMode, ImageSourcePropType, Image as RNImage, ImageProps as RNImageProps } from 'react-native';
3
+ type RNImageType = typeof RNImage;
4
+ type KeyofViewProps = keyof ViewProps;
5
+ export type ImageProps = ViewProps & Omit<RNImageProps, KeyofViewProps | 'source' | 'resizeMode' | 'style'> & {
6
+ /**
7
+ * The image source URL or require() result.
8
+ * Preferred over `source` for better web alignment.
9
+ */
10
+ src?: string | number;
11
+ /**
12
+ * @deprecated
13
+ * use src instead
14
+ */
15
+ source?: ImageSourcePropType;
16
+ /**
17
+ * @deprecated
18
+ * use objectFit instead
19
+ */
20
+ resizeMode?: ImageResizeMode;
21
+ /**
22
+ * How the image should be resized to fit its container.
23
+ * Maps to CSS object-fit on web and resizeMode on native.
24
+ */
25
+ objectFit?: React.CSSProperties['objectFit'];
26
+ /**
27
+ * How the image should be positioned within its container.
28
+ * Maps to CSS object-position on web.
29
+ * On native, requires expo-image or similar for full support.
30
+ */
31
+ objectPosition?: React.CSSProperties['objectPosition'];
32
+ } & Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'width' | 'height' | KeyofViewProps | 'src'> & Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'width' | 'height' | 'style' | 'src'>;
33
+ export type ImageType = React.FC<Partial<ImageProps>> & {
34
+ getSize: RNImageType['getSize'];
35
+ getSizeWithHeaders: RNImageType['getSizeWithHeaders'];
36
+ prefetch: RNImageType['prefetch'];
37
+ prefetchWithMetadata: RNImageType['prefetchWithMetadata'];
38
+ abortPrefetch: RNImageType['abortPrefetch'];
39
+ queryCache: RNImageType['queryCache'];
40
+ };
41
+ export {};
42
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,KAAK,IAAI,OAAO,EAChB,UAAU,IAAI,YAAY,EAC3B,MAAM,cAAc,CAAA;AAErB,KAAK,WAAW,GAAG,OAAO,OAAO,CAAA;AAEjC,KAAK,cAAc,GAAG,MAAM,SAAS,CAAA;AAErC,MAAM,MAAM,UAAU,GAAG,SAAS,GAChC,IAAI,CAAC,YAAY,EAAE,cAAc,GAAG,QAAQ,GAAG,YAAY,GAAG,OAAO,CAAC,GAAG;IACvE;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,mBAAmB,CAAA;IAC5B;;;OAGG;IACH,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAA;IAC5C;;;;OAIG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAA;CACvD,GAAG,IAAI,CACN,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,EACzC,OAAO,GAAG,QAAQ,GAAG,cAAc,GAAG,KAAK,CAC5C,GACD,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC,CAAA;AAEvF,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG;IACtD,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;IAC/B,kBAAkB,EAAE,WAAW,CAAC,oBAAoB,CAAC,CAAA;IACrD,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,CAAA;IACjC,oBAAoB,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAA;IACzD,aAAa,EAAE,WAAW,CAAC,eAAe,CAAC,CAAA;IAC3C,UAAU,EAAE,WAAW,CAAC,YAAY,CAAC,CAAA;CACtC,CAAA"}
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import type { GetProps, RadiusTokens, SizeTokens, ViewProps, ThemeValueFallback } from '@hanzogui/web';
3
+ import type { FC } from 'react';
4
+ import { Image as RNImage } from 'react-native';
5
+ declare const StyledImage: import("@hanzogui/web").HanzoguiComponent<import("@hanzogui/web").TamaDefer, RNImage, import("@hanzogui/web").HanzoguiComponentPropsBaseBase & import("react-native").ImageProps, import("@hanzogui/web").StackStyleBase, {}, import("@hanzogui/web").StaticConfigPublic>;
6
+ type StyledImageProps = Omit<GetProps<typeof StyledImage>, 'borderRadius'> & {
7
+ borderRadius?: RadiusTokens;
8
+ };
9
+ type BaseProps = Omit<StyledImageProps, 'width' | 'height' | 'style' | 'onLayout' | 'resizeMode'> & {
10
+ width?: string | number | SizeTokens | ThemeValueFallback;
11
+ height?: string | number | SizeTokens | ThemeValueFallback;
12
+ /**
13
+ * @deprecated use `source` instead to disambiguate width/height style from width/height of the actual image
14
+ */
15
+ src?: string | StyledImageProps['source'];
16
+ /** @deprecated use objectFit instead */
17
+ resizeMode?: StyledImageProps['resizeMode'];
18
+ objectFit?: React.CSSProperties['objectFit'];
19
+ };
20
+ export type ImageProps = BaseProps & Omit<ViewProps, keyof BaseProps>;
21
+ type RNImageType = typeof RNImage;
22
+ type ImageType = FC<ImageProps> & {
23
+ getSize: RNImageType['getSize'];
24
+ getSizeWithHeaders: RNImageType['getSizeWithHeaders'];
25
+ prefetch: RNImageType['prefetch'];
26
+ prefetchWithMetadata: RNImageType['prefetchWithMetadata'];
27
+ abortPrefetch: RNImageType['abortPrefetch'];
28
+ queryCache: RNImageType['queryCache'];
29
+ };
30
+ /**
31
+ * @summary An image is a component that displays an image.
32
+ * @see — Docs https://hanzogui.dev/ui/image
33
+ */
34
+ export declare const Image: ImageType;
35
+ export {};
36
+ //# sourceMappingURL=Image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../src/v1/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,SAAS,EACT,kBAAkB,EACnB,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,cAAc,CAAA;AAE/C,QAAA,MAAM,WAAW,2QAEf,CAAA;AAEF,KAAK,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,WAAW,CAAC,EAAE,cAAc,CAAC,GAAG;IAC3E,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,CAAA;AAED,KAAK,SAAS,GAAG,IAAI,CACnB,gBAAgB,EAChB,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,YAAY,CACzD,GAAG;IACF,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,kBAAkB,CAAA;IACzD,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,kBAAkB,CAAA;IAE1D;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IACzC,wCAAwC;IACxC,UAAU,CAAC,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAA;IAC3C,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,SAAS,CAAC,CAAA;AAErE,KAAK,WAAW,GAAG,OAAO,OAAO,CAAA;AAEjC,KAAK,SAAS,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG;IAChC,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;IAC/B,kBAAkB,EAAE,WAAW,CAAC,oBAAoB,CAAC,CAAA;IACrD,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,CAAA;IACjC,oBAAoB,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAA;IACzD,aAAa,EAAE,WAAW,CAAC,eAAe,CAAC,CAAA;IAC3C,UAAU,EAAE,WAAW,CAAC,YAAY,CAAC,CAAA;CACtC,CAAA;AAID;;;GAGG;AACH,eAAO,MAAM,KAAK,EAgFL,SAAS,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './Image';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}