@fountain-ui/lab 2.0.0-beta.34 → 2.0.0-beta.36
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/build/commonjs/ComicViewer/ComicViewer.js +196 -143
- package/build/commonjs/ComicViewer/ComicViewer.js.map +1 -1
- package/build/commonjs/ComicViewer/ComicViewerProps.js +0 -12
- package/build/commonjs/ComicViewer/ComicViewerProps.js.map +1 -1
- package/build/commonjs/ComicViewer/EncodedTile.js +10 -0
- package/build/commonjs/ComicViewer/EncodedTile.js.map +1 -0
- package/build/commonjs/ComicViewer/ReloadButton.js +48 -0
- package/build/commonjs/ComicViewer/ReloadButton.js.map +1 -0
- package/build/commonjs/ComicViewer/ViewerItem.js +41 -173
- package/build/commonjs/ComicViewer/ViewerItem.js.map +1 -1
- package/build/commonjs/ComicViewer/index.js.map +1 -1
- package/build/module/ComicViewer/ComicViewer.js +195 -143
- package/build/module/ComicViewer/ComicViewer.js.map +1 -1
- package/build/module/ComicViewer/ComicViewerProps.js +1 -6
- package/build/module/ComicViewer/ComicViewerProps.js.map +1 -1
- package/build/module/ComicViewer/EncodedTile.js +3 -0
- package/build/module/ComicViewer/EncodedTile.js.map +1 -0
- package/build/module/ComicViewer/ReloadButton.js +33 -0
- package/build/module/ComicViewer/ReloadButton.js.map +1 -0
- package/build/module/ComicViewer/ViewerItem.js +42 -173
- package/build/module/ComicViewer/ViewerItem.js.map +1 -1
- package/build/module/ComicViewer/index.js.map +1 -1
- package/build/typescript/ComicViewer/ComicViewer.d.ts +1 -1
- package/build/typescript/ComicViewer/ComicViewerProps.d.ts +15 -90
- package/build/typescript/ComicViewer/EncodedTile.d.ts +2 -0
- package/build/typescript/ComicViewer/ReloadButton.d.ts +6 -0
- package/build/typescript/ComicViewer/ViewerItem.d.ts +37 -7
- package/build/typescript/ComicViewer/index.d.ts +2 -2
- package/package.json +2 -2
- package/src/ComicViewer/ComicViewer.tsx +210 -157
- package/src/ComicViewer/ComicViewerProps.ts +15 -107
- package/src/ComicViewer/EncodedTile.ts +3 -0
- package/src/ComicViewer/ReloadButton.tsx +36 -0
- package/src/ComicViewer/ViewerItem.tsx +82 -184
- package/src/ComicViewer/index.ts +2 -2
- package/build/commonjs/ComicViewer/ComicViewerItemProps.js +0 -6
- package/build/commonjs/ComicViewer/ComicViewerItemProps.js.map +0 -1
- package/build/module/ComicViewer/ComicViewerItemProps.js +0 -2
- package/build/module/ComicViewer/ComicViewerItemProps.js.map +0 -1
- package/build/typescript/ComicViewer/ComicViewerItemProps.d.ts +0 -34
- package/src/ComicViewer/ComicViewerItemProps.ts +0 -42
|
@@ -3,207 +3,75 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = ViewerItem;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
10
|
var _reactNative = require("react-native");
|
|
11
11
|
|
|
12
|
-
var R = _interopRequireWildcard(require("ramda"));
|
|
13
|
-
|
|
14
12
|
var _core = require("@fountain-ui/core");
|
|
15
13
|
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var _ComicViewerProps = require("./ComicViewerProps");
|
|
14
|
+
var _ReloadButton = _interopRequireDefault(require("./ReloadButton"));
|
|
19
15
|
|
|
20
|
-
|
|
16
|
+
var _EncodedTile = _interopRequireDefault(require("./EncodedTile"));
|
|
21
17
|
|
|
22
|
-
function
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
root: {
|
|
27
|
-
display: 'flex',
|
|
28
|
-
flexDirection: 'row',
|
|
29
|
-
justifyContent: 'center'
|
|
30
|
-
},
|
|
31
|
-
reload: {
|
|
32
|
-
display: 'flex',
|
|
33
|
-
alignItems: 'center'
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
function ViewerItem(_ref) {
|
|
39
|
-
var _itemState$error;
|
|
40
|
-
|
|
41
|
-
let {
|
|
42
|
-
props
|
|
43
|
-
} = _ref;
|
|
20
|
+
function ViewerItem(props) {
|
|
44
21
|
const {
|
|
45
|
-
expiresAt,
|
|
46
|
-
errorRetryCount = 3,
|
|
47
22
|
height,
|
|
48
|
-
itemState,
|
|
49
|
-
isViewable,
|
|
50
|
-
sortKey,
|
|
51
|
-
responseTimestamp,
|
|
52
23
|
url,
|
|
53
24
|
width,
|
|
54
|
-
getNextPage,
|
|
55
25
|
onError,
|
|
56
|
-
|
|
57
|
-
|
|
26
|
+
onLoad,
|
|
27
|
+
onPress,
|
|
28
|
+
onReloadPress,
|
|
29
|
+
reloadButtonVisible = false
|
|
58
30
|
} = props;
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const handleError = (0, _react.useCallback)(() => {
|
|
68
|
-
errorCount.current = errorCount.current + 1;
|
|
69
|
-
const now = new Date();
|
|
70
|
-
const utcNow = now.getTime() + now.getTimezoneOffset() * 60 * 1000;
|
|
71
|
-
const expired = new Date(expiresAt).getTime() <= utcNow;
|
|
72
|
-
onError && onError({
|
|
73
|
-
sortKey,
|
|
74
|
-
count: errorCount.current,
|
|
75
|
-
expired
|
|
76
|
-
});
|
|
77
|
-
}, [errorCount.current, onError]);
|
|
78
|
-
const onReloadPress = (0, _react.useCallback)(() => {
|
|
79
|
-
errorCount.current = 1;
|
|
80
|
-
onError && onError({
|
|
81
|
-
sortKey,
|
|
82
|
-
count: errorCount.current,
|
|
83
|
-
expired: false
|
|
84
|
-
});
|
|
85
|
-
}, [sortKey, onError]);
|
|
86
|
-
const viewStyle = {
|
|
87
|
-
width: '100%',
|
|
88
|
-
height,
|
|
89
|
-
..._reactNative.Platform.select({
|
|
90
|
-
web: {
|
|
91
|
-
'cursor': 'default'
|
|
92
|
-
}
|
|
93
|
-
})
|
|
94
|
-
};
|
|
95
|
-
const imageStyle = {
|
|
96
|
-
width,
|
|
97
|
-
height
|
|
98
|
-
};
|
|
99
|
-
const Placeholder = (0, _react.useCallback)(props => {
|
|
100
|
-
const {
|
|
101
|
-
children,
|
|
102
|
-
failed
|
|
103
|
-
} = props;
|
|
104
|
-
|
|
105
|
-
if (!(isViewable || isLoaded || failed) || (itemState === null || itemState === void 0 ? void 0 : itemState.state) === _ComicViewerProps.STATE.FAIL || (itemState === null || itemState === void 0 ? void 0 : itemState.state) === _ComicViewerProps.STATE.INIT) {
|
|
106
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.ImageBackground, {
|
|
107
|
-
source: {
|
|
108
|
-
uri: 'https://ssl.pstatic.net/static/m/comic/im/2012/bg_viewbody.jpg'
|
|
109
|
-
},
|
|
110
|
-
resizeMode: "repeat",
|
|
111
|
-
style: viewStyle
|
|
112
|
-
});
|
|
31
|
+
const styles = {
|
|
32
|
+
view: {
|
|
33
|
+
height,
|
|
34
|
+
width: '100%'
|
|
35
|
+
},
|
|
36
|
+
image: {
|
|
37
|
+
height,
|
|
38
|
+
width
|
|
113
39
|
}
|
|
40
|
+
};
|
|
41
|
+
const error = reloadButtonVisible ? /*#__PURE__*/_react.default.createElement(_ReloadButton.default, {
|
|
42
|
+
onPress: onReloadPress
|
|
43
|
+
}) : null;
|
|
114
44
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}, /*#__PURE__*/_react.default.createElement(_core.Spacer, {
|
|
123
|
-
size: 20
|
|
124
|
-
}), /*#__PURE__*/_react.default.createElement(_core.IconButton, {
|
|
125
|
-
children: /*#__PURE__*/_react.default.createElement(_icons.Restart, {
|
|
126
|
-
fill: '#ffffff'
|
|
127
|
-
}),
|
|
128
|
-
style: {
|
|
129
|
-
width: 48,
|
|
130
|
-
height: 48,
|
|
131
|
-
borderRadius: 24,
|
|
132
|
-
color: '#ffffff',
|
|
133
|
-
backgroundColor: '#767676'
|
|
134
|
-
},
|
|
135
|
-
onPress: onReloadPress
|
|
136
|
-
}));
|
|
137
|
-
}
|
|
45
|
+
const placeholder = /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
46
|
+
source: {
|
|
47
|
+
uri: _EncodedTile.default
|
|
48
|
+
},
|
|
49
|
+
resizeMode: 'cover',
|
|
50
|
+
style: styles.image
|
|
51
|
+
});
|
|
138
52
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
uri: 'https://ssl.pstatic.net/static/m/comic/im/2012/bg_viewbody.jpg'
|
|
142
|
-
},
|
|
143
|
-
resizeMode: "repeat",
|
|
144
|
-
style: viewStyle
|
|
145
|
-
}, children);
|
|
146
|
-
}, [isViewable, isLoaded, errorCount.current, itemState === null || itemState === void 0 ? void 0 : itemState.state, responseTimestamp]);
|
|
147
|
-
(0, _react.useEffect)(() => {
|
|
148
|
-
if ((itemState === null || itemState === void 0 ? void 0 : itemState.state) === _ComicViewerProps.STATE.INIT) {
|
|
149
|
-
getNextPage === null || getNextPage === void 0 ? void 0 : getNextPage(sortKey);
|
|
150
|
-
}
|
|
151
|
-
}, []);
|
|
152
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
153
|
-
activeOpacity: 1,
|
|
154
|
-
onPress: onItemPress
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.TouchableWithoutFeedback, {
|
|
54
|
+
onPress: onPress
|
|
155
55
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
156
|
-
style:
|
|
56
|
+
style: styles.view
|
|
157
57
|
}, /*#__PURE__*/_react.default.createElement(_core.Image, {
|
|
158
|
-
failDependency: [url, expiresAt, responseTimestamp],
|
|
159
|
-
disableOutline: true,
|
|
160
|
-
key: sortKey,
|
|
161
|
-
disableLongClick: true,
|
|
162
58
|
disableDrag: true,
|
|
59
|
+
disableLongClick: true,
|
|
60
|
+
disableOutline: true,
|
|
61
|
+
error: error,
|
|
62
|
+
onError: onError,
|
|
163
63
|
onLoad: onLoad,
|
|
164
|
-
onError: handleError,
|
|
165
64
|
loading: 'eager',
|
|
65
|
+
placeholder: placeholder,
|
|
166
66
|
source: {
|
|
167
67
|
uri: url
|
|
168
68
|
},
|
|
169
|
-
style: imageStyle,
|
|
170
69
|
square: true,
|
|
171
|
-
|
|
172
|
-
|
|
70
|
+
style: (0, _core.css)([{
|
|
71
|
+
alignSelf: 'center'
|
|
72
|
+
}, styles.image])
|
|
173
73
|
})));
|
|
174
74
|
}
|
|
175
75
|
|
|
176
|
-
|
|
177
|
-
var _prevProps$props$item, _nextProps$props$item, _prevProps$props$item2;
|
|
178
|
-
|
|
179
|
-
if (prevProps.props.isViewable !== nextProps.props.isViewable) {
|
|
180
|
-
return false;
|
|
181
|
-
} // NO NEED ?
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
if (prevProps.props.url !== nextProps.props.url) {
|
|
185
|
-
return false;
|
|
186
|
-
} // NO NEED ?
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
if (prevProps.props.expiresAt !== nextProps.props.expiresAt) {
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (prevProps.props.width !== nextProps.props.width) {
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if (((_prevProps$props$item = prevProps.props.itemState) === null || _prevProps$props$item === void 0 ? void 0 : _prevProps$props$item.state) !== ((_nextProps$props$item = nextProps.props.itemState) === null || _nextProps$props$item === void 0 ? void 0 : _nextProps$props$item.state)) {
|
|
198
|
-
return false;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (((_prevProps$props$item2 = prevProps.props.itemState) === null || _prevProps$props$item2 === void 0 ? void 0 : _prevProps$props$item2.state) !== _ComicViewerProps.STATE.LOADED && prevProps.props.responseTimestamp !== nextProps.props.responseTimestamp) {
|
|
202
|
-
return false;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return true;
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
exports.default = _default;
|
|
76
|
+
;
|
|
209
77
|
//# sourceMappingURL=ViewerItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useStyles","root","display","flexDirection","justifyContent","reload","alignItems","ViewerItem","props","expiresAt","errorRetryCount","height","itemState","isViewable","sortKey","responseTimestamp","url","width","getNextPage","onError","onLoaded","onItemPress","isLoaded","setIsLoaded","useState","styles","errorCount","useRef","R","defaultTo","error","count","onLoad","useCallback","current","handleError","now","Date","utcNow","getTime","getTimezoneOffset","expired","onReloadPress","viewStyle","Platform","select","web","imageStyle","Placeholder","children","failed","state","STATE","FAIL","INIT","uri","borderRadius","color","backgroundColor","useEffect","React","memo","prevProps","nextProps","LOADED"],"sources":["ViewerItem.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { ImageBackground, Platform, TouchableOpacity, View } from 'react-native';\nimport * as R from 'ramda';\nimport type { PlaceholderProps } from '@fountain-ui/core';\nimport { IconButton, Image, Spacer } from '@fountain-ui/core';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { Restart } from '@fountain-ui/icons';\nimport ComicViewerItemProps from './ComicViewerItemProps';\nimport { STATE } from './ComicViewerProps';\n\ntype PlaceholderStyles = NamedStylesStringUnion<'reload' | 'root'>;\n\nconst useStyles: UseStyles<PlaceholderStyles> = function (): PlaceholderStyles {\n return {\n root: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'center',\n },\n reload: {\n display: 'flex',\n alignItems: 'center',\n },\n };\n};\n\nfunction ViewerItem<T>({ props }: { props: ComicViewerItemProps<T> }) {\n const {\n expiresAt,\n errorRetryCount = 3,\n height,\n itemState,\n isViewable,\n sortKey,\n responseTimestamp,\n url,\n width,\n getNextPage,\n onError,\n onLoaded,\n onItemPress,\n } = props;\n\n const [isLoaded, setIsLoaded] = useState(false);\n\n const styles = useStyles();\n\n const errorCount = useRef<number>(R.defaultTo(0)(itemState?.error?.count));\n\n const onLoad = useCallback(() => {\n errorCount.current = 0;\n\n setIsLoaded(true);\n\n onLoaded && onLoaded(sortKey);\n }, [sortKey, onLoaded]);\n\n const handleError = useCallback(() => {\n errorCount.current = errorCount.current + 1;\n\n const now = new Date();\n const utcNow = now.getTime() + (now.getTimezoneOffset() * 60 * 1000);\n const expired = new Date(expiresAt).getTime() <= utcNow;\n\n onError && onError({\n sortKey,\n count: errorCount.current,\n expired,\n });\n }, [errorCount.current, onError]);\n\n const onReloadPress = useCallback(() => {\n errorCount.current = 1;\n\n onError && onError({\n sortKey,\n count: errorCount.current,\n expired: false,\n });\n }, [sortKey, onError]);\n\n const viewStyle = {\n width: '100%',\n height,\n ...Platform.select({\n web: { 'cursor': 'default' },\n }),\n };\n\n const imageStyle = { width, height };\n\n const Placeholder = useCallback((props: PlaceholderProps) => {\n const { children, failed } = props;\n\n if (!(isViewable || isLoaded || failed)\n || (itemState?.state === STATE.FAIL)\n || itemState?.state === STATE.INIT\n ) {\n return <ImageBackground\n source={{ uri: 'https://ssl.pstatic.net/static/m/comic/im/2012/bg_viewbody.jpg' }}\n resizeMode=\"repeat\"\n style={viewStyle}\n />;\n }\n\n if (errorCount.current >= errorRetryCount) {\n return <ImageBackground\n source={{ uri: 'https://ssl.pstatic.net/static/m/comic/im/2012/bg_viewbody.jpg' }}\n resizeMode=\"repeat\"\n style={[\n viewStyle,\n styles.reload,\n ]}\n >\n <Spacer size={20}/>\n\n <IconButton\n children={<Restart fill={'#ffffff'}/>}\n style={{\n width: 48,\n height: 48,\n borderRadius: 24,\n color: '#ffffff',\n backgroundColor: '#767676',\n }}\n onPress={onReloadPress}\n />\n </ImageBackground>;\n }\n\n return <ImageBackground\n source={{ uri: 'https://ssl.pstatic.net/static/m/comic/im/2012/bg_viewbody.jpg' }}\n resizeMode=\"repeat\"\n style={viewStyle}\n >\n {children}\n </ImageBackground>;\n }, [isViewable, isLoaded, errorCount.current, itemState?.state, responseTimestamp]);\n\n useEffect(() => {\n if (itemState?.state === STATE.INIT) {\n getNextPage?.(sortKey);\n }\n }, []);\n\n return (\n <TouchableOpacity\n activeOpacity={1}\n onPress={onItemPress}\n >\n <View\n style={[\n styles.root,\n viewStyle,\n ]}\n >\n <Image\n failDependency={[url, expiresAt, responseTimestamp]}\n disableOutline={true}\n key={sortKey}\n disableLongClick={true}\n disableDrag={true}\n onLoad={onLoad}\n onError={handleError}\n loading={'eager'}\n source={{ uri: url }}\n style={imageStyle}\n square={true}\n Placeholder={Placeholder}\n disablePlaceholder={true}\n />\n </View>\n </TouchableOpacity>\n );\n}\n\nexport default React.memo(ViewerItem, (prevProps, nextProps) => {\n if (prevProps.props.isViewable !== nextProps.props.isViewable) {\n return false;\n }\n\n // NO NEED ?\n if (prevProps.props.url !== nextProps.props.url) {\n return false;\n }\n\n // NO NEED ?\n if (prevProps.props.expiresAt !== nextProps.props.expiresAt) {\n return false;\n }\n\n if (prevProps.props.width !== nextProps.props.width) {\n return false;\n }\n\n if (prevProps.props.itemState?.state !== nextProps.props.itemState?.state) {\n return false;\n }\n\n if (prevProps.props.itemState?.state !== STATE.LOADED && prevProps.props.responseTimestamp !== nextProps.props.responseTimestamp) {\n return false;\n }\n\n return true;\n});"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAEA;;AAEA;;;;;;AAIA,MAAMA,SAAuC,GAAG,YAA+B;EAC3E,OAAO;IACHC,IAAI,EAAE;MACFC,OAAO,EAAE,MADP;MAEFC,aAAa,EAAE,KAFb;MAGFC,cAAc,EAAE;IAHd,CADH;IAMHC,MAAM,EAAE;MACJH,OAAO,EAAE,MADL;MAEJI,UAAU,EAAE;IAFR;EANL,CAAP;AAWH,CAZD;;AAcA,SAASC,UAAT,OAAsE;EAAA;;EAAA,IAA/C;IAAEC;EAAF,CAA+C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AS,CAACtD,KAAV,CAAgBO,iBAAhB,KAAsCgD,SAAS,CAACvD,KAAV,CAAgBO,iBAA/G,EAAkI;IAC9H,OAAO,KAAP;EACH;;EAED,OAAO,IAAP;AACH,CA5Bc,C"}
|
|
1
|
+
{"version":3,"names":["ViewerItem","props","height","url","width","onError","onLoad","onPress","onReloadPress","reloadButtonVisible","styles","view","image","error","placeholder","uri","EncodedTile","css","alignSelf"],"sources":["ViewerItem.tsx"],"sourcesContent":["import React from 'react';\nimport { Image, TouchableWithoutFeedback, View } from 'react-native';\nimport { css, Image as FuiImage, ImageProps } from '@fountain-ui/core';\nimport ReloadButton from './ReloadButton';\nimport EncodedTile from './EncodedTile';\n\nexport interface ViewerItemProps {\n /**\n * Image width.\n */\n width: number;\n\n /**\n * Image height.\n */\n height: number;\n\n /**\n * Image sourceUrl for displaying.\n */\n url?: string;\n\n /**\n * Error handler.\n */\n onError?: ImageProps['onError'];\n\n /**\n * Load handler.\n */\n onLoad?: ImageProps['onLoad'];\n\n /**\n * Handle Reload button press event.\n */\n onReloadPress?: ImageProps['onError'];\n\n /**\n * Handle item press event.\n */\n onPress?: () => void;\n\n /**\n * If true, reload button visible.\n * @default false\n */\n reloadButtonVisible?: boolean;\n}\n\nexport default function ViewerItem(props: ViewerItemProps) {\n const {\n height,\n url,\n width,\n onError,\n onLoad,\n onPress,\n onReloadPress,\n reloadButtonVisible = false,\n } = props;\n\n const styles = {\n view: {\n height,\n width: '100%',\n },\n image: {\n height,\n width,\n },\n };\n\n const error = reloadButtonVisible ? <ReloadButton onPress={onReloadPress}/> : null;\n\n const placeholder = <Image\n source={{ uri: EncodedTile }}\n resizeMode={'cover'}\n style={styles.image}\n />;\n\n return (\n <TouchableWithoutFeedback onPress={onPress}>\n <View style={styles.view}>\n <FuiImage\n disableDrag={true}\n disableLongClick={true}\n disableOutline={true}\n error={error}\n onError={onError}\n onLoad={onLoad}\n loading={'eager'}\n placeholder={placeholder}\n source={{ uri: url }}\n square={true}\n style={css([\n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,CADJ;AAsBH;;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './ComicViewer';\nexport type {
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './ComicViewer';\nexport type { Dimension, default as ComicViewerProps } from './ComicViewerProps';\nexport type { ViewerItemProps } from './ViewerItem';\n"],"mappings":";;;;;;;;;;;;AAAA"}
|