@open-document/core 0.11.0 → 0.13.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 (105) hide show
  1. package/dist/{build-BHFGY8eF.js → build-CbgIk6bA.js} +1 -1
  2. package/dist/{check-UEBmDfT_.js → check-BTroj-5Z.js} +3 -3
  3. package/dist/cli/bin.js +58 -34
  4. package/dist/config-BWtOZ1jc.d.ts +45 -0
  5. package/dist/{config-B_pdNbYg.js → config-DKKNIbvO.js} +1458 -983
  6. package/dist/{context-BM9_-u9P.js → context-DXNP8v9I.js} +3 -2
  7. package/dist/deploy-gcp-BUiSuqz7.js +758 -0
  8. package/dist/{dev-DX3QMIRi.js → dev-YXumw5iX.js} +1 -1
  9. package/dist/{diagram-BK4jTZr4.js → diagram-CKf3ptOE.js} +293 -13
  10. package/dist/{diff-DayvbXfX.js → diff-CTFfU4Tz.js} +2 -2
  11. package/dist/{export-BPsXj1i6.js → export-D2QLtF84.js} +11 -4
  12. package/dist/flow-CS5apebG.d.ts +252 -0
  13. package/dist/{import-71wlAsrd.js → import-CcmrFetU.js} +3 -2
  14. package/dist/index.d.ts +155 -59
  15. package/dist/index.js +945 -104
  16. package/dist/open-doc-plugin-DnX5usgI.js +320 -0
  17. package/dist/ops/index.d.ts +112 -3
  18. package/dist/ops/index.js +3 -3
  19. package/dist/{ops-BUo67DaP.js → ops-DmEecq1k.js} +86 -164
  20. package/dist/package-version-C89gtYSk.js +36 -0
  21. package/dist/{preview-D3m1-gUL.js → preview-_mHpBhMk.js} +1 -1
  22. package/dist/templates-MMblHwmT.js +34 -0
  23. package/dist/vite/index.d.ts +1 -1
  24. package/dist/vite/index.js +2 -1
  25. package/package.json +2 -1
  26. package/skills/apply-comments/SKILL.md +3 -1
  27. package/skills/create-doc/SKILL.md +2 -0
  28. package/skills/doc-authoring/SKILL.md +17 -16
  29. package/skills/doc-authoring/references/long-form.md +43 -2
  30. package/skills/doc-authoring/references/pagination.md +14 -2
  31. package/skills/doc-authoring/references/tables-and-charts.md +21 -17
  32. package/src/app/components/browser/browser-ui.tsx +21 -0
  33. package/src/app/components/browser/new-document-dialog.tsx +208 -0
  34. package/src/app/components/callout.tsx +101 -0
  35. package/src/app/components/changes/changes-overlay.tsx +68 -0
  36. package/src/app/components/changes/changes-panel.tsx +341 -0
  37. package/src/app/components/changes/use-changes.ts +85 -0
  38. package/src/app/components/chart.tsx +191 -33
  39. package/src/app/components/code-block.tsx +249 -0
  40. package/src/app/components/comments/comments-overlay.tsx +50 -0
  41. package/src/app/components/comments/comments-panel.tsx +272 -0
  42. package/src/app/components/comments/use-comments.ts +61 -0
  43. package/src/app/components/data-table.tsx +146 -18
  44. package/src/app/components/doc-sidebar.tsx +32 -2
  45. package/src/app/components/flow-page.tsx +57 -8
  46. package/src/app/components/inspector/field-source.tsx +41 -0
  47. package/src/app/components/inspector/inspector.tsx +64 -65
  48. package/src/app/components/numbering.tsx +226 -12
  49. package/src/app/components/overlay-frame.tsx +79 -0
  50. package/src/app/components/page-frame.tsx +46 -0
  51. package/src/app/components/page-placement.ts +68 -0
  52. package/src/app/components/record-picker.tsx +79 -0
  53. package/src/app/components/themes/theme-preview.tsx +5 -4
  54. package/src/app/lib/agent-bridge.ts +29 -1
  55. package/src/app/lib/chart.test.ts +15 -0
  56. package/src/app/lib/chart.ts +134 -9
  57. package/src/app/lib/diagnostics.ts +45 -1
  58. package/src/app/lib/docx/ooxml.test.ts +24 -1
  59. package/src/app/lib/docx/ooxml.ts +27 -1
  60. package/src/app/lib/export-docx.ts +3 -1
  61. package/src/app/lib/export-dom.ts +17 -3
  62. package/src/app/lib/export-html.ts +4 -2
  63. package/src/app/lib/export-image.ts +2 -1
  64. package/src/app/lib/export-pdf.ts +9 -1
  65. package/src/app/lib/flow-measure.test.ts +30 -0
  66. package/src/app/lib/flow-measure.ts +68 -14
  67. package/src/app/lib/flow.test.ts +20 -1
  68. package/src/app/lib/flow.ts +120 -20
  69. package/src/app/lib/i18n-ja/browser.ts +10 -0
  70. package/src/app/lib/i18n-ja/doc.ts +4 -0
  71. package/src/app/lib/i18n-ja/panels.ts +40 -0
  72. package/src/app/lib/i18n-ko/browser.ts +10 -0
  73. package/src/app/lib/i18n-ko/doc.ts +4 -0
  74. package/src/app/lib/i18n-ko/panels.ts +39 -0
  75. package/src/app/lib/i18n-zh-cn/browser.ts +10 -0
  76. package/src/app/lib/i18n-zh-cn/doc.ts +4 -0
  77. package/src/app/lib/i18n-zh-cn/panels.ts +38 -0
  78. package/src/app/lib/i18n-zh-tw/browser.ts +10 -0
  79. package/src/app/lib/i18n-zh-tw/doc.ts +4 -0
  80. package/src/app/lib/i18n-zh-tw/panels.ts +38 -0
  81. package/src/app/lib/labels.ts +29 -10
  82. package/src/app/lib/records.test.ts +38 -0
  83. package/src/app/lib/records.ts +127 -0
  84. package/src/app/lib/sdk.ts +35 -0
  85. package/src/app/lib/use-doc-module.ts +7 -0
  86. package/src/app/lib/use-doc-pages.ts +38 -17
  87. package/src/app/routes/doc.tsx +275 -13
  88. package/src/app/routes/home.tsx +30 -5
  89. package/src/app/styles.css +23 -0
  90. package/templates/blank/index.tsx +63 -0
  91. package/templates/blank/template.json +6 -0
  92. package/templates/certificate/data/recipients.csv +4 -0
  93. package/templates/certificate/index.tsx +128 -0
  94. package/templates/certificate/template.json +6 -0
  95. package/templates/letter/index.tsx +106 -0
  96. package/templates/letter/template.json +5 -0
  97. package/templates/meeting-notes/index.tsx +194 -0
  98. package/templates/meeting-notes/template.json +6 -0
  99. package/templates/proposal/index.tsx +264 -0
  100. package/templates/proposal/template.json +6 -0
  101. package/templates/report/data/metrics.csv +5 -0
  102. package/templates/report/index.tsx +224 -0
  103. package/templates/report/template.json +6 -0
  104. package/dist/config-P61niZMf.d.ts +0 -24
  105. package/dist/sdk-CpDEGRIo.d.ts +0 -138
@@ -1,4 +1,4 @@
1
- import { t as createViteConfig } from "./config-B_pdNbYg.js";
1
+ import { t as createViteConfig } from "./config-DKKNIbvO.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-DKKNIbvO.js";
2
+ import { n as closeRenderSession, t as checkLayout } from "./ops-DmEecq1k.js";
3
+ import { t as cliContext } from "./context-DXNP8v9I.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
- import { Command, Option } from "commander";
8
- import fs, { readFile } from "node:fs/promises";
8
+ import { Argument, Command, Option } from "commander";
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,
@@ -128,6 +107,16 @@ function parsePort(value) {
128
107
  if (!Number.isInteger(n) || n < 0 || n > 65535) throw new Error(`Invalid port: ${value}`);
129
108
  return n;
130
109
  }
110
+ const GCP_DEPLOY_ACTIONS = [
111
+ "up",
112
+ "check",
113
+ "status",
114
+ "pull",
115
+ "push",
116
+ "stop",
117
+ "start",
118
+ "down"
119
+ ];
131
120
  function resolveBuiltinSkillsDir() {
132
121
  const here = path.dirname(fileURLToPath(import.meta.url));
133
122
  return path.resolve(here, "..", "..", "skills");
@@ -165,37 +154,72 @@ async function run(argv) {
165
154
  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
155
  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
156
  if (flags.skillsCheck !== false) await runSkillsDriftCheck(resolveBuiltinSkillsDir());
168
- const { dev } = await import("../dev-DX3QMIRi.js");
157
+ const { dev } = await import("../dev-YXumw5iX.js");
169
158
  await dev(flags);
170
159
  });
171
160
  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");
161
+ const { build } = await import("../build-CbgIk6bA.js");
173
162
  await build(flags);
174
163
  });
175
164
  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");
165
+ const { preview } = await import("../preview-_mHpBhMk.js");
177
166
  await preview(flags);
178
167
  });
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");
168
+ 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) => {
169
+ const { exportDocs } = await import("../export-D2QLtF84.js");
181
170
  await exportDocs(docIds, flags);
182
171
  });
183
172
  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");
173
+ const { diffDoc } = await import("../diff-CTFfU4Tz.js");
185
174
  await diffDoc(docId, flags);
186
175
  });
187
176
  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");
177
+ const { checkDocs } = await import("../check-BTroj-5Z.js");
189
178
  await checkDocs(docIds, flags);
190
179
  });
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");
180
+ program.command("templates").description("List the templates a new document can start from").option("--json", "print them as JSON").action(async (flags) => {
181
+ const { printTemplates } = await import("../templates-MMblHwmT.js");
182
+ await printTemplates(flags);
183
+ });
184
+ 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) => {
185
+ const { newDoc } = await import("../templates-MMblHwmT.js");
186
+ await newDoc(docId, flags);
187
+ });
188
+ 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) => {
189
+ const { importDoc } = await import("../import-CcmrFetU.js");
193
190
  await importDoc(file, flags);
194
191
  });
195
192
  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
193
  const { syncSkills } = await Promise.resolve().then(() => sync_exports);
197
194
  await syncSkills(resolveBuiltinSkillsDir(), flags);
198
195
  });
196
+ 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) => {
197
+ const mod = await import("../deploy-gcp-BUiSuqz7.js");
198
+ switch (action) {
199
+ case "up":
200
+ await mod.runGcpUp(flags);
201
+ break;
202
+ case "check":
203
+ await mod.runGcpCheck(flags);
204
+ break;
205
+ case "status":
206
+ await mod.runGcpStatus(flags);
207
+ break;
208
+ case "pull":
209
+ await mod.runGcpPull(flags);
210
+ break;
211
+ case "push":
212
+ await mod.runGcpPush(flags);
213
+ break;
214
+ case "stop":
215
+ await mod.runGcpStop(flags);
216
+ break;
217
+ case "start":
218
+ await mod.runGcpStart(flags);
219
+ break;
220
+ case "down": await mod.runGcpDown(flags);
221
+ }
222
+ });
199
223
  await program.parseAsync(argv, { from: "user" });
200
224
  }
201
225
  //#endregion
@@ -206,4 +230,4 @@ run(process.argv.slice(2)).catch((err) => {
206
230
  process.exit(1);
207
231
  });
208
232
  //#endregion
209
- export { readCoreVersion as t };
233
+ export {};
@@ -0,0 +1,45 @@
1
+ //#region src/config.d.ts
2
+ type OpenDocBuildConfig = {
3
+ /** Ship the document browser (`/`) in the static build. Defaults to true. */
4
+ showDocBrowser?: boolean;
5
+ /** Offer the "Export HTML" button in the static build. Defaults to true. */
6
+ allowHtmlExport?: boolean;
7
+ };
8
+ type OpenDocGcpDeployConfig = {
9
+ /** Google Cloud project ID. Falls back to `--project` or `gcloud config`. */
10
+ project?: string;
11
+ /** Cloud Run and Cloud Storage region. Defaults to `asia-east1`. */
12
+ region?: string;
13
+ /** Cloud Run service name. Defaults to package name or directory name. */
14
+ service?: string;
15
+ /** Cloud Storage bucket name for persistent docs/assets/themes. */
16
+ bucket?: string;
17
+ /**
18
+ * `editable` runs `open-doc dev --mcp` backed by GCS FUSE so edits and
19
+ * Antigravity MCP calls persist. `static` builds a read-only bundle.
20
+ */
21
+ mode?: 'editable' | 'static';
22
+ /** Cloud Run container memory limit. Defaults to `1Gi`. */
23
+ memory?: string;
24
+ };
25
+ type OpenDocDeployConfig = {
26
+ gcp?: OpenDocGcpDeployConfig;
27
+ };
28
+ type OpenDocConfig = {
29
+ base?: string;
30
+ /**
31
+ * Where the viewer's back affordance goes. Unset it points at this app's own
32
+ * document browser; set it to escape the app entirely — a viewer mounted
33
+ * under a larger site needs to return to that site, not to its own index.
34
+ */
35
+ home?: string;
36
+ docsDir?: string;
37
+ themesDir?: string;
38
+ assetsDir?: string;
39
+ port?: number;
40
+ allowedHosts?: string[] | true;
41
+ build?: OpenDocBuildConfig;
42
+ deploy?: OpenDocDeployConfig;
43
+ };
44
+ //#endregion
45
+ export { OpenDocGcpDeployConfig as i, OpenDocConfig as n, OpenDocDeployConfig as r, OpenDocBuildConfig as t };