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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/LICENSE +21 -149
  2. package/README.md +9 -51
  3. package/dist/components/AgentAvatar.d.mts +19 -0
  4. package/dist/components/AgentAvatar.d.mts.map +1 -0
  5. package/dist/components/AgentAvatar.mjs +88 -0
  6. package/dist/components/AgentAvatar.mjs.map +1 -0
  7. package/dist/components/AnnotationSurface.d.mts +69 -0
  8. package/dist/components/AnnotationSurface.d.mts.map +1 -0
  9. package/dist/components/AnnotationSurface.mjs +431 -0
  10. package/dist/components/AnnotationSurface.mjs.map +1 -0
  11. package/dist/components/Badge.d.mts +1 -1
  12. package/dist/components/Badge.mjs +1 -1
  13. package/dist/components/Button.mjs +3 -3
  14. package/dist/components/Button.mjs.map +1 -1
  15. package/dist/components/CodeBlock.d.mts +3 -1
  16. package/dist/components/CodeBlock.d.mts.map +1 -1
  17. package/dist/components/CodeBlock.mjs +42 -47
  18. package/dist/components/CodeBlock.mjs.map +1 -1
  19. package/dist/components/ComputerRow.d.mts +15 -0
  20. package/dist/components/ComputerRow.d.mts.map +1 -0
  21. package/dist/components/ComputerRow.mjs +107 -0
  22. package/dist/components/ComputerRow.mjs.map +1 -0
  23. package/dist/components/CopyButton.d.mts +13 -0
  24. package/dist/components/CopyButton.d.mts.map +1 -0
  25. package/dist/components/CopyButton.mjs +49 -0
  26. package/dist/components/CopyButton.mjs.map +1 -0
  27. package/dist/components/CountBadge.d.mts +15 -0
  28. package/dist/components/CountBadge.d.mts.map +1 -0
  29. package/dist/components/CountBadge.mjs +49 -0
  30. package/dist/components/CountBadge.mjs.map +1 -0
  31. package/dist/components/CtaCard.d.mts +19 -0
  32. package/dist/components/CtaCard.d.mts.map +1 -0
  33. package/dist/components/CtaCard.mjs +92 -0
  34. package/dist/components/CtaCard.mjs.map +1 -0
  35. package/dist/components/Dialog.d.mts +2 -2
  36. package/dist/components/Dialog.d.mts.map +1 -1
  37. package/dist/components/Dialog.mjs +16 -10
  38. package/dist/components/Dialog.mjs.map +1 -1
  39. package/dist/components/Dot.d.mts +1 -1
  40. package/dist/components/Dot.mjs +2 -2
  41. package/dist/components/DropdownMenu.d.mts +3 -1
  42. package/dist/components/DropdownMenu.d.mts.map +1 -1
  43. package/dist/components/DropdownMenu.mjs +21 -14
  44. package/dist/components/DropdownMenu.mjs.map +1 -1
  45. package/dist/components/EmptyState.d.mts +31 -3
  46. package/dist/components/EmptyState.d.mts.map +1 -1
  47. package/dist/components/EmptyState.mjs +303 -29
  48. package/dist/components/EmptyState.mjs.map +1 -1
  49. package/dist/components/FileList.d.mts +48 -0
  50. package/dist/components/FileList.d.mts.map +1 -0
  51. package/dist/components/FileList.mjs +737 -0
  52. package/dist/components/FileList.mjs.map +1 -0
  53. package/dist/components/FilePreview.d.mts +33 -0
  54. package/dist/components/FilePreview.d.mts.map +1 -0
  55. package/dist/components/FilePreview.mjs +102 -0
  56. package/dist/components/FilePreview.mjs.map +1 -0
  57. package/dist/components/FileViewer.d.mts +57 -0
  58. package/dist/components/FileViewer.d.mts.map +1 -0
  59. package/dist/components/FileViewer.mjs +345 -0
  60. package/dist/components/FileViewer.mjs.map +1 -0
  61. package/dist/components/HashlineLines.d.mts +13 -0
  62. package/dist/components/HashlineLines.d.mts.map +1 -0
  63. package/dist/components/HashlineLines.mjs +153 -0
  64. package/dist/components/HashlineLines.mjs.map +1 -0
  65. package/dist/components/HostFilter.d.mts +17 -0
  66. package/dist/components/HostFilter.d.mts.map +1 -0
  67. package/dist/components/HostFilter.mjs +68 -0
  68. package/dist/components/HostFilter.mjs.map +1 -0
  69. package/dist/components/HostTag.d.mts +7 -0
  70. package/dist/components/HostTag.d.mts.map +1 -0
  71. package/dist/components/HostTag.mjs +48 -0
  72. package/dist/components/HostTag.mjs.map +1 -0
  73. package/dist/components/InfoStrip.d.mts +9 -0
  74. package/dist/components/InfoStrip.d.mts.map +1 -0
  75. package/dist/components/InfoStrip.mjs +53 -0
  76. package/dist/components/InfoStrip.mjs.map +1 -0
  77. package/dist/components/Input.d.mts +3 -1
  78. package/dist/components/Input.d.mts.map +1 -1
  79. package/dist/components/Input.mjs +4 -3
  80. package/dist/components/Input.mjs.map +1 -1
  81. package/dist/components/Label.mjs +1 -1
  82. package/dist/components/LinkText.d.mts +13 -0
  83. package/dist/components/LinkText.d.mts.map +1 -0
  84. package/dist/components/LinkText.mjs +32 -0
  85. package/dist/components/LinkText.mjs.map +1 -0
  86. package/dist/components/List.d.mts.map +1 -1
  87. package/dist/components/List.mjs +50 -11
  88. package/dist/components/List.mjs.map +1 -1
  89. package/dist/components/LiveDuration.d.mts +30 -0
  90. package/dist/components/LiveDuration.d.mts.map +1 -0
  91. package/dist/components/LiveDuration.mjs +67 -0
  92. package/dist/components/LiveDuration.mjs.map +1 -0
  93. package/dist/components/LoadingState.d.mts +17 -0
  94. package/dist/components/LoadingState.d.mts.map +1 -0
  95. package/dist/components/LoadingState.mjs +90 -0
  96. package/dist/components/LoadingState.mjs.map +1 -0
  97. package/dist/components/Markdown.d.mts +24 -2
  98. package/dist/components/Markdown.d.mts.map +1 -1
  99. package/dist/components/Markdown.mjs +356 -27
  100. package/dist/components/Markdown.mjs.map +1 -1
  101. package/dist/components/MessageItem.d.mts +10 -15
  102. package/dist/components/MessageItem.d.mts.map +1 -1
  103. package/dist/components/MessageItem.mjs +94 -68
  104. package/dist/components/MessageItem.mjs.map +1 -1
  105. package/dist/components/NativeShellState.d.mts +30 -0
  106. package/dist/components/NativeShellState.d.mts.map +1 -0
  107. package/dist/components/NativeShellState.mjs +61 -0
  108. package/dist/components/NativeShellState.mjs.map +1 -0
  109. package/dist/components/RailItem.d.mts +13 -0
  110. package/dist/components/RailItem.d.mts.map +1 -0
  111. package/dist/components/RailItem.mjs +61 -0
  112. package/dist/components/RailItem.mjs.map +1 -0
  113. package/dist/components/ReferenceChip.d.mts +18 -0
  114. package/dist/components/ReferenceChip.d.mts.map +1 -0
  115. package/dist/components/ReferenceChip.mjs +38 -0
  116. package/dist/components/ReferenceChip.mjs.map +1 -0
  117. package/dist/components/SectionLabel.mjs +1 -1
  118. package/dist/components/SeekBar.d.mts +17 -0
  119. package/dist/components/SeekBar.d.mts.map +1 -0
  120. package/dist/components/SeekBar.mjs +97 -0
  121. package/dist/components/SeekBar.mjs.map +1 -0
  122. package/dist/components/Select.d.mts +39 -0
  123. package/dist/components/Select.d.mts.map +1 -0
  124. package/dist/components/Select.mjs +288 -0
  125. package/dist/components/Select.mjs.map +1 -0
  126. package/dist/components/Sheet.d.mts +17 -2
  127. package/dist/components/Sheet.d.mts.map +1 -1
  128. package/dist/components/Sheet.mjs +34 -11
  129. package/dist/components/Sheet.mjs.map +1 -1
  130. package/dist/components/SheetFrame.mjs +149 -28
  131. package/dist/components/SheetFrame.mjs.map +1 -1
  132. package/dist/components/SheetList.d.mts +14 -0
  133. package/dist/components/SheetList.d.mts.map +1 -0
  134. package/dist/components/SheetList.mjs +34 -0
  135. package/dist/components/SheetList.mjs.map +1 -0
  136. package/dist/components/ShowMore.d.mts +10 -0
  137. package/dist/components/ShowMore.d.mts.map +1 -0
  138. package/dist/components/ShowMore.mjs +44 -0
  139. package/dist/components/ShowMore.mjs.map +1 -0
  140. package/dist/components/Spinner.d.mts +1 -1
  141. package/dist/components/StatusBadge.d.mts +1 -1
  142. package/dist/components/Switch.d.mts +14 -0
  143. package/dist/components/Switch.d.mts.map +1 -0
  144. package/dist/components/Switch.mjs +37 -0
  145. package/dist/components/Switch.mjs.map +1 -0
  146. package/dist/components/SyntaxLine.d.mts +19 -0
  147. package/dist/components/SyntaxLine.d.mts.map +1 -0
  148. package/dist/components/SyntaxLine.mjs +134 -0
  149. package/dist/components/SyntaxLine.mjs.map +1 -0
  150. package/dist/components/Tabs.d.mts.map +1 -1
  151. package/dist/components/Tabs.mjs +8 -7
  152. package/dist/components/Tabs.mjs.map +1 -1
  153. package/dist/components/ToolPathLink.d.mts +10 -0
  154. package/dist/components/ToolPathLink.d.mts.map +1 -0
  155. package/dist/components/ToolPathLink.mjs +42 -0
  156. package/dist/components/ToolPathLink.mjs.map +1 -0
  157. package/dist/components/ToolResultImage.d.mts +21 -0
  158. package/dist/components/ToolResultImage.d.mts.map +1 -0
  159. package/dist/components/ToolResultImage.mjs +60 -0
  160. package/dist/components/ToolResultImage.mjs.map +1 -0
  161. package/dist/icons/IconColorContext.d.mts +2 -1
  162. package/dist/icons/IconColorContext.d.mts.map +1 -1
  163. package/dist/icons/IconColorContext.mjs.map +1 -1
  164. package/dist/icons/iconGlyphs.d.mts +132 -0
  165. package/dist/icons/iconGlyphs.d.mts.map +1 -1
  166. package/dist/icons/iconGlyphs.mjs +132 -0
  167. package/dist/icons/iconGlyphs.mjs.map +1 -1
  168. package/dist/icons/icons.d.mts +133 -1
  169. package/dist/icons/icons.d.mts.map +1 -1
  170. package/dist/icons/icons.mjs +35 -2
  171. package/dist/icons/icons.mjs.map +1 -1
  172. package/dist/index.d.mts +31 -7
  173. package/dist/index.mjs +36 -12
  174. package/dist/lib/fileKindLabel.mjs +17 -0
  175. package/dist/lib/fileKindLabel.mjs.map +1 -0
  176. package/dist/lib/fonts.d.mts +3 -1
  177. package/dist/lib/fonts.d.mts.map +1 -1
  178. package/dist/lib/fonts.mjs +4 -2
  179. package/dist/lib/fonts.mjs.map +1 -1
  180. package/dist/lib/insideSheet.d.mts +10 -0
  181. package/dist/lib/insideSheet.d.mts.map +1 -0
  182. package/dist/lib/markdown.mjs +310 -23
  183. package/dist/lib/markdown.mjs.map +1 -1
  184. package/dist/lib/reading.mjs +60 -0
  185. package/dist/lib/reading.mjs.map +1 -0
  186. package/dist/lib/useControllable.mjs +14 -6
  187. package/dist/lib/useControllable.mjs.map +1 -1
  188. package/dist/lib/useReadingPage.mjs +33 -0
  189. package/dist/lib/useReadingPage.mjs.map +1 -0
  190. package/dist/po-runtime-identity.json +1 -0
  191. package/dist/shell.d.mts +6 -0
  192. package/dist/shell.mjs +7 -0
  193. package/locales/vi.json +112 -0
  194. package/locales/zh-CN.json +112 -0
  195. package/package.json +43 -30
@@ -1,17 +1,30 @@
1
1
  import { fontOf } from "../lib/fonts.mjs";
2
+ import { READING, inlineLength, inlinePrefix } from "../lib/reading.mjs";
3
+ import { useReadingPage } from "../lib/useReadingPage.mjs";
4
+ import { ShowMore } from "./ShowMore.mjs";
2
5
  import { CodeBlock } from "./CodeBlock.mjs";
3
- import { parseMarkdown } from "../lib/markdown.mjs";
6
+ import { REFERENCE_HREF_PREFIX, exactReference, parseMarkdown } from "../lib/markdown.mjs";
4
7
  import { View } from "react-native-unistyles/components/native/View";
8
+ import { Text } from "react-native-unistyles/components/native/Text";
5
9
  import { StyleSheet } from "react-native-unistyles";
6
10
  import { Linking } from "react-native";
7
- import { Text } from "react-native-unistyles/components/native/Text";
8
- import { createContext, useContext, useMemo } from "react";
11
+ import { createContext, memo, useContext, useEffect, useMemo, useState } from "react";
9
12
  import { jsx, jsxs } from "react/jsx-runtime";
13
+ import { useT } from "@agimon-ai/po-core/native";
14
+ import { ScrollView } from "react-native-unistyles/components/native/ScrollView";
15
+ import { Image } from "react-native-unistyles/components/native/Image";
10
16
 
11
17
  //#region src/components/Markdown.tsx
12
18
  /** Passed by context so the inline renderers stay module functions. */
19
+ const InitialPageContext = createContext(1);
13
20
  const FileLinkContext = createContext(void 0);
21
+ const ReferenceContext = createContext(void 0);
22
+ const ImageContext = createContext(void 0);
14
23
  const URL_OR_ANCHOR = /^(?:[a-z][a-z\d+.-]*:|\/\/|#|\?)/i;
24
+ /** Sources an Image may load as written; any other scheme stays its alt text. */
25
+ const DIRECT_IMAGE = /^(?:https?:|data:image\/)/i;
26
+ /** Until the image reports its size, it holds a landscape box rather than collapsing. */
27
+ const PLACEHOLDER_RATIO = 16 / 9;
15
28
  function decoded(href) {
16
29
  try {
17
30
  return decodeURIComponent(href);
@@ -19,12 +32,17 @@ function decoded(href) {
19
32
  return;
20
33
  }
21
34
  }
22
- function InlineCode({ text }) {
35
+ function InlineCode({ text, originalText = text }) {
23
36
  const onFileLink = useContext(FileLinkContext);
24
- const open = text.includes("\n") ? void 0 : onFileLink?.(text);
37
+ const renderReference = useContext(ReferenceContext);
38
+ const reference = renderReference === void 0 ? void 0 : exactReference(originalText);
39
+ const drawn = reference === void 0 ? void 0 : renderReference?.(reference);
40
+ const open = reference !== void 0 || originalText.includes("\n") ? void 0 : onFileLink?.(originalText);
41
+ const t = useT();
42
+ if (drawn !== void 0) return drawn;
25
43
  if (open !== void 0) return /* @__PURE__ */ jsx(Text, {
26
44
  accessibilityRole: "link",
27
- accessibilityHint: `open ${text}`,
45
+ accessibilityHint: t("nativeComponents.markdown.openHint", "open {target}", { target: originalText }),
28
46
  onPress: open,
29
47
  style: [styles.code, styles.fileLink],
30
48
  children: text
@@ -36,6 +54,22 @@ function InlineCode({ text }) {
36
54
  }
37
55
  function InlineLink({ href, children }) {
38
56
  const onFileLink = useContext(FileLinkContext);
57
+ const renderReference = useContext(ReferenceContext);
58
+ const t = useT();
59
+ if (href.startsWith("po-reference:")) {
60
+ const reference = decoded(href.slice(REFERENCE_HREF_PREFIX.length));
61
+ const drawn = reference === void 0 ? void 0 : renderReference?.(reference);
62
+ if (drawn !== void 0) return drawn;
63
+ const open = reference === void 0 ? void 0 : onFileLink?.(reference);
64
+ if (open === void 0) return /* @__PURE__ */ jsx(Text, { children });
65
+ return /* @__PURE__ */ jsx(Text, {
66
+ accessibilityRole: "link",
67
+ accessibilityHint: t("nativeComponents.markdown.openHint", "open {target}", { target: reference ?? "" }),
68
+ onPress: open,
69
+ style: styles.link,
70
+ children
71
+ });
72
+ }
39
73
  const path = decoded(href);
40
74
  const isFile = path !== void 0 && path !== "" && !URL_OR_ANCHOR.test(path);
41
75
  const open = isFile ? onFileLink?.(path, true) : void 0;
@@ -49,11 +83,78 @@ function InlineLink({ href, children }) {
49
83
  children
50
84
  });
51
85
  }
86
+ /** One image: a file path through the host's loader, or a web or data address as written. */
87
+ function MarkdownImage({ src, alt }) {
88
+ const loader = useContext(ImageContext);
89
+ const t = useT();
90
+ const imageName = alt || t("nativeComponents.markdown.image", "Image");
91
+ const source = src.startsWith("@artifact:") ? src.slice(1) : src;
92
+ const path = URL_OR_ANCHOR.test(source) && !source.startsWith("artifact:") ? void 0 : decoded(source.split(/[?#]/u, 1)[0]) ?? "";
93
+ const [loaded, setLoaded] = useState();
94
+ const [ratio, setRatio] = useState(PLACEHOLDER_RATIO);
95
+ useEffect(() => {
96
+ if (loader === void 0 || path === void 0) return;
97
+ let active = true;
98
+ let asset;
99
+ Promise.resolve().then(() => {
100
+ if (path === "") throw new Error("Invalid image path.");
101
+ return loader(path);
102
+ }).then((result) => {
103
+ if (!active) return result.dispose();
104
+ asset = result;
105
+ setLoaded({
106
+ path,
107
+ url: result.url
108
+ });
109
+ }).catch(() => {
110
+ if (active) setLoaded({
111
+ path,
112
+ failed: true
113
+ });
114
+ });
115
+ return () => {
116
+ active = false;
117
+ asset?.dispose();
118
+ };
119
+ }, [path, loader]);
120
+ const current = loaded?.path === path ? loaded : void 0;
121
+ const uri = path === void 0 ? DIRECT_IMAGE.test(src) ? src : void 0 : current?.url;
122
+ if (uri === void 0 || current?.failed) {
123
+ const waiting = path !== void 0 && loader !== void 0 && current === void 0;
124
+ return /* @__PURE__ */ jsx(Text, {
125
+ style: [styles.prose, styles.imageState],
126
+ accessibilityRole: waiting ? "text" : "alert",
127
+ children: waiting ? t("nativeComponents.markdown.imageLoading", "{name} (loading…)", { name: alt || path || imageName }) : t("nativeComponents.markdown.imageUnavailable", "{name} (unavailable)", { name: alt || path || imageName })
128
+ });
129
+ }
130
+ return /* @__PURE__ */ jsx(Image, {
131
+ source: { uri },
132
+ accessibilityLabel: imageName,
133
+ accessibilityIgnoresInvertColors: true,
134
+ resizeMode: "contain",
135
+ onLoad: ({ nativeEvent }) => {
136
+ const fit = (width, height) => {
137
+ if (width > 0 && height > 0) setRatio(width / height);
138
+ };
139
+ const size = nativeEvent?.source;
140
+ if (size !== void 0) fit(size.width, size.height);
141
+ else Image.getSize(uri, fit, () => void 0);
142
+ },
143
+ onError: () => setLoaded({
144
+ path: path ?? src,
145
+ failed: true
146
+ }),
147
+ style: [styles.image, { aspectRatio: ratio }]
148
+ });
149
+ }
52
150
  function renderInline(nodes) {
53
151
  return nodes.map((node, index) => {
54
152
  switch (node.type) {
55
153
  case "text": return node.text;
56
- case "code": return /* @__PURE__ */ jsx(InlineCode, { text: node.text }, index);
154
+ case "code": return /* @__PURE__ */ jsx(InlineCode, {
155
+ text: node.text,
156
+ originalText: node.originalText
157
+ }, index);
57
158
  case "strong": return /* @__PURE__ */ jsx(Text, {
58
159
  style: styles.strong,
59
160
  children: renderInline(node.children)
@@ -66,62 +167,236 @@ function renderInline(nodes) {
66
167
  href: node.href,
67
168
  children: renderInline(node.children)
68
169
  }, index);
170
+ case "image": return node.alt;
69
171
  }
70
172
  });
71
173
  }
72
- function Block({ block, first }) {
174
+ /**
175
+ * A table read column by column: every cell keeps to one line inside the sideways scroll, so each
176
+ * column takes its widest cell and the rows line up without a table layout.
177
+ */
178
+ function MarkdownTable({ header, rows }) {
179
+ const initialPage = useContext(InitialPageContext);
180
+ const t = useT();
181
+ const [rowPage, setRows] = useState(initialPage);
182
+ const [columnPage, setColumns] = useState(initialPage);
183
+ const [cellPage, setCells] = useState(initialPage);
184
+ const visibleRows = rows.slice(0, READING.rows * Math.max(initialPage, rowPage));
185
+ const visibleHeader = header.slice(0, READING.columns * Math.max(initialPage, columnPage));
186
+ const limit = READING.cell * Math.max(initialPage, cellPage);
187
+ const clipped = [visibleHeader, ...visibleRows.map((row) => row.slice(0, visibleHeader.length))].some((row) => row.some((cell) => inlineLength(cell) > limit));
188
+ return /* @__PURE__ */ jsxs(View, {
189
+ style: styles.root,
190
+ children: [
191
+ /* @__PURE__ */ jsx(ScrollView, {
192
+ horizontal: true,
193
+ showsHorizontalScrollIndicator: false,
194
+ children: /* @__PURE__ */ jsx(View, {
195
+ style: styles.table,
196
+ children: visibleHeader.map((cell, column) => /* @__PURE__ */ jsxs(View, { children: [/* @__PURE__ */ jsxs(Text, {
197
+ style: [
198
+ styles.prose,
199
+ styles.cell,
200
+ styles.headCell
201
+ ],
202
+ children: [renderInline(inlinePrefix(cell, limit)), inlineLength(cell) > limit ? "…" : ""]
203
+ }), visibleRows.map((row, index) => /* @__PURE__ */ jsxs(Text, {
204
+ style: [styles.prose, styles.cell],
205
+ children: [renderInline(inlinePrefix(row[column] ?? [], limit)), inlineLength(row[column] ?? []) > limit ? "…" : ""]
206
+ }, index))] }, column))
207
+ })
208
+ }),
209
+ /* @__PURE__ */ jsxs(Text, {
210
+ style: styles.meta,
211
+ children: [t("nativeComponents.markdown.tableSummary", "{shownRows} of {totalRows} rows · {shownColumns} of {totalColumns} columns", {
212
+ shownRows: visibleRows.length,
213
+ totalRows: rows.length,
214
+ shownColumns: visibleHeader.length,
215
+ totalColumns: header.length
216
+ }), clipped ? ` · ${t("nativeComponents.markdown.cellLimit", "Cells: first {limit} characters", { limit })}` : ""]
217
+ }),
218
+ /* @__PURE__ */ jsxs(View, {
219
+ style: styles.actions,
220
+ children: [
221
+ visibleRows.length < rows.length ? /* @__PURE__ */ jsx(ShowMore, {
222
+ label: t("nativeComponents.markdown.showMoreRows", "Show more rows"),
223
+ onPress: () => setRows((page) => page + 1)
224
+ }) : null,
225
+ visibleHeader.length < header.length ? /* @__PURE__ */ jsx(ShowMore, {
226
+ label: t("nativeComponents.markdown.showMoreColumns", "Show more columns"),
227
+ onPress: () => setColumns((page) => page + 1)
228
+ }) : null,
229
+ clipped ? /* @__PURE__ */ jsx(ShowMore, {
230
+ label: t("nativeComponents.markdown.showMoreCells", "Show more cell text"),
231
+ onPress: () => setCells((page) => page + 1)
232
+ }) : null
233
+ ]
234
+ })
235
+ ]
236
+ });
237
+ }
238
+ /** One Show more for the whole document: a single tap reveals every hidden part and clipped text. */
239
+ function Blocks({ blocks, quoted = false }) {
240
+ const initialPage = useContext(InitialPageContext);
241
+ const t = useT();
242
+ const [revealedPage, setPage] = useState(initialPage);
243
+ const page = Math.max(initialPage, revealedPage);
244
+ const visible = blocks.slice(0, READING.parts * page).map((block) => boundBlock(block, page));
245
+ const hiddenParts = visible.length < blocks.length;
246
+ return /* @__PURE__ */ jsxs(InitialPageContext.Provider, {
247
+ value: page,
248
+ children: [visible.map(({ block }, index) => /* @__PURE__ */ jsx(View, {
249
+ style: styles.root,
250
+ children: /* @__PURE__ */ jsx(Block, {
251
+ block,
252
+ first: index === 0,
253
+ quoted
254
+ })
255
+ }, index)), hiddenParts || visible.some(({ clipped }) => clipped) ? /* @__PURE__ */ jsx(ShowMore, {
256
+ label: t("nativeComponents.markdown.showMore", "Show more"),
257
+ summary: hiddenParts ? t("nativeComponents.markdown.partsSummary", "{shown} of {total} parts", {
258
+ shown: visible.length,
259
+ total: blocks.length
260
+ }) : void 0,
261
+ onPress: () => setPage(Infinity)
262
+ }) : null]
263
+ });
264
+ }
265
+ /** A heading, paragraph or list cut to the page's character budget, and whether anything was cut. */
266
+ function boundBlock(block, page) {
267
+ const limit = READING.characters * page;
268
+ if (block.type === "heading" || block.type === "paragraph") {
269
+ const children = inlinePrefix(block.children, limit);
270
+ return {
271
+ block: {
272
+ ...block,
273
+ children
274
+ },
275
+ clipped: inlineLength(children) < inlineLength(block.children)
276
+ };
277
+ }
278
+ if (block.type !== "list") return {
279
+ block,
280
+ clipped: false
281
+ };
282
+ let remaining = limit;
283
+ let shown = 0;
284
+ const items = [];
285
+ for (const item of block.items.slice(0, READING.parts * page)) {
286
+ if (remaining <= 0) break;
287
+ const next = inlinePrefix(item, remaining);
288
+ items.push(next);
289
+ const length = inlineLength(next);
290
+ shown += length;
291
+ remaining -= length;
292
+ }
293
+ const total = block.items.reduce((sum, item) => sum + inlineLength(item), 0);
294
+ return {
295
+ block: {
296
+ ...block,
297
+ items
298
+ },
299
+ clipped: shown < total || items.length < block.items.length
300
+ };
301
+ }
302
+ function Block({ block, first, quoted = false }) {
303
+ const initialPage = useContext(InitialPageContext);
304
+ const prose = [styles.prose, quoted && styles.quoted];
73
305
  switch (block.type) {
74
306
  case "heading": return /* @__PURE__ */ jsx(Text, {
75
307
  accessibilityRole: "header",
76
308
  style: [
77
- styles.prose,
309
+ ...prose,
78
310
  styles.heading(block.level),
79
- first && styles.firstHeading
311
+ first && styles.firstHeading,
312
+ quoted && styles.quoted
80
313
  ],
81
314
  children: renderInline(block.children)
82
315
  });
83
- case "paragraph": return /* @__PURE__ */ jsx(Text, {
84
- style: styles.prose,
85
- children: renderInline(block.children)
86
- });
316
+ case "paragraph": {
317
+ const parts = [];
318
+ let run = [];
319
+ const flush = () => {
320
+ if (run.length > 0) parts.push(/* @__PURE__ */ jsx(Text, {
321
+ style: prose,
322
+ children: renderInline(run)
323
+ }, parts.length));
324
+ run = [];
325
+ };
326
+ for (const node of block.children) {
327
+ if (node.type !== "image") {
328
+ run.push(node);
329
+ continue;
330
+ }
331
+ flush();
332
+ parts.push(/* @__PURE__ */ jsx(MarkdownImage, {
333
+ src: node.src,
334
+ alt: node.alt
335
+ }, parts.length));
336
+ }
337
+ flush();
338
+ return parts.length === 1 ? parts[0] : /* @__PURE__ */ jsx(View, {
339
+ style: styles.root,
340
+ children: parts
341
+ });
342
+ }
87
343
  case "list": return /* @__PURE__ */ jsx(View, {
88
344
  accessibilityRole: "list",
89
345
  style: styles.list,
90
346
  children: block.items.map((item, index) => /* @__PURE__ */ jsxs(View, {
91
347
  style: styles.item,
92
348
  children: [/* @__PURE__ */ jsx(Text, {
93
- style: [styles.prose, styles.marker],
349
+ style: [...prose, styles.marker],
94
350
  children: block.ordered ? `${block.start + index}.` : "•"
95
351
  }), /* @__PURE__ */ jsx(Text, {
96
- style: [styles.prose, styles.itemText],
352
+ style: [...prose, styles.itemText],
97
353
  children: renderInline(item)
98
354
  })]
99
355
  }, index))
100
356
  });
101
357
  case "code": return /* @__PURE__ */ jsx(CodeBlock, {
102
358
  text: block.text,
103
- language: block.language
359
+ language: block.language,
360
+ initialPage
104
361
  });
105
362
  case "rule": return /* @__PURE__ */ jsx(View, {
106
363
  accessible: false,
107
364
  style: styles.rule
108
365
  });
366
+ case "quote": return /* @__PURE__ */ jsx(View, {
367
+ style: [styles.root, styles.quote],
368
+ children: /* @__PURE__ */ jsx(Blocks, {
369
+ blocks: block.children,
370
+ quoted: true
371
+ })
372
+ });
373
+ case "table": return /* @__PURE__ */ jsx(MarkdownTable, {
374
+ header: block.header,
375
+ rows: block.rows
376
+ });
109
377
  }
110
378
  }
111
379
  /** Markdown in Po's shared presentation, parsed by the package's own small parser. */
112
- function Markdown({ text, onFileLink }) {
380
+ const Markdown = memo(function Markdown({ text, onFileLink, renderReference, loadImage, initialPage = 1 }) {
113
381
  const blocks = useMemo(() => parseMarkdown(text), [text]);
114
- return /* @__PURE__ */ jsx(FileLinkContext.Provider, {
115
- value: onFileLink,
116
- children: /* @__PURE__ */ jsx(View, {
117
- style: styles.root,
118
- children: blocks.map((block, index) => /* @__PURE__ */ jsx(Block, {
119
- block,
120
- first: index === 0
121
- }, index))
382
+ const { generation } = useReadingPage(text);
383
+ return /* @__PURE__ */ jsx(InitialPageContext.Provider, {
384
+ value: initialPage,
385
+ children: /* @__PURE__ */ jsx(FileLinkContext.Provider, {
386
+ value: onFileLink,
387
+ children: /* @__PURE__ */ jsx(ReferenceContext.Provider, {
388
+ value: renderReference,
389
+ children: /* @__PURE__ */ jsx(ImageContext.Provider, {
390
+ value: loadImage,
391
+ children: /* @__PURE__ */ jsx(View, {
392
+ style: styles.root,
393
+ children: /* @__PURE__ */ jsx(Blocks, { blocks }, generation)
394
+ })
395
+ })
396
+ })
122
397
  })
123
398
  });
124
- }
399
+ });
125
400
  /**
126
401
  * Headings step up from the prose and never shrink below it; h4 to h6 keep
127
402
  * the prose size and lean on weight, fading from `hi` to `dim`.
@@ -151,6 +426,17 @@ const HEADING_INK = {
151
426
  6: "dim"
152
427
  };
153
428
  const styles = StyleSheet.create((theme) => ({
429
+ meta: {
430
+ color: theme.colors.dim,
431
+ fontFamily: fontOf(theme.fontFamily.sans),
432
+ fontSize: theme.fontSize.sm,
433
+ lineHeight: theme.lineHeight.sm,
434
+ uni__dependencies: [0]
435
+ },
436
+ actions: {
437
+ flexDirection: "row",
438
+ flexWrap: "wrap"
439
+ },
154
440
  root: {
155
441
  minWidth: 0,
156
442
  gap: theme.spacing(2),
@@ -211,6 +497,49 @@ const styles = StyleSheet.create((theme) => ({
211
497
  height: 1,
212
498
  backgroundColor: theme.colors["border-soft"],
213
499
  uni__dependencies: [0]
500
+ },
501
+ quote: {
502
+ borderLeftWidth: 2,
503
+ borderLeftColor: theme.colors.border,
504
+ paddingLeft: theme.spacing(3),
505
+ uni__dependencies: [0]
506
+ },
507
+ quoted: {
508
+ color: theme.colors.dim,
509
+ uni__dependencies: [0]
510
+ },
511
+ table: {
512
+ flexDirection: "row",
513
+ borderTopWidth: 1,
514
+ borderLeftWidth: 1,
515
+ borderColor: theme.colors.border,
516
+ uni__dependencies: [0]
517
+ },
518
+ cell: {
519
+ paddingHorizontal: theme.spacing(2),
520
+ paddingVertical: theme.spacing(1),
521
+ borderRightWidth: 1,
522
+ borderBottomWidth: 1,
523
+ borderColor: theme.colors.border,
524
+ uni__dependencies: [0]
525
+ },
526
+ headCell: {
527
+ backgroundColor: theme.colors.deep,
528
+ fontWeight: theme.fontWeight.semibold,
529
+ color: theme.colors.hi,
530
+ uni__dependencies: [0]
531
+ },
532
+ image: {
533
+ width: "100%",
534
+ maxHeight: 480,
535
+ borderRadius: theme.borderRadius.md,
536
+ borderWidth: 1,
537
+ borderColor: theme.colors.border,
538
+ uni__dependencies: [0]
539
+ },
540
+ imageState: {
541
+ color: theme.colors.dim,
542
+ uni__dependencies: [0]
214
543
  }
215
544
  }));
216
545
 
@@ -1 +1 @@
1
- {"version":3,"file":"Markdown.mjs","names":["createContext","ReactNode","useContext","useMemo","Linking","StyleSheet","fontOf","MarkdownBlock","MarkdownHeadingLevel","MarkdownInline","parseMarkdown","CodeBlock","FileLinkHandler","text","explicit","FileLinkContext","undefined","URL_OR_ANCHOR","decoded","href","decodeURIComponent","InlineCode","onFileLink","open","includes","styles","code","fileLink","InlineLink","children","path","isFile","test","openURL","catch","link","renderInline","nodes","map","node","index","type","strong","em","Block","block","first","prose","heading","level","firstHeading","list","items","item","marker","ordered","start","itemText","language","rule","MarkdownProps","Markdown","blocks","root","HEADING_STEP","const","HEADING_SPACE","HEADING_INK","create","theme","minWidth","gap","spacing","uni__dependencies","color","colors","fontFamily","sans","fontSize","base","lineHeight","marginTop","letterSpacing","fontWeight","semibold","hi","fontStyle","backgroundColor","deep","green","mono","textDecorationLine","blue","flexDirection","paddingLeft","dim","flexShrink","height"],"sources":["../../src/components/Markdown.tsx"],"sourcesContent":["import { createContext, type ReactNode, useContext, useMemo } from 'react';\nimport { Linking, Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { type MarkdownBlock, type MarkdownHeadingLevel, type MarkdownInline, parseMarkdown } from '../lib/markdown';\nimport { CodeBlock } from './CodeBlock';\n\n/*\n * Markdown in the web component's element styles, from the package's own\n * parser: headings, paragraphs, lists, code spans and fences, bold, italic\n * and links. Web links open with Linking; a file path goes to the host.\n *\n * ponytail: no tables, images or blockquotes yet; their source shows as text.\n */\n\n/**\n * What a piece of inline code or a relative link opens, when the host knows.\n * Returning undefined leaves it as plain code or an ordinary link. The same\n * contract as the web Markdown's handler.\n */\nexport type FileLinkHandler = (text: string, explicit?: boolean) => (() => void) | undefined;\n\n/** Passed by context so the inline renderers stay module functions. */\nconst FileLinkContext = createContext<FileLinkHandler | undefined>(undefined);\n\nconst URL_OR_ANCHOR = /^(?:[a-z][a-z\\d+.-]*:|\\/\\/|#|\\?)/i;\n\nfunction decoded(href: string): string | undefined {\n try {\n return decodeURIComponent(href);\n } catch {\n return undefined;\n }\n}\n\nfunction InlineCode({ text }: { text: string }) {\n const onFileLink = useContext(FileLinkContext);\n const open = text.includes('\\n') ? undefined : onFileLink?.(text);\n if (open !== undefined) {\n return (\n <Text\n accessibilityRole=\"link\"\n accessibilityHint={`open ${text}`}\n onPress={open}\n style={[styles.code, styles.fileLink]}\n >\n {text}\n </Text>\n );\n }\n return <Text style={styles.code}>{text}</Text>;\n}\n\nfunction InlineLink({ href, children }: { href: string; children: ReactNode }) {\n const onFileLink = useContext(FileLinkContext);\n const path = decoded(href);\n const isFile = path !== undefined && path !== '' && !URL_OR_ANCHOR.test(path);\n const open = isFile ? onFileLink?.(path, true) : undefined;\n return (\n <Text\n accessibilityRole=\"link\"\n onPress={() => {\n if (open !== undefined) open();\n else if (!isFile) Linking.openURL(href).catch(() => undefined);\n }}\n style={styles.link}\n >\n {children}\n </Text>\n );\n}\n\nfunction renderInline(nodes: readonly MarkdownInline[]): ReactNode[] {\n return nodes.map((node, index) => {\n switch (node.type) {\n case 'text':\n return node.text;\n case 'code':\n return <InlineCode key={index} text={node.text} />;\n case 'strong':\n return (\n <Text key={index} style={styles.strong}>\n {renderInline(node.children)}\n </Text>\n );\n case 'em':\n return (\n <Text key={index} style={styles.em}>\n {renderInline(node.children)}\n </Text>\n );\n case 'link':\n return (\n <InlineLink key={index} href={node.href}>\n {renderInline(node.children)}\n </InlineLink>\n );\n }\n });\n}\n\nfunction Block({ block, first }: { block: MarkdownBlock; first: boolean }) {\n switch (block.type) {\n case 'heading':\n return (\n <Text\n accessibilityRole=\"header\"\n style={[styles.prose, styles.heading(block.level), first && styles.firstHeading]}\n >\n {renderInline(block.children)}\n </Text>\n );\n case 'paragraph':\n return <Text style={styles.prose}>{renderInline(block.children)}</Text>;\n case 'list':\n return (\n <View accessibilityRole=\"list\" style={styles.list}>\n {block.items.map((item, index) => (\n <View key={index} style={styles.item}>\n <Text style={[styles.prose, styles.marker]}>{block.ordered ? `${block.start + index}.` : '\\u2022'}</Text>\n <Text style={[styles.prose, styles.itemText]}>{renderInline(item)}</Text>\n </View>\n ))}\n </View>\n );\n case 'code':\n return <CodeBlock text={block.text} language={block.language} />;\n case 'rule':\n return <View accessible={false} style={styles.rule} />;\n }\n}\n\nexport interface MarkdownProps {\n text: string;\n onFileLink?: FileLinkHandler;\n}\n\n/** Markdown in Po's shared presentation, parsed by the package's own small parser. */\nexport function Markdown({ text, onFileLink }: MarkdownProps) {\n const blocks = useMemo(() => parseMarkdown(text), [text]);\n return (\n <FileLinkContext.Provider value={onFileLink}>\n <View style={styles.root}>\n {blocks.map((block, index) => (\n <Block key={index} block={block} first={index === 0} />\n ))}\n </View>\n </FileLinkContext.Provider>\n );\n}\n\n/**\n * Headings step up from the prose and never shrink below it; h4 to h6 keep\n * the prose size and lean on weight, fading from `hi` to `dim`.\n */\nconst HEADING_STEP = { 1: '2xl', 2: 'xl', 3: 'lg', 4: 'base', 5: 'base', 6: 'base' } as const;\nconst HEADING_SPACE = { 1: 2, 2: 2, 3: 1, 4: 0, 5: 0, 6: 0 } as const;\nconst HEADING_INK = { 1: 'hi', 2: 'hi', 3: 'hi', 4: 'hi', 5: 'text', 6: 'dim' } as const;\n\nconst styles = StyleSheet.create((theme) => ({\n root: { minWidth: 0, gap: theme.spacing(2) },\n prose: {\n color: theme.colors.text,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n },\n heading: (level: MarkdownHeadingLevel) => ({\n marginTop: theme.spacing(HEADING_SPACE[level]),\n fontSize: theme.fontSize[HEADING_STEP[level]],\n lineHeight: theme.lineHeight[HEADING_STEP[level]],\n letterSpacing: theme.letterSpacing[HEADING_STEP[level]],\n fontWeight: theme.fontWeight.semibold,\n color: theme.colors[HEADING_INK[level]],\n }),\n firstHeading: { marginTop: 0 },\n strong: { fontWeight: theme.fontWeight.semibold, color: theme.colors.hi },\n em: { fontStyle: 'italic' },\n code: {\n backgroundColor: theme.colors.deep,\n color: theme.colors.green,\n fontFamily: fontOf(theme.fontFamily.mono),\n },\n fileLink: { textDecorationLine: 'underline' },\n link: { color: theme.colors.blue, textDecorationLine: 'underline' },\n list: { gap: theme.spacing(0.5) },\n item: { flexDirection: 'row', gap: theme.spacing(2), paddingLeft: theme.spacing(1) },\n marker: { minWidth: theme.spacing(3), color: theme.colors.dim },\n itemText: { flexShrink: 1 },\n rule: { height: 1, backgroundColor: theme.colors['border-soft'] },\n}));\n"],"mappings":";;;;;;;;;;;;AAwBA,MAAMe,kBAAkBf,cAA2CgB,MAAS;AAE5E,MAAMC,gBAAgB;AAEtB,SAASC,QAAQC,MAAkC;CACjD,IAAI;EACF,OAAOC,mBAAmBD,IAAI;CAChC,QAAQ;EACN;CACF;AACF;AAEA,SAASE,WAAW,EAAER,QAA0B;CAC9C,MAAMS,aAAapB,WAAWa,eAAe;CAC7C,MAAMQ,OAAOV,KAAKW,SAAS,IAAI,IAAIR,SAAYM,aAAaT,IAAI;CAChE,IAAIU,SAASP,QACX,OACE,oBAAC,MAAD;EACE,mBAAkB;EAClB,mBAAmB,QAAQH;EAC3B,SAASU;EACT,OAAO,CAACE,OAAOC,MAAMD,OAAOE,QAAQ;YAEnCd;CACG;CAGV,OAAO,oBAAC,MAAD;EAAM,OAAOY,OAAOC;YAAOb;CAAW;AAC/C;AAEA,SAASe,WAAW,EAAET,MAAMU,YAAmD;CAC7E,MAAMP,aAAapB,WAAWa,eAAe;CAC7C,MAAMe,OAAOZ,QAAQC,IAAI;CACzB,MAAMY,SAASD,SAASd,UAAac,SAAS,MAAM,CAACb,cAAce,KAAKF,IAAI;CAC5E,MAAMP,OAAOQ,SAAST,aAAaQ,MAAM,IAAI,IAAId;CACjD,OACE,oBAAC,MAAD;EACE,mBAAkB;EAClB,eAAe;GACb,IAAIO,SAASP,QAAWO,KAAK;QACxB,IAAI,CAACQ,QAAQ3B,QAAQ6B,QAAQd,IAAI,CAAC,CAACe,YAAYlB,MAAS;EAC/D;EACA,OAAOS,OAAOU;EAEbN;CACG;AAEV;AAEA,SAASO,aAAaC,OAA+C;CACnE,OAAOA,MAAMC,KAAKC,MAAMC,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,SAASd,aAAaf;EACtC+B,YAAYX,MAAMW,WAAWhB,aAAaf;EAC1CiC,eAAeb,MAAMa,cAAclB,aAAaf;EAChDkC,YAAYd,MAAMc,WAAWC;EAC7BV,OAAOL,MAAMM,OAAOR,YAAYlB;EAAOwB,mBAAA,CAAA,CAAA;CACzC;CACAvB,cAAc,EAAE+B,WAAW,EAAE;CAC7BvC,QAAQ;EAAEyC,YAAYd,MAAMc,WAAWC;EAAUV,OAAOL,MAAMM,OAAOU;EAAEZ,mBAAA,CAAA,CAAA;CAAC;CACxE9B,IAAI,EAAE2C,WAAW,SAAS;CAC1B5D,MAAM;EACJ6D,iBAAiBlB,MAAMM,OAAOa;EAC9Bd,OAAOL,MAAMM,OAAOc;EACpBb,YAAYtE,OAAO+D,MAAMO,WAAWc,IAAI;EAACjB,mBAAA,CAAA,CAAA;CAC3C;CACA9C,UAAU,EAAEgE,oBAAoB,YAAY;CAC5CxD,MAAM;EAAEuC,OAAOL,MAAMM,OAAOiB;EAAMD,oBAAoB;EAAWlB,mBAAA,CAAA,CAAA;CAAC;CAClEtB,MAAM;EAAEoB,KAAKF,MAAMG,QAAQ,EAAG;EAACC,mBAAA,CAAA,CAAA;CAAC;CAChCpB,MAAM;EAAEwC,eAAe;EAAOtB,KAAKF,MAAMG,QAAQ,CAAC;EAAGsB,aAAazB,MAAMG,QAAQ,CAAC;EAACC,mBAAA,CAAA,CAAA;CAAC;CACnFnB,QAAQ;EAAEgB,UAAUD,MAAMG,QAAQ,CAAC;EAAGE,OAAOL,MAAMM,OAAOoB;EAAGtB,mBAAA,CAAA,CAAA;CAAC;CAC9DhB,UAAU,EAAEuC,YAAY,EAAE;CAC1BrC,MAAM;EAAEsC,QAAQ;EAAGV,iBAAiBlB,MAAMM,OAAO;EAAcF,mBAAA,CAAA,CAAA;CAAC;AAClE,EAAE"}
1
+ {"version":3,"file":"Markdown.mjs","names":["useT","createContext","memo","ReactNode","useContext","useEffect","useMemo","useState","Linking","StyleSheet","fontOf","exactReference","MarkdownBlock","MarkdownHeadingLevel","MarkdownInline","parseMarkdown","REFERENCE_HREF_PREFIX","READING","inlineLength","inlinePrefix","useReadingPage","CodeBlock","ShowMore","FileLinkHandler","text","explicit","InitialPageContext","FileLinkContext","undefined","ReferenceRenderer","reference","options","onLongPress","ReferenceContext","MarkdownImageLoader","path","Promise","url","dispose","ImageContext","URL_OR_ANCHOR","DIRECT_IMAGE","PLACEHOLDER_RATIO","decoded","href","decodeURIComponent","InlineCode","originalText","onFileLink","renderReference","drawn","open","includes","t","target","styles","code","fileLink","InlineLink","children","startsWith","slice","length","link","isFile","test","openURL","catch","MarkdownImage","src","alt","loader","imageName","source","split","loaded","setLoaded","failed","ratio","setRatio","active","asset","Awaited","ReturnType","resolve","then","Error","result","current","uri","waiting","prose","imageState","name","nativeEvent","fit","width","height","size","Image","getSize","image","aspectRatio","renderInline","nodes","map","node","index","type","strong","em","MarkdownTable","header","rows","initialPage","rowPage","setRows","columnPage","setColumns","cellPage","setCells","visibleRows","Math","max","visibleHeader","columns","limit","cell","clipped","row","some","root","table","column","headCell","meta","shownRows","totalRows","shownColumns","totalColumns","actions","page","Blocks","blocks","quoted","revealedPage","setPage","visible","parts","block","boundBlock","hiddenParts","shown","total","Infinity","characters","remaining","items","item","next","push","reduce","sum","Block","first","heading","level","firstHeading","run","flush","list","marker","ordered","start","itemText","language","rule","quote","MarkdownProps","loadImage","Markdown","generation","HEADING_STEP","const","HEADING_SPACE","HEADING_INK","create","theme","color","colors","dim","fontFamily","sans","fontSize","sm","lineHeight","uni__dependencies","flexDirection","flexWrap","minWidth","gap","spacing","base","marginTop","letterSpacing","fontWeight","semibold","hi","fontStyle","backgroundColor","deep","green","mono","textDecorationLine","blue","paddingLeft","flexShrink","borderLeftWidth","borderLeftColor","border","borderTopWidth","borderColor","paddingHorizontal","paddingVertical","borderRightWidth","borderBottomWidth","maxHeight","borderRadius","md","borderWidth"],"sources":["../../src/components/Markdown.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport { createContext, memo, type ReactNode, useContext, useEffect, useMemo, useState } from 'react';\nimport { Image, Linking, ScrollView, Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport {\n exactReference,\n type MarkdownBlock,\n type MarkdownHeadingLevel,\n type MarkdownInline,\n parseMarkdown,\n REFERENCE_HREF_PREFIX,\n} from '../lib/markdown';\nimport { READING, inlineLength, inlinePrefix } from '../lib/reading';\nimport { useReadingPage } from '../lib/useReadingPage';\nimport { CodeBlock } from './CodeBlock';\nimport { ShowMore } from './ShowMore';\n\n/*\n * Markdown in the web component's element styles, from the package's own\n * parser: headings, paragraphs, lists, code spans and fences, bold, italic,\n * links, images, blockquotes and tables. Web links open with Linking; a file\n * path goes to the host. Raw HTML blocks are left out, as on the web.\n */\n\n/**\n * What a piece of inline code, a relative link or an `@scheme:value` reference\n * (handed over as `scheme:value`) opens, when the host knows.\n * Returning undefined leaves it as plain code or an ordinary link. The same\n * contract as the web Markdown's handler.\n */\nexport type FileLinkHandler = (text: string, explicit?: boolean) => (() => void) | undefined;\n\n/** Passed by context so the inline renderers stay module functions. */\nconst InitialPageContext = createContext(1);\n\nconst FileLinkContext = createContext<FileLinkHandler | undefined>(undefined);\n\n/**\n * How an `@scheme:value` reference (handed over as `scheme:value`) is drawn, such as a chip that\n * opens it. Undefined leaves it to `onFileLink`: a plain link when claimed, else text. The same\n * contract as the web Markdown's renderer. What it returns sits inside Text, so it must be Text.\n * `onLongPress` is the surrounding text's, such as a message's actions, for the chip to pass on.\n */\nexport type ReferenceRenderer = (reference: string, options?: { onLongPress?: () => void }) => ReactNode | undefined;\nconst ReferenceContext = createContext<ReferenceRenderer | undefined>(undefined);\n\n/** Loads a relative image path from the host; the same contract as the web Markdown's `loadImage`. */\nexport type MarkdownImageLoader = (path: string) => Promise<{ url: string; dispose(): void }>;\n\nconst ImageContext = createContext<MarkdownImageLoader | undefined>(undefined);\n\nconst URL_OR_ANCHOR = /^(?:[a-z][a-z\\d+.-]*:|\\/\\/|#|\\?)/i;\n/** Sources an Image may load as written; any other scheme stays its alt text. */\nconst DIRECT_IMAGE = /^(?:https?:|data:image\\/)/i;\n/** Until the image reports its size, it holds a landscape box rather than collapsing. */\nconst PLACEHOLDER_RATIO = 16 / 9;\n\nfunction decoded(href: string): string | undefined {\n try {\n return decodeURIComponent(href);\n } catch {\n return undefined;\n }\n}\n\nfunction InlineCode({ text, originalText = text }: { text: string; originalText?: string }) {\n const onFileLink = useContext(FileLinkContext);\n const renderReference = useContext(ReferenceContext);\n // A span that is exactly one reference draws as prose does; one the renderer declines stays code.\n const reference = renderReference === undefined ? undefined : exactReference(originalText);\n const drawn = reference === undefined ? undefined : renderReference?.(reference);\n const open = reference !== undefined || originalText.includes('\\n') ? undefined : onFileLink?.(originalText);\n const t = useT();\n if (drawn !== undefined) return drawn;\n if (open !== undefined) {\n return (\n <Text\n accessibilityRole=\"link\"\n accessibilityHint={t('nativeComponents.markdown.openHint', 'open {target}', { target: originalText })}\n onPress={open}\n style={[styles.code, styles.fileLink]}\n >\n {text}\n </Text>\n );\n }\n return <Text style={styles.code}>{text}</Text>;\n}\n\nfunction InlineLink({ href, children }: { href: string; children: ReactNode }) {\n const onFileLink = useContext(FileLinkContext);\n const renderReference = useContext(ReferenceContext);\n const t = useT();\n // A reference the host does not open stays text; it is never handed to the system as a URL.\n if (href.startsWith(REFERENCE_HREF_PREFIX)) {\n const reference = decoded(href.slice(REFERENCE_HREF_PREFIX.length));\n const drawn = reference === undefined ? undefined : renderReference?.(reference);\n if (drawn !== undefined) return drawn;\n const open = reference === undefined ? undefined : onFileLink?.(reference);\n if (open === undefined) return <Text>{children}</Text>;\n return (\n <Text\n accessibilityRole=\"link\"\n accessibilityHint={t('nativeComponents.markdown.openHint', 'open {target}', { target: reference ?? '' })}\n onPress={open}\n style={styles.link}\n >\n {children}\n </Text>\n );\n }\n const path = decoded(href);\n const isFile = path !== undefined && path !== '' && !URL_OR_ANCHOR.test(path);\n const open = isFile ? onFileLink?.(path, true) : undefined;\n return (\n <Text\n accessibilityRole=\"link\"\n onPress={() => {\n if (open !== undefined) open();\n else if (!isFile) Linking.openURL(href).catch(() => undefined);\n }}\n style={styles.link}\n >\n {children}\n </Text>\n );\n}\n\n/** One image: a file path through the host's loader, or a web or data address as written. */\nfunction MarkdownImage({ src, alt }: { src: string; alt: string }) {\n const loader = useContext(ImageContext);\n const t = useT();\n const imageName = alt || t('nativeComponents.markdown.image', 'Image');\n // An invalid encoded filename is shown as unavailable, never fetched.\n const source = src.startsWith('@artifact:') ? src.slice(1) : src;\n const path =\n URL_OR_ANCHOR.test(source) && !source.startsWith('artifact:')\n ? undefined\n : (decoded(source.split(/[?#]/u, 1)[0]!) ?? '');\n const [loaded, setLoaded] = useState<{ path: string; url?: string; failed?: boolean }>();\n const [ratio, setRatio] = useState(PLACEHOLDER_RATIO);\n useEffect(() => {\n if (loader === undefined || path === undefined) return;\n let active = true;\n let asset: Awaited<ReturnType<MarkdownImageLoader>> | undefined;\n void Promise.resolve()\n .then(() => {\n if (path === '') throw new Error('Invalid image path.');\n return loader(path);\n })\n .then((result) => {\n if (!active) return result.dispose();\n asset = result;\n setLoaded({ path, url: result.url });\n })\n .catch(() => {\n // The failure is shown in place, as the web image does.\n if (active) setLoaded({ path, failed: true });\n });\n return () => {\n active = false;\n asset?.dispose();\n };\n }, [path, loader]);\n const current = loaded?.path === path ? loaded : undefined;\n const uri = path === undefined ? (DIRECT_IMAGE.test(src) ? src : undefined) : current?.url;\n if (uri === undefined || current?.failed) {\n const waiting = path !== undefined && loader !== undefined && current === undefined;\n return (\n <Text style={[styles.prose, styles.imageState]} accessibilityRole={waiting ? 'text' : 'alert'}>\n {waiting\n ? t('nativeComponents.markdown.imageLoading', '{name} (loading\\u2026)', { name: alt || path || imageName })\n : t('nativeComponents.markdown.imageUnavailable', '{name} (unavailable)', { name: alt || path || imageName })}\n </Text>\n );\n }\n return (\n <Image\n source={{ uri }}\n accessibilityLabel={imageName}\n accessibilityIgnoresInvertColors\n resizeMode=\"contain\"\n onLoad={({ nativeEvent }) => {\n const fit = (width: number, height: number) => {\n if (width > 0 && height > 0) setRatio(width / height);\n };\n // iOS and Android report the size with the event; react-native-web does not, so it asks.\n const size = (nativeEvent as { source?: { width: number; height: number } } | undefined)?.source;\n if (size !== undefined) fit(size.width, size.height);\n else Image.getSize(uri, fit, () => undefined);\n }}\n onError={() => setLoaded({ path: path ?? src, failed: true })}\n style={[styles.image, { aspectRatio: ratio }]}\n />\n );\n}\nfunction renderInline(nodes: readonly MarkdownInline[]): ReactNode[] {\n return nodes.map((node, index) => {\n switch (node.type) {\n case 'text':\n return node.text;\n case 'code':\n return <InlineCode key={index} text={node.text} originalText={node.originalText} />;\n case 'strong':\n return (\n <Text key={index} style={styles.strong}>\n {renderInline(node.children)}\n </Text>\n );\n case 'em':\n return (\n <Text key={index} style={styles.em}>\n {renderInline(node.children)}\n </Text>\n );\n case 'link':\n return (\n <InlineLink key={index} href={node.href}>\n {renderInline(node.children)}\n </InlineLink>\n );\n case 'image':\n // Inside a heading or list item an image keeps to its alt text; paragraphs draw it.\n return node.alt;\n }\n });\n}\n\n/**\n * A table read column by column: every cell keeps to one line inside the sideways scroll, so each\n * column takes its widest cell and the rows line up without a table layout.\n */\nfunction MarkdownTable({ header, rows }: { header: MarkdownInline[][]; rows: MarkdownInline[][][] }) {\n const initialPage = useContext(InitialPageContext);\n const t = useT();\n const [rowPage, setRows] = useState(initialPage);\n const [columnPage, setColumns] = useState(initialPage);\n const [cellPage, setCells] = useState(initialPage);\n const visibleRows = rows.slice(0, READING.rows * Math.max(initialPage, rowPage));\n const visibleHeader = header.slice(0, READING.columns * Math.max(initialPage, columnPage));\n const limit = READING.cell * Math.max(initialPage, cellPage);\n const clipped = [visibleHeader, ...visibleRows.map((row) => row.slice(0, visibleHeader.length))].some((row) =>\n row.some((cell) => inlineLength(cell) > limit),\n );\n return (\n <View style={styles.root}>\n <ScrollView horizontal showsHorizontalScrollIndicator={false}>\n <View style={styles.table}>\n {visibleHeader.map((cell, column) => (\n <View key={column}>\n <Text style={[styles.prose, styles.cell, styles.headCell]}>\n {renderInline(inlinePrefix(cell, limit))}\n {inlineLength(cell) > limit ? '…' : ''}\n </Text>\n {visibleRows.map((row, index) => (\n <Text key={index} style={[styles.prose, styles.cell]}>\n {renderInline(inlinePrefix(row[column] ?? [], limit))}\n {inlineLength(row[column] ?? []) > limit ? '…' : ''}\n </Text>\n ))}\n </View>\n ))}\n </View>\n </ScrollView>\n <Text style={styles.meta}>\n {t(\n 'nativeComponents.markdown.tableSummary',\n '{shownRows} of {totalRows} rows · {shownColumns} of {totalColumns} columns',\n {\n shownRows: visibleRows.length,\n totalRows: rows.length,\n shownColumns: visibleHeader.length,\n totalColumns: header.length,\n },\n )}\n {clipped ? ` · ${t('nativeComponents.markdown.cellLimit', 'Cells: first {limit} characters', { limit })}` : ''}\n </Text>\n <View style={styles.actions}>\n {visibleRows.length < rows.length ? (\n <ShowMore\n label={t('nativeComponents.markdown.showMoreRows', 'Show more rows')}\n onPress={() => setRows((page) => page + 1)}\n />\n ) : null}\n {visibleHeader.length < header.length ? (\n <ShowMore\n label={t('nativeComponents.markdown.showMoreColumns', 'Show more columns')}\n onPress={() => setColumns((page) => page + 1)}\n />\n ) : null}\n {clipped ? (\n <ShowMore\n label={t('nativeComponents.markdown.showMoreCells', 'Show more cell text')}\n onPress={() => setCells((page) => page + 1)}\n />\n ) : null}\n </View>\n </View>\n );\n}\n\n/** One Show more for the whole document: a single tap reveals every hidden part and clipped text. */\nfunction Blocks({ blocks, quoted = false }: { blocks: MarkdownBlock[]; quoted?: boolean }) {\n const initialPage = useContext(InitialPageContext);\n const t = useT();\n const [revealedPage, setPage] = useState(initialPage);\n const page = Math.max(initialPage, revealedPage);\n const visible = blocks.slice(0, READING.parts * page).map((block) => boundBlock(block, page));\n const hiddenParts = visible.length < blocks.length;\n return (\n <InitialPageContext.Provider value={page}>\n {visible.map(({ block }, index) => (\n <View key={index} style={styles.root}>\n <Block block={block} first={index === 0} quoted={quoted} />\n </View>\n ))}\n {hiddenParts || visible.some(({ clipped }) => clipped) ? (\n <ShowMore\n label={t('nativeComponents.markdown.showMore', 'Show more')}\n summary={\n hiddenParts\n ? t('nativeComponents.markdown.partsSummary', '{shown} of {total} parts', {\n shown: visible.length,\n total: blocks.length,\n })\n : undefined\n }\n onPress={() => setPage(Infinity)}\n />\n ) : null}\n </InitialPageContext.Provider>\n );\n}\n\n/** A heading, paragraph or list cut to the page's character budget, and whether anything was cut. */\nfunction boundBlock(block: MarkdownBlock, page: number): { block: MarkdownBlock; clipped: boolean } {\n const limit = READING.characters * page;\n if (block.type === 'heading' || block.type === 'paragraph') {\n const children = inlinePrefix(block.children, limit);\n return { block: { ...block, children }, clipped: inlineLength(children) < inlineLength(block.children) };\n }\n if (block.type !== 'list') return { block, clipped: false };\n let remaining = limit;\n let shown = 0;\n const items = [];\n for (const item of block.items.slice(0, READING.parts * page)) {\n if (remaining <= 0) break;\n const next = inlinePrefix(item, remaining);\n items.push(next);\n const length = inlineLength(next);\n shown += length;\n remaining -= length;\n }\n const total = block.items.reduce((sum, item) => sum + inlineLength(item), 0);\n return { block: { ...block, items }, clipped: shown < total || items.length < block.items.length };\n}\n\nfunction Block({ block, first, quoted = false }: { block: MarkdownBlock; first: boolean; quoted?: boolean }) {\n const initialPage = useContext(InitialPageContext);\n const prose = [styles.prose, quoted && styles.quoted];\n switch (block.type) {\n case 'heading':\n return (\n <Text\n accessibilityRole=\"header\"\n style={[...prose, styles.heading(block.level), first && styles.firstHeading, quoted && styles.quoted]}\n >\n {renderInline(block.children)}\n </Text>\n );\n case 'paragraph': {\n // An image breaks the paragraph's text into runs, since an Image cannot sit inside Text.\n const parts: ReactNode[] = [];\n let run: MarkdownInline[] = [];\n const flush = () => {\n if (run.length > 0)\n parts.push(\n <Text key={parts.length} style={prose}>\n {renderInline(run)}\n </Text>,\n );\n run = [];\n };\n for (const node of block.children) {\n if (node.type !== 'image') {\n run.push(node);\n continue;\n }\n flush();\n parts.push(<MarkdownImage key={parts.length} src={node.src} alt={node.alt} />);\n }\n flush();\n return parts.length === 1 ? parts[0] : <View style={styles.root}>{parts}</View>;\n }\n case 'list':\n return (\n <View accessibilityRole=\"list\" style={styles.list}>\n {block.items.map((item, index) => (\n <View key={index} style={styles.item}>\n <Text style={[...prose, styles.marker]}>{block.ordered ? `${block.start + index}.` : '\\u2022'}</Text>\n <Text style={[...prose, styles.itemText]}>{renderInline(item)}</Text>\n </View>\n ))}\n </View>\n );\n case 'code':\n return <CodeBlock text={block.text} language={block.language} initialPage={initialPage} />;\n case 'rule':\n return <View accessible={false} style={styles.rule} />;\n case 'quote':\n return (\n <View style={[styles.root, styles.quote]}>\n <Blocks blocks={block.children} quoted />\n </View>\n );\n case 'table':\n return <MarkdownTable header={block.header} rows={block.rows} />;\n }\n}\n\nexport interface MarkdownProps {\n text: string;\n onFileLink?: FileLinkHandler;\n /** Draws `@scheme:value` references and code spans that are exactly one; without it they link plainly. */\n renderReference?: ReferenceRenderer;\n /** Loads relative image paths; without it they show as unavailable. */\n loadImage?: MarkdownImageLoader;\n /** Initial reveal pages for a restored reading position. Defaults to one. */\n initialPage?: number;\n}\n\n/** Markdown in Po's shared presentation, parsed by the package's own small parser. */\nexport const Markdown = memo(function Markdown({\n text,\n onFileLink,\n renderReference,\n loadImage,\n initialPage = 1,\n}: MarkdownProps) {\n const blocks = useMemo(() => parseMarkdown(text), [text]);\n const { generation } = useReadingPage(text);\n return (\n <InitialPageContext.Provider value={initialPage}>\n <FileLinkContext.Provider value={onFileLink}>\n <ReferenceContext.Provider value={renderReference}>\n <ImageContext.Provider value={loadImage}>\n <View style={styles.root}>\n <Blocks key={generation} blocks={blocks} />\n </View>\n </ImageContext.Provider>\n </ReferenceContext.Provider>\n </FileLinkContext.Provider>\n </InitialPageContext.Provider>\n );\n});\n\n/**\n * Headings step up from the prose and never shrink below it; h4 to h6 keep\n * the prose size and lean on weight, fading from `hi` to `dim`.\n */\nconst HEADING_STEP = { 1: '2xl', 2: 'xl', 3: 'lg', 4: 'base', 5: 'base', 6: 'base' } as const;\nconst HEADING_SPACE = { 1: 2, 2: 2, 3: 1, 4: 0, 5: 0, 6: 0 } as const;\nconst HEADING_INK = { 1: 'hi', 2: 'hi', 3: 'hi', 4: 'hi', 5: 'text', 6: 'dim' } as const;\n\nconst styles = StyleSheet.create((theme) => ({\n meta: {\n color: theme.colors.dim,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n actions: { flexDirection: 'row', flexWrap: 'wrap' },\n root: { minWidth: 0, gap: theme.spacing(2) },\n prose: {\n color: theme.colors.text,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n },\n heading: (level: MarkdownHeadingLevel) => ({\n marginTop: theme.spacing(HEADING_SPACE[level]),\n fontSize: theme.fontSize[HEADING_STEP[level]],\n lineHeight: theme.lineHeight[HEADING_STEP[level]],\n letterSpacing: theme.letterSpacing[HEADING_STEP[level]],\n fontWeight: theme.fontWeight.semibold,\n color: theme.colors[HEADING_INK[level]],\n }),\n firstHeading: { marginTop: 0 },\n strong: { fontWeight: theme.fontWeight.semibold, color: theme.colors.hi },\n em: { fontStyle: 'italic' },\n code: {\n backgroundColor: theme.colors.deep,\n color: theme.colors.green,\n fontFamily: fontOf(theme.fontFamily.mono),\n },\n fileLink: { textDecorationLine: 'underline' },\n link: { color: theme.colors.blue, textDecorationLine: 'underline' },\n list: { gap: theme.spacing(0.5) },\n item: { flexDirection: 'row', gap: theme.spacing(2), paddingLeft: theme.spacing(1) },\n marker: { minWidth: theme.spacing(3), color: theme.colors.dim },\n itemText: { flexShrink: 1 },\n rule: { height: 1, backgroundColor: theme.colors['border-soft'] },\n // The web blockquote: a rule at the left and quieter text.\n quote: { borderLeftWidth: 2, borderLeftColor: theme.colors.border, paddingLeft: theme.spacing(3) },\n quoted: { color: theme.colors.dim },\n // The web table: bordered cells, the header on the deep surface.\n table: {\n flexDirection: 'row',\n borderTopWidth: 1,\n borderLeftWidth: 1,\n borderColor: theme.colors.border,\n },\n cell: {\n paddingHorizontal: theme.spacing(2),\n paddingVertical: theme.spacing(1),\n borderRightWidth: 1,\n borderBottomWidth: 1,\n borderColor: theme.colors.border,\n },\n headCell: { backgroundColor: theme.colors.deep, fontWeight: theme.fontWeight.semibold, color: theme.colors.hi },\n // The web image's frame: at most 480 tall, a soft border and rounded corners.\n image: {\n width: '100%',\n maxHeight: 480,\n borderRadius: theme.borderRadius.md,\n borderWidth: 1,\n borderColor: theme.colors.border,\n },\n imageState: { color: theme.colors.dim },\n}));\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,MAAM0B,qBAAqBzB,cAAc,CAAC;AAE1C,MAAM0B,kBAAkB1B,cAA2C2B,MAAS;AAS5E,MAAMK,mBAAmBhC,cAA6C2B,MAAS;AAK/E,MAAMW,eAAetC,cAA+C2B,MAAS;AAE7E,MAAMY,gBAAgB;;AAEtB,MAAMC,eAAe;;AAErB,MAAMC,oBAAoB,KAAK;AAE/B,SAASC,QAAQC,MAAkC;CACjD,IAAI;EACF,OAAOC,mBAAmBD,IAAI;CAChC,QAAQ;EACN;CACF;AACF;AAEA,SAASE,WAAW,EAAEtB,MAAMuB,eAAevB,QAAiD;CAC1F,MAAMwB,aAAa5C,WAAWuB,eAAe;CAC7C,MAAMsB,kBAAkB7C,WAAW6B,gBAAgB;CAEnD,MAAMH,YAAYmB,oBAAoBrB,SAAYA,SAAYjB,eAAeoC,YAAY;CACzF,MAAMG,QAAQpB,cAAcF,SAAYA,SAAYqB,kBAAkBnB,SAAS;CAC/E,MAAMqB,OAAOrB,cAAcF,UAAamB,aAAaK,SAAS,IAAI,IAAIxB,SAAYoB,aAAaD,YAAY;CAC3G,MAAMM,IAAIrD,KAAK;CACf,IAAIkD,UAAUtB,QAAW,OAAOsB;CAChC,IAAIC,SAASv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hEnB,OAAO;EAAEwC,iBAAiB;EAAGC,iBAAiB/B,MAAME,OAAO8B;EAAQJ,aAAa5B,MAAMc,QAAQ,CAAC;EAACL,mBAAA,CAAA,CAAA;CAAC;CACjGpD,QAAQ;EAAE4C,OAAOD,MAAME,OAAOC;EAAGM,mBAAA,CAAA,CAAA;CAAC;CAElChE,OAAO;EACLiE,eAAe;EACfuB,gBAAgB;EAChBH,iBAAiB;EACjBI,aAAalC,MAAME,OAAO8B;EAAMvB,mBAAA,CAAA,CAAA;CAClC;CACArE,MAAM;EACJ+F,mBAAmBnC,MAAMc,QAAQ,CAAC;EAClCsB,iBAAiBpC,MAAMc,QAAQ,CAAC;EAChCuB,kBAAkB;EAClBC,mBAAmB;EACnBJ,aAAalC,MAAME,OAAO8B;EAAMvB,mBAAA,CAAA,CAAA;CAClC;CACA9D,UAAU;EAAE2E,iBAAiBtB,MAAME,OAAOqB;EAAML,YAAYlB,MAAMkB,WAAWC;EAAUlB,OAAOD,MAAME,OAAOkB;EAAEX,mBAAA,CAAA,CAAA;CAAC;CAE9G/F,OAAO;EACLL,OAAO;EACPkI,WAAW;EACXC,cAAcxC,MAAMwC,aAAaC;EACjCC,aAAa;EACbR,aAAalC,MAAME,OAAO8B;EAAMvB,mBAAA,CAAA,CAAA;CAClC;CACAxG,YAAY;EAAEgG,OAAOD,MAAME,OAAOC;EAAGM,mBAAA,CAAA,CAAA;CAAC;AACxC,EAAE"}
@@ -1,14 +1,8 @@
1
1
  import { StatusTone } from "./StatusBadge.mjs";
2
2
  import { StyleProp, TextProps, ViewProps, ViewStyle } from "react-native";
3
3
  import { ReactNode } from "react";
4
+ import { MessageItemState, MessageItemState as MessageItemState$1 } from "@agimon-ai/po-native-components/shell";
4
5
  //#region src/components/MessageItem.d.ts
5
- export interface MessageItemState {
6
- tone: StatusTone;
7
- /** Whether the header offers the toggle; an item that hides nothing offers none. */
8
- expandable: boolean;
9
- expanded: boolean;
10
- toggle: () => void;
11
- }
12
6
  /** The enclosing item's state, for a part that lives deeper than the item's render prop. */
13
7
  export declare function useMessageItem(): MessageItemState;
14
8
  /** The tone a tool call's item wears: running while the tool runs, then its outcome. */
@@ -35,19 +29,19 @@ export interface MessageItemProps extends Omit<ViewProps, 'children' | 'style'>
35
29
  export declare function MessageItem({ tone, expandable, defaultExpanded, expanded, onExpandedChange, children, style, ...props }: MessageItemProps): import("react").JSX.Element;
36
30
  export interface MessageItemGroupProps extends Omit<ViewProps, 'children' | 'style'> {
37
31
  tone?: StatusTone;
38
- /** The bold label at the left of the group header: the tool the run belongs to. */
32
+ /** The bold label at the left of the group header, such as "7 tool calls". */
39
33
  title: ReactNode;
40
- /** The line beside it, such as how many calls the group holds. */
34
+ /** The line beside it, such as which tools the group holds. */
41
35
  summary?: ReactNode;
42
- /** The badge text; defaults to the tone's label, null hides the badge. */
36
+ /** The outcome's label; defaults to the tone's label, null hides the outcome. */
43
37
  badge?: ReactNode | null;
44
38
  children?: ReactNode;
45
39
  style?: StyleProp<ViewStyle>;
46
40
  }
47
41
  /**
48
- * One frame around a run of items that belong together. Each item inside
49
- * becomes a row: same header, same expand, no card of its own, and its tone
50
- * an edge down its left side.
42
+ * One frame around a run of items that belong together. It stays open: each
43
+ * item inside becomes a row with its own name, outcome and expand, no card of
44
+ * its own, and its tone an edge down its left side.
51
45
  */
52
46
  export declare function MessageItemGroup({ tone, title, summary, badge, children, style, ...props }: MessageItemGroupProps): import("react").JSX.Element;
53
47
  export interface MessageItemHeaderProps extends Omit<ViewProps, 'children' | 'style'> {
@@ -60,9 +54,9 @@ export interface MessageItemHeaderProps extends Omit<ViewProps, 'children' | 'st
60
54
  style?: StyleProp<ViewStyle>;
61
55
  }
62
56
  /**
63
- * The title row: label, summary, the tone's badge and, when the item is
57
+ * The title row: label, summary, the tone's outcome and, when the item is
64
58
  * expandable, a chevron; the whole row is the toggle. A row inside a group
65
- * drops its title and speaks up only when something failed or is running.
59
+ * keeps its name but drops the chip and caption the group header carries.
66
60
  */
67
61
  export declare function MessageItemHeader({ title, badge, children, style, ...props }: MessageItemHeaderProps): import("react").JSX.Element;
68
62
  export interface MessageItemPartProps extends Omit<ViewProps, 'children' | 'style'> {
@@ -84,4 +78,5 @@ export interface MessageItemStatusProps extends Omit<TextProps, 'children'> {
84
78
  /** The one-line status under a body: `running`, `failed`, `done`, or the hint that more is hidden. */
85
79
  export declare function MessageItemStatus({ tone, glyph, expands, children, containerStyle, style, ...props }: MessageItemStatusProps): import("react").JSX.Element;
86
80
  //#endregion
81
+ export type { MessageItemState$1 as MessageItemState };
87
82
  //# sourceMappingURL=MessageItem.d.mts.map