@open-document/core 0.9.1 → 0.11.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-B0GJXy8I.js → build-BHFGY8eF.js} +1 -1
- package/dist/{check-CuDIWsPT.js → check-UEBmDfT_.js} +3 -3
- package/dist/cli/bin.js +10 -6
- package/dist/{config-CAZ7Z_va.js → config-B_pdNbYg.js} +1166 -591
- package/dist/{context-PWAh9qbf.js → context-BM9_-u9P.js} +1 -1
- package/dist/{dev-CYqppXDI.js → dev-DX3QMIRi.js} +1 -1
- package/dist/{diagram-CCaUUnRe.js → diagram-BK4jTZr4.js} +146 -146
- package/dist/diff-DayvbXfX.js +44 -0
- package/dist/{export-1JtO2OMC.js → export-BPsXj1i6.js} +3 -3
- package/dist/{import-CsrdBOZ8.js → import-71wlAsrd.js} +2 -2
- package/dist/index.d.ts +53 -2
- package/dist/index.js +457 -18
- package/dist/ops/index.d.ts +72 -17
- package/dist/ops/index.js +3 -3
- package/dist/{ops-B2y9BMpk.js → ops-BUo67DaP.js} +642 -124
- package/dist/{preview-DW3PM-JV.js → preview-D3m1-gUL.js} +1 -1
- package/dist/{sdk-BqU6mwD_.d.ts → sdk-CpDEGRIo.d.ts} +2 -0
- package/dist/vite/index.js +1 -1
- package/package.json +2 -2
- package/skills/doc-authoring/SKILL.md +9 -4
- package/skills/doc-authoring/references/pagination.md +1 -1
- package/skills/doc-authoring/references/tables-and-charts.md +18 -1
- package/src/app/components/browser/browser-ui.tsx +105 -0
- package/src/app/components/chart.tsx +239 -0
- package/src/app/components/command-palette.tsx +284 -0
- package/src/app/components/design-panel/design-panel.tsx +22 -20
- package/src/app/components/design-panel/design-provider.tsx +4 -2
- package/src/app/components/diagram.tsx +11 -1
- package/src/app/components/doc-assets.tsx +6 -5
- package/src/app/components/doc-search.tsx +12 -10
- package/src/app/components/doc-sidebar.tsx +24 -18
- package/src/app/components/flow-page.tsx +2 -0
- package/src/app/components/inspector/format-section.tsx +434 -0
- package/src/app/components/inspector/inspector.tsx +310 -89
- package/src/app/components/inspector/use-style-edits.ts +210 -0
- package/src/app/components/language-toggle.tsx +38 -0
- package/src/app/components/palette-items.ts +128 -0
- package/src/app/components/panel/edit-save-card.tsx +4 -2
- package/src/app/components/panel/fields.tsx +100 -9
- package/src/app/components/panel/save-card.tsx +18 -10
- package/src/app/components/sidebar/folder-item.tsx +10 -8
- package/src/app/components/sidebar/icon-picker.tsx +3 -1
- package/src/app/components/sidebar/sidebar.tsx +44 -13
- package/src/app/components/theme-toggle.tsx +5 -3
- package/src/app/components/ui/menu.tsx +5 -0
- package/src/app/lib/agent-bridge.ts +8 -2
- package/src/app/lib/chart.test.ts +108 -0
- package/src/app/lib/chart.ts +343 -0
- package/src/app/lib/doc-preview.tsx +0 -10
- package/src/app/lib/docs.ts +3 -0
- package/src/app/lib/docx/from-dom.ts +11 -11
- package/src/app/lib/docx/ooxml.test.ts +25 -9
- package/src/app/lib/docx/ooxml.ts +58 -37
- package/src/app/lib/export-docx.ts +13 -8
- package/src/app/lib/flow.ts +1 -1
- package/src/app/lib/i18n-ja/browser.ts +88 -0
- package/src/app/lib/i18n-ja/doc.ts +65 -0
- package/src/app/lib/i18n-ja/index.ts +5 -0
- package/src/app/lib/i18n-ja/panels.ts +151 -0
- package/src/app/lib/i18n-ko/browser.ts +87 -0
- package/src/app/lib/i18n-ko/doc.ts +65 -0
- package/src/app/lib/i18n-ko/index.ts +5 -0
- package/src/app/lib/i18n-ko/panels.ts +148 -0
- package/src/app/lib/i18n-zh-cn/browser.ts +84 -0
- package/src/app/lib/i18n-zh-cn/doc.ts +64 -0
- package/src/app/lib/i18n-zh-cn/index.ts +5 -0
- package/src/app/lib/i18n-zh-cn/panels.ts +143 -0
- package/src/app/lib/i18n-zh-tw/browser.ts +84 -0
- package/src/app/lib/i18n-zh-tw/doc.ts +64 -0
- package/src/app/lib/i18n-zh-tw/index.ts +5 -0
- package/src/app/lib/i18n-zh-tw/panels.ts +144 -0
- package/src/app/lib/i18n.test.ts +24 -0
- package/src/app/lib/i18n.tsx +109 -0
- package/src/app/lib/inspector/format.ts +156 -0
- package/src/app/lib/outline.ts +23 -0
- package/src/app/lib/page-range.test.ts +10 -1
- package/src/app/lib/page-range.ts +26 -0
- package/src/app/lib/sdk.ts +2 -0
- package/src/app/main.tsx +4 -1
- package/src/app/routes/assets.tsx +193 -132
- package/src/app/routes/doc.tsx +668 -310
- package/src/app/routes/home-shell.tsx +115 -88
- package/src/app/routes/home.tsx +200 -67
- package/src/app/routes/themes.tsx +42 -35
- package/src/app/styles.css +84 -5
- package/src/app/virtual.d.ts +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as readCoreVersion } from "./cli/bin.js";
|
|
2
|
-
import { A as loadUserConfig, O as makeContext } from "./config-
|
|
2
|
+
import { A as loadUserConfig, O as makeContext } from "./config-B_pdNbYg.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,147 +1,3 @@
|
|
|
1
|
-
//#region src/app/lib/design.ts
|
|
2
|
-
function designToCssVars(d) {
|
|
3
|
-
return {
|
|
4
|
-
"--od-bg": d.palette.bg,
|
|
5
|
-
"--od-text": d.palette.text,
|
|
6
|
-
"--od-muted": d.palette.muted,
|
|
7
|
-
"--od-accent": d.palette.accent,
|
|
8
|
-
"--od-rule": d.palette.rule,
|
|
9
|
-
"--od-font-heading": d.fonts.heading,
|
|
10
|
-
"--od-font-body": d.fonts.body,
|
|
11
|
-
"--od-font-mono": d.fonts.mono,
|
|
12
|
-
"--od-size-title": `${d.typeScale.title}px`,
|
|
13
|
-
"--od-size-h1": `${d.typeScale.h1}px`,
|
|
14
|
-
"--od-size-h2": `${d.typeScale.h2}px`,
|
|
15
|
-
"--od-size-h3": `${d.typeScale.h3}px`,
|
|
16
|
-
"--od-size-body": `${d.typeScale.body}px`,
|
|
17
|
-
"--od-size-caption": `${d.typeScale.caption}px`,
|
|
18
|
-
"--od-margin": `${d.margin}px`,
|
|
19
|
-
"--od-leading": String(d.leading),
|
|
20
|
-
"--od-radius": `${d.radius}px`
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function cssVarsToString(vars) {
|
|
24
|
-
return Object.entries(vars).map(([k, v]) => ` ${k}: ${v};`).join("\n");
|
|
25
|
-
}
|
|
26
|
-
const defaultDesign = {
|
|
27
|
-
palette: {
|
|
28
|
-
bg: "#ffffff",
|
|
29
|
-
text: "#16181d",
|
|
30
|
-
muted: "#6b7280",
|
|
31
|
-
accent: "#2563eb",
|
|
32
|
-
rule: "#e5e7eb"
|
|
33
|
-
},
|
|
34
|
-
fonts: {
|
|
35
|
-
heading: "-apple-system, BlinkMacSystemFont, \"Inter\", system-ui, sans-serif",
|
|
36
|
-
body: "-apple-system, BlinkMacSystemFont, \"Inter\", system-ui, sans-serif",
|
|
37
|
-
mono: "ui-monospace, \"SF Mono\", \"JetBrains Mono\", Menlo, monospace"
|
|
38
|
-
},
|
|
39
|
-
typeScale: {
|
|
40
|
-
title: 44,
|
|
41
|
-
h1: 28,
|
|
42
|
-
h2: 20,
|
|
43
|
-
h3: 16,
|
|
44
|
-
body: 14,
|
|
45
|
-
caption: 10
|
|
46
|
-
},
|
|
47
|
-
margin: 76,
|
|
48
|
-
leading: 1.55,
|
|
49
|
-
radius: 6
|
|
50
|
-
};
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region src/data/delimited.ts
|
|
53
|
-
/**
|
|
54
|
-
* RFC 4180 with the parts that actually show up in exported data: quoted
|
|
55
|
-
* fields, doubled quotes inside them, embedded newlines, and CRLF.
|
|
56
|
-
*
|
|
57
|
-
* Hand-written because `core` ships to every user and a CSV dependency is a lot
|
|
58
|
-
* of install size for something a report needs in one place.
|
|
59
|
-
*/
|
|
60
|
-
function splitRecords(text, delimiter) {
|
|
61
|
-
const records = [];
|
|
62
|
-
let row = [];
|
|
63
|
-
let field = "";
|
|
64
|
-
let quoted = false;
|
|
65
|
-
let started = false;
|
|
66
|
-
const endField = () => {
|
|
67
|
-
row.push(field);
|
|
68
|
-
field = "";
|
|
69
|
-
started = false;
|
|
70
|
-
};
|
|
71
|
-
const endRow = () => {
|
|
72
|
-
endField();
|
|
73
|
-
records.push(row);
|
|
74
|
-
row = [];
|
|
75
|
-
};
|
|
76
|
-
for (let i = 0; i < text.length; i++) {
|
|
77
|
-
const char = text[i];
|
|
78
|
-
if (quoted) {
|
|
79
|
-
if (char === "\"") {
|
|
80
|
-
if (text[i + 1] === "\"") {
|
|
81
|
-
field += "\"";
|
|
82
|
-
i++;
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
quoted = false;
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
field += char;
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
if (char === "\"" && !started) {
|
|
92
|
-
quoted = true;
|
|
93
|
-
started = true;
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
if (char === delimiter) {
|
|
97
|
-
endField();
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
if (char === "\r") {
|
|
101
|
-
if (text[i + 1] === "\n") i++;
|
|
102
|
-
endRow();
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
if (char === "\n") {
|
|
106
|
-
endRow();
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
field += char;
|
|
110
|
-
started = true;
|
|
111
|
-
}
|
|
112
|
-
if (field !== "" || row.length > 0) endRow();
|
|
113
|
-
return records;
|
|
114
|
-
}
|
|
115
|
-
/** Numbers stay numbers so a table can align and format them; nothing else is guessed at. */
|
|
116
|
-
function coerce(raw) {
|
|
117
|
-
const value = raw.trim();
|
|
118
|
-
if (value === "") return null;
|
|
119
|
-
if (/^-?(?:\d+|\d*\.\d+)(?:[eE][-+]?\d+)?$/.test(value)) {
|
|
120
|
-
const n = Number(value);
|
|
121
|
-
if (Number.isFinite(n)) return n;
|
|
122
|
-
}
|
|
123
|
-
return value;
|
|
124
|
-
}
|
|
125
|
-
function parseDelimited(text, opts = {}) {
|
|
126
|
-
const delimiter = opts.delimiter ?? ",";
|
|
127
|
-
const records = splitRecords(text.replace(/^/, ""), delimiter).filter((record) => record.length > 1 || (record[0] ?? "") !== "");
|
|
128
|
-
if (records.length === 0) return {
|
|
129
|
-
columns: [],
|
|
130
|
-
rows: []
|
|
131
|
-
};
|
|
132
|
-
const header = opts.noHeader ? records[0].map((_, index) => `column${index + 1}`) : records[0].map((name, index) => name.trim() || `column${index + 1}`);
|
|
133
|
-
return {
|
|
134
|
-
columns: header,
|
|
135
|
-
rows: (opts.noHeader ? records : records.slice(1)).map((record) => {
|
|
136
|
-
const row = {};
|
|
137
|
-
header.forEach((name, index) => {
|
|
138
|
-
row[name] = coerce(record[index] ?? "");
|
|
139
|
-
});
|
|
140
|
-
return row;
|
|
141
|
-
})
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
//#endregion
|
|
145
1
|
//#region src/diagram/layout.ts
|
|
146
2
|
const DEFAULTS = {
|
|
147
3
|
fontSize: 13,
|
|
@@ -570,6 +426,150 @@ function layoutDiagram(diagram, options = {}) {
|
|
|
570
426
|
};
|
|
571
427
|
}
|
|
572
428
|
//#endregion
|
|
429
|
+
//#region src/app/lib/design.ts
|
|
430
|
+
function designToCssVars(d) {
|
|
431
|
+
return {
|
|
432
|
+
"--od-bg": d.palette.bg,
|
|
433
|
+
"--od-text": d.palette.text,
|
|
434
|
+
"--od-muted": d.palette.muted,
|
|
435
|
+
"--od-accent": d.palette.accent,
|
|
436
|
+
"--od-rule": d.palette.rule,
|
|
437
|
+
"--od-font-heading": d.fonts.heading,
|
|
438
|
+
"--od-font-body": d.fonts.body,
|
|
439
|
+
"--od-font-mono": d.fonts.mono,
|
|
440
|
+
"--od-size-title": `${d.typeScale.title}px`,
|
|
441
|
+
"--od-size-h1": `${d.typeScale.h1}px`,
|
|
442
|
+
"--od-size-h2": `${d.typeScale.h2}px`,
|
|
443
|
+
"--od-size-h3": `${d.typeScale.h3}px`,
|
|
444
|
+
"--od-size-body": `${d.typeScale.body}px`,
|
|
445
|
+
"--od-size-caption": `${d.typeScale.caption}px`,
|
|
446
|
+
"--od-margin": `${d.margin}px`,
|
|
447
|
+
"--od-leading": String(d.leading),
|
|
448
|
+
"--od-radius": `${d.radius}px`
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
function cssVarsToString(vars) {
|
|
452
|
+
return Object.entries(vars).map(([k, v]) => ` ${k}: ${v};`).join("\n");
|
|
453
|
+
}
|
|
454
|
+
const defaultDesign = {
|
|
455
|
+
palette: {
|
|
456
|
+
bg: "#ffffff",
|
|
457
|
+
text: "#16181d",
|
|
458
|
+
muted: "#6b7280",
|
|
459
|
+
accent: "#2563eb",
|
|
460
|
+
rule: "#e5e7eb"
|
|
461
|
+
},
|
|
462
|
+
fonts: {
|
|
463
|
+
heading: "-apple-system, BlinkMacSystemFont, \"Inter\", system-ui, sans-serif",
|
|
464
|
+
body: "-apple-system, BlinkMacSystemFont, \"Inter\", system-ui, sans-serif",
|
|
465
|
+
mono: "ui-monospace, \"SF Mono\", \"JetBrains Mono\", Menlo, monospace"
|
|
466
|
+
},
|
|
467
|
+
typeScale: {
|
|
468
|
+
title: 44,
|
|
469
|
+
h1: 28,
|
|
470
|
+
h2: 20,
|
|
471
|
+
h3: 16,
|
|
472
|
+
body: 14,
|
|
473
|
+
caption: 10
|
|
474
|
+
},
|
|
475
|
+
margin: 76,
|
|
476
|
+
leading: 1.55,
|
|
477
|
+
radius: 6
|
|
478
|
+
};
|
|
479
|
+
//#endregion
|
|
480
|
+
//#region src/data/delimited.ts
|
|
481
|
+
/**
|
|
482
|
+
* RFC 4180 with the parts that actually show up in exported data: quoted
|
|
483
|
+
* fields, doubled quotes inside them, embedded newlines, and CRLF.
|
|
484
|
+
*
|
|
485
|
+
* Hand-written because `core` ships to every user and a CSV dependency is a lot
|
|
486
|
+
* of install size for something a report needs in one place.
|
|
487
|
+
*/
|
|
488
|
+
function splitRecords(text, delimiter) {
|
|
489
|
+
const records = [];
|
|
490
|
+
let row = [];
|
|
491
|
+
let field = "";
|
|
492
|
+
let quoted = false;
|
|
493
|
+
let started = false;
|
|
494
|
+
const endField = () => {
|
|
495
|
+
row.push(field);
|
|
496
|
+
field = "";
|
|
497
|
+
started = false;
|
|
498
|
+
};
|
|
499
|
+
const endRow = () => {
|
|
500
|
+
endField();
|
|
501
|
+
records.push(row);
|
|
502
|
+
row = [];
|
|
503
|
+
};
|
|
504
|
+
for (let i = 0; i < text.length; i++) {
|
|
505
|
+
const char = text[i];
|
|
506
|
+
if (quoted) {
|
|
507
|
+
if (char === "\"") {
|
|
508
|
+
if (text[i + 1] === "\"") {
|
|
509
|
+
field += "\"";
|
|
510
|
+
i++;
|
|
511
|
+
continue;
|
|
512
|
+
}
|
|
513
|
+
quoted = false;
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
field += char;
|
|
517
|
+
continue;
|
|
518
|
+
}
|
|
519
|
+
if (char === "\"" && !started) {
|
|
520
|
+
quoted = true;
|
|
521
|
+
started = true;
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
524
|
+
if (char === delimiter) {
|
|
525
|
+
endField();
|
|
526
|
+
continue;
|
|
527
|
+
}
|
|
528
|
+
if (char === "\r") {
|
|
529
|
+
if (text[i + 1] === "\n") i++;
|
|
530
|
+
endRow();
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
if (char === "\n") {
|
|
534
|
+
endRow();
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
field += char;
|
|
538
|
+
started = true;
|
|
539
|
+
}
|
|
540
|
+
if (field !== "" || row.length > 0) endRow();
|
|
541
|
+
return records;
|
|
542
|
+
}
|
|
543
|
+
/** Numbers stay numbers so a table can align and format them; nothing else is guessed at. */
|
|
544
|
+
function coerce(raw) {
|
|
545
|
+
const value = raw.trim();
|
|
546
|
+
if (value === "") return null;
|
|
547
|
+
if (/^-?(?:\d+|\d*\.\d+)(?:[eE][-+]?\d+)?$/.test(value)) {
|
|
548
|
+
const n = Number(value);
|
|
549
|
+
if (Number.isFinite(n)) return n;
|
|
550
|
+
}
|
|
551
|
+
return value;
|
|
552
|
+
}
|
|
553
|
+
function parseDelimited(text, opts = {}) {
|
|
554
|
+
const delimiter = opts.delimiter ?? ",";
|
|
555
|
+
const records = splitRecords(text.replace(/^/, ""), delimiter).filter((record) => record.length > 1 || (record[0] ?? "") !== "");
|
|
556
|
+
if (records.length === 0) return {
|
|
557
|
+
columns: [],
|
|
558
|
+
rows: []
|
|
559
|
+
};
|
|
560
|
+
const header = opts.noHeader ? records[0].map((_, index) => `column${index + 1}`) : records[0].map((name, index) => name.trim() || `column${index + 1}`);
|
|
561
|
+
return {
|
|
562
|
+
columns: header,
|
|
563
|
+
rows: (opts.noHeader ? records : records.slice(1)).map((record) => {
|
|
564
|
+
const row = {};
|
|
565
|
+
header.forEach((name, index) => {
|
|
566
|
+
row[name] = coerce(record[index] ?? "");
|
|
567
|
+
});
|
|
568
|
+
return row;
|
|
569
|
+
})
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
//#endregion
|
|
573
573
|
//#region src/diagram/parse.ts
|
|
574
574
|
var DiagramSyntaxError = class extends Error {
|
|
575
575
|
line;
|
|
@@ -783,7 +783,7 @@ function shapePath(node) {
|
|
|
783
783
|
return `<path d="${`M${x},${y + ry} A${w / 2},${ry} 0 0 1 ${x + w},${y + ry} L${x + w},${y + h - ry} A${w / 2},${ry} 0 0 1 ${x},${y + h - ry} Z`}" ${common} /><path d="${`M${x},${y + ry} A${w / 2},${ry} 0 0 0 ${x + w},${y + ry}`}" fill="none" stroke="var(--od-text, #16181d)" stroke-width="1.25" />`;
|
|
784
784
|
}
|
|
785
785
|
case "round": return `<rect x="${x}" y="${y}" width="${w}" height="${h}" rx="10" ry="10" ${common} />`;
|
|
786
|
-
default: return `<rect x="${x}" y="${y}" width="${w}" height="${h}"
|
|
786
|
+
default: return `<rect x="${x}" y="${y}" width="${w}" height="${h}" style="rx: var(--od-radius, 2px)" ${common} />`;
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
789
|
function nodeText(node, fontSize) {
|
|
@@ -833,4 +833,4 @@ function compileDiagram(source, options = {}) {
|
|
|
833
833
|
};
|
|
834
834
|
}
|
|
835
835
|
//#endregion
|
|
836
|
-
export { defaultDesign as a, cssVarsToString as i, DiagramSyntaxError as n, designToCssVars as o, parseDelimited as r, compileDiagram as t };
|
|
836
|
+
export { defaultDesign as a, cssVarsToString as i, DiagramSyntaxError as n, designToCssVars as o, parseDelimited as r, measureText as s, compileDiagram as t };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { g as diffDocument } from "./ops-BUo67DaP.js";
|
|
2
|
+
import { t as cliContext } from "./context-BM9_-u9P.js";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
//#region src/cli/diff.ts
|
|
5
|
+
const MARK = {
|
|
6
|
+
same: chalk.dim("·"),
|
|
7
|
+
changed: chalk.yellow("~"),
|
|
8
|
+
added: chalk.green("+"),
|
|
9
|
+
removed: chalk.red("-")
|
|
10
|
+
};
|
|
11
|
+
function where(change) {
|
|
12
|
+
if (change.status === "removed") return `p.${change.before} (removed)`;
|
|
13
|
+
if (change.before !== null && change.before !== change.after) return `p.${change.after} (was p.${change.before})`;
|
|
14
|
+
return `p.${change.after}`;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Renders the document as it is and as it was at a revision, and reports what
|
|
18
|
+
* changed page by page — on the terminal, and as a self-contained HTML report a
|
|
19
|
+
* reviewer can open without the repository.
|
|
20
|
+
*/
|
|
21
|
+
async function diffDoc(docId, opts = {}) {
|
|
22
|
+
const ctx = await cliContext();
|
|
23
|
+
const result = await diffDocument(ctx, docId, {
|
|
24
|
+
...opts.since ? { since: opts.since } : {},
|
|
25
|
+
...opts.outDir ? { outDir: opts.outDir } : {}
|
|
26
|
+
});
|
|
27
|
+
if (opts.json) {
|
|
28
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const moved = result.pages.filter((page) => page.status !== "same");
|
|
32
|
+
process.stdout.write(`${chalk.bold(docId)} ${chalk.dim(`since ${result.since} (${result.commit.slice(0, 7)})`)} — ${moved.length === 0 ? chalk.green("no changes") : `${moved.length} of ${result.pages.length} page(s) changed`}\n`);
|
|
33
|
+
for (const change of moved) {
|
|
34
|
+
process.stdout.write(` ${MARK[change.status]} ${where(change)}\n`);
|
|
35
|
+
for (const line of change.lines.slice(0, 6)) {
|
|
36
|
+
const text = line.text.length > 90 ? `${line.text.slice(0, 89)}…` : line.text;
|
|
37
|
+
process.stdout.write(` ${line.op === "add" ? chalk.green(`+ ${text}`) : chalk.red(`- ${text}`)}\n`);
|
|
38
|
+
}
|
|
39
|
+
if (change.lines.length > 6) process.stdout.write(chalk.dim(` … ${change.lines.length - 6} more line(s)\n`));
|
|
40
|
+
}
|
|
41
|
+
process.stdout.write(`${chalk.dim("report")} ${result.file}\n`);
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { diffDoc };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as EXPORT_FORMATS } from "./sdk-CqNZzbkz.js";
|
|
2
|
-
import {
|
|
3
|
-
import { d as closeRenderSession, f as exportDocument } from "./ops-
|
|
4
|
-
import { t as cliContext } from "./context-
|
|
2
|
+
import { f as listDocIds } from "./config-B_pdNbYg.js";
|
|
3
|
+
import { d as closeRenderSession, f as exportDocument } from "./ops-BUo67DaP.js";
|
|
4
|
+
import { t as cliContext } from "./context-BM9_-u9P.js";
|
|
5
5
|
import chalk from "chalk";
|
|
6
6
|
//#region src/cli/export.ts
|
|
7
7
|
const FORMATS = EXPORT_FORMATS;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as importMarkdown } from "./ops-
|
|
2
|
-
import { t as cliContext } from "./context-
|
|
1
|
+
import { m as importMarkdown } from "./ops-BUo67DaP.js";
|
|
2
|
+
import { t as cliContext } from "./context-BM9_-u9P.js";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
//#region src/cli/import.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
|
-
import { A as useDocLabels, C as cssVarsToString, D as LabelKind, E as LabelEntry, O as LabelVocabulary, S as DesignTypeScale, T as designToCssVars, _ as isPageSizeName, a as DocModule, b as DesignPalette, d as Orientation, f as PAGE_SIZES, g as isOrientation, h as PageSizeName, i as DocMeta, k as useDocLabel, 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 defaultDesign, x as DesignSystem, y as DesignFonts } from "./sdk-
|
|
1
|
+
import { A as useDocLabels, C as cssVarsToString, D as LabelKind, E as LabelEntry, O as LabelVocabulary, S as DesignTypeScale, T as designToCssVars, _ as isPageSizeName, a as DocModule, b as DesignPalette, d as Orientation, f as PAGE_SIZES, g as isOrientation, h as PageSizeName, i as DocMeta, k as useDocLabel, 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 defaultDesign, x as DesignSystem, y as DesignFonts } from "./sdk-CpDEGRIo.js";
|
|
2
2
|
import { n as OpenDocConfig, t as OpenDocBuildConfig } from "./config-P61niZMf.js";
|
|
3
3
|
import { CSSProperties, ComponentType, ReactNode } from "react";
|
|
4
|
+
//#region src/app/lib/chart.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Chart geometry, kept pure so it can be tested without a DOM.
|
|
7
|
+
*
|
|
8
|
+
* A chart is laid out synchronously from its data into a fixed box — no
|
|
9
|
+
* measuring pass, no async load — because the flow packer measures the page
|
|
10
|
+
* as it first renders, and a chart that settled a tick later would settle
|
|
11
|
+
* after the page break was decided. Text widths come from the same estimate
|
|
12
|
+
* the diagram compiler uses, for the same reason.
|
|
13
|
+
*/
|
|
14
|
+
type ChartType = 'bar' | 'line' | 'pie';
|
|
15
|
+
type ChartFormat = 'number' | 'integer' | 'percent' | ((value: number) => string);
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/app/components/chart.d.ts
|
|
18
|
+
type ChartProps = {
|
|
19
|
+
type?: ChartType;
|
|
20
|
+
/** Rows as parsed from a `.csv`/`.tsv` import, or any array of objects. */
|
|
21
|
+
data: Array<Record<string, unknown>>;
|
|
22
|
+
/** The key holding each row's category — the x axis, or a slice's name. */
|
|
23
|
+
x: string;
|
|
24
|
+
/** The key, or keys, holding the values. One key per series; a pie reads the first. */
|
|
25
|
+
y: string | string[];
|
|
26
|
+
/** Legend names for the `y` keys. */
|
|
27
|
+
labels?: Record<string, string>;
|
|
28
|
+
/** Stack the series instead of grouping them (bar charts). */
|
|
29
|
+
stacked?: boolean;
|
|
30
|
+
/** How axis ticks and value labels print. */
|
|
31
|
+
format?: ChartFormat;
|
|
32
|
+
/** Print each value on its bar, point or slice. */
|
|
33
|
+
values?: boolean;
|
|
34
|
+
/** Series colours, in order. Defaults to the document's accent and tints of it. */
|
|
35
|
+
colors?: string[];
|
|
36
|
+
/** Drawn size in CSS px; the drawing scales down to the column if it is wider. */
|
|
37
|
+
width?: number;
|
|
38
|
+
height?: number;
|
|
39
|
+
/** Caption text. Given one, the chart is numbered like any other figure. */
|
|
40
|
+
caption?: ReactNode;
|
|
41
|
+
captionText?: string;
|
|
42
|
+
kind?: LabelKind;
|
|
43
|
+
id?: string;
|
|
44
|
+
style?: CSSProperties;
|
|
45
|
+
className?: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* A bar, line or pie chart drawn from data, in the document's own colours and
|
|
49
|
+
* type. It lays itself out synchronously into a fixed box, so it measures as
|
|
50
|
+
* it prints; the Word export places it as a picture.
|
|
51
|
+
*/
|
|
52
|
+
declare function Chart({ type, data, x, y, labels, stacked, format, values, colors, width, height, caption, captionText, kind, id, style, className }: ChartProps): import("react").JSX.Element;
|
|
53
|
+
//#endregion
|
|
4
54
|
//#region src/app/lib/source-loc.d.ts
|
|
5
55
|
/**
|
|
6
56
|
* In dev, `loc-tags-plugin` stamps `data-od-loc` onto the call site of a
|
|
@@ -214,6 +264,7 @@ declare function TableOfContents({ maxLevel, showPageNumbers, includeOwnPage, in
|
|
|
214
264
|
* block — a heading, a paragraph, a table — that never straddles a page break.
|
|
215
265
|
*/
|
|
216
266
|
declare function flow(children: ReactNode, opts?: {
|
|
267
|
+
header?: ComponentType;
|
|
217
268
|
footer?: ComponentType;
|
|
218
269
|
padding?: number;
|
|
219
270
|
}): FlowSection;
|
|
@@ -342,4 +393,4 @@ type CompileOptions = LayoutOptions & RenderOptions;
|
|
|
342
393
|
/** Mermaid-flavoured text in, themed SVG out. One call, no browser. */
|
|
343
394
|
declare function compileDiagram(source: string, options?: CompileOptions): CompiledDiagram;
|
|
344
395
|
//#endregion
|
|
345
|
-
export { type BlockMetrics, type CellValue, 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, 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 };
|