@agimon-ai/po-native-components 0.0.0-alpha.21 → 0.0.0-alpha.211
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/LICENSE +21 -149
- package/README.md +9 -51
- package/dist/components/AgentAvatar.d.mts +19 -0
- package/dist/components/AgentAvatar.d.mts.map +1 -0
- package/dist/components/AgentAvatar.mjs +88 -0
- package/dist/components/AgentAvatar.mjs.map +1 -0
- package/dist/components/AnnotationSurface.d.mts +69 -0
- package/dist/components/AnnotationSurface.d.mts.map +1 -0
- package/dist/components/AnnotationSurface.mjs +431 -0
- package/dist/components/AnnotationSurface.mjs.map +1 -0
- package/dist/components/Badge.d.mts +1 -1
- package/dist/components/Badge.mjs +1 -1
- package/dist/components/Button.mjs +3 -3
- package/dist/components/Button.mjs.map +1 -1
- package/dist/components/CodeBlock.d.mts +3 -1
- package/dist/components/CodeBlock.d.mts.map +1 -1
- package/dist/components/CodeBlock.mjs +42 -47
- package/dist/components/CodeBlock.mjs.map +1 -1
- package/dist/components/ComputerRow.d.mts +15 -0
- package/dist/components/ComputerRow.d.mts.map +1 -0
- package/dist/components/ComputerRow.mjs +107 -0
- package/dist/components/ComputerRow.mjs.map +1 -0
- package/dist/components/CopyButton.d.mts +13 -0
- package/dist/components/CopyButton.d.mts.map +1 -0
- package/dist/components/CopyButton.mjs +49 -0
- package/dist/components/CopyButton.mjs.map +1 -0
- package/dist/components/CountBadge.d.mts +15 -0
- package/dist/components/CountBadge.d.mts.map +1 -0
- package/dist/components/CountBadge.mjs +49 -0
- package/dist/components/CountBadge.mjs.map +1 -0
- package/dist/components/CtaCard.d.mts +19 -0
- package/dist/components/CtaCard.d.mts.map +1 -0
- package/dist/components/CtaCard.mjs +92 -0
- package/dist/components/CtaCard.mjs.map +1 -0
- package/dist/components/Dialog.d.mts +2 -2
- package/dist/components/Dialog.d.mts.map +1 -1
- package/dist/components/Dialog.mjs +16 -10
- package/dist/components/Dialog.mjs.map +1 -1
- package/dist/components/Dot.d.mts +1 -1
- package/dist/components/Dot.mjs +2 -2
- package/dist/components/DropdownMenu.d.mts +3 -1
- package/dist/components/DropdownMenu.d.mts.map +1 -1
- package/dist/components/DropdownMenu.mjs +21 -14
- package/dist/components/DropdownMenu.mjs.map +1 -1
- package/dist/components/EmptyState.d.mts +31 -3
- package/dist/components/EmptyState.d.mts.map +1 -1
- package/dist/components/EmptyState.mjs +303 -29
- package/dist/components/EmptyState.mjs.map +1 -1
- package/dist/components/FileList.d.mts +48 -0
- package/dist/components/FileList.d.mts.map +1 -0
- package/dist/components/FileList.mjs +737 -0
- package/dist/components/FileList.mjs.map +1 -0
- package/dist/components/FilePreview.d.mts +33 -0
- package/dist/components/FilePreview.d.mts.map +1 -0
- package/dist/components/FilePreview.mjs +102 -0
- package/dist/components/FilePreview.mjs.map +1 -0
- package/dist/components/FileViewer.d.mts +57 -0
- package/dist/components/FileViewer.d.mts.map +1 -0
- package/dist/components/FileViewer.mjs +345 -0
- package/dist/components/FileViewer.mjs.map +1 -0
- package/dist/components/HashlineLines.d.mts +13 -0
- package/dist/components/HashlineLines.d.mts.map +1 -0
- package/dist/components/HashlineLines.mjs +153 -0
- package/dist/components/HashlineLines.mjs.map +1 -0
- package/dist/components/HostFilter.d.mts +17 -0
- package/dist/components/HostFilter.d.mts.map +1 -0
- package/dist/components/HostFilter.mjs +68 -0
- package/dist/components/HostFilter.mjs.map +1 -0
- package/dist/components/HostTag.d.mts +7 -0
- package/dist/components/HostTag.d.mts.map +1 -0
- package/dist/components/HostTag.mjs +48 -0
- package/dist/components/HostTag.mjs.map +1 -0
- package/dist/components/InfoStrip.d.mts +9 -0
- package/dist/components/InfoStrip.d.mts.map +1 -0
- package/dist/components/InfoStrip.mjs +53 -0
- package/dist/components/InfoStrip.mjs.map +1 -0
- package/dist/components/Input.d.mts +3 -1
- package/dist/components/Input.d.mts.map +1 -1
- package/dist/components/Input.mjs +4 -3
- package/dist/components/Input.mjs.map +1 -1
- package/dist/components/Label.mjs +1 -1
- package/dist/components/LinkText.d.mts +13 -0
- package/dist/components/LinkText.d.mts.map +1 -0
- package/dist/components/LinkText.mjs +32 -0
- package/dist/components/LinkText.mjs.map +1 -0
- package/dist/components/List.d.mts.map +1 -1
- package/dist/components/List.mjs +50 -11
- package/dist/components/List.mjs.map +1 -1
- package/dist/components/LiveDuration.d.mts +30 -0
- package/dist/components/LiveDuration.d.mts.map +1 -0
- package/dist/components/LiveDuration.mjs +67 -0
- package/dist/components/LiveDuration.mjs.map +1 -0
- package/dist/components/LoadingState.d.mts +17 -0
- package/dist/components/LoadingState.d.mts.map +1 -0
- package/dist/components/LoadingState.mjs +90 -0
- package/dist/components/LoadingState.mjs.map +1 -0
- package/dist/components/Markdown.d.mts +24 -2
- package/dist/components/Markdown.d.mts.map +1 -1
- package/dist/components/Markdown.mjs +356 -27
- package/dist/components/Markdown.mjs.map +1 -1
- package/dist/components/MessageItem.d.mts +10 -15
- package/dist/components/MessageItem.d.mts.map +1 -1
- package/dist/components/MessageItem.mjs +94 -68
- package/dist/components/MessageItem.mjs.map +1 -1
- package/dist/components/NativeShellState.d.mts +30 -0
- package/dist/components/NativeShellState.d.mts.map +1 -0
- package/dist/components/NativeShellState.mjs +61 -0
- package/dist/components/NativeShellState.mjs.map +1 -0
- package/dist/components/RailItem.d.mts +13 -0
- package/dist/components/RailItem.d.mts.map +1 -0
- package/dist/components/RailItem.mjs +61 -0
- package/dist/components/RailItem.mjs.map +1 -0
- package/dist/components/ReferenceChip.d.mts +18 -0
- package/dist/components/ReferenceChip.d.mts.map +1 -0
- package/dist/components/ReferenceChip.mjs +38 -0
- package/dist/components/ReferenceChip.mjs.map +1 -0
- package/dist/components/SectionLabel.mjs +1 -1
- package/dist/components/SeekBar.d.mts +17 -0
- package/dist/components/SeekBar.d.mts.map +1 -0
- package/dist/components/SeekBar.mjs +97 -0
- package/dist/components/SeekBar.mjs.map +1 -0
- package/dist/components/Select.d.mts +39 -0
- package/dist/components/Select.d.mts.map +1 -0
- package/dist/components/Select.mjs +288 -0
- package/dist/components/Select.mjs.map +1 -0
- package/dist/components/Sheet.d.mts +17 -2
- package/dist/components/Sheet.d.mts.map +1 -1
- package/dist/components/Sheet.mjs +34 -11
- package/dist/components/Sheet.mjs.map +1 -1
- package/dist/components/SheetFrame.mjs +149 -28
- package/dist/components/SheetFrame.mjs.map +1 -1
- package/dist/components/SheetList.d.mts +14 -0
- package/dist/components/SheetList.d.mts.map +1 -0
- package/dist/components/SheetList.mjs +34 -0
- package/dist/components/SheetList.mjs.map +1 -0
- package/dist/components/ShowMore.d.mts +10 -0
- package/dist/components/ShowMore.d.mts.map +1 -0
- package/dist/components/ShowMore.mjs +44 -0
- package/dist/components/ShowMore.mjs.map +1 -0
- package/dist/components/Spinner.d.mts +1 -1
- package/dist/components/StatusBadge.d.mts +1 -1
- package/dist/components/Switch.d.mts +14 -0
- package/dist/components/Switch.d.mts.map +1 -0
- package/dist/components/Switch.mjs +37 -0
- package/dist/components/Switch.mjs.map +1 -0
- package/dist/components/SyntaxLine.d.mts +19 -0
- package/dist/components/SyntaxLine.d.mts.map +1 -0
- package/dist/components/SyntaxLine.mjs +134 -0
- package/dist/components/SyntaxLine.mjs.map +1 -0
- package/dist/components/Tabs.d.mts.map +1 -1
- package/dist/components/Tabs.mjs +8 -7
- package/dist/components/Tabs.mjs.map +1 -1
- package/dist/components/ToolPathLink.d.mts +10 -0
- package/dist/components/ToolPathLink.d.mts.map +1 -0
- package/dist/components/ToolPathLink.mjs +42 -0
- package/dist/components/ToolPathLink.mjs.map +1 -0
- package/dist/components/ToolResultImage.d.mts +21 -0
- package/dist/components/ToolResultImage.d.mts.map +1 -0
- package/dist/components/ToolResultImage.mjs +60 -0
- package/dist/components/ToolResultImage.mjs.map +1 -0
- package/dist/icons/IconColorContext.d.mts +2 -1
- package/dist/icons/IconColorContext.d.mts.map +1 -1
- package/dist/icons/IconColorContext.mjs.map +1 -1
- package/dist/icons/iconGlyphs.d.mts +132 -0
- package/dist/icons/iconGlyphs.d.mts.map +1 -1
- package/dist/icons/iconGlyphs.mjs +132 -0
- package/dist/icons/iconGlyphs.mjs.map +1 -1
- package/dist/icons/icons.d.mts +133 -1
- package/dist/icons/icons.d.mts.map +1 -1
- package/dist/icons/icons.mjs +35 -2
- package/dist/icons/icons.mjs.map +1 -1
- package/dist/index.d.mts +31 -7
- package/dist/index.mjs +36 -12
- package/dist/lib/fileKindLabel.mjs +17 -0
- package/dist/lib/fileKindLabel.mjs.map +1 -0
- package/dist/lib/fonts.d.mts +3 -1
- package/dist/lib/fonts.d.mts.map +1 -1
- package/dist/lib/fonts.mjs +4 -2
- package/dist/lib/fonts.mjs.map +1 -1
- package/dist/lib/insideSheet.d.mts +10 -0
- package/dist/lib/insideSheet.d.mts.map +1 -0
- package/dist/lib/markdown.mjs +310 -23
- package/dist/lib/markdown.mjs.map +1 -1
- package/dist/lib/reading.mjs +60 -0
- package/dist/lib/reading.mjs.map +1 -0
- package/dist/lib/useControllable.mjs +14 -6
- package/dist/lib/useControllable.mjs.map +1 -1
- package/dist/lib/useReadingPage.mjs +33 -0
- package/dist/lib/useReadingPage.mjs.map +1 -0
- package/dist/po-runtime-identity.json +1 -0
- package/dist/shell.d.mts +6 -0
- package/dist/shell.mjs +7 -0
- package/locales/vi.json +112 -0
- package/locales/zh-CN.json +112 -0
- package/package.json +43 -30
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.mjs","names":[],"sources":["../../src/lib/markdown.ts"],"sourcesContent":["/*\n * A small Markdown parser for native message text: the subset an assistant\n * reply uses, parsed to plain data so the renderer and the tests share one\n * shape. Kept free of React Native so a unit test can run it in Node.\n *\n * Blocks: ATX headings, paragraphs, bullet and numbered lists, fenced code\n * (an unclosed fence runs to the end, so a streaming reply shows its code\n * before the closing fence arrives) and thematic breaks.\n * Inline: code spans, bold, italic, links and backslash escapes.\n *\n * ponytail: no tables, images, blockquotes, nested lists or setext headings\n * yet; their source falls through as paragraph text, so nothing is lost.\n */\n\nexport type MarkdownInline =\n | { type: 'text'; text: string }\n | { type: 'code'; text: string }\n | { type: 'strong'; children: MarkdownInline[] }\n | { type: 'em'; children: MarkdownInline[] }\n | { type: 'link'; href: string; children: MarkdownInline[] };\n\nexport type MarkdownHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\nexport type MarkdownBlock =\n | { type: 'heading'; level: MarkdownHeadingLevel; children: MarkdownInline[] }\n | { type: 'paragraph'; children: MarkdownInline[] }\n | { type: 'list'; ordered: boolean; start: number; items: MarkdownInline[][] }\n | { type: 'code'; language: string | undefined; text: string }\n | { type: 'rule' };\n\nconst FENCE_OPEN = /^ {0,3}(`{3,}|~{3,})[ \\t]*([^\\s`]*)/;\nconst HEADING = /^ {0,3}(#{1,6})(?:[ \\t]+(.*?))?(?:[ \\t]+#+)?[ \\t]*$/;\nconst RULE = /^ {0,3}([-*_])(?:[ \\t]*\\1){2,}[ \\t]*$/;\nconst BULLET_ITEM = /^ {0,3}[-*+][ \\t]+(.*)$/;\nconst ORDERED_ITEM = /^ {0,3}(\\d{1,9})[.)][ \\t]+(.*)$/;\nconst INDENTED = /^[ \\t]+\\S/;\nconst ESCAPABLE = /[!-/:-@[-`{-~]/;\nconst WORD_CHAR = /[\\p{L}\\p{N}]/u;\n\nfunction isBlank(line: string): boolean {\n return line.trim() === '';\n}\n\n/** Parses a Markdown document into blocks. */\nexport function parseMarkdown(source: string): MarkdownBlock[] {\n const lines = source.replace(/\\r\\n?/g, '\\n').split('\\n');\n const blocks: MarkdownBlock[] = [];\n let paragraph: string[] = [];\n let list: { ordered: boolean; start: number; items: string[] } | undefined;\n\n const flushParagraph = () => {\n if (paragraph.length > 0) blocks.push({ type: 'paragraph', children: parseInline(paragraph.join('\\n')) });\n paragraph = [];\n };\n const flushList = () => {\n if (list !== undefined)\n blocks.push({ type: 'list', ordered: list.ordered, start: list.start, items: list.items.map(parseInline) });\n list = undefined;\n };\n const flush = () => {\n flushParagraph();\n flushList();\n };\n\n for (let index = 0; index < lines.length; index += 1) {\n const line = lines[index]!;\n\n const fence = FENCE_OPEN.exec(line);\n if (fence !== null) {\n flush();\n const marker = fence[1]!;\n const close = new RegExp(`^ {0,3}${marker[0] === '`' ? '`' : '~'}{${marker.length},}[ \\\\t]*$`);\n const body: string[] = [];\n index += 1;\n while (index < lines.length && !close.test(lines[index]!)) {\n body.push(lines[index]!);\n index += 1;\n }\n const language = fence[2] === undefined || fence[2] === '' ? undefined : fence[2];\n blocks.push({ type: 'code', language, text: body.join('\\n') });\n continue;\n }\n\n if (isBlank(line)) {\n flush();\n continue;\n }\n\n const heading = HEADING.exec(line);\n if (heading !== null) {\n flush();\n const level = heading[1]!.length as MarkdownHeadingLevel;\n blocks.push({ type: 'heading', level, children: parseInline(heading[2] ?? '') });\n continue;\n }\n\n if (RULE.test(line)) {\n flush();\n blocks.push({ type: 'rule' });\n continue;\n }\n\n const bullet = BULLET_ITEM.exec(line);\n const ordered = bullet === null ? ORDERED_ITEM.exec(line) : null;\n if (bullet !== null || ordered !== null) {\n flushParagraph();\n const isOrdered = ordered !== null;\n if (list === undefined || list.ordered !== isOrdered) {\n flushList();\n list = { ordered: isOrdered, start: isOrdered ? Number(ordered[1]) : 1, items: [] };\n }\n list.items.push(isOrdered ? ordered[2]! : bullet![1]!);\n continue;\n }\n\n if (list !== undefined && INDENTED.test(line)) {\n const last = list.items.length - 1;\n list.items[last] = `${list.items[last]!}\\n${line.trim()}`;\n continue;\n }\n\n flushList();\n paragraph.push(line);\n }\n flush();\n return blocks;\n}\n\n/** Parses one run of inline Markdown. */\nexport function parseInline(source: string): MarkdownInline[] {\n const nodes: MarkdownInline[] = [];\n let text = '';\n const pushText = (value: string) => {\n text += value;\n };\n const pushNode = (node: MarkdownInline) => {\n if (text !== '') nodes.push({ type: 'text', text });\n text = '';\n nodes.push(node);\n };\n\n let index = 0;\n while (index < source.length) {\n const char = source[index]!;\n\n if (char === '\\\\' && index + 1 < source.length && ESCAPABLE.test(source[index + 1]!)) {\n pushText(source[index + 1]!);\n index += 2;\n continue;\n }\n\n if (char === '`') {\n const span = readCodeSpan(source, index);\n if (span !== undefined) {\n pushNode({ type: 'code', text: span.text });\n index = span.end;\n continue;\n }\n const run = /^`+/.exec(source.slice(index))![0];\n pushText(run);\n index += run.length;\n continue;\n }\n\n if (char === '[') {\n const link = readLink(source, index);\n if (link !== undefined) {\n pushNode({ type: 'link', href: link.href, children: parseInline(link.label) });\n index = link.end;\n continue;\n }\n }\n\n if ((char === '*' || char === '_') && source[index + 1] === char) {\n const strong = readDelimited(source, index, char.repeat(2));\n if (strong !== undefined) {\n pushNode({ type: 'strong', children: parseInline(strong.inner) });\n index = strong.end;\n continue;\n }\n pushText(char.repeat(2));\n index += 2;\n continue;\n }\n\n if (char === '*' || char === '_') {\n const em = readDelimited(source, index, char);\n if (em !== undefined) {\n pushNode({ type: 'em', children: parseInline(em.inner) });\n index = em.end;\n continue;\n }\n }\n\n pushText(char);\n index += 1;\n }\n if (text !== '') nodes.push({ type: 'text', text });\n return nodes;\n}\n\n/** A code span opened by the backtick run at `start`, closed by a run of the same length. */\nfunction readCodeSpan(source: string, start: number): { text: string; end: number } | undefined {\n const run = /^`+/.exec(source.slice(start))![0];\n let search = start + run.length;\n while (search < source.length) {\n const found = source.indexOf(run, search);\n if (found === -1) return undefined;\n const after = found + run.length;\n // A longer run is not the closer; skip past all of it.\n if (source[after] === '`' || source[found - 1] === '`') {\n search = after;\n while (source[search] === '`') search += 1;\n continue;\n }\n let text = source.slice(start + run.length, found).replace(/\\n/g, ' ');\n if (text.length > 2 && text.startsWith(' ') && text.endsWith(' ') && text.trim() !== '') text = text.slice(1, -1);\n return { text, end: after };\n }\n return undefined;\n}\n\n/** `[label](href)` starting at the bracket; brackets in the label may nest. */\nfunction readLink(source: string, start: number): { label: string; href: string; end: number } | undefined {\n let depth = 0;\n let close = -1;\n for (let index = start; index < source.length; index += 1) {\n const char = source[index];\n if (char === '\\\\') {\n index += 1;\n continue;\n }\n if (char === '[') depth += 1;\n if (char === ']') {\n depth -= 1;\n if (depth === 0) {\n close = index;\n break;\n }\n }\n }\n if (close === -1 || source[close + 1] !== '(') return undefined;\n const target = /^\\(\\s*<?([^\\s()<>]*)>?(?:\\s+\"[^\"]*\")?\\s*\\)/.exec(source.slice(close + 1));\n if (target === null) return undefined;\n return { label: source.slice(start + 1, close), href: target[1]!, end: close + 1 + target[0].length };\n}\n\n/**\n * Emphasis opened by `delimiter` at `start`: the inner text may not begin or\n * end with a space, and an underscore only counts at a word boundary, so\n * `snake_case_name` stays text.\n */\nfunction readDelimited(source: string, start: number, delimiter: string): { inner: string; end: number } | undefined {\n const underscore = delimiter[0] === '_';\n if (underscore && start > 0 && WORD_CHAR.test(source[start - 1]!)) return undefined;\n const open = start + delimiter.length;\n if (open >= source.length || /\\s/.test(source[open]!)) return undefined;\n let search = open;\n while (search < source.length) {\n const found = source.indexOf(delimiter, search);\n if (found === -1) return undefined;\n const end = found + delimiter.length;\n const single = delimiter.length === 1;\n // A single delimiter skips over a double one (`*a **b** c*`), which belongs to nested bold.\n if (single && source[end] === delimiter) {\n search = end + 1;\n continue;\n }\n const inner = source.slice(open, found);\n const boundaryOk = !underscore || end >= source.length || !WORD_CHAR.test(source[end]!);\n if (inner !== '' && !/\\s/.test(inner[inner.length - 1]!) && boundaryOk) return { inner, end };\n search = found + 1;\n }\n return undefined;\n}\n"],"mappings":";AA8BA,MAAM,aAAa;AACnB,MAAM,UAAU;AAChB,MAAM,OAAO;AACb,MAAM,cAAc;AACpB,MAAM,eAAe;AACrB,MAAM,WAAW;AACjB,MAAM,YAAY;AAClB,MAAM,YAAY;AAElB,SAAS,QAAQ,MAAuB;CACtC,OAAO,KAAK,KAAK,MAAM;AACzB;;AAGA,SAAgB,cAAc,QAAiC;CAC7D,MAAM,QAAQ,OAAO,QAAQ,UAAU,IAAI,CAAC,CAAC,MAAM,IAAI;CACvD,MAAM,SAA0B,CAAC;CACjC,IAAI,YAAsB,CAAC;CAC3B,IAAI;CAEJ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AO,QAAQ,UAAU;CAC/B,IAAI,QAAQ,OAAO,UAAU,KAAK,KAAK,OAAO,KAAM,GAAG,OAAO;CAC9D,IAAI,SAAS;CACb,OAAO,SAAS,OAAO,QAAQ;EAC7B,MAAM,QAAQ,OAAO,QAAQ,WAAW,MAAM;EAC9C,IAAI,UAAU,IAAI,OAAO;EACzB,MAAM,MAAM,QAAQ,UAAU;EAG9B,IAFe,UAAU,WAAW,KAEtB,OAAO,SAAS,WAAW;GACvC,SAAS,MAAM;GACf;EACF;EACA,MAAM,QAAQ,OAAO,MAAM,MAAM,KAAK;EACtC,MAAM,aAAa,CAAC,cAAc,OAAO,OAAO,UAAU,CAAC,UAAU,KAAK,OAAO,IAAK;EACtF,IAAI,UAAU,MAAM,CAAC,KAAK,KAAK,MAAM,MAAM,SAAS,EAAG,KAAK,YAAY,OAAO;GAAE;GAAO;EAAI;EAC5F,SAAS,QAAQ;CACnB;AAEF"}
|
|
1
|
+
{"version":3,"file":"markdown.mjs","names":[],"sources":["../../src/lib/markdown.ts"],"sourcesContent":["/*\n * A small Markdown parser for native message text: the subset an assistant\n * reply uses, parsed to plain data so the renderer and the tests share one\n * shape. Kept free of React Native so a unit test can run it in Node.\n *\n * Blocks: ATX headings, paragraphs, bullet and numbered lists, fenced code\n * (an unclosed fence runs to the end, so a streaming reply shows its code\n * before the closing fence arrives), thematic breaks, blockquotes and GFM\n * tables. HTML blocks are dropped, as the web renderer drops raw HTML.\n * Inline: code spans, bold, italic, links, images, `@scheme:value` references\n * (as links to `po-reference:<value>`, like the web's), bare and `<...>`\n * http(s) links (as GFM autolinks them) and backslash escapes.\n * A line break inside a paragraph is a space unless the line ends in two\n * spaces or a backslash, as CommonMark reads it.\n *\n * ponytail: no nested lists, setext headings or lazy quote continuation yet;\n * their source falls through as paragraph text, so nothing is lost.\n */\n\nexport type MarkdownInline =\n | { type: 'text'; text: string }\n | { type: 'code'; text: string; originalText?: string }\n | { type: 'strong'; children: MarkdownInline[] }\n | { type: 'em'; children: MarkdownInline[] }\n | { type: 'link'; href: string; children: MarkdownInline[] }\n | { type: 'image'; src: string; alt: string };\n\nexport type MarkdownHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\nexport type MarkdownBlock =\n | { type: 'heading'; level: MarkdownHeadingLevel; children: MarkdownInline[] }\n | { type: 'paragraph'; children: MarkdownInline[] }\n | { type: 'list'; ordered: boolean; start: number; items: MarkdownInline[][] }\n | { type: 'code'; language: string | undefined; text: string }\n | { type: 'rule' }\n | { type: 'quote'; children: MarkdownBlock[] }\n | { type: 'table'; header: MarkdownInline[][]; rows: MarkdownInline[][][] };\n\nconst FENCE_OPEN = /^ {0,3}(`{3,}|~{3,})[ \\t]*([^\\s`]*)/;\nconst HEADING = /^ {0,3}(#{1,6})(?:[ \\t]+(.*?))?(?:[ \\t]+#+)?[ \\t]*$/;\nconst RULE = /^ {0,3}([-*_])(?:[ \\t]*\\1){2,}[ \\t]*$/;\nconst BULLET_ITEM = /^ {0,3}[-*+][ \\t]+(.*)$/;\nconst ORDERED_ITEM = /^ {0,3}(\\d{1,9})[.)][ \\t]+(.*)$/;\nconst INDENTED = /^[ \\t]+\\S/;\nconst QUOTE = /^ {0,3}> ?(.*)$/;\nconst TABLE_DIVIDER = /^ {0,3}\\|?[ \\t]*:?-+:?[ \\t]*(?:\\|[ \\t]*:?-+:?[ \\t]*)*\\|?[ \\t]*$/;\nconst HTML_COMMENT = /^ {0,3}<!--/;\n/** CommonMark's block-level tag names, plus the picture and image markup READMEs open with. */\nconst HTML_BLOCK =\n /^ {0,3}<\\/?(?:address|article|aside|blockquote|center|details|div|dl|figcaption|figure|footer|form|h[1-6]|header|hr|li|main|nav|ol|p|picture|section|summary|table|tbody|td|tfoot|th|thead|tr|ul)(?=[\\s/>]|$)/i;\n/** Any other tag standing alone on its line, such as `<img ...>` or `<br>`. */\nconst HTML_TAG_LINE = /^ {0,3}<\\/?[A-Za-z][A-Za-z0-9-]*(?:\\s[^<>]*)?\\/?>[ \\t]*$/;\nconst HARD_BREAK = /(?: {2,}|\\\\)$/;\nconst ESCAPABLE = /[!-/:-@[-`{-~]/;\nconst WORD_CHAR = /[\\p{L}\\p{N}]/u;\n/** `@session:git` and the like, read where an `@` starts the text or follows whitespace. */\nconst REFERENCE_AT = /@([a-z][a-z0-9+.-]*:[^\\s@]+)/iuy;\nconst TRAILING_PUNCTUATION = /[.,;:!?)\\]]+$/u;\nconst BARE_URL = /https?:\\/\\/[^\\s<>]+/iuy;\nconst URL_TRAILING = /[.,;:!?'\"*_~]$/u;\n/** The href a reference link carries; the renderer recognises it by this prefix. */\nexport const REFERENCE_HREF_PREFIX = 'po-reference:';\n\n/** An http(s) address with a host and no credentials, normalised; anything else is undefined. */\nexport function webHref(raw: string): string | undefined {\n if (!/^https?:\\/\\//iu.test(raw)) return undefined;\n try {\n const url = new URL(raw);\n if ((url.protocol !== 'http:' && url.protocol !== 'https:') || !url.host || url.username || url.password)\n return undefined;\n return url.href;\n } catch {\n return undefined;\n }\n}\n\nfunction count(text: string, char: string): number {\n return text.split(char).length - 1;\n}\n\n/**\n * A bare http(s) URL starting at `start`, without the trailing punctuation that ends a sentence.\n * A closing bracket stays only while it balances one inside the URL, so `wiki/A_(b)` keeps it.\n */\nfunction readBareUrl(source: string, start: number): { text: string; href: string; end: number } | undefined {\n BARE_URL.lastIndex = start;\n let text = BARE_URL.exec(source)?.[0];\n if (text === undefined) return undefined;\n for (;;) {\n if (URL_TRAILING.test(text)) text = text.slice(0, -1);\n else if (text.endsWith(')') && count(text, ')') > count(text, '(')) text = text.slice(0, -1);\n else if (text.endsWith(']') && count(text, ']') > count(text, '[')) text = text.slice(0, -1);\n else break;\n }\n const href = webHref(text);\n return href === undefined ? undefined : { text, href, end: start + text.length };\n}\n\n/** Where a bare URL may begin: the start, or after anything but a letter or digit. */\nfunction urlStarts(source: string, index: number): boolean {\n const char = source[index];\n return (char === 'h' || char === 'H') && (index === 0 || !WORD_CHAR.test(source[index - 1]!));\n}\n\n/** The `@scheme:value` reference an `@` at `index` starts, without the punctuation a sentence hangs on it. */\nfunction referenceAt(source: string, index: number): string | undefined {\n if (source[index] !== '@' || (index > 0 && !/\\s/u.test(source[index - 1]!))) return undefined;\n REFERENCE_AT.lastIndex = index;\n const reference = REFERENCE_AT.exec(source)?.[1]?.replace(TRAILING_PUNCTUATION, '');\n return reference === undefined || reference === '' || reference.endsWith(':') ? undefined : reference;\n}\n\n/** The reference a code span is, when the span is exactly one reference as prose would read it. */\nexport function exactReference(text: string): string | undefined {\n const reference = referenceAt(text, 0);\n return reference !== undefined && reference.length + 1 === text.length ? reference : undefined;\n}\n\n/**\n * Plain text cut into runs, bare http(s) links and `@scheme:value` references (`scheme:value`, as\n * Markdown hands them to its host), for text that is not Markdown.\n */\nexport function splitWebLinks(text: string): Array<{ text: string; href?: string; reference?: string }> {\n if (text.length > MAX_PARSE_CHARACTERS) return [{ text }];\n const parts: Array<{ text: string; href?: string; reference?: string }> = [];\n let from = 0;\n for (let index = 0; index < text.length; index += 1) {\n const reference = referenceAt(text, index);\n if (reference !== undefined) {\n if (index > from) parts.push({ text: text.slice(from, index) });\n parts.push({ text: `@${reference}`, reference });\n from = index + 1 + reference.length;\n index = from - 1;\n continue;\n }\n if (!urlStarts(text, index)) continue;\n const url = readBareUrl(text, index);\n if (url === undefined) continue;\n if (index > from) parts.push({ text: text.slice(from, index) });\n parts.push({ text: url.text, href: url.href });\n from = url.end;\n index = url.end - 1;\n }\n if (from < text.length) parts.push({ text: text.slice(from) });\n return parts;\n}\n\n// ponytail: expensive documents stay literal. A linear parser can lift these ceilings later.\nconst MAX_PARSE_CHARACTERS = 100_000;\nconst MAX_PARSE_WORK = 250_000;\nconst MAX_PARSE_DEPTH = 32;\nconst PARSE_LIMIT = new Error('Markdown parsing limit reached.');\ntype ParseBudget = { remaining: number };\n\nfunction spend(budget: ParseBudget, work: number): void {\n budget.remaining -= work;\n if (budget.remaining < 0) throw PARSE_LIMIT;\n}\n\nfunction isBlank(line: string): boolean {\n return line.trim() === '';\n}\n\n/** Joins a paragraph's lines: a space between them, or a line break after two spaces or a backslash. */\nfunction joinLines(lines: readonly string[]): string {\n return lines\n .map((line, index) => {\n const current = index === 0 ? line : line.trimStart();\n if (index === lines.length - 1) return current;\n return `${current.replace(/(?: {2,}|\\\\|[ \\t]+)$/u, '')}${HARD_BREAK.test(current) ? '\\n' : ' '}`;\n })\n .join('');\n}\n\n/** A table row's cells: outer pipes dropped, split on unescaped pipes, `\\|` read as a pipe. */\nfunction tableCells(line: string): string[] {\n let row = line.trim();\n if (row.startsWith('|')) row = row.slice(1);\n if (row.endsWith('|') && !row.endsWith('\\\\|')) row = row.slice(0, -1);\n const cells: string[] = [];\n let cell = '';\n for (let index = 0; index < row.length; index += 1) {\n const char = row[index]!;\n if (char === '\\\\' && row[index + 1] === '|') {\n cell += '|';\n index += 1;\n } else if (char === '|') {\n cells.push(cell.trim());\n cell = '';\n } else cell += char;\n }\n cells.push(cell.trim());\n return cells;\n}\n\n/** Parses a Markdown document into blocks. */\nexport function parseMarkdown(source: string): MarkdownBlock[] {\n if (source.length <= MAX_PARSE_CHARACTERS) {\n try {\n return parseBlocks(source, { remaining: MAX_PARSE_WORK }, 0);\n } catch (error) {\n if (error !== PARSE_LIMIT) throw error;\n }\n }\n return [{ type: 'paragraph', children: [{ type: 'text', text: source }] }];\n}\n\nfunction parseBlocks(source: string, budget: ParseBudget, depth: number): MarkdownBlock[] {\n if (depth > MAX_PARSE_DEPTH) throw PARSE_LIMIT;\n spend(budget, source.length + 1);\n const inline = (text: string) => parseInlineNodes(text, budget, depth + 1);\n const lines = source.replace(/\\r\\n?/g, '\\n').split('\\n');\n const blocks: MarkdownBlock[] = [];\n let paragraph: string[] = [];\n let list: { ordered: boolean; start: number; items: string[][] } | undefined;\n\n const flushParagraph = () => {\n if (paragraph.length > 0) blocks.push({ type: 'paragraph', children: inline(joinLines(paragraph)) });\n paragraph = [];\n };\n const flushList = () => {\n if (list !== undefined)\n blocks.push({\n type: 'list',\n ordered: list.ordered,\n start: list.start,\n items: list.items.map((item) => inline(joinLines(item))),\n });\n list = undefined;\n };\n const flush = () => {\n flushParagraph();\n flushList();\n };\n\n for (let index = 0; index < lines.length; index += 1) {\n const line = lines[index]!;\n\n const fence = FENCE_OPEN.exec(line);\n if (fence !== null) {\n flush();\n const marker = fence[1]!;\n const close = new RegExp(`^ {0,3}${marker[0] === '`' ? '`' : '~'}{${marker.length},}[ \\\\t]*$`);\n const body: string[] = [];\n index += 1;\n while (index < lines.length && !close.test(lines[index]!)) {\n body.push(lines[index]!);\n index += 1;\n }\n const language = fence[2] === undefined || fence[2] === '' ? undefined : fence[2];\n blocks.push({ type: 'code', language, text: body.join('\\n') });\n continue;\n }\n\n if (isBlank(line)) {\n flush();\n continue;\n }\n\n // Raw HTML is left out, as on the web; a paragraph keeps any tag that appears inside it.\n if (paragraph.length === 0 && HTML_COMMENT.test(line)) {\n flush();\n while (index < lines.length && !lines[index]!.includes('-->')) index += 1;\n continue;\n }\n if (paragraph.length === 0 && (HTML_BLOCK.test(line) || HTML_TAG_LINE.test(line))) {\n flush();\n while (index + 1 < lines.length && !isBlank(lines[index + 1]!)) index += 1;\n continue;\n }\n const heading = HEADING.exec(line);\n if (heading !== null) {\n flush();\n const level = heading[1]!.length as MarkdownHeadingLevel;\n blocks.push({ type: 'heading', level, children: inline(heading[2] ?? '') });\n continue;\n }\n\n if (RULE.test(line)) {\n flush();\n blocks.push({ type: 'rule' });\n continue;\n }\n\n if (QUOTE.test(line)) {\n flush();\n const quoted: string[] = [];\n while (index < lines.length && QUOTE.test(lines[index]!)) {\n quoted.push(QUOTE.exec(lines[index]!)![1]!);\n index += 1;\n }\n index -= 1;\n blocks.push({ type: 'quote', children: parseBlocks(quoted.join('\\n'), budget, depth + 1) });\n continue;\n }\n\n const divider = lines[index + 1];\n if (line.includes('|') && divider !== undefined && divider.includes('|') && TABLE_DIVIDER.test(divider)) {\n const header = tableCells(line);\n if (header.length === tableCells(divider).length) {\n flush();\n index += 2;\n const rows: MarkdownInline[][][] = [];\n while (index < lines.length && !isBlank(lines[index]!) && lines[index]!.includes('|')) {\n const cells = tableCells(lines[index]!);\n rows.push(header.map((_, column) => inline(cells[column] ?? '')));\n index += 1;\n }\n index -= 1;\n blocks.push({ type: 'table', header: header.map((cell) => inline(cell)), rows });\n continue;\n }\n }\n const bullet = BULLET_ITEM.exec(line);\n const ordered = bullet === null ? ORDERED_ITEM.exec(line) : null;\n if (bullet !== null || ordered !== null) {\n flushParagraph();\n const isOrdered = ordered !== null;\n if (list === undefined || list.ordered !== isOrdered) {\n flushList();\n list = { ordered: isOrdered, start: isOrdered ? Number(ordered[1]) : 1, items: [] };\n }\n list.items.push([isOrdered ? ordered[2]! : bullet![1]!]);\n continue;\n }\n\n if (list !== undefined && INDENTED.test(line)) {\n list.items.at(-1)!.push(line.trim());\n continue;\n }\n\n flushList();\n paragraph.push(line);\n }\n flush();\n return blocks;\n}\n\n/** Parses one run of inline Markdown. */\nexport function parseInline(source: string): MarkdownInline[] {\n if (source.length <= MAX_PARSE_CHARACTERS) {\n try {\n return parseInlineNodes(source, { remaining: MAX_PARSE_WORK }, 0);\n } catch (error) {\n if (error !== PARSE_LIMIT) throw error;\n }\n }\n return [{ type: 'text', text: source }];\n}\n\n/** `autolink` is off inside a link's label, so a URL there never nests a link in a link. */\nfunction parseInlineNodes(source: string, budget: ParseBudget, depth: number, autolink = true): MarkdownInline[] {\n if (depth > MAX_PARSE_DEPTH) throw PARSE_LIMIT;\n spend(budget, source.length + 1);\n const nodes: MarkdownInline[] = [];\n let text = '';\n const pushText = (value: string) => {\n text += value;\n };\n const pushNode = (node: MarkdownInline) => {\n if (text !== '') nodes.push({ type: 'text', text });\n text = '';\n nodes.push(node);\n };\n\n let index = 0;\n while (index < source.length) {\n spend(budget, 1);\n const char = source[index]!;\n\n if (char === '\\\\' && index + 1 < source.length && ESCAPABLE.test(source[index + 1]!)) {\n pushText(source[index + 1]!);\n index += 2;\n continue;\n }\n\n if (char === '`') {\n const span = readCodeSpan(source, index, budget);\n if (span !== undefined) {\n pushNode({ type: 'code', text: span.text });\n index = span.end;\n continue;\n }\n const run = /^`+/.exec(source.slice(index))![0];\n pushText(run);\n index += run.length;\n continue;\n }\n\n if (char === '!' && source[index + 1] === '[') {\n const image = readLink(source, index + 1, budget);\n if (image !== undefined) {\n pushNode({ type: 'image', src: image.href, alt: image.label });\n index = image.end;\n continue;\n }\n }\n\n if (char === '[') {\n const link = readLink(source, index, budget);\n if (link !== undefined) {\n pushNode({ type: 'link', href: link.href, children: parseInlineNodes(link.label, budget, depth + 1, false) });\n index = link.end;\n continue;\n }\n }\n\n if ((char === '*' || char === '_') && source[index + 1] === char) {\n const strong = readDelimited(source, index, char.repeat(2), budget);\n if (strong !== undefined) {\n pushNode({ type: 'strong', children: parseInlineNodes(strong.inner, budget, depth + 1, autolink) });\n index = strong.end;\n continue;\n }\n pushText(char.repeat(2));\n index += 2;\n continue;\n }\n\n if (char === '*' || char === '_') {\n const em = readDelimited(source, index, char, budget);\n if (em !== undefined) {\n pushNode({ type: 'em', children: parseInlineNodes(em.inner, budget, depth + 1, autolink) });\n index = em.end;\n continue;\n }\n }\n\n if (autolink && char === '<') {\n const url = readBareUrl(source, index + 1);\n if (url !== undefined && source[url.end] === '>') {\n spend(budget, url.text.length);\n pushNode({ type: 'link', href: url.href, children: [{ type: 'text', text: url.text }] });\n index = url.end + 1;\n continue;\n }\n }\n\n if (autolink && urlStarts(source, index)) {\n const url = readBareUrl(source, index);\n if (url !== undefined) {\n spend(budget, url.text.length);\n pushNode({ type: 'link', href: url.href, children: [{ type: 'text', text: url.text }] });\n index = url.end;\n continue;\n }\n }\n const reference = referenceAt(source, index);\n if (reference !== undefined) {\n spend(budget, reference.length);\n pushNode({\n type: 'link',\n href: REFERENCE_HREF_PREFIX + encodeURIComponent(reference),\n children: [{ type: 'text', text: `@${reference}` }],\n });\n index += 1 + reference.length;\n continue;\n }\n\n pushText(char);\n index += 1;\n }\n if (text !== '') nodes.push({ type: 'text', text });\n return nodes;\n}\n\n/** A code span opened by the backtick run at `start`, closed by a run of the same length. */\nfunction readCodeSpan(source: string, start: number, budget: ParseBudget): { text: string; end: number } | undefined {\n const run = /^`+/.exec(source.slice(start))![0];\n let search = start + run.length;\n while (search < source.length) {\n const found = source.indexOf(run, search);\n spend(budget, (found === -1 ? source.length : found + run.length) - search);\n if (found === -1) return undefined;\n const after = found + run.length;\n // A longer run is not the closer; skip past all of it.\n if (source[after] === '`' || source[found - 1] === '`') {\n search = after;\n while (source[search] === '`') search += 1;\n continue;\n }\n let text = source.slice(start + run.length, found).replace(/\\n/g, ' ');\n if (text.length > 2 && text.startsWith(' ') && text.endsWith(' ') && text.trim() !== '') text = text.slice(1, -1);\n return { text, end: after };\n }\n return undefined;\n}\n\n/** `[label](href)` starting at the bracket; brackets in the label may nest. */\nfunction readLink(\n source: string,\n start: number,\n budget: ParseBudget,\n): { label: string; href: string; end: number } | undefined {\n let depth = 0;\n let close = -1;\n for (let index = start; index < source.length; index += 1) {\n spend(budget, 1);\n const char = source[index];\n if (char === '\\\\') {\n index += 1;\n continue;\n }\n if (char === '[') depth += 1;\n if (char === ']') {\n depth -= 1;\n if (depth === 0) {\n close = index;\n break;\n }\n }\n }\n if (close === -1 || source[close + 1] !== '(') return undefined;\n let index = close + 2;\n const skipSpace = () => {\n while (index < source.length && /\\s/.test(source[index]!)) {\n spend(budget, 1);\n index += 1;\n }\n };\n skipSpace();\n if (source[index] === '<') index += 1;\n const hrefStart = index;\n while (index < source.length && !/[\\s()<>]/.test(source[index]!)) {\n spend(budget, 1);\n index += 1;\n }\n const href = source.slice(hrefStart, index);\n if (source[index] === '>') index += 1;\n const beforeSpace = index;\n skipSpace();\n if (index > beforeSpace && source[index] === '\"') {\n index += 1;\n while (index < source.length && source[index] !== '\"') {\n spend(budget, 1);\n index += 1;\n }\n if (source[index] !== '\"') return undefined;\n index += 1;\n skipSpace();\n }\n if (source[index] !== ')') return undefined;\n return { label: source.slice(start + 1, close), href, end: index + 1 };\n}\n\n/**\n * Emphasis opened by `delimiter` at `start`: the inner text may not begin or\n * end with a space, and an underscore only counts at a word boundary, so\n * `snake_case_name` stays text.\n */\nfunction readDelimited(\n source: string,\n start: number,\n delimiter: string,\n budget: ParseBudget,\n): { inner: string; end: number } | undefined {\n const underscore = delimiter[0] === '_';\n if (underscore && start > 0 && WORD_CHAR.test(source[start - 1]!)) return undefined;\n const open = start + delimiter.length;\n if (open >= source.length || /\\s/.test(source[open]!)) return undefined;\n let search = open;\n while (search < source.length) {\n const found = source.indexOf(delimiter, search);\n spend(budget, (found === -1 ? source.length : found + delimiter.length) - search);\n if (found === -1) return undefined;\n const end = found + delimiter.length;\n const single = delimiter.length === 1;\n // A single delimiter skips over a double one (`*a **b** c*`), which belongs to nested bold.\n if (single && source[end] === delimiter) {\n search = end + 1;\n continue;\n }\n const inner = source.slice(open, found);\n const boundaryOk = !underscore || end >= source.length || !WORD_CHAR.test(source[end]!);\n if (inner !== '' && !/\\s/.test(inner[inner.length - 1]!) && boundaryOk) return { inner, end };\n search = found + 1;\n }\n return undefined;\n}\n"],"mappings":";AAsCA,MAAM,aAAa;AACnB,MAAM,UAAU;AAChB,MAAM,OAAO;AACb,MAAM,cAAc;AACpB,MAAM,eAAe;AACrB,MAAM,WAAW;AACjB,MAAM,QAAQ;AACd,MAAM,gBAAgB;AACtB,MAAM,eAAe;;AAErB,MAAM,aACJ;;AAEF,MAAM,gBAAgB;AACtB,MAAM,aAAa;AACnB,MAAM,YAAY;AAClB,MAAM,YAAY;;AAElB,MAAM,eAAe;AACrB,MAAM,uBAAuB;AAC7B,MAAM,WAAW;AACjB,MAAM,eAAe;;AAErB,MAAa,wBAAwB;;AAGrC,SAAgB,QAAQ,KAAiC;CACvD,IAAI,CAAC,iBAAiB,KAAK,GAAG,GAAG,OAAO;CACxC,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,GAAG;EACvB,IAAK,IAAI,aAAa,WAAW,IAAI,aAAa,YAAa,CAAC,I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AU,UAAU,MAAM;EAChF,IAAI,UAAU,IAAI,OAAO;EACzB,MAAM,MAAM,QAAQ,UAAU;EAG9B,IAFe,UAAU,WAAW,KAEtB,OAAO,SAAS,WAAW;GACvC,SAAS,MAAM;GACf;EACF;EACA,MAAM,QAAQ,OAAO,MAAM,MAAM,KAAK;EACtC,MAAM,aAAa,CAAC,cAAc,OAAO,OAAO,UAAU,CAAC,UAAU,KAAK,OAAO,IAAK;EACtF,IAAI,UAAU,MAAM,CAAC,KAAK,KAAK,MAAM,MAAM,SAAS,EAAG,KAAK,YAAY,OAAO;GAAE;GAAO;EAAI;EAC5F,SAAS,QAAQ;CACnB;AAEF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//#region src/lib/reading.ts
|
|
2
|
+
const READING = {
|
|
3
|
+
parts: 3,
|
|
4
|
+
characters: 640,
|
|
5
|
+
lines: 12,
|
|
6
|
+
rows: 10,
|
|
7
|
+
columns: 4,
|
|
8
|
+
cell: 160,
|
|
9
|
+
hashlines: 12
|
|
10
|
+
};
|
|
11
|
+
/** UTF-16 budgets never leave a dangling high surrogate. */
|
|
12
|
+
function readingPrefix(text, limit) {
|
|
13
|
+
let end = Math.min(text.length, limit);
|
|
14
|
+
const last = text.charCodeAt(end - 1);
|
|
15
|
+
if (end < text.length && last >= 55296 && last <= 56319) end -= 1;
|
|
16
|
+
return text.slice(0, end);
|
|
17
|
+
}
|
|
18
|
+
/** Slice presentation nodes, never Markdown source or link/image destinations. */
|
|
19
|
+
function inlinePrefix(nodes, limit) {
|
|
20
|
+
let remaining = limit;
|
|
21
|
+
const visit = (items) => {
|
|
22
|
+
const result = [];
|
|
23
|
+
for (const node of items) {
|
|
24
|
+
if (remaining <= 0) break;
|
|
25
|
+
if ("children" in node) result.push({
|
|
26
|
+
...node,
|
|
27
|
+
children: visit(node.children)
|
|
28
|
+
});
|
|
29
|
+
else if (node.type === "image") {
|
|
30
|
+
result.push(node);
|
|
31
|
+
remaining -= 1;
|
|
32
|
+
} else {
|
|
33
|
+
const text = readingPrefix(node.text, remaining);
|
|
34
|
+
result.push(node.type === "code" && text !== node.text ? {
|
|
35
|
+
...node,
|
|
36
|
+
text,
|
|
37
|
+
originalText: node.originalText ?? node.text
|
|
38
|
+
} : {
|
|
39
|
+
...node,
|
|
40
|
+
text
|
|
41
|
+
});
|
|
42
|
+
remaining -= node.text.length;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
return visit(nodes);
|
|
48
|
+
}
|
|
49
|
+
function inlineLength(nodes) {
|
|
50
|
+
return nodes.reduce((sum, node) => sum + ("children" in node ? inlineLength(node.children) : node.type === "image" ? 1 : node.text.length), 0);
|
|
51
|
+
}
|
|
52
|
+
function codePrefix(text, page) {
|
|
53
|
+
const prefix = readingPrefix(text, READING.characters * page);
|
|
54
|
+
const lines = prefix.split("\n");
|
|
55
|
+
return lines.length <= READING.lines * page ? prefix : lines.slice(0, READING.lines * page).join("\n");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
export { READING, codePrefix, inlineLength, inlinePrefix, readingPrefix };
|
|
60
|
+
//# sourceMappingURL=reading.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reading.mjs","names":[],"sources":["../../src/lib/reading.ts"],"sourcesContent":["import type { MarkdownInline } from './markdown';\n\nexport const READING = {\n parts: 3,\n characters: 640,\n lines: 12,\n rows: 10,\n columns: 4,\n cell: 160,\n hashlines: 12,\n} as const;\n\n/** UTF-16 budgets never leave a dangling high surrogate. */\nexport function readingPrefix(text: string, limit: number): string {\n let end = Math.min(text.length, limit);\n const last = text.charCodeAt(end - 1);\n if (end < text.length && last >= 0xd800 && last <= 0xdbff) end -= 1;\n return text.slice(0, end);\n}\n\n/** Slice presentation nodes, never Markdown source or link/image destinations. */\nexport function inlinePrefix(nodes: readonly MarkdownInline[], limit: number): MarkdownInline[] {\n let remaining = limit;\n const visit = (items: readonly MarkdownInline[]): MarkdownInline[] => {\n const result: MarkdownInline[] = [];\n for (const node of items) {\n if (remaining <= 0) break;\n if ('children' in node) {\n result.push({ ...node, children: visit(node.children) });\n } else if (node.type === 'image') {\n result.push(node);\n remaining -= 1;\n } else {\n const text = readingPrefix(node.text, remaining);\n result.push(\n node.type === 'code' && text !== node.text\n ? { ...node, text, originalText: node.originalText ?? node.text }\n : { ...node, text },\n );\n remaining -= node.text.length;\n }\n }\n return result;\n };\n return visit(nodes);\n}\n\nexport function inlineLength(nodes: readonly MarkdownInline[]): number {\n return nodes.reduce(\n (sum, node) =>\n sum + ('children' in node ? inlineLength(node.children) : node.type === 'image' ? 1 : node.text.length),\n 0,\n );\n}\n\nexport function codePrefix(text: string, page: number): string {\n const prefix = readingPrefix(text, READING.characters * page);\n const lines = prefix.split('\\n');\n return lines.length <= READING.lines * page ? prefix : lines.slice(0, READING.lines * page).join('\\n');\n}\n"],"mappings":";AAEA,MAAa,UAAU;CACrB,OAAO;CACP,YAAY;CACZ,OAAO;CACP,MAAM;CACN,SAAS;CACT,MAAM;CACN,WAAW;AACb;;AAGA,SAAgB,cAAc,MAAc,OAAuB;CACjE,IAAI,MAAM,KAAK,IAAI,KAAK,QAAQ,KAAK;CACrC,MAAM,OAAO,KAAK,WAAW,MAAM,CAAC;CACpC,IAAI,MAAM,KAAK,UAAU,QAAQ,SAAU,QAAQ,OAAQ,OAAO;CAClE,OAAO,KAAK,MAAM,GAAG,GAAG;AAC1B;;AAGA,SAAgB,aAAa,OAAkC,OAAiC;CAC9F,IAAI,YAAY;CAChB,MAAM,SAAS,UAAuD;EACpE,MAAM,SAA2B,CAAC;EAClC,KAAK,MAAM,QAAQ,OAAO;GACxB,IAAI,aAAa,GAAG;GACpB,IAAI,cAAc,MAChB,OAAO,KAAK;IAAE,GAAG;IAAM,UAAU,MAAM,KAAK,QAAQ;GAAE,CAAC;QAClD,IAAI,KAAK,SAAS,SAAS;IAChC,OAAO,KAAK,IAAI;IAChB,aAAa;GACf,OAAO;IACL,MAAM,OAAO,cAAc,KAAK,MAAM,SAAS;IAC/C,OAAO,KACL,KAAK,SAAS,UAAU,SAAS,KAAK,OAClC;KAAE,GAAG;KAAM;KAAM,cAAc,KAAK,gBAAgB,KAAK;IAAK,IAC9D;KAAE,GAAG;KAAM;IAAK,CACtB;IACA,aAAa,KAAK,KAAK;GACzB;EACF;EACA,OAAO;CACT;CACA,OAAO,MAAM,KAAK;AACpB;AAEA,SAAgB,aAAa,OAA0C;CACrE,OAAO,MAAM,QACV,KAAK,SACJ,OAAO,cAAc,OAAO,aAAa,KAAK,QAAQ,IAAI,KAAK,SAAS,UAAU,IAAI,KAAK,KAAK,SAClG,CACF;AACF;AAEA,SAAgB,WAAW,MAAc,MAAsB;CAC7D,MAAM,SAAS,cAAc,MAAM,QAAQ,aAAa,IAAI;CAC5D,MAAM,QAAQ,OAAO,MAAM,IAAI;CAC/B,OAAO,MAAM,UAAU,QAAQ,QAAQ,OAAO,SAAS,MAAM,MAAM,GAAG,QAAQ,QAAQ,IAAI,CAAC,CAAC,KAAK,IAAI;AACvG"}
|
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
1
|
+
import { useCallback, useRef, useState } from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/useControllable.ts
|
|
4
4
|
/**
|
|
5
5
|
* Controlled-or-uncontrolled state, the Radix convention every compound
|
|
6
6
|
* component follows: given `value` the caller owns it, otherwise the
|
|
7
7
|
* component keeps its own copy seeded from `defaultValue`. `onChange` fires
|
|
8
|
-
* either way.
|
|
8
|
+
* either way. The setter keeps one identity, so a context carrying it does not
|
|
9
|
+
* re-render its consumers on every render of the owner.
|
|
9
10
|
*/
|
|
10
11
|
function useControllable(value, defaultValue, onChange) {
|
|
11
12
|
const [own, setOwn] = useState(defaultValue);
|
|
12
13
|
const current = value === void 0 ? own : value;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
onChange
|
|
14
|
+
const latest = useRef({
|
|
15
|
+
value,
|
|
16
|
+
onChange
|
|
17
|
+
});
|
|
18
|
+
latest.current = {
|
|
19
|
+
value,
|
|
20
|
+
onChange
|
|
16
21
|
};
|
|
17
|
-
return [current,
|
|
22
|
+
return [current, useCallback((next) => {
|
|
23
|
+
if (latest.current.value === void 0) setOwn(next);
|
|
24
|
+
latest.current.onChange?.(next);
|
|
25
|
+
}, [])];
|
|
18
26
|
}
|
|
19
27
|
|
|
20
28
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useControllable.mjs","names":[],"sources":["../../src/lib/useControllable.ts"],"sourcesContent":["import { useState } from 'react';\n\n/**\n * Controlled-or-uncontrolled state, the Radix convention every compound\n * component follows: given `value` the caller owns it, otherwise the\n * component keeps its own copy seeded from `defaultValue`. `onChange` fires\n * either way.\n */\nexport function useControllable<T>(\n value: T | undefined,\n defaultValue: T,\n onChange: ((next: T) => void) | undefined,\n): [T, (next: T) => void] {\n const [own, setOwn] = useState(defaultValue);\n const current = value === undefined ? own : value;\n const set = (next: T) => {\n if (value === undefined) setOwn(next);\n onChange?.(next);\n };\n return [current, set];\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useControllable.mjs","names":[],"sources":["../../src/lib/useControllable.ts"],"sourcesContent":["import { useCallback, useRef, useState } from 'react';\n\n/**\n * Controlled-or-uncontrolled state, the Radix convention every compound\n * component follows: given `value` the caller owns it, otherwise the\n * component keeps its own copy seeded from `defaultValue`. `onChange` fires\n * either way. The setter keeps one identity, so a context carrying it does not\n * re-render its consumers on every render of the owner.\n */\nexport function useControllable<T>(\n value: T | undefined,\n defaultValue: T,\n onChange: ((next: T) => void) | undefined,\n): [T, (next: T) => void] {\n const [own, setOwn] = useState(defaultValue);\n const current = value === undefined ? own : value;\n const latest = useRef({ value, onChange });\n latest.current = { value, onChange };\n const set = useCallback((next: T) => {\n if (latest.current.value === undefined) setOwn(next);\n latest.current.onChange?.(next);\n }, []);\n return [current, set];\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,gBACd,OACA,cACA,UACwB;CACxB,MAAM,CAAC,KAAK,UAAU,SAAS,YAAY;CAC3C,MAAM,UAAU,UAAU,SAAY,MAAM;CAC5C,MAAM,SAAS,OAAO;EAAE;EAAO;CAAS,CAAC;CACzC,OAAO,UAAU;EAAE;EAAO;CAAS;CAKnC,OAAO,CAAC,SAJI,aAAa,SAAY;EACnC,IAAI,OAAO,QAAQ,UAAU,QAAW,OAAO,IAAI;EACnD,OAAO,QAAQ,WAAW,IAAI;CAChC,GAAG,CAAC,CACe,CAAC;AACtB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/useReadingPage.ts
|
|
4
|
+
/** Appended streaming content retains reveal state; replacement resets before paint. */
|
|
5
|
+
function useReadingPage(source, initialPage = 1) {
|
|
6
|
+
const [state, setState] = useState({
|
|
7
|
+
source,
|
|
8
|
+
page: initialPage,
|
|
9
|
+
generation: 0
|
|
10
|
+
});
|
|
11
|
+
let current = state;
|
|
12
|
+
if (source !== state.source) {
|
|
13
|
+
const append = source.startsWith(state.source) || state.source.startsWith(source) && state.source.slice(source.length).trim() === "";
|
|
14
|
+
current = {
|
|
15
|
+
source,
|
|
16
|
+
page: append ? state.page : initialPage,
|
|
17
|
+
generation: state.generation + (append ? 0 : 1)
|
|
18
|
+
};
|
|
19
|
+
setState(current);
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
page: current.page,
|
|
23
|
+
generation: current.generation,
|
|
24
|
+
reveal: () => setState((value) => ({
|
|
25
|
+
...value,
|
|
26
|
+
page: value.page + 1
|
|
27
|
+
}))
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { useReadingPage };
|
|
33
|
+
//# sourceMappingURL=useReadingPage.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReadingPage.mjs","names":[],"sources":["../../src/lib/useReadingPage.ts"],"sourcesContent":["import { useState } from 'react';\n\n/** Appended streaming content retains reveal state; replacement resets before paint. */\nexport function useReadingPage(source: string, initialPage = 1) {\n const [state, setState] = useState({ source, page: initialPage, generation: 0 });\n let current = state;\n if (source !== state.source) {\n const append =\n source.startsWith(state.source) ||\n (state.source.startsWith(source) && state.source.slice(source.length).trim() === '');\n current = { source, page: append ? state.page : initialPage, generation: state.generation + (append ? 0 : 1) };\n setState(current);\n }\n return {\n page: current.page,\n generation: current.generation,\n reveal: () => setState((value) => ({ ...value, page: value.page + 1 })),\n };\n}\n"],"mappings":";;;;AAGA,SAAgB,eAAe,QAAgB,cAAc,GAAG;CAC9D,MAAM,CAAC,OAAO,YAAY,SAAS;EAAE;EAAQ,MAAM;EAAa,YAAY;CAAE,CAAC;CAC/E,IAAI,UAAU;CACd,IAAI,WAAW,MAAM,QAAQ;EAC3B,MAAM,SACJ,OAAO,WAAW,MAAM,MAAM,KAC7B,MAAM,OAAO,WAAW,MAAM,KAAK,MAAM,OAAO,MAAM,OAAO,MAAM,CAAC,CAAC,KAAK,MAAM;EACnF,UAAU;GAAE;GAAQ,MAAM,SAAS,MAAM,OAAO;GAAa,YAAY,MAAM,cAAc,SAAS,IAAI;EAAG;EAC7G,SAAS,OAAO;CAClB;CACA,OAAO;EACL,MAAM,QAAQ;EACd,YAAY,QAAQ;EACpB,cAAc,UAAU,WAAW;GAAE,GAAG;GAAO,MAAM,MAAM,OAAO;EAAE,EAAE;CACxE;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":1,"platformRequirements":{},"sourceFiles":["LICENSE","README.md","llms.txt","locales/vi.json","locales/zh-CN.json","package.json","src/components/AgentAvatar.stories.tsx","src/components/AgentAvatar.tsx","src/components/AnnotationSurface.tsx","src/components/Badge.stories.tsx","src/components/Badge.tsx","src/components/Button.stories.tsx","src/components/Button.tsx","src/components/CodeBlock.stories.tsx","src/components/CodeBlock.tsx","src/components/ComputerRow.stories.tsx","src/components/ComputerRow.tsx","src/components/CopyButton.tsx","src/components/CountBadge.stories.tsx","src/components/CountBadge.tsx","src/components/CtaCard.stories.tsx","src/components/CtaCard.tsx","src/components/Dialog.stories.tsx","src/components/Dialog.tsx","src/components/Dot.stories.tsx","src/components/Dot.tsx","src/components/DropdownMenu.stories.tsx","src/components/DropdownMenu.tsx","src/components/EmptyState.stories.tsx","src/components/EmptyState.tsx","src/components/FileList.stories.tsx","src/components/FileList.tsx","src/components/FilePreview.stories.tsx","src/components/FilePreview.tsx","src/components/FileViewer.stories.tsx","src/components/FileViewer.tsx","src/components/HashlineLines.tsx","src/components/HostFilter.stories.tsx","src/components/HostFilter.tsx","src/components/HostTag.stories.tsx","src/components/HostTag.tsx","src/components/InfoStrip.stories.tsx","src/components/InfoStrip.tsx","src/components/InlineReadingDesign.stories.tsx","src/components/Input.stories.tsx","src/components/Input.tsx","src/components/Label.stories.tsx","src/components/Label.tsx","src/components/LinkText.tsx","src/components/List.stories.tsx","src/components/List.tsx","src/components/LiveDuration.tsx","src/components/LoadingState.stories.tsx","src/components/LoadingState.tsx","src/components/Markdown.stories.tsx","src/components/Markdown.tsx","src/components/MessageItem.stories.tsx","src/components/MessageItem.tsx","src/components/NativeShellState.tsx","src/components/Panel.stories.tsx","src/components/Panel.tsx","src/components/PoNativeProvider.stories.tsx","src/components/PoNativeProvider.tsx","src/components/RailItem.stories.tsx","src/components/RailItem.tsx","src/components/ReferenceChip.stories.tsx","src/components/ReferenceChip.tsx","src/components/SectionLabel.stories.tsx","src/components/SectionLabel.tsx","src/components/SeekBar.stories.tsx","src/components/SeekBar.tsx","src/components/SegmentedControl.stories.tsx","src/components/SegmentedControl.tsx","src/components/Select.stories.tsx","src/components/Select.tsx","src/components/Sheet.stories.tsx","src/components/Sheet.tsx","src/components/SheetFrame.tsx","src/components/SheetList.tsx","src/components/ShowMore.tsx","src/components/Spinner.stories.tsx","src/components/Spinner.tsx","src/components/StatusBadge.stories.tsx","src/components/StatusBadge.tsx","src/components/Switch.stories.tsx","src/components/Switch.tsx","src/components/SyntaxLine.tsx","src/components/Tabs.stories.tsx","src/components/Tabs.tsx","src/components/Textarea.stories.tsx","src/components/Textarea.tsx","src/components/ToolPathLink.tsx","src/components/ToolResultImage.tsx","src/exports/index.ts","src/exports/shell.ts","src/icons/IconColorContext.ts","src/icons/iconGlyphs.ts","src/icons/icons.stories.tsx","src/icons/icons.tsx","src/lib/fileKindLabel.ts","src/lib/fonts.ts","src/lib/haptics.ts","src/lib/insideSheet.ts","src/lib/markdown.ts","src/lib/reading.ts","src/lib/tone.ts","src/lib/useControllable.ts","src/lib/useReadingPage.ts","src/lib/wrapText.tsx","src/unistyles.ts","tsdown.config.ts"],"sourceRevision":"4f4ab8b8be6f12a026a44854dc6fe235","manifestRevision":"04980d0a7d9174c1c929ef9d2a465c30","outputFiles":["LICENSE","README.md","dist/components/AgentAvatar.mjs","dist/components/AnnotationSurface.mjs","dist/components/Badge.mjs","dist/components/Button.mjs","dist/components/CodeBlock.mjs","dist/components/ComputerRow.mjs","dist/components/CopyButton.mjs","dist/components/CountBadge.mjs","dist/components/CtaCard.mjs","dist/components/Dialog.mjs","dist/components/Dot.mjs","dist/components/DropdownMenu.mjs","dist/components/EmptyState.mjs","dist/components/FileList.mjs","dist/components/FilePreview.mjs","dist/components/FileViewer.mjs","dist/components/HashlineLines.mjs","dist/components/HostFilter.mjs","dist/components/HostTag.mjs","dist/components/InfoStrip.mjs","dist/components/Input.mjs","dist/components/Label.mjs","dist/components/LinkText.mjs","dist/components/List.mjs","dist/components/LiveDuration.mjs","dist/components/LoadingState.mjs","dist/components/Markdown.mjs","dist/components/MessageItem.mjs","dist/components/NativeShellState.mjs","dist/components/Panel.mjs","dist/components/PoNativeProvider.mjs","dist/components/RailItem.mjs","dist/components/ReferenceChip.mjs","dist/components/SectionLabel.mjs","dist/components/SeekBar.mjs","dist/components/SegmentedControl.mjs","dist/components/Select.mjs","dist/components/Sheet.mjs","dist/components/SheetFrame.mjs","dist/components/SheetList.mjs","dist/components/ShowMore.mjs","dist/components/Spinner.mjs","dist/components/StatusBadge.mjs","dist/components/Switch.mjs","dist/components/SyntaxLine.mjs","dist/components/Tabs.mjs","dist/components/Textarea.mjs","dist/components/ToolPathLink.mjs","dist/components/ToolResultImage.mjs","dist/icons/IconColorContext.mjs","dist/icons/iconGlyphs.mjs","dist/icons/icons.mjs","dist/index.mjs","dist/lib/fileKindLabel.mjs","dist/lib/fonts.mjs","dist/lib/haptics.mjs","dist/lib/insideSheet.mjs","dist/lib/markdown.mjs","dist/lib/reading.mjs","dist/lib/tone.mjs","dist/lib/useControllable.mjs","dist/lib/useReadingPage.mjs","dist/lib/wrapText.mjs","dist/shell.mjs","llms.txt","locales/vi.json","locales/zh-CN.json"],"outputRevision":"3ccce5b63bb54e6638e01566bd6112ce"}
|
package/dist/shell.d.mts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LiveDuration, LiveDurationProps, LiveDurationReading } from "./components/LiveDuration.mjs";
|
|
2
|
+
import { MessageItemContext, MessageItemGroupContext, MessageItemState, OpenSheet, dismissSheet, hasPresentedSheets, registerSheet, sheetsYielded, subscribePresentedSheets, unregisterSheet, yieldSheets } from "./components/NativeShellState.mjs";
|
|
3
|
+
import { PoNativeProvider, PoNativeProviderProps } from "./components/PoNativeProvider.mjs";
|
|
4
|
+
import { IconColorContext } from "./icons/IconColorContext.mjs";
|
|
5
|
+
import { InsideSheetContext, useInsideSheet } from "./lib/insideSheet.mjs";
|
|
6
|
+
export { IconColorContext, InsideSheetContext, LiveDuration, type LiveDurationProps, type LiveDurationReading, MessageItemContext, MessageItemGroupContext, type MessageItemState, type OpenSheet, PoNativeProvider, type PoNativeProviderProps, dismissSheet, hasPresentedSheets, registerSheet, sheetsYielded, subscribePresentedSheets, unregisterSheet, useInsideSheet, yieldSheets };
|
package/dist/shell.mjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LiveDuration } from "./components/LiveDuration.mjs";
|
|
2
|
+
import { MessageItemContext, MessageItemGroupContext, dismissSheet, hasPresentedSheets, registerSheet, sheetsYielded, subscribePresentedSheets, unregisterSheet, yieldSheets } from "./components/NativeShellState.mjs";
|
|
3
|
+
import { PoNativeProvider } from "./components/PoNativeProvider.mjs";
|
|
4
|
+
import { IconColorContext } from "./icons/IconColorContext.mjs";
|
|
5
|
+
import { InsideSheetContext, useInsideSheet } from "./lib/insideSheet.mjs";
|
|
6
|
+
|
|
7
|
+
export { IconColorContext, InsideSheetContext, LiveDuration, MessageItemContext, MessageItemGroupContext, PoNativeProvider, dismissSheet, hasPresentedSheets, registerSheet, sheetsYielded, subscribePresentedSheets, unregisterSheet, useInsideSheet, yieldSheets };
|
package/locales/vi.json
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nativeComponents.annotation.mark": "Ghi chú {label}",
|
|
3
|
+
"nativeComponents.annotation.markDescribed": "Ghi chú {label}: {description}",
|
|
4
|
+
"nativeComponents.annotation.noteWholeImage": "Ghi chú cho toàn ảnh",
|
|
5
|
+
"nativeComponents.annotation.placeHint": "Chạm hai lần để thêm ghi chú tại đây. Dùng thao tác Ghi chú cho toàn ảnh để đánh dấu toàn bộ ảnh.",
|
|
6
|
+
"nativeComponents.codeBlock.label": "Mã {language}",
|
|
7
|
+
"nativeComponents.codeBlock.showMore": "Hiện thêm mã",
|
|
8
|
+
"nativeComponents.codeBlock.summary": "{shownChars}/{totalChars} ký tự · {shownLines}/{totalLines} dòng",
|
|
9
|
+
"nativeComponents.computerRow.status.connected": "Đã kết nối",
|
|
10
|
+
"nativeComponents.computerRow.status.connecting": "Đang kết nối",
|
|
11
|
+
"nativeComponents.computerRow.status.disconnected": "Ngoại tuyến",
|
|
12
|
+
"nativeComponents.computerRow.status.updateRequired": "Cần cập nhật",
|
|
13
|
+
"nativeComponents.copyButton.copied": "đã sao chép",
|
|
14
|
+
"nativeComponents.copyButton.copy": "sao chép",
|
|
15
|
+
"nativeComponents.copyButton.failed": "sao chép thất bại",
|
|
16
|
+
"nativeComponents.copyButton.withLabel": "{action} {label}",
|
|
17
|
+
"nativeComponents.dialog.close": "đóng",
|
|
18
|
+
"nativeComponents.fileKind.code": "Mã",
|
|
19
|
+
"nativeComponents.fileKind.data": "Dữ liệu",
|
|
20
|
+
"nativeComponents.fileKind.document": "Tài liệu",
|
|
21
|
+
"nativeComponents.fileKind.image": "Hình ảnh",
|
|
22
|
+
"nativeComponents.fileKind.markdown": "Markdown",
|
|
23
|
+
"nativeComponents.fileKind.other": "Khác",
|
|
24
|
+
"nativeComponents.fileList.allTypes": "Mọi loại",
|
|
25
|
+
"nativeComponents.fileList.ascending": "Tăng dần",
|
|
26
|
+
"nativeComponents.fileList.bytes": "{size} byte",
|
|
27
|
+
"nativeComponents.fileList.clearFilters": "Xóa bộ lọc",
|
|
28
|
+
"nativeComponents.fileList.close": "Đóng",
|
|
29
|
+
"nativeComponents.fileList.collapse": "Thu gọn {path}",
|
|
30
|
+
"nativeComponents.fileList.count": "{shown}/{total} tệp",
|
|
31
|
+
"nativeComponents.fileList.descending": "Giảm dần",
|
|
32
|
+
"nativeComponents.fileList.emptyTitle": "Chưa có gì ở đây",
|
|
33
|
+
"nativeComponents.fileList.expand": "Mở rộng {path}",
|
|
34
|
+
"nativeComponents.fileList.filters": "Bộ lọc",
|
|
35
|
+
"nativeComponents.fileList.lastSeen": "Đây là các tệp Po thấy lần gần nhất.",
|
|
36
|
+
"nativeComponents.fileList.layout.grid": "Lưới",
|
|
37
|
+
"nativeComponents.fileList.layout.list": "Danh sách",
|
|
38
|
+
"nativeComponents.fileList.layout.tree": "Cây",
|
|
39
|
+
"nativeComponents.fileList.layoutLabel": "Bố cục {label}",
|
|
40
|
+
"nativeComponents.fileList.loadFailed": "Không tải được danh sách tệp",
|
|
41
|
+
"nativeComponents.fileList.loading": "Đang tải tệp…",
|
|
42
|
+
"nativeComponents.fileList.modified.30days": "30 ngày qua",
|
|
43
|
+
"nativeComponents.fileList.modified.7days": "7 ngày qua",
|
|
44
|
+
"nativeComponents.fileList.modified.any": "Bất kỳ lúc nào",
|
|
45
|
+
"nativeComponents.fileList.modified.today": "Hôm nay",
|
|
46
|
+
"nativeComponents.fileList.next": "Tệp tiếp theo",
|
|
47
|
+
"nativeComponents.fileList.noMatch": "Không có tệp phù hợp",
|
|
48
|
+
"nativeComponents.fileList.open": "Mở {path}",
|
|
49
|
+
"nativeComponents.fileList.openAction": "Mở",
|
|
50
|
+
"nativeComponents.fileList.position": "{index}/{total}",
|
|
51
|
+
"nativeComponents.fileList.previous": "Tệp trước",
|
|
52
|
+
"nativeComponents.fileList.refreshFailed": "Không làm mới được danh sách tệp",
|
|
53
|
+
"nativeComponents.fileList.removeModified": "Xóa bộ lọc thời gian sửa đổi",
|
|
54
|
+
"nativeComponents.fileList.removeSearch": "Xóa bộ lọc tìm kiếm",
|
|
55
|
+
"nativeComponents.fileList.removeType": "Xóa bộ lọc loại",
|
|
56
|
+
"nativeComponents.fileList.retry": "Thử lại",
|
|
57
|
+
"nativeComponents.fileList.search": "Tìm {label}",
|
|
58
|
+
"nativeComponents.fileList.searchChip": "Tìm kiếm: {query}",
|
|
59
|
+
"nativeComponents.fileList.select": "Chọn {path}",
|
|
60
|
+
"nativeComponents.fileList.sort.modified": "Đã sửa đổi",
|
|
61
|
+
"nativeComponents.fileList.sort.name": "Tên",
|
|
62
|
+
"nativeComponents.fileList.sort.size": "Kích thước",
|
|
63
|
+
"nativeComponents.fileList.sortHeading": "Sắp xếp",
|
|
64
|
+
"nativeComponents.fileList.typeHeading": "Loại",
|
|
65
|
+
"nativeComponents.filePreview.loadingMedia": "Đang tải nội dung đa phương tiện…",
|
|
66
|
+
"nativeComponents.filePreview.noHtml": "Máy chủ này không thể hiển thị bản xem trước HTML.",
|
|
67
|
+
"nativeComponents.filePreview.noMedia": "Máy chủ này không thể hiển thị bản xem trước nội dung đa phương tiện này.",
|
|
68
|
+
"nativeComponents.filePreview.unavailable": "Không thể xem trước tệp này.",
|
|
69
|
+
"nativeComponents.fileViewer.cancel": "Hủy",
|
|
70
|
+
"nativeComponents.fileViewer.cancelDownload": "Hủy tải xuống",
|
|
71
|
+
"nativeComponents.fileViewer.cancelled": "Đã hủy tải xuống.",
|
|
72
|
+
"nativeComponents.fileViewer.cannotSave": "Máy chủ này không thể lưu tệp tải xuống.",
|
|
73
|
+
"nativeComponents.fileViewer.download": "Tải xuống",
|
|
74
|
+
"nativeComponents.fileViewer.loadFailed": "Không tải được tệp này",
|
|
75
|
+
"nativeComponents.fileViewer.pathLabel": "đường dẫn",
|
|
76
|
+
"nativeComponents.fileViewer.reading": "Đang đọc tệp này…",
|
|
77
|
+
"nativeComponents.fileViewer.retry": "Thử lại",
|
|
78
|
+
"nativeComponents.fileViewer.saved": "Đã lưu.",
|
|
79
|
+
"nativeComponents.fileViewer.saveFailed": "Không lưu được tệp này",
|
|
80
|
+
"nativeComponents.hashline.showMore": "Hiện thêm dòng",
|
|
81
|
+
"nativeComponents.hashline.summary": "{shown}/{total} dòng",
|
|
82
|
+
"nativeComponents.hostFilter.all": "Tất cả",
|
|
83
|
+
"nativeComponents.hostFilter.label": "Lọc theo máy tính",
|
|
84
|
+
"nativeComponents.hostTag.label": "Máy tính: {label}",
|
|
85
|
+
"nativeComponents.list.jumpToLatest": "Chuyển đến mới nhất",
|
|
86
|
+
"nativeComponents.markdown.cellLimit": "Ô: {limit} ký tự đầu tiên",
|
|
87
|
+
"nativeComponents.markdown.image": "Hình ảnh",
|
|
88
|
+
"nativeComponents.markdown.imageLoading": "{name} (đang tải…)",
|
|
89
|
+
"nativeComponents.markdown.imageUnavailable": "{name} (không khả dụng)",
|
|
90
|
+
"nativeComponents.markdown.openHint": "mở {target}",
|
|
91
|
+
"nativeComponents.markdown.partsSummary": "{shown}/{total} phần",
|
|
92
|
+
"nativeComponents.markdown.showMore": "Hiện thêm",
|
|
93
|
+
"nativeComponents.markdown.showMoreCells": "Hiện thêm văn bản trong ô",
|
|
94
|
+
"nativeComponents.markdown.showMoreColumns": "Hiện thêm cột",
|
|
95
|
+
"nativeComponents.markdown.showMoreRows": "Hiện thêm hàng",
|
|
96
|
+
"nativeComponents.markdown.tableSummary": "{shownRows}/{totalRows} hàng · {shownColumns}/{totalColumns} cột",
|
|
97
|
+
"nativeComponents.messageItem.collapseHint": "thu gọn",
|
|
98
|
+
"nativeComponents.messageItem.expandHint": "mở rộng",
|
|
99
|
+
"nativeComponents.messageItem.status.accent": "Ghi chú",
|
|
100
|
+
"nativeComponents.messageItem.status.error": "Thất bại",
|
|
101
|
+
"nativeComponents.messageItem.status.info": "Thông tin",
|
|
102
|
+
"nativeComponents.messageItem.status.ok": "Đã hoàn tất",
|
|
103
|
+
"nativeComponents.messageItem.status.running": "Đang chạy",
|
|
104
|
+
"nativeComponents.messageItem.toolCall": "Lệnh gọi công cụ",
|
|
105
|
+
"nativeComponents.select.clear": "Xóa",
|
|
106
|
+
"nativeComponents.select.noMatches": "Không có kết quả phù hợp.",
|
|
107
|
+
"nativeComponents.select.placeholder": "Chọn",
|
|
108
|
+
"nativeComponents.select.reload": "Tải lại {title}",
|
|
109
|
+
"nativeComponents.toolResultImage.open": "Mở {name} trong Author",
|
|
110
|
+
"nativeComponents.toolResultImage.openFailed": "Không thể mở ảnh này",
|
|
111
|
+
"nativeComponents.toolResultImage.openHint": "Xem kích thước đầy đủ và gửi phản hồi"
|
|
112
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nativeComponents.annotation.mark": "批注 {label}",
|
|
3
|
+
"nativeComponents.annotation.markDescribed": "批注 {label}:{description}",
|
|
4
|
+
"nativeComponents.annotation.noteWholeImage": "批注整张图片",
|
|
5
|
+
"nativeComponents.annotation.placeHint": "双击可在此处添加批注。使用“批注整张图片”操作可标记整张图片。",
|
|
6
|
+
"nativeComponents.codeBlock.label": "{language} 代码",
|
|
7
|
+
"nativeComponents.codeBlock.showMore": "显示更多代码",
|
|
8
|
+
"nativeComponents.codeBlock.summary": "{shownChars}/{totalChars} 个字符 · {shownLines}/{totalLines} 行",
|
|
9
|
+
"nativeComponents.computerRow.status.connected": "已连接",
|
|
10
|
+
"nativeComponents.computerRow.status.connecting": "正在连接",
|
|
11
|
+
"nativeComponents.computerRow.status.disconnected": "离线",
|
|
12
|
+
"nativeComponents.computerRow.status.updateRequired": "需要更新",
|
|
13
|
+
"nativeComponents.copyButton.copied": "已复制",
|
|
14
|
+
"nativeComponents.copyButton.copy": "复制",
|
|
15
|
+
"nativeComponents.copyButton.failed": "复制失败",
|
|
16
|
+
"nativeComponents.copyButton.withLabel": "{action}{label}",
|
|
17
|
+
"nativeComponents.dialog.close": "关闭",
|
|
18
|
+
"nativeComponents.fileKind.code": "代码",
|
|
19
|
+
"nativeComponents.fileKind.data": "数据",
|
|
20
|
+
"nativeComponents.fileKind.document": "文档",
|
|
21
|
+
"nativeComponents.fileKind.image": "图片",
|
|
22
|
+
"nativeComponents.fileKind.markdown": "Markdown",
|
|
23
|
+
"nativeComponents.fileKind.other": "其他",
|
|
24
|
+
"nativeComponents.fileList.allTypes": "所有类型",
|
|
25
|
+
"nativeComponents.fileList.ascending": "升序",
|
|
26
|
+
"nativeComponents.fileList.bytes": "{size} 字节",
|
|
27
|
+
"nativeComponents.fileList.clearFilters": "清除筛选",
|
|
28
|
+
"nativeComponents.fileList.close": "关闭",
|
|
29
|
+
"nativeComponents.fileList.collapse": "折叠 {path}",
|
|
30
|
+
"nativeComponents.fileList.count": "{shown}/{total} 个文件",
|
|
31
|
+
"nativeComponents.fileList.descending": "降序",
|
|
32
|
+
"nativeComponents.fileList.emptyTitle": "暂无内容",
|
|
33
|
+
"nativeComponents.fileList.expand": "展开 {path}",
|
|
34
|
+
"nativeComponents.fileList.filters": "筛选",
|
|
35
|
+
"nativeComponents.fileList.lastSeen": "这些是 Po 上次看到的文件。",
|
|
36
|
+
"nativeComponents.fileList.layout.grid": "网格",
|
|
37
|
+
"nativeComponents.fileList.layout.list": "列表",
|
|
38
|
+
"nativeComponents.fileList.layout.tree": "树状",
|
|
39
|
+
"nativeComponents.fileList.layoutLabel": "{label}布局",
|
|
40
|
+
"nativeComponents.fileList.loadFailed": "无法加载文件列表",
|
|
41
|
+
"nativeComponents.fileList.loading": "正在加载文件…",
|
|
42
|
+
"nativeComponents.fileList.modified.30days": "最近 30 天",
|
|
43
|
+
"nativeComponents.fileList.modified.7days": "最近 7 天",
|
|
44
|
+
"nativeComponents.fileList.modified.any": "任意时间",
|
|
45
|
+
"nativeComponents.fileList.modified.today": "今天",
|
|
46
|
+
"nativeComponents.fileList.next": "下一个文件",
|
|
47
|
+
"nativeComponents.fileList.noMatch": "没有匹配的文件",
|
|
48
|
+
"nativeComponents.fileList.open": "打开 {path}",
|
|
49
|
+
"nativeComponents.fileList.openAction": "打开",
|
|
50
|
+
"nativeComponents.fileList.position": "第 {index} 个,共 {total} 个",
|
|
51
|
+
"nativeComponents.fileList.previous": "上一个文件",
|
|
52
|
+
"nativeComponents.fileList.refreshFailed": "无法刷新文件列表",
|
|
53
|
+
"nativeComponents.fileList.removeModified": "移除修改时间筛选",
|
|
54
|
+
"nativeComponents.fileList.removeSearch": "移除搜索筛选",
|
|
55
|
+
"nativeComponents.fileList.removeType": "移除类型筛选",
|
|
56
|
+
"nativeComponents.fileList.retry": "重试",
|
|
57
|
+
"nativeComponents.fileList.search": "搜索{label}",
|
|
58
|
+
"nativeComponents.fileList.searchChip": "搜索:{query}",
|
|
59
|
+
"nativeComponents.fileList.select": "选择 {path}",
|
|
60
|
+
"nativeComponents.fileList.sort.modified": "修改时间",
|
|
61
|
+
"nativeComponents.fileList.sort.name": "名称",
|
|
62
|
+
"nativeComponents.fileList.sort.size": "大小",
|
|
63
|
+
"nativeComponents.fileList.sortHeading": "排序",
|
|
64
|
+
"nativeComponents.fileList.typeHeading": "类型",
|
|
65
|
+
"nativeComponents.filePreview.loadingMedia": "正在加载媒体…",
|
|
66
|
+
"nativeComponents.filePreview.noHtml": "此主机无法显示 HTML 预览。",
|
|
67
|
+
"nativeComponents.filePreview.noMedia": "此主机无法显示此媒体预览。",
|
|
68
|
+
"nativeComponents.filePreview.unavailable": "无法预览此文件。",
|
|
69
|
+
"nativeComponents.fileViewer.cancel": "取消",
|
|
70
|
+
"nativeComponents.fileViewer.cancelDownload": "取消下载",
|
|
71
|
+
"nativeComponents.fileViewer.cancelled": "下载已取消。",
|
|
72
|
+
"nativeComponents.fileViewer.cannotSave": "此主机无法保存下载内容。",
|
|
73
|
+
"nativeComponents.fileViewer.download": "下载",
|
|
74
|
+
"nativeComponents.fileViewer.loadFailed": "无法加载此文件",
|
|
75
|
+
"nativeComponents.fileViewer.pathLabel": "路径",
|
|
76
|
+
"nativeComponents.fileViewer.reading": "正在读取此文件…",
|
|
77
|
+
"nativeComponents.fileViewer.retry": "重试",
|
|
78
|
+
"nativeComponents.fileViewer.saved": "已保存。",
|
|
79
|
+
"nativeComponents.fileViewer.saveFailed": "无法保存此文件",
|
|
80
|
+
"nativeComponents.hashline.showMore": "显示更多行",
|
|
81
|
+
"nativeComponents.hashline.summary": "第 {shown} 行,共 {total} 行",
|
|
82
|
+
"nativeComponents.hostFilter.all": "全部",
|
|
83
|
+
"nativeComponents.hostFilter.label": "按电脑筛选",
|
|
84
|
+
"nativeComponents.hostTag.label": "电脑:{label}",
|
|
85
|
+
"nativeComponents.list.jumpToLatest": "跳到最新",
|
|
86
|
+
"nativeComponents.markdown.cellLimit": "单元格:仅显示前 {limit} 个字符",
|
|
87
|
+
"nativeComponents.markdown.image": "图片",
|
|
88
|
+
"nativeComponents.markdown.imageLoading": "{name}(加载中…)",
|
|
89
|
+
"nativeComponents.markdown.imageUnavailable": "{name}(不可用)",
|
|
90
|
+
"nativeComponents.markdown.openHint": "打开 {target}",
|
|
91
|
+
"nativeComponents.markdown.partsSummary": "{shown} / {total} 部分",
|
|
92
|
+
"nativeComponents.markdown.showMore": "显示更多",
|
|
93
|
+
"nativeComponents.markdown.showMoreCells": "显示更多单元格文本",
|
|
94
|
+
"nativeComponents.markdown.showMoreColumns": "显示更多列",
|
|
95
|
+
"nativeComponents.markdown.showMoreRows": "显示更多行",
|
|
96
|
+
"nativeComponents.markdown.tableSummary": "{shownRows} / {totalRows} 行 · {shownColumns} / {totalColumns} 列",
|
|
97
|
+
"nativeComponents.messageItem.collapseHint": "收起",
|
|
98
|
+
"nativeComponents.messageItem.expandHint": "展开",
|
|
99
|
+
"nativeComponents.messageItem.status.accent": "备注",
|
|
100
|
+
"nativeComponents.messageItem.status.error": "失败",
|
|
101
|
+
"nativeComponents.messageItem.status.info": "信息",
|
|
102
|
+
"nativeComponents.messageItem.status.ok": "已完成",
|
|
103
|
+
"nativeComponents.messageItem.status.running": "运行中",
|
|
104
|
+
"nativeComponents.messageItem.toolCall": "工具调用",
|
|
105
|
+
"nativeComponents.select.clear": "清除",
|
|
106
|
+
"nativeComponents.select.noMatches": "无匹配项。",
|
|
107
|
+
"nativeComponents.select.placeholder": "请选择",
|
|
108
|
+
"nativeComponents.select.reload": "重新加载{title}",
|
|
109
|
+
"nativeComponents.toolResultImage.open": "在 Author 中打开 {name}",
|
|
110
|
+
"nativeComponents.toolResultImage.openFailed": "无法打开此图片",
|
|
111
|
+
"nativeComponents.toolResultImage.openHint": "查看原图并提供反馈"
|
|
112
|
+
}
|