@agimon-ai/po-native-components 0.0.0-alpha.203 → 0.0.0-alpha.205
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/components/FileList.d.mts +3 -1
- package/dist/components/FileList.d.mts.map +1 -1
- package/dist/components/FileList.mjs +27 -17
- package/dist/components/FileList.mjs.map +1 -1
- package/dist/components/FileViewer.d.mts.map +1 -1
- package/dist/components/FileViewer.mjs +30 -20
- package/dist/components/FileViewer.mjs.map +1 -1
- package/dist/po-runtime-identity.json +1 -1
- package/package.json +6 -6
|
@@ -33,6 +33,8 @@ export interface FileListProps {
|
|
|
33
33
|
onOpen: (path: string) => void;
|
|
34
34
|
loading?: boolean;
|
|
35
35
|
error?: string;
|
|
36
|
+
/** Offered beside a failed read as Try again. */
|
|
37
|
+
onRetry?: () => void;
|
|
36
38
|
/** Names the list for search and layout, such as "artifacts" or "Personal". */
|
|
37
39
|
label: string;
|
|
38
40
|
/** Guidance under the empty card's title: why the list is empty and what fills it. */
|
|
@@ -41,6 +43,6 @@ export interface FileListProps {
|
|
|
41
43
|
browser?: FileBrowserControls;
|
|
42
44
|
}
|
|
43
45
|
/** A folder of files on the phone: recent rows, or a browser with layouts, filters and a swipeable selection. Presentation only. */
|
|
44
|
-
export declare function FileList({ items, onOpen, loading, error, grid, browser, label, emptyText }: FileListProps): import("react").JSX.Element;
|
|
46
|
+
export declare function FileList({ items, onOpen, loading, error, onRetry, grid, browser, label, emptyText }: FileListProps): import("react").JSX.Element;
|
|
45
47
|
//#endregion
|
|
46
48
|
//# sourceMappingURL=FileList.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileList.d.mts","names":[],"sources":["../../src/components/FileList.tsx"],"mappings":";;;iBA4CiB;EACf,QAAQ;EACR,iBAAiB,QAAQ;EACzB;EACA,gBAAgB;EAChB,MAAM;EACN,eAAe,MAAM;EACrB,UAAU;EACV,mBAAmB,UAAU;EAC7B,MAAM;EACN,eAAe,MAAM;EACrB,WAAW;EACX,oBAAoB,WAAW;EAC/B,eAAe;EACf,oBAAoB;EACpB,WAAW;EACX,WAAW,MAAM;EACjB;EACA;EACA,0BAA0B;;EAE1B,eAAe,MAAM,UAAU,qBAAqB;;EAEpD,SAAS;;EAET;;iBAGe;EACf,gBAAgB;EAChB,SAAS;EACT;EACA;;EAEA;;EAEA;EACA;EACA,UAAU;;;wBAII,
|
|
1
|
+
{"version":3,"file":"FileList.d.mts","names":[],"sources":["../../src/components/FileList.tsx"],"mappings":";;;iBA4CiB;EACf,QAAQ;EACR,iBAAiB,QAAQ;EACzB;EACA,gBAAgB;EAChB,MAAM;EACN,eAAe,MAAM;EACrB,UAAU;EACV,mBAAmB,UAAU;EAC7B,MAAM;EACN,eAAe,MAAM;EACrB,WAAW;EACX,oBAAoB,WAAW;EAC/B,eAAe;EACf,oBAAoB;EACpB,WAAW;EACX,WAAW,MAAM;EACjB;EACA;EACA,0BAA0B;;EAE1B,eAAe,MAAM,UAAU,qBAAqB;;EAEpD,SAAS;;EAET;;iBAGe;EACf,gBAAgB;EAChB,SAAS;EACT;EACA;;EAEA;;EAEA;;EAEA;EACA;EACA,UAAU;;;wBAII,WACd,OACA,QACA,SACA,OACA,SACA,MACA,SACA,OACA,aACC,gCAAa,IAAA"}
|
|
@@ -20,7 +20,7 @@ import { FlatList } from "react-native-unistyles/components/native/FlatList";
|
|
|
20
20
|
|
|
21
21
|
//#region src/components/FileList.tsx
|
|
22
22
|
/** A folder of files on the phone: recent rows, or a browser with layouts, filters and a swipeable selection. Presentation only. */
|
|
23
|
-
function FileList({ items, onOpen, loading, error, grid = false, browser, label, emptyText }) {
|
|
23
|
+
function FileList({ items, onOpen, loading, error, onRetry, grid = false, browser, label, emptyText }) {
|
|
24
24
|
const t = useT();
|
|
25
25
|
if (browser) return /* @__PURE__ */ jsx(FileBrowserList, {
|
|
26
26
|
label,
|
|
@@ -29,16 +29,17 @@ function FileList({ items, onOpen, loading, error, grid = false, browser, label,
|
|
|
29
29
|
onOpen,
|
|
30
30
|
loading,
|
|
31
31
|
error,
|
|
32
|
+
onRetry,
|
|
32
33
|
browser
|
|
33
34
|
});
|
|
34
35
|
return /* @__PURE__ */ jsxs(View, {
|
|
35
36
|
testID: grid ? "file-list-grid" : "file-list-recent",
|
|
36
37
|
style: styles.list,
|
|
37
38
|
children: [
|
|
38
|
-
error ? /* @__PURE__ */ jsx(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
error ? /* @__PURE__ */ jsx(ListFailure, {
|
|
40
|
+
error,
|
|
41
|
+
retained: items.length > 0,
|
|
42
|
+
onRetry
|
|
42
43
|
}) : null,
|
|
43
44
|
loading ? /* @__PURE__ */ jsx(Text, {
|
|
44
45
|
style: styles.meta,
|
|
@@ -144,7 +145,22 @@ const IMAGE_VIEWABILITY = { itemVisiblePercentThreshold: 1 };
|
|
|
144
145
|
/** Past this the dots stop reading as positions; the counter beside the name still does. */
|
|
145
146
|
const MAX_DOTS = 7;
|
|
146
147
|
const PREVIEW_HEIGHT = 320;
|
|
147
|
-
|
|
148
|
+
/** A failed read: kept files stay listed under it, as the approved RetainedContent target shows. */
|
|
149
|
+
function ListFailure({ error, retained, onRetry }) {
|
|
150
|
+
const t = useT();
|
|
151
|
+
return /* @__PURE__ */ jsx(EmptyState, {
|
|
152
|
+
size: "compact",
|
|
153
|
+
surface: "plain",
|
|
154
|
+
tone: "error",
|
|
155
|
+
title: retained ? t("nativeComponents.fileList.refreshFailed", "Couldn't refresh the file list") : t("nativeComponents.fileList.loadFailed", "Couldn't load the file list"),
|
|
156
|
+
description: retained ? t("nativeComponents.fileList.lastSeen", "These are the files Po saw last.") : error,
|
|
157
|
+
action: onRetry ? {
|
|
158
|
+
label: t("nativeComponents.fileList.retry", "Try again"),
|
|
159
|
+
onAction: onRetry
|
|
160
|
+
} : void 0
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function FileBrowserList({ items, onOpen, loading, error, onRetry, browser: b, label, emptyText }) {
|
|
148
164
|
const t = useT();
|
|
149
165
|
const LAYOUTS = layoutOptions(t);
|
|
150
166
|
const MODIFIED = modifiedOptions(t);
|
|
@@ -168,7 +184,7 @@ function FileBrowserList({ items, onOpen, loading, error, browser: b, label, emp
|
|
|
168
184
|
testID: "file-list-browser",
|
|
169
185
|
onViewableItemsChanged,
|
|
170
186
|
viewabilityConfig: IMAGE_VIEWABILITY,
|
|
171
|
-
data: loading
|
|
187
|
+
data: loading ? [] : rows,
|
|
172
188
|
numColumns: grid ? 2 : 1,
|
|
173
189
|
columnWrapperStyle: grid ? styles.columns : void 0,
|
|
174
190
|
keyExtractor: (row) => row.kind === "dir" ? `dir:${row.path}` : row.item.path,
|
|
@@ -257,10 +273,10 @@ function FileBrowserList({ items, onOpen, loading, error, browser: b, label, emp
|
|
|
257
273
|
}) : null
|
|
258
274
|
]
|
|
259
275
|
}),
|
|
260
|
-
error ? /* @__PURE__ */ jsx(
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
276
|
+
error ? /* @__PURE__ */ jsx(ListFailure, {
|
|
277
|
+
error,
|
|
278
|
+
retained: items.length > 0,
|
|
279
|
+
onRetry
|
|
264
280
|
}) : null,
|
|
265
281
|
loading ? /* @__PURE__ */ jsx(Text, {
|
|
266
282
|
style: styles.meta,
|
|
@@ -713,12 +729,6 @@ const styles = StyleSheet.create((theme) => ({
|
|
|
713
729
|
fontSize: theme.fontSize.sm,
|
|
714
730
|
color: theme.colors.dim,
|
|
715
731
|
uni__dependencies: [0]
|
|
716
|
-
},
|
|
717
|
-
error: {
|
|
718
|
-
fontFamily: fontOf(theme.fontFamily.sans),
|
|
719
|
-
fontSize: theme.fontSize.sm,
|
|
720
|
-
color: theme.colors.red,
|
|
721
|
-
uni__dependencies: [0]
|
|
722
732
|
}
|
|
723
733
|
}));
|
|
724
734
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileList.mjs","names":["currentLocale","useT","fileKind","isFileLayout","sizeLabel","FileItem","FileKind","FileLayout","FileModified","FileSort","FileSortDirection","FileTreeRow","ComponentRef","ReactNode","useCallback","useEffect","useRef","useState","ListViewToken","StyleSheet","ChevronDownIcon","ChevronRightIcon","CloseIcon","FileIcon","FolderIcon","ImageIcon","SearchIcon","SlidersIcon","fileKindLabel","fontOf","Button","DropdownMenu","DropdownMenuCheckboxItem","DropdownMenuContent","DropdownMenuLabel","DropdownMenuSeparator","DropdownMenuTrigger","EmptyState","Input","SegmentedControl","Sheet","SheetContent","SheetList","FileBrowserControls","layout","onLayoutChange","query","onQueryChange","type","onTypeChange","modified","onModifiedChange","sort","onSortChange","direction","onDirectionChange","rows","onToggleDirectory","path","selected","onSelect","item","onCloseSelection","totalCount","onViewableImagesChange","paths","renderImage","compact","header","sheet","FileListProps","items","onOpen","loading","error","label","emptyText","grid","browser","FileList","t","styles","list","meta","length","map","name","size","toLocaleString","Translate","ReturnType","layoutOptions","value","TYPES","const","modifiedOptions","sortOptions","ROW_HEIGHT","IMAGE_VIEWABILITY","itemVisiblePercentThreshold","MAX_DOTS","PREVIEW_HEIGHT","FileBrowserList","b","LAYOUTS","MODIFIED","SORTS","onViewableItemsChanged","viewableItems","Omit","flatMap","isViewable","kind","depth","files","row","at","findIndex","file","List","FlatList","embedded","columns","undefined","head","toolbar","search","searchInput","chips","find","option","onAction","inset","indent","open","expanded","count","image","tile","chevronGutter","thumbnail","rowThumbnail","foot","shown","total","selection","titleRow","index","Math","max","actions","SelectionSlides","width","setWidth","scroller","ScrollView","placed","current","scrollTo","x","animated","step","by","next","event","nativeEvent","round","contentOffset","preview","page","abs","arrow","previous","flip","dots","dot","dotActive","create","theme","gap","spacing","padding","paddingBottom","uni__dependencies","paddingTop","paddingHorizontal","flexDirection","alignItems","flex","minWidth","borderWidth","borderColor","colors","border","borderRadius","DEFAULT","backgroundColor","deep","flexWrap","marginHorizontal","marginBottom","minHeight","justifyContent","paddingVertical","paddingRight","paddingLeft","maxWidth","height","overflow","sm","flexShrink","panel","position","top","left","right","transform","rotate","faint","green","fontFamily","sans","fontWeight","fontSize","base","color","text","mono","dim","red"],"sources":["../../src/components/FileList.tsx"],"sourcesContent":["import { currentLocale, useT } from '@agimon-ai/po-core/native';\nimport {\n fileKind,\n isFileLayout,\n sizeLabel,\n type FileItem,\n type FileKind,\n type FileLayout,\n type FileModified,\n type FileSort,\n type FileSortDirection,\n type FileTreeRow,\n} from '@agimon-ai/po-web-components/text';\nimport { type ComponentRef, type ReactNode, useCallback, useEffect, useRef, useState } from 'react';\nimport { FlatList, ScrollView, Text, View, type ListViewToken } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport {\n ChevronDownIcon,\n ChevronRightIcon,\n CloseIcon,\n FileIcon,\n FolderIcon,\n ImageIcon,\n SearchIcon,\n SlidersIcon,\n} from '../icons/icons';\nimport { fileKindLabel } from '../lib/fileKindLabel';\nimport { fontOf } from '../lib/fonts';\nimport { Button } from './Button';\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from './DropdownMenu';\nimport { EmptyState } from './EmptyState';\nimport { Input } from './Input';\nimport { SegmentedControl } from './SegmentedControl';\nimport { Sheet, SheetContent } from './Sheet';\nimport { SheetList } from './SheetList';\n\nexport interface FileBrowserControls {\n layout: FileLayout;\n onLayoutChange: (layout: FileLayout) => void;\n query: string;\n onQueryChange: (query: string) => void;\n type: FileKind | 'any';\n onTypeChange: (type: FileKind | 'any') => void;\n modified: FileModified;\n onModifiedChange: (modified: FileModified) => void;\n sort: FileSort;\n onSortChange: (sort: FileSort) => void;\n direction: FileSortDirection;\n onDirectionChange: (direction: FileSortDirection) => void;\n rows: readonly FileTreeRow[];\n onToggleDirectory: (path: string) => void;\n selected?: FileItem;\n onSelect: (item: FileItem) => void;\n onCloseSelection: () => void;\n totalCount: number;\n onViewableImagesChange?: (paths: readonly string[]) => void;\n /** A loaded thumbnail or a placeholder for an image file; `compact` is a list row's small square. */\n renderImage?: (item: FileItem, compact: boolean) => ReactNode;\n /** Drawn first in the list, above the controls, such as the native dock's tab strip. */\n header?: ReactNode;\n /** Inside a bottom sheet with no scroll view of its own: the list is the sheet's only scroll owner. */\n sheet?: boolean;\n}\n\nexport interface FileListProps {\n items: readonly FileItem[];\n onOpen: (path: string) => void;\n loading?: boolean;\n error?: string;\n /** Names the list for search and layout, such as \"artifacts\" or \"Personal\". */\n label: string;\n /** Guidance under the empty card's title: why the list is empty and what fills it. */\n emptyText: string;\n grid?: boolean;\n browser?: FileBrowserControls;\n}\n\n/** A folder of files on the phone: recent rows, or a browser with layouts, filters and a swipeable selection. Presentation only. */\nexport function FileList({ items, onOpen, loading, error, grid = false, browser, label, emptyText }: FileListProps) {\n const t = useT();\n if (browser)\n return (\n <FileBrowserList\n label={label}\n emptyText={emptyText}\n items={items}\n onOpen={onOpen}\n loading={loading}\n error={error}\n browser={browser}\n />\n );\n return (\n <View testID={grid ? 'file-list-grid' : 'file-list-recent'} style={styles.list}>\n {error ? (\n <Text accessibilityRole=\"alert\" style={styles.error}>\n {error}\n </Text>\n ) : null}\n {loading ? <Text style={styles.meta}>{t('nativeComponents.fileList.loading', 'Loading files...')}</Text> : null}\n {!loading && !error && items.length === 0 ? (\n <EmptyState\n size=\"compact\"\n surface=\"plain\"\n icon={<FolderIcon size={16} />}\n title={t('nativeComponents.fileList.emptyTitle', 'Nothing here yet')}\n description={emptyText}\n />\n ) : null}\n {items.map((item) => (\n <Button\n key={item.path}\n variant={grid ? 'outline' : 'ghost'}\n size=\"card\"\n accessibilityLabel={t('nativeComponents.fileList.open', 'Open {path}', { path: item.path })}\n testID={`file-${item.path}`}\n onPress={() => onOpen(item.path)}\n style={styles.item}\n >\n <FileIcon size={18} color=\"dim\" />\n <View style={styles.label}>\n <Text numberOfLines={1} style={styles.name}>\n {item.name}\n </Text>\n {grid || item.path !== item.name ? (\n <Text numberOfLines={1} style={styles.path}>\n {item.path}\n </Text>\n ) : null}\n {grid ? (\n <Text style={styles.meta}>\n {t('nativeComponents.fileList.bytes', '{size} bytes', {\n size: item.size.toLocaleString(currentLocale()),\n })}\n </Text>\n ) : null}\n </View>\n </Button>\n ))}\n </View>\n );\n}\n\ntype Translate = ReturnType<typeof useT>;\nconst layoutOptions = (t: Translate) => [\n { value: 'tree', label: t('nativeComponents.fileList.layout.tree', 'Tree') },\n { value: 'list', label: t('nativeComponents.fileList.layout.list', 'List') },\n { value: 'grid', label: t('nativeComponents.fileList.layout.grid', 'Grid') },\n];\nconst TYPES = ['any', 'Markdown', 'Image', 'Code', 'Data', 'Document', 'Other'] as const;\nconst modifiedOptions = (t: Translate) =>\n [\n { value: 'any', label: t('nativeComponents.fileList.modified.any', 'Any time') },\n { value: 'today', label: t('nativeComponents.fileList.modified.today', 'Today') },\n { value: '7days', label: t('nativeComponents.fileList.modified.7days', 'Last 7 days') },\n { value: '30days', label: t('nativeComponents.fileList.modified.30days', 'Last 30 days') },\n ] as const;\nconst sortOptions = (t: Translate) =>\n [\n { value: 'name', label: t('nativeComponents.fileList.sort.name', 'Name') },\n { value: 'modified', label: t('nativeComponents.fileList.sort.modified', 'Modified') },\n { value: 'size', label: t('nativeComponents.fileList.sort.size', 'Size') },\n ] as const;\nconst ROW_HEIGHT = 48;\nconst IMAGE_VIEWABILITY = { itemVisiblePercentThreshold: 1 };\n/** Past this the dots stop reading as positions; the counter beside the name still does. */\nconst MAX_DOTS = 7;\nconst PREVIEW_HEIGHT = 320;\n\nfunction FileBrowserList({\n items,\n onOpen,\n loading,\n error,\n browser: b,\n label,\n emptyText,\n}: FileListProps & { browser: FileBrowserControls }) {\n const t = useT();\n const LAYOUTS = layoutOptions(t);\n const MODIFIED = modifiedOptions(t);\n const SORTS = sortOptions(t);\n const grid = b.layout === 'grid';\n const onViewableImagesChange = b.onViewableImagesChange;\n const onViewableItemsChanged = useCallback(\n ({ viewableItems }: { viewableItems: (Omit<ListViewToken, 'item'> & { item: FileTreeRow })[] }) => {\n onViewableImagesChange?.(\n viewableItems.flatMap(({ item, isViewable }) =>\n isViewable && item.kind === 'file' && fileKind(item.item.path) === 'Image' ? [item.item.path] : [],\n ),\n );\n },\n [onViewableImagesChange],\n );\n const rows: readonly FileTreeRow[] =\n b.layout === 'tree' ? b.rows : items.map((item) => ({ kind: 'file', item, depth: 0 }));\n // Prev and next step through the files the person can see, in the order they see them.\n const files = rows.flatMap((row) => (row.kind === 'file' ? [row.item] : []));\n const at = b.selected ? files.findIndex((file) => file.path === b.selected?.path) : -1;\n const List = b.sheet ? SheetList<FileTreeRow> : FlatList<FileTreeRow>;\n const list = (\n <List\n {...(b.sheet ? { embedded: true } : {})}\n key={b.layout}\n testID=\"file-list-browser\"\n onViewableItemsChanged={onViewableItemsChanged}\n viewabilityConfig={IMAGE_VIEWABILITY}\n data={loading || error ? [] : rows}\n numColumns={grid ? 2 : 1}\n columnWrapperStyle={grid ? styles.columns : undefined}\n keyExtractor={(row) => (row.kind === 'dir' ? `dir:${row.path}` : row.item.path)}\n keyboardShouldPersistTaps=\"handled\"\n ListHeaderComponent={\n <>\n {b.header}\n <View style={styles.head}>\n <SegmentedControl\n accessibilityLabel={t('nativeComponents.fileList.layoutLabel', '{label} layout', { label })}\n options={LAYOUTS}\n value={b.layout}\n onValueChange={(value) => {\n if (isFileLayout(value)) b.onLayoutChange(value);\n }}\n />\n <View style={styles.toolbar}>\n <View style={styles.search}>\n <SearchIcon size={18} />\n <Input\n variant=\"bare\"\n accessibilityLabel={t('nativeComponents.fileList.search', 'Search {label}', { label })}\n placeholder={t('nativeComponents.fileList.search', 'Search {label}', { label })}\n value={b.query}\n onChangeText={b.onQueryChange}\n style={styles.searchInput}\n autoCapitalize=\"none\"\n />\n </View>\n <DropdownMenu>\n <DropdownMenuTrigger\n variant=\"outline\"\n accessibilityLabel={t('nativeComponents.fileList.filters', 'Filters')}\n >\n <SlidersIcon />\n {t('nativeComponents.fileList.filters', 'Filters')}\n </DropdownMenuTrigger>\n <DropdownMenuContent>\n <DropdownMenuLabel>{t('nativeComponents.fileList.typeHeading', 'Type')}</DropdownMenuLabel>\n {TYPES.map((type) => (\n <DropdownMenuCheckboxItem\n key={type}\n checked={b.type === type}\n onCheckedChange={() => b.onTypeChange(type)}\n >\n {type === 'any' ? t('nativeComponents.fileList.allTypes', 'All types') : fileKindLabel(type, t)}\n </DropdownMenuCheckboxItem>\n ))}\n <DropdownMenuSeparator />\n <DropdownMenuLabel>{t('nativeComponents.fileList.sort.modified', 'Modified')}</DropdownMenuLabel>\n {MODIFIED.map(({ value, label }) => (\n <DropdownMenuCheckboxItem\n key={value}\n checked={b.modified === value}\n onCheckedChange={() => b.onModifiedChange(value)}\n >\n {label}\n </DropdownMenuCheckboxItem>\n ))}\n <DropdownMenuSeparator />\n <DropdownMenuLabel>{t('nativeComponents.fileList.sortHeading', 'Sort')}</DropdownMenuLabel>\n {SORTS.map(({ value, label }) => (\n <DropdownMenuCheckboxItem\n key={value}\n checked={b.sort === value}\n onCheckedChange={() => b.onSortChange(value)}\n >\n {label}\n </DropdownMenuCheckboxItem>\n ))}\n <DropdownMenuCheckboxItem\n checked={b.direction === 'asc'}\n onCheckedChange={() => b.onDirectionChange('asc')}\n >\n {t('nativeComponents.fileList.ascending', 'Ascending')}\n </DropdownMenuCheckboxItem>\n <DropdownMenuCheckboxItem\n checked={b.direction === 'desc'}\n onCheckedChange={() => b.onDirectionChange('desc')}\n >\n {t('nativeComponents.fileList.descending', 'Descending')}\n </DropdownMenuCheckboxItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </View>\n <View style={styles.chips}>\n {b.query ? (\n <Button\n variant=\"outline\"\n accessibilityLabel={t('nativeComponents.fileList.removeSearch', 'Remove search filter')}\n onPress={() => b.onQueryChange('')}\n >\n {t('nativeComponents.fileList.searchChip', 'Search: {query}', { query: b.query })}\n <CloseIcon />\n </Button>\n ) : null}\n {b.type !== 'any' ? (\n <Button\n variant=\"outline\"\n accessibilityLabel={t('nativeComponents.fileList.removeType', 'Remove type filter')}\n onPress={() => b.onTypeChange('any')}\n >\n {fileKindLabel(b.type, t)}\n <CloseIcon />\n </Button>\n ) : null}\n {b.modified !== 'any' ? (\n <Button\n variant=\"outline\"\n accessibilityLabel={t('nativeComponents.fileList.removeModified', 'Remove modified filter')}\n onPress={() => b.onModifiedChange('any')}\n >\n {MODIFIED.find((option) => option.value === b.modified)?.label}\n <CloseIcon />\n </Button>\n ) : null}\n </View>\n {error ? (\n <Text accessibilityRole=\"alert\" style={styles.error}>\n {error}\n </Text>\n ) : null}\n {loading ? (\n <Text style={styles.meta}>{t('nativeComponents.fileList.loading', 'Loading files...')}</Text>\n ) : null}\n </View>\n </>\n }\n ListEmptyComponent={\n loading || error ? undefined : b.totalCount ? (\n <EmptyState\n size=\"compact\"\n surface=\"plain\"\n icon={<SearchIcon size={16} />}\n title={t('nativeComponents.fileList.noMatch', 'No files match')}\n secondaryAction={{\n label: t('nativeComponents.fileList.clearFilters', 'Clear filters'),\n onAction: () => {\n b.onQueryChange('');\n b.onTypeChange('any');\n b.onModifiedChange('any');\n },\n }}\n style={styles.inset}\n />\n ) : (\n <EmptyState\n size=\"compact\"\n surface=\"plain\"\n icon={<FolderIcon size={16} />}\n title={t('nativeComponents.fileList.emptyTitle', 'Nothing here yet')}\n description={emptyText}\n style={styles.inset}\n />\n )\n }\n renderItem={({ item: row }) => {\n if (row.kind === 'dir')\n return (\n <Button\n variant=\"ghost\"\n style={[styles.row, styles.indent(row.depth)]}\n accessibilityLabel={\n row.open\n ? t('nativeComponents.fileList.collapse', 'Collapse {path}', { path: row.path })\n : t('nativeComponents.fileList.expand', 'Expand {path}', { path: row.path })\n }\n accessibilityState={{ expanded: row.open }}\n onPress={() => b.onToggleDirectory(row.path)}\n >\n {row.open ? <ChevronDownIcon /> : <ChevronRightIcon />}\n <FolderIcon />\n <Text numberOfLines={1} style={[styles.name, styles.label]}>\n {row.name}\n </Text>\n <Text style={styles.meta}>{row.count}</Text>\n </Button>\n );\n const item = row.item;\n const image = fileKind(item.path) === 'Image';\n const selected = b.selected?.path === item.path;\n return (\n <Button\n variant=\"ghost\"\n size=\"card\"\n testID={`file-${item.path}`}\n accessibilityLabel={t('nativeComponents.fileList.select', 'Select {path}', { path: item.path })}\n accessibilityState={{ selected }}\n onPress={() => b.onSelect(item)}\n style={[grid ? styles.tile : styles.row, selected && styles.selected, !grid && styles.indent(row.depth)]}\n >\n {b.layout === 'tree' ? <View accessible={false} style={styles.chevronGutter} /> : null}\n {grid ? (\n <View style={styles.thumbnail}>\n {image && b.renderImage ? (\n b.renderImage(item, false)\n ) : image ? (\n <ImageIcon size={28} />\n ) : (\n <FileIcon size={28} />\n )}\n </View>\n ) : (\n // Every file row keeps the same slot, so names line up whether or not a picture loaded.\n <View style={styles.rowThumbnail}>\n {image && b.renderImage ? (\n b.renderImage(item, true)\n ) : image ? (\n <ImageIcon size={18} />\n ) : (\n <FileIcon size={18} />\n )}\n </View>\n )}\n <View style={styles.label}>\n <Text numberOfLines={1} style={styles.name}>\n {item.name}\n </Text>\n <Text numberOfLines={1} style={styles.path}>\n {item.path}\n </Text>\n </View>\n <Text style={styles.meta}>{sizeLabel(item.size)}</Text>\n </Button>\n );\n }}\n ListFooterComponent={\n <View style={styles.foot}>\n <Text style={styles.meta}>\n {t('nativeComponents.fileList.count', '{shown} of {total} files', {\n shown: items.length,\n total: b.totalCount,\n })}\n </Text>\n </View>\n }\n />\n );\n return (\n <>\n {list}\n <Sheet\n open={b.selected !== undefined}\n onOpenChange={(open) => {\n if (!open) b.onCloseSelection();\n }}\n >\n <SheetContent>\n {b.selected ? (\n <View style={styles.foot}>\n <View style={styles.selection} testID=\"file-selection\">\n <View style={styles.titleRow}>\n <Text accessibilityRole=\"header\" numberOfLines={1} style={[styles.name, styles.label]}>\n {b.selected.name}\n </Text>\n {files.length > 1 ? (\n <Text accessibilityLiveRegion=\"polite\" style={styles.meta}>\n {t('nativeComponents.fileList.position', '{index} of {total}', {\n index: Math.max(0, at) + 1,\n total: files.length,\n })}\n </Text>\n ) : null}\n </View>\n <SelectionSlides\n files={at < 0 ? [b.selected] : files}\n selected={b.selected}\n onSelect={b.onSelect}\n renderImage={b.renderImage}\n />\n <Text numberOfLines={2} style={styles.path}>\n {b.selected.path}\n </Text>\n <Text style={styles.meta}>\n {fileKindLabel(fileKind(b.selected.path), t)} · {sizeLabel(b.selected.size)}\n </Text>\n <View style={styles.actions}>\n <Button variant=\"outline\" onPress={b.onCloseSelection}>\n {t('nativeComponents.fileList.close', 'Close')}\n </Button>\n <Button\n variant=\"primary\"\n onPress={() => {\n if (b.selected) {\n b.onCloseSelection();\n onOpen(b.selected.path);\n }\n }}\n >\n {t('nativeComponents.fileList.openAction', 'Open')}\n </Button>\n </View>\n </View>\n </View>\n ) : null}\n </SheetContent>\n </Sheet>\n </>\n );\n}\n\n/** The selected file large; swiping and the arrows select its neighbours in the list. */\nfunction SelectionSlides({\n files,\n selected,\n onSelect,\n renderImage,\n}: {\n files: readonly FileItem[];\n selected: FileItem;\n onSelect: (item: FileItem) => void;\n renderImage?: FileBrowserControls['renderImage'];\n}) {\n const t = useT();\n const index = Math.max(\n 0,\n files.findIndex((file) => file.path === selected.path),\n );\n // A horizontal scroller does not stretch its pages, so each page takes the measured width.\n const [width, setWidth] = useState(0);\n const scroller = useRef<ComponentRef<typeof ScrollView>>(null);\n const placed = useRef(false);\n useEffect(() => {\n if (width === 0) return;\n // Opening lands on the tapped file; later steps glide.\n scroller.current?.scrollTo({ x: index * width, animated: placed.current });\n placed.current = true;\n }, [index, width]);\n const step = (by: number) => {\n const next = files[index + by];\n if (next) onSelect(next);\n };\n return (\n <View>\n <ScrollView\n ref={scroller}\n horizontal\n pagingEnabled\n showsHorizontalScrollIndicator={false}\n onLayout={(event) => setWidth(event.nativeEvent.layout.width)}\n onMomentumScrollEnd={(event) => {\n if (width > 0) step(Math.round(event.nativeEvent.contentOffset.x / width) - index);\n }}\n style={styles.preview}\n >\n {files.map((file, page) => (\n <View\n key={file.path}\n accessibilityElementsHidden={page !== index}\n importantForAccessibility={page === index ? 'auto' : 'no-hide-descendants'}\n style={[styles.page, { width }]}\n >\n {/* ponytail: only the open page and its neighbours mount; a long list never reads every picture. */}\n {Math.abs(page - index) > 1 ? null : fileKind(file.path) !== 'Image' ? (\n <FileIcon size={28} />\n ) : renderImage ? (\n renderImage(file, false)\n ) : (\n <ImageIcon size={28} />\n )}\n </View>\n ))}\n </ScrollView>\n {files.length > 1 ? (\n <>\n <Button\n variant=\"ghost\"\n size=\"icon-md\"\n accessibilityLabel={t('nativeComponents.fileList.previous', 'Previous file')}\n disabled={index === 0}\n onPress={() => step(-1)}\n style={[styles.arrow, styles.previous]}\n >\n <View style={styles.flip}>\n <ChevronRightIcon size={18} color=\"hi\" />\n </View>\n </Button>\n <Button\n variant=\"ghost\"\n size=\"icon-md\"\n accessibilityLabel={t('nativeComponents.fileList.next', 'Next file')}\n disabled={index === files.length - 1}\n onPress={() => step(1)}\n style={[styles.arrow, styles.next]}\n >\n <ChevronRightIcon size={18} color=\"hi\" />\n </Button>\n </>\n ) : null}\n {files.length > 1 && files.length <= MAX_DOTS ? (\n <View accessible={false} style={styles.dots}>\n {files.map((file, page) => (\n <View key={file.path} style={[styles.dot, page === index && styles.dotActive]} />\n ))}\n </View>\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n head: { gap: theme.spacing(3), padding: theme.spacing(4), paddingBottom: theme.spacing(3) },\n foot: { gap: theme.spacing(3), padding: theme.spacing(4), paddingTop: theme.spacing(3) },\n inset: { paddingHorizontal: theme.spacing(4) },\n toolbar: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2) },\n search: {\n flex: 1,\n minWidth: 0,\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(2),\n paddingHorizontal: theme.spacing(2),\n borderWidth: 1,\n borderColor: theme.colors.border,\n borderRadius: theme.borderRadius.DEFAULT,\n backgroundColor: theme.colors.deep,\n },\n searchInput: { flex: 1 },\n chips: { flexDirection: 'row', flexWrap: 'wrap', gap: theme.spacing(2) },\n row: {\n marginHorizontal: theme.spacing(4),\n marginBottom: theme.spacing(2),\n // A file row holds two lines; a fixed height pressed them against the border.\n minHeight: ROW_HEIGHT,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'flex-start',\n gap: theme.spacing(2),\n borderWidth: 1,\n borderColor: theme.colors['border-soft'],\n borderRadius: theme.borderRadius.DEFAULT,\n paddingVertical: theme.spacing(2),\n paddingRight: theme.spacing(3),\n },\n // Tree depth adds to the row's own inset; replacing it put the icon against the border.\n indent: (depth: number) => ({ paddingLeft: theme.spacing(3) + depth * 16 }),\n chevronGutter: { width: 16 },\n columns: { gap: theme.spacing(2), paddingHorizontal: theme.spacing(4) },\n tile: {\n flex: 1,\n maxWidth: '50%',\n flexDirection: 'column',\n alignItems: 'stretch',\n gap: theme.spacing(2),\n borderWidth: 1,\n borderColor: theme.colors['border-soft'],\n marginBottom: theme.spacing(2),\n },\n thumbnail: {\n height: 96,\n backgroundColor: theme.colors.deep,\n borderRadius: theme.borderRadius.DEFAULT,\n overflow: 'hidden',\n alignItems: 'center',\n justifyContent: 'center',\n },\n rowThumbnail: {\n width: 40,\n height: 40,\n borderRadius: theme.borderRadius.sm,\n overflow: 'hidden',\n alignItems: 'center',\n justifyContent: 'center',\n },\n selected: { backgroundColor: theme.colors['tint-green'], borderColor: theme.colors['edge-green'] },\n selection: {\n flexShrink: 0,\n padding: theme.spacing(3),\n gap: theme.spacing(2),\n borderWidth: 1,\n borderColor: theme.colors.border,\n borderRadius: theme.borderRadius.DEFAULT,\n backgroundColor: theme.colors.panel,\n },\n actions: { flexDirection: 'row', justifyContent: 'flex-end', gap: theme.spacing(2) },\n titleRow: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2) },\n preview: {\n height: PREVIEW_HEIGHT,\n backgroundColor: theme.colors.deep,\n borderRadius: theme.borderRadius.DEFAULT,\n },\n page: { height: PREVIEW_HEIGHT, alignItems: 'center', justifyContent: 'center' },\n arrow: {\n position: 'absolute',\n top: PREVIEW_HEIGHT / 2 - 22,\n width: 44,\n height: 44,\n borderRadius: 22,\n backgroundColor: theme.colors.panel,\n },\n previous: { left: theme.spacing(2) },\n next: { right: theme.spacing(2) },\n flip: { transform: [{ rotate: '180deg' }] },\n dots: { flexDirection: 'row', justifyContent: 'center', gap: theme.spacing(2), paddingTop: theme.spacing(2) },\n dot: { width: 6, height: 6, borderRadius: 3, backgroundColor: theme.colors.faint },\n dotActive: { backgroundColor: theme.colors.green },\n list: { gap: theme.spacing(2) },\n // The card size stacks its children; a recent row reads like the browser's list row instead.\n item: {\n minHeight: 44,\n flexDirection: 'row',\n justifyContent: 'flex-start',\n alignItems: 'center',\n gap: theme.spacing(3),\n },\n label: { flex: 1, gap: theme.spacing(1), minWidth: 0 },\n name: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontWeight: '600',\n fontSize: theme.fontSize.base,\n color: theme.colors.text,\n },\n path: { fontFamily: fontOf(theme.fontFamily.mono), fontSize: theme.fontSize.sm, color: theme.colors.dim },\n meta: { fontFamily: fontOf(theme.fontFamily.sans), fontSize: theme.fontSize.sm, color: theme.colors.dim },\n error: { fontFamily: fontOf(theme.fontFamily.sans), fontSize: theme.fontSize.sm, color: theme.colors.red },\n}));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsFA,SAAgB+E,SAAS,EAAER,OAAOC,QAAQC,SAASC,OAAOG,OAAO,OAAOC,SAASH,OAAOC,aAA4B;CAClH,MAAMI,IAAI/E,KAAK;CACf,IAAI6E,SACF,OACE,oBAAC,iBAAD;EACSH;EACIC;EACJL;EACCC;EACCC;EACFC;EACEI;CAAQ;CAGvB,OACE,qBAAC,MAAD;EAAM,QAAQD,OAAO,mBAAmB;EAAoB,OAAOI,OAAOC;YAA1E;GACGR,QACC,oBAAC,MAAD;IAAM,mBAAkB;IAAQ,OAAOO,OAAOP;cAC3CA;GACG,KACJ;GACHD,UAAU,oBAAC,MAAD;I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C;CACrDjG,MAAM;EACJsI,YAAY/L,OAAOqJ,MAAM0C,WAAWC,IAAI;EACxCC,YAAY;EACZC,UAAU7C,MAAM6C,SAASC;EACzBC,OAAO/C,MAAMc,OAAOkC;EAAI3C,mBAAA,CAAA,CAAA;CAC1B;CACA7H,MAAM;EAAEkK,YAAY/L,OAAOqJ,MAAM0C,WAAWO,IAAI;EAAGJ,UAAU7C,MAAM6C,SAASd;EAAIgB,OAAO/C,MAAMc,OAAOoC;EAAG7C,mBAAA,CAAA,CAAA;CAAC;CACxGpG,MAAM;EAAEyI,YAAY/L,OAAOqJ,MAAM0C,WAAWC,IAAI;EAAGE,UAAU7C,MAAM6C,SAASd;EAAIgB,OAAO/C,MAAMc,OAAOoC;EAAG7C,mBAAA,CAAA,CAAA;CAAC;CACxG7G,OAAO;EAAEkJ,YAAY/L,OAAOqJ,MAAM0C,WAAWC,IAAI;EAAGE,UAAU7C,MAAM6C,SAASd;EAAIgB,OAAO/C,MAAMc,OAAOqC;EAAG9C,mBAAA,CAAA,CAAA;CAAC;AAC3G,EAAE"}
|
|
1
|
+
{"version":3,"file":"FileList.mjs","names":["currentLocale","useT","fileKind","isFileLayout","sizeLabel","FileItem","FileKind","FileLayout","FileModified","FileSort","FileSortDirection","FileTreeRow","ComponentRef","ReactNode","useCallback","useEffect","useRef","useState","ListViewToken","StyleSheet","ChevronDownIcon","ChevronRightIcon","CloseIcon","FileIcon","FolderIcon","ImageIcon","SearchIcon","SlidersIcon","fileKindLabel","fontOf","Button","DropdownMenu","DropdownMenuCheckboxItem","DropdownMenuContent","DropdownMenuLabel","DropdownMenuSeparator","DropdownMenuTrigger","EmptyState","Input","SegmentedControl","Sheet","SheetContent","SheetList","FileBrowserControls","layout","onLayoutChange","query","onQueryChange","type","onTypeChange","modified","onModifiedChange","sort","onSortChange","direction","onDirectionChange","rows","onToggleDirectory","path","selected","onSelect","item","onCloseSelection","totalCount","onViewableImagesChange","paths","renderImage","compact","header","sheet","FileListProps","items","onOpen","loading","error","onRetry","label","emptyText","grid","browser","FileList","t","styles","list","length","meta","map","name","size","toLocaleString","Translate","ReturnType","layoutOptions","value","TYPES","const","modifiedOptions","sortOptions","ROW_HEIGHT","IMAGE_VIEWABILITY","itemVisiblePercentThreshold","MAX_DOTS","PREVIEW_HEIGHT","ListFailure","retained","onAction","undefined","FileBrowserList","b","LAYOUTS","MODIFIED","SORTS","onViewableItemsChanged","viewableItems","Omit","flatMap","isViewable","kind","depth","files","row","at","findIndex","file","List","FlatList","embedded","columns","head","toolbar","search","searchInput","chips","find","option","inset","indent","open","expanded","count","image","tile","chevronGutter","thumbnail","rowThumbnail","foot","shown","total","selection","titleRow","index","Math","max","actions","SelectionSlides","width","setWidth","scroller","ScrollView","placed","current","scrollTo","x","animated","step","by","next","event","nativeEvent","round","contentOffset","preview","page","abs","arrow","previous","flip","dots","dot","dotActive","create","theme","gap","spacing","padding","paddingBottom","uni__dependencies","paddingTop","paddingHorizontal","flexDirection","alignItems","flex","minWidth","borderWidth","borderColor","colors","border","borderRadius","DEFAULT","backgroundColor","deep","flexWrap","marginHorizontal","marginBottom","minHeight","justifyContent","paddingVertical","paddingRight","paddingLeft","maxWidth","height","overflow","sm","flexShrink","panel","position","top","left","right","transform","rotate","faint","green","fontFamily","sans","fontWeight","fontSize","base","color","text","mono","dim"],"sources":["../../src/components/FileList.tsx"],"sourcesContent":["import { currentLocale, useT } from '@agimon-ai/po-core/native';\nimport {\n fileKind,\n isFileLayout,\n sizeLabel,\n type FileItem,\n type FileKind,\n type FileLayout,\n type FileModified,\n type FileSort,\n type FileSortDirection,\n type FileTreeRow,\n} from '@agimon-ai/po-web-components/text';\nimport { type ComponentRef, type ReactNode, useCallback, useEffect, useRef, useState } from 'react';\nimport { FlatList, ScrollView, Text, View, type ListViewToken } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport {\n ChevronDownIcon,\n ChevronRightIcon,\n CloseIcon,\n FileIcon,\n FolderIcon,\n ImageIcon,\n SearchIcon,\n SlidersIcon,\n} from '../icons/icons';\nimport { fileKindLabel } from '../lib/fileKindLabel';\nimport { fontOf } from '../lib/fonts';\nimport { Button } from './Button';\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from './DropdownMenu';\nimport { EmptyState } from './EmptyState';\nimport { Input } from './Input';\nimport { SegmentedControl } from './SegmentedControl';\nimport { Sheet, SheetContent } from './Sheet';\nimport { SheetList } from './SheetList';\n\nexport interface FileBrowserControls {\n layout: FileLayout;\n onLayoutChange: (layout: FileLayout) => void;\n query: string;\n onQueryChange: (query: string) => void;\n type: FileKind | 'any';\n onTypeChange: (type: FileKind | 'any') => void;\n modified: FileModified;\n onModifiedChange: (modified: FileModified) => void;\n sort: FileSort;\n onSortChange: (sort: FileSort) => void;\n direction: FileSortDirection;\n onDirectionChange: (direction: FileSortDirection) => void;\n rows: readonly FileTreeRow[];\n onToggleDirectory: (path: string) => void;\n selected?: FileItem;\n onSelect: (item: FileItem) => void;\n onCloseSelection: () => void;\n totalCount: number;\n onViewableImagesChange?: (paths: readonly string[]) => void;\n /** A loaded thumbnail or a placeholder for an image file; `compact` is a list row's small square. */\n renderImage?: (item: FileItem, compact: boolean) => ReactNode;\n /** Drawn first in the list, above the controls, such as the native dock's tab strip. */\n header?: ReactNode;\n /** Inside a bottom sheet with no scroll view of its own: the list is the sheet's only scroll owner. */\n sheet?: boolean;\n}\n\nexport interface FileListProps {\n items: readonly FileItem[];\n onOpen: (path: string) => void;\n loading?: boolean;\n error?: string;\n /** Offered beside a failed read as Try again. */\n onRetry?: () => void;\n /** Names the list for search and layout, such as \"artifacts\" or \"Personal\". */\n label: string;\n /** Guidance under the empty card's title: why the list is empty and what fills it. */\n emptyText: string;\n grid?: boolean;\n browser?: FileBrowserControls;\n}\n\n/** A folder of files on the phone: recent rows, or a browser with layouts, filters and a swipeable selection. Presentation only. */\nexport function FileList({\n items,\n onOpen,\n loading,\n error,\n onRetry,\n grid = false,\n browser,\n label,\n emptyText,\n}: FileListProps) {\n const t = useT();\n if (browser)\n return (\n <FileBrowserList\n label={label}\n emptyText={emptyText}\n items={items}\n onOpen={onOpen}\n loading={loading}\n error={error}\n onRetry={onRetry}\n browser={browser}\n />\n );\n return (\n <View testID={grid ? 'file-list-grid' : 'file-list-recent'} style={styles.list}>\n {error ? <ListFailure error={error} retained={items.length > 0} onRetry={onRetry} /> : null}\n {loading ? <Text style={styles.meta}>{t('nativeComponents.fileList.loading', 'Loading files...')}</Text> : null}\n {!loading && !error && items.length === 0 ? (\n <EmptyState\n size=\"compact\"\n surface=\"plain\"\n icon={<FolderIcon size={16} />}\n title={t('nativeComponents.fileList.emptyTitle', 'Nothing here yet')}\n description={emptyText}\n />\n ) : null}\n {items.map((item) => (\n <Button\n key={item.path}\n variant={grid ? 'outline' : 'ghost'}\n size=\"card\"\n accessibilityLabel={t('nativeComponents.fileList.open', 'Open {path}', { path: item.path })}\n testID={`file-${item.path}`}\n onPress={() => onOpen(item.path)}\n style={styles.item}\n >\n <FileIcon size={18} color=\"dim\" />\n <View style={styles.label}>\n <Text numberOfLines={1} style={styles.name}>\n {item.name}\n </Text>\n {grid || item.path !== item.name ? (\n <Text numberOfLines={1} style={styles.path}>\n {item.path}\n </Text>\n ) : null}\n {grid ? (\n <Text style={styles.meta}>\n {t('nativeComponents.fileList.bytes', '{size} bytes', {\n size: item.size.toLocaleString(currentLocale()),\n })}\n </Text>\n ) : null}\n </View>\n </Button>\n ))}\n </View>\n );\n}\n\ntype Translate = ReturnType<typeof useT>;\nconst layoutOptions = (t: Translate) => [\n { value: 'tree', label: t('nativeComponents.fileList.layout.tree', 'Tree') },\n { value: 'list', label: t('nativeComponents.fileList.layout.list', 'List') },\n { value: 'grid', label: t('nativeComponents.fileList.layout.grid', 'Grid') },\n];\nconst TYPES = ['any', 'Markdown', 'Image', 'Code', 'Data', 'Document', 'Other'] as const;\nconst modifiedOptions = (t: Translate) =>\n [\n { value: 'any', label: t('nativeComponents.fileList.modified.any', 'Any time') },\n { value: 'today', label: t('nativeComponents.fileList.modified.today', 'Today') },\n { value: '7days', label: t('nativeComponents.fileList.modified.7days', 'Last 7 days') },\n { value: '30days', label: t('nativeComponents.fileList.modified.30days', 'Last 30 days') },\n ] as const;\nconst sortOptions = (t: Translate) =>\n [\n { value: 'name', label: t('nativeComponents.fileList.sort.name', 'Name') },\n { value: 'modified', label: t('nativeComponents.fileList.sort.modified', 'Modified') },\n { value: 'size', label: t('nativeComponents.fileList.sort.size', 'Size') },\n ] as const;\nconst ROW_HEIGHT = 48;\nconst IMAGE_VIEWABILITY = { itemVisiblePercentThreshold: 1 };\n/** Past this the dots stop reading as positions; the counter beside the name still does. */\nconst MAX_DOTS = 7;\nconst PREVIEW_HEIGHT = 320;\n\n/** A failed read: kept files stay listed under it, as the approved RetainedContent target shows. */\nfunction ListFailure({ error, retained, onRetry }: { error: string; retained: boolean; onRetry?: () => void }) {\n const t = useT();\n return (\n <EmptyState\n size=\"compact\"\n surface=\"plain\"\n tone=\"error\"\n title={\n retained\n ? t('nativeComponents.fileList.refreshFailed', \"Couldn't refresh the file list\")\n : t('nativeComponents.fileList.loadFailed', \"Couldn't load the file list\")\n }\n description={retained ? t('nativeComponents.fileList.lastSeen', 'These are the files Po saw last.') : error}\n action={onRetry ? { label: t('nativeComponents.fileList.retry', 'Try again'), onAction: onRetry } : undefined}\n />\n );\n}\n\nfunction FileBrowserList({\n items,\n onOpen,\n loading,\n error,\n onRetry,\n browser: b,\n label,\n emptyText,\n}: FileListProps & { browser: FileBrowserControls }) {\n const t = useT();\n const LAYOUTS = layoutOptions(t);\n const MODIFIED = modifiedOptions(t);\n const SORTS = sortOptions(t);\n const grid = b.layout === 'grid';\n const onViewableImagesChange = b.onViewableImagesChange;\n const onViewableItemsChanged = useCallback(\n ({ viewableItems }: { viewableItems: (Omit<ListViewToken, 'item'> & { item: FileTreeRow })[] }) => {\n onViewableImagesChange?.(\n viewableItems.flatMap(({ item, isViewable }) =>\n isViewable && item.kind === 'file' && fileKind(item.item.path) === 'Image' ? [item.item.path] : [],\n ),\n );\n },\n [onViewableImagesChange],\n );\n const rows: readonly FileTreeRow[] =\n b.layout === 'tree' ? b.rows : items.map((item) => ({ kind: 'file', item, depth: 0 }));\n // Prev and next step through the files the person can see, in the order they see them.\n const files = rows.flatMap((row) => (row.kind === 'file' ? [row.item] : []));\n const at = b.selected ? files.findIndex((file) => file.path === b.selected?.path) : -1;\n const List = b.sheet ? SheetList<FileTreeRow> : FlatList<FileTreeRow>;\n const list = (\n <List\n {...(b.sheet ? { embedded: true } : {})}\n key={b.layout}\n testID=\"file-list-browser\"\n onViewableItemsChanged={onViewableItemsChanged}\n viewabilityConfig={IMAGE_VIEWABILITY}\n data={loading ? [] : rows}\n numColumns={grid ? 2 : 1}\n columnWrapperStyle={grid ? styles.columns : undefined}\n keyExtractor={(row) => (row.kind === 'dir' ? `dir:${row.path}` : row.item.path)}\n keyboardShouldPersistTaps=\"handled\"\n ListHeaderComponent={\n <>\n {b.header}\n <View style={styles.head}>\n <SegmentedControl\n accessibilityLabel={t('nativeComponents.fileList.layoutLabel', '{label} layout', { label })}\n options={LAYOUTS}\n value={b.layout}\n onValueChange={(value) => {\n if (isFileLayout(value)) b.onLayoutChange(value);\n }}\n />\n <View style={styles.toolbar}>\n <View style={styles.search}>\n <SearchIcon size={18} />\n <Input\n variant=\"bare\"\n accessibilityLabel={t('nativeComponents.fileList.search', 'Search {label}', { label })}\n placeholder={t('nativeComponents.fileList.search', 'Search {label}', { label })}\n value={b.query}\n onChangeText={b.onQueryChange}\n style={styles.searchInput}\n autoCapitalize=\"none\"\n />\n </View>\n <DropdownMenu>\n <DropdownMenuTrigger\n variant=\"outline\"\n accessibilityLabel={t('nativeComponents.fileList.filters', 'Filters')}\n >\n <SlidersIcon />\n {t('nativeComponents.fileList.filters', 'Filters')}\n </DropdownMenuTrigger>\n <DropdownMenuContent>\n <DropdownMenuLabel>{t('nativeComponents.fileList.typeHeading', 'Type')}</DropdownMenuLabel>\n {TYPES.map((type) => (\n <DropdownMenuCheckboxItem\n key={type}\n checked={b.type === type}\n onCheckedChange={() => b.onTypeChange(type)}\n >\n {type === 'any' ? t('nativeComponents.fileList.allTypes', 'All types') : fileKindLabel(type, t)}\n </DropdownMenuCheckboxItem>\n ))}\n <DropdownMenuSeparator />\n <DropdownMenuLabel>{t('nativeComponents.fileList.sort.modified', 'Modified')}</DropdownMenuLabel>\n {MODIFIED.map(({ value, label }) => (\n <DropdownMenuCheckboxItem\n key={value}\n checked={b.modified === value}\n onCheckedChange={() => b.onModifiedChange(value)}\n >\n {label}\n </DropdownMenuCheckboxItem>\n ))}\n <DropdownMenuSeparator />\n <DropdownMenuLabel>{t('nativeComponents.fileList.sortHeading', 'Sort')}</DropdownMenuLabel>\n {SORTS.map(({ value, label }) => (\n <DropdownMenuCheckboxItem\n key={value}\n checked={b.sort === value}\n onCheckedChange={() => b.onSortChange(value)}\n >\n {label}\n </DropdownMenuCheckboxItem>\n ))}\n <DropdownMenuCheckboxItem\n checked={b.direction === 'asc'}\n onCheckedChange={() => b.onDirectionChange('asc')}\n >\n {t('nativeComponents.fileList.ascending', 'Ascending')}\n </DropdownMenuCheckboxItem>\n <DropdownMenuCheckboxItem\n checked={b.direction === 'desc'}\n onCheckedChange={() => b.onDirectionChange('desc')}\n >\n {t('nativeComponents.fileList.descending', 'Descending')}\n </DropdownMenuCheckboxItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </View>\n <View style={styles.chips}>\n {b.query ? (\n <Button\n variant=\"outline\"\n accessibilityLabel={t('nativeComponents.fileList.removeSearch', 'Remove search filter')}\n onPress={() => b.onQueryChange('')}\n >\n {t('nativeComponents.fileList.searchChip', 'Search: {query}', { query: b.query })}\n <CloseIcon />\n </Button>\n ) : null}\n {b.type !== 'any' ? (\n <Button\n variant=\"outline\"\n accessibilityLabel={t('nativeComponents.fileList.removeType', 'Remove type filter')}\n onPress={() => b.onTypeChange('any')}\n >\n {fileKindLabel(b.type, t)}\n <CloseIcon />\n </Button>\n ) : null}\n {b.modified !== 'any' ? (\n <Button\n variant=\"outline\"\n accessibilityLabel={t('nativeComponents.fileList.removeModified', 'Remove modified filter')}\n onPress={() => b.onModifiedChange('any')}\n >\n {MODIFIED.find((option) => option.value === b.modified)?.label}\n <CloseIcon />\n </Button>\n ) : null}\n </View>\n {error ? <ListFailure error={error} retained={items.length > 0} onRetry={onRetry} /> : null}\n {loading ? (\n <Text style={styles.meta}>{t('nativeComponents.fileList.loading', 'Loading files...')}</Text>\n ) : null}\n </View>\n </>\n }\n ListEmptyComponent={\n loading || error ? undefined : b.totalCount ? (\n <EmptyState\n size=\"compact\"\n surface=\"plain\"\n icon={<SearchIcon size={16} />}\n title={t('nativeComponents.fileList.noMatch', 'No files match')}\n secondaryAction={{\n label: t('nativeComponents.fileList.clearFilters', 'Clear filters'),\n onAction: () => {\n b.onQueryChange('');\n b.onTypeChange('any');\n b.onModifiedChange('any');\n },\n }}\n style={styles.inset}\n />\n ) : (\n <EmptyState\n size=\"compact\"\n surface=\"plain\"\n icon={<FolderIcon size={16} />}\n title={t('nativeComponents.fileList.emptyTitle', 'Nothing here yet')}\n description={emptyText}\n style={styles.inset}\n />\n )\n }\n renderItem={({ item: row }) => {\n if (row.kind === 'dir')\n return (\n <Button\n variant=\"ghost\"\n style={[styles.row, styles.indent(row.depth)]}\n accessibilityLabel={\n row.open\n ? t('nativeComponents.fileList.collapse', 'Collapse {path}', { path: row.path })\n : t('nativeComponents.fileList.expand', 'Expand {path}', { path: row.path })\n }\n accessibilityState={{ expanded: row.open }}\n onPress={() => b.onToggleDirectory(row.path)}\n >\n {row.open ? <ChevronDownIcon /> : <ChevronRightIcon />}\n <FolderIcon />\n <Text numberOfLines={1} style={[styles.name, styles.label]}>\n {row.name}\n </Text>\n <Text style={styles.meta}>{row.count}</Text>\n </Button>\n );\n const item = row.item;\n const image = fileKind(item.path) === 'Image';\n const selected = b.selected?.path === item.path;\n return (\n <Button\n variant=\"ghost\"\n size=\"card\"\n testID={`file-${item.path}`}\n accessibilityLabel={t('nativeComponents.fileList.select', 'Select {path}', { path: item.path })}\n accessibilityState={{ selected }}\n onPress={() => b.onSelect(item)}\n style={[grid ? styles.tile : styles.row, selected && styles.selected, !grid && styles.indent(row.depth)]}\n >\n {b.layout === 'tree' ? <View accessible={false} style={styles.chevronGutter} /> : null}\n {grid ? (\n <View style={styles.thumbnail}>\n {image && b.renderImage ? (\n b.renderImage(item, false)\n ) : image ? (\n <ImageIcon size={28} />\n ) : (\n <FileIcon size={28} />\n )}\n </View>\n ) : (\n // Every file row keeps the same slot, so names line up whether or not a picture loaded.\n <View style={styles.rowThumbnail}>\n {image && b.renderImage ? (\n b.renderImage(item, true)\n ) : image ? (\n <ImageIcon size={18} />\n ) : (\n <FileIcon size={18} />\n )}\n </View>\n )}\n <View style={styles.label}>\n <Text numberOfLines={1} style={styles.name}>\n {item.name}\n </Text>\n <Text numberOfLines={1} style={styles.path}>\n {item.path}\n </Text>\n </View>\n <Text style={styles.meta}>{sizeLabel(item.size)}</Text>\n </Button>\n );\n }}\n ListFooterComponent={\n <View style={styles.foot}>\n <Text style={styles.meta}>\n {t('nativeComponents.fileList.count', '{shown} of {total} files', {\n shown: items.length,\n total: b.totalCount,\n })}\n </Text>\n </View>\n }\n />\n );\n return (\n <>\n {list}\n <Sheet\n open={b.selected !== undefined}\n onOpenChange={(open) => {\n if (!open) b.onCloseSelection();\n }}\n >\n <SheetContent>\n {b.selected ? (\n <View style={styles.foot}>\n <View style={styles.selection} testID=\"file-selection\">\n <View style={styles.titleRow}>\n <Text accessibilityRole=\"header\" numberOfLines={1} style={[styles.name, styles.label]}>\n {b.selected.name}\n </Text>\n {files.length > 1 ? (\n <Text accessibilityLiveRegion=\"polite\" style={styles.meta}>\n {t('nativeComponents.fileList.position', '{index} of {total}', {\n index: Math.max(0, at) + 1,\n total: files.length,\n })}\n </Text>\n ) : null}\n </View>\n <SelectionSlides\n files={at < 0 ? [b.selected] : files}\n selected={b.selected}\n onSelect={b.onSelect}\n renderImage={b.renderImage}\n />\n <Text numberOfLines={2} style={styles.path}>\n {b.selected.path}\n </Text>\n <Text style={styles.meta}>\n {fileKindLabel(fileKind(b.selected.path), t)} · {sizeLabel(b.selected.size)}\n </Text>\n <View style={styles.actions}>\n <Button variant=\"outline\" onPress={b.onCloseSelection}>\n {t('nativeComponents.fileList.close', 'Close')}\n </Button>\n <Button\n variant=\"primary\"\n onPress={() => {\n if (b.selected) {\n b.onCloseSelection();\n onOpen(b.selected.path);\n }\n }}\n >\n {t('nativeComponents.fileList.openAction', 'Open')}\n </Button>\n </View>\n </View>\n </View>\n ) : null}\n </SheetContent>\n </Sheet>\n </>\n );\n}\n\n/** The selected file large; swiping and the arrows select its neighbours in the list. */\nfunction SelectionSlides({\n files,\n selected,\n onSelect,\n renderImage,\n}: {\n files: readonly FileItem[];\n selected: FileItem;\n onSelect: (item: FileItem) => void;\n renderImage?: FileBrowserControls['renderImage'];\n}) {\n const t = useT();\n const index = Math.max(\n 0,\n files.findIndex((file) => file.path === selected.path),\n );\n // A horizontal scroller does not stretch its pages, so each page takes the measured width.\n const [width, setWidth] = useState(0);\n const scroller = useRef<ComponentRef<typeof ScrollView>>(null);\n const placed = useRef(false);\n useEffect(() => {\n if (width === 0) return;\n // Opening lands on the tapped file; later steps glide.\n scroller.current?.scrollTo({ x: index * width, animated: placed.current });\n placed.current = true;\n }, [index, width]);\n const step = (by: number) => {\n const next = files[index + by];\n if (next) onSelect(next);\n };\n return (\n <View>\n <ScrollView\n ref={scroller}\n horizontal\n pagingEnabled\n showsHorizontalScrollIndicator={false}\n onLayout={(event) => setWidth(event.nativeEvent.layout.width)}\n onMomentumScrollEnd={(event) => {\n if (width > 0) step(Math.round(event.nativeEvent.contentOffset.x / width) - index);\n }}\n style={styles.preview}\n >\n {files.map((file, page) => (\n <View\n key={file.path}\n accessibilityElementsHidden={page !== index}\n importantForAccessibility={page === index ? 'auto' : 'no-hide-descendants'}\n style={[styles.page, { width }]}\n >\n {/* ponytail: only the open page and its neighbours mount; a long list never reads every picture. */}\n {Math.abs(page - index) > 1 ? null : fileKind(file.path) !== 'Image' ? (\n <FileIcon size={28} />\n ) : renderImage ? (\n renderImage(file, false)\n ) : (\n <ImageIcon size={28} />\n )}\n </View>\n ))}\n </ScrollView>\n {files.length > 1 ? (\n <>\n <Button\n variant=\"ghost\"\n size=\"icon-md\"\n accessibilityLabel={t('nativeComponents.fileList.previous', 'Previous file')}\n disabled={index === 0}\n onPress={() => step(-1)}\n style={[styles.arrow, styles.previous]}\n >\n <View style={styles.flip}>\n <ChevronRightIcon size={18} color=\"hi\" />\n </View>\n </Button>\n <Button\n variant=\"ghost\"\n size=\"icon-md\"\n accessibilityLabel={t('nativeComponents.fileList.next', 'Next file')}\n disabled={index === files.length - 1}\n onPress={() => step(1)}\n style={[styles.arrow, styles.next]}\n >\n <ChevronRightIcon size={18} color=\"hi\" />\n </Button>\n </>\n ) : null}\n {files.length > 1 && files.length <= MAX_DOTS ? (\n <View accessible={false} style={styles.dots}>\n {files.map((file, page) => (\n <View key={file.path} style={[styles.dot, page === index && styles.dotActive]} />\n ))}\n </View>\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n head: { gap: theme.spacing(3), padding: theme.spacing(4), paddingBottom: theme.spacing(3) },\n foot: { gap: theme.spacing(3), padding: theme.spacing(4), paddingTop: theme.spacing(3) },\n inset: { paddingHorizontal: theme.spacing(4) },\n toolbar: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2) },\n search: {\n flex: 1,\n minWidth: 0,\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(2),\n paddingHorizontal: theme.spacing(2),\n borderWidth: 1,\n borderColor: theme.colors.border,\n borderRadius: theme.borderRadius.DEFAULT,\n backgroundColor: theme.colors.deep,\n },\n searchInput: { flex: 1 },\n chips: { flexDirection: 'row', flexWrap: 'wrap', gap: theme.spacing(2) },\n row: {\n marginHorizontal: theme.spacing(4),\n marginBottom: theme.spacing(2),\n // A file row holds two lines; a fixed height pressed them against the border.\n minHeight: ROW_HEIGHT,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'flex-start',\n gap: theme.spacing(2),\n borderWidth: 1,\n borderColor: theme.colors['border-soft'],\n borderRadius: theme.borderRadius.DEFAULT,\n paddingVertical: theme.spacing(2),\n paddingRight: theme.spacing(3),\n },\n // Tree depth adds to the row's own inset; replacing it put the icon against the border.\n indent: (depth: number) => ({ paddingLeft: theme.spacing(3) + depth * 16 }),\n chevronGutter: { width: 16 },\n columns: { gap: theme.spacing(2), paddingHorizontal: theme.spacing(4) },\n tile: {\n flex: 1,\n maxWidth: '50%',\n flexDirection: 'column',\n alignItems: 'stretch',\n gap: theme.spacing(2),\n borderWidth: 1,\n borderColor: theme.colors['border-soft'],\n marginBottom: theme.spacing(2),\n },\n thumbnail: {\n height: 96,\n backgroundColor: theme.colors.deep,\n borderRadius: theme.borderRadius.DEFAULT,\n overflow: 'hidden',\n alignItems: 'center',\n justifyContent: 'center',\n },\n rowThumbnail: {\n width: 40,\n height: 40,\n borderRadius: theme.borderRadius.sm,\n overflow: 'hidden',\n alignItems: 'center',\n justifyContent: 'center',\n },\n selected: { backgroundColor: theme.colors['tint-green'], borderColor: theme.colors['edge-green'] },\n selection: {\n flexShrink: 0,\n padding: theme.spacing(3),\n gap: theme.spacing(2),\n borderWidth: 1,\n borderColor: theme.colors.border,\n borderRadius: theme.borderRadius.DEFAULT,\n backgroundColor: theme.colors.panel,\n },\n actions: { flexDirection: 'row', justifyContent: 'flex-end', gap: theme.spacing(2) },\n titleRow: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2) },\n preview: {\n height: PREVIEW_HEIGHT,\n backgroundColor: theme.colors.deep,\n borderRadius: theme.borderRadius.DEFAULT,\n },\n page: { height: PREVIEW_HEIGHT, alignItems: 'center', justifyContent: 'center' },\n arrow: {\n position: 'absolute',\n top: PREVIEW_HEIGHT / 2 - 22,\n width: 44,\n height: 44,\n borderRadius: 22,\n backgroundColor: theme.colors.panel,\n },\n previous: { left: theme.spacing(2) },\n next: { right: theme.spacing(2) },\n flip: { transform: [{ rotate: '180deg' }] },\n dots: { flexDirection: 'row', justifyContent: 'center', gap: theme.spacing(2), paddingTop: theme.spacing(2) },\n dot: { width: 6, height: 6, borderRadius: 3, backgroundColor: theme.colors.faint },\n dotActive: { backgroundColor: theme.colors.green },\n list: { gap: theme.spacing(2) },\n // The card size stacks its children; a recent row reads like the browser's list row instead.\n item: {\n minHeight: 44,\n flexDirection: 'row',\n justifyContent: 'flex-start',\n alignItems: 'center',\n gap: theme.spacing(3),\n },\n label: { flex: 1, gap: theme.spacing(1), minWidth: 0 },\n name: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontWeight: '600',\n fontSize: theme.fontSize.base,\n color: theme.colors.text,\n },\n path: { fontFamily: fontOf(theme.fontFamily.mono), fontSize: theme.fontSize.sm, color: theme.colors.dim },\n meta: { fontFamily: fontOf(theme.fontFamily.sans), fontSize: theme.fontSize.sm, color: theme.colors.dim },\n}));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwFA,SAAgBgF,SAAS,EACvBT,OACAC,QACAC,SACAC,OACAC,SACAG,OAAO,OACPC,SACAH,OACAC,aACgB;CAChB,MAAMI,IAAIhF,KAAK;CACf,IAAI8E,SACF,OACE,oBAAC,iBAAD;EACSH;EACIC;EACJN;EACCC;EACCC;EACFC;EACEC;EACAI;CAAQ;CAGvB,OACE,qBAAC,MAAD;EAAM,QAAQD,OAAO,mBAAmB;EAAoB,OAAOI,OAAOC;YAA1E;GACGT,QAAQ,oBAAC,aAAD;IAAoBA;IAAO,UAAUH,MAAMa,SAAS;IAAYT;GAAQ,KAAM;GACtFF,UAAU,oBAAC,MAAD;IAAM,OAAOS,OAAOG;cAAOJ,EAAE,qCAAqC,kBAAkB;GAAQ,KAAI;GAC1G,CAACR,WAAW,CAACC,SAASH,MAAMa,WAAW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,CAAC;EAACG,mBAAA,CAAA,CAAA;CAAC;CAE9B7H,MAAM;EACJ+I,WAAW;EACXf,eAAe;EACfgB,gBAAgB;EAChBf,YAAY;EACZR,KAAKD,MAAME,QAAQ,CAAC;EAACG,mBAAA,CAAA,CAAA;CACvB;CACA9G,OAAO;EAAEmH,MAAM;EAAGT,KAAKD,MAAME,QAAQ,CAAC;EAAGS,UAAU;EAACN,mBAAA,CAAA,CAAA;CAAC;CACrDnG,MAAM;EACJwI,YAAYlM,OAAOwJ,MAAM0C,WAAWC,IAAI;EACxCC,YAAY;EACZC,UAAU7C,MAAM6C,SAASC;EACzBC,OAAO/C,MAAMc,OAAOkC;EAAI3C,mBAAA,CAAA,CAAA;CAC1B;CACAhI,MAAM;EAAEqK,YAAYlM,OAAOwJ,MAAM0C,WAAWO,IAAI;EAAGJ,UAAU7C,MAAM6C,SAASd;EAAIgB,OAAO/C,MAAMc,OAAOoC;EAAG7C,mBAAA,CAAA,CAAA;CAAC;CACxGrG,MAAM;EAAE0I,YAAYlM,OAAOwJ,MAAM0C,WAAWC,IAAI;EAAGE,UAAU7C,MAAM6C,SAASd;EAAIgB,OAAO/C,MAAMc,OAAOoC;EAAG7C,mBAAA,CAAA,CAAA;CAAC;AAC1G,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileViewer.d.mts","names":[],"sources":["../../src/components/FileViewer.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"FileViewer.d.mts","names":[],"sources":["../../src/components/FileViewer.tsx"],"mappings":";;;;iBA6BiB;EACf;;EAEA;IAAS;IAAc;;;EAEvB;EACA,cAAc,QAAQ,gBAAgB,QAAQ;;EAE9C,aAAa,QAAQ,gBAAgB;IAAU;IAAc;;;EAE7D,eAAe,QAAQ,gBAAgB,QAAQ;EAC/C,kBAAkB,QAAQ,sBAAsB;EAChD,oBAAoB;EACpB,qBAAqB;;EAErB,gBAAgB;IAAU;IAAmB,SAAS;;EACtD,aAAa;;EAEb,UAAU;EACV;;EAEA;;EAEA,SAAS;;;wBAIK,WAAW,OAAO,kCAAe,IAAA;;wBAsLjC,gBAAgB,MAAM;EAAgB;EAAc;oBAAqB,IAAA;;wBAgBzE,mBACd,MACA,MACA,QACA,SACA,UACA,YACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;oBACD,IAAA"}
|
|
@@ -2,6 +2,7 @@ import { fontOf } from "../lib/fonts.mjs";
|
|
|
2
2
|
import { Button } from "./Button.mjs";
|
|
3
3
|
import { CloseIcon, DownloadIcon } from "../icons/icons.mjs";
|
|
4
4
|
import { CopyButton } from "./CopyButton.mjs";
|
|
5
|
+
import { EmptyState } from "./EmptyState.mjs";
|
|
5
6
|
import { fileKindLabel } from "../lib/fileKindLabel.mjs";
|
|
6
7
|
import { FilePreview } from "./FilePreview.mjs";
|
|
7
8
|
import { fileKind, filePreviewMode, modifiedLabel, sizeLabel } from "@agimon-ai/po-web-components/text";
|
|
@@ -23,6 +24,7 @@ function FileViewer(props) {
|
|
|
23
24
|
const downloadKey = `${scopeKey}:${path}`;
|
|
24
25
|
const key = `${downloadKey}:${version}`;
|
|
25
26
|
const [loaded, setLoaded] = useState();
|
|
27
|
+
const [attempt, setAttempt] = useState(0);
|
|
26
28
|
const loaders = useRef({
|
|
27
29
|
loadPreview,
|
|
28
30
|
loadMedia
|
|
@@ -71,16 +73,18 @@ function FileViewer(props) {
|
|
|
71
73
|
key,
|
|
72
74
|
showsMedia,
|
|
73
75
|
unavailable,
|
|
74
|
-
hasStatus
|
|
76
|
+
hasStatus,
|
|
77
|
+
attempt
|
|
75
78
|
]);
|
|
76
79
|
const current = loaded?.key === key ? loaded : void 0;
|
|
77
80
|
const downloadController = useRef(void 0);
|
|
78
81
|
const [download, setDownload] = useState();
|
|
82
|
+
const ownDownload = download?.key === downloadKey ? download : void 0;
|
|
79
83
|
useEffect(() => () => {
|
|
80
84
|
downloadController.current?.abort();
|
|
81
85
|
downloadController.current = void 0;
|
|
82
86
|
}, [downloadKey]);
|
|
83
|
-
const saving =
|
|
87
|
+
const saving = ownDownload?.saving === true;
|
|
84
88
|
const canSave = props.nativeSaveFile !== void 0 && prepareSave !== void 0;
|
|
85
89
|
const save = async () => {
|
|
86
90
|
if (unavailable || !props.nativeSaveFile || !prepareSave || downloadController.current) return;
|
|
@@ -88,7 +92,8 @@ function FileViewer(props) {
|
|
|
88
92
|
downloadController.current = controller;
|
|
89
93
|
setDownload({
|
|
90
94
|
key: downloadKey,
|
|
91
|
-
saving: true
|
|
95
|
+
saving: true,
|
|
96
|
+
failed: ownDownload?.failed
|
|
92
97
|
});
|
|
93
98
|
try {
|
|
94
99
|
const file = await prepareSave(controller.signal);
|
|
@@ -101,7 +106,7 @@ function FileViewer(props) {
|
|
|
101
106
|
} catch (error) {
|
|
102
107
|
if (!controller.signal.aborted && downloadController.current === controller) setDownload({
|
|
103
108
|
key: downloadKey,
|
|
104
|
-
|
|
109
|
+
failed: error instanceof Error ? error.message : String(error)
|
|
105
110
|
});
|
|
106
111
|
} finally {
|
|
107
112
|
if (downloadController.current === controller) downloadController.current = void 0;
|
|
@@ -149,19 +154,30 @@ function FileViewer(props) {
|
|
|
149
154
|
saving,
|
|
150
155
|
offline
|
|
151
156
|
]);
|
|
152
|
-
const note =
|
|
157
|
+
const note = ownDownload?.failed ? /* @__PURE__ */ jsx(EmptyState, {
|
|
158
|
+
size: "compact",
|
|
159
|
+
surface: "plain",
|
|
160
|
+
tone: "error",
|
|
161
|
+
title: t("nativeComponents.fileViewer.saveFailed", "Couldn't save this file"),
|
|
162
|
+
description: ownDownload.failed,
|
|
163
|
+
action: {
|
|
164
|
+
label: t("nativeComponents.fileViewer.retry", "Try again"),
|
|
165
|
+
onAction: () => void save(),
|
|
166
|
+
loading: saving
|
|
167
|
+
}
|
|
168
|
+
}) : ownDownload?.note ? /* @__PURE__ */ jsx(Text, {
|
|
153
169
|
accessibilityLiveRegion: "polite",
|
|
154
170
|
style: styles.meta,
|
|
155
|
-
children:
|
|
171
|
+
children: ownDownload.note
|
|
156
172
|
}) : null;
|
|
157
|
-
const body = hasStatus ? status : unavailable ? /* @__PURE__ */ jsx(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
173
|
+
const body = hasStatus ? status : unavailable ? /* @__PURE__ */ jsx(EmptyState, { title: unavailable }) : current?.error ? /* @__PURE__ */ jsx(EmptyState, {
|
|
174
|
+
tone: "error",
|
|
175
|
+
title: t("nativeComponents.fileViewer.loadFailed", "Couldn't load this file"),
|
|
176
|
+
description: current.error,
|
|
177
|
+
action: {
|
|
178
|
+
label: t("nativeComponents.fileViewer.retry", "Try again"),
|
|
179
|
+
onAction: () => setAttempt((n) => n + 1)
|
|
180
|
+
}
|
|
165
181
|
}) : current?.preview ? /* @__PURE__ */ jsx(FilePreview, {
|
|
166
182
|
preview: current.preview,
|
|
167
183
|
scopeKey,
|
|
@@ -321,12 +337,6 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
321
337
|
fontSize: theme.fontSize.sm,
|
|
322
338
|
color: theme.colors.dim,
|
|
323
339
|
uni__dependencies: [0]
|
|
324
|
-
},
|
|
325
|
-
error: {
|
|
326
|
-
fontFamily: fontOf(theme.fontFamily.sans),
|
|
327
|
-
fontSize: theme.fontSize.sm,
|
|
328
|
-
color: theme.colors.red,
|
|
329
|
-
uni__dependencies: [0]
|
|
330
340
|
}
|
|
331
341
|
}));
|
|
332
342
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileViewer.mjs","names":["useT","BoundedFileSource","fileKind","filePreviewMode","modifiedLabel","sizeLabel","FileTextPreview","ReactNode","useEffect","useRef","useState","StyleSheet","CloseIcon","DownloadIcon","fileKindLabel","fontOf","Button","CopyButton","FilePreview","FilePreviewProps","Loaded","key","preview","error","media","data","mimeType","mediaError","FileViewerProps","path","item","size","modifiedAt","scopeKey","loadPreview","signal","AbortSignal","Promise","loadMedia","prepareSave","nativeSaveFile","source","renderFilePreview","renderMediaPreview","setTabHeader","header","subtitle","action","onOpenPath","actions","note","unavailable","status","FileViewer","props","t","hasStatus","undefined","version","downloadKey","loaded","setLoaded","loaders","current","showsMedia","controller","AbortController","then","aborted","bytes","Error","message","String","catch","abort","downloadController","download","setDownload","saving","canSave","save","file","cancel","handlers","offline","styles","meta","body","screen","stage","content","FilePathStrip","now","Date","strip","stripPath","FileViewerHeader","disabled","onDownload","onCancel","label","create","theme","rt","flex","padding","spacing","gap","uni__dependencies","flexDirection","alignItems","paddingHorizontal","paddingTop","paddingBottom","insets","bottom","borderTopWidth","borderTopColor","colors","backgroundColor","bg","flexShrink","borderBottomWidth","borderBottomColor","minWidth","fontFamily","mono","fontSize","sm","color","dim","sans","red"],"sources":["../../src/components/FileViewer.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport {\n type BoundedFileSource,\n fileKind,\n filePreviewMode,\n modifiedLabel,\n sizeLabel,\n type FileTextPreview,\n} from '@agimon-ai/po-web-components/text';\nimport { type ReactNode, useEffect, useRef, useState } from 'react';\nimport { ScrollView, Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { CloseIcon, DownloadIcon } from '../icons/icons';\nimport { fileKindLabel } from '../lib/fileKindLabel';\nimport { fontOf } from '../lib/fonts';\nimport { Button } from './Button';\nimport { CopyButton } from './CopyButton';\nimport { FilePreview, type FilePreviewProps } from './FilePreview';\n\ninterface Loaded {\n key: string;\n preview?: FileTextPreview;\n error?: string;\n media?: { data: string; mimeType: string };\n mediaError?: string;\n}\n\nexport interface FileViewerProps {\n path: string;\n /** The listed file, for its size and modified time; changes to it reload the preview. */\n item?: { size: number; modifiedAt: number };\n /** Keeps this folder's previews and downloads apart from another folder's file with the same path. */\n scopeKey: string;\n loadPreview: (signal: AbortSignal) => Promise<FileTextPreview>;\n /** Whole small media, base64 encoded by the owner. */\n loadMedia?: (signal: AbortSignal) => Promise<{ data: string; mimeType: string }>;\n /** A bounded source the host saves; without it there is no download. */\n prepareSave?: (signal: AbortSignal) => Promise<BoundedFileSource>;\n nativeSaveFile?: (source: BoundedFileSource) => Promise<void>;\n renderFilePreview?: FilePreviewProps['renderFilePreview'];\n renderMediaPreview?: FilePreviewProps['renderMediaPreview'];\n /** The native top bar of the tab screen; absent in older hosts, where the viewer draws its own header. */\n setTabHeader?: (header: { subtitle?: string; action?: ReactNode }) => void;\n onOpenPath: (path: string) => void;\n /** Above the preview, such as the owner's move action. */\n actions?: ReactNode;\n note?: string;\n /** Shown instead of the preview when the owner cannot read files, such as an unavailable session. */\n unavailable?: string;\n /** Shown instead of the preview, such as an EmptyState for a folder, a missing file or a failed read. */\n status?: ReactNode;\n}\n\n/** One file on the phone: header or top-bar download, the bounded preview, and the path strip. */\nexport function FileViewer(props: FileViewerProps) {\n const t = useT();\n const { path, item, scopeKey, loadPreview, loadMedia, prepareSave, setTabHeader, unavailable, status } = props;\n const hasStatus = status !== undefined && status !== null;\n const version = `${item?.modifiedAt ?? ''}:${item?.size ?? ''}`;\n const downloadKey = `${scopeKey}:${path}`;\n const key = `${downloadKey}:${version}`;\n const [loaded, setLoaded] = useState<Loaded>();\n // The owner's loaders change identity each render; the effect reads the latest through a ref.\n const loaders = useRef({ loadPreview, loadMedia });\n useEffect(() => {\n loaders.current = { loadPreview, loadMedia };\n });\n const showsMedia = props.renderMediaPreview !== undefined;\n useEffect(() => {\n if (unavailable || hasStatus) return;\n const controller = new AbortController();\n void loaders.current\n .loadPreview(controller.signal)\n .then(async (preview) => {\n if (controller.signal.aborted) return;\n setLoaded({ key, preview });\n const media = loaders.current.loadMedia;\n if (filePreviewMode(path) !== 'media' || !showsMedia || !media) return;\n try {\n const bytes = await media(controller.signal);\n if (!controller.signal.aborted) setLoaded({ key, preview, media: bytes });\n } catch (error) {\n if (!controller.signal.aborted)\n setLoaded({ key, preview, mediaError: error instanceof Error ? error.message : String(error) });\n }\n })\n .catch((error: unknown) => {\n if (!controller.signal.aborted)\n setLoaded({ key, error: error instanceof Error ? error.message : String(error) });\n });\n return () => controller.abort();\n }, [path, key, showsMedia, unavailable, hasStatus]);\n const current = loaded?.key === key ? loaded : undefined;\n const downloadController = useRef<AbortController | undefined>(undefined);\n const [download, setDownload] = useState<{ key: string; saving?: boolean; note?: string }>();\n useEffect(\n () => () => {\n downloadController.current?.abort();\n downloadController.current = undefined;\n },\n [downloadKey],\n );\n const saving = download?.key === downloadKey && download.saving === true;\n const canSave = props.nativeSaveFile !== undefined && prepareSave !== undefined;\n const save = async () => {\n if (unavailable || !props.nativeSaveFile || !prepareSave || downloadController.current) return;\n const controller = new AbortController();\n downloadController.current = controller;\n setDownload({ key: downloadKey, saving: true });\n try {\n const file = await prepareSave(controller.signal);\n if (controller.signal.aborted || downloadController.current !== controller) return;\n await props.nativeSaveFile(file);\n if (!controller.signal.aborted && downloadController.current === controller)\n setDownload({ key: downloadKey, note: t('nativeComponents.fileViewer.saved', 'Saved.') });\n } catch (error) {\n if (!controller.signal.aborted && downloadController.current === controller)\n setDownload({ key: downloadKey, note: error instanceof Error ? error.message : String(error) });\n } finally {\n if (downloadController.current === controller) downloadController.current = undefined;\n }\n };\n const cancel = () => {\n downloadController.current?.abort();\n downloadController.current = undefined;\n setDownload({ key: downloadKey, note: t('nativeComponents.fileViewer.cancelled', 'Download cancelled.') });\n };\n // The top bar's control outlives this render; it reaches the latest handlers through a ref synced after commit.\n const handlers = useRef({ save, cancel });\n useEffect(() => {\n handlers.current = { save, cancel };\n });\n // Once the host's media view is showing, it names and saves the media in the top bar; the viewer speaks otherwise.\n const media = filePreviewMode(path) === 'media' && showsMedia && current?.media !== undefined;\n const subtitle = `${fileKindLabel(fileKind(path), t)}${item ? ` · ${sizeLabel(item.size)}` : ''}`;\n const offline = unavailable !== undefined;\n useEffect(() => {\n if (!setTabHeader || media) return;\n setTabHeader({\n subtitle,\n action: canSave ? (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n disabled={offline}\n accessibilityLabel={\n saving\n ? t('nativeComponents.fileViewer.cancelDownload', 'Cancel download')\n : t('nativeComponents.fileViewer.download', 'Download')\n }\n onPress={() => (saving ? handlers.current.cancel() : void handlers.current.save())}\n >\n {saving ? <CloseIcon color=\"hi\" /> : <DownloadIcon color=\"hi\" />}\n </Button>\n ) : undefined,\n });\n }, [setTabHeader, media, subtitle, canSave, saving, offline]);\n const note =\n download?.key === downloadKey && download.note ? (\n <Text accessibilityLiveRegion=\"polite\" style={styles.meta}>\n {download.note}\n </Text>\n ) : null;\n const body = hasStatus ? (\n status\n ) : unavailable ? (\n <Text accessibilityRole=\"alert\" style={styles.error}>\n {unavailable}\n </Text>\n ) : current?.error ? (\n <Text accessibilityRole=\"alert\" style={styles.error}>\n {current.error}\n </Text>\n ) : current?.preview ? (\n <FilePreview\n preview={current.preview}\n scopeKey={scopeKey}\n renderFilePreview={props.renderFilePreview}\n renderMediaPreview={props.renderMediaPreview}\n media={current.media}\n mediaError={current.mediaError}\n onOpen={props.onOpenPath}\n />\n ) : (\n <Text style={styles.meta}>{t('nativeComponents.fileViewer.reading', 'Reading this file...')}</Text>\n );\n return (\n <View style={styles.screen}>\n {props.actions}\n {props.note ? (\n <Text accessibilityLiveRegion=\"polite\" style={styles.meta}>\n {props.note}\n </Text>\n ) : null}\n {media ? (\n <View style={styles.stage}>{body}</View>\n ) : (\n <ScrollView style={styles.stage} contentContainerStyle={styles.content}>\n {setTabHeader ? null : (\n <FileViewerHeader\n path={path}\n size={item?.size}\n saving={saving}\n canSave={canSave}\n disabled={offline}\n onDownload={() => void save()}\n onCancel={cancel}\n />\n )}\n {note}\n {body}\n </ScrollView>\n )}\n <FilePathStrip path={path} modifiedAt={item?.modifiedAt} />\n </View>\n );\n}\n\n/** Where the file lives and when it last changed, pinned under the preview. */\nexport function FilePathStrip({ path, modifiedAt }: { path: string; modifiedAt?: number }) {\n // Read once per mount: a preview left open past midnight keeps its first label, which is still true then.\n const [now] = useState(Date.now);\n const t = useT();\n return (\n <View style={styles.strip}>\n <Text selectable numberOfLines={1} ellipsizeMode=\"middle\" style={[styles.path, styles.stripPath]}>\n {path}\n </Text>\n <CopyButton text={path} label={t('nativeComponents.fileViewer.pathLabel', 'path')} />\n {modifiedAt === undefined ? null : <Text style={styles.meta}>{modifiedLabel(modifiedAt, now)}</Text>}\n </View>\n );\n}\n\n/** The viewer's quiet header: where the file lives, what it is, and the one action on it. */\nexport function FileViewerHeader({\n path,\n size,\n saving,\n canSave,\n disabled,\n onDownload,\n onCancel,\n}: {\n path: string;\n size?: number;\n saving: boolean;\n canSave: boolean;\n disabled: boolean;\n onDownload: () => void;\n onCancel: () => void;\n}) {\n const t = useT();\n return (\n <View style={styles.header}>\n <View style={styles.label}>\n <Text selectable numberOfLines={1} ellipsizeMode=\"middle\" style={styles.path}>\n {path}\n </Text>\n <Text style={styles.meta}>\n {fileKindLabel(fileKind(path), t)}\n {size === undefined ? '' : ` · ${sizeLabel(size)}`}\n {canSave ? '' : ` · ${t('nativeComponents.fileViewer.cannotSave', 'This host cannot save downloads.')}`}\n </Text>\n </View>\n {canSave && saving ? (\n <Button variant=\"ghost\" size=\"sm\" onPress={onCancel}>\n {t('nativeComponents.fileViewer.cancel', 'Cancel')}\n </Button>\n ) : null}\n {canSave ? (\n <Button variant=\"outline\" size=\"sm\" disabled={saving || disabled} onPress={onDownload}>\n {t('nativeComponents.fileViewer.download', 'Download')}\n </Button>\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme, rt) => ({\n screen: { flex: 1 },\n stage: { flex: 1 },\n content: { padding: theme.spacing(4), gap: theme.spacing(3) },\n strip: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(2),\n paddingHorizontal: theme.spacing(4),\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2) + rt.insets.bottom,\n borderTopWidth: 1,\n borderTopColor: theme.colors['border-soft'],\n backgroundColor: theme.colors.bg,\n },\n stripPath: { flexShrink: 1 },\n header: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(2),\n paddingBottom: theme.spacing(3),\n borderBottomWidth: 1,\n borderBottomColor: theme.colors['border-soft'],\n },\n label: { flex: 1, minWidth: 0, gap: theme.spacing(0.5) },\n path: { fontFamily: fontOf(theme.fontFamily.mono), fontSize: theme.fontSize.sm, color: theme.colors.dim },\n meta: { fontFamily: fontOf(theme.fontFamily.sans), fontSize: theme.fontSize.sm, color: theme.colors.dim },\n error: { fontFamily: fontOf(theme.fontFamily.sans), fontSize: theme.fontSize.sm, color: theme.colors.red },\n}));\n"],"mappings":";;;;;;;;;;;;;;;;;AAuDA,SAAgBqD,WAAWC,OAAwB;CACjD,MAAMC,IAAIvD,KAAK;CACf,MAAM,EAAE6B,MAAMC,MAAMG,UAAUC,aAAaI,WAAWC,aAAaK,cAAcO,aAAaC,WAAWE;CACzG,MAAME,YAAYJ,WAAWK,UAAaL,WAAW;CACrD,MAAMM,UAAU,GAAG5B,MAAME,cAAc,GAAE,GAAIF,MAAMC,QAAQ;CAC3D,MAAM4B,cAAc,GAAG1B,SAAQ,GAAIJ;CACnC,MAAMR,MAAM,GAAGsC,YAAW,GAAID;CAC9B,MAAM,CAACE,QAAQC,aAAanD,SAAiB;CAE7C,MAAMoD,UAAUrD,OAAO;EAAEyB;EAAaI;CAAU,CAAC;CACjD9B,gBAAgB;EACdsD,QAAQC,UAAU;GAAE7B;GAAaI;EAAU;CAC7C,CAAC;CACD,MAAM0B,aAAaV,MAAMX,uBAAuBc;CAChDjD,gBAAgB;EACd,IAAI2C,eAAeK,WAAW;EAC9B,MAAMS,aAAa,IAAIC,gBAAgB;EACvC,AAAKJ,QAAQC,QACV7B,YAAY+B,WAAW9B,MAAM,CAAC,CAC9BgC,KAAK,OAAO7C,YAAY;GACvB,IAAI2C,WAAW9B,OAAOiC,SAAS;GAC/BP,UAAU;IAAExC;IAAKC;GAAQ,CAAC;GAC1B,MAAME,QAAQsC,QAAQC,QAAQzB;GAC9B,IAAInC,gBAAgB0B,IAAI,MAAM,WAAW,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AOuF,MAAMuB,WAAWM,IAAI;EAAGJ,UAAUzB,MAAMyB,SAASC;EAAIC,OAAO3B,MAAMgB,OAAOY;EAAGtB,mBAAA,CAAA,CAAA;CAAC;CACxGrF,OAAO;EAAEsG,YAAY9G,OAAOuF,MAAMuB,WAAWM,IAAI;EAAGJ,UAAUzB,MAAMyB,SAASC;EAAIC,OAAO3B,MAAMgB,OAAOc;EAAGxB,mBAAA,CAAA,CAAA;CAAC;AAC3G,EAAE"}
|
|
1
|
+
{"version":3,"file":"FileViewer.mjs","names":["useT","BoundedFileSource","fileKind","filePreviewMode","modifiedLabel","sizeLabel","FileTextPreview","ReactNode","useEffect","useRef","useState","StyleSheet","CloseIcon","DownloadIcon","fileKindLabel","fontOf","Button","CopyButton","EmptyState","FilePreview","FilePreviewProps","Loaded","key","preview","error","media","data","mimeType","mediaError","FileViewerProps","path","item","size","modifiedAt","scopeKey","loadPreview","signal","AbortSignal","Promise","loadMedia","prepareSave","nativeSaveFile","source","renderFilePreview","renderMediaPreview","setTabHeader","header","subtitle","action","onOpenPath","actions","note","unavailable","status","FileViewer","props","t","hasStatus","undefined","version","downloadKey","loaded","setLoaded","attempt","setAttempt","loaders","current","showsMedia","controller","AbortController","then","aborted","bytes","Error","message","String","catch","abort","downloadController","download","setDownload","saving","failed","ownDownload","canSave","save","file","cancel","handlers","offline","label","onAction","loading","styles","meta","body","n","screen","stage","content","FilePathStrip","now","Date","strip","stripPath","FileViewerHeader","disabled","onDownload","onCancel","create","theme","rt","flex","padding","spacing","gap","uni__dependencies","flexDirection","alignItems","paddingHorizontal","paddingTop","paddingBottom","insets","bottom","borderTopWidth","borderTopColor","colors","backgroundColor","bg","flexShrink","borderBottomWidth","borderBottomColor","minWidth","fontFamily","mono","fontSize","sm","color","dim","sans"],"sources":["../../src/components/FileViewer.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport {\n type BoundedFileSource,\n fileKind,\n filePreviewMode,\n modifiedLabel,\n sizeLabel,\n type FileTextPreview,\n} from '@agimon-ai/po-web-components/text';\nimport { type ReactNode, useEffect, useRef, useState } from 'react';\nimport { ScrollView, Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { CloseIcon, DownloadIcon } from '../icons/icons';\nimport { fileKindLabel } from '../lib/fileKindLabel';\nimport { fontOf } from '../lib/fonts';\nimport { Button } from './Button';\nimport { CopyButton } from './CopyButton';\nimport { EmptyState } from './EmptyState';\nimport { FilePreview, type FilePreviewProps } from './FilePreview';\n\ninterface Loaded {\n key: string;\n preview?: FileTextPreview;\n error?: string;\n media?: { data: string; mimeType: string };\n mediaError?: string;\n}\n\nexport interface FileViewerProps {\n path: string;\n /** The listed file, for its size and modified time; changes to it reload the preview. */\n item?: { size: number; modifiedAt: number };\n /** Keeps this folder's previews and downloads apart from another folder's file with the same path. */\n scopeKey: string;\n loadPreview: (signal: AbortSignal) => Promise<FileTextPreview>;\n /** Whole small media, base64 encoded by the owner. */\n loadMedia?: (signal: AbortSignal) => Promise<{ data: string; mimeType: string }>;\n /** A bounded source the host saves; without it there is no download. */\n prepareSave?: (signal: AbortSignal) => Promise<BoundedFileSource>;\n nativeSaveFile?: (source: BoundedFileSource) => Promise<void>;\n renderFilePreview?: FilePreviewProps['renderFilePreview'];\n renderMediaPreview?: FilePreviewProps['renderMediaPreview'];\n /** The native top bar of the tab screen; absent in older hosts, where the viewer draws its own header. */\n setTabHeader?: (header: { subtitle?: string; action?: ReactNode }) => void;\n onOpenPath: (path: string) => void;\n /** Above the preview, such as the owner's move action. */\n actions?: ReactNode;\n note?: string;\n /** Shown instead of the preview when the owner cannot read files, such as an unavailable session. */\n unavailable?: string;\n /** Shown instead of the preview, such as an EmptyState for a folder, a missing file or a failed read. */\n status?: ReactNode;\n}\n\n/** One file on the phone: header or top-bar download, the bounded preview, and the path strip. */\nexport function FileViewer(props: FileViewerProps) {\n const t = useT();\n const { path, item, scopeKey, loadPreview, loadMedia, prepareSave, setTabHeader, unavailable, status } = props;\n const hasStatus = status !== undefined && status !== null;\n const version = `${item?.modifiedAt ?? ''}:${item?.size ?? ''}`;\n const downloadKey = `${scopeKey}:${path}`;\n const key = `${downloadKey}:${version}`;\n const [loaded, setLoaded] = useState<Loaded>();\n // Bumped by Try again after a failed read, so the effect reads the file once more.\n const [attempt, setAttempt] = useState(0);\n // The owner's loaders change identity each render; the effect reads the latest through a ref.\n const loaders = useRef({ loadPreview, loadMedia });\n useEffect(() => {\n loaders.current = { loadPreview, loadMedia };\n });\n const showsMedia = props.renderMediaPreview !== undefined;\n useEffect(() => {\n if (unavailable || hasStatus) return;\n const controller = new AbortController();\n void loaders.current\n .loadPreview(controller.signal)\n .then(async (preview) => {\n if (controller.signal.aborted) return;\n setLoaded({ key, preview });\n const media = loaders.current.loadMedia;\n if (filePreviewMode(path) !== 'media' || !showsMedia || !media) return;\n try {\n const bytes = await media(controller.signal);\n if (!controller.signal.aborted) setLoaded({ key, preview, media: bytes });\n } catch (error) {\n if (!controller.signal.aborted)\n setLoaded({ key, preview, mediaError: error instanceof Error ? error.message : String(error) });\n }\n })\n .catch((error: unknown) => {\n if (!controller.signal.aborted)\n setLoaded({ key, error: error instanceof Error ? error.message : String(error) });\n });\n return () => controller.abort();\n }, [path, key, showsMedia, unavailable, hasStatus, attempt]);\n const current = loaded?.key === key ? loaded : undefined;\n const downloadController = useRef<AbortController | undefined>(undefined);\n const [download, setDownload] = useState<{ key: string; saving?: boolean; note?: string; failed?: string }>();\n const ownDownload = download?.key === downloadKey ? download : undefined;\n useEffect(\n () => () => {\n downloadController.current?.abort();\n downloadController.current = undefined;\n },\n [downloadKey],\n );\n const saving = ownDownload?.saving === true;\n const canSave = props.nativeSaveFile !== undefined && prepareSave !== undefined;\n const save = async () => {\n if (unavailable || !props.nativeSaveFile || !prepareSave || downloadController.current) return;\n const controller = new AbortController();\n downloadController.current = controller;\n // A retry keeps the failure on screen with its button busy, as the approved Retrying target shows.\n setDownload({ key: downloadKey, saving: true, failed: ownDownload?.failed });\n try {\n const file = await prepareSave(controller.signal);\n if (controller.signal.aborted || downloadController.current !== controller) return;\n await props.nativeSaveFile(file);\n if (!controller.signal.aborted && downloadController.current === controller)\n setDownload({ key: downloadKey, note: t('nativeComponents.fileViewer.saved', 'Saved.') });\n } catch (error) {\n if (!controller.signal.aborted && downloadController.current === controller)\n setDownload({ key: downloadKey, failed: error instanceof Error ? error.message : String(error) });\n } finally {\n if (downloadController.current === controller) downloadController.current = undefined;\n }\n };\n const cancel = () => {\n downloadController.current?.abort();\n downloadController.current = undefined;\n setDownload({ key: downloadKey, note: t('nativeComponents.fileViewer.cancelled', 'Download cancelled.') });\n };\n // The top bar's control outlives this render; it reaches the latest handlers through a ref synced after commit.\n const handlers = useRef({ save, cancel });\n useEffect(() => {\n handlers.current = { save, cancel };\n });\n // Once the host's media view is showing, it names and saves the media in the top bar; the viewer speaks otherwise.\n const media = filePreviewMode(path) === 'media' && showsMedia && current?.media !== undefined;\n const subtitle = `${fileKindLabel(fileKind(path), t)}${item ? ` · ${sizeLabel(item.size)}` : ''}`;\n const offline = unavailable !== undefined;\n useEffect(() => {\n if (!setTabHeader || media) return;\n setTabHeader({\n subtitle,\n action: canSave ? (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n disabled={offline}\n accessibilityLabel={\n saving\n ? t('nativeComponents.fileViewer.cancelDownload', 'Cancel download')\n : t('nativeComponents.fileViewer.download', 'Download')\n }\n onPress={() => (saving ? handlers.current.cancel() : void handlers.current.save())}\n >\n {saving ? <CloseIcon color=\"hi\" /> : <DownloadIcon color=\"hi\" />}\n </Button>\n ) : undefined,\n });\n }, [setTabHeader, media, subtitle, canSave, saving, offline]);\n const note = ownDownload?.failed ? (\n <EmptyState\n size=\"compact\"\n surface=\"plain\"\n tone=\"error\"\n title={t('nativeComponents.fileViewer.saveFailed', \"Couldn't save this file\")}\n description={ownDownload.failed}\n action={{\n label: t('nativeComponents.fileViewer.retry', 'Try again'),\n onAction: () => void save(),\n loading: saving,\n }}\n />\n ) : ownDownload?.note ? (\n <Text accessibilityLiveRegion=\"polite\" style={styles.meta}>\n {ownDownload.note}\n </Text>\n ) : null;\n const body = hasStatus ? (\n status\n ) : unavailable ? (\n <EmptyState title={unavailable} />\n ) : current?.error ? (\n <EmptyState\n tone=\"error\"\n title={t('nativeComponents.fileViewer.loadFailed', \"Couldn't load this file\")}\n description={current.error}\n action={{ label: t('nativeComponents.fileViewer.retry', 'Try again'), onAction: () => setAttempt((n) => n + 1) }}\n />\n ) : current?.preview ? (\n <FilePreview\n preview={current.preview}\n scopeKey={scopeKey}\n renderFilePreview={props.renderFilePreview}\n renderMediaPreview={props.renderMediaPreview}\n media={current.media}\n mediaError={current.mediaError}\n onOpen={props.onOpenPath}\n />\n ) : (\n <Text style={styles.meta}>{t('nativeComponents.fileViewer.reading', 'Reading this file...')}</Text>\n );\n return (\n <View style={styles.screen}>\n {props.actions}\n {props.note ? (\n <Text accessibilityLiveRegion=\"polite\" style={styles.meta}>\n {props.note}\n </Text>\n ) : null}\n {media ? (\n <View style={styles.stage}>{body}</View>\n ) : (\n <ScrollView style={styles.stage} contentContainerStyle={styles.content}>\n {setTabHeader ? null : (\n <FileViewerHeader\n path={path}\n size={item?.size}\n saving={saving}\n canSave={canSave}\n disabled={offline}\n onDownload={() => void save()}\n onCancel={cancel}\n />\n )}\n {note}\n {body}\n </ScrollView>\n )}\n <FilePathStrip path={path} modifiedAt={item?.modifiedAt} />\n </View>\n );\n}\n\n/** Where the file lives and when it last changed, pinned under the preview. */\nexport function FilePathStrip({ path, modifiedAt }: { path: string; modifiedAt?: number }) {\n // Read once per mount: a preview left open past midnight keeps its first label, which is still true then.\n const [now] = useState(Date.now);\n const t = useT();\n return (\n <View style={styles.strip}>\n <Text selectable numberOfLines={1} ellipsizeMode=\"middle\" style={[styles.path, styles.stripPath]}>\n {path}\n </Text>\n <CopyButton text={path} label={t('nativeComponents.fileViewer.pathLabel', 'path')} />\n {modifiedAt === undefined ? null : <Text style={styles.meta}>{modifiedLabel(modifiedAt, now)}</Text>}\n </View>\n );\n}\n\n/** The viewer's quiet header: where the file lives, what it is, and the one action on it. */\nexport function FileViewerHeader({\n path,\n size,\n saving,\n canSave,\n disabled,\n onDownload,\n onCancel,\n}: {\n path: string;\n size?: number;\n saving: boolean;\n canSave: boolean;\n disabled: boolean;\n onDownload: () => void;\n onCancel: () => void;\n}) {\n const t = useT();\n return (\n <View style={styles.header}>\n <View style={styles.label}>\n <Text selectable numberOfLines={1} ellipsizeMode=\"middle\" style={styles.path}>\n {path}\n </Text>\n <Text style={styles.meta}>\n {fileKindLabel(fileKind(path), t)}\n {size === undefined ? '' : ` · ${sizeLabel(size)}`}\n {canSave ? '' : ` · ${t('nativeComponents.fileViewer.cannotSave', 'This host cannot save downloads.')}`}\n </Text>\n </View>\n {canSave && saving ? (\n <Button variant=\"ghost\" size=\"sm\" onPress={onCancel}>\n {t('nativeComponents.fileViewer.cancel', 'Cancel')}\n </Button>\n ) : null}\n {canSave ? (\n <Button variant=\"outline\" size=\"sm\" disabled={saving || disabled} onPress={onDownload}>\n {t('nativeComponents.fileViewer.download', 'Download')}\n </Button>\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme, rt) => ({\n screen: { flex: 1 },\n stage: { flex: 1 },\n content: { padding: theme.spacing(4), gap: theme.spacing(3) },\n strip: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(2),\n paddingHorizontal: theme.spacing(4),\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2) + rt.insets.bottom,\n borderTopWidth: 1,\n borderTopColor: theme.colors['border-soft'],\n backgroundColor: theme.colors.bg,\n },\n stripPath: { flexShrink: 1 },\n header: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(2),\n paddingBottom: theme.spacing(3),\n borderBottomWidth: 1,\n borderBottomColor: theme.colors['border-soft'],\n },\n label: { flex: 1, minWidth: 0, gap: theme.spacing(0.5) },\n path: { fontFamily: fontOf(theme.fontFamily.mono), fontSize: theme.fontSize.sm, color: theme.colors.dim },\n meta: { fontFamily: fontOf(theme.fontFamily.sans), fontSize: theme.fontSize.sm, color: theme.colors.dim },\n}));\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwDA,SAAgBsD,WAAWC,OAAwB;CACjD,MAAMC,IAAIxD,KAAK;CACf,MAAM,EAAE8B,MAAMC,MAAMG,UAAUC,aAAaI,WAAWC,aAAaK,cAAcO,aAAaC,WAAWE;CACzG,MAAME,YAAYJ,WAAWK,UAAaL,WAAW;CACrD,MAAMM,UAAU,GAAG5B,MAAME,cAAc,GAAE,GAAIF,MAAMC,QAAQ;CAC3D,MAAM4B,cAAc,GAAG1B,SAAQ,GAAIJ;CACnC,MAAMR,MAAM,GAAGsC,YAAW,GAAID;CAC9B,MAAM,CAACE,QAAQC,aAAapD,SAAiB;CAE7C,MAAM,CAACqD,SAASC,cAActD,SAAS,CAAC;CAExC,MAAMuD,UAAUxD,OAAO;EAAE0B;EAAaI;CAAU,CAAC;CACjD/B,gBAAgB;EACdyD,QAAQC,UAAU;GAAE/B;GAAaI;EAAU;CAC7C,CAAC;CACD,MAAM4B,aAAaZ,MAAMX,uBAAuBc;CAChDlD,gBAAgB;EACd,IAAI4C,eAAeK,WAAW;EAC9B,MAAMW,aAAa,IAAIC,gBAAgB;EACvC,AAAKJ,QAAQC,QACV/B,YAAYiC,WAAWhC,MAAM,CAAC,CAC9BkC,KAAK,OAAO/C,YAAY;GACvB,IAAI6C,WAAWhC,OAAOmC,SAAS;GAC/BT,UAAU;IAAExC;IAAKC;GAAQ,CAAC;GAC1B,MAAME,QAAQwC,QAAQC,QAAQ3B;GAC9B,IAAIpC,gBAAgB2B,IAAI,MAAM,WAAW,CAACqC,cAAc,CAAC1C,OAAO;GAChE,IAAI;IACF,MAAM+C,QAAQ,MAAM/C,MAAM2C,WAAWhC,MAAM;IAC3C,IAAI,CAACgC,WAAWhC,OAAOmC,SAAST,UAAU;KAAExC;KAAKC;KAASE,OAAO+C;IAAM,CAAC;GA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AAM;EAAEuG,YAAYtH,OAAO+F,MAAMuB,WAAWC,IAAI;EAAGC,UAAUzB,MAAMyB,SAASC;EAAIC,OAAO3B,MAAMgB,OAAOY;EAAGtB,mBAAA,CAAA,CAAA;CAAC;CACxGtB,MAAM;EAAEuC,YAAYtH,OAAO+F,MAAMuB,WAAWM,IAAI;EAAGJ,UAAUzB,MAAMyB,SAASC;EAAIC,OAAO3B,MAAMgB,OAAOY;EAAGtB,mBAAA,CAAA,CAAA;CAAC;AAC1G,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":1,"platformRequirements":{},"sourceFiles":["LICENSE","README.md","llms.txt","package.json","src/components/AgentAvatar.stories.tsx","src/components/AgentAvatar.tsx","src/components/AnnotationSurface.tsx","src/components/Badge.stories.tsx","src/components/Badge.tsx","src/components/Button.stories.tsx","src/components/Button.tsx","src/components/CodeBlock.stories.tsx","src/components/CodeBlock.tsx","src/components/ComputerRow.stories.tsx","src/components/ComputerRow.tsx","src/components/CopyButton.tsx","src/components/CountBadge.stories.tsx","src/components/CountBadge.tsx","src/components/CtaCard.stories.tsx","src/components/CtaCard.tsx","src/components/Dialog.stories.tsx","src/components/Dialog.tsx","src/components/Dot.stories.tsx","src/components/Dot.tsx","src/components/DropdownMenu.stories.tsx","src/components/DropdownMenu.tsx","src/components/EmptyState.stories.tsx","src/components/EmptyState.tsx","src/components/FileList.stories.tsx","src/components/FileList.tsx","src/components/FilePreview.stories.tsx","src/components/FilePreview.tsx","src/components/FileViewer.stories.tsx","src/components/FileViewer.tsx","src/components/HashlineLines.tsx","src/components/HostFilter.stories.tsx","src/components/HostFilter.tsx","src/components/HostTag.stories.tsx","src/components/HostTag.tsx","src/components/InfoStrip.stories.tsx","src/components/InfoStrip.tsx","src/components/InlineReadingDesign.stories.tsx","src/components/Input.stories.tsx","src/components/Input.tsx","src/components/Label.stories.tsx","src/components/Label.tsx","src/components/LinkText.tsx","src/components/List.stories.tsx","src/components/List.tsx","src/components/LiveDuration.tsx","src/components/LoadingState.stories.tsx","src/components/LoadingState.tsx","src/components/Markdown.stories.tsx","src/components/Markdown.tsx","src/components/MessageItem.stories.tsx","src/components/MessageItem.tsx","src/components/NativeShellState.tsx","src/components/Panel.stories.tsx","src/components/Panel.tsx","src/components/PoNativeProvider.stories.tsx","src/components/PoNativeProvider.tsx","src/components/RailItem.stories.tsx","src/components/RailItem.tsx","src/components/ReferenceChip.stories.tsx","src/components/ReferenceChip.tsx","src/components/SectionLabel.stories.tsx","src/components/SectionLabel.tsx","src/components/SeekBar.stories.tsx","src/components/SeekBar.tsx","src/components/SegmentedControl.stories.tsx","src/components/SegmentedControl.tsx","src/components/Select.stories.tsx","src/components/Select.tsx","src/components/Sheet.stories.tsx","src/components/Sheet.tsx","src/components/SheetFrame.tsx","src/components/SheetList.tsx","src/components/ShowMore.tsx","src/components/Spinner.stories.tsx","src/components/Spinner.tsx","src/components/StatusBadge.stories.tsx","src/components/StatusBadge.tsx","src/components/Switch.stories.tsx","src/components/Switch.tsx","src/components/SyntaxLine.tsx","src/components/Tabs.stories.tsx","src/components/Tabs.tsx","src/components/Textarea.stories.tsx","src/components/Textarea.tsx","src/components/ToolPathLink.tsx","src/components/ToolResultImage.tsx","src/exports/index.ts","src/exports/shell.ts","src/icons/IconColorContext.ts","src/icons/iconGlyphs.ts","src/icons/icons.stories.tsx","src/icons/icons.tsx","src/lib/fileKindLabel.ts","src/lib/fonts.ts","src/lib/haptics.ts","src/lib/insideSheet.ts","src/lib/markdown.ts","src/lib/reading.ts","src/lib/tone.ts","src/lib/useControllable.ts","src/lib/useReadingPage.ts","src/lib/wrapText.tsx","src/unistyles.ts","tsdown.config.ts"],"sourceRevision":"
|
|
1
|
+
{"version":1,"platformRequirements":{},"sourceFiles":["LICENSE","README.md","llms.txt","package.json","src/components/AgentAvatar.stories.tsx","src/components/AgentAvatar.tsx","src/components/AnnotationSurface.tsx","src/components/Badge.stories.tsx","src/components/Badge.tsx","src/components/Button.stories.tsx","src/components/Button.tsx","src/components/CodeBlock.stories.tsx","src/components/CodeBlock.tsx","src/components/ComputerRow.stories.tsx","src/components/ComputerRow.tsx","src/components/CopyButton.tsx","src/components/CountBadge.stories.tsx","src/components/CountBadge.tsx","src/components/CtaCard.stories.tsx","src/components/CtaCard.tsx","src/components/Dialog.stories.tsx","src/components/Dialog.tsx","src/components/Dot.stories.tsx","src/components/Dot.tsx","src/components/DropdownMenu.stories.tsx","src/components/DropdownMenu.tsx","src/components/EmptyState.stories.tsx","src/components/EmptyState.tsx","src/components/FileList.stories.tsx","src/components/FileList.tsx","src/components/FilePreview.stories.tsx","src/components/FilePreview.tsx","src/components/FileViewer.stories.tsx","src/components/FileViewer.tsx","src/components/HashlineLines.tsx","src/components/HostFilter.stories.tsx","src/components/HostFilter.tsx","src/components/HostTag.stories.tsx","src/components/HostTag.tsx","src/components/InfoStrip.stories.tsx","src/components/InfoStrip.tsx","src/components/InlineReadingDesign.stories.tsx","src/components/Input.stories.tsx","src/components/Input.tsx","src/components/Label.stories.tsx","src/components/Label.tsx","src/components/LinkText.tsx","src/components/List.stories.tsx","src/components/List.tsx","src/components/LiveDuration.tsx","src/components/LoadingState.stories.tsx","src/components/LoadingState.tsx","src/components/Markdown.stories.tsx","src/components/Markdown.tsx","src/components/MessageItem.stories.tsx","src/components/MessageItem.tsx","src/components/NativeShellState.tsx","src/components/Panel.stories.tsx","src/components/Panel.tsx","src/components/PoNativeProvider.stories.tsx","src/components/PoNativeProvider.tsx","src/components/RailItem.stories.tsx","src/components/RailItem.tsx","src/components/ReferenceChip.stories.tsx","src/components/ReferenceChip.tsx","src/components/SectionLabel.stories.tsx","src/components/SectionLabel.tsx","src/components/SeekBar.stories.tsx","src/components/SeekBar.tsx","src/components/SegmentedControl.stories.tsx","src/components/SegmentedControl.tsx","src/components/Select.stories.tsx","src/components/Select.tsx","src/components/Sheet.stories.tsx","src/components/Sheet.tsx","src/components/SheetFrame.tsx","src/components/SheetList.tsx","src/components/ShowMore.tsx","src/components/Spinner.stories.tsx","src/components/Spinner.tsx","src/components/StatusBadge.stories.tsx","src/components/StatusBadge.tsx","src/components/Switch.stories.tsx","src/components/Switch.tsx","src/components/SyntaxLine.tsx","src/components/Tabs.stories.tsx","src/components/Tabs.tsx","src/components/Textarea.stories.tsx","src/components/Textarea.tsx","src/components/ToolPathLink.tsx","src/components/ToolResultImage.tsx","src/exports/index.ts","src/exports/shell.ts","src/icons/IconColorContext.ts","src/icons/iconGlyphs.ts","src/icons/icons.stories.tsx","src/icons/icons.tsx","src/lib/fileKindLabel.ts","src/lib/fonts.ts","src/lib/haptics.ts","src/lib/insideSheet.ts","src/lib/markdown.ts","src/lib/reading.ts","src/lib/tone.ts","src/lib/useControllable.ts","src/lib/useReadingPage.ts","src/lib/wrapText.tsx","src/unistyles.ts","tsdown.config.ts"],"sourceRevision":"6ca55dca5e8a9590d3c31f6084140996","manifestRevision":"302757a2bcab318ee379de4000b5407f","outputFiles":["LICENSE","README.md","dist/components/AgentAvatar.mjs","dist/components/AnnotationSurface.mjs","dist/components/Badge.mjs","dist/components/Button.mjs","dist/components/CodeBlock.mjs","dist/components/ComputerRow.mjs","dist/components/CopyButton.mjs","dist/components/CountBadge.mjs","dist/components/CtaCard.mjs","dist/components/Dialog.mjs","dist/components/Dot.mjs","dist/components/DropdownMenu.mjs","dist/components/EmptyState.mjs","dist/components/FileList.mjs","dist/components/FilePreview.mjs","dist/components/FileViewer.mjs","dist/components/HashlineLines.mjs","dist/components/HostFilter.mjs","dist/components/HostTag.mjs","dist/components/InfoStrip.mjs","dist/components/Input.mjs","dist/components/Label.mjs","dist/components/LinkText.mjs","dist/components/List.mjs","dist/components/LiveDuration.mjs","dist/components/LoadingState.mjs","dist/components/Markdown.mjs","dist/components/MessageItem.mjs","dist/components/NativeShellState.mjs","dist/components/Panel.mjs","dist/components/PoNativeProvider.mjs","dist/components/RailItem.mjs","dist/components/ReferenceChip.mjs","dist/components/SectionLabel.mjs","dist/components/SeekBar.mjs","dist/components/SegmentedControl.mjs","dist/components/Select.mjs","dist/components/Sheet.mjs","dist/components/SheetFrame.mjs","dist/components/SheetList.mjs","dist/components/ShowMore.mjs","dist/components/Spinner.mjs","dist/components/StatusBadge.mjs","dist/components/Switch.mjs","dist/components/SyntaxLine.mjs","dist/components/Tabs.mjs","dist/components/Textarea.mjs","dist/components/ToolPathLink.mjs","dist/components/ToolResultImage.mjs","dist/icons/IconColorContext.mjs","dist/icons/iconGlyphs.mjs","dist/icons/icons.mjs","dist/index.mjs","dist/lib/fileKindLabel.mjs","dist/lib/fonts.mjs","dist/lib/haptics.mjs","dist/lib/insideSheet.mjs","dist/lib/markdown.mjs","dist/lib/reading.mjs","dist/lib/tone.mjs","dist/lib/useControllable.mjs","dist/lib/useReadingPage.mjs","dist/lib/wrapText.mjs","dist/shell.mjs","llms.txt"],"outputRevision":"c6cec9614b65c84f02df992e34f4c8e6"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-native-components",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.205",
|
|
4
4
|
"description": "Shared React Native components for Po and its native plugins: the web component library's look and API on native parts, tuned to the Po palette.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
52
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.205"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@agimon-ai/po-build": "0.0.0-alpha.
|
|
56
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
57
|
-
"@agimon-ai/vibe-lint-plugin-po-web": "0.0.0-alpha.
|
|
55
|
+
"@agimon-ai/po-build": "0.0.0-alpha.205",
|
|
56
|
+
"@agimon-ai/po-core": "0.0.0-alpha.205",
|
|
57
|
+
"@agimon-ai/vibe-lint-plugin-po-web": "0.0.0-alpha.205",
|
|
58
58
|
"@babel/core": "7.29.7",
|
|
59
59
|
"@expo/vector-icons": "15.1.1",
|
|
60
60
|
"@fontsource-variable/ibm-plex-sans": "5.3.0",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"vitest": "5.0.4"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
88
|
+
"@agimon-ai/po-core": "0.0.0-alpha.205",
|
|
89
89
|
"@expo/vector-icons": "^15.0.0",
|
|
90
90
|
"@gorhom/bottom-sheet": "^5.2.0",
|
|
91
91
|
"@react-native-segmented-control/segmented-control": "^2.5.0",
|