@agimon-ai/po-native-components 0.0.0-alpha.13 → 0.0.0-alpha.130

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 (141) hide show
  1. package/LICENSE +149 -22
  2. package/dist/components/AgentAvatar.d.mts +14 -0
  3. package/dist/components/AgentAvatar.d.mts.map +1 -0
  4. package/dist/components/AgentAvatar.mjs +87 -0
  5. package/dist/components/AgentAvatar.mjs.map +1 -0
  6. package/dist/components/AnnotationSurface.d.mts +69 -0
  7. package/dist/components/AnnotationSurface.d.mts.map +1 -0
  8. package/dist/components/AnnotationSurface.mjs +426 -0
  9. package/dist/components/AnnotationSurface.mjs.map +1 -0
  10. package/dist/components/Badge.d.mts +1 -1
  11. package/dist/components/Badge.mjs +1 -1
  12. package/dist/components/Button.mjs +3 -3
  13. package/dist/components/Button.mjs.map +1 -1
  14. package/dist/components/CodeBlock.d.mts +3 -1
  15. package/dist/components/CodeBlock.d.mts.map +1 -1
  16. package/dist/components/CodeBlock.mjs +35 -47
  17. package/dist/components/CodeBlock.mjs.map +1 -1
  18. package/dist/components/CopyButton.d.mts +13 -0
  19. package/dist/components/CopyButton.d.mts.map +1 -0
  20. package/dist/components/CopyButton.mjs +43 -0
  21. package/dist/components/CopyButton.mjs.map +1 -0
  22. package/dist/components/CountBadge.d.mts +15 -0
  23. package/dist/components/CountBadge.d.mts.map +1 -0
  24. package/dist/components/CountBadge.mjs +49 -0
  25. package/dist/components/CountBadge.mjs.map +1 -0
  26. package/dist/components/Dialog.d.mts.map +1 -1
  27. package/dist/components/Dialog.mjs +9 -8
  28. package/dist/components/Dialog.mjs.map +1 -1
  29. package/dist/components/Dot.d.mts +1 -1
  30. package/dist/components/Dot.mjs +2 -2
  31. package/dist/components/DropdownMenu.d.mts +3 -1
  32. package/dist/components/DropdownMenu.d.mts.map +1 -1
  33. package/dist/components/DropdownMenu.mjs +21 -14
  34. package/dist/components/DropdownMenu.mjs.map +1 -1
  35. package/dist/components/HashlineLines.d.mts +13 -0
  36. package/dist/components/HashlineLines.d.mts.map +1 -0
  37. package/dist/components/HashlineLines.mjs +148 -0
  38. package/dist/components/HashlineLines.mjs.map +1 -0
  39. package/dist/components/HostFilter.d.mts +17 -0
  40. package/dist/components/HostFilter.d.mts.map +1 -0
  41. package/dist/components/HostFilter.mjs +66 -0
  42. package/dist/components/HostFilter.mjs.map +1 -0
  43. package/dist/components/HostTag.d.mts +7 -0
  44. package/dist/components/HostTag.d.mts.map +1 -0
  45. package/dist/components/HostTag.mjs +47 -0
  46. package/dist/components/HostTag.mjs.map +1 -0
  47. package/dist/components/InfoStrip.d.mts +9 -0
  48. package/dist/components/InfoStrip.d.mts.map +1 -0
  49. package/dist/components/InfoStrip.mjs +53 -0
  50. package/dist/components/InfoStrip.mjs.map +1 -0
  51. package/dist/components/Input.d.mts +3 -1
  52. package/dist/components/Input.d.mts.map +1 -1
  53. package/dist/components/Input.mjs +4 -3
  54. package/dist/components/Input.mjs.map +1 -1
  55. package/dist/components/Label.mjs +1 -1
  56. package/dist/components/List.d.mts.map +1 -1
  57. package/dist/components/List.mjs +38 -6
  58. package/dist/components/List.mjs.map +1 -1
  59. package/dist/components/LiveDuration.d.mts +30 -0
  60. package/dist/components/LiveDuration.d.mts.map +1 -0
  61. package/dist/components/LiveDuration.mjs +67 -0
  62. package/dist/components/LiveDuration.mjs.map +1 -0
  63. package/dist/components/Markdown.d.mts +10 -1
  64. package/dist/components/Markdown.d.mts.map +1 -1
  65. package/dist/components/Markdown.mjs +335 -26
  66. package/dist/components/Markdown.mjs.map +1 -1
  67. package/dist/components/MessageItem.d.mts +10 -15
  68. package/dist/components/MessageItem.d.mts.map +1 -1
  69. package/dist/components/MessageItem.mjs +72 -63
  70. package/dist/components/MessageItem.mjs.map +1 -1
  71. package/dist/components/NativeShellState.d.mts +30 -0
  72. package/dist/components/NativeShellState.d.mts.map +1 -0
  73. package/dist/components/NativeShellState.mjs +61 -0
  74. package/dist/components/NativeShellState.mjs.map +1 -0
  75. package/dist/components/SectionLabel.mjs +1 -1
  76. package/dist/components/Select.d.mts +33 -0
  77. package/dist/components/Select.d.mts.map +1 -0
  78. package/dist/components/Select.mjs +222 -0
  79. package/dist/components/Select.mjs.map +1 -0
  80. package/dist/components/Sheet.d.mts +9 -1
  81. package/dist/components/Sheet.d.mts.map +1 -1
  82. package/dist/components/Sheet.mjs +27 -10
  83. package/dist/components/Sheet.mjs.map +1 -1
  84. package/dist/components/SheetFrame.mjs +143 -28
  85. package/dist/components/SheetFrame.mjs.map +1 -1
  86. package/dist/components/SheetList.d.mts +14 -0
  87. package/dist/components/SheetList.d.mts.map +1 -0
  88. package/dist/components/SheetList.mjs +34 -0
  89. package/dist/components/SheetList.mjs.map +1 -0
  90. package/dist/components/ShowMore.d.mts +10 -0
  91. package/dist/components/ShowMore.d.mts.map +1 -0
  92. package/dist/components/ShowMore.mjs +44 -0
  93. package/dist/components/ShowMore.mjs.map +1 -0
  94. package/dist/components/Spinner.d.mts +1 -1
  95. package/dist/components/StatusBadge.d.mts +1 -1
  96. package/dist/components/Switch.d.mts +14 -0
  97. package/dist/components/Switch.d.mts.map +1 -0
  98. package/dist/components/Switch.mjs +37 -0
  99. package/dist/components/Switch.mjs.map +1 -0
  100. package/dist/components/SyntaxLine.d.mts +19 -0
  101. package/dist/components/SyntaxLine.d.mts.map +1 -0
  102. package/dist/components/SyntaxLine.mjs +134 -0
  103. package/dist/components/SyntaxLine.mjs.map +1 -0
  104. package/dist/components/Tabs.d.mts.map +1 -1
  105. package/dist/components/Tabs.mjs +8 -7
  106. package/dist/components/Tabs.mjs.map +1 -1
  107. package/dist/components/ToolPathLink.d.mts +10 -0
  108. package/dist/components/ToolPathLink.d.mts.map +1 -0
  109. package/dist/components/ToolPathLink.mjs +40 -0
  110. package/dist/components/ToolPathLink.mjs.map +1 -0
  111. package/dist/components/ToolResultImage.d.mts +12 -0
  112. package/dist/components/ToolResultImage.d.mts.map +1 -0
  113. package/dist/components/ToolResultImage.mjs +48 -0
  114. package/dist/components/ToolResultImage.mjs.map +1 -0
  115. package/dist/icons/iconGlyphs.d.mts +60 -0
  116. package/dist/icons/iconGlyphs.d.mts.map +1 -1
  117. package/dist/icons/iconGlyphs.mjs +60 -0
  118. package/dist/icons/iconGlyphs.mjs.map +1 -1
  119. package/dist/icons/icons.d.mts +61 -1
  120. package/dist/icons/icons.d.mts.map +1 -1
  121. package/dist/icons/icons.mjs +17 -2
  122. package/dist/icons/icons.mjs.map +1 -1
  123. package/dist/index.d.mts +20 -6
  124. package/dist/index.mjs +21 -7
  125. package/dist/lib/fonts.d.mts +3 -1
  126. package/dist/lib/fonts.d.mts.map +1 -1
  127. package/dist/lib/fonts.mjs +4 -2
  128. package/dist/lib/fonts.mjs.map +1 -1
  129. package/dist/lib/insideSheet.d.mts +10 -0
  130. package/dist/lib/insideSheet.d.mts.map +1 -0
  131. package/dist/lib/markdown.mjs +172 -23
  132. package/dist/lib/markdown.mjs.map +1 -1
  133. package/dist/lib/reading.mjs +60 -0
  134. package/dist/lib/reading.mjs.map +1 -0
  135. package/dist/lib/useControllable.mjs +14 -6
  136. package/dist/lib/useControllable.mjs.map +1 -1
  137. package/dist/lib/useReadingPage.mjs +33 -0
  138. package/dist/lib/useReadingPage.mjs.map +1 -0
  139. package/dist/shell.d.mts +6 -0
  140. package/dist/shell.mjs +7 -0
  141. package/package.json +37 -28
@@ -0,0 +1,13 @@
1
+ import { PresentedLine } from "@agimon-ai/po-web-components/text";
2
+ import { ViewProps } from "react-native";
3
+ //#region src/components/HashlineLines.d.ts
4
+ export interface HashlineLinesProps extends Omit<ViewProps, 'children'> {
5
+ lines: readonly PresentedLine[];
6
+ /** Width of the line-number column, in characters, from `hashlineBody`. */
7
+ gutter: number;
8
+ /** The file a body of bare anchored lines came from, for highlighting. */
9
+ path?: string | undefined;
10
+ }
11
+ export declare function HashlineLines({ lines, gutter, path, style, ...props }: HashlineLinesProps): import("react").JSX.Element;
12
+ //#endregion
13
+ //# sourceMappingURL=HashlineLines.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HashlineLines.d.mts","names":[],"sources":["../../src/components/HashlineLines.tsx"],"mappings":";;;iBA6BiB,2BAA2B,KAAK;EAC/C,gBAAgB;;EAEhB;;EAEA;;wBAwCc,gBAAgB,OAAO,QAAQ,MAAM,UAAU,SAAS,qCAAkB,IAAA"}
@@ -0,0 +1,148 @@
1
+ import { fontOf } from "../lib/fonts.mjs";
2
+ import { READING } from "../lib/reading.mjs";
3
+ import { useReadingPage } from "../lib/useReadingPage.mjs";
4
+ import { ShowMore } from "./ShowMore.mjs";
5
+ import { SyntaxLine } from "./SyntaxLine.mjs";
6
+ import { detectGrammar, hashlineGroups, hashlineGroupsKey, highlightToLines } from "@agimon-ai/po-web-components/text";
7
+ import { View } from "react-native-unistyles/components/native/View";
8
+ import { Text } from "react-native-unistyles/components/native/Text";
9
+ import { StyleSheet } from "react-native-unistyles";
10
+ import { useEffect, useMemo, useState } from "react";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+
13
+ //#region src/components/HashlineLines.tsx
14
+ const NO_SPANS = /* @__PURE__ */ new Map();
15
+ /** Spans per presented-line index, kept with the body they belong to, as the web's hook. */
16
+ function useHashlineSpans(lines, path) {
17
+ const groups = useMemo(() => hashlineGroups(lines, path), [lines, path]);
18
+ const key = hashlineGroupsKey(groups);
19
+ const [done, setDone] = useState();
20
+ useEffect(() => {
21
+ let live = true;
22
+ const controller = new AbortController();
23
+ const next = /* @__PURE__ */ new Map();
24
+ const work = groups.map(async (group) => {
25
+ const grammar = detectGrammar({
26
+ path: group.path,
27
+ text: group.text
28
+ });
29
+ if (grammar === void 0) return;
30
+ const highlighted = await highlightToLines(group.text, grammar, controller.signal);
31
+ if (highlighted === void 0) return;
32
+ for (const [offset, index] of group.indices.entries()) {
33
+ const line = highlighted[offset];
34
+ if (line !== void 0) next.set(index, line);
35
+ }
36
+ });
37
+ Promise.allSettled(work).then(() => {
38
+ if (live && next.size > 0) setDone({
39
+ key,
40
+ spans: next
41
+ });
42
+ });
43
+ return () => {
44
+ live = false;
45
+ controller.abort();
46
+ };
47
+ }, [key]);
48
+ return done?.key === key ? done.spans : NO_SPANS;
49
+ }
50
+ function HashlineLines({ lines, gutter, path, style, ...props }) {
51
+ const { page, reveal } = useReadingPage(`${path ?? ""}\n${lines.map((line) => JSON.stringify(line)).join("\n")}`);
52
+ const visible = useMemo(() => lines.slice(0, READING.hashlines * page), [lines, page]);
53
+ const spans = useHashlineSpans(visible, path);
54
+ return /* @__PURE__ */ jsxs(View, {
55
+ style,
56
+ ...props,
57
+ children: [visible.map((line, index) => {
58
+ if (line.type === "file") return /* @__PURE__ */ jsx(Text, {
59
+ numberOfLines: 1,
60
+ style: [
61
+ styles.mono,
62
+ styles.faint,
63
+ index > 0 && styles.fileGap
64
+ ],
65
+ children: line.path
66
+ }, index);
67
+ if (line.type === "plain") return /* @__PURE__ */ jsx(Text, {
68
+ selectable: true,
69
+ style: [styles.mono, styles.dim],
70
+ children: line.text
71
+ }, index);
72
+ const { value } = line;
73
+ const match = value.marker === "match";
74
+ return /* @__PURE__ */ jsxs(View, {
75
+ style: styles.row,
76
+ children: [
77
+ value.marker !== void 0 ? /* @__PURE__ */ jsx(Text, {
78
+ style: [styles.mono, match ? styles.marker : styles.faint],
79
+ children: match ? ">>" : " "
80
+ }) : null,
81
+ /* @__PURE__ */ jsx(Text, {
82
+ style: [styles.mono, styles.faint],
83
+ children: String(value.line).padStart(gutter)
84
+ }),
85
+ /* @__PURE__ */ jsx(SyntaxLine, {
86
+ selectable: true,
87
+ spans: spans.get(index),
88
+ text: value.content,
89
+ style: [
90
+ styles.mono,
91
+ styles.content,
92
+ match ? styles.hi : styles.text
93
+ ]
94
+ })
95
+ ]
96
+ }, index);
97
+ }), visible.length < lines.length ? /* @__PURE__ */ jsx(ShowMore, {
98
+ label: "Show more lines",
99
+ summary: `${visible.length} of ${lines.length} lines`,
100
+ onPress: reveal
101
+ }) : null]
102
+ });
103
+ }
104
+ const styles = StyleSheet.create((theme) => ({
105
+ row: {
106
+ flexDirection: "row",
107
+ gap: theme.spacing(2),
108
+ uni__dependencies: [0]
109
+ },
110
+ fileGap: {
111
+ marginTop: theme.spacing(1),
112
+ uni__dependencies: [0]
113
+ },
114
+ mono: {
115
+ fontFamily: fontOf(theme.fontFamily.mono),
116
+ fontSize: theme.fontSize.sm,
117
+ lineHeight: theme.lineHeightRelaxed.sm,
118
+ uni__dependencies: [0]
119
+ },
120
+ content: {
121
+ flex: 1,
122
+ minWidth: 0
123
+ },
124
+ marker: {
125
+ color: theme.colors.blue,
126
+ uni__dependencies: [0]
127
+ },
128
+ faint: {
129
+ color: theme.colors.faint,
130
+ uni__dependencies: [0]
131
+ },
132
+ dim: {
133
+ color: theme.colors.dim,
134
+ uni__dependencies: [0]
135
+ },
136
+ text: {
137
+ color: theme.colors.text,
138
+ uni__dependencies: [0]
139
+ },
140
+ hi: {
141
+ color: theme.colors.hi,
142
+ uni__dependencies: [0]
143
+ }
144
+ }));
145
+
146
+ //#endregion
147
+ export { HashlineLines };
148
+ //# sourceMappingURL=HashlineLines.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HashlineLines.mjs","names":["detectGrammar","hashlineGroups","hashlineGroupsKey","highlightToLines","PresentedLine","SyntaxSpan","useEffect","useMemo","useState","ViewProps","StyleSheet","fontOf","READING","useReadingPage","ShowMore","SyntaxLine","HashlineLinesProps","Omit","lines","gutter","path","NO_SPANS","ReadonlyMap","Map","useHashlineSpans","groups","key","done","setDone","spans","live","controller","AbortController","next","work","map","group","grammar","text","undefined","highlighted","signal","offset","index","indices","entries","line","set","Promise","allSettled","then","size","abort","HashlineLines","style","props","page","reveal","JSON","stringify","join","visible","slice","hashlines","type","styles","mono","faint","fileGap","dim","value","match","marker","row","String","padStart","get","content","hi","length","create","theme","flexDirection","gap","spacing","uni__dependencies","marginTop","fontFamily","fontSize","sm","lineHeight","lineHeightRelaxed","flex","minWidth","color","colors","blue"],"sources":["../../src/components/HashlineLines.tsx"],"sourcesContent":["import {\n detectGrammar,\n hashlineGroups,\n hashlineGroupsKey,\n highlightToLines,\n type PresentedLine,\n type SyntaxSpan,\n} from '@agimon-ai/po-web-components/text';\nimport { useEffect, useMemo, useState } from 'react';\nimport { Text, View, type ViewProps } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { READING } from '../lib/reading';\nimport { useReadingPage } from '../lib/useReadingPage';\nimport { ShowMore } from './ShowMore';\nimport { SyntaxLine } from './SyntaxLine';\n\n/*\n * The anchored body shared by hashline results, as the web's HashlineLines: a\n * file heading per group, a right-aligned line-number gutter, and a `>>`\n * marker on grep matches. Mono type makes a padded number the gutter, so the\n * column needs no measuring.\n *\n * The anchored lines are coloured with the web's grammars and palette when the\n * body names a file, or when `path` names one. Colour arrives late and never\n * blocks the text: an unhighlighted body is the same body without the colours.\n */\n\nexport interface HashlineLinesProps extends Omit<ViewProps, 'children'> {\n lines: readonly PresentedLine[];\n /** Width of the line-number column, in characters, from `hashlineBody`. */\n gutter: number;\n /** The file a body of bare anchored lines came from, for highlighting. */\n path?: string | undefined;\n}\n\nconst NO_SPANS: ReadonlyMap<number, readonly SyntaxSpan[]> = new Map();\n\n/** Spans per presented-line index, kept with the body they belong to, as the web's hook. */\nfunction useHashlineSpans(lines: readonly PresentedLine[], path: string | undefined) {\n const groups = useMemo(() => hashlineGroups(lines, path), [lines, path]);\n const key = hashlineGroupsKey(groups);\n const [done, setDone] = useState<{ key: string; spans: ReadonlyMap<number, readonly SyntaxSpan[]> }>();\n\n useEffect(() => {\n let live = true;\n const controller = new AbortController();\n const next = new Map<number, readonly SyntaxSpan[]>();\n const work = groups.map(async (group) => {\n const grammar = detectGrammar({ path: group.path, text: group.text });\n if (grammar === undefined) return;\n const highlighted = await highlightToLines(group.text, grammar, controller.signal);\n if (highlighted === undefined) return;\n for (const [offset, index] of group.indices.entries()) {\n const line = highlighted[offset];\n if (line !== undefined) next.set(index, line);\n }\n });\n // A grammar that fails to load leaves its run plain: colour is decoration.\n void Promise.allSettled(work).then(() => {\n if (live && next.size > 0) setDone({ key, spans: next });\n });\n return () => {\n live = false;\n controller.abort();\n };\n // The groups are rebuilt with the lines; their key is what actually changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [key]);\n\n return done?.key === key ? done.spans : NO_SPANS;\n}\n\nexport function HashlineLines({ lines, gutter, path, style, ...props }: HashlineLinesProps) {\n // Whole anchored lines retain their exact content and line numbers, even above 640 characters.\n const { page, reveal } = useReadingPage(`${path ?? ''}\\n${lines.map((line) => JSON.stringify(line)).join('\\n')}`);\n const visible = useMemo(() => lines.slice(0, READING.hashlines * page), [lines, page]);\n const spans = useHashlineSpans(visible, path);\n return (\n <View style={style} {...props}>\n {visible.map((line, index) => {\n if (line.type === 'file') {\n return (\n <Text key={index} numberOfLines={1} style={[styles.mono, styles.faint, index > 0 && styles.fileGap]}>\n {line.path}\n </Text>\n );\n }\n if (line.type === 'plain') {\n return (\n <Text key={index} selectable style={[styles.mono, styles.dim]}>\n {line.text}\n </Text>\n );\n }\n const { value } = line;\n const match = value.marker === 'match';\n return (\n <View key={index} style={styles.row}>\n {value.marker !== undefined ? (\n <Text style={[styles.mono, match ? styles.marker : styles.faint]}>{match ? '>>' : ' '}</Text>\n ) : null}\n <Text style={[styles.mono, styles.faint]}>{String(value.line).padStart(gutter)}</Text>\n <SyntaxLine\n selectable\n spans={spans.get(index)}\n text={value.content}\n style={[styles.mono, styles.content, match ? styles.hi : styles.text]}\n />\n </View>\n );\n })}\n {visible.length < lines.length ? (\n <ShowMore label=\"Show more lines\" summary={`${visible.length} of ${lines.length} lines`} onPress={reveal} />\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n row: { flexDirection: 'row', gap: theme.spacing(2) },\n fileGap: { marginTop: theme.spacing(1) },\n mono: {\n fontFamily: fontOf(theme.fontFamily.mono),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeightRelaxed.sm,\n },\n content: { flex: 1, minWidth: 0 },\n marker: { color: theme.colors.blue },\n faint: { color: theme.colors.faint },\n dim: { color: theme.colors.dim },\n text: { color: theme.colors.text },\n hi: { color: theme.colors.hi },\n}));\n"],"mappings":";;;;;;;;;;;;;AAqCA,MAAMqB,2BAAuD,IAAIE,IAAI;;AAGrE,SAASC,iBAAiBN,OAAiCE,MAA0B;CACnF,MAAMK,SAASlB,cAAcN,eAAeiB,OAAOE,IAAI,GAAG,CAACF,OAAOE,IAAI,CAAC;CACvE,MAAMM,MAAMxB,kBAAkBuB,MAAM;CACpC,MAAM,CAACE,MAAMC,WAAWpB,SAA6E;CAErGF,gBAAgB;EACd,IAAIwB,OAAO;EACX,MAAMC,aAAa,IAAIC,gBAAgB;EACvC,MAAMC,uBAAO,IAAIV,IAAmC;EACpD,MAAMW,OAAOT,OAAOU,IAAI,OAAOC,UAAU;GACvC,MAAMC,UAAUrC,cAAc;IAAEoB,MAAMgB,MAAMhB;IAAMkB,MAAMF,MAAME;GAAK,CAAC;GACpE,IAAID,YAAYE,QAAW;GAC3B,MAAMC,cAAc,MAAMrC,iBAAiBiC,MAAME,MAAMD,SAASN,WAAWU,MAAM;GACjF,IAAID,gBAAgBD,QAAW;GAC/B,KAAK,MAAM,CAACG,QAAQC,UAAUP,MAAMQ,QAAQC,QAAQ,GAAG;IACrD,MAAMC,OAAON,YAAYE;IACzB,IAAII,SAASP,QAAWN,KAAKc,IAAIJ,OAAOG,IAAI;GAC9C;EACF,CAAC;EAED,AAAKE,QAAQC,WAAWf,IAAI,CAAC,CAACgB,WAAW;GACvC,IAAIpB,QAAQG,KAAKkB,OAAO,GAAGvB,QAAQ;IAAEF;IAAKG,OAAOI;GAAK,CAAC;EACzD,CAAC;EACD,aAAa;GACXH,OAAO;GACPC,WAAWqB,MAAM;EACnB;CAGF,GAAG,CAAC1B,GAAG,CAAC;CAER,OAAOC,MAAMD,QAAQA,MAAMC,KAAKE,QAAQR;A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string;
6
+ }[];
7
+ /** null means All. This is presentation only, not a transport selection. */
8
+ value: string | null;
9
+ onChange: (id: string | null) => void;
10
+ /** Off when the choice names where something lives, so exactly one computer is always chosen. */
11
+ includeAll?: boolean;
12
+ accessibilityLabel?: string;
13
+ }
14
+ /** Short names use the native segmented control; long names remain reachable by scrolling. */
15
+ export declare function HostFilter({ hosts, value, onChange, includeAll, accessibilityLabel }: HostFilterProps): import("react").JSX.Element;
16
+ //#endregion
17
+ //# sourceMappingURL=HostFilter.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HostFilter.d.mts","names":[],"sources":["../../src/components/HostFilter.tsx"],"mappings":";iBAOiB;EACf;IAAkB;IAAY;;;EAE9B;EACA,WAAW;;EAEX;EACA;;;wBAOc,aACd,OACA,OACA,UACA,YACA,sBACC,kCAAe,IAAA"}
@@ -0,0 +1,66 @@
1
+ import { selectionTick } from "../lib/haptics.mjs";
2
+ import { Button } from "./Button.mjs";
3
+ import { SegmentedControl } from "./SegmentedControl.mjs";
4
+ import { View } from "react-native-unistyles/components/native/View";
5
+ import { StyleSheet } from "react-native-unistyles";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import { ScrollView } from "react-native-unistyles/components/native/ScrollView";
8
+
9
+ //#region src/components/HostFilter.tsx
10
+ const ALL = "";
11
+ const MAX_SEGMENTS = 3;
12
+ const MAX_SEGMENT_LABEL = 12;
13
+ /** Short names use the native segmented control; long names remain reachable by scrolling. */
14
+ function HostFilter({ hosts, value, onChange, includeAll = true, accessibilityLabel = "Filter by computer" }) {
15
+ const options = [...includeAll ? [{
16
+ value: ALL,
17
+ label: "All"
18
+ }] : [], ...hosts.map(({ id, label }) => ({
19
+ value: id,
20
+ label
21
+ }))];
22
+ const selected = hosts.some(({ id }) => id === value) ? value : includeAll ? ALL : hosts[0]?.id ?? ALL;
23
+ if (options.length <= MAX_SEGMENTS && options.every(({ label }) => label.length <= MAX_SEGMENT_LABEL)) return /* @__PURE__ */ jsx(SegmentedControl, {
24
+ options,
25
+ value: selected,
26
+ onValueChange: (id) => onChange(id || null),
27
+ accessibilityLabel,
28
+ style: styles.control
29
+ });
30
+ return /* @__PURE__ */ jsx(ScrollView, {
31
+ horizontal: true,
32
+ showsHorizontalScrollIndicator: false,
33
+ accessibilityLabel,
34
+ children: /* @__PURE__ */ jsx(View, {
35
+ style: styles.choices,
36
+ children: options.map(({ value: id, label }) => /* @__PURE__ */ jsx(Button, {
37
+ variant: selected === id ? "subtle" : "ghost",
38
+ accessibilityState: { selected: selected === id },
39
+ style: [styles.choice, selected === id && styles.selected],
40
+ onPress: () => {
41
+ selectionTick();
42
+ onChange(id || null);
43
+ },
44
+ children: label
45
+ }, id))
46
+ })
47
+ });
48
+ }
49
+ const styles = StyleSheet.create((theme) => ({
50
+ control: { minHeight: 44 },
51
+ choices: {
52
+ flexDirection: "row",
53
+ gap: theme.spacing(2),
54
+ uni__dependencies: [0]
55
+ },
56
+ choice: { minHeight: 44 },
57
+ selected: {
58
+ backgroundColor: theme.colors["tint-green"],
59
+ borderColor: theme.colors["edge-green"],
60
+ uni__dependencies: [0]
61
+ }
62
+ }));
63
+
64
+ //#endregion
65
+ export { HostFilter };
66
+ //# sourceMappingURL=HostFilter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HostFilter.mjs","names":["StyleSheet","selectionTick","Button","SegmentedControl","HostFilterProps","hosts","id","label","value","onChange","includeAll","accessibilityLabel","ALL","MAX_SEGMENTS","MAX_SEGMENT_LABEL","HostFilter","options","map","selected","some","length","every","styles","control","choices","choice","create","theme","minHeight","flexDirection","gap","spacing","uni__dependencies","backgroundColor","colors","borderColor"],"sources":["../../src/components/HostFilter.tsx"],"sourcesContent":["import { ScrollView, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { selectionTick } from '../lib/haptics';\nimport { Button } from './Button';\nimport { SegmentedControl } from './SegmentedControl';\n\nexport interface HostFilterProps {\n hosts: readonly { id: string; label: string }[];\n /** null means All. This is presentation only, not a transport selection. */\n value: string | null;\n onChange: (id: string | null) => void;\n /** Off when the choice names where something lives, so exactly one computer is always chosen. */\n includeAll?: boolean;\n accessibilityLabel?: string;\n}\nconst ALL = '';\nconst MAX_SEGMENTS = 3;\nconst MAX_SEGMENT_LABEL = 12;\n\n/** Short names use the native segmented control; long names remain reachable by scrolling. */\nexport function HostFilter({\n hosts,\n value,\n onChange,\n includeAll = true,\n accessibilityLabel = 'Filter by computer',\n}: HostFilterProps) {\n const options = [\n ...(includeAll ? [{ value: ALL, label: 'All' }] : []),\n ...hosts.map(({ id, label }) => ({ value: id, label })),\n ];\n const selected = hosts.some(({ id }) => id === value) ? value! : includeAll ? ALL : (hosts[0]?.id ?? ALL);\n if (options.length <= MAX_SEGMENTS && options.every(({ label }) => label.length <= MAX_SEGMENT_LABEL)) {\n return (\n <SegmentedControl\n options={options}\n value={selected}\n onValueChange={(id) => onChange(id || null)}\n accessibilityLabel={accessibilityLabel}\n style={styles.control}\n />\n );\n }\n return (\n <ScrollView horizontal showsHorizontalScrollIndicator={false} accessibilityLabel={accessibilityLabel}>\n <View style={styles.choices}>\n {options.map(({ value: id, label }) => (\n <Button\n key={id}\n variant={selected === id ? 'subtle' : 'ghost'}\n accessibilityState={{ selected: selected === id }}\n style={[styles.choice, selected === id && styles.selected]}\n onPress={() => {\n selectionTick();\n onChange(id || null);\n }}\n >\n {label}\n </Button>\n ))}\n </View>\n </ScrollView>\n );\n}\nconst styles = StyleSheet.create((theme) => ({\n control: { minHeight: 44 },\n choices: { flexDirection: 'row', gap: theme.spacing(2) },\n choice: { minHeight: 44 },\n selected: { backgroundColor: theme.colors['tint-green'], borderColor: theme.colors['edge-green'] },\n}));\n"],"mappings":";;;;;;;;;AAgBA,MAAMY,MAAM;AACZ,MAAMC,eAAe;AACrB,MAAMC,oBAAoB;;AAG1B,SAAgBC,WAAW,EACzBV,OACAG,OACAC,UACAC,aAAa,MACbC,qBAAqB,wBACH;CAClB,MAAMK,UAAU,CACd,GAAIN,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d.ts
2
+ /** A computer's display label, never an authority or connection indicator. */
3
+ export declare function HostTag({ label }: {
4
+ label: string;
5
+ }): import("react").JSX.Element;
6
+ //#endregion
7
+ //# sourceMappingURL=HostTag.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HostTag.d.mts","names":[],"sources":["../../src/components/HostTag.tsx"],"mappings":";;wBAQgB,UAAU;EAAW;oBAAe,IAAA"}
@@ -0,0 +1,47 @@
1
+ import { fontOf } from "../lib/fonts.mjs";
2
+ import { agentInitials } from "./AgentAvatar.mjs";
3
+ import { Badge } from "./Badge.mjs";
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/HostTag.tsx
9
+ /** A computer's display label, never an authority or connection indicator. */
10
+ function HostTag({ label }) {
11
+ return /* @__PURE__ */ jsxs(Badge, {
12
+ accessibilityLabel: `Computer: ${label}`,
13
+ style: styles.tag,
14
+ children: [/* @__PURE__ */ jsx(Text, {
15
+ style: styles.initials,
16
+ children: agentInitials(label)
17
+ }), /* @__PURE__ */ jsx(Text, {
18
+ style: styles.label,
19
+ numberOfLines: 1,
20
+ children: label
21
+ })]
22
+ });
23
+ }
24
+ const styles = StyleSheet.create((theme) => ({
25
+ tag: {
26
+ maxWidth: "100%",
27
+ flexShrink: 1
28
+ },
29
+ initials: {
30
+ fontFamily: fontOf(theme.fontFamily.sans),
31
+ fontSize: theme.fontSize.xs,
32
+ color: theme.colors.dim,
33
+ uni__dependencies: [0]
34
+ },
35
+ label: {
36
+ fontFamily: fontOf(theme.fontFamily.sans),
37
+ fontSize: theme.fontSize.sm,
38
+ lineHeight: theme.lineHeight.sm,
39
+ color: theme.colors.dim,
40
+ flexShrink: 1,
41
+ uni__dependencies: [0]
42
+ }
43
+ }));
44
+
45
+ //#endregion
46
+ export { HostTag };
47
+ //# sourceMappingURL=HostTag.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HostTag.mjs","names":["StyleSheet","fontOf","agentInitials","Badge","HostTag","label","styles","tag","initials","create","theme","maxWidth","flexShrink","fontFamily","sans","fontSize","xs","color","colors","dim","uni__dependencies","sm","lineHeight"],"sources":["../../src/components/HostTag.tsx"],"sourcesContent":["import { Text } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { agentInitials } from './AgentAvatar';\nimport { Badge } from './Badge';\n\n/** A computer's display label, never an authority or connection indicator. */\nexport function HostTag({ label }: { label: string }) {\n return (\n <Badge accessibilityLabel={`Computer: ${label}`} style={styles.tag}>\n <Text style={styles.initials}>{agentInitials(label)}</Text>\n <Text style={styles.label} numberOfLines={1}>\n {label}\n </Text>\n </Badge>\n );\n}\nconst styles = StyleSheet.create((theme) => ({\n tag: { maxWidth: '100%', flexShrink: 1 },\n initials: { fontFamily: fontOf(theme.fontFamily.sans), fontSize: theme.fontSize.xs, color: theme.colors.dim },\n label: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n color: theme.colors.dim,\n flexShrink: 1,\n },\n}));\n"],"mappings":";;;;;;;;;AAQA,SAAgBI,QAAQ,EAAEC,SAA4B;CACpD,OACE,qBAAC,OAAD;EAAO,oBAAoB,aAAaA;EAAS,OAAOC,OAAOC;YAA/D,CACE,oBAAC,MAAD;GAAM,OAAOD,OAAOE;aAAWN,cAAcG,KAAK;EAAQ,IAC1D,oBAAC,MAAD;GAAM,OAAOC,OAAOD;GAAO,eAAe;aACvCA;EACG,EACD;;AAEX;AACA,MAAMC,SAASN,WAAWS,QAAQC,WAAW;CAC3CH,KAAK;EAAEI,UAAU;EAAQC,YAAY;CAAE;CACvCJ,UAAU;EAAEK,YAAYZ,OAAOS,MAAMG,WAAWC,IAAI;EAAGC,UAAUL,MAAMK,SAASC;EAAIC,OAAOP,MAAMQ,OAAOC;EAAGC,mBAAA,CAAA,CAAA;CAAC;CAC5Gf,OAAO;EACLQ,YAAYZ,OAAOS,MAAMG,WAAWC,IAAI;EACxCC,UAAUL,MAAMK,SAASM;EACzBC,YAAYZ,MAAMY,WAAWD;EAC7BJ,OAAOP,MAAMQ,OAAOC;EACpBP,YAAY;EAACQ,mBAAA,CAAA,CAAA;CACf;AACF,EAAE"}
@@ -0,0 +1,9 @@
1
+ //#region src/components/InfoStrip.d.ts
2
+ /** A quiet explanation with an optional text action, without live activity. */
3
+ export declare function InfoStrip({ message, actionLabel, onAction }: {
4
+ message: string;
5
+ actionLabel?: string;
6
+ onAction?: () => void;
7
+ }): import("react").JSX.Element;
8
+ //#endregion
9
+ //# sourceMappingURL=InfoStrip.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InfoStrip.d.mts","names":[],"sources":["../../src/components/InfoStrip.tsx"],"mappings":";;wBASgB,YACd,SACA,aACA;EAEA;EACA;EACA;oBACD,IAAA"}
@@ -0,0 +1,53 @@
1
+ import { fontOf } from "../lib/fonts.mjs";
2
+ import { Button } from "./Button.mjs";
3
+ import { AlertIcon } from "../icons/icons.mjs";
4
+ import { Panel } from "./Panel.mjs";
5
+ import { Text } from "react-native-unistyles/components/native/Text";
6
+ import { StyleSheet } from "react-native-unistyles";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+
9
+ //#region src/components/InfoStrip.tsx
10
+ /** A quiet explanation with an optional text action, without live activity. */
11
+ function InfoStrip({ message, actionLabel, onAction }) {
12
+ return /* @__PURE__ */ jsxs(Panel, {
13
+ style: styles.strip,
14
+ children: [
15
+ /* @__PURE__ */ jsx(AlertIcon, {
16
+ size: 16,
17
+ color: "dim"
18
+ }),
19
+ /* @__PURE__ */ jsx(Text, {
20
+ style: styles.text,
21
+ children: message
22
+ }),
23
+ onAction && actionLabel ? /* @__PURE__ */ jsx(Button, {
24
+ variant: "ghost",
25
+ style: styles.action,
26
+ onPress: onAction,
27
+ children: actionLabel
28
+ }) : null
29
+ ]
30
+ });
31
+ }
32
+ const styles = StyleSheet.create((theme) => ({
33
+ strip: {
34
+ flexDirection: "row",
35
+ alignItems: "center",
36
+ gap: theme.spacing(2),
37
+ padding: theme.spacing(3),
38
+ uni__dependencies: [0]
39
+ },
40
+ text: {
41
+ flex: 1,
42
+ fontFamily: fontOf(theme.fontFamily.sans),
43
+ fontSize: theme.fontSize.sm,
44
+ lineHeight: theme.lineHeight.sm,
45
+ color: theme.colors.dim,
46
+ uni__dependencies: [0]
47
+ },
48
+ action: { minHeight: 44 }
49
+ }));
50
+
51
+ //#endregion
52
+ export { InfoStrip };
53
+ //# sourceMappingURL=InfoStrip.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InfoStrip.mjs","names":["StyleSheet","AlertIcon","fontOf","Button","Panel","InfoStrip","message","actionLabel","onAction","styles","strip","text","action","create","theme","flexDirection","alignItems","gap","spacing","padding","uni__dependencies","flex","fontFamily","sans","fontSize","sm","lineHeight","color","colors","dim","minHeight"],"sources":["../../src/components/InfoStrip.tsx"],"sourcesContent":["import { Text } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { AlertIcon } from '../icons/icons';\nimport { fontOf } from '../lib/fonts';\nimport { Button } from './Button';\nimport { Panel } from './Panel';\n\n/** A quiet explanation with an optional text action, without live activity. */\nexport function InfoStrip({\n message,\n actionLabel,\n onAction,\n}: {\n message: string;\n actionLabel?: string;\n onAction?: () => void;\n}) {\n return (\n <Panel style={styles.strip}>\n <AlertIcon size={16} color=\"dim\" />\n <Text style={styles.text}>{message}</Text>\n {onAction && actionLabel ? (\n <Button variant=\"ghost\" style={styles.action} onPress={onAction}>\n {actionLabel}\n </Button>\n ) : null}\n </Panel>\n );\n}\nconst styles = StyleSheet.create((theme) => ({\n strip: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2), padding: theme.spacing(3) },\n text: {\n flex: 1,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n color: theme.colors.dim,\n },\n action: { minHeight: 44 },\n}));\n"],"mappings":";;;;;;;;;;AASA,SAAgBK,UAAU,EACxBC,SACAC,aACAC,YAKC;CACD,OACE,qBAAC,OAAD;EAAO,OAAOC,OAAOC;YAArB;GACE,oBAAC,WAAD;IAAW,MAAM;IAAI,OAAM;GAAK;GAChC,oBAAC,MAAD;IAAM,OAAOD,OAAOE;cAAOL;GAAc;GACxCE,YAAYD,cACX,oBAAC,QAAD;IAAQ,SAAQ;IAAQ,OAAOE,OAAOG;IAAQ,SAASJ;cACpDD;GACK,KACN;EACC;;AAEX;AACA,MAAME,SAAST,WAAWa,QAAQC,WAAW;CAC3CJ,OAAO;EAAEK,eAAe;EAAOC,YAAY;EAAUC,KAAKH,MAAMI,QAAQ,CAAC;EAAGC,SAASL,MAAMI,QAAQ,CAAC;EAACE,mBAAA,CAAA,CAAA;CAAC;CACtGT,MAAM;EACJU,MAAM;EACNC,YAAYpB,OAAOY,MAAMQ,WAAWC,IAAI;EACxCC,UAAUV,MAAMU,SAASC;EACzBC,YAAYZ,MAAMY,WAAWD;EAC7BE,OAAOb,MAAMc,OAAOC;EAAGT,mBAAA,CAAA,CAAA;CACzB;CACAR,QAAQ,EAAEkB,WAAW,GAAG;AAC1B,EAAE"}
@@ -1,8 +1,10 @@
1
- import { TextInputProps } from "react-native";
1
+ import { TextInput, TextInputProps } from "react-native";
2
+ import { ComponentRef, Ref } from "react";
2
3
  //#region src/components/Input.d.ts
3
4
  export type FieldVariant = 'default' | 'bare';
4
5
  export type FieldSize = 'xs' | 'sm' | 'md' | 'lg';
5
6
  export interface InputProps extends Omit<TextInputProps, 'editable'> {
7
+ ref?: Ref<ComponentRef<typeof TextInput>>;
6
8
  variant?: FieldVariant;
7
9
  /** The same rungs Button names, so a field and the button beside it line up. */
8
10
  size?: FieldSize;
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.mts","names":[],"sources":["../../src/components/Input.tsx"],"mappings":";;YASY;YACA;iBAOK,mBAAmB,KAAK;EACvC,UAAU;;EAEV,OAAO;;EAEP;EACA;;;;;;wBAOc,QACd,SACA,MACA,SACA,UACA,OACA,SACA,QACA,uBACG,SACF,6BAAU,IAAA"}
1
+ {"version":3,"file":"Input.d.mts","names":[],"sources":["../../src/components/Input.tsx"],"mappings":";;;YASY;YACA;iBAQK,mBAAmB,KAAK;EACvC,MAAM,IAAI,oBAAoB;EAC9B,UAAU;;EAEV,OAAO;;EAEP;EACA;;;;;;wBAOc,QACd,SACA,MACA,SACA,UACA,OACA,SACA,QACA,uBACG,SACF,6BAAU,IAAA"}
@@ -1,9 +1,9 @@
1
1
  import { fontOf } from "../lib/fonts.mjs";
2
- import { useInsideSheet } from "../lib/insideSheet.mjs";
3
- import { withAlpha } from "@agimon-ai/po-web-components/nativeTheme";
4
2
  import { StyleSheet, useUnistyles, withUnistyles } from "react-native-unistyles";
3
+ import { withAlpha } from "@agimon-ai/po-web-components/nativeTheme";
5
4
  import { useState } from "react";
6
5
  import { jsx } from "react/jsx-runtime";
6
+ import { useInsideSheet } from "@agimon-ai/po-native-components/shell";
7
7
  import { BottomSheetTextInput } from "@gorhom/bottom-sheet";
8
8
  import { TextInput } from "react-native-unistyles/components/native/TextInput";
9
9
 
@@ -17,7 +17,7 @@ const ThemedSheetTextInput = withUnistyles(BottomSheetTextInput);
17
17
  * red edge when invalid. Inside a Sheet it becomes the sheet's own input.
18
18
  */
19
19
  function Input({ variant = "default", size = "md", invalid = false, disabled = false, style, onFocus, onBlur, accessibilityState, ...props }) {
20
- const { theme } = useUnistyles();
20
+ const { theme, rt } = useUnistyles();
21
21
  const [focused, setFocused] = useState(false);
22
22
  const Field = useInsideSheet() ? ThemedSheetTextInput : TextInput;
23
23
  const _styles = styles;
@@ -28,6 +28,7 @@ function Input({ variant = "default", size = "md", invalid = false, disabled = f
28
28
  });
29
29
  return /* @__PURE__ */ jsx(Field, {
30
30
  autoCorrect: false,
31
+ keyboardAppearance: rt.themeName === "dark" ? "dark" : "light",
31
32
  spellCheck: false,
32
33
  placeholderTextColor: theme.colors.faint,
33
34
  selectionColor: theme.colors.green,
@@ -1 +1 @@
1
- {"version":3,"file":"Input.mjs","names":["withAlpha","BottomSheetTextInput","useState","TextInputProps","StyleSheet","useUnistyles","withUnistyles","fontOf","useInsideSheet","FieldVariant","FieldSize","FOCUS_EDGE_ALPHA_PERCENT","DISABLED_OPACITY","ThemedSheetTextInput","InputProps","Omit","variant","size","invalid","disabled","Input","style","onFocus","onBlur","accessibilityState","props","theme","focused","setFocused","Field","TextInput","_styles","styles","useVariants","undefined","colors","faint","green","event","field","borderColor","create","minWidth","minHeight","color","hi","fontFamily","sans","variants","default","borderRadius","DEFAULT","borderWidth","border","backgroundColor","deep","bare","padding","xs","paddingHorizontal","spacing","paddingVertical","fontSize","sm","md","base","lg","compoundVariants","uni__dependencies","red","opacity"],"sources":["../../src/components/Input.tsx"],"sourcesContent":["import { withAlpha } from '@agimon-ai/po-web-components/nativeTheme';\nimport { BottomSheetTextInput } from '@gorhom/bottom-sheet';\nimport { useState } from 'react';\nimport { TextInput, type TextInputProps } from 'react-native';\nimport { StyleSheet, useUnistyles, withUnistyles } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { useInsideSheet } from '../lib/insideSheet';\n\nexport type FieldVariant = 'default' | 'bare';\nexport type FieldSize = 'xs' | 'sm' | 'md' | 'lg';\n\n/** `focus:border-po-green/60`. */\nconst FOCUS_EDGE_ALPHA_PERCENT = 60;\nconst DISABLED_OPACITY = 0.5;\n\nconst ThemedSheetTextInput = withUnistyles(BottomSheetTextInput);\nexport interface InputProps extends Omit<TextInputProps, 'editable'> {\n variant?: FieldVariant;\n /** The same rungs Button names, so a field and the button beside it line up. */\n size?: FieldSize;\n /** The value is wrong: red edge and red text, as `aria-invalid` on the web. */\n invalid?: boolean;\n disabled?: boolean;\n}\n\n/**\n * The one text field: deep well, quiet border, jade edge and cursor on focus,\n * red edge when invalid. Inside a Sheet it becomes the sheet's own input.\n */\nexport function Input({\n variant = 'default',\n size = 'md',\n invalid = false,\n disabled = false,\n style,\n onFocus,\n onBlur,\n accessibilityState,\n ...props\n}: InputProps) {\n const { theme } = useUnistyles();\n const [focused, setFocused] = useState(false);\n // Inside a Sheet the field must be the sheet's own input, so the sheet rises with the keyboard.\n const Field = useInsideSheet() ? ThemedSheetTextInput : TextInput;\n // Unistyles reserves a variant named `default` as the fallback for an unset variant.\n styles.useVariants({ variant: variant === 'bare' ? 'bare' : undefined, size });\n return (\n <Field\n autoCorrect={false}\n spellCheck={false}\n placeholderTextColor={theme.colors.faint}\n selectionColor={theme.colors.green}\n cursorColor={theme.colors.green}\n editable={!disabled}\n accessibilityState={{ ...accessibilityState, disabled }}\n onFocus={(event) => {\n setFocused(true);\n onFocus?.(event);\n }}\n onBlur={(event) => {\n setFocused(false);\n onBlur?.(event);\n }}\n style={[\n styles.field,\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 focused && variant === 'default' && { borderColor: withAlpha(theme.colors.green, FOCUS_EDGE_ALPHA_PERCENT) },\n invalid && styles.invalid,\n disabled && styles.disabled,\n style,\n ]}\n {...props}\n />\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n field: {\n minWidth: 0,\n minHeight: 44,\n color: theme.colors.hi,\n fontFamily: fontOf(theme.fontFamily.sans),\n variants: {\n variant: {\n default: {\n borderRadius: theme.borderRadius.DEFAULT,\n borderWidth: 1,\n borderColor: theme.colors.border,\n backgroundColor: theme.colors.deep,\n },\n /** No well: a composer or a search that draws its own surface keeps the type and drops the box. */\n bare: { borderWidth: 0, backgroundColor: 'transparent', padding: 0 },\n },\n size: {\n xs: {\n paddingHorizontal: theme.spacing(1.5),\n paddingVertical: theme.spacing(0.5),\n fontSize: theme.fontSize.sm,\n },\n sm: {\n paddingHorizontal: theme.spacing(2),\n paddingVertical: theme.spacing(1),\n fontSize: theme.fontSize.sm,\n },\n md: {\n paddingHorizontal: theme.spacing(2.5),\n paddingVertical: theme.spacing(1.5),\n fontSize: theme.fontSize.base,\n },\n lg: {\n paddingHorizontal: theme.spacing(3),\n paddingVertical: theme.spacing(1.5),\n fontSize: theme.fontSize.base,\n },\n },\n },\n compoundVariants: [{ variant: 'bare', styles: { padding: 0, paddingHorizontal: 0, paddingVertical: 0 } }],\n },\n invalid: { borderColor: theme.colors['edge-red'], color: theme.colors.red },\n disabled: { opacity: DISABLED_OPACITY },\n}));\n"],"mappings":";;;;;;;;;;;AAaA,MAAMW,2BAA2B;AACjC,MAAMC,mBAAmB;AAEzB,MAAMC,uBAAuBP,cAAcL,oBAAoB;;;;;AAc/D,SAAgBmB,MAAM,EACpBJ,UAAU,WACVC,OAAO,MACPC,UAAU,OACVC,WAAW,OACXE,OACAC,SACAC,QACAC,oBACA,GAAGC,SACU;CACb,MAAM,EAAEC,UAAUrB,aAAa;CAC/B,MAAM,CAACsB,SAASC,cAAc1B,SAAS,KAAK;CAE5C,MAAM2B,QAAQrB,eAAe,IAAIK,uBAAuBiB;CACxD,MAAAC,UAAAC;CAAA;EAAA,MAAAA,SAAAD,QAAAE,YACmB;GAAEjB,SAASA,YAAY,SAAS,SAASkB;GAAWjB;EAAK,CAAC;EAC7E,OACE,oBAAC,OAAD;GACE,aAAa;GACb,YAAY;GACZ,sBAAsBS,MAAMS,OAAOC;GACnC,gBAAgBV,MAAMS,OAAOE;GAC7B,aAAaX,MAAMS,OAAOE;GAC1B,UAAU,CAAClB;GACX,oBAAoB;IAAE,GAAGK;IAAoBL;GAAS;GACtD,UAAUmB,UAAU;IAClBV,WAAW,IAAI;IACfN,UAAUgB,KAAK;GACjB;GACA,SAASA,UAAU;IACjBV,WAAW,KAAK;IAChBL,SAASe,KAAK;GAChB;GACA,OAAO;IACLN,OAAOO;IAGPZ,WAAWX,YAAY,aAAa,EAAEwB,aAAaxC,UAAU0B,MAAMS,OAAOE,OAAO1B,wBAAwB,EAAE;IAC3GO,WAAWc,OAAOd;IAClBC,YAA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1EjD,UAAU,EAAEmD,SAAS1D,iBAAiB;AACxC,EAAE"}
1
+ {"version":3,"file":"Input.mjs","names":["useInsideSheet","withAlpha","BottomSheetTextInput","useState","ComponentRef","Ref","TextInputProps","StyleSheet","useUnistyles","withUnistyles","fontOf","FieldVariant","FieldSize","FOCUS_EDGE_ALPHA_PERCENT","DISABLED_OPACITY","ThemedSheetTextInput","TextInput","InputProps","Omit","ref","variant","size","invalid","disabled","Input","style","onFocus","onBlur","accessibilityState","props","theme","rt","focused","setFocused","Field","_styles","styles","useVariants","undefined","themeName","colors","faint","green","event","field","borderColor","create","minWidth","minHeight","color","hi","fontFamily","sans","variants","default","borderRadius","DEFAULT","borderWidth","border","backgroundColor","deep","bare","padding","xs","paddingHorizontal","spacing","paddingVertical","fontSize","sm","md","base","lg","compoundVariants","uni__dependencies","red","opacity"],"sources":["../../src/components/Input.tsx"],"sourcesContent":["import { useInsideSheet } from '@agimon-ai/po-native-components/shell';\nimport { withAlpha } from '@agimon-ai/po-web-components/nativeTheme';\nimport { BottomSheetTextInput } from '@gorhom/bottom-sheet';\nimport { useState, type ComponentRef, type Ref } from 'react';\nimport { TextInput, type TextInputProps } from 'react-native';\nimport { StyleSheet, useUnistyles, withUnistyles } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\n\nexport type FieldVariant = 'default' | 'bare';\nexport type FieldSize = 'xs' | 'sm' | 'md' | 'lg';\n\n/** `focus:border-po-green/60`. */\nconst FOCUS_EDGE_ALPHA_PERCENT = 60;\nconst DISABLED_OPACITY = 0.5;\n\n// Both fields expose the native input handle; the sheet's gesture-handler declaration names its component instead.\nconst ThemedSheetTextInput = withUnistyles(BottomSheetTextInput) as unknown as typeof TextInput;\nexport interface InputProps extends Omit<TextInputProps, 'editable'> {\n ref?: Ref<ComponentRef<typeof TextInput>>;\n variant?: FieldVariant;\n /** The same rungs Button names, so a field and the button beside it line up. */\n size?: FieldSize;\n /** The value is wrong: red edge and red text, as `aria-invalid` on the web. */\n invalid?: boolean;\n disabled?: boolean;\n}\n\n/**\n * The one text field: deep well, quiet border, jade edge and cursor on focus,\n * red edge when invalid. Inside a Sheet it becomes the sheet's own input.\n */\nexport function Input({\n variant = 'default',\n size = 'md',\n invalid = false,\n disabled = false,\n style,\n onFocus,\n onBlur,\n accessibilityState,\n ...props\n}: InputProps) {\n const { theme, rt } = useUnistyles();\n const [focused, setFocused] = useState(false);\n // Inside a Sheet the field must be the sheet's own input, so the sheet rises with the keyboard.\n const Field = useInsideSheet() ? ThemedSheetTextInput : TextInput;\n // Unistyles reserves a variant named `default` as the fallback for an unset variant.\n styles.useVariants({ variant: variant === 'bare' ? 'bare' : undefined, size });\n return (\n <Field\n autoCorrect={false}\n // iOS draws the keyboard light by default, a bright slab under a dark screen.\n keyboardAppearance={rt.themeName === 'dark' ? 'dark' : 'light'}\n spellCheck={false}\n placeholderTextColor={theme.colors.faint}\n selectionColor={theme.colors.green}\n cursorColor={theme.colors.green}\n editable={!disabled}\n accessibilityState={{ ...accessibilityState, disabled }}\n onFocus={(event) => {\n setFocused(true);\n onFocus?.(event);\n }}\n onBlur={(event) => {\n setFocused(false);\n onBlur?.(event);\n }}\n style={[\n styles.field,\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 focused && variant === 'default' && { borderColor: withAlpha(theme.colors.green, FOCUS_EDGE_ALPHA_PERCENT) },\n invalid && styles.invalid,\n disabled && styles.disabled,\n style,\n ]}\n {...props}\n />\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n field: {\n minWidth: 0,\n minHeight: 44,\n color: theme.colors.hi,\n fontFamily: fontOf(theme.fontFamily.sans),\n variants: {\n variant: {\n default: {\n borderRadius: theme.borderRadius.DEFAULT,\n borderWidth: 1,\n borderColor: theme.colors.border,\n backgroundColor: theme.colors.deep,\n },\n /** No well: a composer or a search that draws its own surface keeps the type and drops the box. */\n bare: { borderWidth: 0, backgroundColor: 'transparent', padding: 0 },\n },\n size: {\n xs: {\n paddingHorizontal: theme.spacing(1.5),\n paddingVertical: theme.spacing(0.5),\n fontSize: theme.fontSize.sm,\n },\n sm: {\n paddingHorizontal: theme.spacing(2),\n paddingVertical: theme.spacing(1),\n fontSize: theme.fontSize.sm,\n },\n md: {\n paddingHorizontal: theme.spacing(2.5),\n paddingVertical: theme.spacing(1.5),\n fontSize: theme.fontSize.base,\n },\n lg: {\n paddingHorizontal: theme.spacing(3),\n paddingVertical: theme.spacing(1.5),\n fontSize: theme.fontSize.base,\n },\n },\n },\n compoundVariants: [{ variant: 'bare', styles: { padding: 0, paddingHorizontal: 0, paddingVertical: 0 } }],\n },\n invalid: { borderColor: theme.colors['edge-red'], color: theme.colors.red },\n disabled: { opacity: DISABLED_OPACITY },\n}));\n"],"mappings":";;;;;;;;;;;AAaA,MAAMa,2BAA2B;AACjC,MAAMC,mBAAmB;AAGzB,MAAMC,uBAAuBN,cAAcP,oBAAoB;;;;;AAe/D,SAAgBsB,MAAM,EACpBJ,UAAU,WACVC,OAAO,MACPC,UAAU,OACVC,WAAW,OACXE,OACAC,SACAC,QACAC,oBACA,GAAGC,SACU;CACb,MAAM,EAAEC,OAAOC,OAAOvB,aAAa;CACnC,MAAM,CAACwB,SAASC,cAAc9B,SAAS,KAAK;CAE5C,MAAM+B,QAAQlC,eAAe,IAAIe,uBAAuBC;CACxD,MAAAmB,UAAAC;CAAA;EAAA,MAAAA,SAAAD,QAAAE,YACmB;GAAEjB,SAASA,YAAY,SAAS,SAASkB;GAAWjB;EAAK,CAAC;EAC7E,OACE,oBAAC,OAAD;GACE,aAAa;GAEb,oBAAoBU,GAAGQ,cAAc,SAAS,SAAS;GACvD,YAAY;GACZ,sBAAsBT,MAAMU,OAAOC;GACnC,gBAAgBX,MAAMU,OAAOE;GAC7B,aAAaZ,MAAMU,OAAOE;GAC1B,UAAU,CAACnB;GACX,oBAAoB;IAAE,GAAGK;IAAoBL;GAAS;GACtD,UAAUoB,UAAU;IAClBV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kBAAkB,CAAC;GAAEpD,SAAS;GAAQgB,QAAQ;IAAE0B,SAAS;IAAGE,mBAAmB;IAAGE,iBAAiB;GAAE;EAAE,CAAC;EAACO,mBAAA,CAAA,GAAA,CAAA;CAC3G;CACAnD,SAAS;EAAEuB,aAAaf,MAAMU,OAAO;EAAaS,OAAOnB,MAAMU,OAAOkC;EAAGD,mBAAA,CAAA,CAAA;CAAC;CAC1ElD,UAAU,EAAEoD,SAAS7D,iBAAiB;AACxC,EAAE"}
@@ -1,6 +1,6 @@
1
1
  import { fontOf } from "../lib/fonts.mjs";
2
- import { StyleSheet } from "react-native-unistyles";
3
2
  import { Text } from "react-native-unistyles/components/native/Text";
3
+ import { StyleSheet } from "react-native-unistyles";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
 
6
6
  //#region src/components/Label.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"List.d.mts","names":[],"sources":["../../src/components/List.tsx"],"mappings":";;;iBAoBiB,UAAU;EACzB,eAAe;EACf,aAAa,MAAM,GAAG,kBAAkB;;EAExC,eAAe,MAAM,GAAG;;;;;EAKxB;;EAEA;;EAEA,QAAQ;EACR,SAAS;EACT,SAAS;EACT;EACA;;EAEA,QAAQ,UAAU;;EAElB;;wBAOc,KAAK,KACnB,MACA,YACA,cACA,eACA,YACA,OACA,QACA,QACA,cACA,oBACA,OACA,kBACC,UAAU,qBAAE,IAAA;iBAuBE;EACf,OAAO;;EAEP,cAAc;;EAEd,UAAU;;EAEV,WAAW;;EAEX;EACA;EACA;;EAEA;EACA;EACA,QAAQ,UAAU;;;wBAIJ,UACd,OACA,aACA,SACA,UACA,UACA,UACA,SACA,YACA,oBACA,SACC,+BAAY,IAAA"}
1
+ {"version":3,"file":"List.d.mts","names":[],"sources":["../../src/components/List.tsx"],"mappings":";;;iBA+BiB,UAAU;EACzB,eAAe;EACf,aAAa,MAAM,GAAG,kBAAkB;;EAExC,eAAe,MAAM,GAAG;;;;;EAKxB;;EAEA;;EAEA,QAAQ;EACR,SAAS;EACT,SAAS;EACT;EACA;;EAEA,QAAQ,UAAU;;EAElB;;wBAOc,KAAK,KACnB,MACA,YACA,cACA,eACA,YACA,OACA,QACA,QACA,cACA,oBACA,OACA,kBACC,UAAU,qBAAE,IAAA;iBAkDE;EACf,OAAO;;EAEP,cAAc;;EAEd,UAAU;;EAEV,WAAW;;EAEX;EACA;EACA;;EAEA;EACA;EACA,QAAQ,UAAU;;;wBAIJ,UACd,OACA,aACA,SACA,UACA,UACA,UACA,SACA,YACA,oBACA,SACC,+BAAY,IAAA"}
@@ -1,9 +1,11 @@
1
1
  import { fontOf } from "../lib/fonts.mjs";
2
- import { ChevronRightIcon } from "../icons/icons.mjs";
2
+ import { Button } from "./Button.mjs";
3
+ import { ChevronDownIcon, ChevronRightIcon } from "../icons/icons.mjs";
3
4
  import { View } from "react-native-unistyles/components/native/View";
5
+ import { Text } from "react-native-unistyles/components/native/Text";
4
6
  import { StyleSheet } from "react-native-unistyles";
5
7
  import { Platform } from "react-native";
6
- import { Text } from "react-native-unistyles/components/native/Text";
8
+ import { useCallback, useRef, useState } from "react";
7
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
10
  import { Pressable } from "react-native-unistyles/components/native/Pressable";
9
11
  import { FlashList } from "@shopify/flash-list";
@@ -13,29 +15,51 @@ const MIN_ROW_HEIGHT = 44;
13
15
  const DISABLED_OPACITY = .4;
14
16
  /** How close to the bottom a reader must be for a new row to keep the list pinned, as a fraction of the visible height. */
15
17
  const PIN_THRESHOLD = .1;
18
+ /** How far above the bottom, in visible heights, a chat reader must scroll before the jump-to-latest button shows. */
19
+ const JUMP_THRESHOLD = 1;
16
20
  function Separator() {
17
21
  return /* @__PURE__ */ jsx(View, { style: styles.separator });
18
22
  }
19
23
  function List({ data, renderItem, keyExtractor, startAtBottom = false, separators = true, empty, header, footer, onEndReached, accessibilityLabel, style, contentPadding }) {
20
- return /* @__PURE__ */ jsx(View, {
24
+ const renderRow = useCallback(({ item, index }) => renderItem(item, index), [renderItem]);
25
+ const listRef = useRef(null);
26
+ const [awayFromBottom, setAwayFromBottom] = useState(false);
27
+ const onScroll = useCallback(({ nativeEvent }) => {
28
+ const { contentOffset, contentSize, layoutMeasurement } = nativeEvent;
29
+ const distance = contentSize.height - layoutMeasurement.height - contentOffset.y;
30
+ setAwayFromBottom(distance > layoutMeasurement.height * JUMP_THRESHOLD);
31
+ }, []);
32
+ return /* @__PURE__ */ jsxs(View, {
21
33
  style: [styles.frame, style],
22
34
  accessibilityLabel,
23
- children: /* @__PURE__ */ jsx(FlashList, {
35
+ children: [/* @__PURE__ */ jsx(FlashList, {
36
+ ref: listRef,
37
+ onScroll: startAtBottom ? onScroll : void 0,
38
+ scrollEventThrottle: startAtBottom ? 100 : void 0,
24
39
  data,
25
- renderItem: ({ item, index }) => renderItem(item, index),
40
+ renderItem: renderRow,
26
41
  keyExtractor,
27
42
  ItemSeparatorComponent: separators ? Separator : null,
28
43
  ListEmptyComponent: empty === void 0 ? null : /* @__PURE__ */ jsx(Fragment, { children: empty }),
29
44
  ListHeaderComponent: header === void 0 ? null : /* @__PURE__ */ jsx(Fragment, { children: header }),
30
45
  ListFooterComponent: footer === void 0 ? null : /* @__PURE__ */ jsx(Fragment, { children: footer }),
31
46
  onEndReached,
47
+ keyboardDismissMode: Platform.OS === "ios" ? "interactive" : "on-drag",
48
+ keyboardShouldPersistTaps: startAtBottom ? "never" : "handled",
32
49
  contentInsetAdjustmentBehavior: "automatic",
33
50
  contentContainerStyle: contentPadding === void 0 ? void 0 : { padding: contentPadding },
34
51
  maintainVisibleContentPosition: startAtBottom ? {
35
52
  startRenderingFromBottom: true,
36
53
  autoscrollToBottomThreshold: PIN_THRESHOLD
37
54
  } : void 0
38
- })
55
+ }), startAtBottom && awayFromBottom ? /* @__PURE__ */ jsx(Button, {
56
+ variant: "subtle",
57
+ size: "icon-md",
58
+ accessibilityLabel: "Jump to latest",
59
+ onPress: () => listRef.current?.scrollToEnd({ animated: true }),
60
+ style: styles.jump,
61
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: 18 })
62
+ }) : null]
39
63
  });
40
64
  }
41
65
  /** One list row: 44pt tall, optional leading and trailing slots, pressable when it navigates. */
@@ -99,6 +123,14 @@ const styles = StyleSheet.create((theme) => ({
99
123
  flex: 1,
100
124
  minHeight: 0
101
125
  },
126
+ jump: {
127
+ position: "absolute",
128
+ bottom: theme.spacing(3),
129
+ alignSelf: "center",
130
+ borderRadius: theme.borderRadius.full,
131
+ borderColor: theme.colors.border,
132
+ uni__dependencies: [0]
133
+ },
102
134
  separator: {
103
135
  height: StyleSheet.hairlineWidth,
104
136
  marginLeft: theme.spacing(4),