@agimon-ai/po-native-components 0.0.0-alpha.20 → 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 (193) 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 +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 +46 -0
  50. package/dist/components/FileList.d.mts.map +1 -0
  51. package/dist/components/FileList.mjs +727 -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 +335 -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 +148 -0
  165. package/dist/icons/iconGlyphs.d.mts.map +1 -1
  166. package/dist/icons/iconGlyphs.mjs +148 -0
  167. package/dist/icons/iconGlyphs.mjs.map +1 -1
  168. package/dist/icons/icons.d.mts +149 -1
  169. package/dist/icons/icons.d.mts.map +1 -1
  170. package/dist/icons/icons.mjs +39 -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/package.json +37 -27
package/LICENSE CHANGED
@@ -1,7 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Vuong Ngo
4
- Copyright (c) 2026 pulseaiclub
3
+ Copyright (c) 2026 Agimon Pty Ltd
5
4
 
6
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,16 +1,10 @@
1
- # @agimon-ai/po-native-components
1
+ # Po native components
2
2
 
3
- The React Native component library for Po's native client and its native plugins. It gives native
4
- code the web library's look and API (`@agimon-ai/po-web-components`) built on native parts: the
5
- platform activity indicator, Pressable with an Android ripple and 44pt tap targets, SF Symbols on
6
- iOS and Material icons elsewhere, and a small haptics policy.
3
+ Shared React Native components for the Po app and native plugins. Use them instead of rebuilding buttons, forms, lists, sheets, dialogs, transcript items, or file views in each plugin. They share Po's semantic palette with the web library while using native controls, accessibility roles, touch targets, and platform icons.
7
4
 
8
5
  ## Use
9
6
 
10
- Mount `PoNativeProvider` once at the app root, inside `SafeAreaProvider`. It supplies the gesture
11
- handler root and the bottom sheet host that sheets, dialogs and menus need. Register Po's native
12
- themes with Unistyles (`NATIVE_THEMES` from `@agimon-ai/po-web-components/nativeTheme`) before this
13
- package is imported.
7
+ Register the native Unistyles themes from `@agimon-ai/po-web-components/nativeTheme` before importing this package. Mount `PoNativeProvider` once inside the app's `SafeAreaProvider`; it supplies the gesture root and bottom-sheet host.
14
8
 
15
9
  ```tsx
16
10
  import { Button, PoNativeProvider } from '@agimon-ai/po-native-components';
@@ -22,50 +16,14 @@ import { Button, PoNativeProvider } from '@agimon-ai/po-native-components';
22
16
  </PoNativeProvider>;
23
17
  ```
24
18
 
25
- Plugins reach this package only through the native host module list. Its API is part of that host
26
- contract, so it only ever grows: props and exports are added, never removed or renamed.
19
+ Discover actual exports and props in [`src/exports/index.ts`](src/exports/index.ts) and colocated component stories. Web props are not automatically native contracts: for example, there is no DOM `asChild`, and sheets use native bottom-sheet behavior.
27
20
 
28
- ## Catalogue
21
+ Plugins import this package through the native host-module allowlist. That shared API is additive: do not remove or rename existing exports or props.
29
22
 
30
- | Export | Web counterpart | Native behaviour |
31
- | ----------------------------------------------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
32
- | `Button` | Button (9 variants, 7 sizes) | Pressed state for hover, Android ripple, hitSlop to 44pt, light haptic on primary, danger and success |
33
- | `Label`, `Input`, `Textarea` | Label, Input, Textarea | Placeholder in `faint`, jade cursor, autocorrect off, focus edge at 60% green |
34
- | `Spinner` | Spinner | `ActivityIndicator` in a theme token; a labelled spinner is a live progress indicator |
35
- | `Badge`, `StatusBadge`, `STATUS_EDGE`, `Dot` | Same | Accent edges at 40% alpha; `Dot` pulses with RN `Animated` |
36
- | `EmptyState`, `SectionLabel`, `Panel`, `PanelHeader`, `PanelBody` | Same | Headings carry the header role |
37
- | `List`, `ListRow` | None (the web uses card buttons) | FlashList; hairline separators, iOS disclosure chevron, selected rows on a green tint, `startAtBottom` for a chat list |
38
- | `Sheet` and its parts | Sheet (`side` and `width` dropped) | `BottomSheetModal`: drag handle, sized to content, drag down, backdrop tap or Android back closes; fields inside switch to the sheet's own input |
39
- | `Dialog` and its parts | Dialog (`width`, footer `plain` or `bar`) | RN `Modal` with an `Animated` pop; centred card; Android back and a backdrop tap close it |
40
- | `DropdownMenu` and its parts | DropdownMenu (no submenus yet) | An action list in a bottom sheet; selection haptic; destructive items in red |
41
- | `Tabs` and its parts, `TabBadge` | Tabs | Horizontal `ScrollView`; tab roles; active tab on a green tint; selection haptic |
42
- | `SegmentedControl` | Select (task status) | segmented-control through `withUnistyles`; native on iOS, the library's fallback elsewhere |
43
- | `CodeBlock` | CodeBlock (`text`, `language`) | Horizontal scroll, selectable mono text, expo-clipboard copy; no colouring or mermaid yet |
44
- | `Markdown` | Markdown (`text`, `onFileLink`) | The package's own parser; links open with `Linking`; no tables, images or blockquotes yet |
45
- | `MessageItem` and its parts, `toolTone`, `STATUS_LABEL` | MessageItem | The header is one Pressable that expands the item; edge from `STATUS_EDGE`; outcome as a `StatusBadge` |
46
- | Icons (`CheckIcon` ... `CloseIcon`, 14) | icons.ts, same names | SF Symbols on iOS, MaterialIcons on Android and web |
47
- | `PoNativeProvider` | None | `GestureHandlerRootView` and `BottomSheetModalProvider` |
48
- | `fontOf`, `impactLight`, `selectionTick` | None | Per-platform font family; the haptics policy |
23
+ ## Build and stories
49
24
 
50
- `asChild` has no native equivalent and is dropped. Colours always come from the Unistyles theme;
51
- alpha mixes are computed in render because Unistyles hands stylesheets CSS variables on web.
25
+ `tsdown` emits unbundled ESM with bare dependencies external, so Metro uses the app's single React, Unistyles, and native-library instances. The build applies the Unistyles Babel rewrite before publication.
52
26
 
53
- ## Build
27
+ Component stories are titled `Native/Components/<Name>`. Preview them through the repository's style-system tooling and preserve their identities through implementation. The story-only theme setup in `src/unistyles.ts` is not exported.
54
28
 
55
- `tsdown` emits ESM only (`exports['.']` is `{types, default}`), unbundled, with every bare import
56
- external, so each native library resolves from the app's single copy. The Unistyles Babel rewrite
57
- runs at build time through `unistylesBabel` from `@agimon-ai/po-build/tsdown`.
58
-
59
- ## Stories
60
-
61
- Each component has a colocated `*.stories.tsx` titled `Native/Components/<Name>`, rendered from the
62
- repository root:
63
-
64
- ```sh
65
- pnpm exec style-system get-ui-component -c 'Native/Components/Button' -a packages/core/po-native-components -s Playground
66
- ```
67
-
68
- `src/unistyles.ts` registers the themes for story renders only and is never exported. Story renders
69
- run on react-native-web, so they cannot show SF Symbols, haptics or native ripples; check those on
70
- a device. The SegmentedControl story does not render: style-system's bundler cannot parse the Flow
71
- source segmented-control ships for its non-iOS fallback.
29
+ React Native Web previews do not verify SF Symbols, haptics, ripples, native sheets, or device accessibility behavior. Check those on the target platform. A rendered story is not human approval.
@@ -0,0 +1,19 @@
1
+ //#region src/components/AgentAvatar.d.ts
2
+ /** How an agent is doing, as the avatar's corner dot shows it. */
3
+ export type AgentState = 'running' | 'waiting' | 'done' | 'failed';
4
+ /** One letter for a first name, two for a hyphenated agent name (`po-developer` is PD). */
5
+ export declare function agentInitials(name: string): string;
6
+ declare const TINTS: readonly ["green", "teal", "blue", "cyan", "yellow", "violet"];
7
+ export type Tint = (typeof TINTS)[number];
8
+ /** The tint an avatar seed always reads as, so surfaces outside React Native can paint the same face. */
9
+ export declare function tintFor(seed: string): Tint;
10
+ /** An agent's face: its initials on a tint fixed by `seed`, with its state as a corner dot. */
11
+ export declare function AgentAvatar({ name, seed, state, size }: {
12
+ name: string;
13
+ seed?: string;
14
+ state?: AgentState;
15
+ size?: 'sm' | 'md';
16
+ }): import("react").JSX.Element;
17
+ //#endregion
18
+ export {};
19
+ //# sourceMappingURL=AgentAvatar.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentAvatar.d.mts","names":[],"sources":["../../src/components/AgentAvatar.tsx"],"mappings":";;YAQY;;wBAGI,cAAc;cAUxB;YACM,eAAe;;wBAGX,QAAQ,eAAe;;wBAgBvB,cACd,MACA,MACA,OACA;EAEA;EACA;EACA,QAAQ;EACR;oBACD,IAAA"}
@@ -0,0 +1,88 @@
1
+ import { fontOf } from "../lib/fonts.mjs";
2
+ import { Dot } from "./Dot.mjs";
3
+ import { View } from "react-native-unistyles/components/native/View";
4
+ import { Text } from "react-native-unistyles/components/native/Text";
5
+ import { StyleSheet } from "react-native-unistyles";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+
8
+ //#region src/components/AgentAvatar.tsx
9
+ /** One letter for a first name, two for a hyphenated agent name (`po-developer` is PD). */
10
+ function agentInitials(name) {
11
+ return name.split(/[-_.\s]+/u).filter(Boolean).slice(0, 2).map((part) => part.charAt(0).toUpperCase()).join("");
12
+ }
13
+ const TINTS = [
14
+ "green",
15
+ "teal",
16
+ "blue",
17
+ "cyan",
18
+ "yellow",
19
+ "violet"
20
+ ];
21
+ /** The tint an avatar seed always reads as, so surfaces outside React Native can paint the same face. */
22
+ function tintFor(seed) {
23
+ let hash = 0;
24
+ for (const char of seed) hash = (hash * 31 + char.charCodeAt(0)) % 997;
25
+ return TINTS[hash % TINTS.length] ?? "green";
26
+ }
27
+ const RING = 2;
28
+ const STATE_DOT = {
29
+ running: "green",
30
+ waiting: "yellow",
31
+ done: "neutral",
32
+ failed: "red"
33
+ };
34
+ /** An agent's face: its initials on a tint fixed by `seed`, with its state as a corner dot. */
35
+ function AgentAvatar({ name, seed = name, state, size = "md" }) {
36
+ return /* @__PURE__ */ jsxs(View, {
37
+ accessible: true,
38
+ accessibilityRole: "image",
39
+ accessibilityLabel: state ? `${name}, ${state}` : name,
40
+ testID: "agent-avatar",
41
+ style: styles.frame,
42
+ children: [/* @__PURE__ */ jsx(View, {
43
+ style: styles.face(tintFor(seed), size === "sm" ? 24 : 32),
44
+ children: /* @__PURE__ */ jsx(Text, {
45
+ style: styles.initials,
46
+ children: agentInitials(name)
47
+ })
48
+ }), state ? /* @__PURE__ */ jsx(Dot, {
49
+ tone: STATE_DOT[state],
50
+ size: "md",
51
+ pulse: state === "running",
52
+ style: styles.dot
53
+ }) : null]
54
+ });
55
+ }
56
+ const styles = StyleSheet.create((theme) => ({
57
+ frame: { flexShrink: 0 },
58
+ face: (tint, side) => ({
59
+ width: side,
60
+ height: side,
61
+ alignItems: "center",
62
+ justifyContent: "center",
63
+ borderRadius: theme.borderRadius.full,
64
+ backgroundColor: theme.colors[`tint-${tint}`],
65
+ uni__dependencies: [0]
66
+ }),
67
+ initials: {
68
+ fontFamily: fontOf(theme.fontFamily.sans),
69
+ fontSize: theme.fontSize.sm,
70
+ lineHeight: theme.lineHeight.sm,
71
+ color: theme.colors.hi,
72
+ uni__dependencies: [0]
73
+ },
74
+ dot: {
75
+ position: "absolute",
76
+ right: -4,
77
+ bottom: -4,
78
+ width: theme.spacing(2) + 4,
79
+ height: theme.spacing(2) + 4,
80
+ borderWidth: RING,
81
+ borderColor: theme.colors.panel,
82
+ uni__dependencies: [0]
83
+ }
84
+ }));
85
+
86
+ //#endregion
87
+ export { AgentAvatar, agentInitials, tintFor };
88
+ //# sourceMappingURL=AgentAvatar.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentAvatar.mjs","names":["DotTone","StyleSheet","fontOf","Dot","AgentState","agentInitials","name","split","filter","Boolean","slice","map","part","charAt","toUpperCase","join","TINTS","const","Tint","tintFor","seed","hash","char","charCodeAt","length","RING","STATE_DOT","Readonly","Record","running","waiting","done","failed","AgentAvatar","state","size","styles","frame","face","initials","dot","create","theme","flexShrink","tint","side","width","height","alignItems","justifyContent","borderRadius","full","backgroundColor","colors","uni__dependencies","fontFamily","sans","fontSize","sm","lineHeight","color","hi","position","right","bottom","spacing","borderWidth","borderColor","panel"],"sources":["../../src/components/AgentAvatar.tsx"],"sourcesContent":["import type { DotTone } from '@agimon-ai/po-web-components/nativeTheme';\nimport { Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { Dot } from './Dot';\n\n/** How an agent is doing, as the avatar's corner dot shows it. */\nexport type AgentState = 'running' | 'waiting' | 'done' | 'failed';\n\n/** One letter for a first name, two for a hyphenated agent name (`po-developer` is PD). */\nexport function agentInitials(name: string): string {\n return name\n .split(/[-_.\\s]+/u)\n .filter(Boolean)\n .slice(0, 2)\n .map((part) => part.charAt(0).toUpperCase())\n .join('');\n}\n\n// ponytail: mirrors po-web-components AgentAvatar's tint hash; keep the two in step so a seed reads the same tint.\nconst TINTS = ['green', 'teal', 'blue', 'cyan', 'yellow', 'violet'] as const;\nexport type Tint = (typeof TINTS)[number];\n\n/** The tint an avatar seed always reads as, so surfaces outside React Native can paint the same face. */\nexport function tintFor(seed: string): Tint {\n let hash = 0;\n for (const char of seed) hash = (hash * 31 + char.charCodeAt(0)) % 997;\n return TINTS[hash % TINTS.length] ?? 'green';\n}\n\nconst RING = 2;\n\nconst STATE_DOT: Readonly<Record<AgentState, DotTone>> = {\n running: 'green',\n waiting: 'yellow',\n done: 'neutral',\n failed: 'red',\n};\n\n/** An agent's face: its initials on a tint fixed by `seed`, with its state as a corner dot. */\nexport function AgentAvatar({\n name,\n seed = name,\n state,\n size = 'md',\n}: {\n name: string;\n seed?: string;\n state?: AgentState;\n size?: 'sm' | 'md';\n}) {\n return (\n <View\n accessible\n accessibilityRole=\"image\"\n accessibilityLabel={state ? `${name}, ${state}` : name}\n testID=\"agent-avatar\"\n style={styles.frame}\n >\n <View style={styles.face(tintFor(seed), size === 'sm' ? 24 : 32)}>\n <Text style={styles.initials}>{agentInitials(name)}</Text>\n </View>\n {state ? <Dot tone={STATE_DOT[state]} size=\"md\" pulse={state === 'running'} style={styles.dot} /> : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n frame: { flexShrink: 0 },\n // `size-6` and `size-8`.\n face: (tint: Tint, side: number) => ({\n width: side,\n height: side,\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: theme.borderRadius.full,\n backgroundColor: theme.colors[`tint-${tint}`],\n }),\n initials: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n color: theme.colors.hi,\n },\n // `-right-0.5 -bottom-0.5 ring-2 ring-po-panel`: a ring sits outside the dot, a border inside, so the box grows by it.\n dot: {\n position: 'absolute',\n right: -2 - RING,\n bottom: -2 - RING,\n width: theme.spacing(2) + 2 * RING,\n height: theme.spacing(2) + 2 * RING,\n borderWidth: RING,\n borderColor: theme.colors.panel,\n },\n}));\n"],"mappings":";;;;;;;;;AAWA,SAAgBK,cAAcC,MAAsB;CAClD,OAAOA,KACJC,MAAM,WAAW,CAAC,CAClBC,OAAOC,OAAO,CAAC,CACfC,MAAM,GAAG,CAAC,CAAC,CACXC,KAAKC,SAASA,KAAKC,OAAO,CAAC,CAAC,CAACC,YAAY,CAAC,CAAC,CAC3CC,KAAK,EAAE;AACZ;AAGA,MAAMC,QAAQ;CAAC;CAAS;CAAQ;CAAQ;CAAQ;CAAU;AAAQ;;AAIlE,SAAgBG,QAAQC,MAAoB;CAC1C,IAAIC,OAAO;CACX,KAAK,MAAMC,QAAQF,MAAMC,QAAQA,OAAO,KAAKC,KAAKC,WAAW,CAAC,KAAK;CACnE,OAAOP,MAAMK,OAAOL,MAAMQ,WAAW;AACvC;AAEA,MAAMC,OAAO;AAEb,MAAMC,YAAmD;CACvDG,SAAS;CACTC,SAAS;CACTC,MAAM;CACNC,QAAQ;AACV;;AAGA,SAAgBC,YAAY,EAC1B3B,MACAc,OAAOd,MACP4B,OACAC,OAAO,QAMN;CACD,OACE,qBAAC,MAAD;EACE;EACA,mBAAkB;EAClB,oBAAoBD,QAAQ,GAAG5B,KAAI,IAAK4B,UAAU5B;EAClD,QAAO;EACP,OAAO8B,OAAOC;YALhB,CAOE,oBAAC,MAAD;GAAM,OAAOD,OAAOE,KAAKnB,QAAQC,IAAI,GAAGe,SAAS,OAAO,KAAK,EAAE;aAC7D,oBAAC,MAAD;IAAM,OAAOC,OAAOG;cAAWlC,cAAcC,IAAI;GAAQ;EACrD,IACL4B,QAAQ,oBAAC,KAAD;GAAK,MAAMR,UAAUQ;GAAQ,MAAK;GAAK,OAAOA,UAAU;GAAW,OAAOE,OAAOI;EAAI,KAAM,IAChG;;AAEV;AAEA,MAAMJ,SAASnC,WAAWwC,QAAQC,WAAW;CAC3CL,OAAO,EAAEM,YAAY,EAAE;CAEvBL,OAAOM,MAAYC,UAAkB;EACnCC,OAAOD;EACPE,QAAQF;EACRG,YAAY;EACZC,gBAAgB;EAChBC,cAAcR,MAAMQ,aAAaC;EACjCC,iBAAiBV,MAAMW,OAAO,QAAQT;EAAOU,mBAAA,CAAA,CAAA;CAC/C;CACAf,UAAU;EACRgB,YAAYrD,OAAOwC,MAAMa,WAAWC,IAAI;EACxCC,UAAUf,MAAMe,SAASC;EACzBC,YAAYjB,MAAMiB,WAAWD;EAC7BE,OAAOlB,MAAMW,OAAOQ;EAAEP,mBAAA,CAAA,CAAA;CACxB;CAEAd,KAAK;EACHsB,UAAU;EACVC,OAAO;EACPC,QAAQ;EACRlB,OAAOJ,MAAMuB,QAAQ,CAAC,IAAI;EAC1BlB,QAAQL,MAAMuB,QAAQ,CAAC,IAAI;EAC3BC,aAAazC;EACb0C,aAAazB,MAAMW,OAAOe;EAAKd,mBAAA,CAAA,CAAA;CACjC;AACF,EAAE"}
@@ -0,0 +1,69 @@
1
+ import { StyleProp, ViewStyle } from "react-native";
2
+ import { ReactNode } from "react";
3
+ //#region src/components/AnnotationSurface.d.ts
4
+ /** One note pinned to the content, with an optional stroke, in fractions (0 to 1) of the surface's width and height. */
5
+ export interface AnnotationMark {
6
+ id: string;
7
+ x: number;
8
+ y: number;
9
+ /** The short text drawn on the pin, such as "1". */
10
+ label: string;
11
+ /** What a screen reader announces for the pin, such as the note text. */
12
+ description?: string;
13
+ /** Optional normalized freehand stroke. At most 128 finite points are rendered. */
14
+ points?: readonly {
15
+ x: number;
16
+ y: number;
17
+ }[];
18
+ /** A translucent, thick rose stroke over the content. */
19
+ highlight?: boolean;
20
+ }
21
+ export interface AnnotationSurfaceProps {
22
+ /** The content being marked up: an image, a page, a block of text. */
23
+ children: ReactNode;
24
+ marks: readonly AnnotationMark[];
25
+ selectedId?: string;
26
+ /** A tap places a note there. Without onPlace or onDraw the surface is read-only. */
27
+ onPlace?: (point: {
28
+ x: number;
29
+ y: number;
30
+ }) => void;
31
+ /** Enables drawing instead of tap placement. Receives 2 to 128 finite [0,1] points only on a completed stroke. */
32
+ onDraw?: (points: {
33
+ x: number;
34
+ y: number;
35
+ }[]) => void;
36
+ onSelectMark?: (id: string) => void;
37
+ /** What the content is, such as "hero.png". */
38
+ accessibilityLabel: string;
39
+ /** Image surfaces can pinch and move with two fingers on both native platforms. */
40
+ zoomable?: boolean;
41
+ /** Explicit one-finger pan instead of placing or drawing marks. */
42
+ navigation?: boolean;
43
+ /** Controlled transform. Origins are unscaled RN layout positions, not raster pixels. */
44
+ viewport?: {
45
+ zoom: number;
46
+ originX: number;
47
+ originY: number;
48
+ };
49
+ /** Render the in-progress stroke as a highlight. */
50
+ drawingHighlight?: boolean;
51
+ /** Viewport dimensions and source-layout-to-viewport transform, all in RN layout units, not raster pixels. */
52
+ onViewportChange?: (viewport: {
53
+ width: number;
54
+ height: number;
55
+ zoom: number;
56
+ originX: number;
57
+ originY: number;
58
+ }) => void;
59
+ style?: StyleProp<ViewStyle>;
60
+ }
61
+ /**
62
+ * Tap to pin a note on whatever it wraps. Each pin is its own 44pt button, so a
63
+ * screen reader can reach every note; the surface's own element sits behind the
64
+ * content, so text and controls inside stay readable, and activating it places a
65
+ * note at its centre.
66
+ */
67
+ export declare function AnnotationSurface({ children, marks, selectedId, onPlace, onDraw, onSelectMark, accessibilityLabel, zoomable, onViewportChange, navigation, viewport: controlledViewport, drawingHighlight, style }: AnnotationSurfaceProps): import("react").JSX.Element;
68
+ //#endregion
69
+ //# sourceMappingURL=AnnotationSurface.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnnotationSurface.d.mts","names":[],"sources":["../../src/components/AnnotationSurface.tsx"],"mappings":";;;;iBASiB;EACf;EACA;EACA;;EAEA;;EAEA;;EAEA;IAAoB;IAAW;;;EAE/B;;iBAGe;;EAEf,UAAU;EACV,gBAAgB;EAChB;;EAEA,WAAW;IAAS;IAAW;;;EAE/B,UAAU;IAAU;IAAW;;EAC/B,gBAAgB;;EAEhB;;EAEA;;EAEA;;EAEA;IAAa;IAAc;IAAiB;;;EAE5C;;EAEA,oBAAoB;IAClB;IACA;IACA;IACA;IACA;;EAEF,QAAQ,UAAU;;;;;;;;wBAqDJ,oBACd,UACA,OACA,YACA,SACA,QACA,cACA,oBACA,UACA,kBACA,YACA,UAAU,oBACV,kBACA,SACC,yCAAsB,IAAA"}