@agimon-ai/po-author 0.0.0-alpha.19 → 0.0.0-alpha.20

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.
@@ -3,7 +3,7 @@ import { Store } from "@tanstack/store";
3
3
  import { useStore } from "@tanstack/react-store";
4
4
  import { useEffect, useRef, useState } from "react";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
- import { Button, CodeEditor, Markdown, MediaPreview, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, MessageLines, collapseLines, toolTone } from "@agimon-ai/po-web-components";
6
+ import { Button, CodeEditor, Dot, FileIcon, Markdown, MediaPreview, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, MessageLines, SparklesIcon, StatusBadge, TrashIcon, collapseLines, toolTone } from "@agimon-ai/po-web-components";
7
7
  import { sealedTransport } from "@agimon-ai/po-web-security/browser";
8
8
  //#region src/types/webAuthor.ts
9
9
  const authorChannelType = "author_webmcp";
@@ -1659,7 +1659,7 @@ function AuthorRegionDrafts({ sessionId, path, drafts }) {
1659
1659
  children: [
1660
1660
  drafts.candidate ? /* @__PURE__ */ jsxs(Fragment, { children: [
1661
1661
  /* @__PURE__ */ jsxs("h3", {
1662
- className: "text-base font-semibold text-po-text",
1662
+ className: "text-base font-semibold text-po-hi",
1663
1663
  children: ["Current ", candidateKind]
1664
1664
  }),
1665
1665
  /* @__PURE__ */ jsxs("p", {
@@ -1684,24 +1684,26 @@ function AuthorRegionDrafts({ sessionId, path, drafts }) {
1684
1684
  onChange: (event) => setAuthorCandidateText(sessionId, path, event.target.value),
1685
1685
  placeholder: "What should change here?",
1686
1686
  rows: 3,
1687
- className: "min-h-11 w-full resize-y rounded border border-po-border bg-po-deep p-2 text-lg leading-normal text-po-text focus:border-po-red focus:outline-none sm:text-sm"
1687
+ className: "min-h-24 w-full resize-y rounded-md border border-po-border-soft bg-po-panel p-3 text-lg leading-normal text-po-text placeholder:text-po-dim focus:border-po-green focus:outline-none sm:text-base"
1688
1688
  }),
1689
- /* @__PURE__ */ jsx(Button, {
1690
- className: "min-h-11 min-w-11 text-base [@media(pointer:fine)]:min-h-8 sm:text-sm",
1691
- variant: "outline",
1692
- onClick: add,
1693
- disabled: !drafts.candidate || !drafts.candidateText.trim() || drafts.annotations.length >= 16,
1694
- children: "add annotation"
1695
- }),
1696
- /* @__PURE__ */ jsx(Button, {
1697
- variant: "ghost",
1698
- className: "min-h-11 min-w-11 text-base [@media(pointer:fine)]:min-h-8 sm:text-sm",
1699
- onClick: () => {
1700
- setAuthorRegionCandidate(sessionId, path, void 0);
1701
- setAuthorCandidateText(sessionId, path, "");
1702
- setError(void 0);
1703
- },
1704
- children: "Discard annotation"
1689
+ /* @__PURE__ */ jsxs("div", {
1690
+ className: "flex flex-wrap gap-2",
1691
+ children: [/* @__PURE__ */ jsx(Button, {
1692
+ className: "min-h-11 min-w-11 text-base [@media(pointer:fine)]:min-h-8 sm:text-sm",
1693
+ variant: "outline",
1694
+ onClick: add,
1695
+ disabled: !drafts.candidate || !drafts.candidateText.trim() || drafts.annotations.length >= 16,
1696
+ children: "add annotation"
1697
+ }), /* @__PURE__ */ jsx(Button, {
1698
+ variant: "ghost",
1699
+ className: "min-h-11 min-w-11 text-base [@media(pointer:fine)]:min-h-8 sm:text-sm",
1700
+ onClick: () => {
1701
+ setAuthorRegionCandidate(sessionId, path, void 0);
1702
+ setAuthorCandidateText(sessionId, path, "");
1703
+ setError(void 0);
1704
+ },
1705
+ children: "Discard annotation"
1706
+ })]
1705
1707
  })
1706
1708
  ] }) : null,
1707
1709
  error ? /* @__PURE__ */ jsx("output", {
@@ -1709,7 +1711,7 @@ function AuthorRegionDrafts({ sessionId, path, drafts }) {
1709
1711
  children: error
1710
1712
  }) : null,
1711
1713
  drafts.annotations.length > 0 ? /* @__PURE__ */ jsxs("h3", {
1712
- className: "text-base font-semibold text-po-text",
1714
+ className: "text-sm text-po-dim",
1713
1715
  children: [
1714
1716
  "Unsent annotations (",
1715
1717
  drafts.annotations.length,
@@ -1719,16 +1721,31 @@ function AuthorRegionDrafts({ sessionId, path, drafts }) {
1719
1721
  /* @__PURE__ */ jsx("ol", {
1720
1722
  className: "space-y-2",
1721
1723
  children: drafts.annotations.map((region, index) => /* @__PURE__ */ jsxs("li", {
1722
- className: "rounded border border-po-border bg-po-panel p-2 text-base leading-normal text-po-text sm:text-sm",
1724
+ className: "flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-po-border-soft bg-po-panel py-1 pl-3 pr-1 text-base leading-normal text-po-text",
1723
1725
  children: [
1724
- /* @__PURE__ */ jsxs("span", { children: [
1725
- "(",
1726
- index + 1,
1727
- ") ",
1728
- region.mode === "point" ? "Point" : "Region",
1729
- ": ",
1730
- region.comment
1731
- ] }),
1726
+ /* @__PURE__ */ jsx("span", {
1727
+ "aria-hidden": "true",
1728
+ className: "flex h-6 min-w-6 shrink-0 items-center justify-center rounded-full bg-po-magenta px-1 text-sm font-semibold text-po-rail",
1729
+ children: index + 1
1730
+ }),
1731
+ /* @__PURE__ */ jsxs("span", {
1732
+ className: "min-w-0 flex-1 break-words py-1",
1733
+ children: [
1734
+ /* @__PURE__ */ jsxs("span", {
1735
+ className: "sr-only",
1736
+ children: [
1737
+ "(",
1738
+ index + 1,
1739
+ ") "
1740
+ ]
1741
+ }),
1742
+ region.comment,
1743
+ /* @__PURE__ */ jsx("span", {
1744
+ className: "block text-sm text-po-dim",
1745
+ children: region.mode === "point" ? "Point" : "Region"
1746
+ })
1747
+ ]
1748
+ }),
1732
1749
  region.anchor.kind === "video-time-rect" || region.anchor.kind === "video-time-point" ? /* @__PURE__ */ jsxs(Button, {
1733
1750
  variant: "outline",
1734
1751
  className: "min-h-11 min-w-11 text-base [@media(pointer:fine)]:min-h-8 sm:text-sm",
@@ -1747,7 +1764,10 @@ function AuthorRegionDrafts({ sessionId, path, drafts }) {
1747
1764
  variant: "ghost",
1748
1765
  "aria-label": `Remove annotation ${index + 1}`,
1749
1766
  onClick: () => removeAuthorRegion(sessionId, path, region.id),
1750
- children: "remove"
1767
+ children: /* @__PURE__ */ jsx(TrashIcon, {
1768
+ "aria-hidden": "true",
1769
+ className: "size-4"
1770
+ })
1751
1771
  })
1752
1772
  ]
1753
1773
  }, region.id))
@@ -1761,7 +1781,7 @@ function AuthorFeedbackControls({ sessionId, document, drafts, submitCapture })
1761
1781
  const [status, setStatus] = useState();
1762
1782
  const [capturing, setCapturing] = useState(false);
1763
1783
  return /* @__PURE__ */ jsxs("div", {
1764
- className: "space-y-2",
1784
+ className: "space-y-3",
1765
1785
  children: [
1766
1786
  /* @__PURE__ */ jsx(AuthorRegionDrafts, {
1767
1787
  sessionId,
@@ -1769,8 +1789,9 @@ function AuthorFeedbackControls({ sessionId, document, drafts, submitCapture })
1769
1789
  drafts
1770
1790
  }),
1771
1791
  drafts.annotations.length > 0 ? /* @__PURE__ */ jsx(Button, {
1772
- className: "min-h-11 min-w-11 w-full text-base [@media(pointer:fine)]:min-h-8 sm:text-sm",
1773
- variant: "outline",
1792
+ className: "min-h-11 min-w-11 w-full text-base",
1793
+ size: "lg",
1794
+ variant: "primary",
1774
1795
  "data-testid": "author-attach-capture",
1775
1796
  disabled: capturing || drafts.candidate !== void 0 || submitCapture === void 0,
1776
1797
  onClick: async () => {
@@ -1815,13 +1836,22 @@ const STATUS_LABELS = {
1815
1836
  UNTRACKED: "Sent, not tracked"
1816
1837
  };
1817
1838
  const STATUS_STYLES = {
1818
- REQUESTED: "border-po-yellow/35 bg-po-yellow/5 text-po-yellow",
1819
- CHANGING: "border-po-magenta/45 bg-po-magenta/10 text-po-yellow",
1820
- CHANGED: "border-po-cyan/40 bg-po-cyan/5 text-po-cyan",
1821
- COMPLETE: "border-po-green/40 bg-po-green/5 text-po-green",
1822
- FAILED: "border-po-red/45 bg-po-red/10 text-po-red",
1823
- CANCELLED: "border-po-border bg-po-panel text-po-dim",
1824
- UNTRACKED: "border-po-border bg-po-panel text-po-dim"
1839
+ REQUESTED: "border-po-border-soft bg-po-bg text-po-dim",
1840
+ CHANGING: "border-po-edge-green bg-po-tint-green text-po-green",
1841
+ CHANGED: "border-po-edge-green bg-po-tint-green text-po-green",
1842
+ COMPLETE: "border-po-edge-green bg-po-tint-green text-po-green",
1843
+ FAILED: "border-po-edge-red bg-po-tint-red text-po-red",
1844
+ CANCELLED: "border-po-border-soft bg-po-bg text-po-dim",
1845
+ UNTRACKED: "border-po-border-soft bg-po-bg text-po-dim"
1846
+ };
1847
+ const STATUS_TONES = {
1848
+ REQUESTED: "neutral",
1849
+ CHANGING: "ok",
1850
+ CHANGED: "ok",
1851
+ COMPLETE: "ok",
1852
+ FAILED: "error",
1853
+ CANCELLED: "neutral",
1854
+ UNTRACKED: "neutral"
1825
1855
  };
1826
1856
  function requestInstruction(requestText) {
1827
1857
  const referencedContext = requestText.search(/(?:^|\s+)Referenced context "/u);
@@ -1861,32 +1891,42 @@ function RequestRecord({ request, prominent = false }) {
1861
1891
  const instruction = requestInstruction(request.requestText);
1862
1892
  return /* @__PURE__ */ jsxs("article", {
1863
1893
  "data-testid": prominent ? "author-active-request" : void 0,
1864
- className: "space-y-3",
1894
+ className: "space-y-3 rounded-md border border-po-border-soft bg-po-panel p-3",
1865
1895
  children: [
1866
1896
  /* @__PURE__ */ jsxs("header", {
1867
- className: "border-b border-po-border-soft pb-3",
1868
- children: [/* @__PURE__ */ jsx("p", {
1869
- className: "text-lg font-semibold text-po-hi",
1870
- children: "Document context"
1871
- }), /* @__PURE__ */ jsxs("p", {
1872
- className: "mt-2 flex items-center gap-2 truncate text-base font-semibold text-po-hi",
1873
- children: [/* @__PURE__ */ jsx("span", {
1874
- "aria-hidden": true,
1875
- className: "text-po-magenta",
1876
- children: "↗"
1877
- }), documentName(request.documentPath)]
1897
+ className: "flex gap-3 border-b border-po-border-soft pb-3",
1898
+ children: [/* @__PURE__ */ jsx(SparklesIcon, {
1899
+ "aria-hidden": "true",
1900
+ className: "mt-1 size-4 shrink-0 text-po-green"
1901
+ }), /* @__PURE__ */ jsxs("div", {
1902
+ className: "min-w-0 flex-1",
1903
+ children: [
1904
+ /* @__PURE__ */ jsx("p", {
1905
+ className: "text-lg font-semibold text-po-hi",
1906
+ children: "Document context"
1907
+ }),
1908
+ /* @__PURE__ */ jsx("p", {
1909
+ className: "mt-1 truncate text-base font-semibold text-po-hi",
1910
+ children: documentName(request.documentPath)
1911
+ }),
1912
+ /* @__PURE__ */ jsx(StatusBadge, {
1913
+ tone: STATUS_TONES[request.status],
1914
+ className: "mt-2 whitespace-normal",
1915
+ children: progressLabel(request)
1916
+ })
1917
+ ]
1878
1918
  })]
1879
1919
  }),
1880
1920
  /* @__PURE__ */ jsx("section", {
1881
1921
  "aria-label": "Request locations",
1882
- className: "rounded border border-po-border bg-po-panel p-3",
1922
+ className: "rounded-md border border-po-border-soft bg-po-bg p-3",
1883
1923
  children: /* @__PURE__ */ jsx("ol", {
1884
1924
  className: "space-y-3",
1885
1925
  children: request.regions.map((region, index) => /* @__PURE__ */ jsxs("li", {
1886
1926
  className: "space-y-2",
1887
1927
  children: [
1888
1928
  /* @__PURE__ */ jsxs("p", {
1889
- className: "text-sm font-medium text-po-yellow",
1929
+ className: "text-sm font-medium text-po-magenta",
1890
1930
  children: [
1891
1931
  "Where · ",
1892
1932
  request.regions.length > 1 ? `${index + 1} · ` : "",
@@ -1915,7 +1955,7 @@ function RequestRecord({ request, prominent = false }) {
1915
1955
  }),
1916
1956
  /* @__PURE__ */ jsxs("section", {
1917
1957
  "data-testid": prominent ? "author-operation-card" : void 0,
1918
- className: `rounded border p-3 ${STATUS_STYLES[request.status]}`,
1958
+ className: `rounded-md border p-3 ${STATUS_STYLES[request.status]}`,
1919
1959
  children: [
1920
1960
  /* @__PURE__ */ jsxs("p", {
1921
1961
  className: "text-sm font-semibold",
@@ -1955,19 +1995,15 @@ function RequestRecord({ request, prominent = false }) {
1955
1995
  /* @__PURE__ */ jsxs("section", {
1956
1996
  className: "space-y-2",
1957
1997
  children: [/* @__PURE__ */ jsx("p", {
1958
- className: "text-lg font-semibold text-po-hi",
1998
+ className: "text-base font-semibold text-po-hi",
1959
1999
  children: "Request · how to change"
1960
2000
  }), /* @__PURE__ */ jsx("div", {
1961
- className: "rounded border border-po-border bg-po-deep p-3",
2001
+ className: "rounded-md border border-po-border-soft bg-po-bg p-3",
1962
2002
  children: /* @__PURE__ */ jsx("p", {
1963
2003
  className: "whitespace-pre-wrap text-base leading-relaxed text-po-text",
1964
2004
  children: instruction || "No additional instruction."
1965
2005
  })
1966
2006
  })]
1967
- }),
1968
- /* @__PURE__ */ jsx("footer", {
1969
- className: "text-sm text-po-dim",
1970
- children: progressLabel(request)
1971
2007
  })
1972
2008
  ]
1973
2009
  });
@@ -2010,6 +2046,10 @@ function AuthorRequestLog({ requests }) {
2010
2046
  }
2011
2047
  //#endregion
2012
2048
  //#region src/extensions/workspaces/sessions/(frontend)/dock/_components/AuthorToolPalette.tsx
2049
+ /** One tool tile. An active annotation tool is the person's mark (rose); an active view tool is Po's jade. */
2050
+ function authorToolClassName(active, annotates) {
2051
+ return `h-auto min-h-11 min-w-11 flex-col gap-1 rounded-md px-1 py-2 text-base [@media(pointer:fine)]:min-h-8 ${!active ? "border-po-border-soft bg-po-panel text-po-dim" : annotates ? "border-po-edge-magenta bg-po-tint-magenta font-semibold text-po-magenta hover:text-po-magenta" : "border-po-edge-green bg-po-tint-green font-semibold text-po-green hover:text-po-green"}`;
2052
+ }
2013
2053
  function AuthorToolPalette({ sessionId, path, kind, activeTool }) {
2014
2054
  const [error, setError] = useState();
2015
2055
  const format = (style) => {
@@ -2037,18 +2077,21 @@ function AuthorToolPalette({ sessionId, path, kind, activeTool }) {
2037
2077
  label: "Pan",
2038
2078
  glyph: "✋",
2039
2079
  action: () => setAuthorToolMode(sessionId, path, activeTool === "pan" ? "select" : "pan"),
2040
- active: activeTool === "pan"
2080
+ active: activeTool === "pan",
2081
+ annotates: false
2041
2082
  }, {
2042
2083
  label: "Draw",
2043
2084
  glyph: "✎",
2044
2085
  action: () => setAuthorToolMode(sessionId, path, activeTool === "draw" ? "select" : "draw"),
2045
- active: activeTool === "draw"
2086
+ active: activeTool === "draw",
2087
+ annotates: true
2046
2088
  }] : [],
2047
2089
  {
2048
2090
  label: "Region",
2049
2091
  glyph: "⌗",
2050
2092
  action: () => setAuthorToolMode(sessionId, path, activeTool === "mark" ? "select" : "mark"),
2051
- active: activeTool === "mark"
2093
+ active: activeTool === "mark",
2094
+ annotates: true
2052
2095
  },
2053
2096
  ...kind === "markdown" ? [
2054
2097
  {
@@ -2076,37 +2119,39 @@ function AuthorToolPalette({ sessionId, path, kind, activeTool }) {
2076
2119
  label: "Comment",
2077
2120
  glyph: "●",
2078
2121
  action: () => setAuthorToolMode(sessionId, path, activeTool === "comment" ? "select" : "comment"),
2079
- active: activeTool === "comment"
2122
+ active: activeTool === "comment",
2123
+ annotates: true
2080
2124
  }
2081
2125
  ];
2082
2126
  return /* @__PURE__ */ jsxs("section", {
2083
2127
  "data-testid": "author-tool-palette",
2084
- className: "space-y-2 border-b border-po-border-soft pb-3",
2128
+ className: "space-y-2",
2085
2129
  children: [
2086
- /* @__PURE__ */ jsxs("div", {
2087
- className: "flex justify-between text-sm text-po-dim",
2088
- children: [/* @__PURE__ */ jsx("h3", {
2089
- className: "text-lg font-semibold text-po-hi",
2090
- children: "Tools"
2091
- }), /* @__PURE__ */ jsx("span", { children: "focused tab" })]
2130
+ /* @__PURE__ */ jsx("h3", {
2131
+ className: "sr-only",
2132
+ children: "Tools"
2092
2133
  }),
2093
2134
  /* @__PURE__ */ jsx("div", {
2094
- className: "grid grid-cols-3 gap-1.5",
2135
+ className: "grid grid-cols-4 gap-1.5",
2095
2136
  children: tools.map((tool) => /* @__PURE__ */ jsxs(Button, {
2096
2137
  size: "md",
2097
2138
  variant: "outline",
2098
2139
  "aria-label": tool.label === "Region" ? "mark region" : tool.label,
2099
2140
  "aria-pressed": tool.active,
2100
2141
  onClick: tool.action,
2101
- className: `min-h-11 min-w-11 gap-1.5 rounded border text-base [@media(pointer:fine)]:min-h-8 ${tool.active ? "border-po-red bg-po-red/10 text-po-hi hover:bg-po-red/15" : "border-po-border bg-po-panel text-po-dim"}`,
2142
+ className: authorToolClassName(tool.active === true, tool.annotates === true),
2102
2143
  children: [/* @__PURE__ */ jsx("span", {
2103
2144
  "aria-hidden": "true",
2145
+ className: "text-lg leading-none",
2104
2146
  children: tool.glyph
2105
- }), tool.label]
2147
+ }), /* @__PURE__ */ jsx("span", {
2148
+ className: "text-sm",
2149
+ children: tool.label
2150
+ })]
2106
2151
  }, tool.label))
2107
2152
  }),
2108
2153
  /* @__PURE__ */ jsx("p", {
2109
- className: "text-base leading-normal text-po-dim",
2154
+ className: "text-base leading-normal text-po-dim sm:text-sm",
2110
2155
  children: activeTool === "draw" ? "Draw a location mark, then enter feedback text. Marks never edit the source." : activeTool === "pan" ? "Drag to pan; pinch to zoom. Use Fit to reset the view." : activeTool === "mark" ? "Drag over the document to mark a region." : activeTool === "comment" ? "Click the document to place a comment pin." : "Choose Region to drag an area, or Comment to place a point."
2111
2156
  }),
2112
2157
  error ? /* @__PURE__ */ jsx("output", {
@@ -2137,15 +2182,22 @@ function AuthorPanel({ sessionId, submitCapture, statuses, renderSlot, renderSes
2137
2182
  children: [/* @__PURE__ */ jsx("div", {
2138
2183
  className: "min-h-0 flex-1 overflow-y-auto p-3",
2139
2184
  children: /* @__PURE__ */ jsxs("div", {
2140
- className: "flex flex-col gap-2",
2185
+ className: "flex flex-col gap-3",
2141
2186
  children: [
2142
2187
  /* @__PURE__ */ jsx("div", {
2143
2188
  "data-testid": "author-preview-providers",
2189
+ className: "empty:hidden",
2144
2190
  children: renderSlot("author.preview-provider")
2145
2191
  }),
2146
2192
  sessionId !== null && workspace !== void 0 && focused !== void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
2193
+ /* @__PURE__ */ jsx(AuthorToolPalette, {
2194
+ sessionId,
2195
+ path: focused.path,
2196
+ kind: focused.kind,
2197
+ activeTool: workspace.toolsByDocument[normalizeAuthorPath(focused.path)] ?? "select"
2198
+ }),
2147
2199
  /* @__PURE__ */ jsx("h2", {
2148
- className: "text-base font-semibold text-po-text",
2200
+ className: "border-t border-po-border-soft pt-3 text-lg font-semibold text-po-hi",
2149
2201
  children: "Annotations"
2150
2202
  }),
2151
2203
  /* @__PURE__ */ jsx("p", {
@@ -2156,12 +2208,6 @@ function AuthorPanel({ sessionId, submitCapture, statuses, renderSlot, renderSes
2156
2208
  className: "text-base text-po-dim sm:text-sm",
2157
2209
  children: "Annotations reference video frames. They do not save changes to the source video."
2158
2210
  }) : null,
2159
- /* @__PURE__ */ jsx(AuthorToolPalette, {
2160
- sessionId,
2161
- path: focused.path,
2162
- kind: focused.kind,
2163
- activeTool: workspace.toolsByDocument[normalizeAuthorPath(focused.path)] ?? "select"
2164
- }),
2165
2211
  autonomousVoiceGridVisible(statuses) && grid !== void 0 ? /* @__PURE__ */ jsxs("div", {
2166
2212
  "data-testid": "author-grid-snapshot",
2167
2213
  className: "rounded border border-po-red/40 bg-po-red/5 p-2 text-base text-po-dim",
@@ -2183,7 +2229,10 @@ function AuthorPanel({ sessionId, submitCapture, statuses, renderSlot, renderSes
2183
2229
  }, focused.path)
2184
2230
  })
2185
2231
  ] }) : null,
2186
- /* @__PURE__ */ jsx(AuthorRequestLog, { requests })
2232
+ /* @__PURE__ */ jsx("div", {
2233
+ className: focused === void 0 ? void 0 : "border-t border-po-border-soft pt-3",
2234
+ children: /* @__PURE__ */ jsx(AuthorRequestLog, { requests })
2235
+ })
2187
2236
  ]
2188
2237
  })
2189
2238
  }), activity === null ? null : /* @__PURE__ */ jsx("footer", {
@@ -3114,6 +3163,8 @@ function AuthorVideoControls({ playback, ready, locked, marking, onSeek, onToggl
3114
3163
  }
3115
3164
  //#endregion
3116
3165
  //#region src/extensions/workspaces/sessions/(frontend)/_components/AuthorMediaView.tsx
3166
+ const REGION_FRAME = "pointer-events-none absolute border-2 border-po-magenta bg-po-magenta/10";
3167
+ const ORDINAL_BADGE = "absolute -left-3 -top-3 flex h-6 min-w-6 items-center justify-center rounded-full border-2 border-po-panel bg-po-magenta px-1 text-sm font-semibold text-po-rail";
3117
3168
  /** Marks source media. Native playback and page controls remain usable in select mode. */
3118
3169
  function AuthorMediaView({ sessionId, document: source, activeTool, displayedRegions, pendingCandidate = false, seekRequest }) {
3119
3170
  const host = useRef(null);
@@ -3397,14 +3448,14 @@ function AuthorMediaView({ sessionId, document: source, activeTool, displayedReg
3397
3448
  strokeWidth: "5",
3398
3449
  strokeLinecap: "round",
3399
3450
  strokeLinejoin: "round",
3400
- className: ordinal === void 0 ? "text-po-red" : "text-po-yellow"
3451
+ className: "text-po-magenta"
3401
3452
  })
3402
3453
  });
3403
3454
  const selected = selection?.path === source.path ? selection.rect : void 0;
3404
3455
  const selectedPoint = selection?.path === source.path ? selection.point : void 0;
3405
3456
  const selectionOverlay = selected === void 0 ? null : /* @__PURE__ */ jsx("div", {
3406
3457
  "data-testid": "author-media-selection",
3407
- className: "pointer-events-none absolute border-2 border-po-red bg-po-red/10",
3458
+ className: "pointer-events-none absolute border-2 border-dashed border-po-magenta bg-po-magenta/10",
3408
3459
  style: {
3409
3460
  left: `${selected.x * 100}%`,
3410
3461
  top: `${selected.y * 100}%`,
@@ -3415,7 +3466,7 @@ function AuthorMediaView({ sessionId, document: source, activeTool, displayedReg
3415
3466
  const pointPin = (ordinal, point, key) => /* @__PURE__ */ jsx("span", {
3416
3467
  "data-author-point": ordinal,
3417
3468
  "data-testid": ordinal === void 0 ? "author-media-point-selection" : void 0,
3418
- className: `pointer-events-none absolute z-10 flex h-5 min-w-5 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full border-2 px-1 text-2xs font-semibold ${ordinal === void 0 ? "border-white bg-po-red text-white" : "border-po-deep bg-po-yellow text-po-deep"}`,
3469
+ className: `pointer-events-none absolute z-10 flex h-6 min-w-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full border-2 px-1 text-sm font-semibold ${ordinal === void 0 ? "border-po-magenta bg-po-panel text-po-magenta" : "border-po-panel bg-po-magenta text-po-rail"}`,
3419
3470
  style: {
3420
3471
  left: `${String(point.x * 100)}%`,
3421
3472
  top: `${String(point.y * 100)}%`
@@ -3424,8 +3475,7 @@ function AuthorMediaView({ sessionId, document: source, activeTool, displayedReg
3424
3475
  }, key);
3425
3476
  const pointSelectionOverlay = selectedPoint === void 0 ? null : pointPin(void 0, selectedPoint, "selection");
3426
3477
  return /* @__PURE__ */ jsxs("div", {
3427
- ref: host,
3428
- className: "min-h-0 flex-1 overflow-auto p-4",
3478
+ className: "flex min-h-0 flex-1 flex-col",
3429
3479
  style: { cursor: activeTool === "draw" || activeTool === "mark" ? "crosshair" : void 0 },
3430
3480
  onPointerMove: (event) => {
3431
3481
  if (pointers.current.has(event.pointerId)) pointers.current.set(event.pointerId, {
@@ -3545,141 +3595,43 @@ function AuthorMediaView({ sessionId, document: source, activeTool, displayedReg
3545
3595
  pan.current = void 0;
3546
3596
  setStroke(void 0);
3547
3597
  },
3548
- children: [
3549
- /* @__PURE__ */ jsxs("div", {
3550
- className: "sticky top-0 z-20 mb-2 flex items-center gap-2 bg-po-bg py-1",
3551
- role: "group",
3552
- "aria-label": "Canvas zoom",
3598
+ children: [/* @__PURE__ */ jsx("div", {
3599
+ ref: host,
3600
+ className: "flex min-h-0 flex-1 flex-col overflow-auto bg-po-deep/50 p-6",
3601
+ children: /* @__PURE__ */ jsxs("div", {
3602
+ className: "m-auto flex max-w-full flex-col items-center gap-3",
3553
3603
  children: [
3554
- /* @__PURE__ */ jsx(Button, {
3555
- size: "md",
3556
- variant: "outline",
3557
- "aria-label": "Zoom out",
3558
- className: "min-h-11 min-w-11",
3559
- onClick: () => setZoom((current) => Math.max(1, current / 1.5)),
3560
- children: "−"
3561
- }),
3562
- /* @__PURE__ */ jsxs("output", {
3563
- className: "text-sm text-po-dim",
3564
- children: [Math.round(zoom * 100), "%"]
3565
- }),
3566
- /* @__PURE__ */ jsx(Button, {
3567
- size: "md",
3568
- variant: "outline",
3569
- "aria-label": "Zoom in",
3570
- className: "min-h-11 min-w-11",
3571
- onClick: () => setZoom((current) => Math.min(8, current * 1.5)),
3572
- children: "+"
3573
- }),
3574
- /* @__PURE__ */ jsx(Button, {
3575
- size: "md",
3576
- variant: "outline",
3577
- "aria-label": "Fit canvas",
3578
- className: "min-h-11",
3579
- onClick: () => {
3580
- setZoom(1);
3581
- if (host.current) {
3582
- host.current.scrollLeft = 0;
3583
- host.current.scrollTop = 0;
3584
- }
3604
+ mediaUrl === void 0 ? /* @__PURE__ */ jsx("p", {
3605
+ className: "text-po-dim",
3606
+ children: error === void 0 ? "Loading media..." : "Media unavailable."
3607
+ }) : source.kind === "image" ? /* @__PURE__ */ jsxs("div", {
3608
+ className: "relative inline-block max-w-full shadow-sm ring-1 ring-po-border-soft",
3609
+ style: {
3610
+ zoom,
3611
+ touchAction: activeTool === "select" ? "auto" : "none"
3585
3612
  },
3586
- children: "Fit"
3587
- })
3588
- ]
3589
- }),
3590
- mediaUrl === void 0 ? /* @__PURE__ */ jsx("p", {
3591
- className: "text-po-dim",
3592
- children: error === void 0 ? "Loading media..." : "Media unavailable."
3593
- }) : source.kind === "image" ? /* @__PURE__ */ jsxs("div", {
3594
- className: "relative inline-block max-w-full",
3595
- style: {
3596
- zoom,
3597
- touchAction: activeTool === "select" ? "auto" : "none"
3598
- },
3599
- children: [
3600
- /* @__PURE__ */ jsx("img", {
3601
- ref: image,
3602
- src: mediaUrl,
3603
- alt: source.path,
3604
- draggable: false,
3605
- className: "block max-w-full"
3606
- }),
3607
- selectionOverlay,
3608
- pointSelectionOverlay,
3609
- strokeOverlay(stroke),
3610
- displayedRegions.flatMap(({ ordinal, region }) => {
3611
- if (region.stroke !== void 0) return [/* @__PURE__ */ jsxs("div", {
3612
- className: "pointer-events-none absolute inset-0",
3613
- children: [strokeOverlay(region.stroke, ordinal), pointPin(ordinal, region.stroke[0], `label:${region.id}`)]
3614
- }, region.id)];
3615
- if (region.anchor.kind === "image-point") return [pointPin(ordinal, region.anchor.point, region.id)];
3616
- if (region.anchor.kind !== "image-rect") return [];
3617
- const { rect } = region.anchor;
3618
- return [/* @__PURE__ */ jsx("div", {
3619
- "data-author-region": ordinal,
3620
- className: "pointer-events-none absolute border border-po-yellow bg-po-yellow/10",
3621
- style: {
3622
- left: `${String(rect.x * 100)}%`,
3623
- top: `${String(rect.y * 100)}%`,
3624
- width: `${String(rect.width * 100)}%`,
3625
- height: `${String(rect.height * 100)}%`
3626
- },
3627
- children: /* @__PURE__ */ jsx("span", {
3628
- className: "absolute -left-2 -top-2 flex h-4 min-w-4 items-center justify-center rounded-full bg-po-yellow px-1 text-2xs font-semibold text-po-deep",
3629
- children: ordinal
3630
- })
3631
- }, region.id)];
3632
- })
3633
- ]
3634
- }) : /* @__PURE__ */ jsxs("div", {
3635
- className: "relative w-fit max-w-full",
3636
- style: {
3637
- zoom,
3638
- touchAction: activeTool === "select" ? "auto" : "none"
3639
- },
3640
- children: [/* @__PURE__ */ jsx(MediaPreview, {
3641
- src: mediaUrl,
3642
- path: source.path,
3643
- kind: source.kind === "pdf" ? "pdf" : source.kind === "video" ? "video" : "download",
3644
- controllerRef: video,
3645
- pdfControllerRef: pdf,
3646
- "data-testid": "author-media",
3647
- videoControls: false,
3648
- onPlaybackStateChange: (state) => {
3649
- setPlayback(state);
3650
- setFrameReady(video.current?.isFrameReady() ?? false);
3651
- if (state.playing) setSelection(void 0);
3652
- }
3653
- }), /* @__PURE__ */ jsxs("div", {
3654
- className: "pointer-events-none absolute",
3655
- style: source.kind === "pdf" ? pdfPlane === void 0 ? { display: "none" } : {
3656
- left: pdfPlane.left,
3657
- top: pdfPlane.top,
3658
- width: pdfPlane.width,
3659
- height: pdfPlane.height
3660
- } : { inset: 0 },
3661
- children: [
3662
- selectionOverlay,
3663
- pointSelectionOverlay,
3664
- strokeOverlay(stroke),
3665
- displayedRegions.map(({ ordinal, region }) => {
3666
- if (region.stroke !== void 0) {
3667
- const anchor = region.anchor;
3668
- if (source.kind === "pdf" && (anchor.kind !== "pdf-page-rect" || anchor.page !== pdf.current?.getState().page)) return null;
3669
- if (source.kind === "video" && (anchor.kind !== "video-time-rect" || playback.playing || Math.abs(anchor.timeSeconds - playback.currentTime) > .1)) return null;
3670
- return /* @__PURE__ */ jsxs("div", {
3613
+ children: [
3614
+ /* @__PURE__ */ jsx("img", {
3615
+ ref: image,
3616
+ src: mediaUrl,
3617
+ alt: source.path,
3618
+ draggable: false,
3619
+ className: "block max-w-full"
3620
+ }),
3621
+ selectionOverlay,
3622
+ pointSelectionOverlay,
3623
+ strokeOverlay(stroke),
3624
+ displayedRegions.flatMap(({ ordinal, region }) => {
3625
+ if (region.stroke !== void 0) return [/* @__PURE__ */ jsxs("div", {
3671
3626
  className: "pointer-events-none absolute inset-0",
3672
3627
  children: [strokeOverlay(region.stroke, ordinal), pointPin(ordinal, region.stroke[0], `label:${region.id}`)]
3673
- }, region.id);
3674
- }
3675
- if (source.kind === "pdf") {
3676
- if (region.anchor.kind !== "pdf-page-point" && region.anchor.kind !== "pdf-page-rect") return null;
3677
- if (region.anchor.page !== pdf.current?.getState().page) return null;
3678
- if (region.anchor.kind === "pdf-page-point") return pointPin(ordinal, region.anchor.point, region.id);
3628
+ }, region.id)];
3629
+ if (region.anchor.kind === "image-point") return [pointPin(ordinal, region.anchor.point, region.id)];
3630
+ if (region.anchor.kind !== "image-rect") return [];
3679
3631
  const { rect } = region.anchor;
3680
- return /* @__PURE__ */ jsx("div", {
3632
+ return [/* @__PURE__ */ jsx("div", {
3681
3633
  "data-author-region": ordinal,
3682
- className: "pointer-events-none absolute border border-po-yellow bg-po-yellow/10",
3634
+ className: REGION_FRAME,
3683
3635
  style: {
3684
3636
  left: `${String(rect.x * 100)}%`,
3685
3637
  top: `${String(rect.y * 100)}%`,
@@ -3687,55 +3639,167 @@ function AuthorMediaView({ sessionId, document: source, activeTool, displayedReg
3687
3639
  height: `${String(rect.height * 100)}%`
3688
3640
  },
3689
3641
  children: /* @__PURE__ */ jsx("span", {
3690
- className: "bg-po-yellow text-po-deep",
3642
+ className: ORDINAL_BADGE,
3691
3643
  children: ordinal
3692
3644
  })
3693
- }, region.id);
3645
+ }, region.id)];
3646
+ })
3647
+ ]
3648
+ }) : /* @__PURE__ */ jsxs("div", {
3649
+ className: "relative w-fit max-w-full shadow-sm ring-1 ring-po-border-soft",
3650
+ style: {
3651
+ zoom,
3652
+ touchAction: activeTool === "select" ? "auto" : "none"
3653
+ },
3654
+ children: [/* @__PURE__ */ jsx(MediaPreview, {
3655
+ src: mediaUrl,
3656
+ path: source.path,
3657
+ kind: source.kind === "pdf" ? "pdf" : source.kind === "video" ? "video" : "download",
3658
+ controllerRef: video,
3659
+ pdfControllerRef: pdf,
3660
+ "data-testid": "author-media",
3661
+ videoControls: false,
3662
+ onPlaybackStateChange: (state) => {
3663
+ setPlayback(state);
3664
+ setFrameReady(video.current?.isFrameReady() ?? false);
3665
+ if (state.playing) setSelection(void 0);
3694
3666
  }
3695
- if (source.kind !== "video" || playback.playing) return null;
3696
- if (region.anchor.kind === "video-time-point" && Math.abs(region.anchor.timeSeconds - playback.currentTime) <= .1) return pointPin(ordinal, region.anchor.point, region.id);
3697
- if (region.anchor.kind !== "video-time-rect" || Math.abs(region.anchor.timeSeconds - playback.currentTime) > .1) return null;
3698
- const { rect } = region.anchor;
3699
- return /* @__PURE__ */ jsx("div", {
3700
- "data-author-region": ordinal,
3701
- className: "pointer-events-none absolute border border-po-yellow bg-po-yellow/10",
3702
- style: {
3703
- left: `${rect.x * 100}%`,
3704
- top: `${rect.y * 100}%`,
3705
- width: `${rect.width * 100}%`,
3706
- height: `${rect.height * 100}%`
3707
- },
3708
- children: /* @__PURE__ */ jsx("span", {
3709
- className: "bg-po-yellow text-po-deep",
3710
- children: ordinal
3667
+ }), /* @__PURE__ */ jsxs("div", {
3668
+ className: "pointer-events-none absolute",
3669
+ style: source.kind === "pdf" ? pdfPlane === void 0 ? { display: "none" } : {
3670
+ left: pdfPlane.left,
3671
+ top: pdfPlane.top,
3672
+ width: pdfPlane.width,
3673
+ height: pdfPlane.height
3674
+ } : { inset: 0 },
3675
+ children: [
3676
+ selectionOverlay,
3677
+ pointSelectionOverlay,
3678
+ strokeOverlay(stroke),
3679
+ displayedRegions.map(({ ordinal, region }) => {
3680
+ if (region.stroke !== void 0) {
3681
+ const anchor = region.anchor;
3682
+ if (source.kind === "pdf" && (anchor.kind !== "pdf-page-rect" || anchor.page !== pdf.current?.getState().page)) return null;
3683
+ if (source.kind === "video" && (anchor.kind !== "video-time-rect" || playback.playing || Math.abs(anchor.timeSeconds - playback.currentTime) > .1)) return null;
3684
+ return /* @__PURE__ */ jsxs("div", {
3685
+ className: "pointer-events-none absolute inset-0",
3686
+ children: [strokeOverlay(region.stroke, ordinal), pointPin(ordinal, region.stroke[0], `label:${region.id}`)]
3687
+ }, region.id);
3688
+ }
3689
+ if (source.kind === "pdf") {
3690
+ if (region.anchor.kind !== "pdf-page-point" && region.anchor.kind !== "pdf-page-rect") return null;
3691
+ if (region.anchor.page !== pdf.current?.getState().page) return null;
3692
+ if (region.anchor.kind === "pdf-page-point") return pointPin(ordinal, region.anchor.point, region.id);
3693
+ const { rect } = region.anchor;
3694
+ return /* @__PURE__ */ jsx("div", {
3695
+ "data-author-region": ordinal,
3696
+ className: REGION_FRAME,
3697
+ style: {
3698
+ left: `${String(rect.x * 100)}%`,
3699
+ top: `${String(rect.y * 100)}%`,
3700
+ width: `${String(rect.width * 100)}%`,
3701
+ height: `${String(rect.height * 100)}%`
3702
+ },
3703
+ children: /* @__PURE__ */ jsx("span", {
3704
+ className: ORDINAL_BADGE,
3705
+ children: ordinal
3706
+ })
3707
+ }, region.id);
3708
+ }
3709
+ if (source.kind !== "video" || playback.playing) return null;
3710
+ if (region.anchor.kind === "video-time-point" && Math.abs(region.anchor.timeSeconds - playback.currentTime) <= .1) return pointPin(ordinal, region.anchor.point, region.id);
3711
+ if (region.anchor.kind !== "video-time-rect" || Math.abs(region.anchor.timeSeconds - playback.currentTime) > .1) return null;
3712
+ const { rect } = region.anchor;
3713
+ return /* @__PURE__ */ jsx("div", {
3714
+ "data-author-region": ordinal,
3715
+ className: REGION_FRAME,
3716
+ style: {
3717
+ left: `${rect.x * 100}%`,
3718
+ top: `${rect.y * 100}%`,
3719
+ width: `${rect.width * 100}%`,
3720
+ height: `${rect.height * 100}%`
3721
+ },
3722
+ children: /* @__PURE__ */ jsx("span", {
3723
+ className: ORDINAL_BADGE,
3724
+ children: ordinal
3725
+ })
3726
+ }, region.id);
3711
3727
  })
3712
- }, region.id);
3728
+ ]
3729
+ })]
3730
+ }),
3731
+ source.kind === "video" ? /* @__PURE__ */ jsx(AuthorVideoControls, {
3732
+ playback,
3733
+ ready: frameReady,
3734
+ locked: pendingCandidate,
3735
+ marking: activeTool === "mark",
3736
+ onSeek: seek,
3737
+ onToggle: () => {
3738
+ setAuthorToolMode(sessionId, source.path, "select");
3739
+ setSelection(void 0);
3740
+ if (playback.playing) video.current?.pause();
3741
+ else video.current?.play().catch((reason) => setError(String(reason)));
3742
+ },
3743
+ onAnnotate: () => {
3744
+ video.current?.pause();
3745
+ setAuthorToolMode(sessionId, source.path, "mark");
3746
+ }
3747
+ }) : null,
3748
+ error ? /* @__PURE__ */ jsx("output", {
3749
+ className: "text-base text-po-red",
3750
+ children: error
3751
+ }) : null
3752
+ ]
3753
+ })
3754
+ }), /* @__PURE__ */ jsxs("footer", {
3755
+ className: "flex shrink-0 items-center gap-2 border-t border-po-border bg-po-bg px-3 py-1.5",
3756
+ children: [/* @__PURE__ */ jsxs("div", {
3757
+ role: "group",
3758
+ "aria-label": "Canvas zoom",
3759
+ className: "flex items-center gap-2",
3760
+ children: [/* @__PURE__ */ jsxs("div", {
3761
+ className: "flex items-center rounded-md border border-po-border",
3762
+ children: [
3763
+ /* @__PURE__ */ jsx(Button, {
3764
+ size: "md",
3765
+ variant: "ghost",
3766
+ "aria-label": "Zoom out",
3767
+ className: "min-h-11 min-w-11 rounded-r-none [@media(pointer:fine)]:min-h-8",
3768
+ onClick: () => setZoom((current) => Math.max(1, current / 1.5)),
3769
+ children: "−"
3770
+ }),
3771
+ /* @__PURE__ */ jsxs("output", {
3772
+ className: "flex min-w-14 items-center justify-center self-stretch border-x border-po-border-soft text-sm tabular-nums text-po-text",
3773
+ children: [Math.round(zoom * 100), "%"]
3774
+ }),
3775
+ /* @__PURE__ */ jsx(Button, {
3776
+ size: "md",
3777
+ variant: "ghost",
3778
+ "aria-label": "Zoom in",
3779
+ className: "min-h-11 min-w-11 rounded-l-none [@media(pointer:fine)]:min-h-8",
3780
+ onClick: () => setZoom((current) => Math.min(8, current * 1.5)),
3781
+ children: "+"
3713
3782
  })
3714
3783
  ]
3784
+ }), /* @__PURE__ */ jsx(Button, {
3785
+ size: "md",
3786
+ variant: "outline",
3787
+ "aria-label": "Fit canvas",
3788
+ className: "min-h-11 [@media(pointer:fine)]:min-h-8",
3789
+ onClick: () => {
3790
+ setZoom(1);
3791
+ if (host.current) {
3792
+ host.current.scrollLeft = 0;
3793
+ host.current.scrollTop = 0;
3794
+ }
3795
+ },
3796
+ children: "Fit"
3715
3797
  })]
3716
- }),
3717
- source.kind === "video" ? /* @__PURE__ */ jsx(AuthorVideoControls, {
3718
- playback,
3719
- ready: frameReady,
3720
- locked: pendingCandidate,
3721
- marking: activeTool === "mark",
3722
- onSeek: seek,
3723
- onToggle: () => {
3724
- setAuthorToolMode(sessionId, source.path, "select");
3725
- setSelection(void 0);
3726
- if (playback.playing) video.current?.pause();
3727
- else video.current?.play().catch((reason) => setError(String(reason)));
3728
- },
3729
- onAnnotate: () => {
3730
- video.current?.pause();
3731
- setAuthorToolMode(sessionId, source.path, "mark");
3732
- }
3733
- }) : null,
3734
- error ? /* @__PURE__ */ jsx("output", {
3735
- className: "text-base text-po-red",
3736
- children: error
3737
- }) : null
3738
- ]
3798
+ }), /* @__PURE__ */ jsx("span", {
3799
+ className: "ml-auto text-sm text-po-dim first-letter:uppercase",
3800
+ children: source.kind
3801
+ })]
3802
+ })]
3739
3803
  });
3740
3804
  }
3741
3805
  //#endregion
@@ -3879,13 +3943,17 @@ function AuthorTextView({ sessionId, document, preview, displayedRegions }) {
3879
3943
  label: String(ordinal)
3880
3944
  }] : []));
3881
3945
  }, [displayedRegions]);
3882
- return /* @__PURE__ */ jsx("div", {
3946
+ const lines = (document.content ?? "").split("\n").length;
3947
+ return /* @__PURE__ */ jsxs("div", {
3883
3948
  ref: host,
3884
3949
  className: "flex min-h-0 flex-1 flex-col",
3885
- children: preview ? /* @__PURE__ */ jsx("div", {
3950
+ children: [preview ? /* @__PURE__ */ jsx("div", {
3886
3951
  "data-testid": "author-markdown",
3887
- className: "min-h-0 flex-1 overflow-auto p-4 text-base text-po-text",
3888
- children: /* @__PURE__ */ jsx(Markdown, { text: document.content ?? "" })
3952
+ className: "min-h-0 flex-1 overflow-auto bg-po-deep/50 p-6",
3953
+ children: /* @__PURE__ */ jsx("article", {
3954
+ className: "mx-auto min-h-full max-w-3xl rounded-md bg-po-panel px-6 py-8 sm:px-10 text-lg leading-relaxed text-po-text shadow-sm ring-1 ring-po-border-soft",
3955
+ children: /* @__PURE__ */ jsx(Markdown, { text: document.content ?? "" })
3956
+ })
3889
3957
  }) : /* @__PURE__ */ jsx(CodeEditor, {
3890
3958
  value: document.content ?? "",
3891
3959
  path: document.path,
@@ -3916,11 +3984,35 @@ function AuthorTextView({ sessionId, document, preview, displayedRegions }) {
3916
3984
  createdAt: Date.now()
3917
3985
  });
3918
3986
  }
3919
- })
3987
+ }), /* @__PURE__ */ jsxs("footer", {
3988
+ className: "flex shrink-0 items-center gap-2 border-t border-po-border bg-po-bg px-4 py-1.5 text-sm text-po-dim",
3989
+ children: [
3990
+ /* @__PURE__ */ jsx("span", {
3991
+ className: "first-letter:uppercase",
3992
+ children: document.kind
3993
+ }),
3994
+ /* @__PURE__ */ jsx("span", {
3995
+ "aria-hidden": "true",
3996
+ children: "·"
3997
+ }),
3998
+ /* @__PURE__ */ jsxs("span", { children: [
3999
+ lines,
4000
+ " line",
4001
+ lines === 1 ? "" : "s"
4002
+ ] })
4003
+ ]
4004
+ })]
3920
4005
  });
3921
4006
  }
3922
4007
  //#endregion
3923
4008
  //#region src/extensions/workspaces/sessions/(frontend)/_components/AuthorDocumentPanel.tsx
4009
+ const MOBILE_TOOL_GLYPHS = {
4010
+ select: "↖",
4011
+ pan: "✋",
4012
+ mark: "⌗",
4013
+ comment: "●",
4014
+ draw: "✎"
4015
+ };
3924
4016
  const pendingCanvases = /* @__PURE__ */ new Map();
3925
4017
  const canvasOwners = /* @__PURE__ */ new Map();
3926
4018
  function tabId(path) {
@@ -4045,11 +4137,28 @@ function AuthorDocumentPanel(props) {
4045
4137
  className: "flex min-h-0 flex-1 flex-col",
4046
4138
  children: [
4047
4139
  /* @__PURE__ */ jsxs("header", {
4048
- className: "flex items-center gap-2 border-b border-po-border px-4 py-2",
4140
+ className: "flex items-center gap-2 border-b border-po-border bg-po-bg px-4 py-2",
4049
4141
  children: [
4142
+ /* @__PURE__ */ jsx(FileIcon, {
4143
+ "aria-hidden": "true",
4144
+ className: "size-4 shrink-0 text-po-dim"
4145
+ }),
4050
4146
  /* @__PURE__ */ jsxs("strong", {
4051
- className: "min-w-0 flex-1 truncate text-base text-po-hi",
4052
- children: [alias === void 0 ? "" : `${alias} · `, document.title ?? document.path]
4147
+ className: "min-w-0 truncate text-base font-medium text-po-hi",
4148
+ children: [alias === void 0 ? "" : `${alias} · `, document.title ?? /* @__PURE__ */ jsx("span", {
4149
+ className: "font-mono",
4150
+ children: document.path
4151
+ })]
4152
+ }),
4153
+ /* @__PURE__ */ jsx("span", {
4154
+ className: "min-w-0 flex-1",
4155
+ children: document.version === document.savedVersion ? null : /* @__PURE__ */ jsxs("span", {
4156
+ className: "inline-flex items-center gap-1.5 text-sm text-po-dim",
4157
+ children: [/* @__PURE__ */ jsx(Dot, {
4158
+ tone: "green",
4159
+ size: "md"
4160
+ }), "unsaved"]
4161
+ })
4053
4162
  }),
4054
4163
  PreviewPanel !== void 0 && previewSource !== void 0 ? /* @__PURE__ */ jsx(Button, {
4055
4164
  size: "xs",
@@ -4061,17 +4170,21 @@ function AuthorDocumentPanel(props) {
4061
4170
  children: previewOpen ? "Source" : "Preview"
4062
4171
  }) : null,
4063
4172
  document.kind === "markdown" ? /* @__PURE__ */ jsx(Button, {
4064
- size: "xs",
4065
- variant: "ghost",
4173
+ size: "sm",
4174
+ variant: "outline",
4175
+ className: "min-h-11 [@media(pointer:fine)]:min-h-8",
4066
4176
  "data-testid": "author-markdown-toggle",
4067
4177
  onClick: () => setMarkdownPreview(!markdownPreview),
4068
- children: markdownPreview ? "edit" : "preview"
4178
+ children: /* @__PURE__ */ jsx("span", {
4179
+ className: "first-letter:uppercase",
4180
+ children: markdownPreview ? "edit" : "preview"
4181
+ })
4069
4182
  }) : null,
4070
4183
  document.kind === "video" ? /* @__PURE__ */ jsx("span", {
4071
4184
  className: "text-base text-po-dim",
4072
4185
  children: "Video feedback"
4073
4186
  }) : /* @__PURE__ */ jsx(Button, {
4074
- className: "min-h-11 px-4 text-base",
4187
+ className: "min-h-11 px-4 text-base [@media(pointer:fine)]:min-h-8",
4075
4188
  variant: "outline",
4076
4189
  "data-testid": "author-save",
4077
4190
  disabled: document.revisions.length === 0 || document.savingVersion !== void 0,
@@ -4091,21 +4204,28 @@ function AuthorDocumentPanel(props) {
4091
4204
  "story-preview"
4092
4205
  ].includes(document.kind) ? /* @__PURE__ */ jsx("nav", {
4093
4206
  "aria-label": "Author canvas tools",
4094
- className: "flex shrink-0 gap-1 overflow-x-auto border-b border-po-border px-2 py-1 sm:hidden",
4207
+ className: "flex shrink-0 gap-1.5 overflow-x-auto border-b border-po-border bg-po-bg px-3 py-2 sm:hidden",
4095
4208
  children: [
4096
4209
  "select",
4097
4210
  "pan",
4098
4211
  "mark",
4099
4212
  "comment",
4100
4213
  "draw"
4101
- ].map((mode) => /* @__PURE__ */ jsx(Button, {
4102
- size: "xs",
4103
- variant: activeTool === mode ? "primary" : "outline",
4104
- className: "min-h-11 min-w-11 shrink-0",
4214
+ ].map((mode) => /* @__PURE__ */ jsxs(Button, {
4215
+ size: "md",
4216
+ variant: "outline",
4217
+ className: `min-w-16 shrink-0 ${authorToolClassName(activeTool === mode, mode !== "select" && mode !== "pan")}`,
4105
4218
  "aria-label": `${mode} tool`,
4106
4219
  "aria-pressed": activeTool === mode,
4107
4220
  onClick: () => setAuthorToolMode(sessionId, document.path, mode),
4108
- children: mode
4221
+ children: [/* @__PURE__ */ jsx("span", {
4222
+ "aria-hidden": "true",
4223
+ className: "text-lg leading-none",
4224
+ children: MOBILE_TOOL_GLYPHS[mode]
4225
+ }), /* @__PURE__ */ jsx("span", {
4226
+ className: "text-sm first-letter:uppercase",
4227
+ children: mode
4228
+ })]
4109
4229
  }, mode))
4110
4230
  }) : null,
4111
4231
  /* @__PURE__ */ jsxs("div", {
@@ -4151,7 +4271,7 @@ function AuthorDocumentPanel(props) {
4151
4271
  "video",
4152
4272
  "story-preview"
4153
4273
  ].includes(document.kind) ? /* @__PURE__ */ jsx("div", {
4154
- className: "max-h-56 shrink-0 overflow-y-auto border-t border-po-border p-2 sm:hidden",
4274
+ className: "max-h-56 shrink-0 overflow-y-auto border-t border-po-border bg-po-bg p-3 sm:hidden",
4155
4275
  children: /* @__PURE__ */ jsx(AuthorFeedbackControls, {
4156
4276
  sessionId,
4157
4277
  document,