@agimon-ai/po-native-components 0.0.0-alpha.21 → 0.0.0-alpha.210

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/LICENSE +21 -149
  2. package/README.md +9 -51
  3. package/dist/components/AgentAvatar.d.mts +19 -0
  4. package/dist/components/AgentAvatar.d.mts.map +1 -0
  5. package/dist/components/AgentAvatar.mjs +88 -0
  6. package/dist/components/AgentAvatar.mjs.map +1 -0
  7. package/dist/components/AnnotationSurface.d.mts +69 -0
  8. package/dist/components/AnnotationSurface.d.mts.map +1 -0
  9. package/dist/components/AnnotationSurface.mjs +431 -0
  10. package/dist/components/AnnotationSurface.mjs.map +1 -0
  11. package/dist/components/Badge.d.mts +1 -1
  12. package/dist/components/Badge.mjs +1 -1
  13. package/dist/components/Button.mjs +3 -3
  14. package/dist/components/Button.mjs.map +1 -1
  15. package/dist/components/CodeBlock.d.mts +3 -1
  16. package/dist/components/CodeBlock.d.mts.map +1 -1
  17. package/dist/components/CodeBlock.mjs +42 -47
  18. package/dist/components/CodeBlock.mjs.map +1 -1
  19. package/dist/components/ComputerRow.d.mts +15 -0
  20. package/dist/components/ComputerRow.d.mts.map +1 -0
  21. package/dist/components/ComputerRow.mjs +107 -0
  22. package/dist/components/ComputerRow.mjs.map +1 -0
  23. package/dist/components/CopyButton.d.mts +13 -0
  24. package/dist/components/CopyButton.d.mts.map +1 -0
  25. package/dist/components/CopyButton.mjs +49 -0
  26. package/dist/components/CopyButton.mjs.map +1 -0
  27. package/dist/components/CountBadge.d.mts +15 -0
  28. package/dist/components/CountBadge.d.mts.map +1 -0
  29. package/dist/components/CountBadge.mjs +49 -0
  30. package/dist/components/CountBadge.mjs.map +1 -0
  31. package/dist/components/CtaCard.d.mts +19 -0
  32. package/dist/components/CtaCard.d.mts.map +1 -0
  33. package/dist/components/CtaCard.mjs +92 -0
  34. package/dist/components/CtaCard.mjs.map +1 -0
  35. package/dist/components/Dialog.d.mts +2 -2
  36. package/dist/components/Dialog.d.mts.map +1 -1
  37. package/dist/components/Dialog.mjs +16 -10
  38. package/dist/components/Dialog.mjs.map +1 -1
  39. package/dist/components/Dot.d.mts +1 -1
  40. package/dist/components/Dot.mjs +2 -2
  41. package/dist/components/DropdownMenu.d.mts +3 -1
  42. package/dist/components/DropdownMenu.d.mts.map +1 -1
  43. package/dist/components/DropdownMenu.mjs +21 -14
  44. package/dist/components/DropdownMenu.mjs.map +1 -1
  45. package/dist/components/EmptyState.d.mts +31 -3
  46. package/dist/components/EmptyState.d.mts.map +1 -1
  47. package/dist/components/EmptyState.mjs +303 -29
  48. package/dist/components/EmptyState.mjs.map +1 -1
  49. package/dist/components/FileList.d.mts +48 -0
  50. package/dist/components/FileList.d.mts.map +1 -0
  51. package/dist/components/FileList.mjs +737 -0
  52. package/dist/components/FileList.mjs.map +1 -0
  53. package/dist/components/FilePreview.d.mts +33 -0
  54. package/dist/components/FilePreview.d.mts.map +1 -0
  55. package/dist/components/FilePreview.mjs +102 -0
  56. package/dist/components/FilePreview.mjs.map +1 -0
  57. package/dist/components/FileViewer.d.mts +57 -0
  58. package/dist/components/FileViewer.d.mts.map +1 -0
  59. package/dist/components/FileViewer.mjs +345 -0
  60. package/dist/components/FileViewer.mjs.map +1 -0
  61. package/dist/components/HashlineLines.d.mts +13 -0
  62. package/dist/components/HashlineLines.d.mts.map +1 -0
  63. package/dist/components/HashlineLines.mjs +153 -0
  64. package/dist/components/HashlineLines.mjs.map +1 -0
  65. package/dist/components/HostFilter.d.mts +17 -0
  66. package/dist/components/HostFilter.d.mts.map +1 -0
  67. package/dist/components/HostFilter.mjs +68 -0
  68. package/dist/components/HostFilter.mjs.map +1 -0
  69. package/dist/components/HostTag.d.mts +7 -0
  70. package/dist/components/HostTag.d.mts.map +1 -0
  71. package/dist/components/HostTag.mjs +48 -0
  72. package/dist/components/HostTag.mjs.map +1 -0
  73. package/dist/components/InfoStrip.d.mts +9 -0
  74. package/dist/components/InfoStrip.d.mts.map +1 -0
  75. package/dist/components/InfoStrip.mjs +53 -0
  76. package/dist/components/InfoStrip.mjs.map +1 -0
  77. package/dist/components/Input.d.mts +3 -1
  78. package/dist/components/Input.d.mts.map +1 -1
  79. package/dist/components/Input.mjs +4 -3
  80. package/dist/components/Input.mjs.map +1 -1
  81. package/dist/components/Label.mjs +1 -1
  82. package/dist/components/LinkText.d.mts +13 -0
  83. package/dist/components/LinkText.d.mts.map +1 -0
  84. package/dist/components/LinkText.mjs +32 -0
  85. package/dist/components/LinkText.mjs.map +1 -0
  86. package/dist/components/List.d.mts.map +1 -1
  87. package/dist/components/List.mjs +50 -11
  88. package/dist/components/List.mjs.map +1 -1
  89. package/dist/components/LiveDuration.d.mts +30 -0
  90. package/dist/components/LiveDuration.d.mts.map +1 -0
  91. package/dist/components/LiveDuration.mjs +67 -0
  92. package/dist/components/LiveDuration.mjs.map +1 -0
  93. package/dist/components/LoadingState.d.mts +17 -0
  94. package/dist/components/LoadingState.d.mts.map +1 -0
  95. package/dist/components/LoadingState.mjs +90 -0
  96. package/dist/components/LoadingState.mjs.map +1 -0
  97. package/dist/components/Markdown.d.mts +24 -2
  98. package/dist/components/Markdown.d.mts.map +1 -1
  99. package/dist/components/Markdown.mjs +356 -27
  100. package/dist/components/Markdown.mjs.map +1 -1
  101. package/dist/components/MessageItem.d.mts +10 -15
  102. package/dist/components/MessageItem.d.mts.map +1 -1
  103. package/dist/components/MessageItem.mjs +94 -68
  104. package/dist/components/MessageItem.mjs.map +1 -1
  105. package/dist/components/NativeShellState.d.mts +30 -0
  106. package/dist/components/NativeShellState.d.mts.map +1 -0
  107. package/dist/components/NativeShellState.mjs +61 -0
  108. package/dist/components/NativeShellState.mjs.map +1 -0
  109. package/dist/components/RailItem.d.mts +13 -0
  110. package/dist/components/RailItem.d.mts.map +1 -0
  111. package/dist/components/RailItem.mjs +61 -0
  112. package/dist/components/RailItem.mjs.map +1 -0
  113. package/dist/components/ReferenceChip.d.mts +18 -0
  114. package/dist/components/ReferenceChip.d.mts.map +1 -0
  115. package/dist/components/ReferenceChip.mjs +38 -0
  116. package/dist/components/ReferenceChip.mjs.map +1 -0
  117. package/dist/components/SectionLabel.mjs +1 -1
  118. package/dist/components/SeekBar.d.mts +17 -0
  119. package/dist/components/SeekBar.d.mts.map +1 -0
  120. package/dist/components/SeekBar.mjs +97 -0
  121. package/dist/components/SeekBar.mjs.map +1 -0
  122. package/dist/components/Select.d.mts +39 -0
  123. package/dist/components/Select.d.mts.map +1 -0
  124. package/dist/components/Select.mjs +288 -0
  125. package/dist/components/Select.mjs.map +1 -0
  126. package/dist/components/Sheet.d.mts +17 -2
  127. package/dist/components/Sheet.d.mts.map +1 -1
  128. package/dist/components/Sheet.mjs +34 -11
  129. package/dist/components/Sheet.mjs.map +1 -1
  130. package/dist/components/SheetFrame.mjs +149 -28
  131. package/dist/components/SheetFrame.mjs.map +1 -1
  132. package/dist/components/SheetList.d.mts +14 -0
  133. package/dist/components/SheetList.d.mts.map +1 -0
  134. package/dist/components/SheetList.mjs +34 -0
  135. package/dist/components/SheetList.mjs.map +1 -0
  136. package/dist/components/ShowMore.d.mts +10 -0
  137. package/dist/components/ShowMore.d.mts.map +1 -0
  138. package/dist/components/ShowMore.mjs +44 -0
  139. package/dist/components/ShowMore.mjs.map +1 -0
  140. package/dist/components/Spinner.d.mts +1 -1
  141. package/dist/components/StatusBadge.d.mts +1 -1
  142. package/dist/components/Switch.d.mts +14 -0
  143. package/dist/components/Switch.d.mts.map +1 -0
  144. package/dist/components/Switch.mjs +37 -0
  145. package/dist/components/Switch.mjs.map +1 -0
  146. package/dist/components/SyntaxLine.d.mts +19 -0
  147. package/dist/components/SyntaxLine.d.mts.map +1 -0
  148. package/dist/components/SyntaxLine.mjs +134 -0
  149. package/dist/components/SyntaxLine.mjs.map +1 -0
  150. package/dist/components/Tabs.d.mts.map +1 -1
  151. package/dist/components/Tabs.mjs +8 -7
  152. package/dist/components/Tabs.mjs.map +1 -1
  153. package/dist/components/ToolPathLink.d.mts +10 -0
  154. package/dist/components/ToolPathLink.d.mts.map +1 -0
  155. package/dist/components/ToolPathLink.mjs +42 -0
  156. package/dist/components/ToolPathLink.mjs.map +1 -0
  157. package/dist/components/ToolResultImage.d.mts +21 -0
  158. package/dist/components/ToolResultImage.d.mts.map +1 -0
  159. package/dist/components/ToolResultImage.mjs +60 -0
  160. package/dist/components/ToolResultImage.mjs.map +1 -0
  161. package/dist/icons/IconColorContext.d.mts +2 -1
  162. package/dist/icons/IconColorContext.d.mts.map +1 -1
  163. package/dist/icons/IconColorContext.mjs.map +1 -1
  164. package/dist/icons/iconGlyphs.d.mts +132 -0
  165. package/dist/icons/iconGlyphs.d.mts.map +1 -1
  166. package/dist/icons/iconGlyphs.mjs +132 -0
  167. package/dist/icons/iconGlyphs.mjs.map +1 -1
  168. package/dist/icons/icons.d.mts +133 -1
  169. package/dist/icons/icons.d.mts.map +1 -1
  170. package/dist/icons/icons.mjs +35 -2
  171. package/dist/icons/icons.mjs.map +1 -1
  172. package/dist/index.d.mts +31 -7
  173. package/dist/index.mjs +36 -12
  174. package/dist/lib/fileKindLabel.mjs +17 -0
  175. package/dist/lib/fileKindLabel.mjs.map +1 -0
  176. package/dist/lib/fonts.d.mts +3 -1
  177. package/dist/lib/fonts.d.mts.map +1 -1
  178. package/dist/lib/fonts.mjs +4 -2
  179. package/dist/lib/fonts.mjs.map +1 -1
  180. package/dist/lib/insideSheet.d.mts +10 -0
  181. package/dist/lib/insideSheet.d.mts.map +1 -0
  182. package/dist/lib/markdown.mjs +310 -23
  183. package/dist/lib/markdown.mjs.map +1 -1
  184. package/dist/lib/reading.mjs +60 -0
  185. package/dist/lib/reading.mjs.map +1 -0
  186. package/dist/lib/useControllable.mjs +14 -6
  187. package/dist/lib/useControllable.mjs.map +1 -1
  188. package/dist/lib/useReadingPage.mjs +33 -0
  189. package/dist/lib/useReadingPage.mjs.map +1 -0
  190. package/dist/po-runtime-identity.json +1 -0
  191. package/dist/shell.d.mts +6 -0
  192. package/dist/shell.mjs +7 -0
  193. package/locales/vi.json +112 -0
  194. package/locales/zh-CN.json +112 -0
  195. package/package.json +43 -30
@@ -0,0 +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","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,IACtC,oBAAC,YAAD;IACE,MAAK;IACL,SAAQ;IACR,MAAM,oBAAC,YAAD,EAAY,MAAM,GAAG;IAC3B,OAAOH,EAAE,wCAAwC,kBAAkB;IACnE,aAAaJ;GAAU,KAEvB;GACHN,MAAMe,KAAKzB,SACV,qBAAC,QAAD;IAEE,SAASiB,OAAO,YAAY;IAC5B,MAAK;IACL,oBAAoBG,EAAE,kCAAkC,eAAe,EAAEvB,MAAMG,KAAKH,KAAK,CAAC;IAC1F,QAAQ,QAAQG,KAAKH;IACrB,eAAec,OAAOX,KAAKH,IAAI;IAC/B,OAAOwB,OAAOrB;cAPhB,CASE,oBAAC,UAAD;KAAU,MAAM;KAAI,OAAM;IAAK,IAC/B,qBAAC,MAAD;KAAM,OAAOqB,OAAON;eAApB;MACE,oBAAC,MAAD;OAAM,eAAe;OAAG,OAAOM,OAAOK;iBACnC1B,KAAK0B;MACF;MACL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Mc,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"}
@@ -0,0 +1,33 @@
1
+ import { FileTextPreview } from "@agimon-ai/po-web-components/text";
2
+ import { ReactNode } from "react";
3
+ //#region src/components/FilePreview.d.ts
4
+ export interface FilePreviewProps {
5
+ preview: FileTextPreview;
6
+ /** Keeps host-rendered previews of one file apart from another folder's file with the same path. */
7
+ scopeKey: string;
8
+ /** The host's sandboxed HTML view, when it has one. */
9
+ renderFilePreview?: (request: {
10
+ key: string;
11
+ html: string;
12
+ title: string;
13
+ }) => ReactNode;
14
+ /** The host's media view for bounded bytes the owner fetched. */
15
+ renderMediaPreview?: (request: {
16
+ key: string;
17
+ data: string;
18
+ mimeType: string;
19
+ title?: string;
20
+ path?: string;
21
+ }) => ReactNode;
22
+ media?: {
23
+ data: string;
24
+ mimeType: string;
25
+ };
26
+ mediaError?: string;
27
+ /** Opens a file the markdown links to, already resolved inside the same folder. */
28
+ onOpen: (path: string) => void;
29
+ }
30
+ /** One file's bounded preview on the phone; the host receives only content the owner fetched through its route. */
31
+ export declare function FilePreview({ preview, scopeKey, renderFilePreview, renderMediaPreview, media, mediaError, onOpen }: FilePreviewProps): import("react").JSX.Element;
32
+ //#endregion
33
+ //# sourceMappingURL=FilePreview.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilePreview.d.mts","names":[],"sources":["../../src/components/FilePreview.tsx"],"mappings":";;;iBAUiB;EACf,SAAS;;EAET;;EAEA,qBAAqB;IAAW;IAAa;IAAc;QAAoB;;EAE/E,sBAAsB;IACpB;IACA;IACA;IACA;IACA;QACI;EACN;IAAU;IAAc;;EACxB;;EAEA,SAAS;;;wBAIK,cACd,SACA,UACA,mBACA,oBACA,OACA,YACA,UACC,mCAAgB,IAAA"}
@@ -0,0 +1,102 @@
1
+ import { fontOf } from "../lib/fonts.mjs";
2
+ import { CodeBlock } from "./CodeBlock.mjs";
3
+ import { Markdown } from "./Markdown.mjs";
4
+ import { fileAssetPath, filePreviewMode } from "@agimon-ai/po-web-components/text";
5
+ import { View } from "react-native-unistyles/components/native/View";
6
+ import { Text } from "react-native-unistyles/components/native/Text";
7
+ import { StyleSheet } from "react-native-unistyles";
8
+ import { Fragment, jsx } from "react/jsx-runtime";
9
+ import { useT } from "@agimon-ai/po-core/native";
10
+
11
+ //#region src/components/FilePreview.tsx
12
+ /** One file's bounded preview on the phone; the host receives only content the owner fetched through its route. */
13
+ function FilePreview({ preview, scopeKey, renderFilePreview, renderMediaPreview, media, mediaError, onOpen }) {
14
+ const t = useT();
15
+ const mode = filePreviewMode(preview.path);
16
+ if (mode === "media") {
17
+ if (mediaError) return /* @__PURE__ */ jsx(Text, {
18
+ accessibilityRole: "alert",
19
+ style: styles.error,
20
+ children: mediaError
21
+ });
22
+ if (!renderMediaPreview) return /* @__PURE__ */ jsx(Text, {
23
+ style: styles.meta,
24
+ children: t("nativeComponents.filePreview.noMedia", "This host cannot display this media preview.")
25
+ });
26
+ if (!media) return /* @__PURE__ */ jsx(Text, {
27
+ style: styles.meta,
28
+ children: t("nativeComponents.filePreview.loadingMedia", "Loading media...")
29
+ });
30
+ return /* @__PURE__ */ jsx(Fragment, { children: renderMediaPreview({
31
+ key: `file-media-${scopeKey}-${preview.path}`,
32
+ title: preview.path,
33
+ path: preview.path,
34
+ data: media.data,
35
+ mimeType: media.mimeType
36
+ }) });
37
+ }
38
+ if (preview.unavailable) return /* @__PURE__ */ jsx(Text, {
39
+ style: styles.meta,
40
+ children: preview.reason ?? t("nativeComponents.filePreview.unavailable", "This file cannot be previewed.")
41
+ });
42
+ if (mode === "html") return renderFilePreview ? /* @__PURE__ */ jsx(View, {
43
+ style: styles.html,
44
+ children: renderFilePreview({
45
+ key: `file-html-${scopeKey}-${preview.path}`,
46
+ html: preview.content,
47
+ title: preview.path
48
+ })
49
+ }) : /* @__PURE__ */ jsx(Text, {
50
+ style: styles.meta,
51
+ children: t("nativeComponents.filePreview.noHtml", "This host cannot display HTML previews.")
52
+ });
53
+ if (mode === "markdown") return /* @__PURE__ */ jsx(Markdown, {
54
+ text: preview.content,
55
+ onFileLink: (path) => {
56
+ try {
57
+ const resolved = fileAssetPath(preview.path, path);
58
+ return () => onOpen(resolved);
59
+ } catch {
60
+ return;
61
+ }
62
+ }
63
+ });
64
+ if (mode === "code") return /* @__PURE__ */ jsx(CodeBlock, {
65
+ text: preview.content,
66
+ language: preview.path.split(".").at(-1)
67
+ });
68
+ return /* @__PURE__ */ jsx(Text, {
69
+ selectable: true,
70
+ style: styles.text,
71
+ children: preview.content
72
+ });
73
+ }
74
+ const styles = StyleSheet.create((theme) => ({
75
+ html: {
76
+ minHeight: theme.spacing(90),
77
+ uni__dependencies: [0]
78
+ },
79
+ text: {
80
+ fontFamily: fontOf(theme.fontFamily.mono),
81
+ fontSize: theme.fontSize.sm,
82
+ lineHeight: theme.lineHeight.sm,
83
+ color: theme.colors.text,
84
+ uni__dependencies: [0]
85
+ },
86
+ meta: {
87
+ fontFamily: fontOf(theme.fontFamily.sans),
88
+ fontSize: theme.fontSize.sm,
89
+ color: theme.colors.dim,
90
+ uni__dependencies: [0]
91
+ },
92
+ error: {
93
+ fontFamily: fontOf(theme.fontFamily.sans),
94
+ fontSize: theme.fontSize.sm,
95
+ color: theme.colors.red,
96
+ uni__dependencies: [0]
97
+ }
98
+ }));
99
+
100
+ //#endregion
101
+ export { FilePreview };
102
+ //# sourceMappingURL=FilePreview.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilePreview.mjs","names":["useT","fileAssetPath","filePreviewMode","FileTextPreview","ReactNode","StyleSheet","fontOf","CodeBlock","Markdown","FilePreviewProps","preview","scopeKey","renderFilePreview","request","key","html","title","renderMediaPreview","data","mimeType","path","media","mediaError","onOpen","FilePreview","t","mode","styles","error","meta","unavailable","reason","content","resolved","undefined","split","at","text","create","theme","minHeight","spacing","uni__dependencies","fontFamily","mono","fontSize","sm","lineHeight","color","colors","sans","dim","red"],"sources":["../../src/components/FilePreview.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport { fileAssetPath, filePreviewMode, type FileTextPreview } from '@agimon-ai/po-web-components/text';\nimport type { ReactNode } from 'react';\nimport { Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { CodeBlock } from './CodeBlock';\nimport { Markdown } from './Markdown';\n\nexport interface FilePreviewProps {\n preview: FileTextPreview;\n /** Keeps host-rendered previews of one file apart from another folder's file with the same path. */\n scopeKey: string;\n /** The host's sandboxed HTML view, when it has one. */\n renderFilePreview?: (request: { key: string; html: string; title: string }) => ReactNode;\n /** The host's media view for bounded bytes the owner fetched. */\n renderMediaPreview?: (request: {\n key: string;\n data: string;\n mimeType: string;\n title?: string;\n path?: string;\n }) => ReactNode;\n media?: { data: string; mimeType: string };\n mediaError?: string;\n /** Opens a file the markdown links to, already resolved inside the same folder. */\n onOpen: (path: string) => void;\n}\n\n/** One file's bounded preview on the phone; the host receives only content the owner fetched through its route. */\nexport function FilePreview({\n preview,\n scopeKey,\n renderFilePreview,\n renderMediaPreview,\n media,\n mediaError,\n onOpen,\n}: FilePreviewProps) {\n const t = useT();\n const mode = filePreviewMode(preview.path);\n if (mode === 'media') {\n if (mediaError)\n return (\n <Text accessibilityRole=\"alert\" style={styles.error}>\n {mediaError}\n </Text>\n );\n if (!renderMediaPreview)\n return (\n <Text style={styles.meta}>\n {t('nativeComponents.filePreview.noMedia', 'This host cannot display this media preview.')}\n </Text>\n );\n if (!media)\n return <Text style={styles.meta}>{t('nativeComponents.filePreview.loadingMedia', 'Loading media...')}</Text>;\n return (\n <>\n {renderMediaPreview({\n key: `file-media-${scopeKey}-${preview.path}`,\n title: preview.path,\n path: preview.path,\n data: media.data,\n mimeType: media.mimeType,\n })}\n </>\n );\n }\n if (preview.unavailable)\n return (\n <Text style={styles.meta}>\n {preview.reason ?? t('nativeComponents.filePreview.unavailable', 'This file cannot be previewed.')}\n </Text>\n );\n if (mode === 'html') {\n return renderFilePreview ? (\n <View style={styles.html}>\n {renderFilePreview({\n key: `file-html-${scopeKey}-${preview.path}`,\n html: preview.content,\n title: preview.path,\n })}\n </View>\n ) : (\n <Text style={styles.meta}>\n {t('nativeComponents.filePreview.noHtml', 'This host cannot display HTML previews.')}\n </Text>\n );\n }\n if (mode === 'markdown') {\n return (\n <Markdown\n text={preview.content}\n onFileLink={(path) => {\n try {\n const resolved = fileAssetPath(preview.path, path);\n return () => onOpen(resolved);\n } catch {\n // An out-of-folder or non-file link is not a file action.\n return undefined;\n }\n }}\n />\n );\n }\n if (mode === 'code') return <CodeBlock text={preview.content} language={preview.path.split('.').at(-1)} />;\n return (\n <Text selectable style={styles.text}>\n {preview.content}\n </Text>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n html: { minHeight: theme.spacing(90) },\n text: {\n fontFamily: fontOf(theme.fontFamily.mono),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n color: theme.colors.text,\n },\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":";;;;;;;;;;;;AA+BA,SAAgBwB,YAAY,EAC1Bd,SACAC,UACAC,mBACAK,oBACAI,OACAC,YACAC,UACmB;CACnB,MAAME,IAAIzB,KAAK;CACf,MAAM0B,OAAOxB,gBAAgBQ,QAAQU,IAAI;CACzC,IAAIM,SAAS,SAAS;EACpB,IAAIJ,YACF,OACE,oBAAC,MAAD;GAAM,mBAAkB;GAAQ,OAAOK,OAAOC;aAC3CN;EACG;EAEV,IAAI,CAACL,oBACH,OACE,oBAAC,M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Q,EAAE;EAACC,mBAAA,CAAA,CAAA;CAAC;CACrCL,MAAM;EACJM,YAAYrC,OAAOiC,MAAMI,WAAWC,IAAI;EACxCC,UAAUN,MAAMM,SAASC;EACzBC,YAAYR,MAAMQ,WAAWD;EAC7BE,OAAOT,MAAMU,OAAOZ;EAAIK,mBAAA,CAAA,CAAA;CAC1B;CACAb,MAAM;EAAEc,YAAYrC,OAAOiC,MAAMI,WAAWO,IAAI;EAAGL,UAAUN,MAAMM,SAASC;EAAIE,OAAOT,MAAMU,OAAOE;EAAGT,mBAAA,CAAA,CAAA;CAAC;CACxGd,OAAO;EAAEe,YAAYrC,OAAOiC,MAAMI,WAAWO,IAAI;EAAGL,UAAUN,MAAMM,SAASC;EAAIE,OAAOT,MAAMU,OAAOG;EAAGV,mBAAA,CAAA,CAAA;CAAC;AAC3G,EAAE"}
@@ -0,0 +1,57 @@
1
+ import { FilePreviewProps } from "./FilePreview.mjs";
2
+ import { BoundedFileSource, FileTextPreview } from "@agimon-ai/po-web-components/text";
3
+ import { ReactNode } from "react";
4
+ //#region src/components/FileViewer.d.ts
5
+ export interface FileViewerProps {
6
+ path: string;
7
+ /** The listed file, for its size and modified time; changes to it reload the preview. */
8
+ item?: {
9
+ size: number;
10
+ modifiedAt: number;
11
+ };
12
+ /** Keeps this folder's previews and downloads apart from another folder's file with the same path. */
13
+ scopeKey: string;
14
+ loadPreview: (signal: AbortSignal) => Promise<FileTextPreview>;
15
+ /** Whole small media, base64 encoded by the owner. */
16
+ loadMedia?: (signal: AbortSignal) => Promise<{
17
+ data: string;
18
+ mimeType: string;
19
+ }>;
20
+ /** A bounded source the host saves; without it there is no download. */
21
+ prepareSave?: (signal: AbortSignal) => Promise<BoundedFileSource>;
22
+ nativeSaveFile?: (source: BoundedFileSource) => Promise<void>;
23
+ renderFilePreview?: FilePreviewProps['renderFilePreview'];
24
+ renderMediaPreview?: FilePreviewProps['renderMediaPreview'];
25
+ /** The native top bar of the tab screen; absent in older hosts, where the viewer draws its own header. */
26
+ setTabHeader?: (header: {
27
+ subtitle?: string;
28
+ action?: ReactNode;
29
+ }) => void;
30
+ onOpenPath: (path: string) => void;
31
+ /** Above the preview, such as the owner's move action. */
32
+ actions?: ReactNode;
33
+ note?: string;
34
+ /** Shown instead of the preview when the owner cannot read files, such as an unavailable session. */
35
+ unavailable?: string;
36
+ /** Shown instead of the preview, such as an EmptyState for a folder, a missing file or a failed read. */
37
+ status?: ReactNode;
38
+ }
39
+ /** One file on the phone: header or top-bar download, the bounded preview, and the path strip. */
40
+ export declare function FileViewer(props: FileViewerProps): import("react").JSX.Element;
41
+ /** Where the file lives and when it last changed, pinned under the preview. */
42
+ export declare function FilePathStrip({ path, modifiedAt }: {
43
+ path: string;
44
+ modifiedAt?: number;
45
+ }): import("react").JSX.Element;
46
+ /** The viewer's quiet header: where the file lives, what it is, and the one action on it. */
47
+ export declare function FileViewerHeader({ path, size, saving, canSave, disabled, onDownload, onCancel }: {
48
+ path: string;
49
+ size?: number;
50
+ saving: boolean;
51
+ canSave: boolean;
52
+ disabled: boolean;
53
+ onDownload: () => void;
54
+ onCancel: () => void;
55
+ }): import("react").JSX.Element;
56
+ //#endregion
57
+ //# sourceMappingURL=FileViewer.d.mts.map
@@ -0,0 +1 @@
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"}