@open-document/core 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/{build-BHFGY8eF.js → build-DfUfpeTR.js} +1 -1
  2. package/dist/{check-UEBmDfT_.js → check-CHxiOkQG.js} +3 -3
  3. package/dist/cli/bin.js +20 -33
  4. package/dist/{config-B_pdNbYg.js → config-9IdbhVuT.js} +1402 -675
  5. package/dist/{context-BM9_-u9P.js → context-BLI1-64_.js} +2 -2
  6. package/dist/{dev-DX3QMIRi.js → dev-yNYKv5mm.js} +1 -1
  7. package/dist/{diff-DayvbXfX.js → diff-Bs205mOx.js} +2 -2
  8. package/dist/{export-BPsXj1i6.js → export-tkquS5O5.js} +11 -4
  9. package/dist/{import-71wlAsrd.js → import-D1hIKIr3.js} +3 -2
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.js +63 -28
  12. package/dist/ops/index.d.ts +111 -2
  13. package/dist/ops/index.js +3 -3
  14. package/dist/{ops-BUo67DaP.js → ops-Dgqujq5a.js} +85 -164
  15. package/dist/package-version-C89gtYSk.js +36 -0
  16. package/dist/{preview-D3m1-gUL.js → preview-BImdTH6K.js} +1 -1
  17. package/dist/{sdk-CpDEGRIo.d.ts → sdk-CHEGeINh.d.ts} +46 -1
  18. package/dist/templates-DT5zzqHq.js +34 -0
  19. package/dist/vite/index.js +1 -1
  20. package/package.json +2 -1
  21. package/skills/apply-comments/SKILL.md +3 -1
  22. package/skills/create-doc/SKILL.md +2 -0
  23. package/skills/doc-authoring/SKILL.md +2 -0
  24. package/src/app/components/browser/browser-ui.tsx +21 -0
  25. package/src/app/components/browser/new-document-dialog.tsx +208 -0
  26. package/src/app/components/changes/changes-overlay.tsx +68 -0
  27. package/src/app/components/changes/changes-panel.tsx +341 -0
  28. package/src/app/components/changes/use-changes.ts +85 -0
  29. package/src/app/components/comments/comments-overlay.tsx +50 -0
  30. package/src/app/components/comments/comments-panel.tsx +272 -0
  31. package/src/app/components/comments/use-comments.ts +61 -0
  32. package/src/app/components/doc-sidebar.tsx +32 -2
  33. package/src/app/components/inspector/field-source.tsx +41 -0
  34. package/src/app/components/inspector/inspector.tsx +64 -65
  35. package/src/app/components/overlay-frame.tsx +79 -0
  36. package/src/app/components/page-frame.tsx +4 -0
  37. package/src/app/components/page-placement.ts +68 -0
  38. package/src/app/components/record-picker.tsx +79 -0
  39. package/src/app/components/themes/theme-preview.tsx +5 -4
  40. package/src/app/lib/agent-bridge.ts +29 -1
  41. package/src/app/lib/docx/ooxml.test.ts +24 -1
  42. package/src/app/lib/docx/ooxml.ts +27 -1
  43. package/src/app/lib/export-docx.ts +3 -1
  44. package/src/app/lib/export-dom.ts +2 -1
  45. package/src/app/lib/export-html.ts +4 -2
  46. package/src/app/lib/export-image.ts +2 -1
  47. package/src/app/lib/flow-measure.test.ts +30 -0
  48. package/src/app/lib/flow-measure.ts +35 -10
  49. package/src/app/lib/i18n-ja/browser.ts +10 -0
  50. package/src/app/lib/i18n-ja/doc.ts +4 -0
  51. package/src/app/lib/i18n-ja/panels.ts +40 -0
  52. package/src/app/lib/i18n-ko/browser.ts +10 -0
  53. package/src/app/lib/i18n-ko/doc.ts +4 -0
  54. package/src/app/lib/i18n-ko/panels.ts +39 -0
  55. package/src/app/lib/i18n-zh-cn/browser.ts +10 -0
  56. package/src/app/lib/i18n-zh-cn/doc.ts +4 -0
  57. package/src/app/lib/i18n-zh-cn/panels.ts +38 -0
  58. package/src/app/lib/i18n-zh-tw/browser.ts +10 -0
  59. package/src/app/lib/i18n-zh-tw/doc.ts +4 -0
  60. package/src/app/lib/i18n-zh-tw/panels.ts +38 -0
  61. package/src/app/lib/records.test.ts +38 -0
  62. package/src/app/lib/records.ts +127 -0
  63. package/src/app/lib/sdk.ts +29 -0
  64. package/src/app/lib/use-doc-module.ts +7 -0
  65. package/src/app/lib/use-doc-pages.ts +15 -9
  66. package/src/app/routes/doc.tsx +274 -13
  67. package/src/app/routes/home.tsx +30 -5
  68. package/src/app/styles.css +23 -0
  69. package/templates/blank/index.tsx +63 -0
  70. package/templates/blank/template.json +6 -0
  71. package/templates/certificate/data/recipients.csv +4 -0
  72. package/templates/certificate/index.tsx +128 -0
  73. package/templates/certificate/template.json +6 -0
  74. package/templates/letter/index.tsx +106 -0
  75. package/templates/letter/template.json +5 -0
  76. package/templates/meeting-notes/index.tsx +194 -0
  77. package/templates/meeting-notes/template.json +6 -0
  78. package/templates/proposal/index.tsx +264 -0
  79. package/templates/proposal/template.json +6 -0
  80. package/templates/report/data/metrics.csv +5 -0
  81. package/templates/report/index.tsx +224 -0
  82. package/templates/report/template.json +6 -0
@@ -1,4 +1,4 @@
1
- import { t as createViteConfig } from "./config-B_pdNbYg.js";
1
+ import { t as createViteConfig } from "./config-9IdbhVuT.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 { f as listDocIds } from "./config-B_pdNbYg.js";
2
- import { d as closeRenderSession, u as checkLayout } from "./ops-BUo67DaP.js";
3
- import { t as cliContext } from "./context-BM9_-u9P.js";
1
+ import { D as listDocIds } from "./config-9IdbhVuT.js";
2
+ import { n as closeRenderSession, t as checkLayout } from "./ops-Dgqujq5a.js";
3
+ import { t as cliContext } from "./context-BLI1-64_.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
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { i as ORIENTATIONS, o as PAGE_SIZE_NAMES, r as EXPORT_FORMATS } from "../sdk-CqNZzbkz.js";
3
+ import { n as readCoreVersion } from "../package-version-C89gtYSk.js";
3
4
  import chalk from "chalk";
4
5
  import path from "node:path";
5
6
  import * as readline from "node:readline/promises";
6
7
  import { fileURLToPath } from "node:url";
7
8
  import { Command, Option } from "commander";
8
- import fs, { readFile } from "node:fs/promises";
9
+ import fs from "node:fs/promises";
9
10
  import { existsSync } from "node:fs";
10
11
  //#region \0rolldown/runtime.js
11
12
  var __defProp = Object.defineProperty;
@@ -19,28 +20,6 @@ var __exportAll = (all, no_symbols) => {
19
20
  return target;
20
21
  };
21
22
  //#endregion
22
- //#region src/cli/package-version.ts
23
- const PACKAGE_NAME = "@open-document/core";
24
- /**
25
- * Walks up for this package's own `package.json` instead of assuming a fixed
26
- * depth: the bundler decides which chunk a module lands in, so `../../` is
27
- * right from `dist/cli/` and wrong from `dist/`. Getting that wrong is silent —
28
- * it reports `0.0.0` rather than failing.
29
- */
30
- async function readCoreVersion() {
31
- let dir = path.dirname(fileURLToPath(import.meta.url));
32
- for (let up = 0; up < 6; up += 1) {
33
- try {
34
- const pkg = JSON.parse(await readFile(path.join(dir, "package.json"), "utf8"));
35
- if (pkg.name === PACKAGE_NAME && pkg.version !== void 0) return pkg.version;
36
- } catch {}
37
- const parent = path.dirname(dir);
38
- if (parent === dir) break;
39
- dir = parent;
40
- }
41
- return "0.0.0";
42
- }
43
- //#endregion
44
23
  //#region src/cli/sync.ts
45
24
  var sync_exports = /* @__PURE__ */ __exportAll({
46
25
  detectSkillsDrift: () => detectSkillsDrift,
@@ -165,31 +144,39 @@ async function run(argv) {
165
144
  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)"));
166
145
  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) => {
167
146
  if (flags.skillsCheck !== false) await runSkillsDriftCheck(resolveBuiltinSkillsDir());
168
- const { dev } = await import("../dev-DX3QMIRi.js");
147
+ const { dev } = await import("../dev-yNYKv5mm.js");
169
148
  await dev(flags);
170
149
  });
171
150
  program.command("build").description("Build a static site").option("--out-dir <dir>", "output directory (defaults to `dist`)").action(async (flags) => {
172
- const { build } = await import("../build-BHFGY8eF.js");
151
+ const { build } = await import("../build-DfUfpeTR.js");
173
152
  await build(flags);
174
153
  });
175
154
  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) => {
176
- const { preview } = await import("../preview-D3m1-gUL.js");
155
+ const { preview } = await import("../preview-BImdTH6K.js");
177
156
  await preview(flags);
178
157
  });
179
- 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/").action(async (docIds, flags) => {
180
- const { exportDocs } = await import("../export-BPsXj1i6.js");
158
+ 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) => {
159
+ const { exportDocs } = await import("../export-tkquS5O5.js");
181
160
  await exportDocs(docIds, flags);
182
161
  });
183
162
  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) => {
184
- const { diffDoc } = await import("../diff-DayvbXfX.js");
163
+ const { diffDoc } = await import("../diff-Bs205mOx.js");
185
164
  await diffDoc(docId, flags);
186
165
  });
187
166
  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) => {
188
- const { checkDocs } = await import("../check-UEBmDfT_.js");
167
+ const { checkDocs } = await import("../check-CHxiOkQG.js");
189
168
  await checkDocs(docIds, flags);
190
169
  });
191
- 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("--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) => {
192
- const { importDoc } = await import("../import-71wlAsrd.js");
170
+ program.command("templates").description("List the templates a new document can start from").option("--json", "print them as JSON").action(async (flags) => {
171
+ const { printTemplates } = await import("../templates-DT5zzqHq.js");
172
+ await printTemplates(flags);
173
+ });
174
+ 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) => {
175
+ const { newDoc } = await import("../templates-DT5zzqHq.js");
176
+ await newDoc(docId, flags);
177
+ });
178
+ 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) => {
179
+ const { importDoc } = await import("../import-D1hIKIr3.js");
193
180
  await importDoc(file, flags);
194
181
  });
195
182
  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) => {
@@ -206,4 +193,4 @@ run(process.argv.slice(2)).catch((err) => {
206
193
  process.exit(1);
207
194
  });
208
195
  //#endregion
209
- export { readCoreVersion as t };
196
+ export {};