@agimon-ai/po-native-components 0.0.0-alpha.2 → 0.0.0-alpha.200

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 (197) hide show
  1. package/LICENSE +1 -2
  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 +2 -2
  13. package/dist/components/Badge.mjs.map +1 -1
  14. package/dist/components/Button.mjs +4 -4
  15. package/dist/components/Button.mjs.map +1 -1
  16. package/dist/components/CodeBlock.d.mts +3 -1
  17. package/dist/components/CodeBlock.d.mts.map +1 -1
  18. package/dist/components/CodeBlock.mjs +42 -47
  19. package/dist/components/CodeBlock.mjs.map +1 -1
  20. package/dist/components/ComputerRow.d.mts +15 -0
  21. package/dist/components/ComputerRow.d.mts.map +1 -0
  22. package/dist/components/ComputerRow.mjs +107 -0
  23. package/dist/components/ComputerRow.mjs.map +1 -0
  24. package/dist/components/CopyButton.d.mts +13 -0
  25. package/dist/components/CopyButton.d.mts.map +1 -0
  26. package/dist/components/CopyButton.mjs +49 -0
  27. package/dist/components/CopyButton.mjs.map +1 -0
  28. package/dist/components/CountBadge.d.mts +15 -0
  29. package/dist/components/CountBadge.d.mts.map +1 -0
  30. package/dist/components/CountBadge.mjs +49 -0
  31. package/dist/components/CountBadge.mjs.map +1 -0
  32. package/dist/components/CtaCard.d.mts +19 -0
  33. package/dist/components/CtaCard.d.mts.map +1 -0
  34. package/dist/components/CtaCard.mjs +92 -0
  35. package/dist/components/CtaCard.mjs.map +1 -0
  36. package/dist/components/Dialog.d.mts +2 -2
  37. package/dist/components/Dialog.d.mts.map +1 -1
  38. package/dist/components/Dialog.mjs +18 -12
  39. package/dist/components/Dialog.mjs.map +1 -1
  40. package/dist/components/Dot.d.mts +1 -1
  41. package/dist/components/Dot.mjs +3 -3
  42. package/dist/components/Dot.mjs.map +1 -1
  43. package/dist/components/DropdownMenu.d.mts +3 -1
  44. package/dist/components/DropdownMenu.d.mts.map +1 -1
  45. package/dist/components/DropdownMenu.mjs +21 -14
  46. package/dist/components/DropdownMenu.mjs.map +1 -1
  47. package/dist/components/EmptyState.d.mts +31 -3
  48. package/dist/components/EmptyState.d.mts.map +1 -1
  49. package/dist/components/EmptyState.mjs +303 -29
  50. package/dist/components/EmptyState.mjs.map +1 -1
  51. package/dist/components/FileList.d.mts +46 -0
  52. package/dist/components/FileList.d.mts.map +1 -0
  53. package/dist/components/FileList.mjs +727 -0
  54. package/dist/components/FileList.mjs.map +1 -0
  55. package/dist/components/FilePreview.d.mts +33 -0
  56. package/dist/components/FilePreview.d.mts.map +1 -0
  57. package/dist/components/FilePreview.mjs +102 -0
  58. package/dist/components/FilePreview.mjs.map +1 -0
  59. package/dist/components/FileViewer.d.mts +57 -0
  60. package/dist/components/FileViewer.d.mts.map +1 -0
  61. package/dist/components/FileViewer.mjs +335 -0
  62. package/dist/components/FileViewer.mjs.map +1 -0
  63. package/dist/components/HashlineLines.d.mts +13 -0
  64. package/dist/components/HashlineLines.d.mts.map +1 -0
  65. package/dist/components/HashlineLines.mjs +153 -0
  66. package/dist/components/HashlineLines.mjs.map +1 -0
  67. package/dist/components/HostFilter.d.mts +17 -0
  68. package/dist/components/HostFilter.d.mts.map +1 -0
  69. package/dist/components/HostFilter.mjs +68 -0
  70. package/dist/components/HostFilter.mjs.map +1 -0
  71. package/dist/components/HostTag.d.mts +7 -0
  72. package/dist/components/HostTag.d.mts.map +1 -0
  73. package/dist/components/HostTag.mjs +48 -0
  74. package/dist/components/HostTag.mjs.map +1 -0
  75. package/dist/components/InfoStrip.d.mts +9 -0
  76. package/dist/components/InfoStrip.d.mts.map +1 -0
  77. package/dist/components/InfoStrip.mjs +53 -0
  78. package/dist/components/InfoStrip.mjs.map +1 -0
  79. package/dist/components/Input.d.mts +3 -1
  80. package/dist/components/Input.d.mts.map +1 -1
  81. package/dist/components/Input.mjs +5 -4
  82. package/dist/components/Input.mjs.map +1 -1
  83. package/dist/components/Label.mjs +1 -1
  84. package/dist/components/LinkText.d.mts +13 -0
  85. package/dist/components/LinkText.d.mts.map +1 -0
  86. package/dist/components/LinkText.mjs +32 -0
  87. package/dist/components/LinkText.mjs.map +1 -0
  88. package/dist/components/List.d.mts.map +1 -1
  89. package/dist/components/List.mjs +50 -11
  90. package/dist/components/List.mjs.map +1 -1
  91. package/dist/components/LiveDuration.d.mts +30 -0
  92. package/dist/components/LiveDuration.d.mts.map +1 -0
  93. package/dist/components/LiveDuration.mjs +67 -0
  94. package/dist/components/LiveDuration.mjs.map +1 -0
  95. package/dist/components/LoadingState.d.mts +17 -0
  96. package/dist/components/LoadingState.d.mts.map +1 -0
  97. package/dist/components/LoadingState.mjs +90 -0
  98. package/dist/components/LoadingState.mjs.map +1 -0
  99. package/dist/components/Markdown.d.mts +24 -2
  100. package/dist/components/Markdown.d.mts.map +1 -1
  101. package/dist/components/Markdown.mjs +356 -27
  102. package/dist/components/Markdown.mjs.map +1 -1
  103. package/dist/components/MessageItem.d.mts +10 -15
  104. package/dist/components/MessageItem.d.mts.map +1 -1
  105. package/dist/components/MessageItem.mjs +94 -68
  106. package/dist/components/MessageItem.mjs.map +1 -1
  107. package/dist/components/NativeShellState.d.mts +30 -0
  108. package/dist/components/NativeShellState.d.mts.map +1 -0
  109. package/dist/components/NativeShellState.mjs +61 -0
  110. package/dist/components/NativeShellState.mjs.map +1 -0
  111. package/dist/components/RailItem.d.mts +13 -0
  112. package/dist/components/RailItem.d.mts.map +1 -0
  113. package/dist/components/RailItem.mjs +61 -0
  114. package/dist/components/RailItem.mjs.map +1 -0
  115. package/dist/components/ReferenceChip.d.mts +18 -0
  116. package/dist/components/ReferenceChip.d.mts.map +1 -0
  117. package/dist/components/ReferenceChip.mjs +38 -0
  118. package/dist/components/ReferenceChip.mjs.map +1 -0
  119. package/dist/components/SectionLabel.mjs +1 -1
  120. package/dist/components/SeekBar.d.mts +17 -0
  121. package/dist/components/SeekBar.d.mts.map +1 -0
  122. package/dist/components/SeekBar.mjs +97 -0
  123. package/dist/components/SeekBar.mjs.map +1 -0
  124. package/dist/components/SegmentedControl.d.mts.map +1 -1
  125. package/dist/components/SegmentedControl.mjs.map +1 -1
  126. package/dist/components/Select.d.mts +39 -0
  127. package/dist/components/Select.d.mts.map +1 -0
  128. package/dist/components/Select.mjs +288 -0
  129. package/dist/components/Select.mjs.map +1 -0
  130. package/dist/components/Sheet.d.mts +17 -2
  131. package/dist/components/Sheet.d.mts.map +1 -1
  132. package/dist/components/Sheet.mjs +34 -11
  133. package/dist/components/Sheet.mjs.map +1 -1
  134. package/dist/components/SheetFrame.mjs +150 -29
  135. package/dist/components/SheetFrame.mjs.map +1 -1
  136. package/dist/components/SheetList.d.mts +14 -0
  137. package/dist/components/SheetList.d.mts.map +1 -0
  138. package/dist/components/SheetList.mjs +34 -0
  139. package/dist/components/SheetList.mjs.map +1 -0
  140. package/dist/components/ShowMore.d.mts +10 -0
  141. package/dist/components/ShowMore.d.mts.map +1 -0
  142. package/dist/components/ShowMore.mjs +44 -0
  143. package/dist/components/ShowMore.mjs.map +1 -0
  144. package/dist/components/Spinner.d.mts +1 -1
  145. package/dist/components/StatusBadge.d.mts +1 -1
  146. package/dist/components/Switch.d.mts +14 -0
  147. package/dist/components/Switch.d.mts.map +1 -0
  148. package/dist/components/Switch.mjs +37 -0
  149. package/dist/components/Switch.mjs.map +1 -0
  150. package/dist/components/SyntaxLine.d.mts +19 -0
  151. package/dist/components/SyntaxLine.d.mts.map +1 -0
  152. package/dist/components/SyntaxLine.mjs +134 -0
  153. package/dist/components/SyntaxLine.mjs.map +1 -0
  154. package/dist/components/Tabs.d.mts.map +1 -1
  155. package/dist/components/Tabs.mjs +8 -7
  156. package/dist/components/Tabs.mjs.map +1 -1
  157. package/dist/components/ToolPathLink.d.mts +10 -0
  158. package/dist/components/ToolPathLink.d.mts.map +1 -0
  159. package/dist/components/ToolPathLink.mjs +42 -0
  160. package/dist/components/ToolPathLink.mjs.map +1 -0
  161. package/dist/components/ToolResultImage.d.mts +21 -0
  162. package/dist/components/ToolResultImage.d.mts.map +1 -0
  163. package/dist/components/ToolResultImage.mjs +60 -0
  164. package/dist/components/ToolResultImage.mjs.map +1 -0
  165. package/dist/icons/IconColorContext.d.mts +2 -1
  166. package/dist/icons/IconColorContext.d.mts.map +1 -1
  167. package/dist/icons/IconColorContext.mjs.map +1 -1
  168. package/dist/icons/iconGlyphs.d.mts +206 -54
  169. package/dist/icons/iconGlyphs.d.mts.map +1 -1
  170. package/dist/icons/iconGlyphs.mjs +152 -0
  171. package/dist/icons/iconGlyphs.mjs.map +1 -1
  172. package/dist/icons/icons.d.mts +153 -1
  173. package/dist/icons/icons.d.mts.map +1 -1
  174. package/dist/icons/icons.mjs +40 -2
  175. package/dist/icons/icons.mjs.map +1 -1
  176. package/dist/index.d.mts +31 -7
  177. package/dist/index.mjs +36 -12
  178. package/dist/lib/fileKindLabel.mjs +17 -0
  179. package/dist/lib/fileKindLabel.mjs.map +1 -0
  180. package/dist/lib/fonts.d.mts +3 -1
  181. package/dist/lib/fonts.d.mts.map +1 -1
  182. package/dist/lib/fonts.mjs +4 -2
  183. package/dist/lib/fonts.mjs.map +1 -1
  184. package/dist/lib/insideSheet.d.mts +10 -0
  185. package/dist/lib/insideSheet.d.mts.map +1 -0
  186. package/dist/lib/markdown.mjs +310 -23
  187. package/dist/lib/markdown.mjs.map +1 -1
  188. package/dist/lib/reading.mjs +60 -0
  189. package/dist/lib/reading.mjs.map +1 -0
  190. package/dist/lib/useControllable.mjs +14 -6
  191. package/dist/lib/useControllable.mjs.map +1 -1
  192. package/dist/lib/useReadingPage.mjs +33 -0
  193. package/dist/lib/useReadingPage.mjs.map +1 -0
  194. package/dist/po-runtime-identity.json +1 -0
  195. package/dist/shell.d.mts +6 -0
  196. package/dist/shell.mjs +7 -0
  197. package/package.json +41 -31
@@ -1 +1 @@
1
- {"version":3,"file":"Button.mjs","names":["NativeColorToken","withAlpha","ReactNode","PressableProps","StyleProp","ViewStyle","StyleSheet","useUnistyles","IconColorContext","fontOf","impactLight","wrapText","Spinner","ButtonVariant","ButtonSize","MIN_TAP_TARGET","DISABLED_OPACITY","PRESSED_FILL_OPACITY","RIPPLE_ALPHA_PERCENT","PRESSED_EDGE_ALPHA_PERCENT","SIZE_HEIGHT","Readonly","Record","xs","sm","md","lg","icon","card","INK","rest","pressed","primary","secondary","outline","ghost","subtle","danger","success","link","HAPTIC_VARIANTS","ReadonlySet","Set","ButtonProps","Omit","variant","size","loading","loadingLabel","children","style","Button","disabled","onPress","hitSlop","accessibilityState","props","theme","_styles","styles","useVariants","inactive","slop","Math","max","ink","busy","undefined","text","color","colors","borderless","event","has","button","borderColor","green","token","label","labelPressed","create","flexDirection","alignItems","justifyContent","gap","spacing","borderRadius","borderWidth","overflow","variants","backgroundColor","selected","border","panel","red","height","paddingHorizontal","DEFAULT","width","padding","alignSelf","minHeight","paddingVertical","uni__dependencies","opacity","deep","fontFamily","sans","fontWeight","medium","semibold","fontSize","lineHeight","base","textDecorationLine"],"sources":["../../src/components/Button.tsx"],"sourcesContent":["import { type NativeColorToken, withAlpha } from '@agimon-ai/po-web-components/nativeTheme';\nimport type { ReactNode } from 'react';\nimport { Pressable, type PressableProps, type StyleProp, type ViewStyle } from 'react-native';\nimport { StyleSheet, useUnistyles } from 'react-native-unistyles';\n\nimport { IconColorContext } from '../icons/IconColorContext';\nimport { fontOf } from '../lib/fonts';\nimport { impactLight } from '../lib/haptics';\nimport { wrapText } from '../lib/wrapText';\nimport { Spinner } from './Spinner';\n\nexport type ButtonVariant =\n | 'primary'\n | 'secondary'\n | 'outline'\n | 'ghost'\n | 'subtle'\n | 'danger'\n | 'danger-outline'\n | 'success'\n | 'link';\nexport type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'icon' | 'icon-md' | 'card';\n\n/** Apple's and Google's minimum tap target; a smaller visual box makes up the rest with hitSlop. */\nconst MIN_TAP_TARGET = 44;\nconst DISABLED_OPACITY = 0.4;\nconst PRESSED_FILL_OPACITY = 0.85;\nconst RIPPLE_ALPHA_PERCENT = 20;\n/** `hover:border-doom-green/50`. */\nconst PRESSED_EDGE_ALPHA_PERCENT = 50;\n\n/** The visual height of each size, from which hitSlop pads the tap target to 44pt. */\nconst SIZE_HEIGHT: Readonly<Record<ButtonSize, number>> = {\n xs: 24,\n sm: 28,\n md: 32,\n lg: 36,\n icon: 24,\n 'icon-md': 32,\n card: MIN_TAP_TARGET,\n};\n\n/** The label ink of each variant, and the ink it lifts to while pressed (the web hover). */\nconst INK: Readonly<Record<ButtonVariant, { rest: NativeColorToken; pressed: NativeColorToken }>> = {\n primary: { rest: 'on-selected', pressed: 'on-selected' },\n secondary: { rest: 'magenta', pressed: 'magenta' },\n outline: { rest: 'dim', pressed: 'hi' },\n ghost: { rest: 'dim', pressed: 'hi' },\n subtle: { rest: 'dim', pressed: 'hi' },\n danger: { rest: 'rail', pressed: 'rail' },\n 'danger-outline': { rest: 'red', pressed: 'red' },\n success: { rest: 'rail', pressed: 'rail' },\n link: { rest: 'blue', pressed: 'blue' },\n};\n\n/** Presses that commit something get a light impact; the rest stay quiet. */\nconst HAPTIC_VARIANTS: ReadonlySet<ButtonVariant> = new Set(['primary', 'danger', 'success']);\n\nexport interface ButtonProps extends Omit<PressableProps, 'children' | 'style'> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n /** Work is in flight: the button shows a spinner and stops accepting presses. */\n loading?: boolean;\n /** What the spinner announces while loading; omit it and the wait is silent. */\n loadingLabel?: string;\n /** A bare string is drawn as the label; elements (an icon, a card's lines) render as given. */\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The one button: every variant is a theme token, a press dims or lifts it, and committing presses buzz once. */\nexport function Button({\n variant = 'outline',\n size = 'md',\n loading = false,\n loadingLabel,\n disabled,\n onPress,\n children,\n style,\n hitSlop,\n accessibilityState,\n ...props\n}: ButtonProps) {\n const { theme } = useUnistyles();\n styles.useVariants({ variant, size });\n const inactive = (disabled ?? false) || loading;\n const slop = Math.max(0, (MIN_TAP_TARGET - SIZE_HEIGHT[size]) / 2);\n const ink = INK[variant];\n return (\n <Pressable\n accessibilityRole={variant === 'link' ? 'link' : 'button'}\n accessibilityState={{ ...accessibilityState, disabled: inactive, busy: loading }}\n accessibilityValue={loading && loadingLabel !== undefined ? { text: loadingLabel } : undefined}\n disabled={inactive}\n hitSlop={hitSlop ?? slop}\n android_ripple={{ color: withAlpha(theme.colors[ink.pressed], RIPPLE_ALPHA_PERCENT), borderless: false }}\n onPress={(event) => {\n if (HAPTIC_VARIANTS.has(variant)) impactLight();\n onPress?.(event);\n }}\n style={({ pressed }) => [\n styles.button,\n pressed && styles.pressed,\n // Alpha mixes are computed in render from useUnistyles(), not in StyleSheet.create: on web Unistyles hands\n // the stylesheet CSS variables, which withAlpha cannot read.\n pressed && variant === 'outline' && { borderColor: withAlpha(theme.colors.green, PRESSED_EDGE_ALPHA_PERCENT) },\n inactive && styles.disabled,\n style,\n ]}\n {...props}\n >\n {({ pressed }) => {\n const token = pressed ? ink.pressed : ink.rest;\n return (\n <IconColorContext.Provider value={token}>\n {loading ? <Spinner color={token} /> : null}\n {wrapText(children, [styles.label, pressed && styles.labelPressed, { color: theme.colors[token] }])}\n </IconColorContext.Provider>\n );\n }}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n button: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n gap: theme.spacing(1.5),\n borderRadius: theme.borderRadius.md,\n borderWidth: 1,\n borderColor: 'transparent',\n overflow: 'hidden',\n variants: {\n variant: {\n primary: { backgroundColor: theme.colors.selected },\n secondary: { borderColor: theme.colors['edge-magenta'], backgroundColor: theme.colors['tint-magenta'] },\n outline: { borderColor: theme.colors.border },\n ghost: {},\n subtle: { backgroundColor: theme.colors.panel },\n danger: { backgroundColor: theme.colors.red },\n 'danger-outline': { borderColor: theme.colors['edge-red'], backgroundColor: theme.colors['tint-red'] },\n success: { backgroundColor: theme.colors.green },\n link: {},\n },\n size: {\n xs: { height: SIZE_HEIGHT.xs, paddingHorizontal: theme.spacing(1.5), borderRadius: theme.borderRadius.DEFAULT },\n sm: { height: SIZE_HEIGHT.sm, paddingHorizontal: theme.spacing(2.5) },\n md: { height: SIZE_HEIGHT.md, paddingHorizontal: theme.spacing(3) },\n lg: { height: SIZE_HEIGHT.lg, paddingHorizontal: theme.spacing(3.5) },\n icon: {\n width: SIZE_HEIGHT.icon,\n height: SIZE_HEIGHT.icon,\n padding: 0,\n borderRadius: theme.borderRadius.DEFAULT,\n },\n 'icon-md': { width: SIZE_HEIGHT['icon-md'], height: SIZE_HEIGHT['icon-md'], padding: 0 },\n card: {\n alignSelf: 'stretch',\n flexDirection: 'column',\n alignItems: 'stretch',\n justifyContent: 'flex-start',\n gap: theme.spacing(1),\n minHeight: SIZE_HEIGHT.card,\n paddingHorizontal: 11,\n paddingVertical: theme.spacing(2.5),\n },\n },\n },\n },\n pressed: {\n variants: {\n variant: {\n primary: { opacity: PRESSED_FILL_OPACITY },\n secondary: { opacity: PRESSED_FILL_OPACITY },\n outline: {},\n ghost: { backgroundColor: theme.colors.panel },\n subtle: { backgroundColor: theme.colors.deep },\n danger: { opacity: PRESSED_FILL_OPACITY },\n 'danger-outline': { opacity: PRESSED_FILL_OPACITY },\n success: { opacity: PRESSED_FILL_OPACITY },\n link: {},\n },\n },\n },\n disabled: { opacity: DISABLED_OPACITY },\n label: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontWeight: theme.fontWeight.medium,\n variants: {\n variant: {\n primary: { fontWeight: theme.fontWeight.semibold },\n secondary: { fontWeight: theme.fontWeight.semibold },\n outline: {},\n ghost: {},\n subtle: {},\n danger: { fontWeight: theme.fontWeight.semibold },\n 'danger-outline': { fontWeight: theme.fontWeight.semibold },\n success: { fontWeight: theme.fontWeight.semibold },\n link: {},\n },\n size: {\n xs: { fontSize: theme.fontSize.sm, lineHeight: theme.lineHeight.sm },\n sm: { fontSize: theme.fontSize.sm, lineHeight: theme.lineHeight.sm },\n md: { fontSize: theme.fontSize.base, lineHeight: theme.lineHeight.base },\n lg: { fontSize: theme.fontSize.base, lineHeight: theme.lineHeight.base },\n icon: { fontSize: theme.fontSize.base, lineHeight: theme.lineHeight.base },\n 'icon-md': { fontSize: theme.fontSize.base, lineHeight: theme.lineHeight.base },\n card: { fontSize: theme.fontSize.base, lineHeight: theme.lineHeight.base },\n },\n },\n },\n labelPressed: {\n variants: {\n variant: {\n primary: {},\n secondary: {},\n outline: {},\n ghost: {},\n subtle: {},\n danger: {},\n 'danger-outline': {},\n success: {},\n link: { textDecorationLine: 'underline' },\n },\n },\n },\n}));\n"],"mappings":";;;;;;;;;;;;AAwBA,MAAMe,iBAAiB;AACvB,MAAMC,mBAAmB;AACzB,MAAMC,uBAAuB;AAC7B,MAAMC,uBAAuB;;AAE7B,MAAMC,6BAA6B;;AAGnC,MAAMC,cAAoD;CACxDG,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,MAAM;CACN,WAAW;CACXC,MAAMb;AACR;;AAGA,MAAMc,MAA8F;CAClGG,SAAS;EAAEF,MAAM;EAAeC,SAAS;CAAc;CACvDE,WAAW;EAAEH,MAAM;EAAWC,SAAS;CAAU;CACjDG,SAAS;EAAEJ,MAAM;EAAOC,SAAS;CAAK;CACtCI,OAAO;EAAEL,MAAM;EAAOC,SAAS;CAAK;CACpCK,QAAQ;EAAEN,MAAM;EAAOC,SAAS;CAAK;CACrCM,QAAQ;EAAEP,MAAM;EAAQC,SAAS;CAAO;CACxC,kBAAkB;EAAED,MAAM;EA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file":"Button.mjs","names":["IconColorContext","NativeColorToken","withAlpha","ReactNode","PressableProps","StyleProp","ViewStyle","StyleSheet","useUnistyles","fontOf","impactLight","wrapText","Spinner","ButtonVariant","ButtonSize","MIN_TAP_TARGET","DISABLED_OPACITY","PRESSED_FILL_OPACITY","RIPPLE_ALPHA_PERCENT","PRESSED_EDGE_ALPHA_PERCENT","SIZE_HEIGHT","Readonly","Record","xs","sm","md","lg","icon","card","INK","rest","pressed","primary","secondary","outline","ghost","subtle","danger","success","link","HAPTIC_VARIANTS","ReadonlySet","Set","ButtonProps","Omit","variant","size","loading","loadingLabel","children","style","Button","disabled","onPress","hitSlop","accessibilityState","props","theme","_styles","styles","useVariants","inactive","slop","Math","max","ink","busy","undefined","text","color","colors","borderless","event","has","button","borderColor","green","token","label","labelPressed","create","flexDirection","alignItems","justifyContent","gap","spacing","borderRadius","borderWidth","overflow","variants","backgroundColor","selected","border","panel","red","height","paddingHorizontal","DEFAULT","width","padding","alignSelf","minHeight","paddingVertical","uni__dependencies","opacity","deep","fontFamily","sans","fontWeight","medium","semibold","fontSize","lineHeight","base","textDecorationLine"],"sources":["../../src/components/Button.tsx"],"sourcesContent":["import { IconColorContext } from '@agimon-ai/po-native-components/shell';\nimport { type NativeColorToken, withAlpha } from '@agimon-ai/po-web-components/nativeTheme';\nimport type { ReactNode } from 'react';\nimport { Pressable, type PressableProps, type StyleProp, type ViewStyle } from 'react-native';\nimport { StyleSheet, useUnistyles } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { impactLight } from '../lib/haptics';\nimport { wrapText } from '../lib/wrapText';\nimport { Spinner } from './Spinner';\n\nexport type ButtonVariant =\n | 'primary'\n | 'secondary'\n | 'outline'\n | 'ghost'\n | 'subtle'\n | 'danger'\n | 'danger-outline'\n | 'success'\n | 'link';\nexport type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'icon' | 'icon-md' | 'card';\n\n/** Apple's and Google's minimum tap target; a smaller visual box makes up the rest with hitSlop. */\nconst MIN_TAP_TARGET = 44;\nconst DISABLED_OPACITY = 0.4;\nconst PRESSED_FILL_OPACITY = 0.85;\nconst RIPPLE_ALPHA_PERCENT = 20;\n/** `hover:border-po-green/50`. */\nconst PRESSED_EDGE_ALPHA_PERCENT = 50;\n\n/** The visual height of each size, from which hitSlop pads the tap target to 44pt. */\nconst SIZE_HEIGHT: Readonly<Record<ButtonSize, number>> = {\n xs: 24,\n sm: 28,\n md: 32,\n lg: 36,\n icon: 24,\n 'icon-md': 32,\n card: MIN_TAP_TARGET,\n};\n\n/** The label ink of each variant, and the ink it lifts to while pressed (the web hover). */\nconst INK: Readonly<Record<ButtonVariant, { rest: NativeColorToken; pressed: NativeColorToken }>> = {\n primary: { rest: 'on-selected', pressed: 'on-selected' },\n secondary: { rest: 'magenta', pressed: 'magenta' },\n outline: { rest: 'dim', pressed: 'hi' },\n ghost: { rest: 'dim', pressed: 'hi' },\n subtle: { rest: 'dim', pressed: 'hi' },\n danger: { rest: 'rail', pressed: 'rail' },\n 'danger-outline': { rest: 'red', pressed: 'red' },\n success: { rest: 'rail', pressed: 'rail' },\n link: { rest: 'blue', pressed: 'blue' },\n};\n\n/** Presses that commit something get a light impact; the rest stay quiet. */\nconst HAPTIC_VARIANTS: ReadonlySet<ButtonVariant> = new Set(['primary', 'danger', 'success']);\n\nexport interface ButtonProps extends Omit<PressableProps, 'children' | 'style'> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n /** Work is in flight: the button shows a spinner and stops accepting presses. */\n loading?: boolean;\n /** What the spinner announces while loading; omit it and the wait is silent. */\n loadingLabel?: string;\n /** A bare string is drawn as the label; elements (an icon, a card's lines) render as given. */\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The one button: every variant is a theme token, a press dims or lifts it, and committing presses buzz once. */\nexport function Button({\n variant = 'outline',\n size = 'md',\n loading = false,\n loadingLabel,\n disabled,\n onPress,\n children,\n style,\n hitSlop,\n accessibilityState,\n ...props\n}: ButtonProps) {\n const { theme } = useUnistyles();\n styles.useVariants({ variant, size });\n const inactive = (disabled ?? false) || loading;\n const slop = Math.max(0, (MIN_TAP_TARGET - SIZE_HEIGHT[size]) / 2);\n const ink = INK[variant];\n return (\n <Pressable\n accessibilityRole={variant === 'link' ? 'link' : 'button'}\n accessibilityState={{ ...accessibilityState, disabled: inactive, busy: loading }}\n accessibilityValue={loading && loadingLabel !== undefined ? { text: loadingLabel } : undefined}\n disabled={inactive}\n hitSlop={hitSlop ?? slop}\n android_ripple={{ color: withAlpha(theme.colors[ink.pressed], RIPPLE_ALPHA_PERCENT), borderless: false }}\n onPress={(event) => {\n if (HAPTIC_VARIANTS.has(variant)) impactLight();\n onPress?.(event);\n }}\n style={({ pressed }) => [\n styles.button,\n pressed && styles.pressed,\n // Alpha mixes are computed in render from useUnistyles(), not in StyleSheet.create: on web Unistyles hands\n // the stylesheet CSS variables, which withAlpha cannot read.\n pressed && variant === 'outline' && { borderColor: withAlpha(theme.colors.green, PRESSED_EDGE_ALPHA_PERCENT) },\n inactive && styles.disabled,\n style,\n ]}\n {...props}\n >\n {({ pressed }) => {\n const token = pressed ? ink.pressed : ink.rest;\n return (\n <IconColorContext.Provider value={token}>\n {loading ? <Spinner color={token} /> : null}\n {wrapText(children, [styles.label, pressed && styles.labelPressed, { color: theme.colors[token] }])}\n </IconColorContext.Provider>\n );\n }}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n button: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n gap: theme.spacing(1.5),\n borderRadius: theme.borderRadius.md,\n borderWidth: 1,\n borderColor: 'transparent',\n overflow: 'hidden',\n variants: {\n variant: {\n primary: { backgroundColor: theme.colors.selected },\n secondary: { borderColor: theme.colors['edge-magenta'], backgroundColor: theme.colors['tint-magenta'] },\n outline: { borderColor: theme.colors.border },\n ghost: {},\n subtle: { backgroundColor: theme.colors.panel },\n danger: { backgroundColor: theme.colors.red },\n 'danger-outline': { borderColor: theme.colors['edge-red'], backgroundColor: theme.colors['tint-red'] },\n success: { backgroundColor: theme.colors.green },\n link: {},\n },\n size: {\n xs: { height: SIZE_HEIGHT.xs, paddingHorizontal: theme.spacing(1.5), borderRadius: theme.borderRadius.DEFAULT },\n sm: { height: SIZE_HEIGHT.sm, paddingHorizontal: theme.spacing(2.5) },\n md: { height: SIZE_HEIGHT.md, paddingHorizontal: theme.spacing(3) },\n lg: { height: SIZE_HEIGHT.lg, paddingHorizontal: theme.spacing(3.5) },\n icon: {\n width: SIZE_HEIGHT.icon,\n height: SIZE_HEIGHT.icon,\n padding: 0,\n borderRadius: theme.borderRadius.DEFAULT,\n },\n 'icon-md': { width: SIZE_HEIGHT['icon-md'], height: SIZE_HEIGHT['icon-md'], padding: 0 },\n card: {\n alignSelf: 'stretch',\n flexDirection: 'column',\n alignItems: 'stretch',\n justifyContent: 'flex-start',\n gap: theme.spacing(1),\n minHeight: SIZE_HEIGHT.card,\n paddingHorizontal: 11,\n paddingVertical: theme.spacing(2.5),\n },\n },\n },\n },\n pressed: {\n variants: {\n variant: {\n primary: { opacity: PRESSED_FILL_OPACITY },\n secondary: { opacity: PRESSED_FILL_OPACITY },\n outline: {},\n ghost: { backgroundColor: theme.colors.panel },\n subtle: { backgroundColor: theme.colors.deep },\n danger: { opacity: PRESSED_FILL_OPACITY },\n 'danger-outline': { opacity: PRESSED_FILL_OPACITY },\n success: { opacity: PRESSED_FILL_OPACITY },\n link: {},\n },\n },\n },\n disabled: { opacity: DISABLED_OPACITY },\n label: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontWeight: theme.fontWeight.medium,\n variants: {\n variant: {\n primary: { fontWeight: theme.fontWeight.semibold },\n secondary: { fontWeight: theme.fontWeight.semibold },\n outline: {},\n ghost: {},\n subtle: {},\n danger: { fontWeight: theme.fontWeight.semibold },\n 'danger-outline': { fontWeight: theme.fontWeight.semibold },\n success: { fontWeight: theme.fontWeight.semibold },\n link: {},\n },\n size: {\n xs: { fontSize: theme.fontSize.sm, lineHeight: theme.lineHeight.sm },\n sm: { fontSize: theme.fontSize.sm, lineHeight: theme.lineHeight.sm },\n md: { fontSize: theme.fontSize.base, lineHeight: theme.lineHeight.base },\n lg: { fontSize: theme.fontSize.base, lineHeight: theme.lineHeight.base },\n icon: { fontSize: theme.fontSize.base, lineHeight: theme.lineHeight.base },\n 'icon-md': { fontSize: theme.fontSize.base, lineHeight: theme.lineHeight.base },\n card: { fontSize: theme.fontSize.base, lineHeight: theme.lineHeight.base },\n },\n },\n },\n labelPressed: {\n variants: {\n variant: {\n primary: {},\n secondary: {},\n outline: {},\n ghost: {},\n subtle: {},\n danger: {},\n 'danger-outline': {},\n success: {},\n link: { textDecorationLine: 'underline' },\n },\n },\n },\n}));\n"],"mappings":";;;;;;;;;;;;AAwBA,MAAMe,iBAAiB;AACvB,MAAMC,mBAAmB;AACzB,MAAMC,uBAAuB;AAC7B,MAAMC,uBAAuB;;AAE7B,MAAMC,6BAA6B;;AAGnC,MAAMC,cAAoD;CACxDG,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,MAAM;CACN,WAAW;CACXC,MAAMb;AACR;;AAGA,MAAMc,MAA8F;CAClGG,SAAS;EAAEF,MAAM;EAAeC,SAAS;CAAc;CACvDE,WAAW;EAAEH,MAAM;EAAWC,SAAS;CAAU;CACjDG,SAAS;EAAEJ,MAAM;EAAOC,SAAS;CAAK;CACtCI,OAAO;EAAEL,MAAM;EAAOC,SAAS;CAAK;CACpCK,QAAQ;EAAEN,MAAM;EAAOC,SAAS;CAAK;CACrCM,QAAQ;EAAEP,MAAM;EAAQC,SAAS;CAAO;CACxC,kBAAkB;EAAED,MAAM;EAAOC,SAAS;CAAM;CAChDO,SAAS;EAAER,MAAM;EAAQC,SAAS;CAAO;CACzCQ,MAAM;EAAET,MAAM;EAAQC,SAAS;CAAO;AACxC;;AAGA,MAAMS,kCAA8C,IAAIE,IAAI;CAAC;CAAW;CAAU;AAAS,CAAC;;AAe5F,SAAgBS,O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AAMmD,WAAWE,SAAS;IAC1DxE,SAAS,EAAEsE,YAAYnD,MAAMmD,WAAWE,SAAS;IACjDvE,MAAM,CAAC;GACT;GACAO,MAAM;IACJvB,IAAI;KAAEwF,UAAUtD,MAAMsD,SAASvF;KAAIwF,YAAYvD,MAAMuD,WAAWxF;IAAG;IACnEA,IAAI;KAAEuF,UAAUtD,MAAMsD,SAASvF;KAAIwF,YAAYvD,MAAMuD,WAAWxF;IAAG;IACnEC,IAAI;KAAEsF,UAAUtD,MAAMsD,SAASE;KAAMD,YAAYvD,MAAMuD,WAAWC;IAAK;IACvEvF,IAAI;KAAEqF,UAAUtD,MAAMsD,SAASE;KAAMD,YAAYvD,MAAMuD,WAAWC;IAAK;IACvEtF,MAAM;KAAEoF,UAAUtD,MAAMsD,SAASE;KAAMD,YAAYvD,MAAMuD,WAAWC;IAAK;IACzE,WAAW;KAAEF,UAAUtD,MAAMsD,SAASE;KAAMD,YAAYvD,MAAMuD,WAAWC;IAAK;IAC9ErF,MAAM;KAAEmF,UAAUtD,MAAMsD,SAASE;KAAMD,YAAYvD,MAAMuD,WAAWC;IAAK;GAC3E;EACF;EAACV,mBAAA,CAAA,GAAA,CAAA;CACH;CACAxB,cAAc;EACZU,UAAU,EACR5C,SAAS;GACPb,SAAS,CAAC;GACVC,WAAW,CAAC;GACZC,SAAS,CAAC;GACVC,OAAO,CAAC;GACRC,QAAQ,CAAC;GACTC,QAAQ,CAAC;GACT,kBAAkB,CAAC;GACnBC,SAAS,CAAC;GACVC,MAAM,EAAE2E,oBAAoB,YAAY;EAC1C,EACF;EAACX,mBAAA,CAAA,CAAA;CACH;AACF,EAAE"}
@@ -4,7 +4,9 @@ export interface CodeBlockProps {
4
4
  text: string;
5
5
  /** The fence's language word, such as `ts`; the web reads it from a `language-*` class. */
6
6
  language?: string;
7
+ /** Initial reveal pages, useful for a reader restored to a known position. */
8
+ initialPage?: number;
7
9
  }
8
- export declare function CodeBlock({ text, language }: CodeBlockProps): import("react").JSX.Element;
10
+ export declare function CodeBlock({ text, language, initialPage }: CodeBlockProps): import("react").JSX.Element;
9
11
  //#endregion
10
12
  //# sourceMappingURL=CodeBlock.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlock.d.mts","names":[],"sources":["../../src/components/CodeBlock.tsx"],"mappings":";iBA4BiB;;EAEf;;EAEA;;wBAGc,YAAY,MAAM,YAAY,iCAAc,IAAA"}
1
+ {"version":3,"file":"CodeBlock.d.mts","names":[],"sources":["../../src/components/CodeBlock.tsx"],"mappings":";iBAkBiB;;EAEf;;EAEA;;EAEA;;wBAGc,YAAY,MAAM,UAAU,eAAmB,iCAAc,IAAA"}
@@ -1,61 +1,56 @@
1
1
  import { fontOf } from "../lib/fonts.mjs";
2
- import { Button } from "./Button.mjs";
3
- import { CheckIcon, CopyIcon } from "../icons/icons.mjs";
2
+ import { codePrefix } from "../lib/reading.mjs";
3
+ import { useReadingPage } from "../lib/useReadingPage.mjs";
4
+ import { CopyButton } from "./CopyButton.mjs";
5
+ import { ShowMore } from "./ShowMore.mjs";
4
6
  import { View } from "react-native-unistyles/components/native/View";
5
- import { StyleSheet } from "react-native-unistyles";
6
7
  import { Text } from "react-native-unistyles/components/native/Text";
7
- import { useEffect, useState } from "react";
8
+ import { StyleSheet } from "react-native-unistyles";
8
9
  import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { useT } from "@agimon-ai/po-core/native";
9
11
  import { ScrollView } from "react-native-unistyles/components/native/ScrollView";
10
- import { setStringAsync } from "expo-clipboard";
11
12
 
12
13
  //#region src/components/CodeBlock.tsx
13
- /** How long the control stays acknowledged before returning to its icon. */
14
- const FEEDBACK_MS = 1500;
15
- const LABELS = {
16
- idle: "copy",
17
- copied: "copied",
18
- failed: "copying failed"
19
- };
20
- function CodeBlock({ text, language }) {
21
- const [state, setState] = useState("idle");
22
- useEffect(() => {
23
- if (state === "idle") return void 0;
24
- const timer = setTimeout(() => setState("idle"), FEEDBACK_MS);
25
- return () => clearTimeout(timer);
26
- }, [state]);
27
- const label = LABELS[state];
14
+ function CodeBlock({ text, language, initialPage = 1 }) {
15
+ const t = useT();
16
+ const { page, reveal } = useReadingPage(text, initialPage);
17
+ const visible = codePrefix(text, Math.max(initialPage, page));
28
18
  return /* @__PURE__ */ jsxs(View, {
29
- style: styles.block,
30
- accessibilityLabel: language === void 0 ? void 0 : `${language} code`,
31
- children: [/* @__PURE__ */ jsx(ScrollView, {
32
- horizontal: true,
33
- showsHorizontalScrollIndicator: false,
34
- contentContainerStyle: styles.scroll,
35
- children: /* @__PURE__ */ jsx(Text, {
36
- selectable: true,
37
- style: styles.code,
38
- children: text
39
- })
40
- }), /* @__PURE__ */ jsx(Button, {
41
- variant: "ghost",
42
- size: "icon",
43
- accessibilityLabel: label,
44
- onPress: () => {
45
- setStringAsync(text).then((saved) => setState(saved ? "copied" : "failed"), () => setState("failed"));
46
- },
47
- style: styles.copy,
48
- children: state === "copied" ? /* @__PURE__ */ jsx(CheckIcon, {
49
- size: 12,
50
- color: "green"
51
- }) : /* @__PURE__ */ jsx(CopyIcon, {
52
- size: 12,
53
- color: "faint"
54
- })
55
- })]
19
+ style: styles.root,
20
+ children: [/* @__PURE__ */ jsxs(View, {
21
+ style: styles.block,
22
+ accessibilityLabel: language === void 0 ? void 0 : t("nativeComponents.codeBlock.label", "{language} code", { language }),
23
+ children: [/* @__PURE__ */ jsx(ScrollView, {
24
+ horizontal: true,
25
+ showsHorizontalScrollIndicator: false,
26
+ contentContainerStyle: styles.scroll,
27
+ children: /* @__PURE__ */ jsx(Text, {
28
+ selectable: true,
29
+ style: styles.code,
30
+ children: visible
31
+ })
32
+ }), /* @__PURE__ */ jsx(CopyButton, {
33
+ text,
34
+ style: styles.copy
35
+ })]
36
+ }), visible.length < text.length ? /* @__PURE__ */ jsx(ShowMore, {
37
+ label: t("nativeComponents.codeBlock.showMore", "Show more code"),
38
+ summary: t("nativeComponents.codeBlock.summary", "{shownChars} of {totalChars} characters · {shownLines} of {totalLines} lines", {
39
+ shownChars: visible.length,
40
+ totalChars: text.length,
41
+ shownLines: visible.split("\n").length,
42
+ totalLines: text.split("\n").length
43
+ }),
44
+ onPress: reveal
45
+ }) : null]
56
46
  });
57
47
  }
58
48
  const styles = StyleSheet.create((theme) => ({
49
+ root: {
50
+ gap: theme.spacing(2),
51
+ minWidth: 0,
52
+ uni__dependencies: [0]
53
+ },
59
54
  block: {
60
55
  borderRadius: theme.borderRadius.DEFAULT,
61
56
  borderWidth: 1,
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlock.mjs","names":["setStringAsync","useEffect","useState","StyleSheet","CheckIcon","CopyIcon","fontOf","Button","FEEDBACK_MS","CopyState","LABELS","Readonly","Record","idle","copied","failed","CodeBlockProps","text","language","CodeBlock","state","setState","undefined","timer","setTimeout","clearTimeout","label","styles","block","scroll","code","then","saved","copy","create","theme","borderRadius","DEFAULT","borderWidth","borderColor","colors","border","backgroundColor","deep","uni__dependencies","padding","spacing","paddingRight","color","fontFamily","mono","fontSize","sm","lineHeight","lineHeightRelaxed","position","top","right"],"sources":["../../src/components/CodeBlock.tsx"],"sourcesContent":["import { setStringAsync } from 'expo-clipboard';\nimport { useEffect, useState } from 'react';\nimport { ScrollView, Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { CheckIcon, CopyIcon } from '../icons/icons';\nimport { fontOf } from '../lib/fonts';\nimport { Button } from './Button';\n\n/*\n * A fenced code block: the source in selectable mono type that scrolls\n * sideways rather than wrapping, and a copy button that says when it worked.\n *\n * ponytail: no syntax colouring and no mermaid diagrams yet; a mermaid fence\n * shows its source, which is still the whole content.\n */\n\n/** How long the control stays acknowledged before returning to its icon. */\nconst FEEDBACK_MS = 1500;\n\ntype CopyState = 'idle' | 'copied' | 'failed';\n\nconst LABELS: Readonly<Record<CopyState, string>> = {\n idle: 'copy',\n copied: 'copied',\n failed: 'copying failed',\n};\n\nexport interface CodeBlockProps {\n /** The block's source, without the fence lines. */\n text: string;\n /** The fence's language word, such as `ts`; the web reads it from a `language-*` class. */\n language?: string;\n}\n\nexport function CodeBlock({ text, language }: CodeBlockProps) {\n const [state, setState] = useState<CopyState>('idle');\n\n useEffect(() => {\n if (state === 'idle') return undefined;\n const timer = setTimeout(() => setState('idle'), FEEDBACK_MS);\n return () => clearTimeout(timer);\n }, [state]);\n\n const label = LABELS[state];\n return (\n <View style={styles.block} accessibilityLabel={language === undefined ? undefined : `${language} code`}>\n <ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={styles.scroll}>\n <Text selectable style={styles.code}>\n {text}\n </Text>\n </ScrollView>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n accessibilityLabel={label}\n onPress={() => {\n setStringAsync(text).then(\n (saved) => setState(saved ? 'copied' : 'failed'),\n () => setState('failed'),\n );\n }}\n style={styles.copy}\n >\n {state === 'copied' ? <CheckIcon size={12} color=\"green\" /> : <CopyIcon size={12} color=\"faint\" />}\n </Button>\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n block: {\n borderRadius: theme.borderRadius.DEFAULT,\n borderWidth: 1,\n borderColor: theme.colors.border,\n backgroundColor: theme.colors.deep,\n },\n // The right padding keeps the first line clear of the copy button.\n scroll: { padding: theme.spacing(2.5), paddingRight: theme.spacing(9) },\n code: {\n color: theme.colors.text,\n fontFamily: fontOf(theme.fontFamily.mono),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeightRelaxed.sm,\n },\n copy: { position: 'absolute', top: theme.spacing(1.5), right: theme.spacing(1.5) },\n}));\n"],"mappings":";;;;;;;;;;;;;AAkBA,MAAMQ,cAAc;AAIpB,MAAME,SAA8C;CAClDG,MAAM;CACNC,QAAQ;CACRC,QAAQ;AACV;AASA,SAAgBI,UAAU,EAAEF,MAAMC,YAA4B;CAC5D,MAAM,CAACE,OAAOC,YAAYnB,SAAoB,MAAM;CAEpDD,gBAAgB;EACd,IAAImB,UAAU,QAAQ,OAAOE;EAC7B,MAAMC,QAAQC,iBAAiBH,SAAS,M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,MAAMW,QAAQ,GAAG;EAACF,mBAAA,CAAA,CAAA;CAAC;AACnF,EAAE"}
1
+ {"version":3,"file":"CodeBlock.mjs","names":["useT","StyleSheet","fontOf","codePrefix","useReadingPage","CopyButton","ShowMore","CodeBlockProps","text","language","initialPage","CodeBlock","t","page","reveal","visible","Math","max","styles","root","block","undefined","scroll","code","copy","length","shownChars","totalChars","shownLines","split","totalLines","create","theme","gap","spacing","minWidth","uni__dependencies","borderRadius","DEFAULT","borderWidth","borderColor","colors","border","backgroundColor","deep","padding","paddingRight","color","fontFamily","mono","fontSize","sm","lineHeight","lineHeightRelaxed","position","top","right"],"sources":["../../src/components/CodeBlock.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport { ScrollView, Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { codePrefix } from '../lib/reading';\nimport { useReadingPage } from '../lib/useReadingPage';\nimport { CopyButton } from './CopyButton';\nimport { ShowMore } from './ShowMore';\n\n/*\n * A fenced code block: the source in selectable mono type that scrolls\n * sideways rather than wrapping, and a copy button that says when it worked.\n *\n * ponytail: no syntax colouring and no mermaid diagrams yet; a mermaid fence\n * shows its source, which is still the whole content.\n */\n\nexport interface CodeBlockProps {\n /** The block's source, without the fence lines. */\n text: string;\n /** The fence's language word, such as `ts`; the web reads it from a `language-*` class. */\n language?: string;\n /** Initial reveal pages, useful for a reader restored to a known position. */\n initialPage?: number;\n}\n\nexport function CodeBlock({ text, language, initialPage = 1 }: CodeBlockProps) {\n const t = useT();\n const { page, reveal } = useReadingPage(text, initialPage);\n const visible = codePrefix(text, Math.max(initialPage, page));\n return (\n <View style={styles.root}>\n <View\n style={styles.block}\n accessibilityLabel={\n language === undefined ? undefined : t('nativeComponents.codeBlock.label', '{language} code', { language })\n }\n >\n <ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={styles.scroll}>\n <Text selectable style={styles.code}>\n {visible}\n </Text>\n </ScrollView>\n\n <CopyButton text={text} style={styles.copy} />\n </View>\n {visible.length < text.length ? (\n <ShowMore\n label={t('nativeComponents.codeBlock.showMore', 'Show more code')}\n summary={t(\n 'nativeComponents.codeBlock.summary',\n '{shownChars} of {totalChars} characters · {shownLines} of {totalLines} lines',\n {\n shownChars: visible.length,\n totalChars: text.length,\n shownLines: visible.split('\\n').length,\n totalLines: text.split('\\n').length,\n },\n )}\n onPress={reveal}\n />\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n root: { gap: theme.spacing(2), minWidth: 0 },\n block: {\n borderRadius: theme.borderRadius.DEFAULT,\n borderWidth: 1,\n borderColor: theme.colors.border,\n backgroundColor: theme.colors.deep,\n },\n // The right padding keeps the first line clear of the copy button.\n scroll: { padding: theme.spacing(2.5), paddingRight: theme.spacing(9) },\n code: {\n color: theme.colors.text,\n fontFamily: fontOf(theme.fontFamily.mono),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeightRelaxed.sm,\n },\n copy: { position: 'absolute', top: theme.spacing(1.5), right: theme.spacing(1.5) },\n}));\n"],"mappings":";;;;;;;;;;;;;AA2BA,SAAgBW,UAAU,EAAEH,MAAMC,UAAUC,cAAc,KAAqB;CAC7E,MAAME,IAAIZ,KAAK;CACf,MAAM,EAAEa,MAAMC,WAAWV,eAAeI,MAAME,WAAW;CACzD,MAAMK,UAAUZ,WAAWK,MAAMQ,KAAKC,IAAIP,aAAaG,IAAI,CAAC;CAC5D,OACE,qBAAC,MAAD;EAAM,OAAOK,OAAOC;YAApB,CACE,qBAAC,MAAD;GACE,OAAOD,OAAOE;GACd,oBACEX,aAAaY,SAAYA,SAAYT,EAAE,oCAAoC,mBAAmB,EAAEH,SAAS,CAAC;aAH9G,CAME,oBAAC,YAAD;IAAY;IAAW,gCAAgC;IAAO,uBAAuBS,OAAOI;cAC1F,oBAAC,MAAD;KAAM;KAAW,OAAOJ,OAAOK;eAC5BR;IACG;GACI,IAEZ,oBAAC,YAAD;IAAkBP;IAAM,OAAOU,OAAOM;GAAK,EACvC;MACLT,QAAQU,SAASjB,KAAKiB,SACrB,oBAAC,UAAD;GACE,OAAOb,EAAE,uCAAuC,gBAAgB;GAChE,SAASA,EACP,sCACA,gFACA;IACEc,YAAYX,QAAQU;IACpBE,YAAYnB,KAAKiB;IACjBG,YAAYb,QAAQc,MAAM,IAAI,CAAC,CAACJ;IAChCK,YAAYtB,KAAKqB,MAAM,IAAI,CAAC,CAACJ;GAC/B,CACF;GACA,SAASX;EAAO,KAEhB,IACA;;AAEV;AAEA,MAAMI,SAASjB,WAAW8B,QAAQC,WAAW;CAC3Cb,MAAM;EAAEc,KAAKD,MAAME,QAAQ,CAAC;EAAGC,UAAU;EAACC,mBAAA,CAAA,CAAA;CAAC;CAC3ChB,OAAO;EACLiB,cAAcL,MAAMK,aAAaC;EACjCC,aAAa;EACbC,aAAaR,MAAMS,OAAOC;EAC1BC,iBAAiBX,MAAMS,OAAOG;EAAIR,mBAAA,CAAA,CAAA;CACpC;CAEAd,QAAQ;EAAEuB,SAASb,MAAME,QAAQ,GAAG;EAAGY,cAAcd,MAAME,QAAQ,CAAC;EAACE,mBAAA,CAAA,CAAA;CAAC;CACtEb,MAAM;EACJwB,OAAOf,MAAMS,OAAOjC;EACpBwC,YAAY9C,OAAO8B,MAAMgB,WAAWC,IAAI;EACxCC,UAAUlB,MAAMkB,SAASC;EACzBC,YAAYpB,MAAMqB,kBAAkBF;EAAEf,mBAAA,CAAA,CAAA;CACxC;CACAZ,MAAM;EAAE8B,UAAU;EAAYC,KAAKvB,MAAME,QAAQ,GAAG;EAAGsB,OAAOxB,MAAME,QAAQ,GAAG;EAACE,mBAAA,CAAA,CAAA;CAAC;AACnF,EAAE"}
@@ -0,0 +1,15 @@
1
+ //#region src/components/ComputerRow.d.ts
2
+ export type ComputerStatus = 'connected' | 'connecting' | 'disconnected' | 'update_required';
3
+ export interface ComputerRowProps {
4
+ name: string;
5
+ /** A folder on that computer, in mono with the home folder shown as `~`. */
6
+ path?: string;
7
+ status: ComputerStatus;
8
+ /** Whether the row can be picked. Defaults to off unless the computer is connected. */
9
+ disabled?: boolean;
10
+ onPress: () => void;
11
+ }
12
+ /** One computer to pick in a sheet: its name, an optional folder, and whether it is reachable. */
13
+ export declare function ComputerRow({ name, path, status, disabled, onPress }: ComputerRowProps): import("react").JSX.Element;
14
+ //#endregion
15
+ //# sourceMappingURL=ComputerRow.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComputerRow.d.mts","names":[],"sources":["../../src/components/ComputerRow.tsx"],"mappings":";YASY;iBAgBK;EACf;;EAEA;EACA,QAAQ;;EAER;EACA;;;wBAIc,cAAc,MAAM,MAAM,QAAQ,UAAU,WAAW,mCAAgB,IAAA"}
@@ -0,0 +1,107 @@
1
+ import { fontOf } from "../lib/fonts.mjs";
2
+ import { Dot } from "./Dot.mjs";
3
+ import { MonitorIcon } from "../icons/icons.mjs";
4
+ import { ListRow } from "./List.mjs";
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 { jsx, jsxs } from "react/jsx-runtime";
9
+ import { useT } from "@agimon-ai/po-core/native";
10
+
11
+ //#region src/components/ComputerRow.tsx
12
+ function statusLabel(status, t) {
13
+ switch (status) {
14
+ case "connected": return t("nativeComponents.computerRow.status.connected", "Connected");
15
+ case "connecting": return t("nativeComponents.computerRow.status.connecting", "Connecting");
16
+ case "disconnected": return t("nativeComponents.computerRow.status.disconnected", "Offline");
17
+ case "update_required": return t("nativeComponents.computerRow.status.updateRequired", "Needs update");
18
+ }
19
+ }
20
+ const HOME_FOLDER = /^(\/Users|\/home)\/[^/]+(?=\/|$)/;
21
+ /** One computer to pick in a sheet: its name, an optional folder, and whether it is reachable. */
22
+ function ComputerRow({ name, path, status, disabled, onPress }) {
23
+ const connected = status === "connected";
24
+ const shortPath = path?.replace(HOME_FOLDER, "~");
25
+ const label = statusLabel(status, useT());
26
+ return /* @__PURE__ */ jsx(ListRow, {
27
+ title: name,
28
+ description: shortPath ? /* @__PURE__ */ jsx(Text, {
29
+ numberOfLines: 1,
30
+ ellipsizeMode: "middle",
31
+ style: styles.path,
32
+ children: shortPath
33
+ }) : void 0,
34
+ leading: /* @__PURE__ */ jsx(View, {
35
+ style: [styles.icon, connected && styles.iconConnected],
36
+ children: /* @__PURE__ */ jsx(MonitorIcon, {
37
+ size: 18,
38
+ color: connected ? "green" : "faint"
39
+ })
40
+ }),
41
+ trailing: /* @__PURE__ */ jsxs(View, {
42
+ style: styles.status,
43
+ children: [/* @__PURE__ */ jsx(Dot, {
44
+ tone: connected ? "green" : "muted",
45
+ pulse: status === "connecting"
46
+ }), /* @__PURE__ */ jsx(Text, {
47
+ style: [styles.statusLabel, connected && styles.statusConnected],
48
+ children: label
49
+ })]
50
+ }),
51
+ disabled: disabled ?? !connected,
52
+ onPress,
53
+ accessibilityLabel: `${name}${shortPath ? `, ${shortPath}` : ""}, ${label}`,
54
+ style: styles.card
55
+ });
56
+ }
57
+ const styles = StyleSheet.create((theme) => ({
58
+ card: {
59
+ borderWidth: StyleSheet.hairlineWidth,
60
+ borderColor: theme.colors.border,
61
+ borderRadius: theme.borderRadius.lg,
62
+ marginBottom: theme.spacing(2),
63
+ minHeight: 64,
64
+ uni__dependencies: [0]
65
+ },
66
+ icon: {
67
+ width: 36,
68
+ height: 36,
69
+ borderRadius: theme.borderRadius.full,
70
+ alignItems: "center",
71
+ justifyContent: "center",
72
+ backgroundColor: theme.colors.panel,
73
+ uni__dependencies: [0]
74
+ },
75
+ iconConnected: {
76
+ backgroundColor: theme.colors["tint-green"],
77
+ uni__dependencies: [0]
78
+ },
79
+ path: {
80
+ color: theme.colors.faint,
81
+ fontFamily: fontOf(theme.fontFamily.mono),
82
+ fontSize: theme.fontSize.sm,
83
+ lineHeight: theme.lineHeight.sm,
84
+ uni__dependencies: [0]
85
+ },
86
+ status: {
87
+ flexDirection: "row",
88
+ alignItems: "center",
89
+ gap: theme.spacing(1.5),
90
+ uni__dependencies: [0]
91
+ },
92
+ statusLabel: {
93
+ color: theme.colors.faint,
94
+ fontFamily: fontOf(theme.fontFamily.sans),
95
+ fontSize: theme.fontSize.sm,
96
+ lineHeight: theme.lineHeight.sm,
97
+ uni__dependencies: [0]
98
+ },
99
+ statusConnected: {
100
+ color: theme.colors.green,
101
+ uni__dependencies: [0]
102
+ }
103
+ }));
104
+
105
+ //#endregion
106
+ export { ComputerRow };
107
+ //# sourceMappingURL=ComputerRow.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComputerRow.mjs","names":["useT","StyleSheet","MonitorIcon","fontOf","Dot","ListRow","ComputerStatus","statusLabel","status","t","ReturnType","HOME_FOLDER","ComputerRowProps","name","path","disabled","onPress","ComputerRow","connected","shortPath","replace","label","styles","undefined","icon","iconConnected","statusConnected","card","create","theme","borderWidth","hairlineWidth","borderColor","colors","border","borderRadius","lg","marginBottom","spacing","minHeight","uni__dependencies","width","height","full","alignItems","justifyContent","backgroundColor","panel","color","faint","fontFamily","mono","fontSize","sm","lineHeight","flexDirection","gap","sans","green"],"sources":["../../src/components/ComputerRow.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport { Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { MonitorIcon } from '../icons/icons';\nimport { fontOf } from '../lib/fonts';\nimport { Dot } from './Dot';\nimport { ListRow } from './List';\n\nexport type ComputerStatus = 'connected' | 'connecting' | 'disconnected' | 'update_required';\n\nfunction statusLabel(status: ComputerStatus, t: ReturnType<typeof useT>): string {\n switch (status) {\n case 'connected':\n return t('nativeComponents.computerRow.status.connected', 'Connected');\n case 'connecting':\n return t('nativeComponents.computerRow.status.connecting', 'Connecting');\n case 'disconnected':\n return t('nativeComponents.computerRow.status.disconnected', 'Offline');\n case 'update_required':\n return t('nativeComponents.computerRow.status.updateRequired', 'Needs update');\n }\n}\nconst HOME_FOLDER = /^(\\/Users|\\/home)\\/[^/]+(?=\\/|$)/;\n\nexport interface ComputerRowProps {\n name: string;\n /** A folder on that computer, in mono with the home folder shown as `~`. */\n path?: string;\n status: ComputerStatus;\n /** Whether the row can be picked. Defaults to off unless the computer is connected. */\n disabled?: boolean;\n onPress: () => void;\n}\n\n/** One computer to pick in a sheet: its name, an optional folder, and whether it is reachable. */\nexport function ComputerRow({ name, path, status, disabled, onPress }: ComputerRowProps) {\n const connected = status === 'connected';\n const shortPath = path?.replace(HOME_FOLDER, '~');\n const t = useT();\n const label = statusLabel(status, t);\n return (\n <ListRow\n title={name}\n description={\n shortPath ? (\n <Text numberOfLines={1} ellipsizeMode=\"middle\" style={styles.path}>\n {shortPath}\n </Text>\n ) : undefined\n }\n leading={\n <View style={[styles.icon, connected && styles.iconConnected]}>\n <MonitorIcon size={18} color={connected ? 'green' : 'faint'} />\n </View>\n }\n trailing={\n <View style={styles.status}>\n <Dot tone={connected ? 'green' : 'muted'} pulse={status === 'connecting'} />\n <Text style={[styles.statusLabel, connected && styles.statusConnected]}>{label}</Text>\n </View>\n }\n disabled={disabled ?? !connected}\n onPress={onPress}\n accessibilityLabel={`${name}${shortPath ? `, ${shortPath}` : ''}, ${label}`}\n style={styles.card}\n />\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n card: {\n borderWidth: StyleSheet.hairlineWidth,\n borderColor: theme.colors.border,\n borderRadius: theme.borderRadius.lg,\n marginBottom: theme.spacing(2),\n minHeight: 64,\n },\n icon: {\n width: 36,\n height: 36,\n borderRadius: theme.borderRadius.full,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: theme.colors.panel,\n },\n iconConnected: { backgroundColor: theme.colors['tint-green'] },\n path: {\n color: theme.colors.faint,\n fontFamily: fontOf(theme.fontFamily.mono),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n status: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(1.5) },\n statusLabel: {\n color: theme.colors.faint,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n statusConnected: { color: theme.colors.green },\n}));\n"],"mappings":";;;;;;;;;;;AAWA,SAASO,YAAYC,QAAwBC,GAAoC;CAC/E,QAAQD,QAAR;EACE,KAAK,aACH,OAAOC,EAAE,iDAAiD,WAAW;EACvE,KAAK,cACH,OAAOA,EAAE,kDAAkD,YAAY;EACzE,KAAK,gBACH,OAAOA,EAAE,oDAAoD,SAAS;EACxE,KAAK,mBACH,OAAOA,EAAE,sDAAsD,cAAc;CACjF;AACF;AACA,MAAME,cAAc;;AAapB,SAAgBM,YAAY,EAAEJ,MAAMC,MAAMN,QAAQO,UAAUC,WAA6B;CACvF,MAAME,YAAYV,WAAW;CAC7B,MAAMW,YAAYL,MAAMM,QAAQT,aAAa,GAAG;CAEhD,MAAMU,QAAQd,YAAYC,QADhBR,KACwBS,CAAC;CACnC,OACE,oBAAC,SAAD;EACE,OAAOI;EACP,aACEM,YACE,oBAAC,MAAD;GAAM,eAAe;GAAG,eAAc;GAAS,OAAOG,OAAOR;aAC1DK;EACG,KACJI;EAEN,SACE,oBAAC,MAAD;GAAM,OAAO,CAACD,OAAOE,MAAMN,aAAaI,OAAOG,aAAa;aAC1D,oBAAC,aAAD;IAAa,MAAM;IAAI,OAAOP,YAAY,UAAU;GAAQ;EACxD;EAER,UACE,qBAAC,MAAD;GAAM,OAAOI,OAAOd;aAApB,CACE,oBAAC,KAAD;IAAK,MAAMU,YAAY,UAAU;IAAS,OAAOV,WAAW;GAAa,IACzE,oBAAC,MAAD;IAAM,OAAO,CAACc,OAAOf,aAAaW,aAAaI,OAAOI,eAAe;cAAIL;GAAY,EACjF;;EAER,UAAUN,YAAY,CAACG;EACdF;EACT,oBAAoB,GAAGH,OAAOM,YAAY,KAAKA,cAAc,GAAE,IAAKE;EACpE,OAAOC,OAAOK;CAAK;AAGzB;AAEA,MAAML,SAASrB,WAAW2B,QAAQC,WAAW;CAC3CF,MAAM;EACJG,aAAa7B,WAAW8B;EACxBC,aAAaH,MAAMI,OAAOC;EAC1BC,cAAcN,MAAMM,aAAaC;EACjCC,cAAcR,MAAMS,QAAQ,CAAC;EAC7BC,WAAW;EAAEC,mBAAA,CAAA,CAAA;CACf;CACAhB,MAAM;EACJiB,OAAO;EACPC,QAAQ;EACRP,cAAcN,MAAMM,aAAaQ;EACjCC,YAAY;EACZC,gBAAgB;EAChBC,iBAAiBjB,MAAMI,OAAOc;EAAKP,mBAAA,CAAA,CAAA;CACrC;CACAf,eAAe;EAAEqB,iBAAiBjB,MAAMI,OAAO;EAAaO,mBAAA,CAAA,CAAA;CAAC;CAC7D1B,MAAM;EACJkC,OAAOnB,MAAMI,OAAOgB;EACpBC,YAAY/C,OAAO0B,MAAMqB,WAAWC,IAAI;EACxCC,UAAUvB,MAAMuB,SAASC;EACzBC,YAAYzB,MAAMyB,WAAWD;EAAEb,mBAAA,CAAA,CAAA;CACjC;CACAhC,QAAQ;EAAE+C,eAAe;EAAOX,YAAY;EAAUY,KAAK3B,MAAMS,QAAQ,GAAG;EAACE,mBAAA,CAAA,CAAA;CAAC;CAC9EjC,aAAa;EACXyC,OAAOnB,MAAMI,OAAOgB;EACpBC,YAAY/C,OAAO0B,MAAMqB,WAAWO,IAAI;EACxCL,UAAUvB,MAAMuB,SAASC;EACzBC,YAAYzB,MAAMyB,WAAWD;EAAEb,mBAAA,CAAA,CAAA;CACjC;CACAd,iBAAiB;EAAEsB,OAAOnB,MAAMI,OAAOyB;EAAKlB,mBAAA,CAAA,CAAA;CAAC;AAC/C,EAAE"}
@@ -0,0 +1,13 @@
1
+ import { StyleProp, ViewStyle } from "react-native";
2
+ //#region src/components/CopyButton.d.ts
3
+ export interface CopyButtonProps {
4
+ /** The text the press puts on the clipboard. */
5
+ text: string;
6
+ /** What is copied, announced before the state, such as `path`. */
7
+ label?: string;
8
+ style?: StyleProp<ViewStyle>;
9
+ }
10
+ /** A quiet icon button that copies text and says, briefly, whether it worked. */
11
+ export declare function CopyButton({ text, label, style }: CopyButtonProps): import("react").JSX.Element;
12
+ //#endregion
13
+ //# sourceMappingURL=CopyButton.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopyButton.d.mts","names":[],"sources":["../../src/components/CopyButton.tsx"],"mappings":";;iBAmBiB;;EAEf;;EAEA;EACA,QAAQ,UAAU;;;wBAIJ,aAAa,MAAM,OAAO,SAAS,kCAAe,IAAA"}
@@ -0,0 +1,49 @@
1
+ import { Button } from "./Button.mjs";
2
+ import { CheckIcon, CopyIcon } from "../icons/icons.mjs";
3
+ import { useEffect, useState } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { useT } from "@agimon-ai/po-core/native";
6
+ import { setStringAsync } from "expo-clipboard";
7
+
8
+ //#region src/components/CopyButton.tsx
9
+ /** How long the control stays acknowledged before returning to its icon. */
10
+ const FEEDBACK_MS = 1500;
11
+ function stateLabel(state, t) {
12
+ if (state === "copied") return t("nativeComponents.copyButton.copied", "copied");
13
+ if (state === "failed") return t("nativeComponents.copyButton.failed", "copying failed");
14
+ return t("nativeComponents.copyButton.copy", "copy");
15
+ }
16
+ /** A quiet icon button that copies text and says, briefly, whether it worked. */
17
+ function CopyButton({ text, label, style }) {
18
+ const [state, setState] = useState("idle");
19
+ const t = useT();
20
+ const action = stateLabel(state, t);
21
+ useEffect(() => {
22
+ if (state === "idle") return void 0;
23
+ const timer = setTimeout(() => setState("idle"), FEEDBACK_MS);
24
+ return () => clearTimeout(timer);
25
+ }, [state]);
26
+ return /* @__PURE__ */ jsx(Button, {
27
+ variant: "ghost",
28
+ size: "icon",
29
+ accessibilityLabel: label === void 0 ? action : t("nativeComponents.copyButton.withLabel", "{action} {label}", {
30
+ action,
31
+ label
32
+ }),
33
+ onPress: () => {
34
+ setStringAsync(text).then((saved) => setState(saved ? "copied" : "failed"), () => setState("failed"));
35
+ },
36
+ style,
37
+ children: state === "copied" ? /* @__PURE__ */ jsx(CheckIcon, {
38
+ size: 12,
39
+ color: "green"
40
+ }) : /* @__PURE__ */ jsx(CopyIcon, {
41
+ size: 12,
42
+ color: "faint"
43
+ })
44
+ });
45
+ }
46
+
47
+ //#endregion
48
+ export { CopyButton };
49
+ //# sourceMappingURL=CopyButton.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopyButton.mjs","names":["useT","setStringAsync","useEffect","useState","StyleProp","ViewStyle","CheckIcon","CopyIcon","Button","FEEDBACK_MS","CopyState","stateLabel","state","t","ReturnType","CopyButtonProps","text","label","style","CopyButton","setState","action","undefined","timer","setTimeout","clearTimeout","then","saved"],"sources":["../../src/components/CopyButton.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport { setStringAsync } from 'expo-clipboard';\nimport { useEffect, useState } from 'react';\nimport type { StyleProp, ViewStyle } from 'react-native';\n\nimport { CheckIcon, CopyIcon } from '../icons/icons';\nimport { Button } from './Button';\n\n/** How long the control stays acknowledged before returning to its icon. */\nconst FEEDBACK_MS = 1500;\n\ntype CopyState = 'idle' | 'copied' | 'failed';\n\nfunction stateLabel(state: CopyState, t: ReturnType<typeof useT>): string {\n if (state === 'copied') return t('nativeComponents.copyButton.copied', 'copied');\n if (state === 'failed') return t('nativeComponents.copyButton.failed', 'copying failed');\n return t('nativeComponents.copyButton.copy', 'copy');\n}\n\nexport interface CopyButtonProps {\n /** The text the press puts on the clipboard. */\n text: string;\n /** What is copied, announced before the state, such as `path`. */\n label?: string;\n style?: StyleProp<ViewStyle>;\n}\n\n/** A quiet icon button that copies text and says, briefly, whether it worked. */\nexport function CopyButton({ text, label, style }: CopyButtonProps) {\n const [state, setState] = useState<CopyState>('idle');\n const t = useT();\n const action = stateLabel(state, t);\n\n useEffect(() => {\n if (state === 'idle') return undefined;\n const timer = setTimeout(() => setState('idle'), FEEDBACK_MS);\n return () => clearTimeout(timer);\n }, [state]);\n\n return (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n accessibilityLabel={\n label === undefined ? action : t('nativeComponents.copyButton.withLabel', '{action} {label}', { action, label })\n }\n onPress={() => {\n setStringAsync(text).then(\n (saved) => setState(saved ? 'copied' : 'failed'),\n () => setState('failed'),\n );\n }}\n style={style}\n >\n {state === 'copied' ? <CheckIcon size={12} color=\"green\" /> : <CopyIcon size={12} color=\"faint\" />}\n </Button>\n );\n}\n"],"mappings":";;;;;;;;;AASA,MAAMS,cAAc;AAIpB,SAASE,WAAWC,OAAkBC,GAAoC;CACxE,IAAID,UAAU,UAAU,OAAOC,EAAE,sCAAsC,QAAQ;CAC/E,IAAID,UAAU,UAAU,OAAOC,EAAE,sCAAsC,gBAAgB;CACvF,OAAOA,EAAE,oCAAoC,MAAM;AACrD;;AAWA,SAAgBM,WAAW,EAAEH,MAAMC,OAAOC,SAA0B;CAClE,MAAM,CAACN,OAAOQ,YAAYjB,SAAoB,MAAM;CACpD,MAAMU,IAAIb,KAAK;CACf,MAAMqB,SAASV,WAAWC,OAAOC,CAAC;CAElCX,gBAAgB;EACd,IAAIU,UAAU,QAAQ,OAAOU;EAC7B,MAAMC,QAAQC,iBAAiBJ,SAAS,MAAM,GAAGX,WAAW;EAC5D,aAAagB,aAAaF,KAAK;CACjC,GAAG,CAACX,KAAK,CAAC;CAEV,OACE,oBAAC,QAAD;EACE,SAAQ;EACR,MAAK;EACL,oBACEK,UAAUK,SAAYD,SAASR,EAAE,yCAAyC,oBAAoB;GAAEQ;GAAQJ;EAAM,CAAC;EAEjH,eAAe;GACbhB,eAAee,IAAI,CAAC,CAACU,MAClBC,UAAUP,SAASO,QAAQ,WAAW,QAAQ,SACzCP,SAAS,QAAQ,CACzB;EACF;EACOF;YAENN,UAAU,WAAW,oBAAC,WAAD;GAAW,MAAM;GAAI,OAAM;EAAO,KAAM,oBAAC,UAAD;GAAU,MAAM;GAAI,OAAM;EAAO;CACzF;AAEZ"}
@@ -0,0 +1,15 @@
1
+ import { StyleProp, ViewStyle } from "react-native";
2
+ //#region src/components/CountBadge.d.ts
3
+ export interface CountBadgeProps {
4
+ /** Things waiting for the person; zero or less renders nothing. */
5
+ count: number;
6
+ /** Placement, usually absolute on an icon's top-right; `borderColor` matches the surface behind it. */
7
+ style?: StyleProp<ViewStyle>;
8
+ }
9
+ /**
10
+ * The rose count of things waiting for the person, worn on an icon or avatar corner.
11
+ * A gentle ask, so it is rose, never red. Hidden from screen readers: the owner names the count.
12
+ */
13
+ export declare function CountBadge({ count, style }: CountBadgeProps): import("react").JSX.Element | null;
14
+ //#endregion
15
+ //# sourceMappingURL=CountBadge.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CountBadge.d.mts","names":[],"sources":["../../src/components/CountBadge.tsx"],"mappings":";;iBAKiB;;EAEf;;EAEA,QAAQ,UAAU;;;;;;wBAOJ,aAAa,OAAO,SAAS,kCAAe,IAAA"}
@@ -0,0 +1,49 @@
1
+ import { fontOf } from "../lib/fonts.mjs";
2
+ import { View } from "react-native-unistyles/components/native/View";
3
+ import { Text } from "react-native-unistyles/components/native/Text";
4
+ import { StyleSheet } from "react-native-unistyles";
5
+ import { jsx } from "react/jsx-runtime";
6
+
7
+ //#region src/components/CountBadge.tsx
8
+ /**
9
+ * The rose count of things waiting for the person, worn on an icon or avatar corner.
10
+ * A gentle ask, so it is rose, never red. Hidden from screen readers: the owner names the count.
11
+ */
12
+ function CountBadge({ count, style }) {
13
+ if (count <= 0) return null;
14
+ return /* @__PURE__ */ jsx(View, {
15
+ accessible: false,
16
+ importantForAccessibility: "no-hide-descendants",
17
+ style: [styles.badge, style],
18
+ children: /* @__PURE__ */ jsx(Text, {
19
+ style: styles.text,
20
+ children: count > 9 ? "9+" : String(count)
21
+ })
22
+ });
23
+ }
24
+ const styles = StyleSheet.create((theme) => ({
25
+ badge: {
26
+ minWidth: 16,
27
+ height: 16,
28
+ paddingHorizontal: 4,
29
+ borderRadius: 8,
30
+ alignItems: "center",
31
+ justifyContent: "center",
32
+ backgroundColor: theme.colors.magenta,
33
+ borderWidth: 1.5,
34
+ borderColor: theme.colors.panel,
35
+ uni__dependencies: [0]
36
+ },
37
+ text: {
38
+ fontFamily: fontOf(theme.fontFamily.sans),
39
+ fontSize: theme.fontSize["2xs"],
40
+ lineHeight: 12,
41
+ fontWeight: theme.fontWeight.semibold,
42
+ color: theme.colors.bg,
43
+ uni__dependencies: [0]
44
+ }
45
+ }));
46
+
47
+ //#endregion
48
+ export { CountBadge };
49
+ //# sourceMappingURL=CountBadge.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CountBadge.mjs","names":["StyleProp","ViewStyle","StyleSheet","fontOf","CountBadgeProps","count","style","CountBadge","styles","badge","text","String","create","theme","minWidth","height","paddingHorizontal","borderRadius","alignItems","justifyContent","backgroundColor","colors","magenta","borderWidth","borderColor","panel","uni__dependencies","fontFamily","sans","fontSize","lineHeight","fontWeight","semibold","color","bg"],"sources":["../../src/components/CountBadge.tsx"],"sourcesContent":["import { type StyleProp, Text, View, type ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\n\nexport interface CountBadgeProps {\n /** Things waiting for the person; zero or less renders nothing. */\n count: number;\n /** Placement, usually absolute on an icon's top-right; `borderColor` matches the surface behind it. */\n style?: StyleProp<ViewStyle>;\n}\n\n/**\n * The rose count of things waiting for the person, worn on an icon or avatar corner.\n * A gentle ask, so it is rose, never red. Hidden from screen readers: the owner names the count.\n */\nexport function CountBadge({ count, style }: CountBadgeProps) {\n if (count <= 0) return null;\n return (\n <View accessible={false} importantForAccessibility=\"no-hide-descendants\" style={[styles.badge, style]}>\n <Text style={styles.text}>{count > 9 ? '9+' : String(count)}</Text>\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n badge: {\n minWidth: 16,\n height: 16,\n paddingHorizontal: 4,\n borderRadius: 8,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: theme.colors.magenta,\n borderWidth: 1.5,\n borderColor: theme.colors.panel,\n },\n text: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize['2xs'],\n lineHeight: 12,\n fontWeight: theme.fontWeight.semibold,\n color: theme.colors.bg,\n },\n}));\n"],"mappings":";;;;;;;;;;;AAgBA,SAAgBO,WAAW,EAAEF,OAAOC,SAA0B;CAC5D,IAAID,SAAS,GAAG,OAAO;CACvB,OACE,oBAAC,MAAD;EAAM,YAAY;EAAO,2BAA0B;EAAsB,OAAO,CAACG,OAAOC,OAAOH,KAAK;YAClG,oBAAC,MAAD;GAAM,OAAOE,OAAOE;aAAOL,QAAQ,IAAI,OAAOM,OAAON,KAAK;EAAQ;CAC9D;AAEV;AAEA,MAAMG,SAASN,WAAWU,QAAQC,WAAW;CAC3CJ,OAAO;EACLK,UAAU;EACVC,QAAQ;EACRC,mBAAmB;EACnBC,cAAc;EACdC,YAAY;EACZC,gBAAgB;EAChBC,iBAAiBP,MAAMQ,OAAOC;EAC9BC,aAAa;EACbC,aAAaX,MAAMQ,OAAOI;EAAKC,mBAAA,CAAA,CAAA;CACjC;CACAhB,MAAM;EACJiB,YAAYxB,OAAOU,MAAMc,WAAWC,IAAI;EACxCC,UAAUhB,MAAMgB,SAAS;EACzBC,YAAY;EACZC,YAAYlB,MAAMkB,WAAWC;EAC7BC,OAAOpB,MAAMQ,OAAOa;EAAER,mBAAA,CAAA,CAAA;CACxB;AACF,EAAE"}
@@ -0,0 +1,19 @@
1
+ import { ImageSourcePropType, StyleProp, ViewStyle } from "react-native";
2
+ //#region src/components/CtaCard.d.ts
3
+ export interface CtaCardProps {
4
+ title: string;
5
+ description: string;
6
+ /** The one action's label. */
7
+ action: string;
8
+ onAction: () => void;
9
+ /** Decorative art beside the heading, such as Po doing the card's job. */
10
+ artwork?: ImageSourcePropType;
11
+ loading?: boolean;
12
+ /** The outcome of the last action, announced politely. */
13
+ notice?: string;
14
+ style?: StyleProp<ViewStyle>;
15
+ }
16
+ /** A card asking the person to do one thing: heading, a line of why, one primary action, optional art. */
17
+ export declare function CtaCard({ title, description, action, onAction, artwork, loading, notice, style }: CtaCardProps): import("react").JSX.Element;
18
+ //#endregion
19
+ //# sourceMappingURL=CtaCard.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CtaCard.d.mts","names":[],"sources":["../../src/components/CtaCard.tsx"],"mappings":";;iBAOiB;EACf;EACA;;EAEA;EACA;;EAEA,UAAU;EACV;;EAEA;EACA,QAAQ,UAAU;;;wBAIJ,UACd,OACA,aACA,QACA,UACA,SACA,SACA,QACA,SACC,+BAAY,IAAA"}