@k2b/ui 0.10.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.
Files changed (83) hide show
  1. package/dist/browser/content/FileView.js +203 -136
  2. package/dist/browser/content/FileView.js.map +1 -1
  3. package/dist/browser/content/markdown-title.js +52 -0
  4. package/dist/browser/content/markdown-title.js.map +1 -0
  5. package/dist/browser/feedback/HoverPreview.js +6 -6
  6. package/dist/browser/feedback/HoverPreview.js.map +1 -1
  7. package/dist/browser/feedback/index.js.map +1 -1
  8. package/dist/browser/feedback/prompts.js +18 -19
  9. package/dist/browser/feedback/prompts.js.map +1 -1
  10. package/dist/browser/feedback/toast.js +363 -122
  11. package/dist/browser/feedback/toast.js.map +1 -1
  12. package/dist/browser/inputs/DatePicker.js +263 -222
  13. package/dist/browser/inputs/DatePicker.js.map +1 -1
  14. package/dist/browser/inputs/MultiSelectInput.js +139 -105
  15. package/dist/browser/inputs/MultiSelectInput.js.map +1 -1
  16. package/dist/browser/inputs/NumberInput.js +209 -122
  17. package/dist/browser/inputs/NumberInput.js.map +1 -1
  18. package/dist/browser/inputs/Select.js +184 -92
  19. package/dist/browser/inputs/Select.js.map +1 -1
  20. package/dist/browser/inputs/index.js.map +1 -1
  21. package/dist/browser/intl/messages.js +4 -0
  22. package/dist/browser/intl/messages.js.map +1 -1
  23. package/dist/browser/layout/AppWorkspace.js +105 -77
  24. package/dist/browser/layout/AppWorkspace.js.map +1 -1
  25. package/dist/browser/layout/DetailPanel.js +2 -1
  26. package/dist/browser/layout/DetailPanel.js.map +1 -1
  27. package/dist/browser/layout/Navigation.js +1 -0
  28. package/dist/browser/layout/Navigation.js.map +1 -1
  29. package/dist/browser/layout/PanelDialog.js +1 -0
  30. package/dist/browser/layout/PanelDialog.js.map +1 -1
  31. package/dist/browser/layout/Settings.js +2 -2
  32. package/dist/browser/layout/Settings.js.map +1 -1
  33. package/dist/browser/layout/app-workspace-controller.js +30 -2
  34. package/dist/browser/layout/app-workspace-controller.js.map +1 -1
  35. package/dist/ssr/content/FileView.js +141 -81
  36. package/dist/ssr/content/FileView.js.map +1 -1
  37. package/dist/ssr/content/markdown-title.js +52 -0
  38. package/dist/ssr/content/markdown-title.js.map +1 -0
  39. package/dist/ssr/feedback/HoverPreview.js +6 -6
  40. package/dist/ssr/feedback/HoverPreview.js.map +1 -1
  41. package/dist/ssr/feedback/index.js.map +1 -1
  42. package/dist/ssr/feedback/prompts.js +1 -1
  43. package/dist/ssr/feedback/prompts.js.map +1 -1
  44. package/dist/ssr/feedback/toast.js +363 -122
  45. package/dist/ssr/feedback/toast.js.map +1 -1
  46. package/dist/ssr/inputs/DatePicker.js +78 -52
  47. package/dist/ssr/inputs/DatePicker.js.map +1 -1
  48. package/dist/ssr/inputs/MultiSelectInput.js +52 -32
  49. package/dist/ssr/inputs/MultiSelectInput.js.map +1 -1
  50. package/dist/ssr/inputs/NumberInput.js +93 -40
  51. package/dist/ssr/inputs/NumberInput.js.map +1 -1
  52. package/dist/ssr/inputs/Select.js +108 -29
  53. package/dist/ssr/inputs/Select.js.map +1 -1
  54. package/dist/ssr/inputs/index.js.map +1 -1
  55. package/dist/ssr/intl/messages.js +4 -0
  56. package/dist/ssr/intl/messages.js.map +1 -1
  57. package/dist/ssr/layout/AppWorkspace.js +84 -66
  58. package/dist/ssr/layout/AppWorkspace.js.map +1 -1
  59. package/dist/ssr/layout/DetailPanel.js +2 -1
  60. package/dist/ssr/layout/DetailPanel.js.map +1 -1
  61. package/dist/ssr/layout/Navigation.js +1 -0
  62. package/dist/ssr/layout/Navigation.js.map +1 -1
  63. package/dist/ssr/layout/PanelDialog.js +1 -0
  64. package/dist/ssr/layout/PanelDialog.js.map +1 -1
  65. package/dist/ssr/layout/Settings.js +2 -2
  66. package/dist/ssr/layout/Settings.js.map +1 -1
  67. package/dist/ssr/layout/app-workspace-controller.js +30 -2
  68. package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
  69. package/dist/styles.css +1 -1
  70. package/dist/types/content/FileView.d.ts +11 -1
  71. package/dist/types/content/markdown-title.d.ts +9 -0
  72. package/dist/types/feedback/index.d.ts +1 -1
  73. package/dist/types/feedback/toast.d.ts +7 -0
  74. package/dist/types/inputs/DatePicker.d.ts +11 -2
  75. package/dist/types/inputs/MultiSelectInput.d.ts +5 -1
  76. package/dist/types/inputs/NumberInput.d.ts +14 -0
  77. package/dist/types/inputs/Select.d.ts +10 -0
  78. package/dist/types/inputs/index.d.ts +1 -1
  79. package/dist/types/intl/messages.d.ts +2 -0
  80. package/dist/types/layout/AppWorkspace.d.ts +14 -0
  81. package/dist/types/layout/Settings.d.ts +2 -2
  82. package/dist/types/layout/app-workspace-controller.d.ts +5 -0
  83. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["layout/app-workspace-controller.ts"],"sourcesContent":["import {\n APP_WORKSPACE_DETAIL_MAX,\n APP_WORKSPACE_DETAIL_MIN,\n APP_WORKSPACE_DRAWER_MAX,\n APP_WORKSPACE_DRAWER_MIN,\n APP_WORKSPACE_MAIN_MIN,\n APP_WORKSPACE_PANE_MAX,\n APP_WORKSPACE_PANE_MIN,\n APP_WORKSPACE_SIDEBAR_COLLAPSED,\n APP_WORKSPACE_SIDEBAR_MAX,\n APP_WORKSPACE_SIDEBAR_MIN,\n type AppWorkspaceLayoutState,\n type AppWorkspaceResizeKind,\n appWorkspacePanelVariable,\n appWorkspaceResizeLimits,\n fitAppWorkspacePaneSizes,\n normalizeAppWorkspaceLayoutState,\n resolveAppWorkspaceSidebarWidth,\n safeAppWorkspacePanelId,\n shouldCollapseAppWorkspaceSidebar,\n} from \"./app-workspace-state\";\nimport { installScrollFades } from \"./scroll-fade\";\n\nexport type AppWorkspaceControllerOptions = {\n root?: Document | HTMLElement;\n readState?: () => AppWorkspaceLayoutState | null | undefined;\n writeState?: (state: AppWorkspaceLayoutState) => void;\n};\n\ntype ActiveResize = {\n handle: HTMLElement;\n root: HTMLElement;\n kind: AppWorkspaceResizeKind;\n pointerId: number;\n startClient: number;\n startSize: number;\n liveSize: number;\n moved: boolean;\n direction: 1 | -1;\n previousUserSelect: string;\n};\n\nconst HANDLE_SELECTOR = \"[data-app-workspace-resize]\";\nconst ROOT_SELECTOR = \"[data-k2b-app-workspace]\";\nconst LAYOUT_REGION_SELECTOR = [\n ROOT_SELECTOR,\n \".k2b-app-workspace__sidebar\",\n \".k2b-app-workspace__main-pane\",\n \".k2b-app-workspace__detail\",\n \".k2b-app-workspace__drawer\",\n HANDLE_SELECTOR,\n].join(\",\");\nconst LABEL_SELECTOR = \".k2b-app-workspace__sidebar-item-label[data-marquee='true']\";\nconst LABEL_TEXT_SELECTOR = \".k2b-app-workspace__sidebar-item-label-text\";\nconst ITEM_SELECTOR = \".k2b-app-workspace__sidebar-item\";\nconst clamp = (value: number, min: number, max: number) => Math.round(Math.min(max, Math.max(min, value)));\nconst eventElement = (event: Event) => (event.target instanceof Element ? event.target : null);\nconst resizeHandle = (event: Event) => eventElement(event)?.closest<HTMLElement>(HANDLE_SELECTOR) ?? null;\nconst resizeKind = (handle: HTMLElement): AppWorkspaceResizeKind | null => {\n const value = handle.dataset.appWorkspaceResize;\n return value === \"sidebar\" || value === \"pane\" || value === \"detail\" || value === \"drawer\" ? value : null;\n};\nconst resizeDirection = (handle: HTMLElement, kind: AppWorkspaceResizeKind): 1 | -1 =>\n (handle.dataset.workspaceResizeEdge ?? (kind === \"sidebar\" ? \"end\" : \"start\")) === \"end\" ? 1 : -1;\nconst workspaceRoot = (handle: HTMLElement) => handle.closest<HTMLElement>(ROOT_SELECTOR);\nconst workspaceResizable = (root: HTMLElement) => root.dataset.workspaceResizable !== \"false\";\nconst rootElements = (root: HTMLElement, selector: string) =>\n Array.from(root.querySelectorAll<HTMLElement>(selector)).filter((element) => element.closest(ROOT_SELECTOR) === root);\nconst sidebarElement = (root: HTMLElement) => rootElements(root, \".k2b-app-workspace__sidebar\")[0] ?? null;\nconst mainElement = (root: HTMLElement) => rootElements(root, \".k2b-app-workspace__main\")[0] ?? null;\nconst sidebarCollapsible = (root: HTMLElement) => sidebarElement(root)?.dataset.workspaceCollapsible === \"true\";\nconst isVisible = (element: HTMLElement | null): element is HTMLElement =>\n Boolean(element && !element.hidden && getComputedStyle(element).display !== \"none\");\nconst elementSize = (element: HTMLElement | null, kind: AppWorkspaceResizeKind) => {\n if (!isVisible(element)) return 0;\n const rect = element.getBoundingClientRect();\n return kind === \"drawer\" ? rect.height : rect.width;\n};\nconst controlledPanel = (root: HTMLElement, handle: HTMLElement) => {\n const controls = handle.getAttribute(\"aria-controls\");\n if (!controls) return null;\n const panel = document.getElementById(controls);\n return panel?.closest(ROOT_SELECTOR) === root ? panel : null;\n};\nconst controlsResizableRegion = (root: HTMLElement, handle: HTMLElement, kind: AppWorkspaceResizeKind) =>\n (kind === \"sidebar\" ? sidebarElement(root) : controlledPanel(root, handle))?.dataset.workspaceResizable === \"true\";\nconst panelId = (handle: HTMLElement) => safeAppWorkspacePanelId(handle.dataset.workspacePanelId ?? \"primary\") || \"primary\";\nconst numberData = (handle: HTMLElement, key: \"workspaceDefaultSize\" | \"workspaceMinSize\" | \"workspaceMaxSize\", fallback: number) => {\n const value = Number(handle.dataset[key]);\n return Number.isFinite(value) ? value : fallback;\n};\n\nconst sizeLimits = (root: HTMLElement, handle: HTMLElement, kind: AppWorkspaceResizeKind) => {\n const controlled = controlledPanel(root, handle);\n const main = kind === \"pane\" ? handle.closest<HTMLElement>(\".k2b-app-workspace__main\") : mainElement(root);\n const panes = main\n ? Array.from(main.querySelectorAll<HTMLElement>(\".k2b-app-workspace__main-pane\")).filter(\n (pane) => pane.closest(\".k2b-app-workspace__main\") === main && !pane.classList.contains(\"is-primary\") && isVisible(pane),\n )\n : [];\n const details = rootElements(root, \".k2b-app-workspace__detail\").filter(isVisible);\n const sidebarWidth = elementSize(sidebarElement(root), \"sidebar\");\n const otherDetailWidth = details.reduce((total, detail) => total + (detail === controlled ? 0 : elementSize(detail, \"detail\")), 0);\n const defaultMin =\n kind === \"sidebar\"\n ? APP_WORKSPACE_SIDEBAR_MIN\n : kind === \"pane\"\n ? APP_WORKSPACE_PANE_MIN\n : kind === \"detail\"\n ? APP_WORKSPACE_DETAIL_MIN\n : APP_WORKSPACE_DRAWER_MIN;\n const defaultMax =\n kind === \"sidebar\"\n ? APP_WORKSPACE_SIDEBAR_MAX\n : kind === \"pane\"\n ? APP_WORKSPACE_PANE_MAX\n : kind === \"detail\"\n ? APP_WORKSPACE_DETAIL_MAX\n : APP_WORKSPACE_DRAWER_MAX;\n return appWorkspaceResizeLimits({\n kind,\n workspaceSize:\n kind === \"drawer\"\n ? root.getBoundingClientRect().height\n : kind === \"pane\" && main\n ? main.getBoundingClientRect().width\n : root.getBoundingClientRect().width,\n reservedSize:\n kind === \"sidebar\"\n ? otherDetailWidth\n : kind === \"pane\"\n ? panes.reduce((total, pane) => total + (pane === controlled ? 0 : elementSize(pane, \"pane\")), 0)\n : kind === \"detail\"\n ? sidebarWidth + otherDetailWidth\n : 0,\n min: numberData(handle, \"workspaceMinSize\", defaultMin),\n max: numberData(handle, \"workspaceMaxSize\", defaultMax),\n sidebarCollapsible: kind === \"sidebar\" && sidebarCollapsible(root),\n });\n};\n\nconst currentSize = (root: HTMLElement, handle: HTMLElement, kind: AppWorkspaceResizeKind) =>\n kind === \"sidebar\" ? elementSize(sidebarElement(root), kind) : elementSize(controlledPanel(root, handle), kind);\n\nconst updateHandleValue = (\n root: HTMLElement,\n handle: HTMLElement,\n kind: AppWorkspaceResizeKind,\n size: number,\n limits = sizeLimits(root, handle, kind),\n) => {\n const { min, max } = limits;\n handle.setAttribute(\"aria-valuemin\", String(min));\n handle.setAttribute(\"aria-valuemax\", String(max));\n handle.setAttribute(\"aria-valuenow\", String(clamp(size, min, max)));\n};\n\nconst applySize = (\n root: HTMLElement,\n handle: HTMLElement,\n kind: AppWorkspaceResizeKind,\n requestedSize: number,\n /**\n * `snapSidebar: false` tracks the pointer continuously and only *previews*\n * the collapsed state. Snapping (the default, and what keyboard steps and\n * reconciliation want) quantises the width to either the collapsed rail or\n * the sidebar minimum, which during a live drag makes the handle jump.\n */\n options: { snapSidebar?: boolean } = {},\n) => {\n const { min, max } = sizeLimits(root, handle, kind);\n if (kind === \"sidebar\") {\n const collapsible = sidebarCollapsible(root);\n const sidebar =\n options.snapSidebar === false\n ? { width: clamp(requestedSize, min, max), collapsed: shouldCollapseAppWorkspaceSidebar(requestedSize, collapsible) }\n : resolveAppWorkspaceSidebarWidth(requestedSize, max, collapsible);\n root.style.setProperty(\"--k2b-workspace-sidebar-width\", `${sidebar.width}px`);\n // Cloud removes the attribute rather than writing \"false\", so that a\n // presence selector (`[data-sidebar-collapsed]`) means \"collapsed\".\n if (sidebar.collapsed) root.dataset.sidebarCollapsed = \"true\";\n else delete root.dataset.sidebarCollapsed;\n updateHandleValue(root, handle, kind, sidebar.width, { min, max });\n return sidebar.width;\n }\n const size = clamp(requestedSize, min, max);\n root.style.setProperty(appWorkspacePanelVariable(kind, panelId(handle)), `${size}px`);\n updateHandleValue(root, handle, kind, size, { min, max });\n return size;\n};\n\ntype PaneFit = {\n desired: number;\n handle: HTMLElement;\n min: number;\n};\n\n/**\n * Fits all auxiliary main panes as one group. One main region remains the\n * flexible anchor; the others keep their preferred sizes while space permits\n * and give up the same share of their optional space when the container,\n * navigation or detail panels reduce the available width.\n */\nconst reconcilePanes = (root: HTMLElement, layoutState: AppWorkspaceLayoutState, active: ActiveResize | null = null) => {\n const main = mainElement(root);\n if (!main || !isVisible(main)) return;\n const handles = rootElements(root, HANDLE_SELECTOR).filter(\n (handle) => resizeKind(handle) === \"pane\" && controlsResizableRegion(root, handle, \"pane\"),\n );\n if (!handles.length) return;\n\n const controlled = new Set(handles.map((handle) => controlledPanel(root, handle)).filter(Boolean));\n const fixedWidth = Array.from(main.querySelectorAll<HTMLElement>(\".k2b-app-workspace__main-pane\"))\n .filter(\n (pane) =>\n pane.closest(\".k2b-app-workspace__main\") === main &&\n !pane.classList.contains(\"is-primary\") &&\n isVisible(pane) &&\n !controlled.has(pane),\n )\n .reduce((total, pane) => total + elementSize(pane, \"pane\"), 0);\n const fits: PaneFit[] = handles.flatMap((handle) => {\n const panel = controlledPanel(root, handle);\n if (!isVisible(panel)) return [];\n const min = numberData(handle, \"workspaceMinSize\", APP_WORKSPACE_PANE_MIN);\n const max = Math.max(min, numberData(handle, \"workspaceMaxSize\", APP_WORKSPACE_PANE_MAX));\n const preferred =\n active?.moved && active.root === root && active.kind === \"pane\" && active.handle === handle\n ? active.liveSize\n : (layoutState.paneWidths?.[panelId(handle)] ?? numberData(handle, \"workspaceDefaultSize\", elementSize(panel, \"pane\")));\n const desired = clamp(preferred, min, max);\n return [{ desired, handle, min }];\n });\n if (!fits.length) return;\n\n const sizes = fitAppWorkspacePaneSizes(fits, main.getBoundingClientRect().width - fixedWidth - APP_WORKSPACE_MAIN_MIN);\n fits.forEach((fit, index) => {\n root.style.setProperty(appWorkspacePanelVariable(\"pane\", panelId(fit.handle)), `${sizes[index]}px`);\n });\n fits.forEach((fit, index) => updateHandleValue(root, fit.handle, \"pane\", sizes[index]!));\n};\n\n/**\n * Marquee support for a truncated sidebar label.\n *\n * The animation needs to know how far to travel, and that is only knowable\n * once the label has been laid out — so it is measured lazily, on the same\n * hover/focus that triggers it, and published as a custom property. Labels\n * that fit get no `data-overflow`, so they never animate. A revealed row action\n * pads the label's fading end, so the text is measured against the content box.\n */\nconst measureLabel = (label: HTMLElement) => {\n const text = label.querySelector<HTMLElement>(LABEL_TEXT_SELECTOR);\n if (!text) return;\n const style = getComputedStyle(label);\n const width = label.clientWidth - (Number.parseFloat(style.paddingLeft) || 0) - (Number.parseFloat(style.paddingRight) || 0);\n const overflow = Math.max(0, text.scrollWidth - width);\n label.style.setProperty(\"--k2b-sidebar-label-overflow\", `${overflow}px`);\n if (overflow > 2) label.dataset.overflow = \"true\";\n else delete label.dataset.overflow;\n};\n\nexport const installAppWorkspaceController = (options: AppWorkspaceControllerOptions = {}): (() => void) => {\n const eventRoot = options.root ?? document;\n const stopScrollFades = installScrollFades(eventRoot);\n let layoutState = normalizeAppWorkspaceLayoutState(options.readState?.()) ?? { version: 2 as const };\n let active: ActiveResize | null = null;\n let resizeFrame: number | null = null;\n let pendingClient: number | null = null;\n\n const persistSize = (handle: HTMLElement, kind: AppWorkspaceResizeKind, size: number) => {\n if (kind === \"sidebar\") {\n const collapsed = size === APP_WORKSPACE_SIDEBAR_COLLAPSED;\n layoutState = {\n ...layoutState,\n sidebarWidth: collapsed ? layoutState.sidebarWidth : size,\n sidebarCollapsed: collapsed,\n };\n } else {\n const key = kind === \"pane\" ? \"paneWidths\" : kind === \"detail\" ? \"detailWidths\" : \"drawerHeights\";\n layoutState = { ...layoutState, [key]: { ...layoutState[key], [panelId(handle)]: size } };\n }\n options.writeState?.(layoutState);\n };\n\n const flushPointerMove = () => {\n if (resizeFrame !== null) {\n cancelAnimationFrame(resizeFrame);\n resizeFrame = null;\n }\n if (!active || pendingClient === null) return;\n const client = pendingClient;\n pendingClient = null;\n active.moved ||= client !== active.startClient;\n active.liveSize = applySize(\n active.root,\n active.handle,\n active.kind,\n active.startSize + (client - active.startClient) * active.direction,\n { snapSidebar: active.kind !== \"sidebar\" },\n );\n if (active.kind === \"sidebar\" || active.kind === \"detail\") reconcilePanes(active.root, layoutState, active);\n };\n const onPointerMove = (event: PointerEvent) => {\n if (!active || event.pointerId !== active.pointerId) return;\n pendingClient = active.kind === \"drawer\" ? event.clientY : event.clientX;\n if (resizeFrame !== null) return;\n resizeFrame = requestAnimationFrame(flushPointerMove);\n };\n const stopResize = (event?: Event) => {\n if (!active || (event instanceof PointerEvent && event.pointerId !== active.pointerId)) return;\n flushPointerMove();\n const finished = active;\n active = null;\n delete finished.root.dataset.workspaceResizeActive;\n delete finished.handle.dataset.workspaceResizeActive;\n if (finished.moved) {\n // A pane's rendered width may have been fitted below the pointer's live\n // preference to keep the main region usable. Persist that preference,\n // then fit the visible panes from the updated state. Reapplying it through\n // the per-handle limits here would count the already-fitted sibling panes\n // a second time and permanently shrink the preference on release.\n const size =\n finished.kind === \"pane\" ? finished.liveSize : applySize(finished.root, finished.handle, finished.kind, finished.liveSize);\n persistSize(finished.handle, finished.kind, size);\n if (finished.kind !== \"drawer\") reconcilePanes(finished.root, layoutState);\n }\n if (finished.handle.hasPointerCapture?.(finished.pointerId)) finished.handle.releasePointerCapture(finished.pointerId);\n document.body.style.userSelect = finished.previousUserSelect;\n window.removeEventListener(\"pointermove\", onPointerMove);\n window.removeEventListener(\"pointerup\", stopResize);\n window.removeEventListener(\"pointercancel\", stopResize);\n window.removeEventListener(\"blur\", stopResize);\n };\n const onPointerDown = (event: PointerEvent) => {\n const handle = resizeHandle(event);\n const kind = handle ? resizeKind(handle) : null;\n const root = handle ? workspaceRoot(handle) : null;\n if (!handle || !kind || !root || !workspaceResizable(root) || !controlsResizableRegion(root, handle, kind) || event.button !== 0)\n return;\n event.preventDefault();\n stopResize();\n pendingClient = null;\n const startSize = currentSize(root, handle, kind);\n active = {\n handle,\n root,\n kind,\n pointerId: event.pointerId,\n startClient: kind === \"drawer\" ? event.clientY : event.clientX,\n startSize,\n liveSize: startSize,\n moved: false,\n direction: resizeDirection(handle, kind),\n previousUserSelect: document.body.style.userSelect,\n };\n root.dataset.workspaceResizeActive = kind;\n handle.dataset.workspaceResizeActive = \"true\";\n document.body.style.userSelect = \"none\";\n handle.setPointerCapture?.(event.pointerId);\n window.addEventListener(\"pointermove\", onPointerMove);\n window.addEventListener(\"pointerup\", stopResize);\n window.addEventListener(\"pointercancel\", stopResize);\n window.addEventListener(\"blur\", stopResize);\n };\n const onKeyDown = (event: KeyboardEvent) => {\n const handle = resizeHandle(event);\n const kind = handle ? resizeKind(handle) : null;\n const root = handle ? workspaceRoot(handle) : null;\n if (!handle || !kind || !root || !workspaceResizable(root) || !controlsResizableRegion(root, handle, kind)) return;\n const current = currentSize(root, handle, kind);\n const { min, max } = sizeLimits(root, handle, kind);\n const step = event.shiftKey ? 32 : 8;\n let requested: number | null = null;\n const direction = resizeDirection(handle, kind);\n const collapsibleSidebar = kind === \"sidebar\" && sidebarCollapsible(root);\n if (event.key === \"Home\") requested = min;\n else if (event.key === \"End\") requested = max;\n // The drawer arrows follow the handle's edge like every other kind; the\n // hard-coded +/- here inverted for a handle on the `end` edge.\n else if (kind === \"drawer\" && event.key === \"ArrowUp\") requested = current - step * direction;\n else if (kind === \"drawer\" && event.key === \"ArrowDown\") requested = current + step * direction;\n // A collapsible sidebar is already at its minimum when the rail is the\n // next step: without these two branches a keyboard step of 8 (or 32) is\n // clamped straight back to the minimum, so the handle is simply stuck and\n // collapse/expand is unreachable without a pointer.\n else if (kind !== \"drawer\" && event.key === \"ArrowLeft\")\n requested = collapsibleSidebar && current <= APP_WORKSPACE_SIDEBAR_MIN ? APP_WORKSPACE_SIDEBAR_COLLAPSED : current - step * direction;\n else if (kind !== \"drawer\" && event.key === \"ArrowRight\")\n requested =\n collapsibleSidebar && current <= APP_WORKSPACE_SIDEBAR_COLLAPSED\n ? (layoutState.sidebarWidth ?? APP_WORKSPACE_SIDEBAR_MIN)\n : current + step * direction;\n if (requested === null) return;\n event.preventDefault();\n persistSize(handle, kind, applySize(root, handle, kind, requested));\n if (kind === \"sidebar\" || kind === \"detail\") reconcilePanes(root, layoutState);\n };\n\n const allRoots = () => {\n const nested = Array.from(eventRoot.querySelectorAll<HTMLElement>(ROOT_SELECTOR));\n return eventRoot instanceof HTMLElement && eventRoot.matches(ROOT_SELECTOR) ? [eventRoot, ...nested] : nested;\n };\n const roots = () => {\n // A hidden or zero-width workspace measures 0, which drives every limit\n // down to its minimum — reconciling one would overwrite its variables and\n // `aria-valuenow` with that minimum for good.\n return allRoots().filter((root) => getComputedStyle(root).display !== \"none\" && root.getBoundingClientRect().width > 0);\n };\n const reconcile = () => {\n roots().forEach((root) => {\n // `data-workspace-resizable=\"false\"` already refuses pointer and keyboard\n // resizing; without this the same workspace still had persisted sizes\n // forced onto it on load and on every window resize.\n if (!workspaceResizable(root)) return;\n const handles = rootElements(root, HANDLE_SELECTOR);\n // Chrome establishes the space available to the work area. Auxiliary\n // panes are then fitted together into what remains, so DOM order cannot\n // give the last pane an accidental sizing priority.\n handles\n .filter((handle) => resizeKind(handle) !== \"pane\")\n .forEach((handle) => {\n const kind = resizeKind(handle);\n if (!kind || !controlsResizableRegion(root, handle, kind)) return;\n if (active?.moved && active.root === root && active.handle === handle && active.kind === kind) {\n applySize(root, handle, kind, active.liveSize, { snapSidebar: kind !== \"sidebar\" });\n return;\n }\n const persisted =\n kind === \"sidebar\"\n ? layoutState.sidebarCollapsed && sidebarCollapsible(root)\n ? APP_WORKSPACE_SIDEBAR_COLLAPSED\n : layoutState.sidebarWidth\n : kind === \"detail\"\n ? layoutState.detailWidths?.[panelId(handle)]\n : layoutState.drawerHeights?.[panelId(handle)];\n if (persisted !== undefined) applySize(root, handle, kind, persisted);\n else updateHandleValue(root, handle, kind, currentSize(root, handle, kind));\n });\n reconcilePanes(root, layoutState, active?.root === root ? active : null);\n });\n };\n /**\n * A handle's limits move whenever anything around it does — opening a detail\n * panel, showing a pane. Only `applySize` refreshed them, so a keyboard user\n * arriving at a handle was announced whatever `aria-valuenow`/`valuemax` the\n * last drag left behind.\n */\n const onFocusIn = (event: FocusEvent) => {\n const handle = resizeHandle(event);\n const kind = handle ? resizeKind(handle) : null;\n const root = handle ? workspaceRoot(handle) : null;\n if (handle && kind && root && controlsResizableRegion(root, handle, kind)) {\n updateHandleValue(root, handle, kind, currentSize(root, handle, kind));\n }\n const label = eventElement(event)?.closest<HTMLElement>(ITEM_SELECTOR)?.querySelector<HTMLElement>(LABEL_SELECTOR);\n if (label) requestAnimationFrame(() => measureLabel(label));\n };\n\n // Measured on entry rather than on every render: `scrollWidth` forces layout,\n // and a sidebar can hold hundreds of rows.\n const onPointerOver = (event: PointerEvent) => {\n const label = eventElement(event)?.closest<HTMLElement>(LABEL_SELECTOR);\n if (!label || (event.relatedTarget instanceof Node && label.contains(event.relatedTarget))) return;\n requestAnimationFrame(() => measureLabel(label));\n };\n\n // A resize changes every label's available width, so the cached measurement\n // is dropped and taken again on the next hover or focus.\n const clearMeasuredLabels = () => {\n eventRoot.querySelectorAll<HTMLElement>(LABEL_SELECTOR).forEach((label) => {\n delete label.dataset.overflow;\n label.style.removeProperty(\"--k2b-sidebar-label-overflow\");\n });\n };\n\n // Geometry can change without a window resize: a parent can resize the\n // workspace, or a detail/pane can open. All sources share one frame so a\n // transition performs at most one layout reconciliation.\n let reconcileFrame: number | null = null;\n const scheduleReconcile = (clearLabels = false) => {\n if (clearLabels) clearMeasuredLabels();\n if (reconcileFrame !== null) return;\n reconcileFrame = requestAnimationFrame(() => {\n reconcileFrame = null;\n reconcile();\n });\n };\n const onResize = () => scheduleReconcile(true);\n\n const observedRoots = new Set<HTMLElement>();\n const resizeObserver =\n typeof ResizeObserver === \"undefined\"\n ? null\n : new ResizeObserver(() => {\n scheduleReconcile(true);\n });\n const syncObservedRoots = () => {\n if (!resizeObserver) return;\n const next = new Set(allRoots());\n observedRoots.forEach((root) => {\n if (!next.has(root)) {\n resizeObserver.unobserve(root);\n observedRoots.delete(root);\n }\n });\n next.forEach((root) => {\n if (observedRoots.has(root)) return;\n observedRoots.add(root);\n resizeObserver.observe(root);\n });\n };\n const layoutNode = (node: Node) =>\n node instanceof Element && (node.matches(LAYOUT_REGION_SELECTOR) || Boolean(node.querySelector(LAYOUT_REGION_SELECTOR)));\n const mutationObserver =\n typeof MutationObserver === \"undefined\"\n ? null\n : new MutationObserver((records) => {\n const changed = records.some((record) =>\n record.type === \"attributes\"\n ? record.target instanceof Element && record.target.matches(LAYOUT_REGION_SELECTOR)\n : [...Array.from(record.addedNodes), ...Array.from(record.removedNodes)].some(layoutNode),\n );\n if (!changed) return;\n syncObservedRoots();\n scheduleReconcile();\n });\n\n eventRoot.addEventListener(\"pointerdown\", onPointerDown as EventListener);\n eventRoot.addEventListener(\"keydown\", onKeyDown as EventListener);\n eventRoot.addEventListener(\"focusin\", onFocusIn as EventListener);\n eventRoot.addEventListener(\"pointerover\", onPointerOver as EventListener);\n window.addEventListener(\"resize\", onResize);\n syncObservedRoots();\n mutationObserver?.observe(eventRoot, {\n attributes: true,\n attributeFilter: [\"hidden\"],\n childList: true,\n subtree: true,\n });\n scheduleReconcile();\n return () => {\n stopScrollFades();\n // Flush the latest coalesced pointer sample before listeners and frames are\n // torn down, so unmounting during a drag cannot lose the final size.\n stopResize();\n if (reconcileFrame !== null) cancelAnimationFrame(reconcileFrame);\n mutationObserver?.disconnect();\n resizeObserver?.disconnect();\n observedRoots.clear();\n eventRoot.removeEventListener(\"pointerdown\", onPointerDown as EventListener);\n eventRoot.removeEventListener(\"keydown\", onKeyDown as EventListener);\n eventRoot.removeEventListener(\"focusin\", onFocusIn as EventListener);\n eventRoot.removeEventListener(\"pointerover\", onPointerOver as EventListener);\n window.removeEventListener(\"resize\", onResize);\n };\n};\n"],"mappings":"AAAA,SACE,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EAGzB,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,gCAAgC,EAChC,+BAA+B,EAC/B,uBAAuB,EACvB,iCAAiC,QAC5B,uBAAuB;AAC9B,SAAS,kBAAkB,QAAQ,eAAe;AAqBlD,MAAM,eAAe,GAAG,6BAA6B;AACrD,MAAM,aAAa,GAAG,0BAA0B;AAChD,MAAM,sBAAsB,GAAG,CAC7B,aAAa,EACb,6BAA6B,EAC7B,+BAA+B,EAC/B,4BAA4B,EAC5B,4BAA4B,EAC5B,eAAe,CAChB,CAAC,IAAI,CAAC,GAAG,CAAC;AACX,MAAM,cAAc,GAAG,6DAA6D;AACpF,MAAM,mBAAmB,GAAG,6CAA6C;AACzE,MAAM,aAAa,GAAG,kCAAkC;AACxD,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAW,E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C,CAAC;IAC9B,cAAc,EAAE,UAAU,CAAC,CAAC;IAC5B,aAAa,CAAC,KAAK,CAAC,CAAC;IACrB,SAAS,CAAC,mBAAmB,CAAC,aAAa,EAAE,aAA8B,CAAC;IAC5E,SAAS,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAA0B,CAAC;IACpE,SAAS,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAA0B,CAAC;IACpE,SAAS,CAAC,mBAAmB,CAAC,aAAa,EAAE,aAA8B,CAAC;IAC5E,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC;EAChD,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["layout/app-workspace-controller.ts"],"sourcesContent":["import {\n APP_WORKSPACE_DETAIL_MAX,\n APP_WORKSPACE_DETAIL_MIN,\n APP_WORKSPACE_DRAWER_MAX,\n APP_WORKSPACE_DRAWER_MIN,\n APP_WORKSPACE_MAIN_MIN,\n APP_WORKSPACE_PANE_MAX,\n APP_WORKSPACE_PANE_MIN,\n APP_WORKSPACE_SIDEBAR_COLLAPSED,\n APP_WORKSPACE_SIDEBAR_MAX,\n APP_WORKSPACE_SIDEBAR_MIN,\n type AppWorkspaceLayoutState,\n type AppWorkspaceResizeKind,\n appWorkspacePanelVariable,\n appWorkspaceResizeLimits,\n fitAppWorkspacePaneSizes,\n normalizeAppWorkspaceLayoutState,\n resolveAppWorkspaceSidebarWidth,\n safeAppWorkspacePanelId,\n shouldCollapseAppWorkspaceSidebar,\n} from \"./app-workspace-state\";\nimport { installScrollFades } from \"./scroll-fade\";\n\nexport type AppWorkspaceControllerOptions = {\n root?: Document | HTMLElement;\n readState?: () => AppWorkspaceLayoutState | null | undefined;\n writeState?: (state: AppWorkspaceLayoutState) => void;\n};\n\ntype ActiveResize = {\n handle: HTMLElement;\n root: HTMLElement;\n kind: AppWorkspaceResizeKind;\n pointerId: number;\n startClient: number;\n startSize: number;\n liveSize: number;\n moved: boolean;\n /** A hideable sidebar dragged below half its minimum previews the hidden state. */\n hiding: boolean;\n direction: 1 | -1;\n previousUserSelect: string;\n};\n\nconst HANDLE_SELECTOR = \"[data-app-workspace-resize]\";\nconst ROOT_SELECTOR = \"[data-k2b-app-workspace]\";\nconst LAYOUT_REGION_SELECTOR = [\n ROOT_SELECTOR,\n \".k2b-app-workspace__sidebar\",\n \".k2b-app-workspace__main-pane\",\n \".k2b-app-workspace__detail\",\n \".k2b-app-workspace__drawer\",\n HANDLE_SELECTOR,\n].join(\",\");\nconst LABEL_SELECTOR = \".k2b-app-workspace__sidebar-item-label[data-marquee='true']\";\nconst LABEL_TEXT_SELECTOR = \".k2b-app-workspace__sidebar-item-label-text\";\nconst ITEM_SELECTOR = \".k2b-app-workspace__sidebar-item\";\nconst clamp = (value: number, min: number, max: number) => Math.round(Math.min(max, Math.max(min, value)));\nconst eventElement = (event: Event) => (event.target instanceof Element ? event.target : null);\nconst resizeHandle = (event: Event) => eventElement(event)?.closest<HTMLElement>(HANDLE_SELECTOR) ?? null;\nconst resizeKind = (handle: HTMLElement): AppWorkspaceResizeKind | null => {\n const value = handle.dataset.appWorkspaceResize;\n return value === \"sidebar\" || value === \"pane\" || value === \"detail\" || value === \"drawer\" ? value : null;\n};\nconst resizeDirection = (handle: HTMLElement, kind: AppWorkspaceResizeKind): 1 | -1 =>\n (handle.dataset.workspaceResizeEdge ?? (kind === \"sidebar\" ? \"end\" : \"start\")) === \"end\" ? 1 : -1;\nconst workspaceRoot = (handle: HTMLElement) => handle.closest<HTMLElement>(ROOT_SELECTOR);\nconst workspaceResizable = (root: HTMLElement) => root.dataset.workspaceResizable !== \"false\";\nconst rootElements = (root: HTMLElement, selector: string) =>\n Array.from(root.querySelectorAll<HTMLElement>(selector)).filter((element) => element.closest(ROOT_SELECTOR) === root);\nconst sidebarElement = (root: HTMLElement) => rootElements(root, \".k2b-app-workspace__sidebar\")[0] ?? null;\nconst mainElement = (root: HTMLElement) => rootElements(root, \".k2b-app-workspace__main\")[0] ?? null;\nconst sidebarCollapsible = (root: HTMLElement) => sidebarElement(root)?.dataset.workspaceCollapsible === \"true\";\nconst sidebarHideable = (root: HTMLElement) => sidebarElement(root)?.dataset.workspaceHideable === \"true\";\n/**\n * Asks the owning `AppWorkspace.Sidebar` to hide. The sidebar's `hidden` prop\n * stays application state, so the controller only requests the change.\n */\nexport const APP_WORKSPACE_SIDEBAR_HIDE_EVENT = \"k2b-app-workspace-sidebar-hide\";\nconst previewSidebarHidden = (root: HTMLElement, hidden: boolean) => {\n const sidebar = sidebarElement(root);\n if (!sidebar) return;\n if (hidden) sidebar.dataset.workspaceHidePreview = \"true\";\n else delete sidebar.dataset.workspaceHidePreview;\n};\nconst isVisible = (element: HTMLElement | null): element is HTMLElement =>\n Boolean(element && !element.hidden && getComputedStyle(element).display !== \"none\");\nconst elementSize = (element: HTMLElement | null, kind: AppWorkspaceResizeKind) => {\n if (!isVisible(element)) return 0;\n const rect = element.getBoundingClientRect();\n return kind === \"drawer\" ? rect.height : rect.width;\n};\nconst controlledPanel = (root: HTMLElement, handle: HTMLElement) => {\n const controls = handle.getAttribute(\"aria-controls\");\n if (!controls) return null;\n const panel = document.getElementById(controls);\n return panel?.closest(ROOT_SELECTOR) === root ? panel : null;\n};\nconst controlsResizableRegion = (root: HTMLElement, handle: HTMLElement, kind: AppWorkspaceResizeKind) =>\n (kind === \"sidebar\" ? sidebarElement(root) : controlledPanel(root, handle))?.dataset.workspaceResizable === \"true\";\nconst panelId = (handle: HTMLElement) => safeAppWorkspacePanelId(handle.dataset.workspacePanelId ?? \"primary\") || \"primary\";\nconst numberData = (handle: HTMLElement, key: \"workspaceDefaultSize\" | \"workspaceMinSize\" | \"workspaceMaxSize\", fallback: number) => {\n const value = Number(handle.dataset[key]);\n return Number.isFinite(value) ? value : fallback;\n};\n\nconst sizeLimits = (root: HTMLElement, handle: HTMLElement, kind: AppWorkspaceResizeKind) => {\n const controlled = controlledPanel(root, handle);\n const main = kind === \"pane\" ? handle.closest<HTMLElement>(\".k2b-app-workspace__main\") : mainElement(root);\n const panes = main\n ? Array.from(main.querySelectorAll<HTMLElement>(\".k2b-app-workspace__main-pane\")).filter(\n (pane) => pane.closest(\".k2b-app-workspace__main\") === main && !pane.classList.contains(\"is-primary\") && isVisible(pane),\n )\n : [];\n const details = rootElements(root, \".k2b-app-workspace__detail\").filter(isVisible);\n const sidebarWidth = elementSize(sidebarElement(root), \"sidebar\");\n const otherDetailWidth = details.reduce((total, detail) => total + (detail === controlled ? 0 : elementSize(detail, \"detail\")), 0);\n const defaultMin =\n kind === \"sidebar\"\n ? APP_WORKSPACE_SIDEBAR_MIN\n : kind === \"pane\"\n ? APP_WORKSPACE_PANE_MIN\n : kind === \"detail\"\n ? APP_WORKSPACE_DETAIL_MIN\n : APP_WORKSPACE_DRAWER_MIN;\n const defaultMax =\n kind === \"sidebar\"\n ? APP_WORKSPACE_SIDEBAR_MAX\n : kind === \"pane\"\n ? APP_WORKSPACE_PANE_MAX\n : kind === \"detail\"\n ? APP_WORKSPACE_DETAIL_MAX\n : APP_WORKSPACE_DRAWER_MAX;\n return appWorkspaceResizeLimits({\n kind,\n workspaceSize:\n kind === \"drawer\"\n ? root.getBoundingClientRect().height\n : kind === \"pane\" && main\n ? main.getBoundingClientRect().width\n : root.getBoundingClientRect().width,\n reservedSize:\n kind === \"sidebar\"\n ? otherDetailWidth\n : kind === \"pane\"\n ? panes.reduce((total, pane) => total + (pane === controlled ? 0 : elementSize(pane, \"pane\")), 0)\n : kind === \"detail\"\n ? sidebarWidth + otherDetailWidth\n : 0,\n min: numberData(handle, \"workspaceMinSize\", defaultMin),\n max: numberData(handle, \"workspaceMaxSize\", defaultMax),\n sidebarCollapsible: kind === \"sidebar\" && sidebarCollapsible(root),\n });\n};\n\nconst currentSize = (root: HTMLElement, handle: HTMLElement, kind: AppWorkspaceResizeKind) =>\n kind === \"sidebar\" ? elementSize(sidebarElement(root), kind) : elementSize(controlledPanel(root, handle), kind);\n\nconst updateHandleValue = (\n root: HTMLElement,\n handle: HTMLElement,\n kind: AppWorkspaceResizeKind,\n size: number,\n limits = sizeLimits(root, handle, kind),\n) => {\n const { min, max } = limits;\n handle.setAttribute(\"aria-valuemin\", String(min));\n handle.setAttribute(\"aria-valuemax\", String(max));\n handle.setAttribute(\"aria-valuenow\", String(clamp(size, min, max)));\n};\n\nconst applySize = (\n root: HTMLElement,\n handle: HTMLElement,\n kind: AppWorkspaceResizeKind,\n requestedSize: number,\n /**\n * `snapSidebar: false` tracks the pointer continuously and only *previews*\n * the collapsed state. Snapping (the default, and what keyboard steps and\n * reconciliation want) quantises the width to either the collapsed rail or\n * the sidebar minimum, which during a live drag makes the handle jump.\n */\n options: { snapSidebar?: boolean } = {},\n) => {\n const { min, max } = sizeLimits(root, handle, kind);\n if (kind === \"sidebar\") {\n const collapsible = sidebarCollapsible(root);\n const sidebar =\n options.snapSidebar === false\n ? { width: clamp(requestedSize, min, max), collapsed: shouldCollapseAppWorkspaceSidebar(requestedSize, collapsible) }\n : resolveAppWorkspaceSidebarWidth(requestedSize, max, collapsible);\n root.style.setProperty(\"--k2b-workspace-sidebar-width\", `${sidebar.width}px`);\n // Cloud removes the attribute rather than writing \"false\", so that a\n // presence selector (`[data-sidebar-collapsed]`) means \"collapsed\".\n if (sidebar.collapsed) root.dataset.sidebarCollapsed = \"true\";\n else delete root.dataset.sidebarCollapsed;\n updateHandleValue(root, handle, kind, sidebar.width, { min, max });\n return sidebar.width;\n }\n const size = clamp(requestedSize, min, max);\n root.style.setProperty(appWorkspacePanelVariable(kind, panelId(handle)), `${size}px`);\n updateHandleValue(root, handle, kind, size, { min, max });\n return size;\n};\n\ntype PaneFit = {\n desired: number;\n handle: HTMLElement;\n min: number;\n};\n\n/**\n * Fits all auxiliary main panes as one group. One main region remains the\n * flexible anchor; the others keep their preferred sizes while space permits\n * and give up the same share of their optional space when the container,\n * navigation or detail panels reduce the available width.\n */\nconst reconcilePanes = (root: HTMLElement, layoutState: AppWorkspaceLayoutState, active: ActiveResize | null = null) => {\n const main = mainElement(root);\n if (!main || !isVisible(main)) return;\n const handles = rootElements(root, HANDLE_SELECTOR).filter(\n (handle) => resizeKind(handle) === \"pane\" && controlsResizableRegion(root, handle, \"pane\"),\n );\n if (!handles.length) return;\n\n const controlled = new Set(handles.map((handle) => controlledPanel(root, handle)).filter(Boolean));\n const fixedWidth = Array.from(main.querySelectorAll<HTMLElement>(\".k2b-app-workspace__main-pane\"))\n .filter(\n (pane) =>\n pane.closest(\".k2b-app-workspace__main\") === main &&\n !pane.classList.contains(\"is-primary\") &&\n isVisible(pane) &&\n !controlled.has(pane),\n )\n .reduce((total, pane) => total + elementSize(pane, \"pane\"), 0);\n const fits: PaneFit[] = handles.flatMap((handle) => {\n const panel = controlledPanel(root, handle);\n if (!isVisible(panel)) return [];\n const min = numberData(handle, \"workspaceMinSize\", APP_WORKSPACE_PANE_MIN);\n const max = Math.max(min, numberData(handle, \"workspaceMaxSize\", APP_WORKSPACE_PANE_MAX));\n const preferred =\n active?.moved && active.root === root && active.kind === \"pane\" && active.handle === handle\n ? active.liveSize\n : (layoutState.paneWidths?.[panelId(handle)] ?? numberData(handle, \"workspaceDefaultSize\", elementSize(panel, \"pane\")));\n const desired = clamp(preferred, min, max);\n return [{ desired, handle, min }];\n });\n if (!fits.length) return;\n\n const sizes = fitAppWorkspacePaneSizes(fits, main.getBoundingClientRect().width - fixedWidth - APP_WORKSPACE_MAIN_MIN);\n fits.forEach((fit, index) => {\n root.style.setProperty(appWorkspacePanelVariable(\"pane\", panelId(fit.handle)), `${sizes[index]}px`);\n });\n fits.forEach((fit, index) => updateHandleValue(root, fit.handle, \"pane\", sizes[index]!));\n};\n\n/**\n * Marquee support for a truncated sidebar label.\n *\n * The animation needs to know how far to travel, and that is only knowable\n * once the label has been laid out — so it is measured lazily, on the same\n * hover/focus that triggers it, and published as a custom property. Labels\n * that fit get no `data-overflow`, so they never animate. A revealed row action\n * pads the label's fading end, so the text is measured against the content box.\n */\nconst measureLabel = (label: HTMLElement) => {\n const text = label.querySelector<HTMLElement>(LABEL_TEXT_SELECTOR);\n if (!text) return;\n const style = getComputedStyle(label);\n const width = label.clientWidth - (Number.parseFloat(style.paddingLeft) || 0) - (Number.parseFloat(style.paddingRight) || 0);\n const overflow = Math.max(0, text.scrollWidth - width);\n label.style.setProperty(\"--k2b-sidebar-label-overflow\", `${overflow}px`);\n if (overflow > 2) label.dataset.overflow = \"true\";\n else delete label.dataset.overflow;\n};\n\nexport const installAppWorkspaceController = (options: AppWorkspaceControllerOptions = {}): (() => void) => {\n const eventRoot = options.root ?? document;\n const stopScrollFades = installScrollFades(eventRoot);\n let layoutState = normalizeAppWorkspaceLayoutState(options.readState?.()) ?? { version: 2 as const };\n let active: ActiveResize | null = null;\n let resizeFrame: number | null = null;\n let pendingClient: number | null = null;\n\n const persistSize = (handle: HTMLElement, kind: AppWorkspaceResizeKind, size: number) => {\n if (kind === \"sidebar\") {\n const collapsed = size === APP_WORKSPACE_SIDEBAR_COLLAPSED;\n layoutState = {\n ...layoutState,\n sidebarWidth: collapsed ? layoutState.sidebarWidth : size,\n sidebarCollapsed: collapsed,\n };\n } else {\n const key = kind === \"pane\" ? \"paneWidths\" : kind === \"detail\" ? \"detailWidths\" : \"drawerHeights\";\n layoutState = { ...layoutState, [key]: { ...layoutState[key], [panelId(handle)]: size } };\n }\n options.writeState?.(layoutState);\n };\n\n const flushPointerMove = () => {\n if (resizeFrame !== null) {\n cancelAnimationFrame(resizeFrame);\n resizeFrame = null;\n }\n if (!active || pendingClient === null) return;\n const client = pendingClient;\n pendingClient = null;\n active.moved ||= client !== active.startClient;\n const requested = active.startSize + (client - active.startClient) * active.direction;\n // Below half the smallest visible width a hideable sidebar stays at its\n // minimum and previews hiding; dragging back out resumes the live width.\n const hiding =\n active.kind === \"sidebar\" && sidebarHideable(active.root) && requested < sizeLimits(active.root, active.handle, active.kind).min / 2;\n if (hiding !== active.hiding) {\n active.hiding = hiding;\n previewSidebarHidden(active.root, hiding);\n }\n if (!hiding)\n active.liveSize = applySize(active.root, active.handle, active.kind, requested, { snapSidebar: active.kind !== \"sidebar\" });\n if (active.kind === \"sidebar\" || active.kind === \"detail\") reconcilePanes(active.root, layoutState, active);\n };\n const onPointerMove = (event: PointerEvent) => {\n if (!active || event.pointerId !== active.pointerId) return;\n pendingClient = active.kind === \"drawer\" ? event.clientY : event.clientX;\n if (resizeFrame !== null) return;\n resizeFrame = requestAnimationFrame(flushPointerMove);\n };\n const stopResize = (event?: Event) => {\n if (!active || (event instanceof PointerEvent && event.pointerId !== active.pointerId)) return;\n flushPointerMove();\n const finished = active;\n active = null;\n delete finished.root.dataset.workspaceResizeActive;\n delete finished.handle.dataset.workspaceResizeActive;\n if (finished.hiding) {\n // The request comes first, while the layout is still the one on screen,\n // so the host sees the sidebar disappear in a single change. The width\n // before the drag then stays the remembered width for the next time it\n // shows; a host that declines the request gets that width back.\n sidebarElement(finished.root)?.dispatchEvent(new CustomEvent(APP_WORKSPACE_SIDEBAR_HIDE_EVENT));\n previewSidebarHidden(finished.root, false);\n applySize(finished.root, finished.handle, \"sidebar\", finished.startSize);\n } else if (finished.moved) {\n // A pane's rendered width may have been fitted below the pointer's live\n // preference to keep the main region usable. Persist that preference,\n // then fit the visible panes from the updated state. Reapplying it through\n // the per-handle limits here would count the already-fitted sibling panes\n // a second time and permanently shrink the preference on release.\n const size =\n finished.kind === \"pane\" ? finished.liveSize : applySize(finished.root, finished.handle, finished.kind, finished.liveSize);\n persistSize(finished.handle, finished.kind, size);\n if (finished.kind !== \"drawer\") reconcilePanes(finished.root, layoutState);\n }\n if (finished.handle.hasPointerCapture?.(finished.pointerId)) finished.handle.releasePointerCapture(finished.pointerId);\n document.body.style.userSelect = finished.previousUserSelect;\n window.removeEventListener(\"pointermove\", onPointerMove);\n window.removeEventListener(\"pointerup\", stopResize);\n window.removeEventListener(\"pointercancel\", stopResize);\n window.removeEventListener(\"blur\", stopResize);\n };\n const onPointerDown = (event: PointerEvent) => {\n const handle = resizeHandle(event);\n const kind = handle ? resizeKind(handle) : null;\n const root = handle ? workspaceRoot(handle) : null;\n if (!handle || !kind || !root || !workspaceResizable(root) || !controlsResizableRegion(root, handle, kind) || event.button !== 0)\n return;\n event.preventDefault();\n stopResize();\n pendingClient = null;\n const startSize = currentSize(root, handle, kind);\n active = {\n handle,\n root,\n kind,\n pointerId: event.pointerId,\n startClient: kind === \"drawer\" ? event.clientY : event.clientX,\n startSize,\n liveSize: startSize,\n moved: false,\n hiding: false,\n direction: resizeDirection(handle, kind),\n previousUserSelect: document.body.style.userSelect,\n };\n root.dataset.workspaceResizeActive = kind;\n handle.dataset.workspaceResizeActive = \"true\";\n document.body.style.userSelect = \"none\";\n handle.setPointerCapture?.(event.pointerId);\n window.addEventListener(\"pointermove\", onPointerMove);\n window.addEventListener(\"pointerup\", stopResize);\n window.addEventListener(\"pointercancel\", stopResize);\n window.addEventListener(\"blur\", stopResize);\n };\n const onKeyDown = (event: KeyboardEvent) => {\n const handle = resizeHandle(event);\n const kind = handle ? resizeKind(handle) : null;\n const root = handle ? workspaceRoot(handle) : null;\n if (!handle || !kind || !root || !workspaceResizable(root) || !controlsResizableRegion(root, handle, kind)) return;\n const current = currentSize(root, handle, kind);\n const { min, max } = sizeLimits(root, handle, kind);\n const step = event.shiftKey ? 32 : 8;\n let requested: number | null = null;\n const direction = resizeDirection(handle, kind);\n const collapsibleSidebar = kind === \"sidebar\" && sidebarCollapsible(root);\n if (event.key === \"Home\") requested = min;\n else if (event.key === \"End\") requested = max;\n // The drawer arrows follow the handle's edge like every other kind; the\n // hard-coded +/- here inverted for a handle on the `end` edge.\n else if (kind === \"drawer\" && event.key === \"ArrowUp\") requested = current - step * direction;\n else if (kind === \"drawer\" && event.key === \"ArrowDown\") requested = current + step * direction;\n // A collapsible sidebar is already at its minimum when the rail is the\n // next step: without these two branches a keyboard step of 8 (or 32) is\n // clamped straight back to the minimum, so the handle is simply stuck and\n // collapse/expand is unreachable without a pointer.\n else if (kind !== \"drawer\" && event.key === \"ArrowLeft\")\n requested = collapsibleSidebar && current <= APP_WORKSPACE_SIDEBAR_MIN ? APP_WORKSPACE_SIDEBAR_COLLAPSED : current - step * direction;\n else if (kind !== \"drawer\" && event.key === \"ArrowRight\")\n requested =\n collapsibleSidebar && current <= APP_WORKSPACE_SIDEBAR_COLLAPSED\n ? (layoutState.sidebarWidth ?? APP_WORKSPACE_SIDEBAR_MIN)\n : current + step * direction;\n if (requested === null) return;\n event.preventDefault();\n persistSize(handle, kind, applySize(root, handle, kind, requested));\n if (kind === \"sidebar\" || kind === \"detail\") reconcilePanes(root, layoutState);\n };\n\n const allRoots = () => {\n const nested = Array.from(eventRoot.querySelectorAll<HTMLElement>(ROOT_SELECTOR));\n return eventRoot instanceof HTMLElement && eventRoot.matches(ROOT_SELECTOR) ? [eventRoot, ...nested] : nested;\n };\n const roots = () => {\n // A hidden or zero-width workspace measures 0, which drives every limit\n // down to its minimum — reconciling one would overwrite its variables and\n // `aria-valuenow` with that minimum for good.\n return allRoots().filter((root) => getComputedStyle(root).display !== \"none\" && root.getBoundingClientRect().width > 0);\n };\n const reconcile = () => {\n roots().forEach((root) => {\n // `data-workspace-resizable=\"false\"` already refuses pointer and keyboard\n // resizing; without this the same workspace still had persisted sizes\n // forced onto it on load and on every window resize.\n if (!workspaceResizable(root)) return;\n const handles = rootElements(root, HANDLE_SELECTOR);\n // Chrome establishes the space available to the work area. Auxiliary\n // panes are then fitted together into what remains, so DOM order cannot\n // give the last pane an accidental sizing priority.\n handles\n .filter((handle) => resizeKind(handle) !== \"pane\")\n .forEach((handle) => {\n const kind = resizeKind(handle);\n if (!kind || !controlsResizableRegion(root, handle, kind)) return;\n if (active?.moved && active.root === root && active.handle === handle && active.kind === kind) {\n applySize(root, handle, kind, active.liveSize, { snapSidebar: kind !== \"sidebar\" });\n return;\n }\n const persisted =\n kind === \"sidebar\"\n ? layoutState.sidebarCollapsed && sidebarCollapsible(root)\n ? APP_WORKSPACE_SIDEBAR_COLLAPSED\n : layoutState.sidebarWidth\n : kind === \"detail\"\n ? layoutState.detailWidths?.[panelId(handle)]\n : layoutState.drawerHeights?.[panelId(handle)];\n if (persisted !== undefined) applySize(root, handle, kind, persisted);\n else updateHandleValue(root, handle, kind, currentSize(root, handle, kind));\n });\n reconcilePanes(root, layoutState, active?.root === root ? active : null);\n });\n };\n /**\n * A handle's limits move whenever anything around it does — opening a detail\n * panel, showing a pane. Only `applySize` refreshed them, so a keyboard user\n * arriving at a handle was announced whatever `aria-valuenow`/`valuemax` the\n * last drag left behind.\n */\n const onFocusIn = (event: FocusEvent) => {\n const handle = resizeHandle(event);\n const kind = handle ? resizeKind(handle) : null;\n const root = handle ? workspaceRoot(handle) : null;\n if (handle && kind && root && controlsResizableRegion(root, handle, kind)) {\n updateHandleValue(root, handle, kind, currentSize(root, handle, kind));\n }\n const label = eventElement(event)?.closest<HTMLElement>(ITEM_SELECTOR)?.querySelector<HTMLElement>(LABEL_SELECTOR);\n if (label) requestAnimationFrame(() => measureLabel(label));\n };\n\n // Measured on entry rather than on every render: `scrollWidth` forces layout,\n // and a sidebar can hold hundreds of rows.\n const onPointerOver = (event: PointerEvent) => {\n const label = eventElement(event)?.closest<HTMLElement>(LABEL_SELECTOR);\n if (!label || (event.relatedTarget instanceof Node && label.contains(event.relatedTarget))) return;\n requestAnimationFrame(() => measureLabel(label));\n };\n\n // A resize changes every label's available width, so the cached measurement\n // is dropped and taken again on the next hover or focus.\n const clearMeasuredLabels = () => {\n eventRoot.querySelectorAll<HTMLElement>(LABEL_SELECTOR).forEach((label) => {\n delete label.dataset.overflow;\n label.style.removeProperty(\"--k2b-sidebar-label-overflow\");\n });\n };\n\n // Geometry can change without a window resize: a parent can resize the\n // workspace, or a detail/pane can open. All sources share one frame so a\n // transition performs at most one layout reconciliation.\n let reconcileFrame: number | null = null;\n const scheduleReconcile = (clearLabels = false) => {\n if (clearLabels) clearMeasuredLabels();\n if (reconcileFrame !== null) return;\n reconcileFrame = requestAnimationFrame(() => {\n reconcileFrame = null;\n reconcile();\n });\n };\n const onResize = () => scheduleReconcile(true);\n\n const observedRoots = new Set<HTMLElement>();\n const resizeObserver =\n typeof ResizeObserver === \"undefined\"\n ? null\n : new ResizeObserver(() => {\n scheduleReconcile(true);\n });\n const syncObservedRoots = () => {\n if (!resizeObserver) return;\n const next = new Set(allRoots());\n observedRoots.forEach((root) => {\n if (!next.has(root)) {\n resizeObserver.unobserve(root);\n observedRoots.delete(root);\n }\n });\n next.forEach((root) => {\n if (observedRoots.has(root)) return;\n observedRoots.add(root);\n resizeObserver.observe(root);\n });\n };\n const layoutNode = (node: Node) =>\n node instanceof Element && (node.matches(LAYOUT_REGION_SELECTOR) || Boolean(node.querySelector(LAYOUT_REGION_SELECTOR)));\n const mutationObserver =\n typeof MutationObserver === \"undefined\"\n ? null\n : new MutationObserver((records) => {\n const changed = records.some((record) =>\n record.type === \"attributes\"\n ? record.target instanceof Element && record.target.matches(LAYOUT_REGION_SELECTOR)\n : [...Array.from(record.addedNodes), ...Array.from(record.removedNodes)].some(layoutNode),\n );\n if (!changed) return;\n syncObservedRoots();\n scheduleReconcile();\n });\n\n eventRoot.addEventListener(\"pointerdown\", onPointerDown as EventListener);\n eventRoot.addEventListener(\"keydown\", onKeyDown as EventListener);\n eventRoot.addEventListener(\"focusin\", onFocusIn as EventListener);\n eventRoot.addEventListener(\"pointerover\", onPointerOver as EventListener);\n window.addEventListener(\"resize\", onResize);\n syncObservedRoots();\n mutationObserver?.observe(eventRoot, {\n attributes: true,\n attributeFilter: [\"hidden\"],\n childList: true,\n subtree: true,\n });\n scheduleReconcile();\n return () => {\n stopScrollFades();\n // Flush the latest coalesced pointer sample before listeners and frames are\n // torn down, so unmounting during a drag cannot lose the final size.\n stopResize();\n if (reconcileFrame !== null) cancelAnimationFrame(reconcileFrame);\n mutationObserver?.disconnect();\n resizeObserver?.disconnect();\n observedRoots.clear();\n eventRoot.removeEventListener(\"pointerdown\", onPointerDown as EventListener);\n eventRoot.removeEventListener(\"keydown\", onKeyDown as EventListener);\n eventRoot.removeEventListener(\"focusin\", onFocusIn as EventListener);\n eventRoot.removeEventListener(\"pointerover\", onPointerOver as EventListener);\n window.removeEventListener(\"resize\", onResize);\n };\n};\n"],"mappings":"AAAA,SACE,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EAGzB,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,gCAAgC,EAChC,+BAA+B,EAC/B,uBAAuB,EACvB,iCAAiC,QAC5B,uBAAuB;AAC9B,SAAS,kBAAkB,QAAQ,eAAe;AAuBlD,MAAM,eAAe,GAAG,6BAA6B;AACrD,MAAM,aAAa,GAAG,0BAA0B;AAChD,MAAM,sBAAsB,GAAG,CAC7B,aAAa,EACb,6BAA6B,EAC7B,+BAA+B,EAC/B,4BAA4B,EAC5B,4BAA4B,EAC5B,eAAe,CAChB,CAAC,IAAI,CAAC,GAAG,CAAC;AACX,MAAM,cAAc,GAAG,6DAA6D;AACpF,MAAM,mBAAmB,GAAG,6CAA6C;AACzE,MAAM,aAAa,GAAG,kCAAkC;AACxD,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAC1G,MAAM,YAAY,GAAI,KAAY,IAAM,KAAK,CAAC,MAAM,YAAY,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,IAAK;AAC9F,MAAM,YAAY,GAAI,KAAY,IAAK,YAAY,CAAC,KAAK,CAAC,EAAE,OAAO,CAAc,eAAe,CAAC,IAAI,IAAI;AACzG,MAAM,UAAU,GAAI,MAAmB,IAAoC;EACzE,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC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["<a", "><i", " aria-hidden=\"true\"></i><span class=\"k2b-sr-only\
10
10
  _tmpl$5 = ["<i", " aria-hidden=\"true\"></i>"],
11
11
  _tmpl$6 = ["<div class=\"k2b-content-file-view__truncated\">", "</div>"],
12
12
  _tmpl$7 = ["<span>", "</span>"],
13
- _tmpl$8 = ["<div class=\"", "\">", "</div>"],
13
+ _tmpl$8 = ["<div class=\"k2b-content-file-view__excerpt\">", "</div>"],
14
14
  _tmpl$9 = ["<div class=\"k2b-content-file-view__document\">", "</div>"],
15
15
  _tmpl$0 = ["<div class=\"k2b-content-file-view__editor\">", "</div>"],
16
16
  _tmpl$1 = ["<div class=\"k2b-content-file-view__editor\"><div class=\"k2b-markdown-editor\" data-fill=\"true\" role=\"group\"", "><div class=\"k2b-markdown-editor__toolbar k2b-content-file-view__code-toolbar\"><span class=\"k2b-content-file-view__code-language\">", "</span><span class=\"k2b-markdown-editor__trailing\">", "", "</span></div><div class=\"k2b-markdown-editor__surface\"><textarea class=\"k2b-content-file-view__code-input\"", " spellcheck=\"false\"></textarea></div></div></div>"],
@@ -21,23 +21,25 @@ var _tmpl$ = ["<a", "><i", " aria-hidden=\"true\"></i><span class=\"k2b-sr-only\
21
21
  _tmpl$14 = ["<td>", "</td>"],
22
22
  _tmpl$15 = ["<div class=\"k2b-content-file-view__pagination\">", "<span>", "–", " / ", "</span>", "</div>"],
23
23
  _tmpl$16 = ["<div class=\"k2b-content-file-view__media\"><img", "></div>"],
24
- _tmpl$17 = ["<object", " type=\"application/pdf\" class=\"k2b-content-file-view__pdf\"", "></object>"],
25
- _tmpl$18 = ["<div class=\"k2b-content-file-view__media\" data-kind=\"audio\"><audio", " controls preload=\"metadata\"", ">", "</audio></div>"],
26
- _tmpl$19 = ["<div class=\"k2b-content-file-view__media\" data-kind=\"video\"><video", " controls preload=\"metadata\" playsinline", ">", "</video></div>"],
27
- _tmpl$20 = ["<a class=\"k2b-button\" data-variant=\"secondary\" data-size=\"sm\"", " download><i class=\"ti ti-download\" aria-hidden=\"true\"></i>", "</a>"],
28
- _tmpl$21 = ["<div class=\"", "\"", ">", "</div>"];
24
+ _tmpl$17 = ["<div class=\"k2b-content-file-view__pdf-viewer\">", "", "</div>"],
25
+ _tmpl$18 = ["<object", " type=\"application/pdf\" class=\"k2b-content-file-view__pdf\"", "></object>"],
26
+ _tmpl$19 = ["<div class=\"k2b-content-file-view__media\" data-kind=\"audio\"><audio", " controls preload=\"metadata\"", ">", "</audio></div>"],
27
+ _tmpl$20 = ["<div class=\"k2b-content-file-view__media\" data-kind=\"video\"><video", " controls preload=\"metadata\" playsinline", ">", "</video></div>"],
28
+ _tmpl$21 = ["<a class=\"k2b-button\" data-variant=\"secondary\" data-size=\"sm\"", " download><i class=\"ti ti-download\" aria-hidden=\"true\"></i>", "</a>"],
29
+ _tmpl$22 = ["<div class=\"", "\"", ">", "</div>"];
29
30
  /**
30
31
  * FileView — renders one file through a small renderer registry keyed by
31
32
  * media type / path. Editing is enabled purely by the presence of `save`;
32
33
  * without it every renderer is read-only. IDE-style chrome: editors reuse
33
34
  * the markdown editor's surface (toolbar with an in-toolbar save, Ctrl/Cmd+S),
34
35
  * previews are quiet paper panels with icon-only actions overlaid top-right.
36
+ * A plain preview drops the panel and sits on its host's surface instead.
35
37
  * Custom renderers are passed per instance, which keeps SSR requests and
36
38
  * independently mounted applications isolated.
37
39
  */
38
40
 
39
41
  import { mutation } from "@k2b/stdlib/solid";
40
- import { createEffect, createMemo, createResource, createSignal, For, Match, onCleanup, onMount, Show, Switch, untrack } from "solid-js";
42
+ import { createContext, createEffect, createMemo, createResource, createSignal, For, Match, onCleanup, onMount, Show, Switch, untrack, useContext } from "solid-js";
41
43
  import { Button } from "../actions/Button";
42
44
  import { prompts } from "../feedback/prompts";
43
45
  import { Tooltip } from "../feedback/Tooltip";
@@ -50,9 +52,15 @@ import CodeDisplay from "./CodeDisplay";
50
52
  import { decodeDelimitedContent, readDelimitedPreferences } from "./delimited-preferences";
51
53
  import { fileViewExtension, getFileViewPreviewKind, parseDelimitedText } from "./file-view-preview";
52
54
  import MarkdownView from "./MarkdownView";
55
+ import { leadingMarkdownTitle } from "./markdown-title";
53
56
  import PdfPreview from "./PdfPreview";
54
57
  import StructuredDataPreview from "./StructuredDataPreview";
55
58
  export { canPreviewFile, getFileViewPreviewKind } from "./file-view-preview";
59
+ /** Instance options that reach the built-in renderers without widening the public renderer props. */
60
+ const FileViewHost = createContext({
61
+ plain: false,
62
+ liftTitle: false
63
+ });
56
64
  const codeLanguage = path => {
57
65
  const extension = fileViewExtension(path);
58
66
  if (extension === "ts" || extension === "mts" || extension === "cts") return "ts";
@@ -220,7 +228,9 @@ function TextExcerpt(props) {
220
228
  const lines = createMemo(() => props.text.replace(/\r\n?/g, "\n").replace(/\n$/, "").split("\n"));
221
229
  const limit = () => props.renderer.previewLines === undefined ? lines().length : Math.max(1, props.renderer.previewLines);
222
230
  const text = () => lines().slice(0, limit()).join("\n");
223
- return [_$ssr(_tmpl$8, props.renderer.previewLines !== undefined ? "k2b-content-file-view__excerpt" : "", _$escape(_$createComponent(Show, {
231
+ const host = useContext(FileViewHost);
232
+ // A plain preview has no code box: the host frames the file and owns its copy action.
233
+ const content = () => _$createComponent(Show, {
224
234
  get when() {
225
235
  return props.markdown;
226
236
  },
@@ -231,6 +241,9 @@ function TextExcerpt(props) {
231
241
  },
232
242
  get language() {
233
243
  return codeLanguage(props.renderer.file.path);
244
+ },
245
+ get copy() {
246
+ return host.plain ? false : undefined;
234
247
  }
235
248
  });
236
249
  },
@@ -244,7 +257,20 @@ function TextExcerpt(props) {
244
257
  }
245
258
  });
246
259
  }
247
- }))), _$createComponent(MoreLines, {
260
+ });
261
+ // Only an excerpt needs a clipping box; a complete preview keeps its content
262
+ // a direct child of the preview frame, which the frame's styles expect.
263
+ return [_$createComponent(Show, {
264
+ get when() {
265
+ return props.renderer.previewLines !== undefined;
266
+ },
267
+ get fallback() {
268
+ return content();
269
+ },
270
+ get children() {
271
+ return _$ssr(_tmpl$8, _$escape(content()));
272
+ }
273
+ }), _$createComponent(MoreLines, {
248
274
  get count() {
249
275
  return lines().length - limit();
250
276
  },
@@ -255,7 +281,12 @@ function TextExcerpt(props) {
255
281
  }
256
282
  function MarkdownRenderer(props) {
257
283
  const messages = useUiMessages();
284
+ const host = useContext(FileViewHost);
258
285
  const [editing, setEditing] = createSignal(false);
286
+ const markdown = () => {
287
+ const text = stripFrontmatter(props.editor?.draft() ?? props.content.content);
288
+ return host.liftTitle ? leadingMarkdownTitle(text)?.body ?? text : text;
289
+ };
259
290
  return _$createComponent(Show, {
260
291
  get when() {
261
292
  return _$memo(() => !!props.editor)() && editing();
@@ -282,7 +313,7 @@ function MarkdownRenderer(props) {
282
313
  return _$ssr(_tmpl$9, _$escape(_$createComponent(TextExcerpt, {
283
314
  renderer: props,
284
315
  get text() {
285
- return stripFrontmatter(props.editor?.draft() ?? props.content.content);
316
+ return markdown();
286
317
  },
287
318
  markdown: true
288
319
  })));
@@ -726,17 +757,19 @@ function PdfRenderer(props) {
726
757
  }
727
758
  });
728
759
  },
729
- children: pdf => _$createComponent(PdfPreview, {
760
+ children: pdf => // Composed without the standalone heading: the host already names the file, and the frame keeps the
761
+ // file name as its accessible title.
762
+ _$createComponent(PdfPreview, {
730
763
  autoLoad: true,
731
764
  get title() {
732
765
  return props.file.path.slice(props.file.path.lastIndexOf("/") + 1);
733
766
  },
734
767
  request: async () => pdf,
735
- "class": "k2b-content-file-view__pdf"
768
+ children: parts => _$ssr(_tmpl$17, _$escape(parts.actions), _$escape(parts.content))
736
769
  })
737
770
  });
738
771
  },
739
- children: href => _$ssr(_tmpl$17, _$ssrAttribute("data", _$escape(href(), true), false), _$ssrAttribute("aria-label", _$escape(props.file.path, true), false))
772
+ children: href => _$ssr(_tmpl$18, _$ssrAttribute("data", _$escape(href(), true), false), _$ssrAttribute("aria-label", _$escape(props.file.path, true), false))
740
773
  });
741
774
  }
742
775
  function AudioRenderer(props) {
@@ -746,7 +779,7 @@ function AudioRenderer(props) {
746
779
  return _$createComponent(DownloadAction, props);
747
780
  },
748
781
  get children() {
749
- return _$ssr(_tmpl$18, _$ssrAttribute("crossorigin", _$escape(props.crossOrigin, true), false), _$ssrAttribute("src", _$escape(mediaSource(props), true), false) + _$ssrAttribute("aria-label", _$escape(props.file.path, true), false), _$escape(messages().audioUnsupported));
782
+ return _$ssr(_tmpl$19, _$ssrAttribute("crossorigin", _$escape(props.crossOrigin, true), false), _$ssrAttribute("src", _$escape(mediaSource(props), true), false) + _$ssrAttribute("aria-label", _$escape(props.file.path, true), false), _$escape(messages().audioUnsupported));
750
783
  }
751
784
  });
752
785
  }
@@ -757,7 +790,7 @@ function VideoRenderer(props) {
757
790
  return _$createComponent(DownloadAction, props);
758
791
  },
759
792
  get children() {
760
- return _$ssr(_tmpl$19, _$ssrAttribute("crossorigin", _$escape(props.crossOrigin, true), false), _$ssrAttribute("src", _$escape(mediaSource(props), true), false) + _$ssrAttribute("aria-label", _$escape(props.file.path, true), false), _$escape(messages().videoUnsupported));
793
+ return _$ssr(_tmpl$20, _$ssrAttribute("crossorigin", _$escape(props.crossOrigin, true), false), _$ssrAttribute("src", _$escape(mediaSource(props), true), false) + _$ssrAttribute("aria-label", _$escape(props.file.path, true), false), _$escape(messages().videoUnsupported));
761
794
  }
762
795
  });
763
796
  }
@@ -776,7 +809,7 @@ function BinaryRenderer(props) {
776
809
  get when() {
777
810
  return props.downloadHref;
778
811
  },
779
- children: href => _$ssr(_tmpl$20, _$ssrAttribute("href", _$escape(href(), true), false), _$escape(messages().download))
812
+ children: href => _$ssr(_tmpl$21, _$ssrAttribute("href", _$escape(href(), true), false), _$escape(messages().download))
780
813
  });
781
814
  }
782
815
  });
@@ -904,7 +937,8 @@ export default function FileView(props) {
904
937
  });
905
938
  if (unregister) onCleanup(unregister);
906
939
  });
907
- const resolvedContent = createMemo(() => browserPreviewContent() ?? content());
940
+ // An errored resource throws when read; the error state below shows it instead.
941
+ const resolvedContent = createMemo(() => browserPreviewContent() ?? (content.error ? undefined : content()));
908
942
  const renderer = createMemo(() => {
909
943
  const loaded = resolvedContent();
910
944
  if (!loaded) return null;
@@ -927,78 +961,104 @@ export default function FileView(props) {
927
961
  saving: saveMutation.loading,
928
962
  save
929
963
  } : null;
930
- return _$ssr(_tmpl$21, `k2b-content-file-view ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("data-variant", _$escape(props.variant, true), false) + _$ssrAttribute("data-excerpt", props.previewLines !== undefined ? "true" : _$escape(undefined, true), false), _$escape(_$createComponent(Switch, {
964
+
965
+ // Undefined while loading; the host keeps its own placeholder until the shown file decides.
966
+ const documentTitle = createMemo(() => {
967
+ if (!props.onDocumentTitle) return undefined;
968
+ if (content.error) return null;
969
+ const loaded = resolvedContent();
970
+ if (!loaded) return undefined;
971
+ if (renderer()?.component !== MarkdownRenderer) return null;
972
+ return leadingMarkdownTitle(stripFrontmatter(editor()?.draft() ?? loaded.content))?.title ?? null;
973
+ });
974
+ createEffect(() => {
975
+ const title = documentTitle();
976
+ if (title !== undefined) props.onDocumentTitle?.(title);
977
+ });
978
+ return _$ssr(_tmpl$22, `k2b-content-file-view ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("data-variant", _$escape(props.variant, true), false) + _$ssrAttribute("data-excerpt", props.previewLines !== undefined ? "true" : _$escape(undefined, true), false), _$escape(_$createComponent(FileViewHost.Provider, {
979
+ value: {
980
+ get plain() {
981
+ return props.variant === "plain";
982
+ },
983
+ get liftTitle() {
984
+ return Boolean(props.onDocumentTitle);
985
+ }
986
+ },
931
987
  get children() {
932
- return [_$createComponent(Match, {
933
- get when() {
934
- return _$memo(() => !!content.loading)() && content() === undefined;
935
- },
936
- get children() {
937
- return _$createComponent(Placeholder, {
938
- icon: "ti ti-loader-2",
939
- get title() {
940
- return messages().loading;
941
- }
942
- });
943
- }
944
- }), _$createComponent(Match, {
945
- get when() {
946
- return content.error;
947
- },
988
+ return _$createComponent(Switch, {
948
989
  get children() {
949
- return _$createComponent(Placeholder, {
950
- icon: "ti ti-alert-circle",
951
- get title() {
952
- return messages().failedLoadFile;
990
+ return [_$createComponent(Match, {
991
+ get when() {
992
+ return _$memo(() => !!content.loading)() && content() === undefined;
953
993
  },
954
- get description() {
955
- return String(content.error?.message ?? "");
994
+ get children() {
995
+ return _$createComponent(Placeholder, {
996
+ icon: "ti ti-loader-2",
997
+ get title() {
998
+ return messages().loading;
999
+ }
1000
+ });
956
1001
  }
957
- });
958
- }
959
- }), _$createComponent(Match, {
960
- get when() {
961
- return _$memo(() => !!resolvedContent())() && renderer();
962
- },
963
- children: active => {
964
- const Renderer = active().component;
965
- return _$createComponent(Renderer, {
966
- get previewLines() {
967
- return props.previewLines;
968
- },
969
- get onExpandPreview() {
970
- return props.onExpandPreview;
971
- },
972
- get headingScale() {
973
- return props.headingScale;
974
- },
975
- get previewPreferencesKey() {
976
- return props.previewPreferencesKey;
977
- },
978
- get file() {
979
- return props.file;
980
- },
981
- get content() {
982
- return resolvedContent();
983
- },
984
- get previewHref() {
985
- return nativePreviewHref();
986
- },
987
- get crossOrigin() {
988
- return props.crossOrigin;
989
- },
990
- get onPreviewError() {
991
- return props.onPreviewError;
1002
+ }), _$createComponent(Match, {
1003
+ get when() {
1004
+ return content.error;
992
1005
  },
993
- get downloadHref() {
994
- return props.downloadHref ?? null;
1006
+ get children() {
1007
+ return _$createComponent(Placeholder, {
1008
+ icon: "ti ti-alert-circle",
1009
+ get title() {
1010
+ return messages().failedLoadFile;
1011
+ },
1012
+ get description() {
1013
+ return String(content.error?.message ?? "");
1014
+ }
1015
+ });
1016
+ }
1017
+ }), _$createComponent(Match, {
1018
+ get when() {
1019
+ return _$memo(() => !!resolvedContent())() && renderer();
995
1020
  },
996
- get editor() {
997
- return editor();
1021
+ children: active => {
1022
+ const Renderer = active().component;
1023
+ return _$createComponent(Renderer, {
1024
+ get previewLines() {
1025
+ return props.previewLines;
1026
+ },
1027
+ get onExpandPreview() {
1028
+ return props.onExpandPreview;
1029
+ },
1030
+ get headingScale() {
1031
+ return props.headingScale;
1032
+ },
1033
+ get previewPreferencesKey() {
1034
+ return props.previewPreferencesKey;
1035
+ },
1036
+ get file() {
1037
+ return props.file;
1038
+ },
1039
+ get content() {
1040
+ return resolvedContent();
1041
+ },
1042
+ get previewHref() {
1043
+ return nativePreviewHref();
1044
+ },
1045
+ get crossOrigin() {
1046
+ return props.crossOrigin;
1047
+ },
1048
+ get onPreviewError() {
1049
+ return props.onPreviewError;
1050
+ },
1051
+ get downloadHref() {
1052
+ return props.downloadHref ?? null;
1053
+ },
1054
+ get editor() {
1055
+ return editor();
1056
+ }
1057
+ });
998
1058
  }
999
- });
1059
+ })];
1000
1060
  }
1001
- })];
1061
+ });
1002
1062
  }
1003
1063
  })));
1004
1064
  }