@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.
- package/dist/{build-BHFGY8eF.js → build-CbgIk6bA.js} +1 -1
- package/dist/{check-UEBmDfT_.js → check-BTroj-5Z.js} +3 -3
- package/dist/cli/bin.js +58 -34
- package/dist/config-BWtOZ1jc.d.ts +45 -0
- package/dist/{config-B_pdNbYg.js → config-DKKNIbvO.js} +1458 -983
- package/dist/{context-BM9_-u9P.js → context-DXNP8v9I.js} +3 -2
- package/dist/deploy-gcp-BUiSuqz7.js +758 -0
- package/dist/{dev-DX3QMIRi.js → dev-YXumw5iX.js} +1 -1
- package/dist/{diagram-BK4jTZr4.js → diagram-CKf3ptOE.js} +293 -13
- package/dist/{diff-DayvbXfX.js → diff-CTFfU4Tz.js} +2 -2
- package/dist/{export-BPsXj1i6.js → export-D2QLtF84.js} +11 -4
- package/dist/flow-CS5apebG.d.ts +252 -0
- package/dist/{import-71wlAsrd.js → import-CcmrFetU.js} +3 -2
- package/dist/index.d.ts +155 -59
- package/dist/index.js +945 -104
- package/dist/open-doc-plugin-DnX5usgI.js +320 -0
- package/dist/ops/index.d.ts +112 -3
- package/dist/ops/index.js +3 -3
- package/dist/{ops-BUo67DaP.js → ops-DmEecq1k.js} +86 -164
- package/dist/package-version-C89gtYSk.js +36 -0
- package/dist/{preview-D3m1-gUL.js → preview-_mHpBhMk.js} +1 -1
- package/dist/templates-MMblHwmT.js +34 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +2 -1
- package/package.json +2 -1
- package/skills/apply-comments/SKILL.md +3 -1
- package/skills/create-doc/SKILL.md +2 -0
- package/skills/doc-authoring/SKILL.md +17 -16
- package/skills/doc-authoring/references/long-form.md +43 -2
- package/skills/doc-authoring/references/pagination.md +14 -2
- package/skills/doc-authoring/references/tables-and-charts.md +21 -17
- package/src/app/components/browser/browser-ui.tsx +21 -0
- package/src/app/components/browser/new-document-dialog.tsx +208 -0
- package/src/app/components/callout.tsx +101 -0
- package/src/app/components/changes/changes-overlay.tsx +68 -0
- package/src/app/components/changes/changes-panel.tsx +341 -0
- package/src/app/components/changes/use-changes.ts +85 -0
- package/src/app/components/chart.tsx +191 -33
- package/src/app/components/code-block.tsx +249 -0
- package/src/app/components/comments/comments-overlay.tsx +50 -0
- package/src/app/components/comments/comments-panel.tsx +272 -0
- package/src/app/components/comments/use-comments.ts +61 -0
- package/src/app/components/data-table.tsx +146 -18
- package/src/app/components/doc-sidebar.tsx +32 -2
- package/src/app/components/flow-page.tsx +57 -8
- package/src/app/components/inspector/field-source.tsx +41 -0
- package/src/app/components/inspector/inspector.tsx +64 -65
- package/src/app/components/numbering.tsx +226 -12
- package/src/app/components/overlay-frame.tsx +79 -0
- package/src/app/components/page-frame.tsx +46 -0
- package/src/app/components/page-placement.ts +68 -0
- package/src/app/components/record-picker.tsx +79 -0
- package/src/app/components/themes/theme-preview.tsx +5 -4
- package/src/app/lib/agent-bridge.ts +29 -1
- package/src/app/lib/chart.test.ts +15 -0
- package/src/app/lib/chart.ts +134 -9
- package/src/app/lib/diagnostics.ts +45 -1
- package/src/app/lib/docx/ooxml.test.ts +24 -1
- package/src/app/lib/docx/ooxml.ts +27 -1
- package/src/app/lib/export-docx.ts +3 -1
- package/src/app/lib/export-dom.ts +17 -3
- package/src/app/lib/export-html.ts +4 -2
- package/src/app/lib/export-image.ts +2 -1
- package/src/app/lib/export-pdf.ts +9 -1
- package/src/app/lib/flow-measure.test.ts +30 -0
- package/src/app/lib/flow-measure.ts +68 -14
- package/src/app/lib/flow.test.ts +20 -1
- package/src/app/lib/flow.ts +120 -20
- package/src/app/lib/i18n-ja/browser.ts +10 -0
- package/src/app/lib/i18n-ja/doc.ts +4 -0
- package/src/app/lib/i18n-ja/panels.ts +40 -0
- package/src/app/lib/i18n-ko/browser.ts +10 -0
- package/src/app/lib/i18n-ko/doc.ts +4 -0
- package/src/app/lib/i18n-ko/panels.ts +39 -0
- package/src/app/lib/i18n-zh-cn/browser.ts +10 -0
- package/src/app/lib/i18n-zh-cn/doc.ts +4 -0
- package/src/app/lib/i18n-zh-cn/panels.ts +38 -0
- package/src/app/lib/i18n-zh-tw/browser.ts +10 -0
- package/src/app/lib/i18n-zh-tw/doc.ts +4 -0
- package/src/app/lib/i18n-zh-tw/panels.ts +38 -0
- package/src/app/lib/labels.ts +29 -10
- package/src/app/lib/records.test.ts +38 -0
- package/src/app/lib/records.ts +127 -0
- package/src/app/lib/sdk.ts +35 -0
- package/src/app/lib/use-doc-module.ts +7 -0
- package/src/app/lib/use-doc-pages.ts +38 -17
- package/src/app/routes/doc.tsx +275 -13
- package/src/app/routes/home.tsx +30 -5
- package/src/app/styles.css +23 -0
- package/templates/blank/index.tsx +63 -0
- package/templates/blank/template.json +6 -0
- package/templates/certificate/data/recipients.csv +4 -0
- package/templates/certificate/index.tsx +128 -0
- package/templates/certificate/template.json +6 -0
- package/templates/letter/index.tsx +106 -0
- package/templates/letter/template.json +5 -0
- package/templates/meeting-notes/index.tsx +194 -0
- package/templates/meeting-notes/template.json +6 -0
- package/templates/proposal/index.tsx +264 -0
- package/templates/proposal/template.json +6 -0
- package/templates/report/data/metrics.csv +5 -0
- package/templates/report/index.tsx +224 -0
- package/templates/report/template.json +6 -0
- package/dist/config-P61niZMf.d.ts +0 -24
- package/dist/sdk-CpDEGRIo.d.ts +0 -138
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as cliContext } from "./context-
|
|
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
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
177
|
+
const { checkDocs } = await import("../check-BTroj-5Z.js");
|
|
189
178
|
await checkDocs(docIds, flags);
|
|
190
179
|
});
|
|
191
|
-
program.command("
|
|
192
|
-
const {
|
|
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 {
|
|
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 };
|