@open-document/core 0.10.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.
- package/dist/{build-DJMLK50m.js → build-DfUfpeTR.js} +1 -1
- package/dist/{check-CUKuufBm.js → check-CHxiOkQG.js} +3 -3
- package/dist/cli/bin.js +20 -33
- package/dist/{config-CvzpyAUA.js → config-9IdbhVuT.js} +2015 -725
- package/dist/{context-B4ip7SoI.js → context-BLI1-64_.js} +2 -2
- package/dist/{dev-dnH7DTlD.js → dev-yNYKv5mm.js} +1 -1
- package/dist/{diff-QTo0A5Rx.js → diff-Bs205mOx.js} +2 -2
- package/dist/{export-BrRFrexj.js → export-tkquS5O5.js} +11 -4
- package/dist/{import-C14Vn9ER.js → import-D1hIKIr3.js} +3 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +63 -28
- package/dist/ops/index.d.ts +111 -2
- package/dist/ops/index.js +3 -3
- package/dist/{ops-DKidjLXP.js → ops-Dgqujq5a.js} +85 -164
- package/dist/package-version-C89gtYSk.js +36 -0
- package/dist/{preview-wKM4C6Uk.js → preview-BImdTH6K.js} +1 -1
- package/dist/{sdk-CpDEGRIo.d.ts → sdk-CHEGeINh.d.ts} +46 -1
- package/dist/templates-DT5zzqHq.js +34 -0
- package/dist/vite/index.js +1 -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 +2 -0
- 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/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/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/doc-sidebar.tsx +32 -2
- package/src/app/components/inspector/field-source.tsx +41 -0
- package/src/app/components/inspector/format-section.tsx +434 -0
- package/src/app/components/inspector/inspector.tsx +311 -118
- package/src/app/components/inspector/use-style-edits.ts +210 -0
- package/src/app/components/overlay-frame.tsx +79 -0
- package/src/app/components/page-frame.tsx +4 -0
- package/src/app/components/page-placement.ts +68 -0
- package/src/app/components/panel/fields.tsx +95 -7
- 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/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 +2 -1
- package/src/app/lib/export-html.ts +4 -2
- package/src/app/lib/export-image.ts +2 -1
- package/src/app/lib/flow-measure.test.ts +30 -0
- package/src/app/lib/flow-measure.ts +35 -10
- 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 +92 -5
- 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 +90 -5
- 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 +88 -5
- 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 +88 -5
- package/src/app/lib/inspector/format.ts +156 -0
- package/src/app/lib/records.test.ts +38 -0
- package/src/app/lib/records.ts +127 -0
- package/src/app/lib/sdk.ts +29 -0
- package/src/app/lib/use-doc-module.ts +7 -0
- package/src/app/lib/use-doc-pages.ts +15 -9
- package/src/app/routes/doc.tsx +274 -11
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as readCoreVersion } from "./package-version-C89gtYSk.js";
|
|
2
|
+
import { F as loadUserConfig, N as makeContext } from "./config-9IdbhVuT.js";
|
|
3
3
|
//#region src/cli/context.ts
|
|
4
4
|
/** The same context the dev API and the MCP server run on, for commands that call `ops/`. */
|
|
5
5
|
async function cliContext(userCwd = process.cwd()) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as cliContext } from "./context-
|
|
1
|
+
import { s as diffDocument } from "./ops-Dgqujq5a.js";
|
|
2
|
+
import { t as cliContext } from "./context-BLI1-64_.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 {
|
|
3
|
-
import {
|
|
4
|
-
import { t as cliContext } from "./context-
|
|
2
|
+
import { D as listDocIds } from "./config-9IdbhVuT.js";
|
|
3
|
+
import { n as closeRenderSession, r as exportDocument } from "./ops-Dgqujq5a.js";
|
|
4
|
+
import { t as cliContext } from "./context-BLI1-64_.js";
|
|
5
5
|
import chalk from "chalk";
|
|
6
6
|
//#region src/cli/export.ts
|
|
7
7
|
const FORMATS = EXPORT_FORMATS;
|
|
@@ -20,8 +20,15 @@ async function exportDocs(docIds, opts = {}) {
|
|
|
20
20
|
for (const docId of targets) {
|
|
21
21
|
const result = await exportDocument(ctx, docId, {
|
|
22
22
|
format,
|
|
23
|
-
...opts.outDir !== void 0 ? { outDir: opts.outDir } : {}
|
|
23
|
+
...opts.outDir !== void 0 ? { outDir: opts.outDir } : {},
|
|
24
|
+
...opts.each ? { each: true } : {},
|
|
25
|
+
...opts.name !== void 0 ? { name: opts.name } : {}
|
|
24
26
|
});
|
|
27
|
+
if (result.records !== void 0) {
|
|
28
|
+
process.stdout.write(`${chalk.green("✓")} ${chalk.bold(docId)} ${chalk.dim(`${result.records} records, ${result.pageCount}p`)} → ${result.files.length} files\n`);
|
|
29
|
+
for (const file of result.files) process.stdout.write(chalk.dim(` ${file}\n`));
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
25
32
|
const files = result.files.join(", ");
|
|
26
33
|
process.stdout.write(`${chalk.green("✓")} ${chalk.bold(docId)} ${chalk.dim(`${result.pageCount}p`)} → ${files}\n`);
|
|
27
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as cliContext } from "./context-
|
|
1
|
+
import { a as importMarkdown } from "./ops-Dgqujq5a.js";
|
|
2
|
+
import { t as cliContext } from "./context-BLI1-64_.js";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
//#region src/cli/import.ts
|
|
@@ -11,6 +11,7 @@ async function importDoc(file, opts = {}) {
|
|
|
11
11
|
...opts.id !== void 0 ? { docId: opts.id } : {},
|
|
12
12
|
...opts.title !== void 0 ? { title: opts.title } : {},
|
|
13
13
|
...opts.subtitle !== void 0 ? { subtitle: opts.subtitle } : {},
|
|
14
|
+
...opts.lang !== void 0 ? { lang: opts.lang } : {},
|
|
14
15
|
...opts.author !== void 0 ? { author: opts.author } : {},
|
|
15
16
|
...opts.theme !== void 0 ? { theme: opts.theme } : {},
|
|
16
17
|
...opts.pageSize !== void 0 ? { pageSize: opts.pageSize } : {},
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as LabelEntry, C as DesignFonts, D as cssVarsToString, E as DesignTypeScale, M as LabelVocabulary, N as useDocLabel, O as defaultDesign, P as useDocLabels, S as useRecord, T as DesignSystem, _ as isPageSizeName, a as DocModule, b as Field, d as Orientation, f as PAGE_SIZES, g as isOrientation, h as PageSizeName, i as DocMeta, j as LabelKind, k as designToCssVars, l as FlowSection, m as PageGeometry, n as DEFAULT_PAGE_SIZE, o as DocPage, p as PAGE_SIZE_NAMES, r as DocEntry, t as DEFAULT_ORIENTATION, u as ORIENTATIONS, v as resolvePageGeometry, w as DesignPalette, x as FieldProps, y as DataRecord } from "./sdk-CHEGeINh.js";
|
|
2
2
|
import { n as OpenDocConfig, t as OpenDocBuildConfig } from "./config-P61niZMf.js";
|
|
3
3
|
import { CSSProperties, ComponentType, ReactNode } from "react";
|
|
4
4
|
//#region src/app/lib/chart.d.ts
|
|
@@ -393,4 +393,4 @@ type CompileOptions = LayoutOptions & RenderOptions;
|
|
|
393
393
|
/** Mermaid-flavoured text in, themed SVG out. One call, no browser. */
|
|
394
394
|
declare function compileDiagram(source: string, options?: CompileOptions): CompiledDiagram;
|
|
395
395
|
//#endregion
|
|
396
|
-
export { type BlockMetrics, type CellValue, Chart, type ChartFormat, type ChartProps, type ChartType, type CompileOptions, type CompiledDiagram, DEFAULT_ORIENTATION, DEFAULT_PAGE_SIZE, type DataAlign, type DataColumn, type DataFormat, DataTable, type DataTableProps, type DelimitedTable, type DesignFonts, type DesignPalette, type DesignSystem, type DesignTypeScale, Diagram, type DiagramProps, type DiagramSource, DiagramSyntaxError, type DocEntry, type DocMeta, type DocModule, type DocPage, Figure, type FigureProps, type FlowSection, Footnote, type FootnoteProps, Footnotes, type FootnotesProps, ImagePlaceholder, type ImagePlaceholderProps, type LabelEntry, type LabelKind, type LabelVocabulary, ListOf, ListOfFigures, type ListOfProps, ListOfTables, ORIENTATIONS, type OpenDocBuildConfig, type OpenDocConfig, type Orientation, type OutlineEntry, PAGE_SIZES, PAGE_SIZE_NAMES, type PageGeometry, type PageSizeName, type PaginationResult, Ref, type RefProps, TableOfContents, type TableOfContentsProps, compileDiagram, cssVarsToString, defaultDesign, designToCssVars, flow, isFlowSection, isOrientation, isPageSizeName, paginateBlocks, parseDelimited, resolvePageGeometry, useDocLabel, useDocLabels, useDocOutline, useDocPageCount, useDocPageNumber };
|
|
396
|
+
export { type BlockMetrics, type CellValue, Chart, type ChartFormat, type ChartProps, type ChartType, type CompileOptions, type CompiledDiagram, DEFAULT_ORIENTATION, DEFAULT_PAGE_SIZE, type DataAlign, type DataColumn, type DataFormat, type DataRecord, DataTable, type DataTableProps, type DelimitedTable, type DesignFonts, type DesignPalette, type DesignSystem, type DesignTypeScale, Diagram, type DiagramProps, type DiagramSource, 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, ListOf, ListOfFigures, type ListOfProps, ListOfTables, ORIENTATIONS, type OpenDocBuildConfig, type OpenDocConfig, type Orientation, type OutlineEntry, PAGE_SIZES, PAGE_SIZE_NAMES, type PageGeometry, type PageSizeName, type PaginationResult, Ref, type RefProps, TableOfContents, type TableOfContentsProps, compileDiagram, cssVarsToString, defaultDesign, designToCssVars, flow, isFlowSection, isOrientation, isPageSizeName, paginateBlocks, parseDelimited, resolvePageGeometry, useDocLabel, useDocLabels, useDocOutline, useDocPageCount, useDocPageNumber, useRecord };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as defaultDesign, i as cssVarsToString, n as DiagramSyntaxError, o as designToCssVars, r as parseDelimited, s as measureText, t as compileDiagram } from "./diagram-BK4jTZr4.js";
|
|
2
2
|
import { a as PAGE_SIZES, c as isPageSizeName, i as ORIENTATIONS, l as resolvePageGeometry, n as DEFAULT_PAGE_SIZE, o as PAGE_SIZE_NAMES, s as isOrientation, t as DEFAULT_ORIENTATION } from "./sdk-CqNZzbkz.js";
|
|
3
|
-
import { Children, Fragment, createContext, isValidElement, useContext, useEffect, useId, useRef, useSyncExternalStore } from "react";
|
|
3
|
+
import { Children, Fragment, createContext, createElement, isValidElement, useContext, useEffect, useId, useRef, useSyncExternalStore } from "react";
|
|
4
4
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
const LEGEND_GAP = 14;
|
|
6
6
|
/** A number read the way a CSV cell or a typed literal would hold it. */
|
|
@@ -267,19 +267,19 @@ function layoutChart(spec) {
|
|
|
267
267
|
}
|
|
268
268
|
//#endregion
|
|
269
269
|
//#region src/app/lib/outline.ts
|
|
270
|
-
const GLOBAL_KEY$
|
|
271
|
-
const g$
|
|
272
|
-
if (!g$
|
|
270
|
+
const GLOBAL_KEY$4 = "__open_doc_outline_store__";
|
|
271
|
+
const g$4 = globalThis;
|
|
272
|
+
if (!g$4[GLOBAL_KEY$4]) g$4[GLOBAL_KEY$4] = {
|
|
273
273
|
snapshot: [],
|
|
274
274
|
listeners: /* @__PURE__ */ new Set()
|
|
275
275
|
};
|
|
276
|
-
const store$
|
|
276
|
+
const store$2 = g$4[GLOBAL_KEY$4];
|
|
277
277
|
function getOutline() {
|
|
278
|
-
return store$
|
|
278
|
+
return store$2.snapshot;
|
|
279
279
|
}
|
|
280
|
-
function subscribe$
|
|
281
|
-
store$
|
|
282
|
-
return () => store$
|
|
280
|
+
function subscribe$2(listener) {
|
|
281
|
+
store$2.listeners.add(listener);
|
|
282
|
+
return () => store$2.listeners.delete(listener);
|
|
283
283
|
}
|
|
284
284
|
/**
|
|
285
285
|
* The document's headings, filled in after the pages render. Empty on the first
|
|
@@ -287,7 +287,7 @@ function subscribe$1(listener) {
|
|
|
287
287
|
* has run.
|
|
288
288
|
*/
|
|
289
289
|
function useDocOutline() {
|
|
290
|
-
return useSyncExternalStore(subscribe$
|
|
290
|
+
return useSyncExternalStore(subscribe$2, getOutline, getOutline);
|
|
291
291
|
}
|
|
292
292
|
//#endregion
|
|
293
293
|
//#region src/app/lib/labels.ts
|
|
@@ -303,22 +303,22 @@ const EMPTY = {
|
|
|
303
303
|
onPage: " (p. {page})"
|
|
304
304
|
}
|
|
305
305
|
};
|
|
306
|
-
const GLOBAL_KEY$
|
|
307
|
-
const g$
|
|
308
|
-
if (!g$
|
|
306
|
+
const GLOBAL_KEY$3 = "__open_doc_labels_store__";
|
|
307
|
+
const g$3 = globalThis;
|
|
308
|
+
if (!g$3[GLOBAL_KEY$3]) g$3[GLOBAL_KEY$3] = {
|
|
309
309
|
snapshot: EMPTY,
|
|
310
310
|
listeners: /* @__PURE__ */ new Set()
|
|
311
311
|
};
|
|
312
|
-
const store = g$
|
|
312
|
+
const store$1 = g$3[GLOBAL_KEY$3];
|
|
313
313
|
function getLabels() {
|
|
314
|
-
return store.snapshot;
|
|
314
|
+
return store$1.snapshot;
|
|
315
315
|
}
|
|
316
|
-
function subscribe(listener) {
|
|
317
|
-
store.listeners.add(listener);
|
|
318
|
-
return () => store.listeners.delete(listener);
|
|
316
|
+
function subscribe$1(listener) {
|
|
317
|
+
store$1.listeners.add(listener);
|
|
318
|
+
return () => store$1.listeners.delete(listener);
|
|
319
319
|
}
|
|
320
320
|
function useLabelSnapshot() {
|
|
321
|
-
return useSyncExternalStore(subscribe, getLabels, getLabels);
|
|
321
|
+
return useSyncExternalStore(subscribe$1, getLabels, getLabels);
|
|
322
322
|
}
|
|
323
323
|
/** The document's numbered items of one kind, in order. Empty on the first render pass. */
|
|
324
324
|
function useDocLabels(kind) {
|
|
@@ -357,10 +357,10 @@ function sourceAttrs(loc, prop) {
|
|
|
357
357
|
//#region src/app/components/footnote.tsx
|
|
358
358
|
/** Stands in for a number the scan has not produced yet, or never will. */
|
|
359
359
|
const UNNUMBERED = "•";
|
|
360
|
-
const GLOBAL_KEY$
|
|
361
|
-
const g$
|
|
362
|
-
if (!g$
|
|
363
|
-
const FootnoteContext = g$
|
|
360
|
+
const GLOBAL_KEY$2 = "__open_doc_footnote_context__";
|
|
361
|
+
const g$2 = globalThis;
|
|
362
|
+
if (!g$2[GLOBAL_KEY$2]) g$2[GLOBAL_KEY$2] = createContext(null);
|
|
363
|
+
const FootnoteContext = g$2[GLOBAL_KEY$2];
|
|
364
364
|
const FOOTNOTE_MARKER_FLAG = "__odFootnote";
|
|
365
365
|
function markerStyle() {
|
|
366
366
|
return {
|
|
@@ -477,10 +477,10 @@ function Footnotes({ notes, style, className }) {
|
|
|
477
477
|
}
|
|
478
478
|
//#endregion
|
|
479
479
|
//#region src/app/lib/page-context.tsx
|
|
480
|
-
const GLOBAL_KEY = "__open_doc_page_context__";
|
|
481
|
-
const g = globalThis;
|
|
482
|
-
if (!g[GLOBAL_KEY]) g[GLOBAL_KEY] = createContext(null);
|
|
483
|
-
const PageContext = g[GLOBAL_KEY];
|
|
480
|
+
const GLOBAL_KEY$1 = "__open_doc_page_context__";
|
|
481
|
+
const g$1 = globalThis;
|
|
482
|
+
if (!g$1[GLOBAL_KEY$1]) g$1[GLOBAL_KEY$1] = createContext(null);
|
|
483
|
+
const PageContext = g$1[GLOBAL_KEY$1];
|
|
484
484
|
/** 1-based page number of the page currently rendering. `0` outside a page. */
|
|
485
485
|
function useDocPageNumber() {
|
|
486
486
|
const ctx = useContext(PageContext);
|
|
@@ -1133,4 +1133,39 @@ function paginateBlocks(blocks, available, opts = {}) {
|
|
|
1133
1133
|
};
|
|
1134
1134
|
}
|
|
1135
1135
|
//#endregion
|
|
1136
|
-
|
|
1136
|
+
//#region src/app/lib/records.ts
|
|
1137
|
+
const GLOBAL_KEY = "__open_doc_record_store__";
|
|
1138
|
+
const g = globalThis;
|
|
1139
|
+
if (!g[GLOBAL_KEY]) g[GLOBAL_KEY] = {
|
|
1140
|
+
records: [],
|
|
1141
|
+
index: 0,
|
|
1142
|
+
listeners: /* @__PURE__ */ new Set()
|
|
1143
|
+
};
|
|
1144
|
+
const store = g[GLOBAL_KEY];
|
|
1145
|
+
function subscribe(listener) {
|
|
1146
|
+
store.listeners.add(listener);
|
|
1147
|
+
return () => store.listeners.delete(listener);
|
|
1148
|
+
}
|
|
1149
|
+
const getCurrent = () => store.records[store.index];
|
|
1150
|
+
/**
|
|
1151
|
+
* The row this copy of the document is printed for. A document that exports
|
|
1152
|
+
* `records` is laid out once per row; every page reads the same one. Outside a
|
|
1153
|
+
* document with records — a card in the document list — it is `undefined`.
|
|
1154
|
+
*/
|
|
1155
|
+
function useRecord() {
|
|
1156
|
+
return useSyncExternalStore(subscribe, getCurrent, getCurrent);
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* One value of the current row, as text. Where no row is set — a document
|
|
1160
|
+
* card, a theme preview — it prints the column's name in guillemets, so the
|
|
1161
|
+
* layout still shows what goes where.
|
|
1162
|
+
*/
|
|
1163
|
+
function Field({ name, fallback }) {
|
|
1164
|
+
const record = useRecord();
|
|
1165
|
+
if (!record) return createElement("span", { style: { opacity: .55 } }, `‹${name}›`);
|
|
1166
|
+
const value = record[name];
|
|
1167
|
+
if (value === null || value === void 0 || value === "") return fallback === void 0 ? null : createElement("span", null, fallback);
|
|
1168
|
+
return createElement("span", null, String(value));
|
|
1169
|
+
}
|
|
1170
|
+
//#endregion
|
|
1171
|
+
export { Chart, DEFAULT_ORIENTATION, DEFAULT_PAGE_SIZE, DataTable, Diagram, DiagramSyntaxError, Field, Figure, Footnote, Footnotes, ImagePlaceholder, ListOf, ListOfFigures, ListOfTables, ORIENTATIONS, PAGE_SIZES, PAGE_SIZE_NAMES, Ref, TableOfContents, compileDiagram, cssVarsToString, defaultDesign, designToCssVars, flow, isFlowSection, isOrientation, isPageSizeName, paginateBlocks, parseDelimited, resolvePageGeometry, useDocLabel, useDocLabels, useDocOutline, useDocPageCount, useDocPageNumber, useRecord };
|
package/dist/ops/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as ExportFormat, d as Orientation, h as PageSizeName, p as PAGE_SIZE_NAMES, s as EXPORT_FORMATS, u as ORIENTATIONS } from "../sdk-
|
|
1
|
+
import { c as ExportFormat, d as Orientation, h as PageSizeName, p as PAGE_SIZE_NAMES, s as EXPORT_FORMATS, u as ORIENTATIONS } from "../sdk-CHEGeINh.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import "vite";
|
|
4
4
|
//#region src/vite/routes/context.d.ts
|
|
@@ -25,6 +25,74 @@ type ApiPluginOptions = {
|
|
|
25
25
|
};
|
|
26
26
|
declare function makeContext(opts: ApiPluginOptions): ApiContext;
|
|
27
27
|
//#endregion
|
|
28
|
+
//#region src/ops/changes-diff.d.ts
|
|
29
|
+
/**
|
|
30
|
+
* How a change shows on the page: the element is new, rewritten, or something
|
|
31
|
+
* was taken out just before or after it.
|
|
32
|
+
*/
|
|
33
|
+
type ChangeMark = 'added' | 'changed' | 'removed-before' | 'removed-after';
|
|
34
|
+
type ChangeTarget = {
|
|
35
|
+
loc: string;
|
|
36
|
+
mark: ChangeMark;
|
|
37
|
+
};
|
|
38
|
+
type Hunk = {
|
|
39
|
+
/** Stable across edits elsewhere in the file, so a revert names the hunk the viewer saw. */
|
|
40
|
+
id: string;
|
|
41
|
+
oldStart: number;
|
|
42
|
+
oldLines: number;
|
|
43
|
+
newStart: number;
|
|
44
|
+
newLines: number;
|
|
45
|
+
removed: string[];
|
|
46
|
+
added: string[];
|
|
47
|
+
/** Elements on the page this hunk touches; empty when it is not drawn (meta, a style const). */
|
|
48
|
+
targets: ChangeTarget[];
|
|
49
|
+
};
|
|
50
|
+
type FileChange = {
|
|
51
|
+
/** Relative to the document's folder: `index.tsx`, `data/rows.csv`. */
|
|
52
|
+
path: string;
|
|
53
|
+
status: 'modified' | 'added' | 'deleted';
|
|
54
|
+
binary: boolean;
|
|
55
|
+
hunks: Hunk[];
|
|
56
|
+
};
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/ops/changes.d.ts
|
|
59
|
+
type Revision = {
|
|
60
|
+
commit: string;
|
|
61
|
+
short: string;
|
|
62
|
+
subject: string;
|
|
63
|
+
when: string;
|
|
64
|
+
};
|
|
65
|
+
type ChangesResult = {
|
|
66
|
+
available: false;
|
|
67
|
+
reason: 'no-git' | 'no-repo';
|
|
68
|
+
} | {
|
|
69
|
+
available: true;
|
|
70
|
+
since: string;
|
|
71
|
+
commit: string | null;
|
|
72
|
+
files: FileChange[];
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* What changed in one document's folder since a revision — the working tree
|
|
76
|
+
* against `since`, untracked files included — with each hunk of the document's
|
|
77
|
+
* own source placed on the elements it touches, so the viewer can mark them.
|
|
78
|
+
*/
|
|
79
|
+
declare function readChanges(ctx: ApiContext, docId: string, since?: string): Promise<ChangesResult>;
|
|
80
|
+
/** Recent commits that touched the document, newest first, for choosing what to compare against. */
|
|
81
|
+
declare function listRevisions(ctx: ApiContext, docId: string, limit?: number): Promise<Revision[]>;
|
|
82
|
+
/**
|
|
83
|
+
* Takes one hunk back out of the working tree. The hunk is found again by id
|
|
84
|
+
* in a fresh diff, never trusted from the request, and a source file must still
|
|
85
|
+
* parse afterwards — hunks can depend on each other, and a revert that leaves
|
|
86
|
+
* half a JSX tag behind is refused rather than written.
|
|
87
|
+
*/
|
|
88
|
+
declare function revertChange(ctx: ApiContext, docId: string, opts: {
|
|
89
|
+
since?: string;
|
|
90
|
+
file: string;
|
|
91
|
+
hunk: string;
|
|
92
|
+
}): Promise<{
|
|
93
|
+
ok: true;
|
|
94
|
+
}>;
|
|
95
|
+
//#endregion
|
|
28
96
|
//#region src/app/lib/diagnostics.d.ts
|
|
29
97
|
type LayoutRule = 'unresolved-ref' | 'page-overflow' | 'off-page' | 'blank-page' | 'oversized-block' | 'orphan-heading' | 'tiny-text' | 'broken-image';
|
|
30
98
|
type LayoutSeverity = 'error' | 'warn';
|
|
@@ -157,6 +225,8 @@ type ImportMarkdownOptions = {
|
|
|
157
225
|
theme?: string;
|
|
158
226
|
pageSize?: string;
|
|
159
227
|
orientation?: string;
|
|
228
|
+
/** BCP 47 tag; read from the front matter, else detected for Chinese, Japanese and Korean. */
|
|
229
|
+
lang?: string;
|
|
160
230
|
/** Open with a title page. Defaults to true. */
|
|
161
231
|
cover?: boolean;
|
|
162
232
|
/** Insert a self-filling contents page. Defaults to false. */
|
|
@@ -196,6 +266,8 @@ type ExportResult = {
|
|
|
196
266
|
pageCount: number;
|
|
197
267
|
/** Written paths, relative to the workspace root. */
|
|
198
268
|
files: string[];
|
|
269
|
+
/** With `each`: how many rows were written, one copy each. */
|
|
270
|
+
records?: number;
|
|
199
271
|
};
|
|
200
272
|
/** Closes the warm browser. Call before the process exits so nothing lingers. */
|
|
201
273
|
declare function closeRenderSession(): Promise<void>;
|
|
@@ -211,9 +283,16 @@ declare function renderDocPage(ctx: ApiContext, docId: string, page: number): Pr
|
|
|
211
283
|
mimeType: string;
|
|
212
284
|
base64: string;
|
|
213
285
|
}>;
|
|
286
|
+
/**
|
|
287
|
+
* Writes the document's files. With `each`, a document that exports
|
|
288
|
+
* `records` is laid out and written once per row — `name` (or
|
|
289
|
+
* `meta.recordName`) names each row's files.
|
|
290
|
+
*/
|
|
214
291
|
declare function exportDocument(ctx: ApiContext, docId: string, opts?: {
|
|
215
292
|
format?: ExportFormat;
|
|
216
293
|
outDir?: string;
|
|
294
|
+
each?: boolean;
|
|
295
|
+
name?: string;
|
|
217
296
|
}): Promise<ExportResult>;
|
|
218
297
|
//#endregion
|
|
219
298
|
//#region src/files/folders.d.ts
|
|
@@ -274,6 +353,36 @@ declare function createFolder(ctx: ApiContext, rawName: unknown, rawIcon?: unkno
|
|
|
274
353
|
/** Filing only edits assignments — a document id never moves on disk. */
|
|
275
354
|
declare function fileDocument(ctx: ApiContext, docId: string, folderId: string | null): Promise<void>;
|
|
276
355
|
//#endregion
|
|
356
|
+
//#region src/ops/templates.d.ts
|
|
357
|
+
type TemplateSummary = {
|
|
358
|
+
/** What `--template` takes. */
|
|
359
|
+
name: string;
|
|
360
|
+
title: string;
|
|
361
|
+
description: string;
|
|
362
|
+
category: string;
|
|
363
|
+
/** Shipped with open-doc, or written in this workspace's `templates/`. */
|
|
364
|
+
source: 'builtin' | 'workspace';
|
|
365
|
+
};
|
|
366
|
+
declare function listTemplates(ctx: ApiContext): Promise<TemplateSummary[]>;
|
|
367
|
+
/**
|
|
368
|
+
* A free id from a title, else the template's name — a title in Chinese has
|
|
369
|
+
* no letters to make one from: `quarterly-report`, then `quarterly-report-2`.
|
|
370
|
+
*/
|
|
371
|
+
declare function suggestDocId(bases: string[], taken: Set<string>): string;
|
|
372
|
+
/**
|
|
373
|
+
* A new document copied from a template: its folder as it is, minus the
|
|
374
|
+
* manifest, with the title it was given and today as its creation date — so
|
|
375
|
+
* it sorts as new, not as old as the template.
|
|
376
|
+
*/
|
|
377
|
+
declare function createFromTemplate(ctx: ApiContext, opts: {
|
|
378
|
+
template: string;
|
|
379
|
+
docId?: string;
|
|
380
|
+
title?: string;
|
|
381
|
+
}): Promise<{
|
|
382
|
+
id: string;
|
|
383
|
+
entry: string;
|
|
384
|
+
}>;
|
|
385
|
+
//#endregion
|
|
277
386
|
//#region src/editing/edit-ops.d.ts
|
|
278
387
|
type EditTarget = {
|
|
279
388
|
line: number;
|
|
@@ -345,4 +454,4 @@ declare function addComment(ctx: ApiContext, docId: string, loc: Loc, note: stri
|
|
|
345
454
|
id: string;
|
|
346
455
|
}>;
|
|
347
456
|
//#endregion
|
|
348
|
-
export { type ApiContext, type AssetSummary, type DiffResult, type DocumentSummary, EXPORT_FORMATS, type ExportFormat, type ExportResult, type ImportMarkdownOptions, type ImportResult, type LayoutFinding, type LayoutReport, type Loc, ORIENTATIONS, OpsError, type Orientation, PAGE_SIZE_NAMES, type PageChange, type PageSizeName, type PageStatus, type ThemeSummary, addComment, checkLayout, closeRenderSession, createDocument, createFolder, deleteAsset, deleteDocument, diffDocument, docDir, duplicateDocument, exportDocument, fileDocument, findAssetUsages, importMarkdown, listAssets, listDocIds, listDocuments, listFolders, listThemes, makeContext, readDocument, readText, readTheme, renameDocument, renderDocPage, resolveEntry, slugify, writeAsset, writeDocument, writeText, writeTexts };
|
|
457
|
+
export { type ApiContext, type AssetSummary, type ChangesResult, type DiffResult, type DocumentSummary, EXPORT_FORMATS, type ExportFormat, type ExportResult, type ImportMarkdownOptions, type ImportResult, type LayoutFinding, type LayoutReport, type Loc, ORIENTATIONS, OpsError, type Orientation, PAGE_SIZE_NAMES, type PageChange, type PageSizeName, type PageStatus, type Revision, type TemplateSummary, type ThemeSummary, addComment, checkLayout, closeRenderSession, createDocument, createFolder, createFromTemplate, deleteAsset, deleteDocument, diffDocument, docDir, duplicateDocument, exportDocument, fileDocument, findAssetUsages, importMarkdown, listAssets, listDocIds, listDocuments, listFolders, listRevisions, listTemplates, listThemes, makeContext, readChanges, readDocument, readText, readTheme, renameDocument, renderDocPage, resolveEntry, revertChange, slugify, suggestDocId, writeAsset, writeDocument, 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 {
|
|
3
|
-
import { a as
|
|
4
|
-
export { EXPORT_FORMATS, ORIENTATIONS, OpsError, PAGE_SIZE_NAMES, addComment, checkLayout, closeRenderSession, createDocument, createFolder, deleteAsset, deleteDocument, diffDocument, docDir, duplicateDocument, exportDocument, fileDocument, findAssetUsages, importMarkdown, listAssets, listDocIds, listDocuments, listFolders, listThemes, makeContext, readDocument, readText, readTheme, renameDocument, renderDocPage, resolveEntry, slugify, writeAsset, writeDocument, writeText, writeTexts };
|
|
2
|
+
import { A as renameDocument, C as createDocument, D as listDocIds, E as duplicateDocument, M as writeDocument, N as makeContext, O as listDocuments, S as OpsError, T as docDir, _ as writeAsset, a as writeTexts, b as readChanges, c as suggestDocId, d as fileDocument, f as findAssetUsages, g as readTheme, h as listThemes, i as writeText, j as resolveEntry, k as readDocument, l as createFolder, m as listFolders, n as addComment, o as createFromTemplate, p as listAssets, r as readText, s as listTemplates, u as deleteAsset, w as deleteDocument, x as revertChange, y as listRevisions } from "../config-9IdbhVuT.js";
|
|
3
|
+
import { a as importMarkdown, i as renderDocPage, n as closeRenderSession, o as slugify, r as exportDocument, s as diffDocument, t as checkLayout } from "../ops-Dgqujq5a.js";
|
|
4
|
+
export { EXPORT_FORMATS, ORIENTATIONS, OpsError, PAGE_SIZE_NAMES, addComment, checkLayout, closeRenderSession, createDocument, createFolder, createFromTemplate, deleteAsset, deleteDocument, diffDocument, docDir, duplicateDocument, exportDocument, fileDocument, findAssetUsages, importMarkdown, listAssets, listDocIds, listDocuments, listFolders, listRevisions, listTemplates, listThemes, makeContext, readChanges, readDocument, readText, readTheme, renameDocument, renderDocPage, resolveEntry, revertChange, slugify, suggestDocId, writeAsset, writeDocument, writeText, writeTexts };
|