@open-document/core 0.17.0 → 0.17.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.
Files changed (31) hide show
  1. package/dist/{build-BzNZnIhF.js → build-C7nHUUXO.js} +1 -1
  2. package/dist/{check-C7kxlAFW.js → check--Cbkdqw3.js} +3 -3
  3. package/dist/cli/bin.js +12 -12
  4. package/dist/{context-CFPnmNCR.js → context-DRXgt6Je.js} +2 -2
  5. package/dist/{deploy-gcp-BUiSuqz7.js → deploy-gcp-bbxQT0gf.js} +1 -1
  6. package/dist/{dev-BUo7OESU.js → dev-D_j2ykSa.js} +1 -1
  7. package/dist/{diff-B950T0O6.js → diff-C1RDK_I5.js} +2 -2
  8. package/dist/{export-CHN1CiGv.js → export-BFxKPa0W.js} +3 -3
  9. package/dist/{import-CLSnIxvN.js → import-TLuMXkou.js} +3 -3
  10. package/dist/{open-doc-plugin-DnX5usgI.js → open-doc-plugin-DE1sJXK_.js} +3 -2
  11. package/dist/ops/index.js +2 -2
  12. package/dist/{ops-BgbM5Irm.js → ops-BG9hfBwQ.js} +1 -1
  13. package/dist/{preview-BVwVqS-I.js → preview-rlMPuRZV.js} +1 -1
  14. package/dist/{proofread-BpR_3GZz.js → proofread-Dtj9OlWX.js} +3 -3
  15. package/dist/{session-DmbXf3u7.js → session-CPFLe6BT.js} +13 -2
  16. package/dist/{templates-BsWxs7oo.js → templates-BmSuBmj3.js} +3 -3
  17. package/dist/{translations-CW5OVM0L.js → translations-BmTXOhx9.js} +2 -2
  18. package/dist/vite/index.d.ts +2 -0
  19. package/dist/vite/index.js +2 -2
  20. package/package.json +1 -1
  21. package/src/app/components/agent/agent-dock.tsx +1 -1
  22. package/src/app/components/browser/browser-ui.tsx +8 -2
  23. package/src/app/components/panel/panel-shell.tsx +3 -1
  24. package/src/app/components/sidebar/sidebar.tsx +2 -1
  25. package/src/app/lib/i18n-ja/doc.ts +1 -0
  26. package/src/app/lib/i18n-ko/doc.ts +1 -0
  27. package/src/app/lib/i18n-zh-cn/doc.ts +1 -0
  28. package/src/app/lib/i18n-zh-tw/doc.ts +1 -0
  29. package/src/app/routes/doc.tsx +164 -52
  30. package/src/app/routes/home.tsx +11 -7
  31. package/src/app/virtual.d.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { r as createViteConfig } from "./session-DmbXf3u7.js";
1
+ import { r as createViteConfig } from "./session-CPFLe6BT.js";
2
2
  import path from "node:path";
3
3
  import { build as build$1, mergeConfig } from "vite";
4
4
  //#region src/cli/build.ts
@@ -1,6 +1,6 @@
1
- import { B as listDocIds, S as closeRenderSession, x as checkLayout } from "./session-DmbXf3u7.js";
2
- import "./ops-BgbM5Irm.js";
3
- import { t as cliContext } from "./context-CFPnmNCR.js";
1
+ import { B as listDocIds, S as closeRenderSession, x as checkLayout } from "./session-CPFLe6BT.js";
2
+ import "./ops-BG9hfBwQ.js";
3
+ import { t as cliContext } from "./context-DRXgt6Je.js";
4
4
  import chalk from "chalk";
5
5
  //#region src/cli/check.ts
6
6
  function line(finding) {
package/dist/cli/bin.js CHANGED
@@ -148,47 +148,47 @@ async function run(argv) {
148
148
  program.name("open-doc").description("Author documents — we handle the Vite/React stack, pagination, and export.").version(version, "-v, --version", "print version").helpOption("-h, --help", "show help").showHelpAfterError(chalk.dim("(run `open-doc --help` for usage)"));
149
149
  program.command("dev").description("Start the dev server").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").option("--no-skills-check", "skip the built-in skills drift check").option("--mcp", "serve an MCP endpoint at /mcp (requires @open-document/mcp)").action(async (flags) => {
150
150
  if (flags.skillsCheck !== false) await runSkillsDriftCheck(resolveBuiltinSkillsDir());
151
- const { dev } = await import("../dev-BUo7OESU.js");
151
+ const { dev } = await import("../dev-D_j2ykSa.js");
152
152
  await dev(flags);
153
153
  });
154
154
  program.command("build").description("Build a static site").option("--out-dir <dir>", "output directory (defaults to `dist`)").action(async (flags) => {
155
- const { build } = await import("../build-BzNZnIhF.js");
155
+ const { build } = await import("../build-C7nHUUXO.js");
156
156
  await build(flags);
157
157
  });
158
158
  program.command("preview").description("Preview the production build").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").action(async (flags) => {
159
- const { preview } = await import("../preview-BVwVqS-I.js");
159
+ const { preview } = await import("../preview-rlMPuRZV.js");
160
160
  await preview(flags);
161
161
  });
162
162
  program.command("export [docIds...]").description("Render documents headlessly to PDF, HTML, PNG, or DOCX").addOption(new Option("-f, --format <format>", "output format").choices([...EXPORT_FORMATS])).option("-o, --out-dir <dir>", "directory to write into (defaults to `out`)").option("--all", "export every document under docs/").option("--each", "one copy per row of the document's `records`").option("--name <pattern>", "with --each: file name, e.g. \"certificate-{name}\" ({#} is the row number)").action(async (docIds, flags) => {
163
- const { exportDocs } = await import("../export-CHN1CiGv.js");
163
+ const { exportDocs } = await import("../export-BFxKPa0W.js");
164
164
  await exportDocs(docIds, flags);
165
165
  });
166
166
  program.command("diff <docId>").description("Show what changed in a document since a git revision, page by page").option("-s, --since <rev>", "revision to compare against (defaults to HEAD)").option("-o, --out-dir <dir>", "directory to write the report into (defaults to `out`)").option("--json", "print the result as JSON").action(async (docId, flags) => {
167
- const { diffDoc } = await import("../diff-B950T0O6.js");
167
+ const { diffDoc } = await import("../diff-C1RDK_I5.js");
168
168
  await diffDoc(docId, flags);
169
169
  });
170
170
  program.command("check [docIds...]").description("Report layout faults — clipped content, blank sheets, stranded headings").option("--json", "print the full report as JSON").addOption(new Option("--max-pages <n>", "fail when a document runs past n pages, and say where the length is").argParser(parsePositiveInt)).action(async (docIds, flags) => {
171
- const { checkDocs } = await import("../check-C7kxlAFW.js");
171
+ const { checkDocs } = await import("../check--Cbkdqw3.js");
172
172
  await checkDocs(docIds, flags);
173
173
  });
174
174
  program.command("translations [docId]").description("List translations (meta.translationOf) and what changed in their source since").option("--diff", "print the source's changes since each translation's translatedAt").option("--mark <docId>", "record that a translation now matches its source").option("--at <rev>", "with --mark: the source commit it matches (defaults to the last one)").option("--json", "print the result as JSON").action(async (docId, flags) => {
175
- const { translations } = await import("../translations-CW5OVM0L.js");
175
+ const { translations } = await import("../translations-BmTXOhx9.js");
176
176
  await translations(docId, flags);
177
177
  });
178
178
  program.command("proofread [docIds...]").description("Report text slips — full-width letters, wrong-width punctuation, mixed scripts").option("--json", "print the full report as JSON").action(async (docIds, flags) => {
179
- const { proofreadDocs } = await import("../proofread-BpR_3GZz.js");
179
+ const { proofreadDocs } = await import("../proofread-Dtj9OlWX.js");
180
180
  await proofreadDocs(docIds, flags);
181
181
  });
182
182
  program.command("templates").description("List the templates a new document can start from").option("--json", "print them as JSON").action(async (flags) => {
183
- const { printTemplates } = await import("../templates-BsWxs7oo.js");
183
+ const { printTemplates } = await import("../templates-BmSuBmj3.js");
184
184
  await printTemplates(flags);
185
185
  });
186
186
  program.command("new [docId]").description("Create a document under docs/ from a template (see `open-doc templates`)").option("-t, --template <name>", "template to start from (defaults to blank)").option("--title <title>", "title of the new document").action(async (docId, flags) => {
187
- const { newDoc } = await import("../templates-BsWxs7oo.js");
187
+ const { newDoc } = await import("../templates-BmSuBmj3.js");
188
188
  await newDoc(docId, flags);
189
189
  });
190
190
  program.command("import <file>").description("Turn a Markdown (.md) or Word (.docx) file into a document under docs/ — Word keeps its page look").option("--id <id>", "document id (defaults to a slug of the title)").option("--title <title>", "override the title").option("--subtitle <subtitle>", "subtitle, also used as the cover eyebrow").option("--lang <tag>", "language of the text, e.g. zh-Hant-TW (detected for CJK when omitted)").option("--author <author>", "author line on the cover").option("--theme <theme>", "theme id to back-link from meta.theme").addOption(new Option("--page-size <size>", "page size").choices(PAGE_SIZE_NAMES)).addOption(new Option("--orientation <orientation>", "page orientation").choices(ORIENTATIONS)).option("--no-cover", "skip the title page (Markdown, or Word with --plain)").option("--contents", "add a self-filling contents page (Markdown, or Word with --plain)").option("--plain", "Word only: structure in the house style (headings, lists, tables, a cover) instead of Word's own page look").action(async (file, flags) => {
191
- const { importDoc } = await import("../import-CLSnIxvN.js");
191
+ const { importDoc } = await import("../import-TLuMXkou.js");
192
192
  await importDoc(file, flags);
193
193
  });
194
194
  program.command("sync:skills").description("Sync built-in skills from @open-document/core into this workspace").option("--dry-run", "show what would change without writing").action(async (flags) => {
@@ -196,7 +196,7 @@ async function run(argv) {
196
196
  await syncSkills(resolveBuiltinSkillsDir(), flags);
197
197
  });
198
198
  program.command("deploy").description("Deploy and manage this workspace on a cloud provider (e.g. `open-doc deploy gcp`)").command("gcp").description("Deploy to Google Cloud Run + Cloud Storage, sync files, or stop/delete the service").addArgument(new Argument("[action]", "up (deploy), check (preflight diagnostics), status, pull, push, stop, start, or down").choices([...GCP_DEPLOY_ACTIONS]).default("up")).option("--project <id>", "Google Cloud project ID").option("--region <region>", "Cloud Run and Cloud Storage region (defaults to asia-east1)").option("--service <name>", "Cloud Run service name").option("--bucket <name>", "Cloud Storage bucket name for persistent docs/assets/themes").addOption(new Option("--mode <mode>", "deployment mode: editable (GCS + MCP) or static").choices(["editable", "static"])).option("--memory <size>", "Cloud Run memory limit (defaults to 1Gi)").option("--token <token>", "Bearer token for the remote /mcp endpoint").option("--dry-run", "print the cloud commands without executing them").option("--json", "print output as JSON (for check and status)").option("--delete", "with pull/push: delete destination files missing from source").option("--pull", "with stop: pull latest files from Cloud Storage before locking service").option("--skip-pull", "with down: skip backing up files from Cloud Storage before deleting").option("--purge-storage", "with down: also delete the Cloud Storage bucket").option("-y, --yes", "skip confirmation prompts").action(async (action, flags) => {
199
- const mod = await import("../deploy-gcp-BUiSuqz7.js");
199
+ const mod = await import("../deploy-gcp-bbxQT0gf.js");
200
200
  switch (action) {
201
201
  case "up":
202
202
  await mod.runGcpUp(flags);
@@ -1,6 +1,6 @@
1
1
  import { n as readCoreVersion } from "./package-version-C89gtYSk.js";
2
- import { n as loadUserConfig } from "./open-doc-plugin-DnX5usgI.js";
3
- import { J as makeContext } from "./session-DmbXf3u7.js";
2
+ import { n as loadUserConfig } from "./open-doc-plugin-DE1sJXK_.js";
3
+ import { J as makeContext } from "./session-CPFLe6BT.js";
4
4
  //#region src/cli/context.ts
5
5
  /** The same context the dev API and the MCP server run on, for commands that call `ops/`. */
6
6
  async function cliContext(userCwd = process.cwd()) {
@@ -1,4 +1,4 @@
1
- import { n as loadUserConfig } from "./open-doc-plugin-DnX5usgI.js";
1
+ import { n as loadUserConfig } from "./open-doc-plugin-DE1sJXK_.js";
2
2
  import chalk from "chalk";
3
3
  import path from "node:path";
4
4
  import * as readline from "node:readline/promises";
@@ -1,4 +1,4 @@
1
- import { r as createViteConfig } from "./session-DmbXf3u7.js";
1
+ import { r as createViteConfig } from "./session-CPFLe6BT.js";
2
2
  import { createServer, mergeConfig } from "vite";
3
3
  //#region src/cli/dev.ts
4
4
  async function dev(opts = {}) {
@@ -1,5 +1,5 @@
1
- import { c as diffDocument } from "./ops-BgbM5Irm.js";
2
- import { t as cliContext } from "./context-CFPnmNCR.js";
1
+ import { c as diffDocument } from "./ops-BG9hfBwQ.js";
2
+ import { t as cliContext } from "./context-DRXgt6Je.js";
3
3
  import chalk from "chalk";
4
4
  //#region src/cli/diff.ts
5
5
  const MARK = {
@@ -1,7 +1,7 @@
1
1
  import { r as EXPORT_FORMATS } from "./sdk-CqNZzbkz.js";
2
- import { B as listDocIds, C as exportDocument, S as closeRenderSession } from "./session-DmbXf3u7.js";
3
- import "./ops-BgbM5Irm.js";
4
- import { t as cliContext } from "./context-CFPnmNCR.js";
2
+ import { B as listDocIds, C as exportDocument, S as closeRenderSession } from "./session-CPFLe6BT.js";
3
+ import "./ops-BG9hfBwQ.js";
4
+ import { t as cliContext } from "./context-DRXgt6Je.js";
5
5
  import chalk from "chalk";
6
6
  //#region src/cli/export.ts
7
7
  const FORMATS = EXPORT_FORMATS;
@@ -1,6 +1,6 @@
1
- import { D as importMarkdown, E as importDocx } from "./session-DmbXf3u7.js";
2
- import "./ops-BgbM5Irm.js";
3
- import { t as cliContext } from "./context-CFPnmNCR.js";
1
+ import { D as importMarkdown, E as importDocx } from "./session-CPFLe6BT.js";
2
+ import "./ops-BG9hfBwQ.js";
3
+ import { t as cliContext } from "./context-DRXgt6Je.js";
4
4
  import chalk from "chalk";
5
5
  import path from "node:path";
6
6
  //#region src/cli/import.ts
@@ -157,7 +157,7 @@ ${cases}
157
157
  };
158
158
  }
159
159
  function openDocPlugin(opts) {
160
- const { userCwd, config, coreVersion } = opts;
160
+ const { userCwd, config, coreVersion, coreFromSource = false } = opts;
161
161
  const docsDir = config.docsDir ?? "docs";
162
162
  const docsRoot = path.resolve(userCwd, docsDir);
163
163
  const foldersManifestPath = path.join(docsRoot, ".folders.json");
@@ -235,7 +235,8 @@ function openDocPlugin(opts) {
235
235
  return `export default ${JSON.stringify({
236
236
  ...config,
237
237
  build,
238
- version: coreVersion
238
+ version: coreVersion,
239
+ fromSource: coreFromSource
239
240
  })};\n`;
240
241
  }
241
242
  if (id === resolved(FOLDERS_VMOD)) {
package/dist/ops/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { i as ORIENTATIONS, o as PAGE_SIZE_NAMES, r as EXPORT_FORMATS } from "../sdk-CqNZzbkz.js";
2
- import { A as readChanges, B as listDocIds, C as exportDocument, D as importMarkdown, E as importDocx, F as OpsError, G as resolveEntry, H as readDocument, I as createDocument, J as makeContext, K as writeDocument, L as deleteDocument, M as assertExpectedSource, N as hashSource, O as slugify, P as withFileLock, R as docDir, S as closeRenderSession, T as renderDocPage, V as listDocuments, W as renameDocument, _ as listFolders, a as readText, b as writeAsset, c as writeTexts, d as suggestDocId, f as createFolder, g as listAssets, h as findAssetUsages, i as addComment, j as revertChange, k as listRevisions, l as createFromTemplate, m as fileDocument, o as writeEdits, p as deleteAsset, s as writeText, u as listTemplates, v as listThemes, w as proofreadDocument, x as checkLayout, y as readTheme, z as duplicateDocument } from "../session-DmbXf3u7.js";
3
- import { a as outlineSource, c as diffDocument, i as outlineDocument, n as translationStatus, o as readDocumentLines, r as editDocument, s as searchDocument, t as markTranslated } from "../ops-BgbM5Irm.js";
2
+ import { A as readChanges, B as listDocIds, C as exportDocument, D as importMarkdown, E as importDocx, F as OpsError, G as resolveEntry, H as readDocument, I as createDocument, J as makeContext, K as writeDocument, L as deleteDocument, M as assertExpectedSource, N as hashSource, O as slugify, P as withFileLock, R as docDir, S as closeRenderSession, T as renderDocPage, V as listDocuments, W as renameDocument, _ as listFolders, a as readText, b as writeAsset, c as writeTexts, d as suggestDocId, f as createFolder, g as listAssets, h as findAssetUsages, i as addComment, j as revertChange, k as listRevisions, l as createFromTemplate, m as fileDocument, o as writeEdits, p as deleteAsset, s as writeText, u as listTemplates, v as listThemes, w as proofreadDocument, x as checkLayout, y as readTheme, z as duplicateDocument } from "../session-CPFLe6BT.js";
3
+ import { a as outlineSource, c as diffDocument, i as outlineDocument, n as translationStatus, o as readDocumentLines, r as editDocument, s as searchDocument, t as markTranslated } from "../ops-BG9hfBwQ.js";
4
4
  export { EXPORT_FORMATS, ORIENTATIONS, OpsError, PAGE_SIZE_NAMES, addComment, assertExpectedSource, checkLayout, closeRenderSession, createDocument, createFolder, createFromTemplate, deleteAsset, deleteDocument, diffDocument, docDir, duplicateDocument, editDocument, exportDocument, fileDocument, findAssetUsages, hashSource, importDocx, importMarkdown, listAssets, listDocIds, listDocuments, listFolders, listRevisions, listTemplates, listThemes, makeContext, markTranslated, outlineDocument, outlineSource, proofreadDocument, readChanges, readDocument, readDocumentLines, readText, readTheme, renameDocument, renderDocPage, resolveEntry, revertChange, searchDocument, slugify, suggestDocId, translationStatus, withFileLock, writeAsset, writeDocument, writeEdits, writeText, writeTexts };
@@ -1,4 +1,4 @@
1
- import { B as listDocIds, F as OpsError, G as resolveEntry, M as assertExpectedSource, N as hashSource, P as withFileLock, U as readMetaField, n as createRenderSession, q as setMetaString, t as RenderUnavailableError } from "./session-DmbXf3u7.js";
1
+ import { B as listDocIds, F as OpsError, G as resolveEntry, M as assertExpectedSource, N as hashSource, P as withFileLock, U as readMetaField, n as createRenderSession, q as setMetaString, t as RenderUnavailableError } from "./session-CPFLe6BT.js";
2
2
  import path from "node:path";
3
3
  import fs from "node:fs/promises";
4
4
  import { execFile } from "node:child_process";
@@ -1,4 +1,4 @@
1
- import { r as createViteConfig } from "./session-DmbXf3u7.js";
1
+ import { r as createViteConfig } from "./session-CPFLe6BT.js";
2
2
  import { mergeConfig, preview as preview$1 } from "vite";
3
3
  //#region src/cli/preview.ts
4
4
  async function preview(opts = {}) {
@@ -1,6 +1,6 @@
1
- import { B as listDocIds, S as closeRenderSession, w as proofreadDocument } from "./session-DmbXf3u7.js";
2
- import "./ops-BgbM5Irm.js";
3
- import { t as cliContext } from "./context-CFPnmNCR.js";
1
+ import { B as listDocIds, S as closeRenderSession, w as proofreadDocument } from "./session-CPFLe6BT.js";
2
+ import "./ops-BG9hfBwQ.js";
3
+ import { t as cliContext } from "./context-DRXgt6Je.js";
4
4
  import chalk from "chalk";
5
5
  //#region src/cli/proofread.ts
6
6
  function line(finding) {
@@ -2,7 +2,7 @@ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
2
  import { a as defaultDesign, n as DiagramSyntaxError, r as parseDelimited, t as compileDiagram } from "./diagram-CKf3ptOE.js";
3
3
  import { a as PAGE_SIZES, c as isPageSizeName, i as ORIENTATIONS, o as PAGE_SIZE_NAMES, s as isOrientation } from "./sdk-CqNZzbkz.js";
4
4
  import { t as corePackageRoot } from "./package-version-C89gtYSk.js";
5
- import { n as loadUserConfig, r as openDocPlugin, t as DOC_ID_RE } from "./open-doc-plugin-DnX5usgI.js";
5
+ import { n as loadUserConfig, r as openDocPlugin, t as DOC_ID_RE } from "./open-doc-plugin-DE1sJXK_.js";
6
6
  import chalk from "chalk";
7
7
  import path from "node:path";
8
8
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -12983,6 +12983,16 @@ function readCoreVersion() {
12983
12983
  }
12984
12984
  }
12985
12985
  const CORE_VERSION = readCoreVersion();
12986
+ /**
12987
+ * Whether this core runs from a source checkout (a `link:`, `file:` or `workspace:`
12988
+ * dependency, or this repo's own demo) rather than a package installed from npm.
12989
+ * An install always lives under a `node_modules` folder, even through pnpm's links,
12990
+ * because the path is the resolved file's; a checkout never does.
12991
+ */
12992
+ function isSourceCheckout(pkgRoot) {
12993
+ return !pkgRoot.split(/[\\/]/).includes("node_modules");
12994
+ }
12995
+ const CORE_FROM_SOURCE = isSourceCheckout(PKG_ROOT);
12986
12996
  function safeRealpath(target) {
12987
12997
  try {
12988
12998
  return existsSync(target) ? realpathSync(target) : null;
@@ -13035,7 +13045,8 @@ async function createViteConfig(opts) {
13035
13045
  openDocPlugin({
13036
13046
  userCwd,
13037
13047
  config,
13038
- coreVersion: CORE_VERSION
13048
+ coreVersion: CORE_VERSION,
13049
+ coreFromSource: CORE_FROM_SOURCE
13039
13050
  }),
13040
13051
  themesPlugin({
13041
13052
  userCwd,
@@ -1,6 +1,6 @@
1
- import { l as createFromTemplate, u as listTemplates } from "./session-DmbXf3u7.js";
2
- import "./ops-BgbM5Irm.js";
3
- import { t as cliContext } from "./context-CFPnmNCR.js";
1
+ import { l as createFromTemplate, u as listTemplates } from "./session-CPFLe6BT.js";
2
+ import "./ops-BG9hfBwQ.js";
3
+ import { t as cliContext } from "./context-DRXgt6Je.js";
4
4
  import chalk from "chalk";
5
5
  //#region src/cli/templates.ts
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { n as translationStatus, t as markTranslated } from "./ops-BgbM5Irm.js";
2
- import { t as cliContext } from "./context-CFPnmNCR.js";
1
+ import { n as translationStatus, t as markTranslated } from "./ops-BG9hfBwQ.js";
2
+ import { t as cliContext } from "./context-DRXgt6Je.js";
3
3
  import chalk from "chalk";
4
4
  //#region src/cli/translations.ts
5
5
  const STATE = {
@@ -5,6 +5,8 @@ type OpenDocPluginOptions = {
5
5
  userCwd: string;
6
6
  config: OpenDocConfig;
7
7
  coreVersion: string;
8
+ /** Core runs from a source checkout; the browser marks its version `dev`. */
9
+ coreFromSource?: boolean;
8
10
  };
9
11
  declare function openDocPlugin(opts: OpenDocPluginOptions): Plugin;
10
12
  //#endregion
@@ -1,3 +1,3 @@
1
- import { r as openDocPlugin } from "../open-doc-plugin-DnX5usgI.js";
2
- import { r as createViteConfig } from "../session-DmbXf3u7.js";
1
+ import { r as openDocPlugin } from "../open-doc-plugin-DE1sJXK_.js";
2
+ import { r as createViteConfig } from "../session-CPFLe6BT.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.17.0",
3
+ "version": "0.17.1",
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": {
@@ -56,7 +56,7 @@ export function AgentDockFrame({ children }: { children: ReactNode }) {
56
56
  return (
57
57
  <div
58
58
  data-agent-dock
59
- className="relative flex h-full max-w-[60vw] shrink-0 border-border border-l bg-sidebar"
59
+ className="relative flex h-full max-w-[60vw] shrink-0 border-border border-l bg-sidebar max-md:absolute max-md:inset-y-0 max-md:right-0 max-md:z-40 max-md:w-[min(24rem,calc(100%-2.5rem))]! max-md:max-w-none max-md:shadow-2xl"
60
60
  style={{ width }}
61
61
  >
62
62
  <ResizeHandle
@@ -74,7 +74,9 @@ export function PageHeader({
74
74
  children?: ReactNode;
75
75
  }) {
76
76
  return (
77
- <header className="mb-8">
77
+ // A container, so the actions fold by the room the page has, not the window:
78
+ // the sidebar takes part of a wide window and none of a narrow one.
79
+ <header className="@container mb-8">
78
80
  <div className="flex flex-wrap items-center justify-between gap-4">
79
81
  <div className="min-w-0">
80
82
  <h1 className="flex items-center gap-2.5 font-medium text-lg tracking-tight">
@@ -90,7 +92,11 @@ export function PageHeader({
90
92
  <p className="mt-1 max-w-2xl text-muted-foreground text-sm">{description}</p>
91
93
  )}
92
94
  </div>
93
- {actions && <div className="flex flex-none items-center gap-2">{actions}</div>}
95
+ {actions && (
96
+ <div className="flex w-full min-w-0 items-center gap-2 @2xl:w-auto @2xl:flex-none">
97
+ {actions}
98
+ </div>
99
+ )}
94
100
  </div>
95
101
  {children && <div className="mt-5">{children}</div>}
96
102
  </header>
@@ -26,7 +26,9 @@ export function PanelShell({
26
26
  <aside
27
27
  ref={panelRef}
28
28
  aria-label={label}
29
- className="od-panel-in flex w-72 flex-none flex-col border-border border-l bg-background"
29
+ // Below md there is no room beside the pages: the panel floats over them
30
+ // instead of squeezing them to a sliver.
31
+ className="od-panel-in flex w-72 flex-none flex-col border-border border-l bg-background max-md:absolute max-md:inset-y-0 max-md:right-0 max-md:z-40 max-md:w-[min(18rem,calc(100%-2.5rem))] max-md:shadow-2xl"
30
32
  >
31
33
  <header className="flex h-10 flex-none items-center justify-between gap-2 border-border border-b px-3">
32
34
  <div className="flex min-w-0 items-center gap-2">{header}</div>
@@ -251,7 +251,8 @@ export function Sidebar({
251
251
  <div className="flex items-center justify-between gap-2 px-4 py-3 text-[11px] text-muted-foreground">
252
252
  <span>
253
253
  v{config.version}
254
- <span className="ml-2 font-mono">{import.meta.env.DEV ? 'dev' : 'static'}</span>
254
+ {/* Only a core run from a checkout says so; an npm install shows its version alone. */}
255
+ {config.fromSource && <span className="ml-2 font-mono">dev</span>}
255
256
  </span>
256
257
  <div className="-mr-1.5 flex items-center gap-0.5">
257
258
  <LanguageToggle />
@@ -62,6 +62,7 @@ export const DOC: Record<string, string> = {
62
62
  'Actual size (100%)': '実際のサイズ (100%)',
63
63
  'Link copied': 'リンクをコピーしました',
64
64
  'Copy link': 'リンクをコピー',
65
+ More: 'その他',
65
66
  Record: 'レコード',
66
67
  'Previous record': '前のレコード',
67
68
  'Next record': '次のレコード',
@@ -62,6 +62,7 @@ export const DOC: Record<string, string> = {
62
62
  'Actual size (100%)': '실제 크기 (100%)',
63
63
  'Link copied': '링크 복사됨',
64
64
  'Copy link': '링크 복사',
65
+ More: '더 보기',
65
66
  Record: '레코드',
66
67
  'Previous record': '이전 레코드',
67
68
  'Next record': '다음 레코드',
@@ -61,6 +61,7 @@ export const DOC: Record<string, string> = {
61
61
  'Actual size (100%)': '实际大小 (100%)',
62
62
  'Link copied': '已复制链接',
63
63
  'Copy link': '复制链接',
64
+ More: '更多',
64
65
  Record: '数据行',
65
66
  'Previous record': '上一条数据',
66
67
  'Next record': '下一条数据',
@@ -61,6 +61,7 @@ export const DOC: Record<string, string> = {
61
61
  'Actual size (100%)': '實際大小 (100%)',
62
62
  'Link copied': '已複製連結',
63
63
  'Copy link': '複製連結',
64
+ More: '更多',
64
65
  Record: '資料列',
65
66
  'Previous record': '上一筆資料',
66
67
  'Next record': '下一筆資料',
@@ -6,6 +6,7 @@ import {
6
6
  Check,
7
7
  ChevronDown,
8
8
  Download,
9
+ Ellipsis,
9
10
  Eye,
10
11
  FileCode2,
11
12
  FileImage,
@@ -846,9 +847,13 @@ export function Doc() {
846
847
  (page, zoom, layout, fullscreen), and what you do to the document
847
848
  (search, edit, design, download). The middle rail is `auto` between
848
849
  two equal `1fr` rails, so it sits at the true centre of the bar while
849
- the title truncates before anything is overlapped. */}
850
- <header className="grid h-12 flex-none grid-cols-[1fr_auto_1fr] items-center gap-3 border-b border-border px-3">
851
- <div className="flex min-w-0 items-center gap-1">
850
+ the title truncates before anything is overlapped. Below xl the bar is
851
+ a plain row: the title takes what is left, the view controls drop out
852
+ by width (zoom and layout below lg, the page counter below sm), labels
853
+ fold to icons, and below sm Changes, Comments and Copy link move into
854
+ a More menu, so nothing is pushed off the edge. */}
855
+ <header className="flex h-12 flex-none items-center gap-2 border-b border-border px-3 xl:grid xl:grid-cols-[1fr_auto_1fr] xl:gap-3">
856
+ <div className="flex min-w-0 flex-1 items-center gap-1">
852
857
  <HeaderBackLink />
853
858
  <h1 className="truncate font-medium text-sm">{doc.meta?.title ?? docId}</h1>
854
859
  {doc.records && doc.records.length > 0 && (
@@ -856,50 +861,56 @@ export function Doc() {
856
861
  )}
857
862
  </div>
858
863
 
859
- <div className="hidden items-center gap-2 sm:flex">
864
+ <div className="hidden flex-none items-center gap-2 sm:flex">
860
865
  <PageJump page={currentPage} total={pages.length} onJump={scrollToPage} />
861
- <Divider />
862
- <ZoomControl
863
- scale={scale}
864
- fit={manualScale === null ? zoomMode : null}
865
- onStep={zoom}
866
- onSet={setZoom}
867
- onFit={fitTo}
868
- />
869
- <Divider />
870
- <fieldset className="flex items-center gap-0.5">
871
- <legend className="sr-only">{t('Page layout')}</legend>
872
- <IconButton
873
- label={t('Continuous')}
874
- active={viewMode === 'continuous'}
875
- onClick={() => setViewMode('continuous')}
876
- >
877
- <Rows3 className="size-3.5" />
878
- </IconButton>
879
- <IconButton
880
- label={t('Two-up')}
881
- active={viewMode === 'spread'}
882
- onClick={() => setViewMode('spread')}
883
- >
884
- <BookOpen className="size-3.5" />
885
- </IconButton>
866
+ <div className="hidden items-center gap-2 lg:flex">
867
+ <Divider />
868
+ <ZoomControl
869
+ scale={scale}
870
+ fit={manualScale === null ? zoomMode : null}
871
+ onStep={zoom}
872
+ onSet={setZoom}
873
+ onFit={fitTo}
874
+ />
875
+ <Divider />
876
+ <fieldset className="flex items-center gap-0.5">
877
+ <legend className="sr-only">{t('Page layout')}</legend>
878
+ <IconButton
879
+ label={t('Continuous')}
880
+ active={viewMode === 'continuous'}
881
+ onClick={() => setViewMode('continuous')}
882
+ >
883
+ <Rows3 className="size-3.5" />
884
+ </IconButton>
885
+ <IconButton
886
+ label={t('Two-up')}
887
+ active={viewMode === 'spread'}
888
+ onClick={() => setViewMode('spread')}
889
+ >
890
+ <BookOpen className="size-3.5" />
891
+ </IconButton>
892
+ <IconButton
893
+ label={t('Grid')}
894
+ active={viewMode === 'grid'}
895
+ onClick={() => setViewMode('grid')}
896
+ >
897
+ <LayoutGrid className="size-3.5" />
898
+ </IconButton>
899
+ </fieldset>
886
900
  <IconButton
887
- label={t('Grid')}
888
- active={viewMode === 'grid'}
889
- onClick={() => setViewMode('grid')}
901
+ label={isFullscreen ? t('Exit fullscreen (F)') : t('Fullscreen (F)')}
902
+ onClick={toggleFullscreen}
890
903
  >
891
- <LayoutGrid className="size-3.5" />
904
+ {isFullscreen ? (
905
+ <Minimize className="size-3.5" />
906
+ ) : (
907
+ <Maximize className="size-3.5" />
908
+ )}
892
909
  </IconButton>
893
- </fieldset>
894
- <IconButton
895
- label={isFullscreen ? t('Exit fullscreen (F)') : t('Fullscreen (F)')}
896
- onClick={toggleFullscreen}
897
- >
898
- {isFullscreen ? <Minimize className="size-3.5" /> : <Maximize className="size-3.5" />}
899
- </IconButton>
910
+ </div>
900
911
  </div>
901
912
 
902
- <div className="flex items-center justify-end gap-2">
913
+ <div className="flex flex-none items-center justify-end gap-1.5 sm:gap-2">
903
914
  <DocSearch scrollRef={scrollRef} pagesRef={pagesRef} onFoundPage={setCurrentPage} />
904
915
 
905
916
  {import.meta.env.DEV && (
@@ -935,10 +946,10 @@ export function Doc() {
935
946
  )}
936
947
  >
937
948
  <Palette className="size-3.5" />
938
- {t('Design')}
949
+ <span className="hidden lg:inline">{t('Design')}</span>
939
950
  <kbd
940
951
  aria-hidden
941
- className="hidden rounded-sm bg-foreground/10 px-1 font-mono text-[9.5px] text-muted-foreground md:inline"
952
+ className="hidden rounded-sm bg-foreground/10 px-1 font-mono text-[9.5px] text-muted-foreground lg:inline"
942
953
  >
943
954
  D
944
955
  </kbd>
@@ -957,12 +968,12 @@ export function Doc() {
957
968
  title={`${t('Changes since the last commit')} (C)`}
958
969
  onClick={() => toggleDock('changes')}
959
970
  className={cn(
960
- 'flex flex-none items-center gap-1.5 whitespace-nowrap rounded-md border border-border px-2.5 py-1.5 text-xs transition-colors hover:bg-accent',
971
+ 'hidden flex-none sm:flex items-center gap-1.5 whitespace-nowrap rounded-md border border-border px-2.5 py-1.5 text-xs transition-colors hover:bg-accent',
961
972
  changesOpen && 'bg-accent',
962
973
  )}
963
974
  >
964
975
  <GitCompare className="size-3.5" />
965
- <span className="hidden lg:inline">{t('Changes')}</span>
976
+ <span className="hidden xl:inline">{t('Changes')}</span>
966
977
  {changeItems.length > 0 && (
967
978
  <span
968
979
  aria-hidden
@@ -987,12 +998,12 @@ export function Doc() {
987
998
  title={`${t('Comments')} (M)`}
988
999
  onClick={() => toggleDock('comments')}
989
1000
  className={cn(
990
- 'flex flex-none items-center gap-1.5 whitespace-nowrap rounded-md border border-border px-2.5 py-1.5 text-xs transition-colors hover:bg-accent',
1001
+ 'hidden flex-none sm:flex items-center gap-1.5 whitespace-nowrap rounded-md border border-border px-2.5 py-1.5 text-xs transition-colors hover:bg-accent',
991
1002
  commentsOpen && 'bg-accent',
992
1003
  )}
993
1004
  >
994
1005
  <MessageSquare className="size-3.5" />
995
- <span className="hidden lg:inline">{t('Comments')}</span>
1006
+ <span className="hidden xl:inline">{t('Comments')}</span>
996
1007
  {commentList.length > 0 && (
997
1008
  <span
998
1009
  aria-hidden
@@ -1023,7 +1034,29 @@ export function Doc() {
1023
1034
  </button>
1024
1035
  )}
1025
1036
 
1026
- <CopyLink />
1037
+ <div className="hidden sm:contents">
1038
+ <CopyLink />
1039
+ </div>
1040
+ <MoreMenu
1041
+ changes={
1042
+ import.meta.env.DEV
1043
+ ? {
1044
+ open: changesOpen,
1045
+ count: changeItems.length,
1046
+ toggle: () => toggleDock('changes'),
1047
+ }
1048
+ : null
1049
+ }
1050
+ comments={
1051
+ import.meta.env.DEV
1052
+ ? {
1053
+ open: commentsOpen,
1054
+ count: commentList.length,
1055
+ toggle: () => toggleDock('comments'),
1056
+ }
1057
+ : null
1058
+ }
1059
+ />
1027
1060
 
1028
1061
  {/* The document browser normally carries this. A viewer mounted with
1029
1062
  `showDocBrowser: false` never shows that shell, and without it a
@@ -1036,6 +1069,8 @@ export function Doc() {
1036
1069
  <button
1037
1070
  type="button"
1038
1071
  disabled={download !== null}
1072
+ aria-label={download ? undefined : t('Download')}
1073
+ title={t('Download')}
1039
1074
  className="flex flex-none items-center gap-1.5 whitespace-nowrap rounded-md bg-primary px-2.5 py-1.5 text-primary-foreground text-xs transition-opacity hover:opacity-90 disabled:opacity-70 aria-expanded:opacity-90"
1040
1075
  {...props}
1041
1076
  >
@@ -1046,9 +1081,11 @@ export function Doc() {
1046
1081
  ) : (
1047
1082
  <Download className="size-3.5" />
1048
1083
  )}
1049
- {download
1050
- ? `${t(DOWNLOAD_LABEL[download.format])} ${Math.round(download.percent)}%`
1051
- : t('Download')}
1084
+ {download ? (
1085
+ `${t(DOWNLOAD_LABEL[download.format])} ${Math.round(download.percent)}%`
1086
+ ) : (
1087
+ <span className="hidden md:inline">{t('Download')}</span>
1088
+ )}
1052
1089
  </button>
1053
1090
  )}
1054
1091
  >
@@ -1097,7 +1134,8 @@ export function Doc() {
1097
1134
  </div>
1098
1135
  </header>
1099
1136
 
1100
- <div className="flex min-h-0 flex-1">
1137
+ {/* Positioned: below md the right dock floats over the pages from here. */}
1138
+ <div className="relative flex min-h-0 flex-1">
1101
1139
  <DocSidebar
1102
1140
  docId={docId ?? ''}
1103
1141
  pages={pages}
@@ -1585,6 +1623,80 @@ function ZoomControl({
1585
1623
  }
1586
1624
 
1587
1625
  /** The page as it is — document, and the reader's place in it — on the clipboard. */
1626
+ type DockToggle = { open: boolean; count: number; toggle: () => void } | null;
1627
+
1628
+ /** Below sm the header has no room for Changes, Comments and Copy link; they live here. */
1629
+ function MoreMenu({ changes, comments }: { changes: DockToggle; comments: DockToggle }) {
1630
+ const t = useT();
1631
+ const item = 'size-4 flex-none text-muted-foreground';
1632
+ return (
1633
+ <div className="sm:hidden">
1634
+ <Menu
1635
+ className="w-48 p-1.5"
1636
+ trigger={(props) => (
1637
+ <button
1638
+ type="button"
1639
+ aria-label={t('More')}
1640
+ title={t('More')}
1641
+ className="flex size-8 flex-none items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground"
1642
+ {...props}
1643
+ >
1644
+ <Ellipsis className="size-4" />
1645
+ </button>
1646
+ )}
1647
+ >
1648
+ {(close) => (
1649
+ <>
1650
+ {changes && (
1651
+ <MenuItem
1652
+ active={changes.open}
1653
+ onClick={() => {
1654
+ close();
1655
+ changes.toggle();
1656
+ }}
1657
+ >
1658
+ <GitCompare className={item} />
1659
+ <span className="flex-1">{t('Changes')}</span>
1660
+ {changes.count > 0 && (
1661
+ <span className="font-mono text-[10px] text-muted-foreground tabular-nums">
1662
+ {changes.count}
1663
+ </span>
1664
+ )}
1665
+ </MenuItem>
1666
+ )}
1667
+ {comments && (
1668
+ <MenuItem
1669
+ active={comments.open}
1670
+ onClick={() => {
1671
+ close();
1672
+ comments.toggle();
1673
+ }}
1674
+ >
1675
+ <MessageSquare className={item} />
1676
+ <span className="flex-1">{t('Comments')}</span>
1677
+ {comments.count > 0 && (
1678
+ <span className="font-mono text-[10px] text-muted-foreground tabular-nums">
1679
+ {comments.count}
1680
+ </span>
1681
+ )}
1682
+ </MenuItem>
1683
+ )}
1684
+ <MenuItem
1685
+ onClick={() => {
1686
+ close();
1687
+ navigator.clipboard.writeText(window.location.href).catch(() => {});
1688
+ }}
1689
+ >
1690
+ <Link2 className={item} />
1691
+ <span className="flex-1">{t('Copy link')}</span>
1692
+ </MenuItem>
1693
+ </>
1694
+ )}
1695
+ </Menu>
1696
+ </div>
1697
+ );
1698
+ }
1699
+
1588
1700
  function CopyLink() {
1589
1701
  const t = useT();
1590
1702
  const [copied, setCopied] = useState(false);
@@ -112,10 +112,12 @@ export function Home() {
112
112
  <button
113
113
  type="button"
114
114
  onClick={() => setCreating(true)}
115
- className="flex h-8 items-center gap-1.5 rounded-md bg-primary px-2.5 text-primary-foreground text-xs transition-opacity hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground/60"
115
+ aria-label={t('New document')}
116
+ title={t('New document')}
117
+ className="flex h-8 flex-none items-center gap-1.5 rounded-md bg-primary px-2.5 text-primary-foreground text-xs transition-opacity hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground/60"
116
118
  >
117
119
  <Plus className="size-3.5" />
118
- {t('New document')}
120
+ <span className="hidden @md:inline">{t('New document')}</span>
119
121
  </button>
120
122
  </>
121
123
  );
@@ -178,11 +180,12 @@ export function Home() {
178
180
  <button
179
181
  type="button"
180
182
  aria-label={t('Sort: {label}', { label: t(currentSort.label) })}
181
- className="flex h-8 items-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-xs transition-colors hover:bg-accent aria-expanded:bg-accent"
183
+ title={t(currentSort.label)}
184
+ className="flex h-8 flex-none items-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-xs transition-colors hover:bg-accent aria-expanded:bg-accent"
182
185
  {...props}
183
186
  >
184
187
  <currentSort.icon className="size-3.5 text-muted-foreground" />
185
- {t(currentSort.label)}
188
+ <span className="hidden @lg:inline">{t(currentSort.label)}</span>
186
189
  <ChevronDown className="size-3 text-muted-foreground" />
187
190
  </button>
188
191
  )}
@@ -204,7 +207,7 @@ export function Home() {
204
207
  ))
205
208
  }
206
209
  </Menu>
207
- <label className="flex h-8 w-56 items-center gap-2 rounded-md border border-border bg-background px-2.5 text-xs focus-within:border-foreground focus-within:ring-2 focus-within:ring-primary/30">
210
+ <label className="flex h-8 min-w-0 flex-1 items-center gap-2 @2xl:w-56 @2xl:flex-none rounded-md border border-border bg-background px-2.5 text-xs focus-within:border-foreground focus-within:ring-2 focus-within:ring-primary/30">
208
211
  <Search className="size-3.5 flex-none text-muted-foreground" />
209
212
  <input
210
213
  type="search"
@@ -478,19 +481,20 @@ function DraftWithAgentButton() {
478
481
  <button
479
482
  type="button"
480
483
  onClick={() => void start()}
484
+ aria-label={t.agent.createDoc}
481
485
  title={
482
486
  provider
483
487
  ? format(t.agent.createDocWith, { provider: provider.name })
484
488
  : t.agent.quickCreateHint
485
489
  }
486
- className="flex h-8 items-center gap-1.5 rounded-md border border-border px-2.5 text-xs transition-colors hover:bg-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground/60"
490
+ className="flex h-8 flex-none items-center gap-1.5 rounded-md border border-border px-2.5 text-xs transition-colors hover:bg-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground/60"
487
491
  >
488
492
  {provider ? (
489
493
  <ProviderLogo provider={provider.id} className="size-3.5" />
490
494
  ) : (
491
495
  <Sparkles className="size-3.5" />
492
496
  )}
493
- {t.agent.createDoc}
497
+ <span className="hidden @lg:inline">{t.agent.createDoc}</span>
494
498
  </button>
495
499
  );
496
500
  }
@@ -26,6 +26,6 @@ declare module 'virtual:open-doc/config' {
26
26
  import type { OpenDocConfig } from '../config';
27
27
 
28
28
  type ResolvedBuild = { showDocBrowser: boolean; allowHtmlExport: boolean };
29
- const config: OpenDocConfig & { build: ResolvedBuild; version: string };
29
+ const config: OpenDocConfig & { build: ResolvedBuild; version: string; fromSource: boolean };
30
30
  export default config;
31
31
  }