@opengeni/react-native 4.2.1-canary.39593846423001 → 4.3.1
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.
- package/android/build.gradle +15 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/dev/opengeni/textselection/OpenGeniTextSelectionModule.kt +274 -0
- package/dist/{chunk-D3MFBDVR.js → chunk-2RNMGRTB.js} +3 -3
- package/dist/{chunk-D3MFBDVR.js.map → chunk-2RNMGRTB.js.map} +1 -1
- package/dist/{chunk-2W74OY6I.js → chunk-FHPMRXIG.js} +16 -2
- package/dist/chunk-FHPMRXIG.js.map +1 -0
- package/dist/{chunk-63PZ52YJ.js → chunk-QFV5DISV.js} +38 -5
- package/dist/chunk-QFV5DISV.js.map +1 -0
- package/dist/{chunk-U5L2CUMJ.js → chunk-ZZNZBZWV.js} +3 -3
- package/dist/{chunk-U5L2CUMJ.js.map → chunk-ZZNZBZWV.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/timeline/activity.d.ts +3 -1
- package/dist/timeline/annotations.d.ts +81 -0
- package/dist/timeline/icon-nodes.generated.d.ts +5 -0
- package/dist/timeline/index.d.ts +2 -0
- package/dist/timeline/index.js +1223 -203
- package/dist/timeline/index.js.map +1 -1
- package/dist/timeline/markdown.js +5 -2
- package/dist/timeline/markdown.js.map +1 -1
- package/dist/timeline/message-timeline.d.ts +20 -2
- package/dist/timeline/previews.js +2 -2
- package/dist/timeline/primitives.d.ts +7 -1
- package/dist/timeline/queue-dock.d.ts +4 -1
- package/dist/timeline/text-selection.d.ts +44 -0
- package/expo-module.config.json +5 -2
- package/ios/OpenGeniTextSelectionModule.swift +560 -0
- package/package.json +6 -4
- package/src/timeline/activity.tsx +76 -21
- package/src/timeline/annotations.tsx +877 -0
- package/src/timeline/icon-nodes.generated.ts +14 -0
- package/src/timeline/index.ts +2 -0
- package/src/timeline/markdown.tsx +7 -0
- package/src/timeline/message-timeline.tsx +340 -174
- package/src/timeline/primitives.tsx +50 -1
- package/src/timeline/queue-dock.tsx +36 -0
- package/src/timeline/session-screen.tsx +122 -4
- package/src/timeline/sheet.tsx +3 -2
- package/src/timeline/text-selection.ts +115 -0
- package/dist/chunk-2W74OY6I.js.map +0 -1
- package/dist/chunk-63PZ52YJ.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useNativeTimelineMessages, withAlpha } from '../chunk-
|
|
2
|
-
import { fontStyle, MONO_FALLBACK, insetSurface, useNativeTimelineTheme, Icon } from '../chunk-
|
|
1
|
+
import { useNativeTimelineMessages, withAlpha } from '../chunk-QFV5DISV.js';
|
|
2
|
+
import { fontStyle, MONO_FALLBACK, insetSurface, useNativeTimelineTheme, Icon } from '../chunk-FHPMRXIG.js';
|
|
3
3
|
import { createContext, useMemo, useState, useContext, useRef } from 'react';
|
|
4
4
|
import { Text, View, Image, ScrollView, Pressable } from 'react-native';
|
|
5
5
|
import Markdown, { MarkdownIt, renderRules } from 'react-native-markdown-display';
|
|
@@ -382,6 +382,9 @@ function webRules(theme, tone, onCopy, media = {}) {
|
|
|
382
382
|
const line = tone === "muted" ? 24 : 28;
|
|
383
383
|
return {
|
|
384
384
|
...renderRules,
|
|
385
|
+
// Every run of text is selectable, as on the web: a long press selects
|
|
386
|
+
// words (and, inside a timeline message, offers Add note).
|
|
387
|
+
textgroup: (node, children, _parent, styles) => /* @__PURE__ */ jsx(Text, { selectable: true, style: styles.textgroup, children }, node.key),
|
|
385
388
|
// Web lists use a disc marker in fg-subtle; the library's iOS default is a middle dot.
|
|
386
389
|
list_item: (node, children, parent, styles, inheritedStyles = {}) => {
|
|
387
390
|
if (parent.some((entry) => entry.type === "bullet_list")) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/timeline/markdown.tsx"],"names":[],"mappings":";;;;;;;;;;AAwCA,IAAM,UAAU,MAAM;AACpB,EAAA,MAAM,SAAS,UAAA,CAAW,EAAE,aAAa,KAAA,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;AAEJ;AAEO,SAAS,yBAAA,CACd,OAAA,GAK2B,EAAC,EACJ;AACxB,EAAA,MAAM,WAAA,GAAc,CAAC,GAAA,KAAyB;AAC5C,IAAA,MAAM,MAAA,GAAS,kBAAkB,GAAG,CAAA;AACpC,IAAA,IAAI,MAAA,IAAU,sBAAA,CAAuB,GAAG,CAAA,EAAG;AACzC,MAAA,IAAI,MAAA,EAAQ,OAAA,CAAQ,cAAA,GAAiB,MAAM,CAAA;AAC3C,MAAA,OAAO,KAAA;AAAA,IACT;AACA,IAAA,OAAO,OAAA,CAAQ,WAAA,GAAc,OAAA,CAAQ,WAAA,CAAY,GAAG,CAAA,GAAI,IAAA;AAAA,EAC1D,CAAA;AAEA,EAAA,MAAM,KAAA,GAA8B;AAAA,IAClC,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,wBAAwB,OAAA,CAAQ;AAAA,GAClC;AACA,EAAA,OAAO,CAAC,MAAM,EAAE,IAAA,EAAM,WAAU,KAC9B,IAAA,CAAK,MAAK,mBACR,GAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,IAAA;AAAA,MACA,IAAA;AAAA,MACA,WAAW,SAAA,KAAc,IAAA;AAAA,MACzB,WAAA;AAAA,MACA,QAAQ,OAAA,CAAQ,MAAA;AAAA,MAChB;AAAA;AAAA,GACF,uBAEC,IAAA,EAAA,EAAK,CAAA;AAEZ","file":"markdown.js","sourcesContent":["import {\n createContext,\n useContext,\n useMemo,\n useRef,\n useState,\n type ComponentRef,\n type ReactNode,\n} from \"react\";\nimport { Image, Pressable, ScrollView, Text, View, type TextStyle } from \"react-native\";\nimport Markdown, { MarkdownIt, renderRules, type RenderRules } from \"react-native-markdown-display\";\nimport Svg, { Defs, LinearGradient, Rect, Stop } from \"react-native-svg\";\nimport {\n isReservedOpenGeniLink,\n parseOpenGeniLink,\n parseRetainedFileReference,\n type OpenGeniLinkTarget,\n} from \"@opengeni/sdk\";\nimport {\n interactivePreviewKind,\n type InteractivePreviewKind,\n} from \"@opengeni/react/native-previews\";\nimport { Icon } from \"./icon\";\nimport { withAlpha as withAlphaColor } from \"./primitives\";\nimport type { NativeMarkdownRenderer } from \"./message-timeline\";\nimport {\n fontStyle,\n insetSurface,\n MONO_FALLBACK,\n useNativeTimelineTheme,\n type NativeTimelineTheme,\n} from \"./theme\";\nimport { useNativeTimelineMessages } from \"./messages\";\n\n/**\n * One parser for every message, configured like the web's `remark-gfm`: no typographic\n * substitution (quotes, dashes and `(c)` stay as written), and bare `http(s)://` URLs\n * autolink while file-like words (`fib.py`) do not. The library default would build a\n * new typographer parser on every render, including every streaming delta.\n */\nconst PARSER = (() => {\n const parser = MarkdownIt({ typographer: false, linkify: true });\n parser.linkify.set({ fuzzyLink: false, fuzzyEmail: false });\n return parser;\n})();\n\n/* ----------------------------------------------------------------------------\n Web Markdown (components/markdown.tsx) styles for react-native-markdown-display.\n Prose 15/28 (`text-og-md leading-7`), paragraphs `my-2.5`, lists `ml-5 gap-1`,\n code blocks `rounded-og-md bg-surface-1/70 px-3 py-2.5 text-og-sm leading-5`.\n -------------------------------------------------------------------------- */\n\nexport function webMarkdownStyles(\n theme: NativeTimelineTheme,\n tone: \"body\" | \"muted\",\n): Record<string, TextStyle> {\n const c = theme.colors;\n const muted = tone === \"muted\";\n const size = muted ? theme.size.base : theme.size.md;\n const line = muted ? 24 : 28;\n const body = {\n ...fontStyle(theme),\n color: muted ? c[\"fg-muted\"] : c.fg,\n fontSize: size,\n lineHeight: line,\n };\n const mono = fontStyle(theme, 400, \"mono\");\n const heading = { ...fontStyle(theme, 600), color: c.fg, letterSpacing: -0.2 };\n return {\n body,\n paragraph: { marginTop: 0, marginBottom: 10 },\n // Web margins collapse against the 10pt paragraph margin; native margins add up.\n heading1: { ...heading, fontSize: 20, lineHeight: 28, marginTop: 10, marginBottom: 10 },\n heading2: { ...heading, fontSize: 18, lineHeight: 26, marginTop: 10, marginBottom: 8 },\n heading3: {\n ...heading,\n fontSize: theme.size.md,\n lineHeight: 24,\n marginTop: 6,\n marginBottom: 6,\n },\n heading4: {\n ...heading,\n fontSize: theme.size.sm,\n lineHeight: 18,\n marginTop: 6,\n marginBottom: 6,\n textTransform: \"uppercase\" as const,\n },\n strong: { ...fontStyle(theme, 600), color: muted ? c[\"fg-muted\"] : c.fg },\n em: theme.fonts.sansItalic\n ? { fontFamily: theme.fonts.sansItalic }\n : { fontStyle: \"italic\" as const },\n bullet_list: { marginTop: 0, marginBottom: 10 },\n ordered_list: { marginTop: 0, marginBottom: 10 },\n list_item: { marginBottom: 4 },\n bullet_list_icon: { color: c[\"fg-subtle\"], marginLeft: 6, marginRight: 8, lineHeight: line },\n ordered_list_icon: { color: c[\"fg-subtle\"], marginLeft: 2, marginRight: 6, lineHeight: line },\n code_inline: {\n ...mono,\n fontFamily: (mono.fontFamily as string | undefined) ?? MONO_FALLBACK,\n fontSize: theme.size.sm,\n backgroundColor: c[\"surface-2\"],\n color: c.fg,\n borderRadius: theme.radius.xs,\n paddingHorizontal: 4,\n borderWidth: 0,\n },\n fence: {\n ...mono,\n fontSize: theme.size.sm,\n lineHeight: 20,\n color: c[\"fg-muted\"],\n backgroundColor: insetSurface(theme),\n borderWidth: 0,\n borderRadius: theme.radius.md,\n paddingHorizontal: 12,\n paddingVertical: 10,\n marginTop: 2,\n marginBottom: 10,\n },\n code_block: {\n ...mono,\n fontSize: theme.size.sm,\n lineHeight: 20,\n color: c[\"fg-muted\"],\n backgroundColor: insetSurface(theme),\n borderWidth: 0,\n borderRadius: theme.radius.md,\n paddingHorizontal: 12,\n paddingVertical: 10,\n },\n // Web MARKDOWN_LINK_CLASS: medium weight in accent-strong, no underline.\n link: {\n ...fontStyle(theme, 500),\n color: c[\"accent-strong\"],\n textDecorationLine: \"none\" as const,\n },\n blockquote: {\n // Web blockquote text is fg-muted; text styles inherit through the renderer.\n color: c[\"fg-muted\"],\n backgroundColor: \"transparent\",\n borderLeftColor: c[\"border-strong\"],\n borderLeftWidth: 2,\n paddingLeft: 14,\n marginLeft: 0,\n marginVertical: 12,\n },\n hr: { backgroundColor: c.border, height: 1, marginVertical: 16 },\n // Web tables: unboxed, text-og-base, hairline rules, content-sized columns.\n table: { borderWidth: 0, marginTop: 12, marginBottom: 10 },\n thead: {},\n th: {\n ...fontStyle(theme, 500),\n color: c.fg,\n fontSize: theme.size.base,\n lineHeight: 20,\n paddingVertical: 6,\n paddingRight: 16,\n },\n tr: { borderBottomWidth: 0 },\n td: {\n color: c[\"fg-muted\"],\n fontSize: theme.size.base,\n lineHeight: 20,\n paddingVertical: 6,\n paddingRight: 16,\n },\n };\n}\n\nfunction CodeFence({\n content,\n language,\n onCopy,\n}: {\n content: string;\n language: string;\n onCopy?: ((text: string) => void) | undefined;\n}) {\n const theme = useNativeTimelineTheme();\n const m = useNativeTimelineMessages();\n const styles = webMarkdownStyles(theme, \"body\");\n const [copied, setCopied] = useState(false);\n // The code scrolls in the space left of the language label and copy button, which\n // vary in width (\"SH\" vs \"TYPESCRIPT\"); reserve their measured width plus a gap.\n const [chromeWidth, setChromeWidth] = useState(64);\n return (\n <View style={{ marginTop: 2, marginBottom: 10 }}>\n <View\n style={{\n borderRadius: theme.radius.md,\n backgroundColor: insetSurface(theme),\n paddingLeft: 12,\n paddingRight: chromeWidth,\n paddingVertical: 10,\n }}\n >\n <ScrollView horizontal showsHorizontalScrollIndicator={false}>\n <Text\n selectable\n style={{\n ...styles.code_block,\n backgroundColor: \"transparent\",\n paddingHorizontal: 0,\n paddingVertical: 0,\n }}\n >\n {content}\n </Text>\n </ScrollView>\n </View>\n <View\n onLayout={(event) => {\n const next = Math.ceil(event.nativeEvent.layout.width) + 6 + 10;\n if (next !== chromeWidth) setChromeWidth(next);\n }}\n style={{\n position: \"absolute\",\n top: 6,\n right: 6,\n flexDirection: \"row\",\n alignItems: \"center\",\n gap: 4,\n }}\n >\n {language ? (\n <Text\n style={{\n ...fontStyle(theme, 400, \"mono\"),\n fontSize: 10,\n letterSpacing: 0.5,\n textTransform: \"uppercase\",\n color: theme.colors[\"fg-subtle\"],\n opacity: 0.7,\n }}\n >\n {language}\n </Text>\n ) : null}\n {onCopy ? (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={m.copyCode}\n hitSlop={8}\n onPress={() => {\n onCopy(content);\n setCopied(true);\n setTimeout(() => setCopied(false), 1400);\n }}\n style={{ width: 28, height: 28, alignItems: \"center\", justifyContent: \"center\" }}\n >\n <Icon name={copied ? \"check\" : \"copy\"} size={14} color={theme.colors[\"fg-subtle\"]} />\n </Pressable>\n ) : null}\n </View>\n </View>\n );\n}\n\n/* Tables ------------------------------------------------------------------- */\n\ntype AstNode = { type: string; content?: string; children?: AstNode[] };\n\nfunction astText(node: AstNode): string {\n // Container nodes carry an empty content string; text lives in their leaves.\n if (node.children && node.children.length > 0) return node.children.map(astText).join(\"\");\n return typeof node.content === \"string\" ? node.content : \"\";\n}\n\nfunction tableRows(table: AstNode): string[][] {\n const rows: string[][] = [];\n const visit = (node: AstNode) => {\n if (node.type === \"tr\") rows.push((node.children ?? []).map((cell) => astText(cell).trim()));\n else (node.children ?? []).forEach(visit);\n };\n visit(table);\n return rows;\n}\n\n/**\n * Content-sized columns, as a browser's auto table layout lays them out: short\n * columns keep their natural width on one line, long ones share the rest.\n */\nfunction tableColumns(rows: string[][]): { width?: number; grow: number }[] {\n const count = Math.max(0, ...rows.map((row) => row.length));\n return Array.from({ length: count }, (_, index) => {\n const longest = Math.max(1, ...rows.map((row) => row[index]?.length ?? 0));\n return longest <= 14 ? { width: Math.ceil(longest * 8.4) + 20, grow: 0 } : { grow: longest };\n });\n}\n\n/** A cell's column: its sibling index in the row (set by the AST builder). */\nfunction cellIndex(node: { index?: unknown }): number {\n return typeof node.index === \"number\" && node.index >= 0 ? node.index : 0;\n}\n\n/** Explicit column widths for a measured table; empty until the table lays out. */\nconst TableColumnsContext = createContext<number[]>([]);\n\nfunction columnWidths(columns: { width?: number; grow: number }[], available: number): number[] {\n const fixed = columns.reduce((sum, column) => sum + (column.width ?? 0), 0);\n const growth = columns.reduce(\n (sum, column) => sum + (column.width === undefined ? column.grow : 0),\n 0,\n );\n const rest = Math.max(0, available - fixed);\n if (growth === 0) return columns.map((column) => column.width ?? 0);\n // Long columns share the rest by length, each keeping a readable minimum.\n return columns.map((column) =>\n column.width !== undefined ? column.width : Math.max(64, (rest * column.grow) / growth),\n );\n}\n\n/** A column's comfortable width when the table is wider than the screen. */\nfunction naturalColumnWidth(column: { width?: number; grow: number }): number {\n return column.width ?? Math.min(280, Math.max(120, Math.ceil(column.grow * 7.6) + 20));\n}\n\nfunction MarkdownTable({\n node,\n children,\n onCopy,\n}: {\n node: AstNode;\n children: ReactNode;\n onCopy?: ((text: string) => void) | undefined;\n}) {\n const theme = useNativeTimelineTheme();\n const m = useNativeTimelineMessages();\n const rows = useMemo(() => tableRows(node), [node]);\n const columns = useMemo(() => tableColumns(rows), [rows]);\n const natural = useMemo(() => columns.map(naturalColumnWidth), [columns]);\n const naturalWidth = natural.reduce((sum, width) => sum + width, 0);\n const [available, setAvailable] = useState(0);\n // Web wraps tables in overflow-x-auto: a table that cannot fit keeps readable\n // columns and scrolls sideways instead of crushing every cell.\n const scrolls = available > 0 && naturalWidth > available;\n const widths = useMemo(\n () => (available > 0 ? (scrolls ? natural : columnWidths(columns, available)) : []),\n [available, columns, natural, scrolls],\n );\n const [copied, setCopied] = useState(false);\n // A soft edge says \"more columns this way\" until the reader reaches the end.\n const [atEnd, setAtEnd] = useState(false);\n const scroller = useRef<ComponentRef<typeof ScrollView>>(null);\n const body = (\n <TableColumnsContext.Provider value={widths}>{children}</TableColumnsContext.Provider>\n );\n return (\n <View\n style={{ marginTop: 12, marginBottom: 10 }}\n onLayout={(event) => setAvailable(Math.round(event.nativeEvent.layout.width))}\n >\n {scrolls ? (\n <View>\n <ScrollView\n ref={scroller}\n horizontal\n nestedScrollEnabled\n directionalLockEnabled\n showsHorizontalScrollIndicator\n scrollEventThrottle={32}\n onLayout={() => scroller.current?.flashScrollIndicators()}\n onScroll={(event) => {\n const { contentOffset, contentSize, layoutMeasurement } = event.nativeEvent;\n setAtEnd(contentOffset.x + layoutMeasurement.width >= contentSize.width - 8);\n }}\n accessibilityHint={m.scrollTableHint}\n >\n <View style={{ width: naturalWidth }}>{body}</View>\n </ScrollView>\n {atEnd ? null : (\n <Svg\n pointerEvents=\"none\"\n width={36}\n height=\"100%\"\n style={{ position: \"absolute\", top: 0, right: 0, bottom: 0 }}\n >\n <Defs>\n <LinearGradient id=\"table-edge\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"0\">\n <Stop offset=\"0\" stopColor={theme.colors.bg} stopOpacity={0} />\n <Stop offset=\"1\" stopColor={theme.colors.bg} stopOpacity={0.95} />\n </LinearGradient>\n </Defs>\n <Rect x=\"0\" y=\"0\" width=\"36\" height=\"100%\" fill=\"url(#table-edge)\" />\n </Svg>\n )}\n </View>\n ) : (\n body\n )}\n {onCopy ? (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={m.copyTable}\n hitSlop={8}\n onPress={() => {\n onCopy(rows.map((row) => row.join(\"\\t\")).join(\"\\n\"));\n setCopied(true);\n setTimeout(() => setCopied(false), 1400);\n }}\n style={{\n position: \"absolute\",\n top: 2,\n right: 0,\n width: 28,\n height: 28,\n alignItems: \"center\",\n justifyContent: \"center\",\n borderRadius: 8,\n backgroundColor: scrolls ? theme.colors.bg : \"transparent\",\n }}\n >\n <Icon name={copied ? \"check\" : \"copy\"} size={14} color={theme.colors[\"fg-subtle\"]} />\n </Pressable>\n ) : null}\n </View>\n );\n}\n\nfunction TableRow({ head, last, children }: { head: boolean; last: boolean; children: ReactNode }) {\n const theme = useNativeTimelineTheme();\n const c = theme.colors;\n return (\n <View\n style={{\n flexDirection: \"row\",\n borderBottomWidth: last ? 0 : 1,\n // Header rule in border; body rules at 70% (web border-og-border/70).\n borderBottomColor: head ? c.border : withAlphaColor(c.border, 0.7),\n }}\n >\n {children}\n </View>\n );\n}\n\nfunction TableCell({\n index,\n style,\n children,\n}: {\n index: number;\n style: object;\n children: ReactNode;\n}) {\n const width = useContext(TableColumnsContext)[index];\n return (\n <View\n style={[\n style,\n // The renderer's default cell style is flex: 1 (equal columns); a measured\n // table replaces it with content-sized widths.\n width !== undefined ? { flex: 0, width } : null,\n ]}\n >\n {children}\n </View>\n );\n}\n\nfunction webRules(\n theme: NativeTimelineTheme,\n tone: \"body\" | \"muted\",\n onCopy?: (text: string) => void,\n media: MarkdownMediaOptions = {},\n): RenderRules {\n const line = tone === \"muted\" ? 24 : 28;\n return {\n ...renderRules,\n // Web lists use a disc marker in fg-subtle; the library's iOS default is a middle dot.\n list_item: (node, children, parent, styles, inheritedStyles = {}) => {\n if (parent.some((entry: { type: string }) => entry.type === \"bullet_list\")) {\n // A drawn disc: the text bullet glyph renders noticeably smaller than\n // the browser's list-disc marker at the same line height.\n const disc = 5.5;\n return (\n <View key={node.key} style={{ flexDirection: \"row\", marginBottom: 4 }}>\n <View\n accessible={false}\n style={{ width: 20, height: line, alignItems: \"center\", justifyContent: \"center\" }}\n >\n <View\n style={{\n width: disc,\n height: disc,\n borderRadius: disc / 2,\n backgroundColor: theme.colors[\"fg-subtle\"],\n }}\n />\n </View>\n <View style={{ flex: 1, minWidth: 0 }}>{children}</View>\n </View>\n );\n }\n return renderRules.list_item!(node, children, parent, styles, inheritedStyles);\n },\n table: (node, children) => (\n <MarkdownTable key={node.key} node={node} onCopy={onCopy}>\n {children}\n </MarkdownTable>\n ),\n tr: (node, children, parent) => {\n const head = parent.some((entry: { type: string }) => entry.type === \"thead\");\n const body = parent.find((entry: { type: string }) => entry.type === \"tbody\") as\n | { children?: unknown[] }\n | undefined;\n const last = !head && body?.children?.[body.children.length - 1] === node;\n return (\n <TableRow key={node.key} head={head} last={last}>\n {children}\n </TableRow>\n );\n },\n th: (node, children, _parent, styles) => (\n <TableCell key={node.key} index={cellIndex(node)} style={styles._VIEW_SAFE_th}>\n {children}\n </TableCell>\n ),\n td: (node, children, _parent, styles) => (\n <TableCell key={node.key} index={cellIndex(node)} style={styles._VIEW_SAFE_td}>\n {children}\n </TableCell>\n ),\n fence: (node) => {\n const raw = typeof node.content === \"string\" ? node.content : \"\";\n const content = raw.endsWith(\"\\n\") ? raw.slice(0, -1) : raw;\n const info = (node as { sourceInfo?: unknown }).sourceInfo;\n const language = typeof info === \"string\" ? (info.trim().split(/\\s+/)[0] ?? \"\") : \"\";\n const kind = interactivePreviewKind(language);\n if (kind && media.renderInteractiveBlock) {\n return (\n <InteractiveFence\n key={node.key}\n kind={kind}\n content={content}\n render={media.renderInteractiveBlock}\n />\n );\n }\n return <CodeFence key={node.key} content={content} language={language} onCopy={onCopy} />;\n },\n image: (node) => {\n const attributes = (node as { attributes?: { src?: unknown; alt?: unknown } }).attributes;\n const src = typeof attributes?.src === \"string\" ? attributes.src : \"\";\n const alt = typeof attributes?.alt === \"string\" ? attributes.alt : \"\";\n const custom = src ? media.renderImage?.({ src, alt }) : undefined;\n return custom !== undefined && custom !== null ? (\n <View key={node.key}>{custom}</View>\n ) : (\n <MarkdownImage key={node.key} src={src} alt={alt} />\n );\n },\n };\n}\n\n/** An assistant-authored interactive preview fence, as the host should draw it. */\nexport type NativeInteractiveBlock = {\n kind: InteractivePreviewKind;\n /** The fence body (complete only when `state` is \"complete\"). */\n content: string;\n /**\n * \"streaming\": still being written (show a loading surface, never the body);\n * \"incomplete\": generation stopped before the fence closed; \"complete\".\n */\n state: \"streaming\" | \"incomplete\" | \"complete\";\n};\n\nexport interface MarkdownMediaOptions {\n /**\n * Draw a Markdown image. Retained files arrive as `artifact:<id>` sources,\n * which only the host can resolve; return null to use the built-in image.\n */\n renderImage?: ((image: { src: string; alt: string }) => ReactNode) | undefined;\n /**\n * Draw `opengeni-html` / `opengeni-site` fences (web `renderInteractiveBlock`).\n * Without it they show as code, like the web without the host opt-in.\n */\n renderInteractiveBlock?: ((block: NativeInteractiveBlock) => ReactNode) | undefined;\n}\n\n/** Whether the message ends inside an unclosed fence, and that fence's body. */\nexport function trailingOpenFence(text: string): string | null {\n let open: { char: string; length: number; lines: string[] } | null = null;\n for (const line of text.split(\"\\n\")) {\n if (open) {\n const close = /^ {0,3}([`~]{3,})\\s*$/.exec(line);\n if (close && close[1]![0] === open.char && close[1]!.length >= open.length) open = null;\n else open.lines.push(line);\n continue;\n }\n const start = /^ {0,3}(`{3,}|~{3,})/.exec(line);\n if (start) open = { char: start[1]![0]!, length: start[1]!.length, lines: [] };\n }\n return open ? open.lines.join(\"\\n\") : null;\n}\n\nconst FenceStateContext = createContext<{ openTail: string | null; streaming: boolean }>({\n openTail: null,\n streaming: false,\n});\n\nfunction InteractiveFence({\n kind,\n content,\n render,\n}: {\n kind: InteractivePreviewKind;\n content: string;\n render: (block: NativeInteractiveBlock) => ReactNode;\n}) {\n const { openTail, streaming } = useContext(FenceStateContext);\n const open = openTail !== null && openTail.trimEnd() === content.trimEnd();\n const state = !open ? \"complete\" : streaming ? \"streaming\" : \"incomplete\";\n return <>{render({ kind, content: state === \"complete\" ? content : \"\", state })}</>;\n}\n\n/** Plain image URLs load directly; retained files need the host's `renderImage`. */\nfunction MarkdownImage({ src, alt }: { src: string; alt: string }) {\n const theme = useNativeTimelineTheme();\n const m = useNativeTimelineMessages();\n const [ratio, setRatio] = useState<number | null>(null);\n const [failed, setFailed] = useState(false);\n const remote = /^https?:\\/\\//i.test(src) && !parseRetainedFileReference(src);\n if (!remote || failed) {\n return (\n <Text\n style={{ ...fontStyle(theme), color: theme.colors[\"fg-muted\"], fontSize: theme.size.sm }}\n >\n {m.previewUnavailable(alt || m.image)}\n </Text>\n );\n }\n return (\n <Image\n accessibilityLabel={alt || m.image}\n source={{ uri: src }}\n resizeMode=\"contain\"\n onLoad={(event) => {\n const { width, height } = event.nativeEvent.source;\n if (width > 0 && height > 0) setRatio(width / height);\n }}\n onError={() => setFailed(true)}\n style={{\n width: \"100%\",\n aspectRatio: ratio ?? 4 / 3,\n maxHeight: 420,\n marginVertical: 8,\n borderRadius: theme.radius.md,\n backgroundColor: theme.colors[\"surface-2\"],\n }}\n />\n );\n}\n\n/** Trim the trailing paragraph margin (web `last:mb-0`). */\nfunction TrimmedMarkdown({\n text,\n tone,\n streaming,\n onLinkPress,\n onCopy,\n media,\n}: {\n text: string;\n tone: \"body\" | \"muted\";\n streaming: boolean;\n onLinkPress?: ((url: string) => boolean) | undefined;\n onCopy?: ((text: string) => void) | undefined;\n media: MarkdownMediaOptions;\n}) {\n const theme = useNativeTimelineTheme();\n const styles = useMemo(() => webMarkdownStyles(theme, tone), [theme, tone]);\n const rules = useMemo(() => webRules(theme, tone, onCopy, media), [theme, tone, onCopy, media]);\n const openTail = useMemo(\n () => (media.renderInteractiveBlock ? trailingOpenFence(text) : null),\n [media.renderInteractiveBlock, text],\n );\n const fenceState = useMemo(() => ({ openTail, streaming }), [openTail, streaming]);\n return (\n <View style={{ marginBottom: -10 }}>\n <FenceStateContext.Provider value={fenceState}>\n <Markdown\n markdownit={PARSER}\n style={styles}\n rules={rules}\n {...(onLinkPress ? { onLinkPress } : {})}\n >\n {text}\n </Markdown>\n </FenceStateContext.Provider>\n </View>\n );\n}\n\nexport function createWebMarkdownRenderer(\n options: {\n onLinkPress?: (url: string) => boolean;\n onCopy?: (text: string) => void;\n /** Opengeni links (sandbox files, artifacts, Sites); never handed to the OS. */\n onOpenGeniLink?: (target: OpenGeniLinkTarget) => void;\n } & MarkdownMediaOptions = {},\n): NativeMarkdownRenderer {\n const onLinkPress = (url: string): boolean => {\n const target = parseOpenGeniLink(url);\n if (target || isReservedOpenGeniLink(url)) {\n if (target) options.onOpenGeniLink?.(target);\n return false;\n }\n return options.onLinkPress ? options.onLinkPress(url) : true;\n };\n // One stable object, so the memoized rules survive every streaming delta.\n const media: MarkdownMediaOptions = {\n renderImage: options.renderImage,\n renderInteractiveBlock: options.renderInteractiveBlock,\n };\n return (text, { tone, streaming }): ReactNode =>\n text.trim() ? (\n <TrimmedMarkdown\n text={text}\n tone={tone}\n streaming={streaming === true}\n onLinkPress={onLinkPress}\n onCopy={options.onCop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,IAAA,EAAA,EAAK,CAAA;AAEZ","file":"markdown.js","sourcesContent":["import {\n createContext,\n useContext,\n useMemo,\n useRef,\n useState,\n type ComponentRef,\n type ReactNode,\n} from \"react\";\nimport { Image, Pressable, ScrollView, Text, View, type TextStyle } from \"react-native\";\nimport Markdown, { MarkdownIt, renderRules, type RenderRules } from \"react-native-markdown-display\";\nimport Svg, { Defs, LinearGradient, Rect, Stop } from \"react-native-svg\";\nimport {\n isReservedOpenGeniLink,\n parseOpenGeniLink,\n parseRetainedFileReference,\n type OpenGeniLinkTarget,\n} from \"@opengeni/sdk\";\nimport {\n interactivePreviewKind,\n type InteractivePreviewKind,\n} from \"@opengeni/react/native-previews\";\nimport { Icon } from \"./icon\";\nimport { withAlpha as withAlphaColor } from \"./primitives\";\nimport type { NativeMarkdownRenderer } from \"./message-timeline\";\nimport {\n fontStyle,\n insetSurface,\n MONO_FALLBACK,\n useNativeTimelineTheme,\n type NativeTimelineTheme,\n} from \"./theme\";\nimport { useNativeTimelineMessages } from \"./messages\";\n\n/**\n * One parser for every message, configured like the web's `remark-gfm`: no typographic\n * substitution (quotes, dashes and `(c)` stay as written), and bare `http(s)://` URLs\n * autolink while file-like words (`fib.py`) do not. The library default would build a\n * new typographer parser on every render, including every streaming delta.\n */\nconst PARSER = (() => {\n const parser = MarkdownIt({ typographer: false, linkify: true });\n parser.linkify.set({ fuzzyLink: false, fuzzyEmail: false });\n return parser;\n})();\n\n/* ----------------------------------------------------------------------------\n Web Markdown (components/markdown.tsx) styles for react-native-markdown-display.\n Prose 15/28 (`text-og-md leading-7`), paragraphs `my-2.5`, lists `ml-5 gap-1`,\n code blocks `rounded-og-md bg-surface-1/70 px-3 py-2.5 text-og-sm leading-5`.\n -------------------------------------------------------------------------- */\n\nexport function webMarkdownStyles(\n theme: NativeTimelineTheme,\n tone: \"body\" | \"muted\",\n): Record<string, TextStyle> {\n const c = theme.colors;\n const muted = tone === \"muted\";\n const size = muted ? theme.size.base : theme.size.md;\n const line = muted ? 24 : 28;\n const body = {\n ...fontStyle(theme),\n color: muted ? c[\"fg-muted\"] : c.fg,\n fontSize: size,\n lineHeight: line,\n };\n const mono = fontStyle(theme, 400, \"mono\");\n const heading = { ...fontStyle(theme, 600), color: c.fg, letterSpacing: -0.2 };\n return {\n body,\n paragraph: { marginTop: 0, marginBottom: 10 },\n // Web margins collapse against the 10pt paragraph margin; native margins add up.\n heading1: { ...heading, fontSize: 20, lineHeight: 28, marginTop: 10, marginBottom: 10 },\n heading2: { ...heading, fontSize: 18, lineHeight: 26, marginTop: 10, marginBottom: 8 },\n heading3: {\n ...heading,\n fontSize: theme.size.md,\n lineHeight: 24,\n marginTop: 6,\n marginBottom: 6,\n },\n heading4: {\n ...heading,\n fontSize: theme.size.sm,\n lineHeight: 18,\n marginTop: 6,\n marginBottom: 6,\n textTransform: \"uppercase\" as const,\n },\n strong: { ...fontStyle(theme, 600), color: muted ? c[\"fg-muted\"] : c.fg },\n em: theme.fonts.sansItalic\n ? { fontFamily: theme.fonts.sansItalic }\n : { fontStyle: \"italic\" as const },\n bullet_list: { marginTop: 0, marginBottom: 10 },\n ordered_list: { marginTop: 0, marginBottom: 10 },\n list_item: { marginBottom: 4 },\n bullet_list_icon: { color: c[\"fg-subtle\"], marginLeft: 6, marginRight: 8, lineHeight: line },\n ordered_list_icon: { color: c[\"fg-subtle\"], marginLeft: 2, marginRight: 6, lineHeight: line },\n code_inline: {\n ...mono,\n fontFamily: (mono.fontFamily as string | undefined) ?? MONO_FALLBACK,\n fontSize: theme.size.sm,\n backgroundColor: c[\"surface-2\"],\n color: c.fg,\n borderRadius: theme.radius.xs,\n paddingHorizontal: 4,\n borderWidth: 0,\n },\n fence: {\n ...mono,\n fontSize: theme.size.sm,\n lineHeight: 20,\n color: c[\"fg-muted\"],\n backgroundColor: insetSurface(theme),\n borderWidth: 0,\n borderRadius: theme.radius.md,\n paddingHorizontal: 12,\n paddingVertical: 10,\n marginTop: 2,\n marginBottom: 10,\n },\n code_block: {\n ...mono,\n fontSize: theme.size.sm,\n lineHeight: 20,\n color: c[\"fg-muted\"],\n backgroundColor: insetSurface(theme),\n borderWidth: 0,\n borderRadius: theme.radius.md,\n paddingHorizontal: 12,\n paddingVertical: 10,\n },\n // Web MARKDOWN_LINK_CLASS: medium weight in accent-strong, no underline.\n link: {\n ...fontStyle(theme, 500),\n color: c[\"accent-strong\"],\n textDecorationLine: \"none\" as const,\n },\n blockquote: {\n // Web blockquote text is fg-muted; text styles inherit through the renderer.\n color: c[\"fg-muted\"],\n backgroundColor: \"transparent\",\n borderLeftColor: c[\"border-strong\"],\n borderLeftWidth: 2,\n paddingLeft: 14,\n marginLeft: 0,\n marginVertical: 12,\n },\n hr: { backgroundColor: c.border, height: 1, marginVertical: 16 },\n // Web tables: unboxed, text-og-base, hairline rules, content-sized columns.\n table: { borderWidth: 0, marginTop: 12, marginBottom: 10 },\n thead: {},\n th: {\n ...fontStyle(theme, 500),\n color: c.fg,\n fontSize: theme.size.base,\n lineHeight: 20,\n paddingVertical: 6,\n paddingRight: 16,\n },\n tr: { borderBottomWidth: 0 },\n td: {\n color: c[\"fg-muted\"],\n fontSize: theme.size.base,\n lineHeight: 20,\n paddingVertical: 6,\n paddingRight: 16,\n },\n };\n}\n\nfunction CodeFence({\n content,\n language,\n onCopy,\n}: {\n content: string;\n language: string;\n onCopy?: ((text: string) => void) | undefined;\n}) {\n const theme = useNativeTimelineTheme();\n const m = useNativeTimelineMessages();\n const styles = webMarkdownStyles(theme, \"body\");\n const [copied, setCopied] = useState(false);\n // The code scrolls in the space left of the language label and copy button, which\n // vary in width (\"SH\" vs \"TYPESCRIPT\"); reserve their measured width plus a gap.\n const [chromeWidth, setChromeWidth] = useState(64);\n return (\n <View style={{ marginTop: 2, marginBottom: 10 }}>\n <View\n style={{\n borderRadius: theme.radius.md,\n backgroundColor: insetSurface(theme),\n paddingLeft: 12,\n paddingRight: chromeWidth,\n paddingVertical: 10,\n }}\n >\n <ScrollView horizontal showsHorizontalScrollIndicator={false}>\n <Text\n selectable\n style={{\n ...styles.code_block,\n backgroundColor: \"transparent\",\n paddingHorizontal: 0,\n paddingVertical: 0,\n }}\n >\n {content}\n </Text>\n </ScrollView>\n </View>\n <View\n onLayout={(event) => {\n const next = Math.ceil(event.nativeEvent.layout.width) + 6 + 10;\n if (next !== chromeWidth) setChromeWidth(next);\n }}\n style={{\n position: \"absolute\",\n top: 6,\n right: 6,\n flexDirection: \"row\",\n alignItems: \"center\",\n gap: 4,\n }}\n >\n {language ? (\n <Text\n style={{\n ...fontStyle(theme, 400, \"mono\"),\n fontSize: 10,\n letterSpacing: 0.5,\n textTransform: \"uppercase\",\n color: theme.colors[\"fg-subtle\"],\n opacity: 0.7,\n }}\n >\n {language}\n </Text>\n ) : null}\n {onCopy ? (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={m.copyCode}\n hitSlop={8}\n onPress={() => {\n onCopy(content);\n setCopied(true);\n setTimeout(() => setCopied(false), 1400);\n }}\n style={{ width: 28, height: 28, alignItems: \"center\", justifyContent: \"center\" }}\n >\n <Icon name={copied ? \"check\" : \"copy\"} size={14} color={theme.colors[\"fg-subtle\"]} />\n </Pressable>\n ) : null}\n </View>\n </View>\n );\n}\n\n/* Tables ------------------------------------------------------------------- */\n\ntype AstNode = { type: string; content?: string; children?: AstNode[] };\n\nfunction astText(node: AstNode): string {\n // Container nodes carry an empty content string; text lives in their leaves.\n if (node.children && node.children.length > 0) return node.children.map(astText).join(\"\");\n return typeof node.content === \"string\" ? node.content : \"\";\n}\n\nfunction tableRows(table: AstNode): string[][] {\n const rows: string[][] = [];\n const visit = (node: AstNode) => {\n if (node.type === \"tr\") rows.push((node.children ?? []).map((cell) => astText(cell).trim()));\n else (node.children ?? []).forEach(visit);\n };\n visit(table);\n return rows;\n}\n\n/**\n * Content-sized columns, as a browser's auto table layout lays them out: short\n * columns keep their natural width on one line, long ones share the rest.\n */\nfunction tableColumns(rows: string[][]): { width?: number; grow: number }[] {\n const count = Math.max(0, ...rows.map((row) => row.length));\n return Array.from({ length: count }, (_, index) => {\n const longest = Math.max(1, ...rows.map((row) => row[index]?.length ?? 0));\n return longest <= 14 ? { width: Math.ceil(longest * 8.4) + 20, grow: 0 } : { grow: longest };\n });\n}\n\n/** A cell's column: its sibling index in the row (set by the AST builder). */\nfunction cellIndex(node: { index?: unknown }): number {\n return typeof node.index === \"number\" && node.index >= 0 ? node.index : 0;\n}\n\n/** Explicit column widths for a measured table; empty until the table lays out. */\nconst TableColumnsContext = createContext<number[]>([]);\n\nfunction columnWidths(columns: { width?: number; grow: number }[], available: number): number[] {\n const fixed = columns.reduce((sum, column) => sum + (column.width ?? 0), 0);\n const growth = columns.reduce(\n (sum, column) => sum + (column.width === undefined ? column.grow : 0),\n 0,\n );\n const rest = Math.max(0, available - fixed);\n if (growth === 0) return columns.map((column) => column.width ?? 0);\n // Long columns share the rest by length, each keeping a readable minimum.\n return columns.map((column) =>\n column.width !== undefined ? column.width : Math.max(64, (rest * column.grow) / growth),\n );\n}\n\n/** A column's comfortable width when the table is wider than the screen. */\nfunction naturalColumnWidth(column: { width?: number; grow: number }): number {\n return column.width ?? Math.min(280, Math.max(120, Math.ceil(column.grow * 7.6) + 20));\n}\n\nfunction MarkdownTable({\n node,\n children,\n onCopy,\n}: {\n node: AstNode;\n children: ReactNode;\n onCopy?: ((text: string) => void) | undefined;\n}) {\n const theme = useNativeTimelineTheme();\n const m = useNativeTimelineMessages();\n const rows = useMemo(() => tableRows(node), [node]);\n const columns = useMemo(() => tableColumns(rows), [rows]);\n const natural = useMemo(() => columns.map(naturalColumnWidth), [columns]);\n const naturalWidth = natural.reduce((sum, width) => sum + width, 0);\n const [available, setAvailable] = useState(0);\n // Web wraps tables in overflow-x-auto: a table that cannot fit keeps readable\n // columns and scrolls sideways instead of crushing every cell.\n const scrolls = available > 0 && naturalWidth > available;\n const widths = useMemo(\n () => (available > 0 ? (scrolls ? natural : columnWidths(columns, available)) : []),\n [available, columns, natural, scrolls],\n );\n const [copied, setCopied] = useState(false);\n // A soft edge says \"more columns this way\" until the reader reaches the end.\n const [atEnd, setAtEnd] = useState(false);\n const scroller = useRef<ComponentRef<typeof ScrollView>>(null);\n const body = (\n <TableColumnsContext.Provider value={widths}>{children}</TableColumnsContext.Provider>\n );\n return (\n <View\n style={{ marginTop: 12, marginBottom: 10 }}\n onLayout={(event) => setAvailable(Math.round(event.nativeEvent.layout.width))}\n >\n {scrolls ? (\n <View>\n <ScrollView\n ref={scroller}\n horizontal\n nestedScrollEnabled\n directionalLockEnabled\n showsHorizontalScrollIndicator\n scrollEventThrottle={32}\n onLayout={() => scroller.current?.flashScrollIndicators()}\n onScroll={(event) => {\n const { contentOffset, contentSize, layoutMeasurement } = event.nativeEvent;\n setAtEnd(contentOffset.x + layoutMeasurement.width >= contentSize.width - 8);\n }}\n accessibilityHint={m.scrollTableHint}\n >\n <View style={{ width: naturalWidth }}>{body}</View>\n </ScrollView>\n {atEnd ? null : (\n <Svg\n pointerEvents=\"none\"\n width={36}\n height=\"100%\"\n style={{ position: \"absolute\", top: 0, right: 0, bottom: 0 }}\n >\n <Defs>\n <LinearGradient id=\"table-edge\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"0\">\n <Stop offset=\"0\" stopColor={theme.colors.bg} stopOpacity={0} />\n <Stop offset=\"1\" stopColor={theme.colors.bg} stopOpacity={0.95} />\n </LinearGradient>\n </Defs>\n <Rect x=\"0\" y=\"0\" width=\"36\" height=\"100%\" fill=\"url(#table-edge)\" />\n </Svg>\n )}\n </View>\n ) : (\n body\n )}\n {onCopy ? (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={m.copyTable}\n hitSlop={8}\n onPress={() => {\n onCopy(rows.map((row) => row.join(\"\\t\")).join(\"\\n\"));\n setCopied(true);\n setTimeout(() => setCopied(false), 1400);\n }}\n style={{\n position: \"absolute\",\n top: 2,\n right: 0,\n width: 28,\n height: 28,\n alignItems: \"center\",\n justifyContent: \"center\",\n borderRadius: 8,\n backgroundColor: scrolls ? theme.colors.bg : \"transparent\",\n }}\n >\n <Icon name={copied ? \"check\" : \"copy\"} size={14} color={theme.colors[\"fg-subtle\"]} />\n </Pressable>\n ) : null}\n </View>\n );\n}\n\nfunction TableRow({ head, last, children }: { head: boolean; last: boolean; children: ReactNode }) {\n const theme = useNativeTimelineTheme();\n const c = theme.colors;\n return (\n <View\n style={{\n flexDirection: \"row\",\n borderBottomWidth: last ? 0 : 1,\n // Header rule in border; body rules at 70% (web border-og-border/70).\n borderBottomColor: head ? c.border : withAlphaColor(c.border, 0.7),\n }}\n >\n {children}\n </View>\n );\n}\n\nfunction TableCell({\n index,\n style,\n children,\n}: {\n index: number;\n style: object;\n children: ReactNode;\n}) {\n const width = useContext(TableColumnsContext)[index];\n return (\n <View\n style={[\n style,\n // The renderer's default cell style is flex: 1 (equal columns); a measured\n // table replaces it with content-sized widths.\n width !== undefined ? { flex: 0, width } : null,\n ]}\n >\n {children}\n </View>\n );\n}\n\nfunction webRules(\n theme: NativeTimelineTheme,\n tone: \"body\" | \"muted\",\n onCopy?: (text: string) => void,\n media: MarkdownMediaOptions = {},\n): RenderRules {\n const line = tone === \"muted\" ? 24 : 28;\n return {\n ...renderRules,\n // Every run of text is selectable, as on the web: a long press selects\n // words (and, inside a timeline message, offers Add note).\n textgroup: (node, children, _parent, styles) => (\n <Text key={node.key} selectable style={styles.textgroup}>\n {children}\n </Text>\n ),\n // Web lists use a disc marker in fg-subtle; the library's iOS default is a middle dot.\n list_item: (node, children, parent, styles, inheritedStyles = {}) => {\n if (parent.some((entry: { type: string }) => entry.type === \"bullet_list\")) {\n // A drawn disc: the text bullet glyph renders noticeably smaller than\n // the browser's list-disc marker at the same line height.\n const disc = 5.5;\n return (\n <View key={node.key} style={{ flexDirection: \"row\", marginBottom: 4 }}>\n <View\n accessible={false}\n style={{ width: 20, height: line, alignItems: \"center\", justifyContent: \"center\" }}\n >\n <View\n style={{\n width: disc,\n height: disc,\n borderRadius: disc / 2,\n backgroundColor: theme.colors[\"fg-subtle\"],\n }}\n />\n </View>\n <View style={{ flex: 1, minWidth: 0 }}>{children}</View>\n </View>\n );\n }\n return renderRules.list_item!(node, children, parent, styles, inheritedStyles);\n },\n table: (node, children) => (\n <MarkdownTable key={node.key} node={node} onCopy={onCopy}>\n {children}\n </MarkdownTable>\n ),\n tr: (node, children, parent) => {\n const head = parent.some((entry: { type: string }) => entry.type === \"thead\");\n const body = parent.find((entry: { type: string }) => entry.type === \"tbody\") as\n | { children?: unknown[] }\n | undefined;\n const last = !head && body?.children?.[body.children.length - 1] === node;\n return (\n <TableRow key={node.key} head={head} last={last}>\n {children}\n </TableRow>\n );\n },\n th: (node, children, _parent, styles) => (\n <TableCell key={node.key} index={cellIndex(node)} style={styles._VIEW_SAFE_th}>\n {children}\n </TableCell>\n ),\n td: (node, children, _parent, styles) => (\n <TableCell key={node.key} index={cellIndex(node)} style={styles._VIEW_SAFE_td}>\n {children}\n </TableCell>\n ),\n fence: (node) => {\n const raw = typeof node.content === \"string\" ? node.content : \"\";\n const content = raw.endsWith(\"\\n\") ? raw.slice(0, -1) : raw;\n const info = (node as { sourceInfo?: unknown }).sourceInfo;\n const language = typeof info === \"string\" ? (info.trim().split(/\\s+/)[0] ?? \"\") : \"\";\n const kind = interactivePreviewKind(language);\n if (kind && media.renderInteractiveBlock) {\n return (\n <InteractiveFence\n key={node.key}\n kind={kind}\n content={content}\n render={media.renderInteractiveBlock}\n />\n );\n }\n return <CodeFence key={node.key} content={content} language={language} onCopy={onCopy} />;\n },\n image: (node) => {\n const attributes = (node as { attributes?: { src?: unknown; alt?: unknown } }).attributes;\n const src = typeof attributes?.src === \"string\" ? attributes.src : \"\";\n const alt = typeof attributes?.alt === \"string\" ? attributes.alt : \"\";\n const custom = src ? media.renderImage?.({ src, alt }) : undefined;\n return custom !== undefined && custom !== null ? (\n <View key={node.key}>{custom}</View>\n ) : (\n <MarkdownImage key={node.key} src={src} alt={alt} />\n );\n },\n };\n}\n\n/** An assistant-authored interactive preview fence, as the host should draw it. */\nexport type NativeInteractiveBlock = {\n kind: InteractivePreviewKind;\n /** The fence body (complete only when `state` is \"complete\"). */\n content: string;\n /**\n * \"streaming\": still being written (show a loading surface, never the body);\n * \"incomplete\": generation stopped before the fence closed; \"complete\".\n */\n state: \"streaming\" | \"incomplete\" | \"complete\";\n};\n\nexport interface MarkdownMediaOptions {\n /**\n * Draw a Markdown image. Retained files arrive as `artifact:<id>` sources,\n * which only the host can resolve; return null to use the built-in image.\n */\n renderImage?: ((image: { src: string; alt: string }) => ReactNode) | undefined;\n /**\n * Draw `opengeni-html` / `opengeni-site` fences (web `renderInteractiveBlock`).\n * Without it they show as code, like the web without the host opt-in.\n */\n renderInteractiveBlock?: ((block: NativeInteractiveBlock) => ReactNode) | undefined;\n}\n\n/** Whether the message ends inside an unclosed fence, and that fence's body. */\nexport function trailingOpenFence(text: string): string | null {\n let open: { char: string; length: number; lines: string[] } | null = null;\n for (const line of text.split(\"\\n\")) {\n if (open) {\n const close = /^ {0,3}([`~]{3,})\\s*$/.exec(line);\n if (close && close[1]![0] === open.char && close[1]!.length >= open.length) open = null;\n else open.lines.push(line);\n continue;\n }\n const start = /^ {0,3}(`{3,}|~{3,})/.exec(line);\n if (start) open = { char: start[1]![0]!, length: start[1]!.length, lines: [] };\n }\n return open ? open.lines.join(\"\\n\") : null;\n}\n\nconst FenceStateContext = createContext<{ openTail: string | null; streaming: boolean }>({\n openTail: null,\n streaming: false,\n});\n\nfunction InteractiveFence({\n kind,\n content,\n render,\n}: {\n kind: InteractivePreviewKind;\n content: string;\n render: (block: NativeInteractiveBlock) => ReactNode;\n}) {\n const { openTail, streaming } = useContext(FenceStateContext);\n const open = openTail !== null && openTail.trimEnd() === content.trimEnd();\n const state = !open ? \"complete\" : streaming ? \"streaming\" : \"incomplete\";\n return <>{render({ kind, content: state === \"complete\" ? content : \"\", state })}</>;\n}\n\n/** Plain image URLs load directly; retained files need the host's `renderImage`. */\nfunction MarkdownImage({ src, alt }: { src: string; alt: string }) {\n const theme = useNativeTimelineTheme();\n const m = useNativeTimelineMessages();\n const [ratio, setRatio] = useState<number | null>(null);\n const [failed, setFailed] = useState(false);\n const remote = /^https?:\\/\\//i.test(src) && !parseRetainedFileReference(src);\n if (!remote || failed) {\n return (\n <Text\n style={{ ...fontStyle(theme), color: theme.colors[\"fg-muted\"], fontSize: theme.size.sm }}\n >\n {m.previewUnavailable(alt || m.image)}\n </Text>\n );\n }\n return (\n <Image\n accessibilityLabel={alt || m.image}\n source={{ uri: src }}\n resizeMode=\"contain\"\n onLoad={(event) => {\n const { width, height } = event.nativeEvent.source;\n if (width > 0 && height > 0) setRatio(width / height);\n }}\n onError={() => setFailed(true)}\n style={{\n width: \"100%\",\n aspectRatio: ratio ?? 4 / 3,\n maxHeight: 420,\n marginVertical: 8,\n borderRadius: theme.radius.md,\n backgroundColor: theme.colors[\"surface-2\"],\n }}\n />\n );\n}\n\n/** Trim the trailing paragraph margin (web `last:mb-0`). */\nfunction TrimmedMarkdown({\n text,\n tone,\n streaming,\n onLinkPress,\n onCopy,\n media,\n}: {\n text: string;\n tone: \"body\" | \"muted\";\n streaming: boolean;\n onLinkPress?: ((url: string) => boolean) | undefined;\n onCopy?: ((text: string) => void) | undefined;\n media: MarkdownMediaOptions;\n}) {\n const theme = useNativeTimelineTheme();\n const styles = useMemo(() => webMarkdownStyles(theme, tone), [theme, tone]);\n const rules = useMemo(() => webRules(theme, tone, onCopy, media), [theme, tone, onCopy, media]);\n const openTail = useMemo(\n () => (media.renderInteractiveBlock ? trailingOpenFence(text) : null),\n [media.renderInteractiveBlock, text],\n );\n const fenceState = useMemo(() => ({ openTail, streaming }), [openTail, streaming]);\n return (\n <View style={{ marginBottom: -10 }}>\n <FenceStateContext.Provider value={fenceState}>\n <Markdown\n markdownit={PARSER}\n style={styles}\n rules={rules}\n {...(onLinkPress ? { onLinkPress } : {})}\n >\n {text}\n </Markdown>\n </FenceStateContext.Provider>\n </View>\n );\n}\n\nexport function createWebMarkdownRenderer(\n options: {\n onLinkPress?: (url: string) => boolean;\n onCopy?: (text: string) => void;\n /** Opengeni links (sandbox files, artifacts, Sites); never handed to the OS. */\n onOpenGeniLink?: (target: OpenGeniLinkTarget) => void;\n } & MarkdownMediaOptions = {},\n): NativeMarkdownRenderer {\n const onLinkPress = (url: string): boolean => {\n const target = parseOpenGeniLink(url);\n if (target || isReservedOpenGeniLink(url)) {\n if (target) options.onOpenGeniLink?.(target);\n return false;\n }\n return options.onLinkPress ? options.onLinkPress(url) : true;\n };\n // One stable object, so the memoized rules survive every streaming delta.\n const media: MarkdownMediaOptions = {\n renderImage: options.renderImage,\n renderInteractiveBlock: options.renderInteractiveBlock,\n };\n return (text, { tone, streaming }): ReactNode =>\n text.trim() ? (\n <TrimmedMarkdown\n text={text}\n tone={tone}\n streaming={streaming === true}\n onLinkPress={onLinkPress}\n onCopy={options.onCopy}\n media={media}\n />\n ) : (\n <Text />\n );\n}\n"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { SessionEvent, SessionStatus } from "@opengeni/sdk";
|
|
1
|
+
import type { DraftTimelineAnnotation, SessionEvent, SessionStatus } from "@opengeni/sdk";
|
|
2
2
|
import { type AgentMessageItem, type TimelineItem, type UserMessageItem } from "@opengeni/react/session";
|
|
3
3
|
import { type TurnSummaryFacetConfiguration } from "@opengeni/react/timeline-model";
|
|
4
|
-
import { type ReactNode } from "react";
|
|
4
|
+
import { type MutableRefObject, type ReactNode } from "react";
|
|
5
5
|
import { type StyleProp, type ViewStyle } from "react-native";
|
|
6
6
|
import { type NativeActivityOptions } from "./activity.js";
|
|
7
7
|
import { type PreparingProps } from "./turn.js";
|
|
8
|
+
import { type AnnotationReveal } from "./annotations.js";
|
|
8
9
|
export type NativeMarkdownRenderer = (text: string, options: {
|
|
9
10
|
tone: "body" | "muted";
|
|
10
11
|
streaming?: boolean | undefined;
|
|
@@ -45,6 +46,23 @@ export interface NativeMessageTimelineProps extends NativeActivityOptions {
|
|
|
45
46
|
contentInsetBottom?: number | undefined;
|
|
46
47
|
/** Height of host chrome floating over the timeline's bottom edge (a floating composer). */
|
|
47
48
|
overlayInsetBottom?: number | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Changes whenever the reader sends: the timeline resumes following the
|
|
51
|
+
* latest row, so a message sent while reading (or annotating) older
|
|
52
|
+
* history comes into view.
|
|
53
|
+
*/
|
|
54
|
+
followLatestSignal?: number | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Add note on selected message text (iOS): receives the quote as a draft
|
|
57
|
+
* annotation, as the web timeline's selection popover does.
|
|
58
|
+
*/
|
|
59
|
+
onAnnotate?: ((annotation: DraftTimelineAnnotation) => void) | undefined;
|
|
60
|
+
/** The draft's annotations, marked on the messages they quote. */
|
|
61
|
+
draftAnnotations?: readonly DraftTimelineAnnotation[] | undefined;
|
|
62
|
+
/** A draft marker was tapped: review that annotation. */
|
|
63
|
+
onDraftAnnotationSelect?: ((id: string) => void) | undefined;
|
|
64
|
+
/** Receives a function that scrolls a quoted message into view and highlights it. */
|
|
65
|
+
annotationRevealRef?: MutableRefObject<AnnotationReveal | null> | undefined;
|
|
48
66
|
style?: StyleProp<ViewStyle>;
|
|
49
67
|
}
|
|
50
68
|
export declare function MessageTimeline(props: NativeMessageTimelineProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NativeImageViewer } from '../chunk-
|
|
1
|
+
import { NativeImageViewer } from '../chunk-ZZNZBZWV.js';
|
|
2
2
|
import { useOpenNativeLink } from '../chunk-2WJTBHO6.js';
|
|
3
3
|
import '../chunk-7ZDF5VGA.js';
|
|
4
|
-
import { useNativeTimelineTheme, Icon, fontStyle } from '../chunk-
|
|
4
|
+
import { useNativeTimelineTheme, Icon, fontStyle } from '../chunk-FHPMRXIG.js';
|
|
5
5
|
import { previewLoadingDocument, inlineHtmlDocument, parseSiteFence, loadSiteSnapshot } from '@opengeni/react/native-previews';
|
|
6
6
|
import { parseRetainedFileReference } from '@opengeni/sdk';
|
|
7
7
|
import { useOpenGeniText } from '@opengeni/react/messages';
|
|
@@ -2,6 +2,7 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
import { type TextStyle } from "react-native";
|
|
3
3
|
import { type NativeIconName } from "./icon.js";
|
|
4
4
|
import { type NativeTimelineTheme } from "./theme.js";
|
|
5
|
+
import type { ToolOutputPreview } from "@opengeni/react/session";
|
|
5
6
|
export declare const ReleaseFollowProvider: import("react").Provider<() => void>;
|
|
6
7
|
export declare function useReleaseFollow(): () => void;
|
|
7
8
|
export type DisclosureChip = {
|
|
@@ -51,10 +52,15 @@ export interface ActivityDisclosureProps {
|
|
|
51
52
|
/** Compact reel rendering for the rolling status (no chevron, no body). */
|
|
52
53
|
compact?: boolean | undefined;
|
|
53
54
|
accessibilityLabel?: string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Set while a tool row's output is a bounded preview: opening the row reads
|
|
57
|
+
* the exact output, and the body waits for it (or says it is a preview).
|
|
58
|
+
*/
|
|
59
|
+
outputPreview?: ToolOutputPreview | null | undefined;
|
|
54
60
|
children?: ReactNode | undefined;
|
|
55
61
|
}
|
|
56
62
|
/** The one row shape every activity uses, matching the web ActivityDisclosure. */
|
|
57
|
-
export declare function ActivityDisclosure({ icon, iconTone: iconToneProp, title, titleMono, running, preview, media, chip: chipProp, failed, cancelled, expandable, defaultOpen, compact, accessibilityLabel, children, }: ActivityDisclosureProps): import("react").JSX.Element;
|
|
63
|
+
export declare function ActivityDisclosure({ icon, iconTone: iconToneProp, title, titleMono, running, preview, media, chip: chipProp, failed, cancelled, expandable, defaultOpen, compact, accessibilityLabel, outputPreview, children, }: ActivityDisclosureProps): import("react").JSX.Element;
|
|
58
64
|
/** A running preview: the pulse locus immediately left of the status words. */
|
|
59
65
|
export declare function RunningPreview({ text, compact }: {
|
|
60
66
|
text: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ComposerDraft } from "@opengeni/sdk";
|
|
2
2
|
import type { useTurnQueue } from "@opengeni/react/session";
|
|
3
3
|
import { type ReactNode } from "react";
|
|
4
|
+
import type { NativeAnnotationLike } from "./annotations.js";
|
|
4
5
|
type TurnQueue = ReturnType<typeof useTurnQueue>;
|
|
5
6
|
/** The composer surface the dock checks prompts out into. */
|
|
6
7
|
export interface QueueDockComposer {
|
|
@@ -9,10 +10,12 @@ export interface QueueDockComposer {
|
|
|
9
10
|
applyDraft: (draft: ComposerDraft) => void;
|
|
10
11
|
draftPersistence?: "durable" | "disabled" | undefined;
|
|
11
12
|
}
|
|
12
|
-
export declare function QueueDock({ queue, composer, onComposerFocus, leading, singleSend, }: {
|
|
13
|
+
export declare function QueueDock({ queue, composer, onComposerFocus, onReviewAnnotations, leading, singleSend, }: {
|
|
13
14
|
queue: TurnQueue;
|
|
14
15
|
composer?: QueueDockComposer | undefined;
|
|
15
16
|
onComposerFocus?: (() => void) | undefined;
|
|
17
|
+
/** Show a waiting message's quotes and notes. */
|
|
18
|
+
onReviewAnnotations?: ((annotations: readonly NativeAnnotationLike[]) => void) | undefined;
|
|
16
19
|
/** Chips sharing the queue chip's row (goal, agents, commands). */
|
|
17
20
|
leading?: ReactNode;
|
|
18
21
|
/** One Send and nothing to choose: no Steer on waiting messages. */
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { DraftTimelineAnnotation } from "@opengeni/sdk";
|
|
2
|
+
import type { TimelineAnnotationSourceDescriptor } from "@opengeni/react/session";
|
|
3
|
+
/**
|
|
4
|
+
* Text selection inside timeline messages. A message body sits in a view with
|
|
5
|
+
* this test id prefix plus its annotation source key (empty when it cannot be
|
|
6
|
+
* annotated). On iOS the package's native module then gives its text the
|
|
7
|
+
* system selection (handles, Copy, Look Up, Share) instead of React Native's
|
|
8
|
+
* whole-paragraph Copy; on both platforms it adds Add note to the selection
|
|
9
|
+
* menu when a host takes annotations.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ANNOTATION_SOURCE_TEST_ID_PREFIX = "og-annotation-source:";
|
|
12
|
+
export declare function annotationSourceTestId(sourceKey: string | undefined): string;
|
|
13
|
+
export type QuoteBox = {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Where a quote is drawn in its source view: the end of its last glyph, the
|
|
21
|
+
* top of that line's text, and a text box for each line it spans.
|
|
22
|
+
*/
|
|
23
|
+
export type QuoteAnchor = {
|
|
24
|
+
x: number;
|
|
25
|
+
top: number;
|
|
26
|
+
boxes: QuoteBox[];
|
|
27
|
+
};
|
|
28
|
+
export type QuoteAnchorQuery = {
|
|
29
|
+
quote: string;
|
|
30
|
+
before: string;
|
|
31
|
+
after: string;
|
|
32
|
+
};
|
|
33
|
+
/** Whether this build can turn a text selection into an annotation. */
|
|
34
|
+
export declare function nativeTextAnnotationAvailable(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Measures where each quote ends inside the source drawn for `sourceKey`;
|
|
37
|
+
* null for a quote that is not drawn there (or without native measuring).
|
|
38
|
+
*/
|
|
39
|
+
export declare function measureQuoteAnchors(sourceKey: string, queries: QuoteAnchorQuery[]): Promise<(QuoteAnchor | null)[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Turns Add note on a selection into a draft annotation for `onAnnotate`.
|
|
42
|
+
* `sources` maps each message's annotation source key to its source.
|
|
43
|
+
*/
|
|
44
|
+
export declare function useNativeTextAnnotation(sources: ReadonlyMap<string, TimelineAnnotationSourceDescriptor>, onAnnotate: ((annotation: DraftTimelineAnnotation) => void) | undefined): void;
|
package/expo-module.config.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"platforms": ["apple"],
|
|
2
|
+
"platforms": ["apple", "android"],
|
|
3
3
|
"apple": {
|
|
4
|
-
"modules": ["OpenGeniCallModule", "OpenGeniPasteModule"],
|
|
4
|
+
"modules": ["OpenGeniCallModule", "OpenGeniPasteModule", "OpenGeniTextSelectionModule"],
|
|
5
5
|
"appDelegateSubscribers": ["OpenGeniCallAppDelegateSubscriber"]
|
|
6
|
+
},
|
|
7
|
+
"android": {
|
|
8
|
+
"modules": ["dev.opengeni.textselection.OpenGeniTextSelectionModule"]
|
|
6
9
|
}
|
|
7
10
|
}
|