@open-document/core 0.13.3 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-CvsOak5B.js → build-I0cgoERP.js} +1 -1
- package/dist/{check-CbUBwYmf.js → check-Dys96QSL.js} +3 -3
- package/dist/cli/bin.js +10 -21
- package/dist/{config-BWtOZ1jc.d.ts → config-cAV1OCuY.d.ts} +9 -1
- package/dist/{context-CWgfsHoE.js → context-C-osJW5f.js} +1 -1
- package/dist/{dev-B8H2qT6G.js → dev-CC4PrIOC.js} +1 -1
- package/dist/{diff-BvIjjgnc.js → diff-DhutD4TJ.js} +2 -2
- package/dist/{export-DX30_s2q.js → export-KrajVJO7.js} +3 -3
- package/dist/{import-DgsdJT5e.js → import-Yv34za3L.js} +3 -2
- package/dist/index.d.ts +2 -2
- package/dist/ops/index.d.ts +3 -1
- package/dist/ops/index.js +2 -2
- package/dist/ops-Dux5HlkH.js +401 -0
- package/dist/{preview-DYMUNjXL.js → preview-7eqn9Wzf.js} +1 -1
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/{config-CltJJVsw.js → session-BSbrC5gK.js} +3268 -385
- package/dist/{templates-B5Tz0AKb.js → templates-s-VLTSRc.js} +3 -3
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/package.json +1 -1
- package/skills/create-doc/SKILL.md +1 -1
- package/skills/doc-authoring/SKILL.md +6 -0
- package/src/app/app.tsx +2 -0
- package/src/app/components/agent/agent-dock.tsx +75 -0
- package/src/app/components/agent/agent-markdown.tsx +45 -0
- package/src/app/components/agent/agent-panel.tsx +695 -0
- package/src/app/components/agent/agent-presence.tsx +74 -0
- package/src/app/components/agent/composer.tsx +120 -0
- package/src/app/components/agent/connect-view.tsx +183 -0
- package/src/app/components/agent/history-view.tsx +134 -0
- package/src/app/components/agent/provider-logo.tsx +23 -0
- package/src/app/components/agent/transcript.tsx +717 -0
- package/src/app/components/comments/comments-panel.tsx +26 -2
- package/src/app/components/inspector/inspector.tsx +17 -0
- package/src/app/components/note-markdown.tsx +85 -0
- package/src/app/components/page-error-boundary.tsx +84 -0
- package/src/app/components/page-frame.tsx +2 -1
- package/src/app/components/panel/resize-handle.tsx +129 -0
- package/src/app/components/ui/button.tsx +97 -0
- package/src/app/components/ui/popover.tsx +144 -0
- package/src/app/components/ui/tooltip.tsx +123 -0
- package/src/app/lib/agent/use-agent.ts +543 -0
- package/src/app/lib/diagnostics.ts +13 -0
- package/src/app/lib/export-dom.ts +2 -1
- package/src/app/lib/export-pdf.ts +2 -1
- package/src/app/lib/i18n-ja/agent-panel.ts +115 -0
- package/src/app/lib/i18n-ja/agent.ts +9 -0
- package/src/app/lib/i18n-ja/index.ts +9 -1
- package/src/app/lib/i18n-ko/agent-panel.ts +114 -0
- package/src/app/lib/i18n-ko/agent.ts +9 -0
- package/src/app/lib/i18n-ko/index.ts +9 -1
- package/src/app/lib/i18n-zh-cn/agent-panel.ts +113 -0
- package/src/app/lib/i18n-zh-cn/agent.ts +9 -0
- package/src/app/lib/i18n-zh-cn/index.ts +9 -1
- package/src/app/lib/i18n-zh-tw/agent-panel.ts +113 -0
- package/src/app/lib/i18n-zh-tw/agent.ts +9 -0
- package/src/app/lib/i18n-zh-tw/index.ts +9 -1
- package/src/app/lib/note-markdown.ts +116 -0
- package/src/app/lib/toast.ts +50 -0
- package/src/app/lib/use-auto-grow.ts +15 -0
- package/src/app/lib/use-doc-titles.ts +28 -0
- package/src/app/lib/use-locale.ts +151 -0
- package/src/app/lib/utils.ts +4 -0
- package/src/app/routes/doc-preview.tsx +103 -0
- package/src/app/routes/doc.tsx +118 -11
- package/src/app/routes/home.tsx +43 -8
- package/src/app/styles.css +193 -0
- package/dist/ops-CSR5RlrE.js +0 -1673
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./ops-
|
|
3
|
-
import { t as cliContext } from "./context-
|
|
1
|
+
import { l as createFromTemplate, u as listTemplates } from "./session-BSbrC5gK.js";
|
|
2
|
+
import "./ops-Dux5HlkH.js";
|
|
3
|
+
import { t as cliContext } from "./context-C-osJW5f.js";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
//#region src/cli/templates.ts
|
|
6
6
|
/**
|
package/dist/vite/index.d.ts
CHANGED
package/dist/vite/index.js
CHANGED
package/package.json
CHANGED
|
@@ -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
|
+
}
|