@hanzogui/image 8.3.1 → 8.3.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.
- package/dist/cjs/Image.js +27 -0
- package/dist/cjs/Image.js.map +1 -0
- package/dist/cjs/createImage.js +158 -0
- package/dist/cjs/createImage.js.map +1 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/v1/Image.js +86 -0
- package/dist/cjs/v1/Image.js.map +1 -0
- package/dist/cjs/v1/index.js +5 -0
- package/dist/cjs/v1/index.js.map +1 -0
- package/dist/esm/Image.js +24 -0
- package/dist/esm/Image.js.map +1 -0
- package/dist/esm/createImage.js +155 -0
- package/dist/esm/createImage.js.map +1 -0
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/v1/Image.js +82 -0
- package/dist/esm/v1/Image.js.map +1 -0
- package/dist/esm/v1/index.js +2 -0
- package/dist/esm/v1/index.js.map +1 -0
- package/dist/native/Image.js +6 -0
- package/dist/native/Image.js.map +1 -0
- package/dist/native/createImage.js +155 -0
- package/dist/native/createImage.js.map +1 -0
- package/dist/native/index.js +3 -0
- package/dist/native/index.js.map +1 -0
- package/dist/native/types.js +2 -0
- package/dist/native/types.js.map +1 -0
- package/dist/native/v1/Image.js +82 -0
- package/dist/native/v1/Image.js.map +1 -0
- package/dist/native/v1/index.js +2 -0
- package/dist/native/v1/index.js.map +1 -0
- package/package.json +22 -17
- package/src/Image.native.tsx +1 -1
- package/src/Image.tsx +1 -1
- package/src/createImage.tsx +1 -1
- package/src/index.ts +3 -3
- package/src/v1/index.ts +1 -1
- package/types/Image.d.ts +1 -1
- package/types/Image.d.ts.map +1 -1
- package/types/Image.native.d.ts +5 -5
- package/types/createImage.d.ts +5 -5
- package/types/createImage.d.ts.map +1 -1
- package/types/index.d.ts +3 -3
- package/types/index.d.ts.map +1 -1
- package/types/v1/index.d.ts +1 -1
- package/types/v1/index.d.ts.map +1 -1
- package/dist/cjs/Image.cjs +0 -64
- package/dist/cjs/Image.native.js +0 -35
- package/dist/cjs/Image.native.js.map +0 -1
- package/dist/cjs/createImage.cjs +0 -160
- package/dist/cjs/createImage.native.js +0 -164
- package/dist/cjs/createImage.native.js.map +0 -1
- package/dist/cjs/index.cjs +0 -21
- package/dist/cjs/index.native.js +0 -24
- package/dist/cjs/index.native.js.map +0 -1
- package/dist/cjs/types.cjs +0 -18
- package/dist/cjs/types.native.js +0 -21
- package/dist/cjs/types.native.js.map +0 -1
- package/dist/cjs/v1/Image.cjs +0 -101
- package/dist/cjs/v1/Image.native.js +0 -123
- package/dist/cjs/v1/Image.native.js.map +0 -1
- package/dist/cjs/v1/index.cjs +0 -20
- package/dist/cjs/v1/index.native.js +0 -23
- package/dist/cjs/v1/index.native.js.map +0 -1
- package/dist/esm/Image.mjs +0 -39
- package/dist/esm/Image.mjs.map +0 -1
- package/dist/esm/Image.native.js +0 -7
- package/dist/esm/Image.native.js.map +0 -1
- package/dist/esm/createImage.mjs +0 -135
- package/dist/esm/createImage.mjs.map +0 -1
- package/dist/esm/createImage.native.js +0 -136
- package/dist/esm/createImage.native.js.map +0 -1
- package/dist/esm/index.mjs +0 -3
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js +0 -3
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.mjs.map +0 -1
- package/dist/esm/types.native.js +0 -2
- package/dist/esm/types.native.js.map +0 -1
- package/dist/esm/v1/Image.mjs +0 -65
- package/dist/esm/v1/Image.mjs.map +0 -1
- package/dist/esm/v1/Image.native.js +0 -84
- package/dist/esm/v1/Image.native.js.map +0 -1
- package/dist/esm/v1/index.mjs +0 -2
- package/dist/esm/v1/index.mjs.map +0 -1
- package/dist/esm/v1/index.native.js +0 -2
- package/dist/esm/v1/index.native.js.map +0 -1
- package/dist/jsx/Image.mjs +0 -39
- package/dist/jsx/Image.mjs.map +0 -1
- package/dist/jsx/Image.native.js +0 -35
- package/dist/jsx/Image.native.js.map +0 -1
- package/dist/jsx/createImage.mjs +0 -135
- package/dist/jsx/createImage.mjs.map +0 -1
- package/dist/jsx/createImage.native.js +0 -164
- package/dist/jsx/createImage.native.js.map +0 -1
- package/dist/jsx/index.js +0 -3
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs +0 -3
- package/dist/jsx/index.mjs.map +0 -1
- package/dist/jsx/index.native.js +0 -24
- package/dist/jsx/index.native.js.map +0 -1
- package/dist/jsx/types.mjs +0 -2
- package/dist/jsx/types.mjs.map +0 -1
- package/dist/jsx/types.native.js +0 -21
- package/dist/jsx/types.native.js.map +0 -1
- package/dist/jsx/v1/Image.mjs +0 -65
- package/dist/jsx/v1/Image.mjs.map +0 -1
- package/dist/jsx/v1/Image.native.js +0 -123
- package/dist/jsx/v1/Image.native.js.map +0 -1
- package/dist/jsx/v1/index.mjs +0 -2
- package/dist/jsx/v1/index.mjs.map +0 -1
- package/dist/jsx/v1/index.native.js +0 -23
- package/dist/jsx/v1/index.native.js.map +0 -1
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getTokenValue, styled } from '@hanzogui/web';
|
|
3
|
+
const defaultObjectFitMap = (objectFit) => {
|
|
4
|
+
switch (objectFit) {
|
|
5
|
+
case 'fill':
|
|
6
|
+
return 'stretch';
|
|
7
|
+
case 'none':
|
|
8
|
+
return 'center';
|
|
9
|
+
case 'scale-down':
|
|
10
|
+
return 'contain';
|
|
11
|
+
case 'contain':
|
|
12
|
+
return 'contain';
|
|
13
|
+
default:
|
|
14
|
+
return 'cover';
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const defaultTransformSource = (props) => {
|
|
18
|
+
const { src, source } = props;
|
|
19
|
+
if (typeof src === 'string') {
|
|
20
|
+
return {
|
|
21
|
+
uri: src,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
if (source !== undefined && source !== null)
|
|
25
|
+
return source;
|
|
26
|
+
if (src !== undefined && src !== null)
|
|
27
|
+
return src;
|
|
28
|
+
return {
|
|
29
|
+
uri: src,
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Create a custom Image component with a pluggable underlying implementation.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* Using with expo-image
|
|
37
|
+
* import { Image as ExpoImage } from 'expo-image'
|
|
38
|
+
* import { createImage } from '@hanzogui/image'
|
|
39
|
+
*
|
|
40
|
+
* export const Image = createImage({
|
|
41
|
+
* Component: ExpoImage,
|
|
42
|
+
* resizeModePropName: 'contentFit',
|
|
43
|
+
* objectPositionPropName: 'contentPosition',
|
|
44
|
+
* })
|
|
45
|
+
*
|
|
46
|
+
* Now you get all expo-image props (transition, placeholder, etc.)
|
|
47
|
+
* plus Gui's unified API (src, objectFit, objectPosition)
|
|
48
|
+
* <Image
|
|
49
|
+
* src="https://example.com/photo.jpg"
|
|
50
|
+
* objectFit="cover"
|
|
51
|
+
* transition={300}
|
|
52
|
+
* placeholder={blurhash}
|
|
53
|
+
* />
|
|
54
|
+
*/
|
|
55
|
+
export function createImage(options) {
|
|
56
|
+
const { Component, mapObjectFitToResizeMode = defaultObjectFitMap, resizeModePropName = 'resizeMode', objectPositionPropName, transformSource = defaultTransformSource, } = options;
|
|
57
|
+
// Props that should pass directly to the underlying component without Gui processing
|
|
58
|
+
const inlinePropsSet = new Set([
|
|
59
|
+
'source',
|
|
60
|
+
'placeholder',
|
|
61
|
+
'transition',
|
|
62
|
+
'contentFit',
|
|
63
|
+
'contentPosition',
|
|
64
|
+
'cachePolicy',
|
|
65
|
+
'recyclingKey',
|
|
66
|
+
'allowDownscaling',
|
|
67
|
+
'autoplay',
|
|
68
|
+
'blurRadius',
|
|
69
|
+
'priority',
|
|
70
|
+
'placeholderContentFit',
|
|
71
|
+
'responsivePolicy',
|
|
72
|
+
'onLoadStart',
|
|
73
|
+
'onProgress',
|
|
74
|
+
'onLoadEnd',
|
|
75
|
+
]);
|
|
76
|
+
const StyledImage = styled(Component, {
|
|
77
|
+
name: 'Image',
|
|
78
|
+
}, {
|
|
79
|
+
inlineProps: inlinePropsSet,
|
|
80
|
+
});
|
|
81
|
+
const ImageComponent = StyledImage.styleable((incomingProps, ref) => {
|
|
82
|
+
const props = incomingProps;
|
|
83
|
+
const { src, source, width, height, borderRadius, objectFit, objectPosition,
|
|
84
|
+
// web only props - filter out on native
|
|
85
|
+
decoding, elementTiming, fetchpriority, isMap, loading, sizes, useMap, onLoad, onError, ...rest } = props;
|
|
86
|
+
const resolvedWidth = typeof width === 'string' && width[0] === '$'
|
|
87
|
+
? getTokenValue(width, 'size')
|
|
88
|
+
: width;
|
|
89
|
+
const resolvedHeight = typeof height === 'string' && height[0] === '$'
|
|
90
|
+
? getTokenValue(height, 'size')
|
|
91
|
+
: height;
|
|
92
|
+
const finalSource = transformSource({
|
|
93
|
+
src,
|
|
94
|
+
source,
|
|
95
|
+
width: resolvedWidth,
|
|
96
|
+
height: resolvedHeight,
|
|
97
|
+
});
|
|
98
|
+
const incomingStyle = Array.isArray(rest.style)
|
|
99
|
+
? Object.assign({}, ...rest.style.flat())
|
|
100
|
+
: rest.style;
|
|
101
|
+
const resolvedBorderRadius = typeof borderRadius === 'string' && borderRadius[0] === '$'
|
|
102
|
+
? getTokenValue(borderRadius, 'radius')
|
|
103
|
+
: borderRadius;
|
|
104
|
+
const finalProps = {
|
|
105
|
+
...rest,
|
|
106
|
+
source: finalSource,
|
|
107
|
+
style: {
|
|
108
|
+
...incomingStyle,
|
|
109
|
+
...(resolvedBorderRadius !== undefined && { borderRadius: resolvedBorderRadius }),
|
|
110
|
+
...(resolvedWidth !== undefined && { width: resolvedWidth }),
|
|
111
|
+
...(resolvedHeight !== undefined && { height: resolvedHeight }),
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
// Set resize mode / content fit
|
|
115
|
+
if (objectFit) {
|
|
116
|
+
finalProps[resizeModePropName] = mapObjectFitToResizeMode(objectFit);
|
|
117
|
+
}
|
|
118
|
+
// Add object position if supported
|
|
119
|
+
if (objectPositionPropName && objectPosition) {
|
|
120
|
+
finalProps[objectPositionPropName] = objectPosition;
|
|
121
|
+
}
|
|
122
|
+
// Normalize onLoad event
|
|
123
|
+
if (onLoad) {
|
|
124
|
+
finalProps.onLoad = (e) => {
|
|
125
|
+
const source = e?.nativeEvent?.source || e?.source || {};
|
|
126
|
+
onLoad({
|
|
127
|
+
target: {
|
|
128
|
+
naturalHeight: source?.height,
|
|
129
|
+
naturalWidth: source?.width,
|
|
130
|
+
},
|
|
131
|
+
type: 'load',
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
// Normalize onError event
|
|
136
|
+
if (onError) {
|
|
137
|
+
finalProps.onError = () => {
|
|
138
|
+
onError({
|
|
139
|
+
type: 'error',
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
return _jsx(StyledImage, { ref: ref, ...finalProps });
|
|
144
|
+
});
|
|
145
|
+
// Add static methods if the component has them
|
|
146
|
+
const comp = Component;
|
|
147
|
+
ImageComponent.getSize = comp.getSize || (() => { });
|
|
148
|
+
ImageComponent.getSizeWithHeaders = comp.getSizeWithHeaders || (() => { });
|
|
149
|
+
ImageComponent.prefetch = comp.prefetch || (() => { });
|
|
150
|
+
ImageComponent.prefetchWithMetadata = comp.prefetchWithMetadata || (() => { });
|
|
151
|
+
ImageComponent.abortPrefetch = comp.abortPrefetch || (() => { });
|
|
152
|
+
ImageComponent.queryCache = comp.queryCache || (() => { });
|
|
153
|
+
return ImageComponent;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=createImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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X,CAAC,CAAA;QACH,CAAC;QAED,0BAA0B;QAC1B,IAAI,OAAO,EAAE,CAAC;YACZ,UAAU,CAAC,OAAO,GAAG,GAAG,EAAE;gBACxB,OAAO,CAAC;oBACN,IAAI,EAAE,OAAO;iBACP,CAAC,CAAA;YACX,CAAC,CAAA;QACH,CAAC;QAED,OAAO,KAAC,WAAW,IAAC,GAAG,EAAE,GAAG,KAAM,UAAU,GAAI,CAAA;IAClD,CAAC,CAAmD,CAAA;IAEpD,+CAA+C;IAC/C,MAAM,IAAI,GAAG,SAAgB,CAAA;IAC7B,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IACnD,cAAc,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IACzE,cAAc,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IACrD,cAAc,CAAC,oBAAoB,GAAG,IAAI,CAAC,oBAAoB,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IAC7E,cAAc,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IAC/D,cAAc,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IAEzD,OAAO,cAAc,CAAA;AACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAa,CAAA;AAC3B,cAAc,kBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { isWeb } from '@hanzogui/constants';
|
|
4
|
+
import { styled, usePropsAndStyle } from '@hanzogui/web';
|
|
5
|
+
import { Image as RNImage } from 'react-native';
|
|
6
|
+
const StyledImage = styled(RNImage, {
|
|
7
|
+
name: 'Image',
|
|
8
|
+
});
|
|
9
|
+
let hasWarned = false;
|
|
10
|
+
/**
|
|
11
|
+
* @summary An image is a component that displays an image.
|
|
12
|
+
* @see — Docs https://hanzogui.dev/ui/image
|
|
13
|
+
*/
|
|
14
|
+
export const Image = StyledImage.styleable((inProps, ref) => {
|
|
15
|
+
const [props, style] = usePropsAndStyle(inProps);
|
|
16
|
+
const { src, source, objectFit, ...rest } = props;
|
|
17
|
+
if (process.env.NODE_ENV === 'development') {
|
|
18
|
+
if (typeof src === 'string') {
|
|
19
|
+
if ((typeof props.width === 'string' && props.width[0] !== '$') ||
|
|
20
|
+
(typeof props.height === 'string' && props.height[0] !== '$')) {
|
|
21
|
+
if (!hasWarned) {
|
|
22
|
+
hasWarned = true;
|
|
23
|
+
console.warn(`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.`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
let finalSource = typeof src === 'string'
|
|
29
|
+
? {
|
|
30
|
+
uri: src,
|
|
31
|
+
...(isWeb && {
|
|
32
|
+
width: props.width || style?.width,
|
|
33
|
+
height: props.height || style?.height,
|
|
34
|
+
}),
|
|
35
|
+
}
|
|
36
|
+
: (source ?? src);
|
|
37
|
+
if (finalSource && typeof finalSource === 'object') {
|
|
38
|
+
if ("native" === 'native') {
|
|
39
|
+
// fix: normalize import style images
|
|
40
|
+
if (!Array.isArray(finalSource)) {
|
|
41
|
+
if (typeof finalSource.uri === 'number') {
|
|
42
|
+
finalSource = finalSource.uri;
|
|
43
|
+
if (source && typeof source === 'object' && !Array.isArray(source)) {
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
style.width ?? (style.width = source.width);
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
style.height ?? (style.height = source.height);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (process.env.NODE_ENV === 'development' && process.env.GUI_IMAGE_CHECK_ERROR) {
|
|
53
|
+
// lets add an onload timeout and warning if it fails to load in console
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
async function run() {
|
|
56
|
+
if (typeof src === 'string') {
|
|
57
|
+
try {
|
|
58
|
+
await fetch(src).then((res) => res.text());
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
console.error(`Error loading image: ${src}`, { props });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
run();
|
|
66
|
+
}, [src]);
|
|
67
|
+
}
|
|
68
|
+
// require compat across native/web
|
|
69
|
+
if (finalSource['default']) {
|
|
70
|
+
finalSource = finalSource['default'];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// must set defaultSource to allow SSR, default it to the same as src
|
|
74
|
+
return (_jsx(RNImage, { resizeMode: objectFit, ref: ref, source: finalSource, style: style, ...rest }));
|
|
75
|
+
});
|
|
76
|
+
Image.getSize = RNImage.getSize;
|
|
77
|
+
Image.getSizeWithHeaders = RNImage.getSizeWithHeaders;
|
|
78
|
+
Image.prefetch = RNImage.prefetch;
|
|
79
|
+
Image.prefetchWithMetadata = RNImage.prefetchWithMetadata;
|
|
80
|
+
Image.abortPrefetch = RNImage.abortPrefetch;
|
|
81
|
+
Image.queryCache = RNImage.queryCache;
|
|
82
|
+
//# sourceMappingURL=Image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.js","sourceRoot":"","sources":["../../../src/v1/Image.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO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C,CAAC;wBAAC,OAAO,GAAG,EAAE,CAAC;4BACb,OAAO,CAAC,KAAK,CAAC,wBAAwB,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;wBACzD,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,GAAG,EAAE,CAAA;YACP,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;QACX,CAAC;QAED,mCAAmC;QACnC,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3B,WAAW,GAAG,WAAW,CAAC,SAAS,CAAC,CAAA;QACtC,CAAC;IACH,CAAC;IAED,qEAAqE;IACrE,OAAO,CACL,KAAC,OAAO,IACN,UAAU,EAAE,SAAS,EACrB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,KAAK,KACP,IAAY,GACjB,CACH,CAAA;AACH,CAAC,CAAqB,CAAA;AAEtB,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;AAC/B,KAAK,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;AACrD,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;AACjC,KAAK,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAA;AACzD,KAAK,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAA;AAC3C,KAAK,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/v1/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAa,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzogui/image",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.2",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -9,19 +9,19 @@
|
|
|
9
9
|
],
|
|
10
10
|
"type": "module",
|
|
11
11
|
"sideEffects": false,
|
|
12
|
-
"main": "dist/cjs",
|
|
13
|
-
"module": "dist/esm",
|
|
12
|
+
"main": "./dist/cjs/index.js",
|
|
13
|
+
"module": "./dist/esm/index.js",
|
|
14
14
|
"types": "./types/index.d.ts",
|
|
15
15
|
"exports": {
|
|
16
16
|
"./package.json": "./package.json",
|
|
17
17
|
".": {
|
|
18
18
|
"types": "./types/index.d.ts",
|
|
19
|
-
"react-native": "./dist/
|
|
20
|
-
"browser": "./dist/esm/index.
|
|
21
|
-
"module": "./dist/esm/index.
|
|
22
|
-
"import": "./dist/esm/index.
|
|
23
|
-
"require": "./dist/cjs/index.
|
|
24
|
-
"default": "./dist/esm/index.
|
|
19
|
+
"react-native": "./dist/native/index.js",
|
|
20
|
+
"browser": "./dist/esm/index.js",
|
|
21
|
+
"module": "./dist/esm/index.js",
|
|
22
|
+
"import": "./dist/esm/index.js",
|
|
23
|
+
"require": "./dist/cjs/index.js",
|
|
24
|
+
"default": "./dist/esm/index.js"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
|
@@ -34,17 +34,22 @@
|
|
|
34
34
|
"clean:build": "hanzogui-build clean:build"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@hanzogui/constants": "8.3.
|
|
38
|
-
"@hanzogui/core": "8.3.
|
|
39
|
-
"@hanzogui/web": "8.3.
|
|
37
|
+
"@hanzogui/constants": "8.3.2",
|
|
38
|
+
"@hanzogui/core": "8.3.2",
|
|
39
|
+
"@hanzogui/web": "8.3.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@hanzogui/build": "8.3.
|
|
43
|
-
"react": "
|
|
44
|
-
"react-native": "0.
|
|
42
|
+
"@hanzogui/build": "8.3.2",
|
|
43
|
+
"react": "19.2.8",
|
|
44
|
+
"react-native": "^0.87.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"react": ">=19"
|
|
47
|
+
"react": ">=19.2.8"
|
|
48
48
|
},
|
|
49
|
-
"module:jsx": "dist/jsx"
|
|
49
|
+
"module:jsx": "dist/jsx",
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/hanzoai/gui.git",
|
|
53
|
+
"directory": "pkgs/ui/image"
|
|
54
|
+
}
|
|
50
55
|
}
|
package/src/Image.native.tsx
CHANGED
package/src/Image.tsx
CHANGED
package/src/createImage.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getTokenValue, styled } from '@hanzogui/web'
|
|
2
2
|
import type { ComponentType } from 'react'
|
|
3
3
|
import type { ImageResizeMode } from 'react-native'
|
|
4
|
-
import type { ImageProps, ImageType } from './types'
|
|
4
|
+
import type { ImageProps, ImageType } from './types.ts'
|
|
5
5
|
|
|
6
6
|
type GetProps<T> = T extends ComponentType<infer P> ? P : never
|
|
7
7
|
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './Image'
|
|
2
|
-
export * from './createImage'
|
|
3
|
-
export type { ImageProps, ImageType } from './types'
|
|
1
|
+
export * from './Image.tsx'
|
|
2
|
+
export * from './createImage.tsx'
|
|
3
|
+
export type { ImageProps, ImageType } from './types.ts'
|
package/src/v1/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './Image'
|
|
1
|
+
export * from './Image.tsx'
|
package/types/Image.d.ts
CHANGED
package/types/Image.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../src/Image.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../src/Image.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,YAAY,CAAA;AAOvD,eAAO,MAAM,KAAK,EAuBF,SAAS,CAAA"}
|
package/types/Image.native.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Image as RNImage } from 'react-native';
|
|
2
|
-
export declare const Image: import("react").FC<Partial<import("./types").ImageProps>> & {
|
|
2
|
+
export declare const Image: import("react").FC<Partial<import("./types.ts").ImageProps>> & {
|
|
3
3
|
getSize: typeof RNImage.getSize;
|
|
4
4
|
getSizeWithHeaders: typeof RNImage.getSizeWithHeaders;
|
|
5
5
|
prefetch: typeof RNImage.prefetch;
|
|
6
6
|
prefetchWithMetadata: typeof RNImage.prefetchWithMetadata;
|
|
7
7
|
abortPrefetch: typeof RNImage.abortPrefetch | undefined;
|
|
8
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 | keyof import("@hanzogui/web").
|
|
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, "resizeMode" | "source" | `$${string}` | `$${number}` | import("@hanzogui/web").GroupMediaKeys | keyof import("@hanzogui/web").StackNonStyleProps | keyof import("@hanzogui/web").StackStyleBase | 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>>>> & {
|
|
10
10
|
src?: string | number;
|
|
11
11
|
source?: import("react-native").ImageSourcePropType;
|
|
12
12
|
resizeMode?: import("react-native").ImageResizeMode;
|
|
13
|
-
objectFit?: React.CSSProperties[
|
|
14
|
-
objectPosition?: React.CSSProperties[
|
|
15
|
-
} & Omit<import("react").ImgHTMLAttributes<HTMLImageElement>, `$${string}` | `$${number}` | import("@hanzogui/web").GroupMediaKeys | keyof import("@hanzogui/web").
|
|
13
|
+
objectFit?: React.CSSProperties['objectFit'];
|
|
14
|
+
objectPosition?: React.CSSProperties['objectPosition'];
|
|
15
|
+
} & Omit<import("react").ImgHTMLAttributes<HTMLImageElement>, "src" | `$${string}` | `$${number}` | import("@hanzogui/web").GroupMediaKeys | keyof import("@hanzogui/web").StackNonStyleProps | keyof import("@hanzogui/web").StackStyleBase | 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>>>> & Omit<import("react").ImgHTMLAttributes<HTMLImageElement>, "height" | "src" | "style" | "width"> & Omit<import("react-native").ImageProps, "about" | "accessKey" | "alt" | "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" | "autoCapitalize" | "autoCorrect" | "autoFocus" | "autoSave" | "blurRadius" | "capInsets" | "color" | "contentEditable" | "contextMenu" | "crossOrigin" | "datatype" | "decoding" | "defaultChecked" | "defaultSource" | "defaultValue" | "dir" | "draggable" | "enterKeyHint" | "exportparts" | "fadeDuration" | "fetchPriority" | "hidden" | "inert" | "inlist" | "inputMode" | "is" | "itemID" | "itemProp" | "itemRef" | "itemScope" | "itemType" | "lang" | "loading" | "loadingIndicatorSource" | "nonce" | "objectPosition" | "onAbort" | "onAbortCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAuxClick" | "onAuxClickCapture" | "onBeforeInputCapture" | "onBeforeToggle" | "onBlurCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onChangeCapture" | "onClickCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onContextMenuCapture" | "onCopyCapture" | "onCutCapture" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeaveCapture" | "onDragOverCapture" | "onDragStartCapture" | "onDropCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onError" | "onErrorCapture" | "onFocusCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onInputCapture" | "onInvalid" | "onInvalidCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUpCapture" | "onLayout" | "onLoad" | "onLoadCapture" | "onLoadEnd" | "onLoadStart" | "onLoadStartCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onMouseDownCapture" | "onMouseMoveCapture" | "onMouseOutCapture" | "onMouseOverCapture" | "onMouseUpCapture" | "onPartialLoad" | "onPasteCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onPointerOut" | "onPointerOutCapture" | "onPointerOver" | "onPointerOverCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onReset" | "onResetCapture" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onSelect" | "onSelectCapture" | "onStalled" | "onStalledCapture" | "onSubmit" | "onSubmitCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onToggle" | "onTouchCancelCapture" | "onTouchMoveCapture" | "onTouchStartCapture" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onWheelCapture" | "part" | "popover" | "popoverTarget" | "popoverTargetAction" | "prefix" | "progressiveRenderingEnabled" | "property" | "radioGroup" | "referrerPolicy" | "rel" | "resizeMethod" | "resizeMode" | "resource" | "results" | "rev" | "security" | "sizes" | "slot" | "source" | "spellCheck" | "src" | "srcSet" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "tintColor" | "title" | "translate" | "typeof" | "unselectable" | "useMap" | "vocab" | `$${string}` | `$${number}` | import("@hanzogui/web").GroupMediaKeys | keyof import("@hanzogui/web").StackNonStyleProps | keyof import("@hanzogui/web").StackStyleBase | 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>>>>>;
|
|
16
16
|
//# sourceMappingURL=Image.native.d.ts.map
|
package/types/createImage.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import type { ImageResizeMode } from 'react-native';
|
|
3
|
-
import type { ImageProps } from './types';
|
|
3
|
+
import type { ImageProps } from './types.ts';
|
|
4
4
|
type GetProps<T> = T extends ComponentType<infer P> ? P : never;
|
|
5
5
|
export type CreateImageOptions<C extends ComponentType<any>> = {
|
|
6
6
|
/**
|
|
@@ -66,12 +66,12 @@ export declare function createImage<C extends ComponentType<any>>(options: Creat
|
|
|
66
66
|
prefetchWithMetadata: typeof import("react-native").Image.prefetchWithMetadata;
|
|
67
67
|
abortPrefetch: typeof import("react-native").Image.abortPrefetch | undefined;
|
|
68
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 | keyof import("@hanzogui/web").
|
|
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, "resizeMode" | "source" | `$${string}` | `$${number}` | import("@hanzogui/web").GroupMediaKeys | keyof import("@hanzogui/web").StackNonStyleProps | keyof import("@hanzogui/web").StackStyleBase | 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>>>> & {
|
|
70
70
|
src?: string | number;
|
|
71
71
|
source?: import("react-native").ImageSourcePropType;
|
|
72
72
|
resizeMode?: ImageResizeMode;
|
|
73
|
-
objectFit?: React.CSSProperties[
|
|
74
|
-
objectPosition?: React.CSSProperties[
|
|
75
|
-
} & Omit<import("react").ImgHTMLAttributes<HTMLImageElement>, `$${string}` | `$${number}` | import("@hanzogui/web").GroupMediaKeys | keyof import("@hanzogui/web").
|
|
73
|
+
objectFit?: React.CSSProperties['objectFit'];
|
|
74
|
+
objectPosition?: React.CSSProperties['objectPosition'];
|
|
75
|
+
} & Omit<import("react").ImgHTMLAttributes<HTMLImageElement>, "src" | `$${string}` | `$${number}` | import("@hanzogui/web").GroupMediaKeys | keyof import("@hanzogui/web").StackNonStyleProps | keyof import("@hanzogui/web").StackStyleBase | 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>>>> & Omit<import("react").ImgHTMLAttributes<HTMLImageElement>, "height" | "src" | "style" | "width"> & Omit<GetProps<C>, "about" | "accessKey" | "alt" | "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" | "autoCapitalize" | "autoCorrect" | "autoFocus" | "autoSave" | "blurRadius" | "capInsets" | "color" | "contentEditable" | "contextMenu" | "crossOrigin" | "datatype" | "decoding" | "defaultChecked" | "defaultSource" | "defaultValue" | "dir" | "draggable" | "enterKeyHint" | "exportparts" | "fadeDuration" | "fetchPriority" | "hidden" | "inert" | "inlist" | "inputMode" | "is" | "itemID" | "itemProp" | "itemRef" | "itemScope" | "itemType" | "lang" | "loading" | "loadingIndicatorSource" | "nonce" | "objectPosition" | "onAbort" | "onAbortCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAuxClick" | "onAuxClickCapture" | "onBeforeInputCapture" | "onBeforeToggle" | "onBlurCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onChangeCapture" | "onClickCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onContextMenuCapture" | "onCopyCapture" | "onCutCapture" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeaveCapture" | "onDragOverCapture" | "onDragStartCapture" | "onDropCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onError" | "onErrorCapture" | "onFocusCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onInputCapture" | "onInvalid" | "onInvalidCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUpCapture" | "onLayout" | "onLoad" | "onLoadCapture" | "onLoadEnd" | "onLoadStart" | "onLoadStartCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onMouseDownCapture" | "onMouseMoveCapture" | "onMouseOutCapture" | "onMouseOverCapture" | "onMouseUpCapture" | "onPartialLoad" | "onPasteCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onPointerOut" | "onPointerOutCapture" | "onPointerOver" | "onPointerOverCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onReset" | "onResetCapture" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onSelect" | "onSelectCapture" | "onStalled" | "onStalledCapture" | "onSubmit" | "onSubmitCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onToggle" | "onTouchCancelCapture" | "onTouchMoveCapture" | "onTouchStartCapture" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onWheelCapture" | "part" | "popover" | "popoverTarget" | "popoverTargetAction" | "prefix" | "progressiveRenderingEnabled" | "property" | "radioGroup" | "referrerPolicy" | "rel" | "resizeMethod" | "resizeMode" | "resource" | "results" | "rev" | "security" | "sizes" | "slot" | "source" | "spellCheck" | "src" | "srcSet" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "tintColor" | "title" | "translate" | "typeof" | "unselectable" | "useMap" | "vocab" | `$${string}` | `$${number}` | import("@hanzogui/web").GroupMediaKeys | keyof import("@hanzogui/web").StackNonStyleProps | keyof import("@hanzogui/web").StackStyleBase | 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>>>>>;
|
|
76
76
|
export {};
|
|
77
77
|
//# sourceMappingURL=createImage.d.ts.map
|
|
@@ -1 +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,
|
|
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,YAAY,CAAA;AAEvD,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;AAoCD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,aAAa,CAAC,GAAG,CAAC,EACtD,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC;;;;;;;;;;;;;yvKAoJ/B"}
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './Image';
|
|
2
|
-
export * from './createImage';
|
|
3
|
-
export type { ImageProps, ImageType } from './types';
|
|
1
|
+
export * from './Image.tsx';
|
|
2
|
+
export * from './createImage.tsx';
|
|
3
|
+
export type { ImageProps, ImageType } from './types.ts';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA"}
|
package/types/v1/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './Image';
|
|
1
|
+
export * from './Image.tsx';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/types/v1/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|