@k2b/ui 0.11.0 → 0.12.0
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/dist/browser/content/FileView.js +203 -136
- package/dist/browser/content/FileView.js.map +1 -1
- package/dist/browser/content/markdown-title.js +52 -0
- package/dist/browser/content/markdown-title.js.map +1 -0
- package/dist/browser/feedback/index.js.map +1 -1
- package/dist/browser/feedback/prompts.js +18 -19
- package/dist/browser/feedback/prompts.js.map +1 -1
- package/dist/browser/feedback/toast.js +363 -122
- package/dist/browser/feedback/toast.js.map +1 -1
- package/dist/browser/inputs/DatePicker.js +263 -222
- package/dist/browser/inputs/DatePicker.js.map +1 -1
- package/dist/browser/inputs/MultiSelectInput.js +139 -105
- package/dist/browser/inputs/MultiSelectInput.js.map +1 -1
- package/dist/browser/inputs/NumberInput.js +209 -122
- package/dist/browser/inputs/NumberInput.js.map +1 -1
- package/dist/browser/inputs/Select.js +184 -92
- package/dist/browser/inputs/Select.js.map +1 -1
- package/dist/browser/inputs/index.js.map +1 -1
- package/dist/browser/intl/messages.js +4 -0
- package/dist/browser/intl/messages.js.map +1 -1
- package/dist/browser/layout/DetailPanel.js +2 -1
- package/dist/browser/layout/DetailPanel.js.map +1 -1
- package/dist/browser/layout/Navigation.js +1 -0
- package/dist/browser/layout/Navigation.js.map +1 -1
- package/dist/browser/layout/PanelDialog.js +1 -0
- package/dist/browser/layout/PanelDialog.js.map +1 -1
- package/dist/browser/layout/Settings.js +2 -2
- package/dist/browser/layout/Settings.js.map +1 -1
- package/dist/ssr/content/FileView.js +141 -81
- package/dist/ssr/content/FileView.js.map +1 -1
- package/dist/ssr/content/markdown-title.js +52 -0
- package/dist/ssr/content/markdown-title.js.map +1 -0
- package/dist/ssr/feedback/index.js.map +1 -1
- package/dist/ssr/feedback/prompts.js +1 -1
- package/dist/ssr/feedback/prompts.js.map +1 -1
- package/dist/ssr/feedback/toast.js +363 -122
- package/dist/ssr/feedback/toast.js.map +1 -1
- package/dist/ssr/inputs/DatePicker.js +78 -52
- package/dist/ssr/inputs/DatePicker.js.map +1 -1
- package/dist/ssr/inputs/MultiSelectInput.js +52 -32
- package/dist/ssr/inputs/MultiSelectInput.js.map +1 -1
- package/dist/ssr/inputs/NumberInput.js +93 -40
- package/dist/ssr/inputs/NumberInput.js.map +1 -1
- package/dist/ssr/inputs/Select.js +108 -29
- package/dist/ssr/inputs/Select.js.map +1 -1
- package/dist/ssr/inputs/index.js.map +1 -1
- package/dist/ssr/intl/messages.js +4 -0
- package/dist/ssr/intl/messages.js.map +1 -1
- package/dist/ssr/layout/DetailPanel.js +2 -1
- package/dist/ssr/layout/DetailPanel.js.map +1 -1
- package/dist/ssr/layout/Navigation.js +1 -0
- package/dist/ssr/layout/Navigation.js.map +1 -1
- package/dist/ssr/layout/PanelDialog.js +1 -0
- package/dist/ssr/layout/PanelDialog.js.map +1 -1
- package/dist/ssr/layout/Settings.js +2 -2
- package/dist/ssr/layout/Settings.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/content/FileView.d.ts +11 -1
- package/dist/types/content/markdown-title.d.ts +9 -0
- package/dist/types/feedback/index.d.ts +1 -1
- package/dist/types/feedback/toast.d.ts +7 -0
- package/dist/types/inputs/DatePicker.d.ts +11 -2
- package/dist/types/inputs/MultiSelectInput.d.ts +5 -1
- package/dist/types/inputs/NumberInput.d.ts +14 -0
- package/dist/types/inputs/Select.d.ts +10 -0
- package/dist/types/inputs/index.d.ts +1 -1
- package/dist/types/intl/messages.d.ts +2 -0
- package/dist/types/layout/Settings.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["content/FileView.tsx"],"sourcesContent":["/**\n * FileView — renders one file through a small renderer registry keyed by\n * media type / path. Editing is enabled purely by the presence of `save`;\n * without it every renderer is read-only. IDE-style chrome: editors reuse\n * the markdown editor's surface (toolbar with an in-toolbar save, Ctrl/Cmd+S),\n * previews are quiet paper panels with icon-only actions overlaid top-right.\n * Custom renderers are passed per instance, which keeps SSR requests and\n * independently mounted applications isolated.\n */\n\nimport { mutation } from \"@k2b/stdlib/solid\";\nimport {\n type Component,\n createEffect,\n createMemo,\n createResource,\n createSignal,\n For,\n type JSX,\n Match,\n onCleanup,\n onMount,\n Show,\n Switch,\n untrack,\n} from \"solid-js\";\nimport { Button } from \"../actions/Button\";\nimport { prompts } from \"../feedback/prompts\";\nimport { Tooltip } from \"../feedback/Tooltip\";\nimport { toast } from \"../feedback/toast\";\nimport { MarkdownEditor } from \"../inputs/markdown/MarkdownEditor\";\nimport { Select } from \"../inputs/Select\";\nimport { useUiMessages } from \"../intl/messages\";\nimport Placeholder from \"../surfaces/Placeholder\";\nimport CodeDisplay, { type CodeDisplayLanguage } from \"./CodeDisplay\";\nimport { type DelimitedPreferences, decodeDelimitedContent, readDelimitedPreferences } from \"./delimited-preferences\";\nimport { type FileViewFile, fileViewExtension, getFileViewPreviewKind, parseDelimitedText } from \"./file-view-preview\";\nimport MarkdownView from \"./MarkdownView\";\nimport PdfPreview from \"./PdfPreview\";\nimport StructuredDataPreview, { type StructuredDataValue } from \"./StructuredDataPreview\";\n\nexport type { FileViewFile, FileViewPreviewKind } from \"./file-view-preview\";\nexport { canPreviewFile, getFileViewPreviewKind } from \"./file-view-preview\";\nexport type FileViewContent = { encoding: \"utf8\" | \"base64\"; content: string; mediaType: string };\n\nexport type FileViewProps = {\n /** Plain previews inherit the surrounding surface without a frame or inset padding. */\n variant?: \"default\" | \"plain\";\n /** Read-only excerpt limit; omitted renders the complete preview. */\n previewLines?: number;\n onExpandPreview?: () => void;\n headingScale?: \"compact\" | \"normal\" | \"large\";\n /** Optional browser-local preference scope, owned by the host. */\n previewPreferencesKey?: string;\n file: FileViewFile;\n load: () => Promise<FileViewContent>;\n /** Refetch the current path when this host-owned revision changes. */\n revision?: unknown;\n /** Register an awaitable refresh for the currently visible preview. */\n registerRefresh?: (refresh: () => Promise<void>) => void | (() => void);\n /** Presence enables editing for text-based renderers. */\n save?: (content: string) => Promise<void>;\n /** Authenticated inline URL used by browser-native image, PDF, audio, and video previews. */\n previewHref?: string | null;\n /** CORS mode for native image/audio/video previews. Omit to preserve browser defaults. */\n crossOrigin?: \"anonymous\" | \"use-credentials\";\n /** Native media failed to load; the host can renew a signed URL and offer retry. */\n onPreviewError?: () => void;\n /** Download actions only; never a preview source, because an attachment response does not render inline. */\n downloadHref?: string | null;\n /** App-specific renderers matched before the built-ins for this instance. */\n renderers?: readonly FileViewRenderer[];\n /** Reports local edit state so a parent browser can guard navigation. */\n onDirtyChange?: (dirty: boolean) => void;\n class?: string;\n};\n\nexport type FileViewRendererProps = {\n /** Read-only excerpt limit; omitted renders the complete preview. */\n previewLines?: number;\n onExpandPreview?: () => void;\n headingScale?: \"compact\" | \"normal\" | \"large\";\n /** Optional browser-local preference scope, owned by the host. */\n previewPreferencesKey?: string;\n file: FileViewFile;\n content: FileViewContent;\n previewHref: string | null;\n crossOrigin?: \"anonymous\" | \"use-credentials\";\n onPreviewError?: () => void;\n downloadHref: string | null;\n /** Null when the file is read-only. */\n editor: {\n draft: () => string;\n setDraft: (value: string) => void;\n dirty: () => boolean;\n saving: () => boolean;\n save: () => Promise<void>;\n } | null;\n};\n\nexport type FileViewRenderer = {\n id: string;\n match: (file: FileViewFile, content: FileViewContent) => boolean;\n component: Component<FileViewRendererProps>;\n /** Text renderers that support the edit affordance when `save` is present. */\n editable?: boolean;\n};\n\nconst codeLanguage = (path: string): CodeDisplayLanguage => {\n const extension = fileViewExtension(path);\n if (extension === \"ts\" || extension === \"mts\" || extension === \"cts\") return \"ts\";\n if (extension === \"tsx\") return \"tsx\";\n if (extension === \"js\" || extension === \"mjs\" || extension === \"cjs\") return \"js\";\n if (extension === \"jsx\") return \"jsx\";\n if (extension === \"md\" || extension === \"markdown\") return \"md\";\n return \"text\";\n};\n\nconst isMarkdown = (file: FileViewFile, content: FileViewContent) =>\n content.encoding === \"utf8\" && getFileViewPreviewKind({ ...file, mediaType: content.mediaType || file.mediaType }) === \"markdown\";\n\n/** Rendered previews hide a leading YAML frontmatter block — it's metadata, not content. */\nconst stripFrontmatter = (text: string): string => {\n const match = /^---\\r?\\n[\\s\\S]*?\\r?\\n---\\r?\\n?/.exec(text.trimStart());\n return match ? text.trimStart().slice(match[0].length) : text;\n};\n\n/** Icon-only download link with the shared tooltip, for toolbars that style their own controls. */\nfunction DownloadLink(props: { class: string; href: string; download: string; label: string; icon: string }) {\n let link: HTMLAnchorElement | undefined;\n return (\n <>\n <a ref={link} class={props.class} href={props.href} download={props.download} aria-label={props.label}>\n <i class={props.icon} aria-hidden=\"true\" />\n <span class=\"k2b-sr-only\">{props.label}</span>\n </a>\n <Tooltip content={props.label} target={() => link} />\n </>\n );\n}\n\n/** Icon-only action, IDE style — sits in the floating top-right cluster of previews. */\nfunction OverlayAction(props: { icon: string; title: string; onClick?: () => void; href?: string; download?: string }) {\n const classes = \"k2b-content-file-view__action\";\n return (\n <Show\n when={props.href}\n fallback={\n <Tooltip.Trigger type=\"button\" class={classes} content={props.title} aria-label={props.title} onClick={props.onClick}>\n <i class={`ti ${props.icon}`} aria-hidden=\"true\" />\n </Tooltip.Trigger>\n }\n >\n {(href) => (\n <DownloadLink class={classes} href={href()} download={props.download ?? \"\"} label={props.title} icon={`ti ${props.icon}`} />\n )}\n </Show>\n );\n}\n\n/** Scrollable preview panel with the floating action cluster overlaid top-right. */\nfunction OverlayPanel(props: { actions?: JSX.Element; children: JSX.Element }) {\n return (\n <div class=\"k2b-content-file-view__panel\">\n <div class=\"k2b-content-file-view__preview\">{props.children}</div>\n <Show when={props.actions}>\n <div class=\"k2b-content-file-view__overlay\">{props.actions}</div>\n </Show>\n </div>\n );\n}\n\nconst DownloadAction = (props: FileViewRendererProps): JSX.Element => {\n const messages = useUiMessages();\n return (\n <Show when={props.downloadHref}>\n {(href) => (\n <OverlayAction\n icon=\"ti-download\"\n title={messages().download}\n href={href()}\n download={props.file.path.slice(props.file.path.lastIndexOf(\"/\") + 1)}\n />\n )}\n </Show>\n );\n};\n\n/** Toolbar-styled icon button — reuses the package markdown-editor tool primitive. */\nfunction EditorToolButton(props: { icon: string; title: string; onClick: () => void; disabled?: boolean }) {\n return (\n <Tooltip.Trigger\n type=\"button\"\n class=\"k2b-markdown-editor__tool\"\n content={props.title}\n aria-label={props.title}\n tabIndex={-1}\n disabled={props.disabled}\n onMouseDown={(e) => e.preventDefault()}\n onClick={props.onClick}\n >\n <i class={props.icon} aria-hidden=\"true\" />\n </Tooltip.Trigger>\n );\n}\n\n// ── Built-in renderers ──────────────────────────────────────────────────────\n\nfunction MoreLines(props: { count: number; onClick?: () => void }) {\n const messages = useUiMessages();\n return (\n <Show when={props.count > 0}>\n <div class=\"k2b-content-file-view__truncated\">\n <Show when={props.onClick} fallback={<span>{messages().previewMoreLines(props.count)}</span>}>\n <Button size=\"sm\" variant=\"ghost\" onClick={props.onClick}>\n {messages().previewMoreLines(props.count)}\n </Button>\n </Show>\n </div>\n </Show>\n );\n}\nfunction TextExcerpt(props: { renderer: FileViewRendererProps; text: string; markdown?: boolean }) {\n const lines = createMemo(() => props.text.replace(/\\r\\n?/g, \"\\n\").replace(/\\n$/, \"\").split(\"\\n\"));\n const limit = () => (props.renderer.previewLines === undefined ? lines().length : Math.max(1, props.renderer.previewLines));\n const text = () => lines().slice(0, limit()).join(\"\\n\");\n return (\n <>\n <div classList={{ \"k2b-content-file-view__excerpt\": props.renderer.previewLines !== undefined }}>\n <Show when={props.markdown} fallback={<CodeDisplay code={text()} language={codeLanguage(props.renderer.file.path)} />}>\n <MarkdownView markdown={text()} headingScale={props.renderer.headingScale ?? \"compact\"} />\n </Show>\n </div>\n <MoreLines count={lines().length - limit()} onClick={props.renderer.onExpandPreview} />\n </>\n );\n}\n\nfunction MarkdownRenderer(props: FileViewRendererProps) {\n const messages = useUiMessages();\n const [editing, setEditing] = createSignal(false);\n return (\n <Show\n when={props.editor && editing()}\n fallback={\n <OverlayPanel\n actions={\n <>\n <Show when={props.editor}>\n <OverlayAction icon=\"ti-pencil\" title={messages().edit} onClick={() => setEditing(true)} />\n </Show>\n <DownloadAction {...props} />\n </>\n }\n >\n <div class=\"k2b-content-file-view__document\">\n <TextExcerpt renderer={props} text={stripFrontmatter(props.editor?.draft() ?? props.content.content)} markdown />\n </div>\n </OverlayPanel>\n }\n >\n {(_) => {\n const editor = props.editor!;\n return (\n <div class=\"k2b-content-file-view__editor\">\n <MarkdownEditor\n class=\"k2b-content-file-view__markdown-field\"\n aria-label={`Edit ${props.file.path.slice(props.file.path.lastIndexOf(\"/\") + 1)}`}\n fill\n value={editor.draft()}\n onValueChange={editor.setDraft}\n showStats={false}\n onSave={() => void editor.save()}\n saveDisabled={!editor.dirty()}\n saving={editor.saving()}\n toolbarTrailing={<EditorToolButton icon=\"ti ti-eye\" title={messages().preview} onClick={() => setEditing(false)} />}\n />\n </div>\n );\n }}\n </Show>\n );\n}\n\nfunction TextRenderer(props: FileViewRendererProps) {\n const messages = useUiMessages();\n return (\n <Show\n when={props.editor}\n fallback={\n <OverlayPanel actions={<DownloadAction {...props} />}>\n <TextExcerpt renderer={props} text={props.content.content} />\n </OverlayPanel>\n }\n >\n {(editor) => (\n // Same chrome as the markdown editor — literally the same classes, so\n // border, radius, focus ring, toolbar height and text metrics cannot drift.\n <div class=\"k2b-content-file-view__editor\">\n <div\n class=\"k2b-markdown-editor\"\n data-fill=\"true\"\n role=\"group\"\n aria-label={messages().textEditor}\n onKeyDown={(event) => {\n if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === \"s\") {\n event.preventDefault();\n if (editor().dirty() && !editor().saving()) void editor().save();\n }\n }}\n >\n {/* No formatting tools here — the divider under an actions-only bar reads lost. */}\n <div class=\"k2b-markdown-editor__toolbar k2b-content-file-view__code-toolbar\">\n <span class=\"k2b-content-file-view__code-language\">{codeLanguage(props.file.path)}</span>\n <span class=\"k2b-markdown-editor__trailing\">\n <Show when={props.downloadHref}>\n {(href) => (\n <DownloadLink\n class=\"k2b-markdown-editor__tool\"\n href={href()}\n download={props.file.path.slice(props.file.path.lastIndexOf(\"/\") + 1)}\n label={messages().download}\n icon=\"ti ti-download\"\n />\n )}\n </Show>\n <EditorToolButton\n icon={editor().saving() ? \"ti ti-loader-2 k2b-spin\" : \"ti ti-device-floppy\"}\n title={messages().saveShortcut}\n disabled={!editor().dirty() || editor().saving()}\n onClick={() => void editor().save()}\n />\n </span>\n </div>\n <div class=\"k2b-markdown-editor__surface\">\n <textarea\n class=\"k2b-content-file-view__code-input\"\n value={editor().draft()}\n spellcheck={false}\n onInput={(event) => editor().setDraft(event.currentTarget.value)}\n />\n </div>\n </div>\n </div>\n )}\n </Show>\n );\n}\n\nfunction JsonRenderer(props: FileViewRendererProps) {\n const parsed = createMemo(() => {\n try {\n return { ok: true as const, value: JSON.parse(props.content.content) as StructuredDataValue };\n } catch {\n return { ok: false as const };\n }\n });\n const parsedValue = (): StructuredDataValue => {\n const result = parsed();\n return result.ok ? result.value : null;\n };\n\n return (\n <OverlayPanel actions={<DownloadAction {...props} />}>\n <div class=\"k2b-content-file-view__document\">\n <Show when={parsed().ok} fallback={<TextExcerpt renderer={props} text={props.content.content} />}>\n <Show\n when={props.previewLines === undefined}\n fallback={<TextExcerpt renderer={props} text={JSON.stringify(parsedValue(), null, 2)} />}\n >\n <StructuredDataPreview data={parsedValue()} maxRows={200} />\n </Show>\n </Show>\n </div>\n </OverlayPanel>\n );\n}\n\nfunction DelimitedTextRenderer(props: FileViewRendererProps) {\n const messages = useUiMessages();\n const [preferences, setPreferences] = createSignal<DelimitedPreferences>({ encoding: \"utf-8\", delimiter: \"auto\", view: \"table\" });\n onMount(() => {\n if (!props.previewPreferencesKey) return;\n try {\n setPreferences(readDelimitedPreferences(localStorage.getItem(props.previewPreferencesKey)));\n } catch {\n /* Storage may be disabled. */\n }\n });\n const update = (patch: Partial<DelimitedPreferences>) => {\n const next = { ...preferences(), ...patch };\n setPreferences(next);\n if (props.previewPreferencesKey) {\n try {\n localStorage.setItem(props.previewPreferencesKey, JSON.stringify(next));\n } catch {\n /* Keep the local selection. */\n }\n }\n };\n const text = createMemo(() => decodeDelimitedContent(props.content, preferences().encoding));\n const delimiter = () =>\n preferences().delimiter === \"auto\"\n ? fileViewExtension(props.file.path) === \"tsv\" || props.content.mediaType === \"text/tab-separated-values\"\n ? \"\\t\"\n : \",\"\n : preferences().delimiter;\n const [page, setPage] = createSignal(0);\n createEffect(() => {\n text();\n delimiter();\n props.previewLines;\n setPage(0);\n });\n const pageSize = () => (props.previewLines === undefined ? 200 : Math.max(1, props.previewLines));\n const preview = createMemo(() => parseDelimitedText(text(), delimiter(), { rows: pageSize() + 1, offset: page() * pageSize() }));\n const settings = () =>\n prompts.dialog(\n () => (\n <div class=\"k2b-content-file-view__settings\">\n <Select\n label={messages().csvEncoding}\n value={preferences().encoding}\n disabled={props.content.encoding !== \"base64\"}\n options={[\"utf-8\", \"windows-1252\", \"utf-16le\", \"utf-16be\"]}\n onValueChange={(value) => {\n if (value) update({ encoding: value });\n }}\n />\n <Select\n label={messages().csvSeparator}\n value={preferences().delimiter}\n options={[\n { value: \"auto\", label: messages().csvDefaultSeparator },\n { value: \",\", label: messages().csvComma },\n { value: \";\", label: messages().csvSemicolon },\n { value: \"\\t\", label: messages().csvTab },\n { value: \"|\", label: \"|\" },\n ]}\n onValueChange={(value) => {\n if (value) update({ delimiter: value });\n }}\n />\n <Select\n label={messages().csvView}\n value={preferences().view}\n options={[\n { value: \"table\", label: messages().dataTable },\n { value: \"raw\", label: messages().csvRaw },\n ]}\n onValueChange={(value) => {\n if (value === \"table\" || value === \"raw\") update({ view: value });\n }}\n />\n </div>\n ),\n { title: messages().csvSettings },\n );\n const headers = createMemo(() => preview().rows[0] ?? []);\n const rows = createMemo(() => preview().rows.slice(1));\n\n return (\n <OverlayPanel\n actions={\n <>\n <OverlayAction icon=\"ti-adjustments-horizontal\" title={messages().csvSettings} onClick={() => void settings()} />\n <DownloadAction {...props} />\n </>\n }\n >\n <Show when={preferences().view === \"table\"} fallback={<TextExcerpt renderer={props} text={text()} />}>\n <Show\n when={headers().length > 0}\n fallback={<Placeholder icon=\"ti ti-table\" title={messages().emptyFile} description={messages().delimitedFileEmpty} />}\n >\n <div class=\"k2b-content-file-view__sheet\">\n <table class=\"k2b-content-file-view__table\">\n <thead>\n <tr>\n <For each={headers()}>\n {(header, index) => (\n <th scope=\"col\">\n <span>{header || messages().column({ number: index() + 1 })}</span>\n </th>\n )}\n </For>\n </tr>\n </thead>\n <tbody>\n <For each={rows()}>\n {(row) => (\n <tr>\n <For each={headers()}>{(_, index) => <td>{row[index()] ?? \"\"}</td>}</For>\n </tr>\n )}\n </For>\n </tbody>\n </table>\n <Show when={preview().columnsTruncated}>\n <div class=\"k2b-content-file-view__truncated\">{messages().previewColumnsLimited}</div>\n </Show>\n <Show\n when={props.previewLines !== undefined}\n fallback={\n <Show when={preview().totalRows > 201}>\n <div class=\"k2b-content-file-view__pagination\">\n <Button size=\"sm\" variant=\"ghost\" disabled={page() === 0} onClick={() => setPage(page() - 1)}>\n {messages().previous}\n </Button>\n <span>\n {page() * pageSize() + 1}–{Math.min((page() + 1) * pageSize(), preview().totalRows - 1)} / {preview().totalRows - 1}\n </span>\n <Button\n size=\"sm\"\n variant=\"ghost\"\n disabled={(page() + 1) * pageSize() >= preview().totalRows - 1}\n onClick={() => setPage(page() + 1)}\n >\n {messages().next}\n </Button>\n </div>\n </Show>\n }\n >\n <MoreLines count={preview().totalRows - rows().length - 1} onClick={props.onExpandPreview} />\n </Show>\n </div>\n </Show>\n </Show>\n </OverlayPanel>\n );\n}\n\nconst mediaSource = (props: FileViewRendererProps): string =>\n props.previewHref ?? `data:${props.content.mediaType};base64,${props.content.content}`;\n\nfunction ImageRenderer(props: FileViewRendererProps) {\n return (\n <OverlayPanel actions={<DownloadAction {...props} />}>\n <div class=\"k2b-content-file-view__media\">\n <img crossOrigin={props.crossOrigin} onError={props.onPreviewError} src={mediaSource(props)} alt={props.file.path} />\n </div>\n </OverlayPanel>\n );\n}\n\nconst pdfBlob = (content: FileViewContent): Blob => {\n if (content.encoding === \"utf8\") return new Blob([content.content], { type: \"application/pdf\" });\n const binary = atob(content.content);\n const bytes = new Uint8Array(binary.length);\n for (let index = 0; index < binary.length; index += 1) bytes[index] = binary.charCodeAt(index);\n return new Blob([bytes], { type: \"application/pdf\" });\n};\n\n/**\n * A host inline URL goes to the browser's native viewer. Without one, the\n * loaded bytes become a local PDF Blob: a download URL is an attachment and\n * would leave a native viewer empty.\n */\nfunction PdfRenderer(props: FileViewRendererProps) {\n const messages = useUiMessages();\n // A new Blob remounts the preview, so changed bytes show the new file. A revision refetch\n // often returns the same bytes (the Assistant refetches on every tool step); keeping the\n // Blob then keeps the reader's page instead of reloading the viewer.\n const bytes = createMemo(() => props.content, undefined, {\n equals: (previous, next) => previous.encoding === next.encoding && previous.content === next.content,\n });\n const blob = createMemo(() => (props.previewHref || !bytes().content ? null : pdfBlob(bytes())));\n return (\n <Show\n when={props.previewHref}\n fallback={\n <Show\n keyed\n when={blob()}\n fallback={<Placeholder icon=\"ti ti-file-type-pdf\" title=\"PDF\" description={messages().noInlinePreview} />}\n >\n {(pdf) => (\n <PdfPreview\n autoLoad\n title={props.file.path.slice(props.file.path.lastIndexOf(\"/\") + 1)}\n request={async () => pdf}\n class=\"k2b-content-file-view__pdf\"\n />\n )}\n </Show>\n }\n >\n {(href) => <object data={href()} type=\"application/pdf\" class=\"k2b-content-file-view__pdf\" aria-label={props.file.path} />}\n </Show>\n );\n}\n\nfunction AudioRenderer(props: FileViewRendererProps) {\n const messages = useUiMessages();\n return (\n <OverlayPanel actions={<DownloadAction {...props} />}>\n <div class=\"k2b-content-file-view__media\" data-kind=\"audio\">\n <audio\n crossOrigin={props.crossOrigin}\n onError={props.onPreviewError}\n controls\n preload=\"metadata\"\n src={mediaSource(props)}\n aria-label={props.file.path}\n >\n {messages().audioUnsupported}\n </audio>\n </div>\n </OverlayPanel>\n );\n}\n\nfunction VideoRenderer(props: FileViewRendererProps) {\n const messages = useUiMessages();\n return (\n <OverlayPanel actions={<DownloadAction {...props} />}>\n <div class=\"k2b-content-file-view__media\" data-kind=\"video\">\n <video\n crossOrigin={props.crossOrigin}\n onError={props.onPreviewError}\n controls\n preload=\"metadata\"\n playsinline\n src={mediaSource(props)}\n aria-label={props.file.path}\n >\n {messages().videoUnsupported}\n </video>\n </div>\n </OverlayPanel>\n );\n}\n\nfunction BinaryRenderer(props: FileViewRendererProps) {\n const messages = useUiMessages();\n return (\n <Placeholder\n icon=\"ti ti-file-unknown\"\n title={messages().noPreview}\n description={props.content.mediaType || messages().binaryFile}\n action={\n <Show when={props.downloadHref}>\n {(href) => (\n <a class=\"k2b-button\" data-variant=\"secondary\" data-size=\"sm\" href={href()} download=\"\">\n <i class=\"ti ti-download\" aria-hidden=\"true\" />\n {messages().download}\n </a>\n )}\n </Show>\n }\n />\n );\n}\n\nconst BUILTIN_RENDERERS: FileViewRenderer[] = [\n { id: \"markdown\", match: isMarkdown, component: MarkdownRenderer, editable: true },\n {\n id: \"image\",\n match: (file, content) => getFileViewPreviewKind({ ...file, mediaType: content.mediaType || file.mediaType }) === \"image\",\n component: ImageRenderer,\n },\n {\n id: \"pdf\",\n match: (file, content) => getFileViewPreviewKind({ ...file, mediaType: content.mediaType || file.mediaType }) === \"pdf\",\n component: PdfRenderer,\n },\n {\n id: \"json\",\n match: (file, content) =>\n content.encoding === \"utf8\" && getFileViewPreviewKind({ ...file, mediaType: content.mediaType || file.mediaType }) === \"json\",\n component: JsonRenderer,\n },\n {\n id: \"delimited-text\",\n match: (file, content) => getFileViewPreviewKind({ ...file, mediaType: content.mediaType || file.mediaType }) === \"delimited-text\",\n component: DelimitedTextRenderer,\n },\n {\n id: \"audio\",\n match: (file, content) => getFileViewPreviewKind({ ...file, mediaType: content.mediaType || file.mediaType }) === \"audio\",\n component: AudioRenderer,\n },\n {\n id: \"video\",\n match: (file, content) => getFileViewPreviewKind({ ...file, mediaType: content.mediaType || file.mediaType }) === \"video\",\n component: VideoRenderer,\n },\n { id: \"text\", match: (_file, content) => content.encoding === \"utf8\", component: TextRenderer, editable: true },\n { id: \"binary\", match: () => true, component: BinaryRenderer },\n];\n\n// ── Component ───────────────────────────────────────────────────────────────\n\nexport const formatFileViewSize = (bytes: number): string => {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n};\n\nexport default function FileView(props: FileViewProps) {\n const messages = useUiMessages();\n const [draft, setDraft] = createSignal(\"\");\n const [savedDraft, setSavedDraft] = createSignal(\"\");\n const [nativeRevision, setNativeRevision] = createSignal(0);\n const dirty = createMemo(() => draft() !== savedDraft());\n const instanceRenderers = () => props.renderers ?? [];\n const saveMutation = mutation.create<{ path: string; content: string }, { path: string; content: string }>({\n mutation: async (input) => {\n await props.save!(input.content);\n return input;\n },\n onSuccess: (saved) => {\n if (props.file.path === saved.path) setSavedDraft(saved.content);\n toast.success(messages().fileSaved);\n },\n onError: (error) => toast.error(error.message),\n });\n const nativePreviewHref = createMemo(() => {\n const href = props.previewHref;\n if (!href) return null;\n const separator = href.includes(\"?\") ? \"&\" : \"?\";\n return `${href}${separator}preview-revision=${nativeRevision()}`;\n });\n const browserPreviewContent = createMemo<FileViewContent | null>(() => {\n const kind = getFileViewPreviewKind(props.file);\n if (kind !== \"image\" && kind !== \"pdf\" && kind !== \"audio\" && kind !== \"video\") return null;\n const href = nativePreviewHref();\n if (!href) return null;\n\n const candidate: FileViewContent = {\n encoding: \"base64\",\n content: \"\",\n mediaType: props.file.mediaType ?? \"application/octet-stream\",\n };\n return instanceRenderers().some((renderer) => renderer.match(props.file, candidate)) ? null : candidate;\n });\n const [content, { refetch }] = createResource(\n () => (browserPreviewContent() ? null : { path: props.file.path, revision: props.revision }),\n async () => {\n saveMutation.abort();\n // `load` is an imperative source adapter. Host signal reads inside it\n // must not turn this resource into a hidden reactive feedback loop.\n const loaded = await untrack(() => props.load());\n const loadedDraft = loaded.encoding === \"utf8\" ? loaded.content : \"\";\n setDraft(loadedDraft);\n setSavedDraft(loadedDraft);\n return loaded;\n },\n );\n createEffect(() => {\n if (!props.registerRefresh) return;\n const unregister = props.registerRefresh(async () => {\n if (browserPreviewContent()) setNativeRevision((value) => value + 1);\n else await refetch();\n });\n if (unregister) onCleanup(unregister);\n });\n const resolvedContent = createMemo(() => browserPreviewContent() ?? content());\n\n const renderer = createMemo(() => {\n const loaded = resolvedContent();\n if (!loaded) return null;\n return [...instanceRenderers(), ...BUILTIN_RENDERERS].find((candidate) => candidate.match(props.file, loaded)) ?? null;\n });\n\n createEffect(() => {\n props.onDirtyChange?.(dirty());\n });\n\n const save = async () => {\n if (!props.save || saveMutation.loading()) return;\n await saveMutation.mutate({ path: props.file.path, content: draft() });\n };\n\n const editor = () =>\n props.save && renderer()?.editable && resolvedContent()?.encoding === \"utf8\"\n ? {\n draft,\n setDraft,\n dirty,\n saving: saveMutation.loading,\n save,\n }\n : null;\n\n return (\n <div\n class={`k2b-content-file-view ${props.class ?? \"\"}`}\n data-variant={props.variant}\n data-excerpt={props.previewLines !== undefined ? \"true\" : undefined}\n >\n <Switch>\n <Match when={content.loading && content() === undefined}>\n <Placeholder icon=\"ti ti-loader-2\" title={messages().loading} />\n </Match>\n <Match when={content.error}>\n <Placeholder icon=\"ti ti-alert-circle\" title={messages().failedLoadFile} description={String(content.error?.message ?? \"\")} />\n </Match>\n <Match when={resolvedContent() && renderer()}>\n {(active) => {\n const Renderer = active().component;\n return (\n <Renderer\n previewLines={props.previewLines}\n onExpandPreview={props.onExpandPreview}\n headingScale={props.headingScale}\n previewPreferencesKey={props.previewPreferencesKey}\n file={props.file}\n content={resolvedContent()!}\n previewHref={nativePreviewHref()}\n crossOrigin={props.crossOrigin}\n onPreviewError={props.onPreviewError}\n downloadHref={props.downloadHref ?? null}\n editor={editor()}\n />\n );\n }}\n </Match>\n </Switch>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;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AAA;YAAA,IACpC,YAAY;cAAA,OAAE,KAAK,CAAC,YAAY,IAAI,IAAI;YAAA;YAAA,IACxC,MAAM;cAAA,OAAE,MAAM,CAAC,CAAC;YAAA;UAAA;QAGtB;MAAC;IAAA;EAAA;AAKX","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["content/FileView.tsx"],"sourcesContent":["/**\n * FileView — renders one file through a small renderer registry keyed by\n * media type / path. Editing is enabled purely by the presence of `save`;\n * without it every renderer is read-only. IDE-style chrome: editors reuse\n * the markdown editor's surface (toolbar with an in-toolbar save, Ctrl/Cmd+S),\n * previews are quiet paper panels with icon-only actions overlaid top-right.\n * A plain preview drops the panel and sits on its host's surface instead.\n * Custom renderers are passed per instance, which keeps SSR requests and\n * independently mounted applications isolated.\n */\n\nimport { mutation } from \"@k2b/stdlib/solid\";\nimport {\n type Component,\n createContext,\n createEffect,\n createMemo,\n createResource,\n createSignal,\n For,\n type JSX,\n Match,\n onCleanup,\n onMount,\n Show,\n Switch,\n untrack,\n useContext,\n} from \"solid-js\";\nimport { Button } from \"../actions/Button\";\nimport { prompts } from \"../feedback/prompts\";\nimport { Tooltip } from \"../feedback/Tooltip\";\nimport { toast } from \"../feedback/toast\";\nimport { MarkdownEditor } from \"../inputs/markdown/MarkdownEditor\";\nimport { Select } from \"../inputs/Select\";\nimport { useUiMessages } from \"../intl/messages\";\nimport Placeholder from \"../surfaces/Placeholder\";\nimport CodeDisplay, { type CodeDisplayLanguage } from \"./CodeDisplay\";\nimport { type DelimitedPreferences, decodeDelimitedContent, readDelimitedPreferences } from \"./delimited-preferences\";\nimport { type FileViewFile, fileViewExtension, getFileViewPreviewKind, parseDelimitedText } from \"./file-view-preview\";\nimport MarkdownView from \"./MarkdownView\";\nimport { leadingMarkdownTitle } from \"./markdown-title\";\nimport PdfPreview from \"./PdfPreview\";\nimport StructuredDataPreview, { type StructuredDataValue } from \"./StructuredDataPreview\";\n\nexport type { FileViewFile, FileViewPreviewKind } from \"./file-view-preview\";\nexport { canPreviewFile, getFileViewPreviewKind } from \"./file-view-preview\";\nexport type FileViewContent = { encoding: \"utf8\" | \"base64\"; content: string; mediaType: string };\n\nexport type FileViewProps = {\n /**\n * Plain previews inherit the surrounding surface without a frame or inset padding. They keep their natural height,\n * so the host scrolls them and owns the actions around them; a host that stretches one gets its scrolling back.\n */\n variant?: \"default\" | \"plain\";\n /**\n * Lifts a leading Markdown level-one heading into the host, for example a dialog title. Reports its plain text and\n * leaves that heading out of the preview, or reports null when the shown file has none, the heading holds a link or\n * image or is the whole document, or the file fails to load.\n */\n onDocumentTitle?: (title: string | null) => void;\n /** Read-only excerpt limit; omitted renders the complete preview. */\n previewLines?: number;\n onExpandPreview?: () => void;\n headingScale?: \"compact\" | \"normal\" | \"large\";\n /** Optional browser-local preference scope, owned by the host. */\n previewPreferencesKey?: string;\n file: FileViewFile;\n load: () => Promise<FileViewContent>;\n /** Refetch the current path when this host-owned revision changes. */\n revision?: unknown;\n /** Register an awaitable refresh for the currently visible preview. */\n registerRefresh?: (refresh: () => Promise<void>) => void | (() => void);\n /** Presence enables editing for text-based renderers. */\n save?: (content: string) => Promise<void>;\n /** Authenticated inline URL used by browser-native image, PDF, audio, and video previews. */\n previewHref?: string | null;\n /** CORS mode for native image/audio/video previews. Omit to preserve browser defaults. */\n crossOrigin?: \"anonymous\" | \"use-credentials\";\n /** Native media failed to load; the host can renew a signed URL and offer retry. */\n onPreviewError?: () => void;\n /** Download actions only; never a preview source, because an attachment response does not render inline. */\n downloadHref?: string | null;\n /** App-specific renderers matched before the built-ins for this instance. */\n renderers?: readonly FileViewRenderer[];\n /** Reports local edit state so a parent browser can guard navigation. */\n onDirtyChange?: (dirty: boolean) => void;\n class?: string;\n};\n\nexport type FileViewRendererProps = {\n /** Read-only excerpt limit; omitted renders the complete preview. */\n previewLines?: number;\n onExpandPreview?: () => void;\n headingScale?: \"compact\" | \"normal\" | \"large\";\n /** Optional browser-local preference scope, owned by the host. */\n previewPreferencesKey?: string;\n file: FileViewFile;\n content: FileViewContent;\n previewHref: string | null;\n crossOrigin?: \"anonymous\" | \"use-credentials\";\n onPreviewError?: () => void;\n downloadHref: string | null;\n /** Null when the file is read-only. */\n editor: {\n draft: () => string;\n setDraft: (value: string) => void;\n dirty: () => boolean;\n saving: () => boolean;\n save: () => Promise<void>;\n } | null;\n};\n\nexport type FileViewRenderer = {\n id: string;\n match: (file: FileViewFile, content: FileViewContent) => boolean;\n component: Component<FileViewRendererProps>;\n /** Text renderers that support the edit affordance when `save` is present. */\n editable?: boolean;\n};\n\n/** Instance options that reach the built-in renderers without widening the public renderer props. */\nconst FileViewHost = createContext({ plain: false, liftTitle: false });\n\nconst codeLanguage = (path: string): CodeDisplayLanguage => {\n const extension = fileViewExtension(path);\n if (extension === \"ts\" || extension === \"mts\" || extension === \"cts\") return \"ts\";\n if (extension === \"tsx\") return \"tsx\";\n if (extension === \"js\" || extension === \"mjs\" || extension === \"cjs\") return \"js\";\n if (extension === \"jsx\") return \"jsx\";\n if (extension === \"md\" || extension === \"markdown\") return \"md\";\n return \"text\";\n};\n\nconst isMarkdown = (file: FileViewFile, content: FileViewContent) =>\n content.encoding === \"utf8\" && getFileViewPreviewKind({ ...file, mediaType: content.mediaType || file.mediaType }) === \"markdown\";\n\n/** Rendered previews hide a leading YAML frontmatter block — it's metadata, not content. */\nconst stripFrontmatter = (text: string): string => {\n const match = /^---\\r?\\n[\\s\\S]*?\\r?\\n---\\r?\\n?/.exec(text.trimStart());\n return match ? text.trimStart().slice(match[0].length) : text;\n};\n\n/** Icon-only download link with the shared tooltip, for toolbars that style their own controls. */\nfunction DownloadLink(props: { class: string; href: string; download: string; label: string; icon: string }) {\n let link: HTMLAnchorElement | undefined;\n return (\n <>\n <a ref={link} class={props.class} href={props.href} download={props.download} aria-label={props.label}>\n <i class={props.icon} aria-hidden=\"true\" />\n <span class=\"k2b-sr-only\">{props.label}</span>\n </a>\n <Tooltip content={props.label} target={() => link} />\n </>\n );\n}\n\n/** Icon-only action, IDE style — sits in the floating top-right cluster of previews. */\nfunction OverlayAction(props: { icon: string; title: string; onClick?: () => void; href?: string; download?: string }) {\n const classes = \"k2b-content-file-view__action\";\n return (\n <Show\n when={props.href}\n fallback={\n <Tooltip.Trigger type=\"button\" class={classes} content={props.title} aria-label={props.title} onClick={props.onClick}>\n <i class={`ti ${props.icon}`} aria-hidden=\"true\" />\n </Tooltip.Trigger>\n }\n >\n {(href) => (\n <DownloadLink class={classes} href={href()} download={props.download ?? \"\"} label={props.title} icon={`ti ${props.icon}`} />\n )}\n </Show>\n );\n}\n\n/** Scrollable preview panel with the floating action cluster overlaid top-right. */\nfunction OverlayPanel(props: { actions?: JSX.Element; children: JSX.Element }) {\n return (\n <div class=\"k2b-content-file-view__panel\">\n <div class=\"k2b-content-file-view__preview\">{props.children}</div>\n <Show when={props.actions}>\n <div class=\"k2b-content-file-view__overlay\">{props.actions}</div>\n </Show>\n </div>\n );\n}\n\nconst DownloadAction = (props: FileViewRendererProps): JSX.Element => {\n const messages = useUiMessages();\n return (\n <Show when={props.downloadHref}>\n {(href) => (\n <OverlayAction\n icon=\"ti-download\"\n title={messages().download}\n href={href()}\n download={props.file.path.slice(props.file.path.lastIndexOf(\"/\") + 1)}\n />\n )}\n </Show>\n );\n};\n\n/** Toolbar-styled icon button — reuses the package markdown-editor tool primitive. */\nfunction EditorToolButton(props: { icon: string; title: string; onClick: () => void; disabled?: boolean }) {\n return (\n <Tooltip.Trigger\n type=\"button\"\n class=\"k2b-markdown-editor__tool\"\n content={props.title}\n aria-label={props.title}\n tabIndex={-1}\n disabled={props.disabled}\n onMouseDown={(e) => e.preventDefault()}\n onClick={props.onClick}\n >\n <i class={props.icon} aria-hidden=\"true\" />\n </Tooltip.Trigger>\n );\n}\n\n// ── Built-in renderers ──────────────────────────────────────────────────────\n\nfunction MoreLines(props: { count: number; onClick?: () => void }) {\n const messages = useUiMessages();\n return (\n <Show when={props.count > 0}>\n <div class=\"k2b-content-file-view__truncated\">\n <Show when={props.onClick} fallback={<span>{messages().previewMoreLines(props.count)}</span>}>\n <Button size=\"sm\" variant=\"ghost\" onClick={props.onClick}>\n {messages().previewMoreLines(props.count)}\n </Button>\n </Show>\n </div>\n </Show>\n );\n}\nfunction TextExcerpt(props: { renderer: FileViewRendererProps; text: string; markdown?: boolean }) {\n const lines = createMemo(() => props.text.replace(/\\r\\n?/g, \"\\n\").replace(/\\n$/, \"\").split(\"\\n\"));\n const limit = () => (props.renderer.previewLines === undefined ? lines().length : Math.max(1, props.renderer.previewLines));\n const text = () => lines().slice(0, limit()).join(\"\\n\");\n const host = useContext(FileViewHost);\n // A plain preview has no code box: the host frames the file and owns its copy action.\n const content = () => (\n <Show\n when={props.markdown}\n fallback={<CodeDisplay code={text()} language={codeLanguage(props.renderer.file.path)} copy={host.plain ? false : undefined} />}\n >\n <MarkdownView markdown={text()} headingScale={props.renderer.headingScale ?? \"compact\"} />\n </Show>\n );\n // Only an excerpt needs a clipping box; a complete preview keeps its content\n // a direct child of the preview frame, which the frame's styles expect.\n return (\n <>\n <Show when={props.renderer.previewLines !== undefined} fallback={content()}>\n <div class=\"k2b-content-file-view__excerpt\">{content()}</div>\n </Show>\n <MoreLines count={lines().length - limit()} onClick={props.renderer.onExpandPreview} />\n </>\n );\n}\n\nfunction MarkdownRenderer(props: FileViewRendererProps) {\n const messages = useUiMessages();\n const host = useContext(FileViewHost);\n const [editing, setEditing] = createSignal(false);\n const markdown = () => {\n const text = stripFrontmatter(props.editor?.draft() ?? props.content.content);\n return host.liftTitle ? (leadingMarkdownTitle(text)?.body ?? text) : text;\n };\n return (\n <Show\n when={props.editor && editing()}\n fallback={\n <OverlayPanel\n actions={\n <>\n <Show when={props.editor}>\n <OverlayAction icon=\"ti-pencil\" title={messages().edit} onClick={() => setEditing(true)} />\n </Show>\n <DownloadAction {...props} />\n </>\n }\n >\n <div class=\"k2b-content-file-view__document\">\n <TextExcerpt renderer={props} text={markdown()} markdown />\n </div>\n </OverlayPanel>\n }\n >\n {(_) => {\n const editor = props.editor!;\n return (\n <div class=\"k2b-content-file-view__editor\">\n <MarkdownEditor\n class=\"k2b-content-file-view__markdown-field\"\n aria-label={`Edit ${props.file.path.slice(props.file.path.lastIndexOf(\"/\") + 1)}`}\n fill\n value={editor.draft()}\n onValueChange={editor.setDraft}\n showStats={false}\n onSave={() => void editor.save()}\n saveDisabled={!editor.dirty()}\n saving={editor.saving()}\n toolbarTrailing={<EditorToolButton icon=\"ti ti-eye\" title={messages().preview} onClick={() => setEditing(false)} />}\n />\n </div>\n );\n }}\n </Show>\n );\n}\n\nfunction TextRenderer(props: FileViewRendererProps) {\n const messages = useUiMessages();\n return (\n <Show\n when={props.editor}\n fallback={\n <OverlayPanel actions={<DownloadAction {...props} />}>\n <TextExcerpt renderer={props} text={props.content.content} />\n </OverlayPanel>\n }\n >\n {(editor) => (\n // Same chrome as the markdown editor — literally the same classes, so\n // border, radius, focus ring, toolbar height and text metrics cannot drift.\n <div class=\"k2b-content-file-view__editor\">\n <div\n class=\"k2b-markdown-editor\"\n data-fill=\"true\"\n role=\"group\"\n aria-label={messages().textEditor}\n onKeyDown={(event) => {\n if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === \"s\") {\n event.preventDefault();\n if (editor().dirty() && !editor().saving()) void editor().save();\n }\n }}\n >\n {/* No formatting tools here — the divider under an actions-only bar reads lost. */}\n <div class=\"k2b-markdown-editor__toolbar k2b-content-file-view__code-toolbar\">\n <span class=\"k2b-content-file-view__code-language\">{codeLanguage(props.file.path)}</span>\n <span class=\"k2b-markdown-editor__trailing\">\n <Show when={props.downloadHref}>\n {(href) => (\n <DownloadLink\n class=\"k2b-markdown-editor__tool\"\n href={href()}\n download={props.file.path.slice(props.file.path.lastIndexOf(\"/\") + 1)}\n label={messages().download}\n icon=\"ti ti-download\"\n />\n )}\n </Show>\n <EditorToolButton\n icon={editor().saving() ? \"ti ti-loader-2 k2b-spin\" : \"ti ti-device-floppy\"}\n title={messages().saveShortcut}\n disabled={!editor().dirty() || editor().saving()}\n onClick={() => void editor().save()}\n />\n </span>\n </div>\n <div class=\"k2b-markdown-editor__surface\">\n <textarea\n class=\"k2b-content-file-view__code-input\"\n value={editor().draft()}\n spellcheck={false}\n onInput={(event) => editor().setDraft(event.currentTarget.value)}\n />\n </div>\n </div>\n </div>\n )}\n </Show>\n );\n}\n\nfunction JsonRenderer(props: FileViewRendererProps) {\n const parsed = createMemo(() => {\n try {\n return { ok: true as const, value: JSON.parse(props.content.content) as StructuredDataValue };\n } catch {\n return { ok: false as const };\n }\n });\n const parsedValue = (): StructuredDataValue => {\n const result = parsed();\n return result.ok ? result.value : null;\n };\n\n return (\n <OverlayPanel actions={<DownloadAction {...props} />}>\n <div class=\"k2b-content-file-view__document\">\n <Show when={parsed().ok} fallback={<TextExcerpt renderer={props} text={props.content.content} />}>\n <Show\n when={props.previewLines === undefined}\n fallback={<TextExcerpt renderer={props} text={JSON.stringify(parsedValue(), null, 2)} />}\n >\n <StructuredDataPreview data={parsedValue()} maxRows={200} />\n </Show>\n </Show>\n </div>\n </OverlayPanel>\n );\n}\n\nfunction DelimitedTextRenderer(props: FileViewRendererProps) {\n const messages = useUiMessages();\n const [preferences, setPreferences] = createSignal<DelimitedPreferences>({ encoding: \"utf-8\", delimiter: \"auto\", view: \"table\" });\n onMount(() => {\n if (!props.previewPreferencesKey) return;\n try {\n setPreferences(readDelimitedPreferences(localStorage.getItem(props.previewPreferencesKey)));\n } catch {\n /* Storage may be disabled. */\n }\n });\n const update = (patch: Partial<DelimitedPreferences>) => {\n const next = { ...preferences(), ...patch };\n setPreferences(next);\n if (props.previewPreferencesKey) {\n try {\n localStorage.setItem(props.previewPreferencesKey, JSON.stringify(next));\n } catch {\n /* Keep the local selection. */\n }\n }\n };\n const text = createMemo(() => decodeDelimitedContent(props.content, preferences().encoding));\n const delimiter = () =>\n preferences().delimiter === \"auto\"\n ? fileViewExtension(props.file.path) === \"tsv\" || props.content.mediaType === \"text/tab-separated-values\"\n ? \"\\t\"\n : \",\"\n : preferences().delimiter;\n const [page, setPage] = createSignal(0);\n createEffect(() => {\n text();\n delimiter();\n props.previewLines;\n setPage(0);\n });\n const pageSize = () => (props.previewLines === undefined ? 200 : Math.max(1, props.previewLines));\n const preview = createMemo(() => parseDelimitedText(text(), delimiter(), { rows: pageSize() + 1, offset: page() * pageSize() }));\n const settings = () =>\n prompts.dialog(\n () => (\n <div class=\"k2b-content-file-view__settings\">\n <Select\n label={messages().csvEncoding}\n value={preferences().encoding}\n disabled={props.content.encoding !== \"base64\"}\n options={[\"utf-8\", \"windows-1252\", \"utf-16le\", \"utf-16be\"]}\n onValueChange={(value) => {\n if (value) update({ encoding: value });\n }}\n />\n <Select\n label={messages().csvSeparator}\n value={preferences().delimiter}\n options={[\n { value: \"auto\", label: messages().csvDefaultSeparator },\n { value: \",\", label: messages().csvComma },\n { value: \";\", label: messages().csvSemicolon },\n { value: \"\\t\", label: messages().csvTab },\n { value: \"|\", label: \"|\" },\n ]}\n onValueChange={(value) => {\n if (value) update({ delimiter: value });\n }}\n />\n <Select\n label={messages().csvView}\n value={preferences().view}\n options={[\n { value: \"table\", label: messages().dataTable },\n { value: \"raw\", label: messages().csvRaw },\n ]}\n onValueChange={(value) => {\n if (value === \"table\" || value === \"raw\") update({ view: value });\n }}\n />\n </div>\n ),\n { title: messages().csvSettings },\n );\n const headers = createMemo(() => preview().rows[0] ?? []);\n const rows = createMemo(() => preview().rows.slice(1));\n\n return (\n <OverlayPanel\n actions={\n <>\n <OverlayAction icon=\"ti-adjustments-horizontal\" title={messages().csvSettings} onClick={() => void settings()} />\n <DownloadAction {...props} />\n </>\n }\n >\n <Show when={preferences().view === \"table\"} fallback={<TextExcerpt renderer={props} text={text()} />}>\n <Show\n when={headers().length > 0}\n fallback={<Placeholder icon=\"ti ti-table\" title={messages().emptyFile} description={messages().delimitedFileEmpty} />}\n >\n <div class=\"k2b-content-file-view__sheet\">\n <table class=\"k2b-content-file-view__table\">\n <thead>\n <tr>\n <For each={headers()}>\n {(header, index) => (\n <th scope=\"col\">\n <span>{header || messages().column({ number: index() + 1 })}</span>\n </th>\n )}\n </For>\n </tr>\n </thead>\n <tbody>\n <For each={rows()}>\n {(row) => (\n <tr>\n <For each={headers()}>{(_, index) => <td>{row[index()] ?? \"\"}</td>}</For>\n </tr>\n )}\n </For>\n </tbody>\n </table>\n <Show when={preview().columnsTruncated}>\n <div class=\"k2b-content-file-view__truncated\">{messages().previewColumnsLimited}</div>\n </Show>\n <Show\n when={props.previewLines !== undefined}\n fallback={\n <Show when={preview().totalRows > 201}>\n <div class=\"k2b-content-file-view__pagination\">\n <Button size=\"sm\" variant=\"ghost\" disabled={page() === 0} onClick={() => setPage(page() - 1)}>\n {messages().previous}\n </Button>\n <span>\n {page() * pageSize() + 1}–{Math.min((page() + 1) * pageSize(), preview().totalRows - 1)} / {preview().totalRows - 1}\n </span>\n <Button\n size=\"sm\"\n variant=\"ghost\"\n disabled={(page() + 1) * pageSize() >= preview().totalRows - 1}\n onClick={() => setPage(page() + 1)}\n >\n {messages().next}\n </Button>\n </div>\n </Show>\n }\n >\n <MoreLines count={preview().totalRows - rows().length - 1} onClick={props.onExpandPreview} />\n </Show>\n </div>\n </Show>\n </Show>\n </OverlayPanel>\n );\n}\n\nconst mediaSource = (props: FileViewRendererProps): string =>\n props.previewHref ?? `data:${props.content.mediaType};base64,${props.content.content}`;\n\nfunction ImageRenderer(props: FileViewRendererProps) {\n return (\n <OverlayPanel actions={<DownloadAction {...props} />}>\n <div class=\"k2b-content-file-view__media\">\n <img crossOrigin={props.crossOrigin} onError={props.onPreviewError} src={mediaSource(props)} alt={props.file.path} />\n </div>\n </OverlayPanel>\n );\n}\n\nconst pdfBlob = (content: FileViewContent): Blob => {\n if (content.encoding === \"utf8\") return new Blob([content.content], { type: \"application/pdf\" });\n const binary = atob(content.content);\n const bytes = new Uint8Array(binary.length);\n for (let index = 0; index < binary.length; index += 1) bytes[index] = binary.charCodeAt(index);\n return new Blob([bytes], { type: \"application/pdf\" });\n};\n\n/**\n * A host inline URL goes to the browser's native viewer. Without one, the\n * loaded bytes become a local PDF Blob: a download URL is an attachment and\n * would leave a native viewer empty.\n */\nfunction PdfRenderer(props: FileViewRendererProps) {\n const messages = useUiMessages();\n // A new Blob remounts the preview, so changed bytes show the new file. A revision refetch\n // often returns the same bytes (the Assistant refetches on every tool step); keeping the\n // Blob then keeps the reader's page instead of reloading the viewer.\n const bytes = createMemo(() => props.content, undefined, {\n equals: (previous, next) => previous.encoding === next.encoding && previous.content === next.content,\n });\n const blob = createMemo(() => (props.previewHref || !bytes().content ? null : pdfBlob(bytes())));\n return (\n <Show\n when={props.previewHref}\n fallback={\n <Show\n keyed\n when={blob()}\n fallback={<Placeholder icon=\"ti ti-file-type-pdf\" title=\"PDF\" description={messages().noInlinePreview} />}\n >\n {(pdf) => (\n // Composed without the standalone heading: the host already names the file, and the frame keeps the\n // file name as its accessible title.\n <PdfPreview autoLoad title={props.file.path.slice(props.file.path.lastIndexOf(\"/\") + 1)} request={async () => pdf}>\n {(parts) => (\n <div class=\"k2b-content-file-view__pdf-viewer\">\n {parts.actions}\n {parts.content}\n </div>\n )}\n </PdfPreview>\n )}\n </Show>\n }\n >\n {(href) => <object data={href()} type=\"application/pdf\" class=\"k2b-content-file-view__pdf\" aria-label={props.file.path} />}\n </Show>\n );\n}\n\nfunction AudioRenderer(props: FileViewRendererProps) {\n const messages = useUiMessages();\n return (\n <OverlayPanel actions={<DownloadAction {...props} />}>\n <div class=\"k2b-content-file-view__media\" data-kind=\"audio\">\n <audio\n crossOrigin={props.crossOrigin}\n onError={props.onPreviewError}\n controls\n preload=\"metadata\"\n src={mediaSource(props)}\n aria-label={props.file.path}\n >\n {messages().audioUnsupported}\n </audio>\n </div>\n </OverlayPanel>\n );\n}\n\nfunction VideoRenderer(props: FileViewRendererProps) {\n const messages = useUiMessages();\n return (\n <OverlayPanel actions={<DownloadAction {...props} />}>\n <div class=\"k2b-content-file-view__media\" data-kind=\"video\">\n <video\n crossOrigin={props.crossOrigin}\n onError={props.onPreviewError}\n controls\n preload=\"metadata\"\n playsinline\n src={mediaSource(props)}\n aria-label={props.file.path}\n >\n {messages().videoUnsupported}\n </video>\n </div>\n </OverlayPanel>\n );\n}\n\nfunction BinaryRenderer(props: FileViewRendererProps) {\n const messages = useUiMessages();\n return (\n <Placeholder\n icon=\"ti ti-file-unknown\"\n title={messages().noPreview}\n description={props.content.mediaType || messages().binaryFile}\n action={\n <Show when={props.downloadHref}>\n {(href) => (\n <a class=\"k2b-button\" data-variant=\"secondary\" data-size=\"sm\" href={href()} download=\"\">\n <i class=\"ti ti-download\" aria-hidden=\"true\" />\n {messages().download}\n </a>\n )}\n </Show>\n }\n />\n );\n}\n\nconst BUILTIN_RENDERERS: FileViewRenderer[] = [\n { id: \"markdown\", match: isMarkdown, component: MarkdownRenderer, editable: true },\n {\n id: \"image\",\n match: (file, content) => getFileViewPreviewKind({ ...file, mediaType: content.mediaType || file.mediaType }) === \"image\",\n component: ImageRenderer,\n },\n {\n id: \"pdf\",\n match: (file, content) => getFileViewPreviewKind({ ...file, mediaType: content.mediaType || file.mediaType }) === \"pdf\",\n component: PdfRenderer,\n },\n {\n id: \"json\",\n match: (file, content) =>\n content.encoding === \"utf8\" && getFileViewPreviewKind({ ...file, mediaType: content.mediaType || file.mediaType }) === \"json\",\n component: JsonRenderer,\n },\n {\n id: \"delimited-text\",\n match: (file, content) => getFileViewPreviewKind({ ...file, mediaType: content.mediaType || file.mediaType }) === \"delimited-text\",\n component: DelimitedTextRenderer,\n },\n {\n id: \"audio\",\n match: (file, content) => getFileViewPreviewKind({ ...file, mediaType: content.mediaType || file.mediaType }) === \"audio\",\n component: AudioRenderer,\n },\n {\n id: \"video\",\n match: (file, content) => getFileViewPreviewKind({ ...file, mediaType: content.mediaType || file.mediaType }) === \"video\",\n component: VideoRenderer,\n },\n { id: \"text\", match: (_file, content) => content.encoding === \"utf8\", component: TextRenderer, editable: true },\n { id: \"binary\", match: () => true, component: BinaryRenderer },\n];\n\n// ── Component ───────────────────────────────────────────────────────────────\n\nexport const formatFileViewSize = (bytes: number): string => {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n};\n\nexport default function FileView(props: FileViewProps) {\n const messages = useUiMessages();\n const [draft, setDraft] = createSignal(\"\");\n const [savedDraft, setSavedDraft] = createSignal(\"\");\n const [nativeRevision, setNativeRevision] = createSignal(0);\n const dirty = createMemo(() => draft() !== savedDraft());\n const instanceRenderers = () => props.renderers ?? [];\n const saveMutation = mutation.create<{ path: string; content: string }, { path: string; content: string }>({\n mutation: async (input) => {\n await props.save!(input.content);\n return input;\n },\n onSuccess: (saved) => {\n if (props.file.path === saved.path) setSavedDraft(saved.content);\n toast.success(messages().fileSaved);\n },\n onError: (error) => toast.error(error.message),\n });\n const nativePreviewHref = createMemo(() => {\n const href = props.previewHref;\n if (!href) return null;\n const separator = href.includes(\"?\") ? \"&\" : \"?\";\n return `${href}${separator}preview-revision=${nativeRevision()}`;\n });\n const browserPreviewContent = createMemo<FileViewContent | null>(() => {\n const kind = getFileViewPreviewKind(props.file);\n if (kind !== \"image\" && kind !== \"pdf\" && kind !== \"audio\" && kind !== \"video\") return null;\n const href = nativePreviewHref();\n if (!href) return null;\n\n const candidate: FileViewContent = {\n encoding: \"base64\",\n content: \"\",\n mediaType: props.file.mediaType ?? \"application/octet-stream\",\n };\n return instanceRenderers().some((renderer) => renderer.match(props.file, candidate)) ? null : candidate;\n });\n const [content, { refetch }] = createResource(\n () => (browserPreviewContent() ? null : { path: props.file.path, revision: props.revision }),\n async () => {\n saveMutation.abort();\n // `load` is an imperative source adapter. Host signal reads inside it\n // must not turn this resource into a hidden reactive feedback loop.\n const loaded = await untrack(() => props.load());\n const loadedDraft = loaded.encoding === \"utf8\" ? loaded.content : \"\";\n setDraft(loadedDraft);\n setSavedDraft(loadedDraft);\n return loaded;\n },\n );\n createEffect(() => {\n if (!props.registerRefresh) return;\n const unregister = props.registerRefresh(async () => {\n if (browserPreviewContent()) setNativeRevision((value) => value + 1);\n else await refetch();\n });\n if (unregister) onCleanup(unregister);\n });\n // An errored resource throws when read; the error state below shows it instead.\n const resolvedContent = createMemo(() => browserPreviewContent() ?? (content.error ? undefined : content()));\n\n const renderer = createMemo(() => {\n const loaded = resolvedContent();\n if (!loaded) return null;\n return [...instanceRenderers(), ...BUILTIN_RENDERERS].find((candidate) => candidate.match(props.file, loaded)) ?? null;\n });\n\n createEffect(() => {\n props.onDirtyChange?.(dirty());\n });\n\n const save = async () => {\n if (!props.save || saveMutation.loading()) return;\n await saveMutation.mutate({ path: props.file.path, content: draft() });\n };\n\n const editor = () =>\n props.save && renderer()?.editable && resolvedContent()?.encoding === \"utf8\"\n ? {\n draft,\n setDraft,\n dirty,\n saving: saveMutation.loading,\n save,\n }\n : null;\n\n // Undefined while loading; the host keeps its own placeholder until the shown file decides.\n const documentTitle = createMemo<string | null | undefined>(() => {\n if (!props.onDocumentTitle) return undefined;\n if (content.error) return null;\n const loaded = resolvedContent();\n if (!loaded) return undefined;\n if (renderer()?.component !== MarkdownRenderer) return null;\n return leadingMarkdownTitle(stripFrontmatter(editor()?.draft() ?? loaded.content))?.title ?? null;\n });\n createEffect(() => {\n const title = documentTitle();\n if (title !== undefined) props.onDocumentTitle?.(title);\n });\n\n return (\n <div\n class={`k2b-content-file-view ${props.class ?? \"\"}`}\n data-variant={props.variant}\n data-excerpt={props.previewLines !== undefined ? \"true\" : undefined}\n >\n <FileViewHost.Provider\n value={{\n get plain() {\n return props.variant === \"plain\";\n },\n get liftTitle() {\n return Boolean(props.onDocumentTitle);\n },\n }}\n >\n <Switch>\n <Match when={content.loading && content() === undefined}>\n <Placeholder icon=\"ti ti-loader-2\" title={messages().loading} />\n </Match>\n <Match when={content.error}>\n <Placeholder icon=\"ti ti-alert-circle\" title={messages().failedLoadFile} description={String(content.error?.message ?? \"\")} />\n </Match>\n <Match when={resolvedContent() && renderer()}>\n {(active) => {\n const Renderer = active().component;\n return (\n <Renderer\n previewLines={props.previewLines}\n onExpandPreview={props.onExpandPreview}\n headingScale={props.headingScale}\n previewPreferencesKey={props.previewPreferencesKey}\n file={props.file}\n content={resolvedContent()!}\n previewHref={nativePreviewHref()}\n crossOrigin={props.crossOrigin}\n onPreviewError={props.onPreviewError}\n downloadHref={props.downloadHref ?? null}\n editor={editor()}\n />\n );\n }}\n </Match>\n </Switch>\n </FileViewHost.Provider>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,QAAQ,QAAQ,mBAAmB;AAC5C,SAEE,aAAa,EACb,YAAY,EACZ,UAAU,EACV,cAAc,EACd,YAAY,EACZ,GAAG,EAEH,KAAK,EACL,SAAS,EACT,OAAO,EACP,IAAI,EACJ,MAAM,EACN,OAAO,EACP,UAAU,QACL,UAAU;AACjB,SAAS,MAAM,QAAQ,mBAAmB;AAC1C,SAAS,OAAO,QAAQ,qBAAqB;AAC7C,SAAS,OAAO,QAAQ,qBAAqB;AAC7C,SAAS,KAAK,QAAQ,mBAAmB;AACzC,SAAS,cAAc,QAAQ,mCAAmC;AAClE,SAAS,MAAM,QAAQ,kBAAkB;AACzC,SAAS,aAAa,QAAQ,kBAAkB;AAChD,OAAO,WAAW,MAAM,yBAAyB;AACjD,OAAO,WAAW,MAAoC,eAAe;AACrE,SAAoC,sBAAsB,EAAE,wBAAwB,QAAQ,yBAAyB;AACrH,SAA4B,iBAAiB,EAAE,sBAAsB,EAAE,kBAAkB,QAAQ,qBAAqB;AACtH,OAAO,YAAY,MAAM,gBAAgB;AACzC,SAAS,oBAAoB,QAAQ,kBAAkB;AACvD,OAAO,UAAU,MAAM,cAAc;AACrC,OAAO,qBAAqB,MAAoC,yBAAyB;AAGzF,SAAS,cAAc,EAAE,sBAAsB,QAAQ,qBAAqB;AA2E5E;AACA,MAAM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
nbsp: " "
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/** The rendered heading turns entities into characters; the plain-text title does the same. */
|
|
12
|
+
const decodeEntities = text => text.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi, (match, name) => {
|
|
13
|
+
if (!name.startsWith("#")) return NAMED_ENTITIES[name.toLowerCase()] ?? match;
|
|
14
|
+
const code = name[1] === "x" || name[1] === "X" ? Number.parseInt(name.slice(2), 16) : Number.parseInt(name.slice(1), 10);
|
|
15
|
+
return code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : match;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/** Visible text of inline tokens: link and emphasis text, code text, image alt text, and escaped raw HTML as written. */
|
|
19
|
+
const plainText = tokens => tokens.map(token => {
|
|
20
|
+
if ("tokens" in token && token.tokens) return plainText(token.tokens);
|
|
21
|
+
if (token.type === "br") return " ";
|
|
22
|
+
return "text" in token && typeof token.text === "string" ? token.text : "";
|
|
23
|
+
}).join("");
|
|
24
|
+
|
|
25
|
+
/** Links and images would lose their target or picture in a plain-text title. */
|
|
26
|
+
const hasLinkOrImage = tokens => tokens.some(token => token.type === "link" || token.type === "image" || "tokens" in token && !!token.tokens && hasLinkOrImage(token.tokens));
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The document title of Markdown that starts with a level-one heading: its plain text, and the Markdown after it.
|
|
30
|
+
* Null when the first block is anything else, the heading has no text or holds a link or image, or nothing follows
|
|
31
|
+
* it; the heading then stays in the document.
|
|
32
|
+
*/
|
|
33
|
+
export function leadingMarkdownTitle(markdown) {
|
|
34
|
+
const source = markdown.replace(/\r\n?/g, "\n");
|
|
35
|
+
let offset = 0;
|
|
36
|
+
for (const token of marked.lexer(source)) {
|
|
37
|
+
if (token.type === "space") {
|
|
38
|
+
offset += token.raw.length;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (token.type !== "heading" || token.depth !== 1 || !source.startsWith(token.raw, offset)) return null;
|
|
42
|
+
const body = source.slice(offset + token.raw.length);
|
|
43
|
+
if (hasLinkOrImage(token.tokens ?? []) || !body.trim()) return null;
|
|
44
|
+
const title = decodeEntities(plainText(token.tokens ?? [])).replace(/\s+/g, " ").trim();
|
|
45
|
+
return title ? {
|
|
46
|
+
title,
|
|
47
|
+
body
|
|
48
|
+
} : null;
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=markdown-title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["content/markdown-title.ts"],"sourcesContent":["import { marked, type Token } from \"marked\";\n\nconst NAMED_ENTITIES: Record<string, string> = { amp: \"&\", lt: \"<\", gt: \">\", quot: '\"', apos: \"'\", nbsp: \" \" };\n\n/** The rendered heading turns entities into characters; the plain-text title does the same. */\nconst decodeEntities = (text: string): string =>\n text.replace(/&(#x[0-9a-f]+|#\\d+|[a-z]+);/gi, (match, name: string) => {\n if (!name.startsWith(\"#\")) return NAMED_ENTITIES[name.toLowerCase()] ?? match;\n const code = name[1] === \"x\" || name[1] === \"X\" ? Number.parseInt(name.slice(2), 16) : Number.parseInt(name.slice(1), 10);\n return code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : match;\n });\n\n/** Visible text of inline tokens: link and emphasis text, code text, image alt text, and escaped raw HTML as written. */\nconst plainText = (tokens: readonly Token[]): string =>\n tokens\n .map((token) => {\n if (\"tokens\" in token && token.tokens) return plainText(token.tokens);\n if (token.type === \"br\") return \" \";\n return \"text\" in token && typeof token.text === \"string\" ? token.text : \"\";\n })\n .join(\"\");\n\n/** Links and images would lose their target or picture in a plain-text title. */\nconst hasLinkOrImage = (tokens: readonly Token[]): boolean =>\n tokens.some(\n (token) => token.type === \"link\" || token.type === \"image\" || (\"tokens\" in token && !!token.tokens && hasLinkOrImage(token.tokens)),\n );\n\n/**\n * The document title of Markdown that starts with a level-one heading: its plain text, and the Markdown after it.\n * Null when the first block is anything else, the heading has no text or holds a link or image, or nothing follows\n * it; the heading then stays in the document.\n */\nexport function leadingMarkdownTitle(markdown: string): { title: string; body: string } | null {\n const source = markdown.replace(/\\r\\n?/g, \"\\n\");\n let offset = 0;\n for (const token of marked.lexer(source)) {\n if (token.type === \"space\") {\n offset += token.raw.length;\n continue;\n }\n if (token.type !== \"heading\" || token.depth !== 1 || !source.startsWith(token.raw, offset)) return null;\n const body = source.slice(offset + token.raw.length);\n if (hasLinkOrImage(token.tokens ?? []) || !body.trim()) return null;\n const title = decodeEntities(plainText(token.tokens ?? []))\n .replace(/\\s+/g, \" \")\n .trim();\n return title ? { title, body } : null;\n }\n return null;\n}\n"],"mappings":"AAAA,SAAS,MAAM,QAAoB,QAAQ;AAE3C,MAAM,cAAsC,GAAG;EAAE,GAAG,EAAE,GAAG;EAAE,EAAE,EAAE,GAAG;EAAE,EAAE,EAAE,GAAG;EAAE,IAAI,EAAE,GAAG;EAAE,IAAI,EAAE,GAAG;EAAE,IAAI,EAAE;AAAI,CAAC;;AAE9G;AACA,MAAM,cAAc,GAAI,IAAY,IAClC,IAAI,CAAC,OAAO,CAAC,+BAA+B,EAAE,CAAC,KAAK,EAAE,IAAY,KAAK;EACrE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,OAAO,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,KAAK;EAC7E,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;EACzH,OAAO,IAAI,GAAG,CAAC,IAAI,IAAI,IAAI,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAC,IAAI,CA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I,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;IACpD,IAAI,cAAc,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,IAAI;IACnE,MAAM,KAAK,GAAG,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CACxD,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CACpB,IAAI,CAAC,CAAC;IACT,OAAO,KAAK,GAAG;MAAE,KAAK;MAAE;IAAK,CAAC,GAAG,IAAI;EACvC;EACA,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["feedback/index.ts"],"sourcesContent":["export type { DialogClose, DialogCore, DialogRender, OpenDialogOptions } from \"./dialog-core\";\nexport { dialogCore } from \"./dialog-core\";\nexport type { HoverPreviewController, HoverPreviewOptions, HoverPreviewPlacement, HoverPreviewProps } from \"./HoverPreview\";\nexport { createHoverPreview, HoverPreview } from \"./HoverPreview\";\nexport type { InlineGuidanceProps } from \"./InlineGuidance\";\nexport { default as InlineGuidance } from \"./InlineGuidance\";\nexport type {\n ConfirmOptions,\n DialogOptions,\n FieldSchema,\n PromptFieldBase,\n PromptSearchInput,\n PromptSearchItem,\n PromptSearchOptions,\n} from \"./prompts\";\nexport { createFormState, DialogHeader, prompts } from \"./prompts\";\nexport type { TooltipAnchorProps, TooltipPlacement, TooltipProps, TooltipTriggerProps } from \"./Tooltip\";\nexport { Tooltip } from \"./Tooltip\";\nexport type { ToastAction, ToastFn, ToastHandle, ToastOptions, ToastVariant } from \"./toast\";\nexport { isPointInsideToast, toast } from \"./toast\";\n"],"mappings":"AACA,SAAS,UAAU,QAAQ,eAAe;AAE1C,SAAS,kBAAkB,EAAE,YAAY,QAAQ,gBAAgB;AAEjE,SAAS,OAAO,IAAI,cAAc,QAAQ,kBAAkB;AAU5D,SAAS,eAAe,EAAE,YAAY,EAAE,OAAO,QAAQ,WAAW;AAElE,SAAS,OAAO,QAAQ,WAAW;AAEnC,SAAS,kBAAkB,EAAE,KAAK,QAAQ,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["feedback/index.ts"],"sourcesContent":["export type { DialogClose, DialogCore, DialogRender, OpenDialogOptions } from \"./dialog-core\";\nexport { dialogCore } from \"./dialog-core\";\nexport type { HoverPreviewController, HoverPreviewOptions, HoverPreviewPlacement, HoverPreviewProps } from \"./HoverPreview\";\nexport { createHoverPreview, HoverPreview } from \"./HoverPreview\";\nexport type { InlineGuidanceProps } from \"./InlineGuidance\";\nexport { default as InlineGuidance } from \"./InlineGuidance\";\nexport type {\n ConfirmOptions,\n DialogOptions,\n FieldSchema,\n PromptFieldBase,\n PromptSearchInput,\n PromptSearchItem,\n PromptSearchOptions,\n} from \"./prompts\";\nexport { createFormState, DialogHeader, prompts } from \"./prompts\";\nexport type { TooltipAnchorProps, TooltipPlacement, TooltipProps, TooltipTriggerProps } from \"./Tooltip\";\nexport { Tooltip } from \"./Tooltip\";\nexport type { ToastAction, ToastFn, ToastHandle, ToastOptions, ToastSlot, ToastVariant } from \"./toast\";\nexport { isPointInsideToast, toast } from \"./toast\";\n"],"mappings":"AACA,SAAS,UAAU,QAAQ,eAAe;AAE1C,SAAS,kBAAkB,EAAE,YAAY,QAAQ,gBAAgB;AAEjE,SAAS,OAAO,IAAI,cAAc,QAAQ,kBAAkB;AAU5D,SAAS,eAAe,EAAE,YAAY,EAAE,OAAO,QAAQ,WAAW;AAElE,SAAS,OAAO,QAAQ,WAAW;AAEnC,SAAS,kBAAkB,EAAE,KAAK,QAAQ,SAAS","ignoreList":[]}
|
|
@@ -27,7 +27,7 @@ var _tmpl$ = ["<header class=\"k2b-dialog__header\">", "", "<button type=\"butto
|
|
|
27
27
|
_tmpl$19 = ["<div class=\"k2b-dialog__panel\">", "<div class=\"k2b-dialog__body\">", "</div><footer class=\"k2b-dialog__actions\"><button type=\"button\" class=\"k2b-button\" data-variant=\"secondary\">", "</button><button type=\"button\" class=\"k2b-button\"", ">", "</button></footer></div>"],
|
|
28
28
|
_tmpl$20 = ["<form class=\"k2b-dialog__panel\">", "<div class=\"k2b-dialog__body k2b-prompt-form\"><div class=\"k2b-prompt-copy\">", "</div>", "</div><footer class=\"k2b-dialog__actions\"><button type=\"button\" class=\"k2b-button\" data-variant=\"secondary\">", "</button><button type=\"submit\" class=\"k2b-button\"", "", ">", "</button></footer></form>"],
|
|
29
29
|
_tmpl$21 = ["<code class=\"k2b-confirmation-phrase\">", "</code>"],
|
|
30
|
-
_tmpl$22 = ["<div class=\"k2b-dialog__panel k2b-dialog__stack\">", "", "</div>"],
|
|
30
|
+
_tmpl$22 = ["<div class=\"k2b-dialog__panel k2b-dialog__stack\">", "<div class=\"k2b-dialog__content\">", "</div></div>"],
|
|
31
31
|
_tmpl$23 = ["<div class=\"k2b-dialog__panel\">", "<div class=\"k2b-dialog__body\">", "</div><footer class=\"k2b-dialog__actions\"><button type=\"button\" class=\"k2b-button\">", "</button></footer></div>"];
|
|
32
32
|
import { mutation, timed } from "@k2b/stdlib/solid";
|
|
33
33
|
import { createEffect, createMemo, createSignal, createUniqueId, For, onCleanup, Show } from "solid-js";
|