@open-document/core 0.13.3 → 0.14.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 (67) hide show
  1. package/dist/{build-CvsOak5B.js → build-CyBlmrjS.js} +1 -1
  2. package/dist/{check-CbUBwYmf.js → check-DUKDEem-.js} +3 -3
  3. package/dist/cli/bin.js +10 -21
  4. package/dist/{config-BWtOZ1jc.d.ts → config-cAV1OCuY.d.ts} +9 -1
  5. package/dist/{config-CltJJVsw.js → config-cNpYUpF6.js} +2746 -369
  6. package/dist/{context-CWgfsHoE.js → context-BPApOW9n.js} +1 -1
  7. package/dist/{dev-B8H2qT6G.js → dev-DrnOvsX3.js} +1 -1
  8. package/dist/{diff-BvIjjgnc.js → diff-BPMD2Knh.js} +2 -2
  9. package/dist/{export-DX30_s2q.js → export-DeVtL8aX.js} +3 -3
  10. package/dist/{import-DgsdJT5e.js → import-WAgWsuOv.js} +3 -2
  11. package/dist/index.d.ts +2 -2
  12. package/dist/ops/index.d.ts +3 -1
  13. package/dist/ops/index.js +2 -2
  14. package/dist/{ops-CSR5RlrE.js → ops-raK6424A.js} +2 -854
  15. package/dist/{preview-DYMUNjXL.js → preview-B8Vw9QCh.js} +1 -1
  16. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  17. package/dist/{templates-B5Tz0AKb.js → templates-D9jAFJ8R.js} +3 -3
  18. package/dist/vite/index.d.ts +1 -1
  19. package/dist/vite/index.js +1 -1
  20. package/package.json +1 -1
  21. package/skills/create-doc/SKILL.md +1 -1
  22. package/skills/doc-authoring/SKILL.md +6 -0
  23. package/src/app/app.tsx +2 -0
  24. package/src/app/components/agent/agent-dock.tsx +75 -0
  25. package/src/app/components/agent/agent-markdown.tsx +45 -0
  26. package/src/app/components/agent/agent-panel.tsx +690 -0
  27. package/src/app/components/agent/agent-presence.tsx +74 -0
  28. package/src/app/components/agent/composer.tsx +120 -0
  29. package/src/app/components/agent/connect-view.tsx +183 -0
  30. package/src/app/components/agent/history-view.tsx +134 -0
  31. package/src/app/components/agent/provider-logo.tsx +23 -0
  32. package/src/app/components/agent/transcript.tsx +609 -0
  33. package/src/app/components/comments/comments-panel.tsx +26 -2
  34. package/src/app/components/inspector/inspector.tsx +17 -0
  35. package/src/app/components/note-markdown.tsx +85 -0
  36. package/src/app/components/page-error-boundary.tsx +84 -0
  37. package/src/app/components/page-frame.tsx +2 -1
  38. package/src/app/components/panel/resize-handle.tsx +129 -0
  39. package/src/app/components/ui/button.tsx +97 -0
  40. package/src/app/components/ui/popover.tsx +144 -0
  41. package/src/app/components/ui/tooltip.tsx +123 -0
  42. package/src/app/lib/agent/use-agent.ts +543 -0
  43. package/src/app/lib/diagnostics.ts +13 -0
  44. package/src/app/lib/export-dom.ts +2 -1
  45. package/src/app/lib/export-pdf.ts +2 -1
  46. package/src/app/lib/i18n-ja/agent-panel.ts +107 -0
  47. package/src/app/lib/i18n-ja/agent.ts +9 -0
  48. package/src/app/lib/i18n-ja/index.ts +9 -1
  49. package/src/app/lib/i18n-ko/agent-panel.ts +106 -0
  50. package/src/app/lib/i18n-ko/agent.ts +9 -0
  51. package/src/app/lib/i18n-ko/index.ts +9 -1
  52. package/src/app/lib/i18n-zh-cn/agent-panel.ts +105 -0
  53. package/src/app/lib/i18n-zh-cn/agent.ts +9 -0
  54. package/src/app/lib/i18n-zh-cn/index.ts +9 -1
  55. package/src/app/lib/i18n-zh-tw/agent-panel.ts +105 -0
  56. package/src/app/lib/i18n-zh-tw/agent.ts +9 -0
  57. package/src/app/lib/i18n-zh-tw/index.ts +9 -1
  58. package/src/app/lib/note-markdown.ts +116 -0
  59. package/src/app/lib/toast.ts +50 -0
  60. package/src/app/lib/use-auto-grow.ts +15 -0
  61. package/src/app/lib/use-doc-titles.ts +28 -0
  62. package/src/app/lib/use-locale.ts +144 -0
  63. package/src/app/lib/utils.ts +4 -0
  64. package/src/app/routes/doc-preview.tsx +103 -0
  65. package/src/app/routes/doc.tsx +118 -11
  66. package/src/app/routes/home.tsx +43 -8
  67. package/src/app/styles.css +193 -0
@@ -1,4 +1,4 @@
1
- import { t as createViteConfig } from "./config-CltJJVsw.js";
1
+ import { t as createViteConfig } from "./config-cNpYUpF6.js";
2
2
  import { mergeConfig, preview as preview$1 } from "vite";
3
3
  //#region src/cli/preview.ts
4
4
  async function preview(opts = {}) {
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll as t };
@@ -1,6 +1,6 @@
1
- import { c as listTemplates, s as createFromTemplate } from "./config-CltJJVsw.js";
2
- import "./ops-CSR5RlrE.js";
3
- import { t as cliContext } from "./context-CWgfsHoE.js";
1
+ import { c as listTemplates, s as createFromTemplate } from "./config-cNpYUpF6.js";
2
+ import "./ops-raK6424A.js";
3
+ import { t as cliContext } from "./context-BPApOW9n.js";
4
4
  import chalk from "chalk";
5
5
  //#region src/cli/templates.ts
6
6
  /**
@@ -1,4 +1,4 @@
1
- import { n as OpenDocConfig } from "../config-BWtOZ1jc.js";
1
+ import { r as OpenDocConfig } from "../config-cAV1OCuY.js";
2
2
  import { InlineConfig, Plugin } from "vite";
3
3
  //#region src/vite/open-doc-plugin.d.ts
4
4
  type OpenDocPluginOptions = {
@@ -1,3 +1,3 @@
1
1
  import { r as openDocPlugin } from "../open-doc-plugin-DnX5usgI.js";
2
- import { t as createViteConfig } from "../config-CltJJVsw.js";
2
+ import { t as createViteConfig } from "../config-cNpYUpF6.js";
3
3
  export { createViteConfig, openDocPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-document/core",
3
- "version": "0.13.3",
3
+ "version": "0.14.0",
4
4
  "description": "Runtime and CLI for open-doc — write documents in docs/, we handle the pages, print layout, and export.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -91,7 +91,7 @@ While writing:
91
91
 
92
92
  ## Step 7 — Self-review
93
93
 
94
- **Run `open-doc check <id>` first.** You cannot see the sheets you produced; it renders them at true page size and reports clipped content, blank pages, stranded headings, and unreadable type, each with a source location. Fix every error before moving on. (Driving the MCP server instead? `check_layout`, and `render_page` when you need to look at a sheet.)
94
+ **Run `open-doc check <id>` first.** You cannot see the sheets you produced; it renders them at true page size and reports clipped content, blank pages, stranded headings, and unreadable type, each with a source location. Fix every error before moving on. (Driving the MCP server instead? `check_layout`, and `render_page` when you need to look at a sheet. With the dev server running, `/d/<id>/preview?p=<page>` shows one sheet alone for a screenshot.)
95
95
 
96
96
  Then run the checklist in `doc-authoring` ("Self-review before finishing"), and re-read the prose once as a reader: does the summary state the conclusion? Does every claim have a source?
97
97
 
@@ -405,6 +405,12 @@ the foot of a page, type too small to print, an image that never loaded — each
405
405
  with the `line:column` in your source. Agents driving the MCP server call
406
406
  `check_layout` for the same report, and `render_page` for a PNG of one sheet.
407
407
 
408
+ To **look** at one sheet while `open-doc dev` is running, open
409
+ `http://localhost:5273/d/<id>/preview?p=<page>` (your dev server's origin, the
410
+ page 1-based). It draws that sheet alone at true size with no viewer around it;
411
+ wait for `[data-od-preview-ready="true"]` before you screenshot it — by then the
412
+ fonts are in and the contents, figure numbers and references are counted.
413
+
408
414
  **Run it after writing a document and after any edit that changes how much text
409
415
  is on a page.** The checklist below is what you reason about; `check` is what
410
416
  confirms it.
package/src/app/app.tsx CHANGED
@@ -2,6 +2,7 @@ import config from 'virtual:open-doc/config';
2
2
  import { BrowserRouter, Link, Route, Routes } from 'react-router-dom';
3
3
  import { AssetsPage } from './routes/assets';
4
4
  import { Doc } from './routes/doc';
5
+ import { DocPreview } from './routes/doc-preview';
5
6
  import { Home } from './routes/home';
6
7
  import { HomeShell } from './routes/home-shell';
7
8
  import { ThemeDetailPage, ThemesGalleryPage } from './routes/themes';
@@ -21,6 +22,7 @@ export function App() {
21
22
  <Route path="/" element={<NotFound />} />
22
23
  )}
23
24
  <Route path="/d/:docId" element={<Doc />} />
25
+ <Route path="/d/:docId/preview" element={<DocPreview />} />
24
26
  <Route path="*" element={<NotFound />} />
25
27
  </Routes>
26
28
  </BrowserRouter>
@@ -0,0 +1,75 @@
1
+ import { Sparkles } from 'lucide-react';
2
+ import type { ReactNode } from 'react';
3
+ import { ResizeHandle, useStoredWidth } from '@/components/panel/resize-handle';
4
+ import { Button } from '@/components/ui/button';
5
+ import { useAgentDock, useAgentStatus } from '@/lib/agent/use-agent';
6
+ import { useT } from '@/lib/i18n';
7
+ import { useLocale } from '@/lib/use-locale';
8
+ import { ProviderLogo } from './provider-logo';
9
+
10
+ export const AGENT_DOCK_W = 380;
11
+
12
+ export function AgentToggleButton() {
13
+ const t = useLocale();
14
+ const { open, toggle } = useAgentDock();
15
+ const { provider } = useAgentStatus();
16
+ if (import.meta.env.PROD) return null;
17
+ return (
18
+ <Button
19
+ size="sm"
20
+ variant={open ? 'default' : 'ghost'}
21
+ onClick={toggle}
22
+ aria-pressed={open}
23
+ aria-label={t.agent.openTitle}
24
+ title={t.agent.openTitle}
25
+ data-agent-ui
26
+ >
27
+ {provider ? (
28
+ <ProviderLogo provider={provider.id} className="size-3.5" />
29
+ ) : (
30
+ <Sparkles className="size-3.5" />
31
+ )}
32
+ <span className="hidden lg:inline">{t.agent.open}</span>
33
+ <kbd className="ml-1 hidden rounded-[3px] bg-foreground/10 px-1 font-mono text-[9.5px] tracking-[0.04em] lg:inline">
34
+ A
35
+ </kbd>
36
+ </Button>
37
+ );
38
+ }
39
+
40
+ const AGENT_MIN_W = 300;
41
+ const AGENT_MAX_W = 720;
42
+
43
+ /**
44
+ * The agent's column in the right dock: open-slide's width, resizable from its
45
+ * left edge and remembered. The width never animates — the pages reflow on
46
+ * every frame it would.
47
+ */
48
+ export function AgentDockFrame({ children }: { children: ReactNode }) {
49
+ const t = useT();
50
+ const [width, setWidth] = useStoredWidth(
51
+ 'open-doc:agent-panel-width',
52
+ AGENT_DOCK_W,
53
+ AGENT_MIN_W,
54
+ AGENT_MAX_W,
55
+ );
56
+ return (
57
+ <div
58
+ data-agent-dock
59
+ className="relative flex h-full max-w-[60vw] shrink-0 border-border border-l bg-sidebar"
60
+ style={{ width }}
61
+ >
62
+ <ResizeHandle
63
+ width={width}
64
+ min={AGENT_MIN_W}
65
+ max={AGENT_MAX_W}
66
+ defaultWidth={AGENT_DOCK_W}
67
+ edge="left"
68
+ label={t('Resize the agent panel')}
69
+ onResize={setWidth}
70
+ className="left-0 hidden md:block"
71
+ />
72
+ <div className="h-full min-w-0 flex-1">{children}</div>
73
+ </div>
74
+ );
75
+ }
@@ -0,0 +1,45 @@
1
+ import { useMemo } from 'react';
2
+ import { NoteMarkdown } from '@/components/note-markdown';
3
+
4
+ type Segment = { type: 'text'; text: string } | { type: 'code'; code: string };
5
+
6
+ const FENCE = /^```[^\n]*\n([\s\S]*?)\n?```\s*$/m;
7
+
8
+ function splitFences(text: string): Segment[] {
9
+ const segments: Segment[] = [];
10
+ let rest = text;
11
+ while (rest) {
12
+ const m = FENCE.exec(rest);
13
+ if (!m) {
14
+ segments.push({ type: 'text', text: rest });
15
+ break;
16
+ }
17
+ const before = rest.slice(0, m.index);
18
+ if (before.trim()) segments.push({ type: 'text', text: before });
19
+ segments.push({ type: 'code', code: m[1] });
20
+ rest = rest.slice(m.index + m[0].length);
21
+ }
22
+ return segments;
23
+ }
24
+
25
+ export function AgentMarkdown({ text }: { text: string }) {
26
+ const segments = useMemo(() => splitFences(text), [text]);
27
+ return (
28
+ <div className="space-y-2 text-[12.5px] leading-[1.55] [&_ol]:my-1 [&_ul]:my-1">
29
+ {segments.map((segment, i) =>
30
+ segment.type === 'code' ? (
31
+ <pre
32
+ // biome-ignore lint/suspicious/noArrayIndexKey: static parse output, never reordered
33
+ key={i}
34
+ className="overflow-x-auto rounded-[6px] border border-hairline bg-muted/60 px-2.5 py-2 font-mono text-[11px] leading-relaxed"
35
+ >
36
+ <code>{segment.code}</code>
37
+ </pre>
38
+ ) : (
39
+ // biome-ignore lint/suspicious/noArrayIndexKey: static parse output, never reordered
40
+ <NoteMarkdown key={i} text={segment.text} />
41
+ ),
42
+ )}
43
+ </div>
44
+ );
45
+ }