@open-document/core 0.16.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 (68) hide show
  1. package/dist/{build-BS_CoazO.js → build-C7nHUUXO.js} +1 -1
  2. package/dist/{check-tTjyMCrU.js → check--Cbkdqw3.js} +11 -4
  3. package/dist/cli/bin.js +25 -12
  4. package/dist/{context-Cli81dhF.js → context-DRXgt6Je.js} +2 -2
  5. package/dist/{deploy-gcp-BUiSuqz7.js → deploy-gcp-bbxQT0gf.js} +1 -1
  6. package/dist/{dev-n222xdoE.js → dev-D_j2ykSa.js} +1 -1
  7. package/dist/{diff-DB_qruzT.js → diff-C1RDK_I5.js} +2 -2
  8. package/dist/{export-CCFtdscQ.js → export-BFxKPa0W.js} +3 -3
  9. package/dist/{flow-CS5apebG.d.ts → flow-DlV3t5ML.d.ts} +24 -4
  10. package/dist/{import-D7k0yYZh.js → import-TLuMXkou.js} +11 -7
  11. package/dist/index.d.ts +26 -2
  12. package/dist/index.js +55 -1
  13. package/dist/{open-doc-plugin-DnX5usgI.js → open-doc-plugin-DE1sJXK_.js} +3 -2
  14. package/dist/ops/index.d.ts +138 -4
  15. package/dist/ops/index.js +3 -3
  16. package/dist/{ops-CouYBa1O.js → ops-BG9hfBwQ.js} +197 -9
  17. package/dist/{preview-DV0GDIsj.js → preview-rlMPuRZV.js} +1 -1
  18. package/dist/proofread-Dtj9OlWX.js +35 -0
  19. package/dist/{session-Cx7Msl_F.js → session-CPFLe6BT.js} +5148 -69
  20. package/dist/{templates-C-7VcMMV.js → templates-BmSuBmj3.js} +3 -3
  21. package/dist/translations-BmTXOhx9.js +42 -0
  22. package/dist/vite/index.d.ts +2 -0
  23. package/dist/vite/index.js +2 -2
  24. package/package.json +1 -1
  25. package/skills/doc-authoring/references/pagination.md +1 -1
  26. package/skills/fill-form/SKILL.md +42 -0
  27. package/skills/fit-pages/SKILL.md +48 -0
  28. package/skills/import-document/SKILL.md +58 -0
  29. package/skills/proofread/SKILL.md +44 -0
  30. package/skills/refresh-report/SKILL.md +48 -0
  31. package/skills/sync-translation/SKILL.md +55 -0
  32. package/src/agent/prompt.ts +1 -1
  33. package/src/app/components/agent/agent-dock.tsx +1 -1
  34. package/src/app/components/browser/browser-ui.tsx +8 -2
  35. package/src/app/components/checkbox.tsx +68 -0
  36. package/src/app/components/doc-sidebar.tsx +5 -3
  37. package/src/app/components/flow-page.tsx +7 -2
  38. package/src/app/components/panel/edit-save-card.tsx +3 -0
  39. package/src/app/components/panel/panel-shell.tsx +3 -1
  40. package/src/app/components/sidebar/sidebar.tsx +2 -1
  41. package/src/app/lib/agent-bridge.ts +37 -4
  42. package/src/app/lib/diagnostics.ts +46 -5
  43. package/src/app/lib/export-docx.ts +5 -2
  44. package/src/app/lib/export-dom.ts +13 -0
  45. package/src/app/lib/export-html.ts +6 -1
  46. package/src/app/lib/export-image.ts +9 -4
  47. package/src/app/lib/export-pdf.ts +17 -4
  48. package/src/app/lib/flow-measure.ts +9 -5
  49. package/src/app/lib/flow.ts +3 -2
  50. package/src/app/lib/i18n-ja/browser.ts +1 -0
  51. package/src/app/lib/i18n-ja/doc.ts +1 -0
  52. package/src/app/lib/i18n-ko/browser.ts +1 -0
  53. package/src/app/lib/i18n-ko/doc.ts +1 -0
  54. package/src/app/lib/i18n-zh-cn/browser.ts +1 -0
  55. package/src/app/lib/i18n-zh-cn/doc.ts +1 -0
  56. package/src/app/lib/i18n-zh-tw/browser.ts +1 -0
  57. package/src/app/lib/i18n-zh-tw/doc.ts +1 -0
  58. package/src/app/lib/page-budget.ts +81 -0
  59. package/src/app/lib/proofread-script.ts +61 -0
  60. package/src/app/lib/proofread.ts +399 -0
  61. package/src/app/lib/recent-docs.ts +27 -0
  62. package/src/app/lib/sdk.ts +44 -2
  63. package/src/app/lib/text-runs.ts +83 -0
  64. package/src/app/lib/use-doc-pages.ts +10 -3
  65. package/src/app/routes/doc-preview.tsx +1 -1
  66. package/src/app/routes/doc.tsx +190 -54
  67. package/src/app/routes/home.tsx +50 -12
  68. package/src/app/virtual.d.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { r as createViteConfig } from "./session-Cx7Msl_F.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 { R as listDocIds, S as closeRenderSession, x as checkLayout } from "./session-Cx7Msl_F.js";
2
- import "./ops-CouYBa1O.js";
3
- import { t as cliContext } from "./context-Cli81dhF.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) {
@@ -24,13 +24,20 @@ async function checkDocs(docIds, opts = {}) {
24
24
  const reports = [];
25
25
  try {
26
26
  for (const docId of targets) {
27
- const report = await checkLayout(ctx, docId);
27
+ const report = await checkLayout(ctx, docId, { maxPages: opts.maxPages });
28
28
  reports.push(report);
29
29
  errors += report.errors;
30
30
  if (opts.json) continue;
31
31
  const summary = report.errors === 0 && report.warnings === 0 ? chalk.green("clean") : [report.errors > 0 ? chalk.red(`${report.errors} error(s)`) : "", report.warnings > 0 ? chalk.yellow(`${report.warnings} warning(s)`) : ""].filter(Boolean).join(", ");
32
32
  process.stdout.write(`${chalk.bold(docId)} ${chalk.dim(`${report.pageCount} pages`)} — ${summary}\n`);
33
33
  for (const finding of report.findings) process.stdout.write(`${line(finding)}\n`);
34
+ if (report.budget && report.budget.over > 0) {
35
+ process.stdout.write(` ${chalk.dim("Where the pages go:")}\n`);
36
+ for (const section of report.budget.sections) {
37
+ const span = section.startPage === section.endPage ? `p.${section.startPage}` : `p.${section.startPage}–${section.endPage}`;
38
+ process.stdout.write(` ${String(section.pages).padStart(5)} ${section.title} ${chalk.dim(span)}\n`);
39
+ }
40
+ }
34
41
  }
35
42
  } finally {
36
43
  await closeRenderSession();
package/dist/cli/bin.js CHANGED
@@ -96,6 +96,11 @@ function parsePort(value) {
96
96
  if (!Number.isInteger(n) || n < 0 || n > 65535) throw new Error(`Invalid port: ${value}`);
97
97
  return n;
98
98
  }
99
+ function parsePositiveInt(value) {
100
+ const n = Number(value);
101
+ if (!Number.isInteger(n) || n < 1) throw new Error(`Expected a whole number of at least 1: ${value}`);
102
+ return n;
103
+ }
99
104
  const GCP_DEPLOY_ACTIONS = [
100
105
  "up",
101
106
  "check",
@@ -143,39 +148,47 @@ async function run(argv) {
143
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)"));
144
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) => {
145
150
  if (flags.skillsCheck !== false) await runSkillsDriftCheck(resolveBuiltinSkillsDir());
146
- const { dev } = await import("../dev-n222xdoE.js");
151
+ const { dev } = await import("../dev-D_j2ykSa.js");
147
152
  await dev(flags);
148
153
  });
149
154
  program.command("build").description("Build a static site").option("--out-dir <dir>", "output directory (defaults to `dist`)").action(async (flags) => {
150
- const { build } = await import("../build-BS_CoazO.js");
155
+ const { build } = await import("../build-C7nHUUXO.js");
151
156
  await build(flags);
152
157
  });
153
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) => {
154
- const { preview } = await import("../preview-DV0GDIsj.js");
159
+ const { preview } = await import("../preview-rlMPuRZV.js");
155
160
  await preview(flags);
156
161
  });
157
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) => {
158
- const { exportDocs } = await import("../export-CCFtdscQ.js");
163
+ const { exportDocs } = await import("../export-BFxKPa0W.js");
159
164
  await exportDocs(docIds, flags);
160
165
  });
161
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) => {
162
- const { diffDoc } = await import("../diff-DB_qruzT.js");
167
+ const { diffDoc } = await import("../diff-C1RDK_I5.js");
163
168
  await diffDoc(docId, flags);
164
169
  });
165
- program.command("check [docIds...]").description("Report layout faults — clipped content, blank sheets, stranded headings").option("--json", "print the full report as JSON").action(async (docIds, flags) => {
166
- const { checkDocs } = await import("../check-tTjyMCrU.js");
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--Cbkdqw3.js");
167
172
  await checkDocs(docIds, flags);
168
173
  });
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-BmTXOhx9.js");
176
+ await translations(docId, flags);
177
+ });
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-Dtj9OlWX.js");
180
+ await proofreadDocs(docIds, flags);
181
+ });
169
182
  program.command("templates").description("List the templates a new document can start from").option("--json", "print them as JSON").action(async (flags) => {
170
- const { printTemplates } = await import("../templates-C-7VcMMV.js");
183
+ const { printTemplates } = await import("../templates-BmSuBmj3.js");
171
184
  await printTemplates(flags);
172
185
  });
173
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) => {
174
- const { newDoc } = await import("../templates-C-7VcMMV.js");
187
+ const { newDoc } = await import("../templates-BmSuBmj3.js");
175
188
  await newDoc(docId, flags);
176
189
  });
177
- program.command("import <file>").description("Turn a Markdown file into a document under docs/").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").option("--contents", "add a self-filling contents page").action(async (file, flags) => {
178
- const { importDoc } = await import("../import-D7k0yYZh.js");
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-TLuMXkou.js");
179
192
  await importDoc(file, flags);
180
193
  });
181
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) => {
@@ -183,7 +196,7 @@ async function run(argv) {
183
196
  await syncSkills(resolveBuiltinSkillsDir(), flags);
184
197
  });
185
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) => {
186
- const mod = await import("../deploy-gcp-BUiSuqz7.js");
199
+ const mod = await import("../deploy-gcp-bbxQT0gf.js");
187
200
  switch (action) {
188
201
  case "up":
189
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 { W as makeContext } from "./session-Cx7Msl_F.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-Cx7Msl_F.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 { o as diffDocument } from "./ops-CouYBa1O.js";
2
- import { t as cliContext } from "./context-Cli81dhF.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 { C as exportDocument, R as listDocIds, S as closeRenderSession } from "./session-Cx7Msl_F.js";
3
- import "./ops-CouYBa1O.js";
4
- import { t as cliContext } from "./context-Cli81dhF.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;
@@ -124,6 +124,12 @@ type DocPage = ComponentType;
124
124
  * A run of continuous content the framework paginates itself. Build one with
125
125
  * `flow(...)` and put it in the page array alongside fixed pages.
126
126
  */
127
+ type FlowPadding = number | {
128
+ top: number;
129
+ right: number;
130
+ bottom: number;
131
+ left: number;
132
+ };
127
133
  type FlowSection = {
128
134
  readonly __odFlow: true;
129
135
  blocks: ReactNode[];
@@ -131,8 +137,17 @@ type FlowSection = {
131
137
  header?: ComponentType;
132
138
  /** Rendered on every page the section expands into. */
133
139
  footer?: ComponentType;
134
- /** Page padding override in px; defaults to the design's `margin`. */
135
- padding?: number;
140
+ /**
141
+ * Page padding override in px — one number for all four sides, or each side
142
+ * on its own (a Word page's top and bottom margins rarely match its sides).
143
+ * Defaults to the design's `margin`.
144
+ */
145
+ padding?: FlowPadding;
146
+ /**
147
+ * Turns this section's sheets — a wide table's landscape pages inside a
148
+ * portrait document. Defaults to the document's orientation.
149
+ */
150
+ orientation?: Orientation;
136
151
  /** Number of columns for body content inside each page of this flow section. */
137
152
  columns?: 1 | 2 | 3;
138
153
  /** Gap in px between columns when `columns > 1`; defaults to 24. */
@@ -175,6 +190,10 @@ type DocMeta = {
175
190
  recordLabel?: string;
176
191
  /** Diagonal watermark text stamped across every sheet (e.g. 'CONFIDENTIAL', 'DRAFT'). */
177
192
  watermark?: string;
193
+ /** Id of the document this one translates. `open-doc translations` reports when it falls behind. */
194
+ translationOf?: string;
195
+ /** The source's commit this translation matches. Written by `open-doc translations --mark`. */
196
+ translatedAt?: string;
178
197
  };
179
198
  type DocModule = {
180
199
  default: DocEntry[];
@@ -197,7 +216,8 @@ declare function resolvePageGeometry(meta?: DocMeta): PageGeometry;
197
216
  declare function flow(children: ReactNode, opts?: {
198
217
  header?: ComponentType;
199
218
  footer?: ComponentType;
200
- padding?: number;
219
+ padding?: FlowPadding;
220
+ orientation?: Orientation;
201
221
  columns?: 1 | 2 | 3;
202
222
  columnGap?: number;
203
223
  }): FlowSection;
@@ -249,4 +269,4 @@ type PaginateOptions = {
249
269
  */
250
270
  declare function paginateBlocks(blocks: BlockMetrics[], available: number, opts?: PaginateOptions): PaginationResult;
251
271
  //#endregion
252
- export { DesignPalette as A, useDocLabels as B, isPageSizeName as C, FieldProps as D, Field as E, designToCssVars as F, LabelEntry as I, LabelKind as L, DesignTypeScale as M, cssVarsToString as N, useRecord as O, defaultDesign as P, LabelVocabulary as R, isOrientation as S, DataRecord as T, Orientation as _, isFlowSection as a, PageGeometry as b, DEFAULT_PAGE_SIZE as c, DocModule as d, DocPage as f, ORIENTATIONS as g, FlowSection as h, flow as i, DesignSystem as j, DesignFonts as k, DocEntry as l, ExportFormat as m, BlockSlice as n, paginateBlocks as o, EXPORT_FORMATS as p, PaginationResult as r, DEFAULT_ORIENTATION as s, BlockMetrics as t, DocMeta as u, PAGE_SIZES as v, resolvePageGeometry as w, PageSizeName as x, PAGE_SIZE_NAMES as y, useDocLabel as z };
272
+ export { DesignFonts as A, useDocLabel as B, isOrientation as C, Field as D, DataRecord as E, defaultDesign as F, designToCssVars as I, LabelEntry as L, DesignSystem as M, DesignTypeScale as N, FieldProps as O, cssVarsToString as P, LabelKind as R, PageSizeName as S, resolvePageGeometry as T, useDocLabels as V, ORIENTATIONS as _, isFlowSection as a, PAGE_SIZE_NAMES as b, DEFAULT_PAGE_SIZE as c, DocModule as d, DocPage as f, FlowSection as g, FlowPadding as h, flow as i, DesignPalette as j, useRecord as k, DocEntry as l, ExportFormat as m, BlockSlice as n, paginateBlocks as o, EXPORT_FORMATS as p, PaginationResult as r, DEFAULT_ORIENTATION as s, BlockMetrics as t, DocMeta as u, Orientation as v, isPageSizeName as w, PageGeometry as x, PAGE_SIZES as y, LabelVocabulary as z };
@@ -1,14 +1,13 @@
1
- import { T as importMarkdown } from "./session-Cx7Msl_F.js";
2
- import "./ops-CouYBa1O.js";
3
- import { t as cliContext } from "./context-Cli81dhF.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
7
7
  async function importDoc(file, opts = {}) {
8
8
  const ctx = await cliContext();
9
- const relative = path.relative(ctx.userCwd, path.resolve(ctx.userCwd, file));
10
- const result = await importMarkdown(ctx, {
11
- file: relative,
9
+ const common = {
10
+ file: path.relative(ctx.userCwd, path.resolve(ctx.userCwd, file)),
12
11
  ...opts.id !== void 0 ? { docId: opts.id } : {},
13
12
  ...opts.title !== void 0 ? { title: opts.title } : {},
14
13
  ...opts.subtitle !== void 0 ? { subtitle: opts.subtitle } : {},
@@ -19,10 +18,15 @@ async function importDoc(file, opts = {}) {
19
18
  ...opts.orientation !== void 0 ? { orientation: opts.orientation } : {},
20
19
  ...opts.cover !== void 0 ? { cover: opts.cover } : {},
21
20
  ...opts.contents !== void 0 ? { contents: opts.contents } : {}
22
- });
21
+ };
22
+ const result = /\.(docx|docm|dotx|dotm)$/i.test(file) ? await importDocx(ctx, {
23
+ ...common,
24
+ ...opts.plain ? { plain: true } : {}
25
+ }) : await importMarkdown(ctx, common);
23
26
  process.stdout.write(`${chalk.green("✓")} ${chalk.bold(result.title)} → ${result.entry} ${chalk.dim(`(${result.blocks} blocks)`)}\n`);
24
27
  if (result.assets.length > 0) process.stdout.write(chalk.dim(` copied ${result.assets.length} asset(s)\n`));
25
28
  for (const missing of result.missingAssets) process.stdout.write(chalk.yellow(` ! image not found, left as written: ${missing}\n`));
29
+ for (const warning of result.warnings) process.stdout.write(chalk.yellow(` ! ${warning}\n`));
26
30
  }
27
31
  //#endregion
28
32
  export { importDoc };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as DesignPalette, B as useDocLabels, C as isPageSizeName, D as FieldProps, E as Field, F as designToCssVars, I as LabelEntry, L as LabelKind, M as DesignTypeScale, N as cssVarsToString, O as useRecord, P as defaultDesign, R as LabelVocabulary, S as isOrientation, T as DataRecord, _ as Orientation, a as isFlowSection, b as PageGeometry, c as DEFAULT_PAGE_SIZE, d as DocModule, f as DocPage, g as ORIENTATIONS, h as FlowSection, i as flow, j as DesignSystem, k as DesignFonts, l as DocEntry, n as BlockSlice, o as paginateBlocks, r as PaginationResult, s as DEFAULT_ORIENTATION, t as BlockMetrics, u as DocMeta, v as PAGE_SIZES, w as resolvePageGeometry, x as PageSizeName, y as PAGE_SIZE_NAMES, z as useDocLabel } from "./flow-CS5apebG.js";
1
+ import { A as DesignFonts, B as useDocLabel, C as isOrientation, D as Field, E as DataRecord, F as defaultDesign, I as designToCssVars, L as LabelEntry, M as DesignSystem, N as DesignTypeScale, O as FieldProps, P as cssVarsToString, R as LabelKind, S as PageSizeName, T as resolvePageGeometry, V as useDocLabels, _ as ORIENTATIONS, a as isFlowSection, b as PAGE_SIZE_NAMES, c as DEFAULT_PAGE_SIZE, d as DocModule, f as DocPage, g as FlowSection, h as FlowPadding, i as flow, j as DesignPalette, k as useRecord, l as DocEntry, n as BlockSlice, o as paginateBlocks, r as PaginationResult, s as DEFAULT_ORIENTATION, t as BlockMetrics, u as DocMeta, v as Orientation, w as isPageSizeName, x as PageGeometry, y as PAGE_SIZES, z as LabelVocabulary } from "./flow-DlV3t5ML.js";
2
2
  import { a as OpenDocGcpDeployConfig, i as OpenDocDeployConfig, n as OpenDocBuildConfig, r as OpenDocConfig, t as OpenDocAgentConfig } from "./config-cAV1OCuY.js";
3
3
  import { CSSProperties, ReactNode } from "react";
4
4
  //#region src/app/lib/source-loc.d.ts
@@ -95,6 +95,23 @@ type SparklineProps = {
95
95
  */
96
96
  declare function Sparkline({ data, type, width, height, color, showEndDot, style, className }: SparklineProps): import("react").JSX.Element | null;
97
97
  //#endregion
98
+ //#region src/app/components/checkbox.d.ts
99
+ type CheckboxProps = {
100
+ /** Ticked. Toggle this to fill in a form. */
101
+ checked?: boolean;
102
+ /** The mark a ticked box shows: a tick (default) or a cross, as ☑ and ☒. */
103
+ mark?: 'tick' | 'cross';
104
+ style?: CSSProperties;
105
+ className?: string;
106
+ };
107
+ /**
108
+ * A box on a form to tick: ☐, or ☑ when `checked`. Drawn rather than typed,
109
+ * so it keeps one size and look in any font — ☑ is missing from most CJK
110
+ * faces, and the fallback a browser picks draws it smaller than the □ beside
111
+ * it. It takes a character's width in the text it sits in.
112
+ */
113
+ declare function Checkbox({ checked, mark, style, className }: CheckboxProps): import("react").JSX.Element;
114
+ //#endregion
98
115
  //#region src/app/components/code-block.d.ts
99
116
  type CodeBlockProps = {
100
117
  code?: string;
@@ -196,6 +213,13 @@ type DiagramProps = {
196
213
  */
197
214
  declare function Diagram({ chart, caption, captionText, kind, id, width, align, style, className }: DiagramProps): import("react").JSX.Element;
198
215
  //#endregion
216
+ //#region src/app/components/flow-page.d.ts
217
+ type TableSliceRange = {
218
+ rowStart: number;
219
+ rowEnd: number;
220
+ };
221
+ declare function useTableSlice(): TableSliceRange | null;
222
+ //#endregion
199
223
  //#region src/app/components/footnote.d.ts
200
224
  /** `loc` is the `<Footnote>` call site, so the printed note can be edited where it prints. */
201
225
  type CollectedNote = {
@@ -489,4 +513,4 @@ type CompileOptions = LayoutOptions & RenderOptions;
489
513
  /** Mermaid-flavoured text in, themed SVG out. One call, no browser. */
490
514
  declare function compileDiagram(source: string, options?: CompileOptions): CompiledDiagram;
491
515
  //#endregion
492
- export { Bibliography, type BibliographyItem, type BibliographyProps, type BlockMetrics, type BlockSlice, Callout, type CalloutProps, type CalloutVariant, type CellValue, Chart, type ChartFormat, type ChartProps, type ChartType, Cite, type CiteProps, CodeBlock, type CodeBlockProps, type CompileOptions, type CompiledDiagram, DEFAULT_ORIENTATION, DEFAULT_PAGE_SIZE, type DataAlign, type DataColumn, type DataFormat, type DataRecord, type DataSummaryOp, DataTable, type DataTableProps, type DelimitedTable, type DesignFonts, type DesignPalette, type DesignSystem, type DesignTypeScale, Diagram, type DiagramProps, type DiagramSource, type DiagramSubgraph, DiagramSyntaxError, type DocEntry, type DocMeta, type DocModule, type DocPage, Field, type FieldProps, Figure, type FigureProps, type FlowSection, Footnote, type FootnoteProps, Footnotes, type FootnotesProps, ImagePlaceholder, type ImagePlaceholderProps, type LabelEntry, type LabelKind, type LabelVocabulary, type LaidOutLifeline, type LaidOutSubgraph, ListOf, ListOfFigures, type ListOfProps, ListOfTables, ORIENTATIONS, type OpenDocAgentConfig, type OpenDocBuildConfig, type OpenDocConfig, type OpenDocDeployConfig, type OpenDocGcpDeployConfig, type Orientation, type OutlineEntry, PAGE_SIZES, PAGE_SIZE_NAMES, type PageGeometry, type PageSizeName, type PaginationResult, Ref, type RefProps, type SequenceMessage, type SequenceParticipant, Sparkline, type SparklineProps, TableOfContents, type TableOfContentsProps, compileDiagram, cssVarsToString, defaultDesign, designToCssVars, flow, isFlowSection, isOrientation, isPageSizeName, paginateBlocks, parseDelimited, resolvePageGeometry, useDocLabel, useDocLabels, useDocOutline, useDocPageCount, useDocPageNumber, useRecord };
516
+ export { Bibliography, type BibliographyItem, type BibliographyProps, type BlockMetrics, type BlockSlice, Callout, type CalloutProps, type CalloutVariant, type CellValue, Chart, type ChartFormat, type ChartProps, type ChartType, Checkbox, type CheckboxProps, Cite, type CiteProps, CodeBlock, type CodeBlockProps, type CompileOptions, type CompiledDiagram, DEFAULT_ORIENTATION, DEFAULT_PAGE_SIZE, type DataAlign, type DataColumn, type DataFormat, type DataRecord, type DataSummaryOp, DataTable, type DataTableProps, type DelimitedTable, type DesignFonts, type DesignPalette, type DesignSystem, type DesignTypeScale, Diagram, type DiagramProps, type DiagramSource, type DiagramSubgraph, DiagramSyntaxError, type DocEntry, type DocMeta, type DocModule, type DocPage, Field, type FieldProps, Figure, type FigureProps, type FlowPadding, type FlowSection, Footnote, type FootnoteProps, Footnotes, type FootnotesProps, ImagePlaceholder, type ImagePlaceholderProps, type LabelEntry, type LabelKind, type LabelVocabulary, type LaidOutLifeline, type LaidOutSubgraph, ListOf, ListOfFigures, type ListOfProps, ListOfTables, ORIENTATIONS, type OpenDocAgentConfig, type OpenDocBuildConfig, type OpenDocConfig, type OpenDocDeployConfig, type OpenDocGcpDeployConfig, type Orientation, type OutlineEntry, PAGE_SIZES, PAGE_SIZE_NAMES, type PageGeometry, type PageSizeName, type PaginationResult, Ref, type RefProps, type SequenceMessage, type SequenceParticipant, Sparkline, type SparklineProps, TableOfContents, type TableOfContentsProps, type TableSliceRange, compileDiagram, cssVarsToString, defaultDesign, designToCssVars, flow, isFlowSection, isOrientation, isPageSizeName, paginateBlocks, parseDelimited, resolvePageGeometry, useDocLabel, useDocLabels, useDocOutline, useDocPageCount, useDocPageNumber, useRecord, useTableSlice };
package/dist/index.js CHANGED
@@ -1269,6 +1269,60 @@ function Sparkline({ data, type = "line", width = 76, height = 20, color = ACCEN
1269
1269
  });
1270
1270
  }
1271
1271
  //#endregion
1272
+ //#region src/app/components/checkbox.tsx
1273
+ /**
1274
+ * A box on a form to tick: ☐, or ☑ when `checked`. Drawn rather than typed,
1275
+ * so it keeps one size and look in any font — ☑ is missing from most CJK
1276
+ * faces, and the fallback a browser picks draws it smaller than the □ beside
1277
+ * it. It takes a character's width in the text it sits in.
1278
+ */
1279
+ function Checkbox({ checked = false, mark = "tick", style, className }) {
1280
+ return /* @__PURE__ */ jsx("span", {
1281
+ role: "img",
1282
+ "aria-label": checked ? mark === "cross" ? "☒" : "☑" : "☐",
1283
+ "data-od-checkbox": checked ? "checked" : "",
1284
+ className,
1285
+ style: {
1286
+ display: "inline-block",
1287
+ position: "relative",
1288
+ boxSizing: "border-box",
1289
+ width: "0.8em",
1290
+ height: "0.8em",
1291
+ margin: "0 0.1em",
1292
+ border: "0.07em solid currentColor",
1293
+ verticalAlign: "-0.1em",
1294
+ textIndent: 0,
1295
+ lineHeight: 1,
1296
+ ...style
1297
+ },
1298
+ children: checked && /* @__PURE__ */ jsx("svg", {
1299
+ viewBox: "0 0 10 10",
1300
+ "aria-hidden": true,
1301
+ style: {
1302
+ position: "absolute",
1303
+ left: 0,
1304
+ top: 0,
1305
+ width: "100%",
1306
+ height: "100%",
1307
+ overflow: "visible"
1308
+ },
1309
+ children: mark === "cross" ? /* @__PURE__ */ jsx("path", {
1310
+ d: "M2 2 L8 8 M8 2 L2 8",
1311
+ stroke: "currentColor",
1312
+ strokeWidth: "1.2",
1313
+ fill: "none"
1314
+ }) : /* @__PURE__ */ jsx("path", {
1315
+ d: "M1.8 5.2 L4.1 7.6 L8.6 2.2",
1316
+ stroke: "currentColor",
1317
+ strokeWidth: "1.3",
1318
+ fill: "none",
1319
+ strokeLinecap: "round",
1320
+ strokeLinejoin: "round"
1321
+ })
1322
+ })
1323
+ });
1324
+ }
1325
+ //#endregion
1272
1326
  //#region src/app/components/code-block.tsx
1273
1327
  const KEYWORDS = /* @__PURE__ */ new Set([
1274
1328
  "import",
@@ -1977,4 +2031,4 @@ function Field({ name, fallback }) {
1977
2031
  return createElement("span", null, String(value));
1978
2032
  }
1979
2033
  //#endregion
1980
- export { Bibliography, Callout, Chart, Cite, CodeBlock, DEFAULT_ORIENTATION, DEFAULT_PAGE_SIZE, DataTable, Diagram, DiagramSyntaxError, Field, Figure, Footnote, Footnotes, ImagePlaceholder, ListOf, ListOfFigures, ListOfTables, ORIENTATIONS, PAGE_SIZES, PAGE_SIZE_NAMES, Ref, Sparkline, TableOfContents, compileDiagram, cssVarsToString, defaultDesign, designToCssVars, flow, isFlowSection, isOrientation, isPageSizeName, paginateBlocks, parseDelimited, resolvePageGeometry, useDocLabel, useDocLabels, useDocOutline, useDocPageCount, useDocPageNumber, useRecord };
2034
+ export { Bibliography, Callout, Chart, Checkbox, Cite, CodeBlock, DEFAULT_ORIENTATION, DEFAULT_PAGE_SIZE, DataTable, Diagram, DiagramSyntaxError, Field, Figure, Footnote, Footnotes, ImagePlaceholder, ListOf, ListOfFigures, ListOfTables, ORIENTATIONS, PAGE_SIZES, PAGE_SIZE_NAMES, Ref, Sparkline, TableOfContents, compileDiagram, cssVarsToString, defaultDesign, designToCssVars, flow, isFlowSection, isOrientation, isPageSizeName, paginateBlocks, parseDelimited, resolvePageGeometry, useDocLabel, useDocLabels, useDocOutline, useDocPageCount, useDocPageNumber, useRecord, useTableSlice };
@@ -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)) {
@@ -1,4 +1,4 @@
1
- import { _ as Orientation, g as ORIENTATIONS, m as ExportFormat, p as EXPORT_FORMATS, x as PageSizeName, y as PAGE_SIZE_NAMES } from "../flow-CS5apebG.js";
1
+ import { S as PageSizeName, _ as ORIENTATIONS, b as PAGE_SIZE_NAMES, m as ExportFormat, p as EXPORT_FORMATS, v as Orientation } from "../flow-DlV3t5ML.js";
2
2
  import { ReactNode } from "react";
3
3
  import "vite";
4
4
  //#region src/vite/routes/context.d.ts
@@ -118,7 +118,7 @@ declare function assertExpectedSource(current: string, opts?: {
118
118
  declare function withFileLock<T>(filePath: string, fn: () => Promise<T>): Promise<T>;
119
119
  //#endregion
120
120
  //#region src/app/lib/diagnostics.d.ts
121
- type LayoutRule = 'render-error' | 'unresolved-ref' | 'duplicate-id' | 'heading-skip' | 'page-overflow' | 'off-page' | 'blank-page' | 'oversized-block' | 'orphan-heading' | 'tiny-text' | 'broken-image';
121
+ type LayoutRule = 'render-error' | 'unresolved-ref' | 'duplicate-id' | 'heading-skip' | 'page-overflow' | 'off-page' | 'blank-page' | 'oversized-block' | 'orphan-heading' | 'tiny-text' | 'broken-image' | 'page-budget';
122
122
  type LayoutSeverity = 'error' | 'warn';
123
123
  type LayoutFinding = {
124
124
  /** 1-based sheet the problem is on. */
@@ -132,6 +132,20 @@ type LayoutFinding = {
132
132
  loc?: string;
133
133
  };
134
134
  //#endregion
135
+ //#region src/app/lib/proofread.d.ts
136
+ type ProofreadRule = 'fullwidth-alnum' | 'punctuation-width' | 'script-mix' | 'repeated-word' | 'term-casing';
137
+ type ProofreadFinding = {
138
+ /** 1-based sheet the text is on. */
139
+ page: number;
140
+ rule: ProofreadRule;
141
+ severity: 'warn';
142
+ message: string;
143
+ /** The words around the problem, as printed. */
144
+ snippet: string;
145
+ /** `line:column` in the document source, from the inspector's `data-od-loc`. */
146
+ loc?: string;
147
+ };
148
+ //#endregion
135
149
  //#region src/render/session.d.ts
136
150
  /** Where two pictures of a sheet differ, in the pictures' own pixels. */
137
151
  type ImageDiff = {
@@ -272,6 +286,8 @@ type ImportResult = {
272
286
  assets: string[];
273
287
  /** Image references that could not be resolved and were left as written. */
274
288
  missingAssets: string[];
289
+ /** What the source had that the document could not hold, in words. */
290
+ warnings: string[];
275
291
  };
276
292
  declare function slugify(value: string, fallback?: string): string;
277
293
  /**
@@ -281,6 +297,46 @@ declare function slugify(value: string, fallback?: string): string;
281
297
  * agent would have written by hand, and every editing surface works on it.
282
298
  */
283
299
  declare function importMarkdown(ctx: ApiContext, opts: ImportMarkdownOptions): Promise<ImportResult>;
300
+ type ImportDocxOptions = Omit<ImportMarkdownOptions, 'markdown' | 'file'> & {
301
+ /** Path to a `.docx` file, relative to the workspace root. */
302
+ file: string;
303
+ /**
304
+ * Structure only — headings, lists, tables in the house style, with a cover —
305
+ * instead of Word's own page look. `cover` and `contents` apply only then.
306
+ */
307
+ plain?: boolean;
308
+ };
309
+ /**
310
+ * Reads a Word `.docx` into the same blocks Markdown import uses and writes
311
+ * the document through the same generator. Embedded pictures are copied into
312
+ * `docs/<id>/assets/`; what Word has that a document does not (text boxes,
313
+ * notes, comments, tracked changes) comes back in `warnings`.
314
+ */
315
+ declare function importDocx(ctx: ApiContext, opts: ImportDocxOptions): Promise<ImportResult>;
316
+ //#endregion
317
+ //#region src/app/lib/page-budget.d.ts
318
+ type BudgetSection = {
319
+ title: string;
320
+ level: number;
321
+ /** 1-based sheet the section's heading is on. */
322
+ startPage: number;
323
+ /** Last sheet it reaches. */
324
+ endPage: number;
325
+ /** Sheets it fills, from its heading to the next section's (or to the end of the last sheet's content). */
326
+ pages: number;
327
+ };
328
+ type PageBudget = {
329
+ maxPages: number;
330
+ pageCount: number;
331
+ /** Sheets past the budget; 0 when it fits. */
332
+ over: number;
333
+ /** How full the last sheet is, 0–1. A nearly empty last sheet is the cheapest one to lose. */
334
+ lastPageFill: number;
335
+ /** Roughly how many sheets of body must go: `over`, less the last sheet's slack. */
336
+ toCut: number;
337
+ /** Top-rank sections in document order. */
338
+ sections: BudgetSection[];
339
+ };
284
340
  //#endregion
285
341
  //#region src/ops/layout.d.ts
286
342
  type LayoutReport = {
@@ -290,6 +346,23 @@ type LayoutReport = {
290
346
  errors: number;
291
347
  warnings: number;
292
348
  findings: LayoutFinding[];
349
+ /** With `maxPages`: how far over the document is and which sections hold the length. */
350
+ budget?: PageBudget;
351
+ };
352
+ type CheckLayoutOptions = {
353
+ /** Sheets the document must fit in. Going over is an error finding. */
354
+ maxPages?: number;
355
+ };
356
+ type ProofreadReport = {
357
+ docId: string;
358
+ title: string;
359
+ /** The language the rules read the text in — `meta.lang`, else `en`. */
360
+ lang: string;
361
+ pageCount: number;
362
+ warnings: number;
363
+ findings: ProofreadFinding[];
364
+ /** Findings left out by the per-page and per-rule caps. */
365
+ omitted: number;
293
366
  };
294
367
  type ExportResult = {
295
368
  docId: string;
@@ -306,7 +379,14 @@ declare function closeRenderSession(): Promise<void>;
306
379
  * Renders the document headlessly at true page size and reports what is wrong
307
380
  * with the layout — the part of a document an agent writing React cannot see.
308
381
  */
309
- declare function checkLayout(ctx: ApiContext, docId: string): Promise<LayoutReport>;
382
+ declare function checkLayout(ctx: ApiContext, docId: string, opts?: CheckLayoutOptions): Promise<LayoutReport>;
383
+ /**
384
+ * Reads the text the document prints and reports consistency slips — full-width
385
+ * letters, punctuation of the wrong width for the language, Simplified and
386
+ * Traditional characters mixed, doubled words, a term capitalised two ways.
387
+ * Advice, not a gate: everything is a warning.
388
+ */
389
+ declare function proofreadDocument(ctx: ApiContext, docId: string): Promise<ProofreadReport>;
310
390
  declare function renderDocPage(ctx: ApiContext, docId: string, page: number): Promise<{
311
391
  docId: string;
312
392
  page: number;
@@ -603,4 +683,58 @@ declare function addComment(ctx: ApiContext, docId: string, loc: Loc, note: stri
603
683
  hash: string;
604
684
  }>;
605
685
  //#endregion
606
- export { type ApiContext, type AssetSummary, type ChangesResult, type DiffResult, type DocumentOutline, type DocumentSummary, EXPORT_FORMATS, type ExportFormat, type ExportResult, type ImportMarkdownOptions, type ImportResult, type LayoutFinding, type LayoutReport, type Loc, ORIENTATIONS, OpsError, type Orientation, type OutlineBlock, type OutlineHeading, PAGE_SIZE_NAMES, type PageChange, type PageSizeName, type PageStatus, type Revision, type TemplateSummary, type ThemeSummary, addComment, assertExpectedSource, checkLayout, closeRenderSession, createDocument, createFolder, createFromTemplate, deleteAsset, deleteDocument, diffDocument, docDir, duplicateDocument, editDocument, exportDocument, fileDocument, findAssetUsages, hashSource, importMarkdown, listAssets, listDocIds, listDocuments, listFolders, listRevisions, listTemplates, listThemes, makeContext, outlineDocument, outlineSource, readChanges, readDocument, readDocumentLines, readText, readTheme, renameDocument, renderDocPage, resolveEntry, revertChange, searchDocument, slugify, suggestDocId, withFileLock, writeAsset, writeDocument, writeEdits, writeText, writeTexts };
686
+ //#region src/ops/translations.d.ts
687
+ type TranslationState =
688
+ /** The source has not changed since `translatedAt`. */
689
+ 'current' |
690
+ /** The source changed after `translatedAt`. */
691
+ 'stale' |
692
+ /** No `translatedAt` yet: nothing says which version of the source it matches. */
693
+ 'unsynced' |
694
+ /** `translationOf` names a document that does not exist. */
695
+ 'missing-source' |
696
+ /** `translatedAt` is not a commit this repository knows. */
697
+ 'unknown-revision' |
698
+ /** The workspace is not a git repository, so changes cannot be traced. */
699
+ 'no-git';
700
+ type TranslationStatus = {
701
+ id: string;
702
+ lang?: string;
703
+ /** The document this one is a translation of. */
704
+ of: string;
705
+ sourceLang?: string;
706
+ state: TranslationState;
707
+ translatedAt?: string;
708
+ /** Source files changed since `translatedAt`, committed or not, relative to the workspace. */
709
+ changedFiles: string[];
710
+ /** Commits to the source since `translatedAt`, newest first. */
711
+ commits: Array<{
712
+ short: string;
713
+ subject: string;
714
+ }>;
715
+ /** With `diff`: the source's changes since `translatedAt` as a unified diff. */
716
+ diff?: string;
717
+ /** True when the diff was cut at its size limit. */
718
+ diffTruncated?: boolean;
719
+ };
720
+ /**
721
+ * Every document that declares `meta.translationOf`, and whether its source
722
+ * moved on since the version it was translated from (`meta.translatedAt`, a
723
+ * commit). Pass `docId` for one translation, and `diff` for what changed.
724
+ */
725
+ declare function translationStatus(ctx: ApiContext, opts?: {
726
+ docId?: string;
727
+ diff?: boolean;
728
+ }): Promise<TranslationStatus[]>;
729
+ /**
730
+ * Records that a translation now matches its source as of `revision` — by
731
+ * default the last commit that touched the source. Refuses while the source
732
+ * has uncommitted changes, which no commit could name.
733
+ */
734
+ declare function markTranslated(ctx: ApiContext, docId: string, revision?: string): Promise<{
735
+ id: string;
736
+ of: string;
737
+ translatedAt: string;
738
+ }>;
739
+ //#endregion
740
+ export { type ApiContext, type AssetSummary, type ChangesResult, type CheckLayoutOptions, type DiffResult, type DocumentOutline, type DocumentSummary, EXPORT_FORMATS, type ExportFormat, type ExportResult, type ImportDocxOptions, type ImportMarkdownOptions, type ImportResult, type LayoutFinding, type LayoutReport, type Loc, ORIENTATIONS, OpsError, type Orientation, type OutlineBlock, type OutlineHeading, PAGE_SIZE_NAMES, type PageBudget, type PageChange, type PageSizeName, type PageStatus, type ProofreadFinding, type ProofreadReport, type Revision, type TemplateSummary, type ThemeSummary, type TranslationState, type TranslationStatus, 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 };
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 assertExpectedSource, B as readDocument, C as exportDocument, D as listRevisions, E as slugify, F as deleteDocument, H as resolveEntry, I as docDir, L as duplicateDocument, M as withFileLock, N as OpsError, O as readChanges, P as createDocument, R as listDocIds, S as closeRenderSession, T as importMarkdown, U as writeDocument, V as renameDocument, W as makeContext, _ 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 hashSource, k as revertChange, l as createFromTemplate, m as fileDocument, o as writeEdits, p as deleteAsset, s as writeText, u as listTemplates, v as listThemes, w as renderDocPage, x as checkLayout, y as readTheme, z as listDocuments } from "../session-Cx7Msl_F.js";
3
- import { a as searchDocument, i as readDocumentLines, n as outlineDocument, o as diffDocument, r as outlineSource, t as editDocument } from "../ops-CouYBa1O.js";
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, importMarkdown, listAssets, listDocIds, listDocuments, listFolders, listRevisions, listTemplates, listThemes, makeContext, outlineDocument, outlineSource, readChanges, readDocument, readDocumentLines, readText, readTheme, renameDocument, renderDocPage, resolveEntry, revertChange, searchDocument, slugify, suggestDocId, withFileLock, writeAsset, writeDocument, writeEdits, writeText, writeTexts };
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
+ 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 };