office-open 0.12.0 → 0.12.2
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/ai/index.mjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/convert/index.d.mts.map +1 -1
- package/dist/convert/index.mjs +14 -11
- package/dist/convert/index.mjs.map +1 -1
- package/dist/schemas/index.mjs +1 -1
- package/dist/{schemas-DhCWsZ8v.mjs → schemas-B400scMm.mjs} +1194 -32
- package/dist/{schemas-DhCWsZ8v.mjs.map → schemas-B400scMm.mjs.map} +1 -1
- package/package.json +6 -6
- package/schemas/docx.schema.json +626 -15
- package/schemas/pptx.schema.json +589 -3
- package/schemas/xlsx.schema.json +596 -8
package/dist/ai/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { generate } from "../generate.mjs";
|
|
2
|
-
import { a as sliceDocumentSchema, g as validateDocumentInput, n as getSkeletonSchema, r as UnknownDefinitionError, t as renderSliceTypeText } from "../schemas-
|
|
2
|
+
import { a as sliceDocumentSchema, g as validateDocumentInput, n as getSkeletonSchema, r as UnknownDefinitionError, t as renderSliceTypeText } from "../schemas-B400scMm.mjs";
|
|
3
3
|
import { lintWorkbookFormulas } from "@office-open/xlsx";
|
|
4
4
|
import { PART_REGISTRIES, encodeBase64, unzipSync, validateOpcConsistency } from "@office-open/core";
|
|
5
5
|
import { jsonSchema, tool } from "ai";
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { generateToFile, parseInput } from "./generate.mjs";
|
|
2
|
-
import { a as sliceDocumentSchema, g as validateDocumentInput, p as SCHEMAS, r as UnknownDefinitionError, t as renderSliceTypeText, u as SCHEMA_ENTRIES } from "./schemas-
|
|
2
|
+
import { a as sliceDocumentSchema, g as validateDocumentInput, p as SCHEMAS, r as UnknownDefinitionError, t as renderSliceTypeText, u as SCHEMA_ENTRIES } from "./schemas-B400scMm.mjs";
|
|
3
3
|
import { defineCommand, runMain } from "citty";
|
|
4
4
|
//#region src/cli.ts
|
|
5
5
|
const FORMATS = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/convert/picture.ts","../../src/convert/shape.ts","../../src/convert/position.ts","../../src/convert/connector.ts","../../src/convert/group.ts","../../src/convert/table.ts","../../src/convert/smartart.ts","../../src/convert/text.ts"],"mappings":";;;;;;iBAuHgB,cAAc,QAAQ,mBAAqB;iBAE3C,cAAc,QAAQ,mBAAqB;iBAuC3C,cAAc,QAAQ,iBAAqB;iBAE3C,cAAc,QAAQ,mBAAqB;iBAmC3C,cAAc,QAAQ,iBAAqB;iBAE3C,cAAc,QAAQ,mBAAqB;;;KClJ/C,mBAAmB;UAGd;EAEf,OAAO;EACP,UAAU;EACV,UAAU;EACV,YAAY;EACZ,UAAU;EACV,UAAU;;KAIP,gBAAgB,KAAK;EAA0B,OAAO;;iBAG3C,YAAY,UAAU,cAAc,QAAQ,IAAI;iBAehD,iBACd,GAAG,YAAY,oCACd;iBAQa,uBAAuB,UAAU,kBAAkB;iBAWnD,eACd,UAAU,iCACV,gBAAgB,oCACf;UAoCc;EACf,MAAM;EACN,gBAAgB;;iBA8BF,iBAAiB,QAAQ,iBAAmB,iBAAmB;iBA+C/D,YAAY,QAAQ,iBAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;iBASvC,YAAY,QAAQ,mBAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;iBA2CvC,YAAY,QAAQ,mBAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;;;UCvPtC;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;;iBCdc,eACd,aAAa,8BACb,aAAa,8BACb,aAAa,8BACb,aAAa,+BACZ;iBAgBa,eAAe,KAAK;EAClC;EACA;EACA;EACA;;iBAiBc,gBAAgB,SAAS,mBAAuB;iBAQhD,gBAAgB,QAAQ,qBAAuB;iBA0B/C,gBAAgB,QAAQ,mBAAuB;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/convert/picture.ts","../../src/convert/shape.ts","../../src/convert/position.ts","../../src/convert/connector.ts","../../src/convert/group.ts","../../src/convert/table.ts","../../src/convert/smartart.ts","../../src/convert/text.ts"],"mappings":";;;;;;iBAuHgB,cAAc,QAAQ,mBAAqB;iBAE3C,cAAc,QAAQ,mBAAqB;iBAuC3C,cAAc,QAAQ,iBAAqB;iBAE3C,cAAc,QAAQ,mBAAqB;iBAmC3C,cAAc,QAAQ,iBAAqB;iBAE3C,cAAc,QAAQ,mBAAqB;;;KClJ/C,mBAAmB;UAGd;EAEf,OAAO;EACP,UAAU;EACV,UAAU;EACV,YAAY;EACZ,UAAU;EACV,UAAU;;KAIP,gBAAgB,KAAK;EAA0B,OAAO;;iBAG3C,YAAY,UAAU,cAAc,QAAQ,IAAI;iBAehD,iBACd,GAAG,YAAY,oCACd;iBAQa,uBAAuB,UAAU,kBAAkB;iBAWnD,eACd,UAAU,iCACV,gBAAgB,oCACf;UAoCc;EACf,MAAM;EACN,gBAAgB;;iBA8BF,iBAAiB,QAAQ,iBAAmB,iBAAmB;iBA+C/D,YAAY,QAAQ,iBAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;iBASvC,YAAY,QAAQ,mBAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;iBA2CvC,YAAY,QAAQ,mBAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;;;UCvPtC;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;;iBCdc,eACd,aAAa,8BACb,aAAa,8BACb,aAAa,8BACb,aAAa,+BACZ;iBAgBa,eAAe,KAAK;EAClC;EACA;EACA;EACA;;iBAiBc,gBAAgB,SAAS,mBAAuB;iBAQhD,gBAAgB,QAAQ,qBAAuB;iBA0B/C,gBAAgB,QAAQ,mBAAuB;;;iBCwG/C,YAAY,QAAQ,iBAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;iBAsEvC,YAAY,QAAQ,eAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;iBAgEvC,YAAY,QAAQ,eAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;;;UCzRtC;EACf,MAAM;EACN,aAAa;EACb,UAAU;;iBAyMI,YAAY,QAAQ,iBAAmB;iBAEvC,YAAY,QAAQ,kBAAkB;iBA+EtC,YAAY,QAAQ,eAAmB;iBAEvC,YAAY,QAAQ,kBAAkB;iBA6DtC,YAAY,QAAQ,eAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;;;iBClWvC,eAAe,QAAQ,oBAAe;iBAqBtC,eAAe,QAAQ,kBAAe;;;iBC2BtC,qBAAqB,SAAS,6BAA6B;iBA2H3D,mBAAmB,MAAM,mBAAmB"}
|
package/dist/convert/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTransformation } from "@office-open/docx";
|
|
2
2
|
import { columnToLetter, letterToColumn } from "@office-open/xlsx";
|
|
3
|
-
import { convertEmuToPoints, convertEmuToTwip, convertPointsToEmu, convertPointsToTwip, convertToEmu, convertToPt, convertToTwip, convertTwipToEmu, pickConnectorBase, pickGroupBase, pickNonVisualDrawingProperties, stripColorHashPrefix } from "@office-open/core";
|
|
3
|
+
import { convertEmuToPoints, convertEmuToTwip, convertPixelsToEmu, convertPointsToEmu, convertPointsToTwip, convertToEmu, convertToPt, convertToTwip, convertTwipToEmu, parseAngle, pickConnectorBase, pickGroupBase, pickNonVisualDrawingProperties, stripColorHashPrefix } from "@office-open/core";
|
|
4
4
|
//#region src/convert/position.ts
|
|
5
5
|
/**
|
|
6
6
|
* Cross-format position helpers shared by the picture/shape/connector/group
|
|
@@ -774,7 +774,7 @@ function isRunChild(child) {
|
|
|
774
774
|
/** Copy the shared shape-content fields that are present on the source. */
|
|
775
775
|
function pickContent(source) {
|
|
776
776
|
const out = {};
|
|
777
|
-
if (source.fill
|
|
777
|
+
if (source.fill != null) out.fill = source.fill;
|
|
778
778
|
if (source.outline !== void 0) out.outline = source.outline;
|
|
779
779
|
if (source.effects !== void 0) out.effects = source.effects;
|
|
780
780
|
if (source.effectDag !== void 0) out.effectDag = source.effectDag;
|
|
@@ -1038,8 +1038,6 @@ function toXlsxConnector(source) {
|
|
|
1038
1038
|
*
|
|
1039
1039
|
* @module
|
|
1040
1040
|
*/
|
|
1041
|
-
const EMU_PER_PIXEL = 9525;
|
|
1042
|
-
const ANGLE_UNITS_PER_DEGREE = 6e4;
|
|
1043
1041
|
/**
|
|
1044
1042
|
* Build the docx altText (wp:docPr) from the container cNvPr. Only emitted when
|
|
1045
1043
|
* at least one cNvPr field is authored; name defaults to "Group" since docx
|
|
@@ -1068,11 +1066,11 @@ const hasCnvPr = (picked) => picked.name !== void 0 || picked.description !== vo
|
|
|
1068
1066
|
/** docx child MediaDataTransformation → absolute box (reads EMUs; falls back to pixels). */
|
|
1069
1067
|
function docxChildMediaToBox(t) {
|
|
1070
1068
|
return {
|
|
1071
|
-
x: t.offset?.emus?.x ?? (t.offset?.pixels.x ?? 0)
|
|
1072
|
-
y: t.offset?.emus?.y ?? (t.offset?.pixels.y ?? 0)
|
|
1069
|
+
x: t.offset?.emus?.x ?? convertPixelsToEmu(t.offset?.pixels.x ?? 0),
|
|
1070
|
+
y: t.offset?.emus?.y ?? convertPixelsToEmu(t.offset?.pixels.y ?? 0),
|
|
1073
1071
|
width: t.emus.x,
|
|
1074
1072
|
height: t.emus.y,
|
|
1075
|
-
...t.rotation !== void 0 ? { rotation: t.rotation
|
|
1073
|
+
...t.rotation !== void 0 ? { rotation: parseAngle(t.rotation) } : {},
|
|
1076
1074
|
...t.flip?.horizontal ? { flipHorizontal: true } : {},
|
|
1077
1075
|
...t.flip?.vertical ? { flipVertical: true } : {}
|
|
1078
1076
|
};
|
|
@@ -1501,13 +1499,18 @@ function pptxToDocx(src) {
|
|
|
1501
1499
|
...copyBaseTableFlags(src)
|
|
1502
1500
|
};
|
|
1503
1501
|
}
|
|
1502
|
+
function mergeIndex(merges) {
|
|
1503
|
+
const index = /* @__PURE__ */ new Map();
|
|
1504
|
+
for (const m of merges) index.set(`${m.row}:${m.col}`, m);
|
|
1505
|
+
return index;
|
|
1506
|
+
}
|
|
1504
1507
|
function xlsxToDocx(src) {
|
|
1505
|
-
const merges = (src.mergeCells ?? []).map((m) => parseMergeRef(m.ref)).filter((m) => m !== void 0);
|
|
1508
|
+
const merges = mergeIndex((src.mergeCells ?? []).map((m) => parseMergeRef(m.ref)).filter((m) => m !== void 0));
|
|
1506
1509
|
return {
|
|
1507
1510
|
rows: src.rows.map((row, ri) => ({
|
|
1508
1511
|
...row.height !== void 0 ? { height: { value: convertPointsToTwip(convertToPt(row.height)) } } : {},
|
|
1509
1512
|
cells: (row.cells ?? []).map((cell, ci) => {
|
|
1510
|
-
const merge = merges.
|
|
1513
|
+
const merge = merges.get(`${ri}:${ci}`);
|
|
1511
1514
|
const columnSpan = merge ? merge.colEnd - merge.col + 1 : void 0;
|
|
1512
1515
|
const rowSpan = merge ? merge.rowEnd - merge.row + 1 : void 0;
|
|
1513
1516
|
const text = cellValueToText(cell.value);
|
|
@@ -1546,12 +1549,12 @@ function docxToPptx(src) {
|
|
|
1546
1549
|
};
|
|
1547
1550
|
}
|
|
1548
1551
|
function xlsxToPptx(src) {
|
|
1549
|
-
const merges = (src.mergeCells ?? []).map((m) => parseMergeRef(m.ref)).filter((m) => m !== void 0);
|
|
1552
|
+
const merges = mergeIndex((src.mergeCells ?? []).map((m) => parseMergeRef(m.ref)).filter((m) => m !== void 0));
|
|
1550
1553
|
return {
|
|
1551
1554
|
rows: src.rows.map((row, ri) => ({
|
|
1552
1555
|
...row.height !== void 0 ? { height: convertPointsToEmu(convertToPt(row.height)) } : {},
|
|
1553
1556
|
cells: (row.cells ?? []).map((cell, ci) => {
|
|
1554
|
-
const merge = merges.
|
|
1557
|
+
const merge = merges.get(`${ri}:${ci}`);
|
|
1555
1558
|
const columnSpan = merge ? merge.colEnd - merge.col + 1 : void 0;
|
|
1556
1559
|
const rowSpan = merge ? merge.rowEnd - merge.row + 1 : void 0;
|
|
1557
1560
|
const text = cellValueToText(cell.value);
|