@pixerate/editor 0.48.0 → 0.50.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/agent/index.cjs +24 -22
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.js +6 -4
- package/dist/agent/index.js.map +1 -1
- package/dist/canvas/index.cjs +151 -25
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +109 -3
- package/dist/canvas/index.d.ts +109 -3
- package/dist/canvas/index.js +127 -1
- package/dist/canvas/index.js.map +1 -1
- package/dist/chart/index.cjs +81 -79
- package/dist/chart/index.cjs.map +1 -1
- package/dist/chart/index.js +52 -50
- package/dist/chart/index.js.map +1 -1
- package/dist/{chunk-TXXNBDQX.cjs → chunk-2Q46FKZK.cjs} +113 -34
- package/dist/chunk-2Q46FKZK.cjs.map +1 -0
- package/dist/{chunk-PIMCHMZE.cjs → chunk-3JNRQVTS.cjs} +16 -16
- package/dist/{chunk-PIMCHMZE.cjs.map → chunk-3JNRQVTS.cjs.map} +1 -1
- package/dist/{chunk-HXUL3LS7.js → chunk-5TWIN7ZJ.js} +2 -2
- package/dist/{chunk-VKPEPWKZ.js → chunk-DQPBQXKG.js} +4 -4
- package/dist/{chunk-MUCYWI6W.cjs → chunk-FEMIVHN3.cjs} +17 -15
- package/dist/chunk-FEMIVHN3.cjs.map +1 -0
- package/dist/{chunk-XUUD43OV.js → chunk-GJBIVWB2.js} +2 -2
- package/dist/{chunk-PRSJJZBS.cjs → chunk-GTZXF4BI.cjs} +191 -841
- package/dist/chunk-GTZXF4BI.cjs.map +1 -0
- package/dist/chunk-JOX6MJW4.cjs +674 -0
- package/dist/chunk-JOX6MJW4.cjs.map +1 -0
- package/dist/{chunk-WXEHCVJQ.cjs → chunk-LNKZPIQD.cjs} +52 -52
- package/dist/{chunk-WXEHCVJQ.cjs.map → chunk-LNKZPIQD.cjs.map} +1 -1
- package/dist/chunk-OV7UAKIY.js +674 -0
- package/dist/chunk-OV7UAKIY.js.map +1 -0
- package/dist/{chunk-PKBWLEL7.js → chunk-QFTVLEVN.js} +6 -4
- package/dist/{chunk-PKBWLEL7.js.map → chunk-QFTVLEVN.js.map} +1 -1
- package/dist/{chunk-KRGXUQ2Y.js → chunk-T6XU4B54.js} +82 -3
- package/dist/chunk-T6XU4B54.js.map +1 -0
- package/dist/{chunk-U6IZKC7B.cjs → chunk-TGBCBQFV.cjs} +14 -14
- package/dist/{chunk-U6IZKC7B.cjs.map → chunk-TGBCBQFV.cjs.map} +1 -1
- package/dist/{chunk-3LHWTGHW.js → chunk-TO22LX34.js} +11 -1
- package/dist/chunk-TO22LX34.js.map +1 -0
- package/dist/{chunk-LTUM52X6.js → chunk-WBOAXDKD.js} +109 -759
- package/dist/chunk-WBOAXDKD.js.map +1 -0
- package/dist/{chunk-VNYRI265.cjs → chunk-YNSK4MGT.cjs} +12 -2
- package/dist/chunk-YNSK4MGT.cjs.map +1 -0
- package/dist/export/index.cjs +4 -2
- package/dist/export/index.cjs.map +1 -1
- package/dist/export/index.d.cts +5 -1
- package/dist/export/index.d.ts +5 -1
- package/dist/export/index.js +3 -1
- package/dist/extensions/index.cjs +6 -5
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.js +5 -4
- package/dist/image-editor/index.cjs +141 -1
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +42 -1
- package/dist/image-editor/index.d.ts +42 -1
- package/dist/image-editor/index.js +140 -0
- package/dist/image-editor/index.js.map +1 -1
- package/dist/index.cjs +12 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/{pathfinder-D98S2lV5.d.ts → pathfinder-B9xh_pCZ.d.ts} +2 -1
- package/dist/{pathfinder-DKRcXiLS.d.cts → pathfinder-QdG70sr9.d.cts} +2 -1
- package/dist/vector/index.cjs +153 -153
- package/dist/vector/index.d.cts +1 -1
- package/dist/vector/index.d.ts +1 -1
- package/dist/vector/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3LHWTGHW.js.map +0 -1
- package/dist/chunk-KRGXUQ2Y.js.map +0 -1
- package/dist/chunk-LTUM52X6.js.map +0 -1
- package/dist/chunk-MUCYWI6W.cjs.map +0 -1
- package/dist/chunk-PRSJJZBS.cjs.map +0 -1
- package/dist/chunk-TXXNBDQX.cjs.map +0 -1
- package/dist/chunk-VNYRI265.cjs.map +0 -1
- /package/dist/{chunk-HXUL3LS7.js.map → chunk-5TWIN7ZJ.js.map} +0 -0
- /package/dist/{chunk-VKPEPWKZ.js.map → chunk-DQPBQXKG.js.map} +0 -0
- /package/dist/{chunk-XUUD43OV.js.map → chunk-GJBIVWB2.js.map} +0 -0
|
@@ -5,6 +5,15 @@
|
|
|
5
5
|
|
|
6
6
|
var _chunk3CC7OPUQcjs = require('./chunk-3CC7OPUQ.cjs');
|
|
7
7
|
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunk3JNRQVTScjs = require('./chunk-3JNRQVTS.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkJOX6MJW4cjs = require('./chunk-JOX6MJW4.cjs');
|
|
16
|
+
|
|
8
17
|
// src/export/images.ts
|
|
9
18
|
var DOCX_IMAGE_TYPES = {
|
|
10
19
|
"image/png": "png",
|
|
@@ -654,7 +663,7 @@ ${external}`;
|
|
|
654
663
|
}
|
|
655
664
|
}, _class2);
|
|
656
665
|
var DocxBuilder = (_class3 = class {
|
|
657
|
-
constructor(doc, options, threads, styles) {;_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this);_class3.prototype.__init9.call(this);_class3.prototype.__init10.call(this);_class3.prototype.__init11.call(this);_class3.prototype.__init12.call(this);_class3.prototype.__init13.call(this);_class3.prototype.__init14.call(this);_class3.prototype.__init15.call(this);_class3.prototype.__init16.call(this);_class3.prototype.__init17.call(this);
|
|
666
|
+
constructor(doc, options, threads, styles) {;_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this);_class3.prototype.__init9.call(this);_class3.prototype.__init10.call(this);_class3.prototype.__init11.call(this);_class3.prototype.__init12.call(this);_class3.prototype.__init13.call(this);_class3.prototype.__init14.call(this);_class3.prototype.__init15.call(this);_class3.prototype.__init16.call(this);_class3.prototype.__init17.call(this);_class3.prototype.__init18.call(this);
|
|
658
667
|
this.doc = doc;
|
|
659
668
|
this.options = options;
|
|
660
669
|
this.threads = threads;
|
|
@@ -669,23 +678,24 @@ var DocxBuilder = (_class3 = class {
|
|
|
669
678
|
|
|
670
679
|
__init5() {this.report = {
|
|
671
680
|
dropped: [],
|
|
672
|
-
written: { paragraphs: 0, tables: 0, images: 0, comments: 0, replies: 0, trackedChanges: 0 }
|
|
681
|
+
written: { paragraphs: 0, tables: 0, images: 0, charts: 0, comments: 0, replies: 0, trackedChanges: 0 }
|
|
673
682
|
}}
|
|
674
683
|
__init6() {this.rels = new Relationships()}
|
|
675
684
|
__init7() {this.media = []}
|
|
676
685
|
__init8() {this.mediaTypes = /* @__PURE__ */ new Set()}
|
|
677
|
-
__init9() {this.
|
|
678
|
-
__init10() {this.
|
|
679
|
-
__init11() {this.
|
|
680
|
-
__init12() {this.
|
|
681
|
-
__init13() {this.
|
|
686
|
+
__init9() {this.charts = []}
|
|
687
|
+
__init10() {this.nums = []}
|
|
688
|
+
__init11() {this.revisionId = 0}
|
|
689
|
+
__init12() {this.docPrId = 0}
|
|
690
|
+
__init13() {this.paraIdCounter = 268435456}
|
|
691
|
+
__init14() {this.comments = /* @__PURE__ */ new Map()}
|
|
682
692
|
/** Thread id → JSON node carrying its last comment mark. */
|
|
683
|
-
|
|
693
|
+
__init15() {this.commentEnds = /* @__PURE__ */ new Map()}
|
|
684
694
|
/** JSON node → threads whose range ends after it (so ends are found in O(1) per node). */
|
|
685
|
-
|
|
686
|
-
|
|
695
|
+
__init16() {this.endsByNode = /* @__PURE__ */ new Map()}
|
|
696
|
+
__init17() {this.people = /* @__PURE__ */ new Map()}
|
|
687
697
|
|
|
688
|
-
|
|
698
|
+
__init18() {this.extraStyles = /* @__PURE__ */ new Set()}
|
|
689
699
|
|
|
690
700
|
|
|
691
701
|
drop(kind, name, reason) {
|
|
@@ -815,6 +825,9 @@ var DocxBuilder = (_class3 = class {
|
|
|
815
825
|
case "image":
|
|
816
826
|
this.paragraph(w, { type: "paragraph", content: [node] }, ctx);
|
|
817
827
|
return;
|
|
828
|
+
case "chart":
|
|
829
|
+
this.chartParagraph(w, node, ctx);
|
|
830
|
+
return;
|
|
818
831
|
default:
|
|
819
832
|
break;
|
|
820
833
|
}
|
|
@@ -935,6 +948,12 @@ var DocxBuilder = (_class3 = class {
|
|
|
935
948
|
case "image":
|
|
936
949
|
out.push({ kind: "image", node, last: true, marks });
|
|
937
950
|
break;
|
|
951
|
+
case "sparkline": {
|
|
952
|
+
const text = sparklineText(node.attrs);
|
|
953
|
+
this.drop("node", "sparkline", "written as text (its label, or \u2581\u2583\u2587 bars)");
|
|
954
|
+
out.push({ kind: "text", text, node, last: true, marks });
|
|
955
|
+
break;
|
|
956
|
+
}
|
|
938
957
|
case "mention": {
|
|
939
958
|
const label = _nullishCoalesce(_nullishCoalesce(_optionalChain([node, 'access', _53 => _53.attrs, 'optionalAccess', _54 => _54.label]), () => ( _optionalChain([node, 'access', _55 => _55.attrs, 'optionalAccess', _56 => _56.id]))), () => ( ""));
|
|
940
959
|
out.push({ kind: "text", text: label ? `@${label}` : "", node, last: true, marks });
|
|
@@ -1149,9 +1168,57 @@ var DocxBuilder = (_class3 = class {
|
|
|
1149
1168
|
w.close("pic:pic").close("a:graphicData").close("a:graphic").close("wp:inline").close("w:drawing");
|
|
1150
1169
|
return w.toString();
|
|
1151
1170
|
}
|
|
1171
|
+
// -- Charts -----------------------------------------------------------------
|
|
1172
|
+
/** A `chart` node as a paragraph holding a native Word chart (`c:chart` in `wp:inline`). */
|
|
1173
|
+
chartParagraph(w, node, ctx) {
|
|
1174
|
+
const raw = _optionalChain([node, 'access', _89 => _89.attrs, 'optionalAccess', _90 => _90.spec]);
|
|
1175
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
1176
|
+
this.drop("node", "chart", "chart has no spec");
|
|
1177
|
+
return;
|
|
1178
|
+
}
|
|
1179
|
+
const spec = _chunkJOX6MJW4cjs.normalizeChartSpec.call(void 0, raw).spec;
|
|
1180
|
+
const written = _chunk3JNRQVTScjs.chartToOoxml.call(void 0, spec);
|
|
1181
|
+
for (const issue of written.issues) this.drop("node", "chart", issue);
|
|
1182
|
+
const name = `chart${this.charts.length + 1}.xml`;
|
|
1183
|
+
this.charts.push(written.xml);
|
|
1184
|
+
const relId = this.rels.add(_chunk3JNRQVTScjs.CHART_OOXML_RELATIONSHIP, `charts/${name}`);
|
|
1185
|
+
let width = _nullishCoalesce(pixelAttr(_optionalChain([node, 'access', _91 => _91.attrs, 'optionalAccess', _92 => _92.width])), () => ( MAX_IMAGE_WIDTH_PX));
|
|
1186
|
+
let height = _nullishCoalesce(pixelAttr(_optionalChain([node, 'access', _93 => _93.attrs, 'optionalAccess', _94 => _94.height])), () => ( 320));
|
|
1187
|
+
if (width > MAX_IMAGE_WIDTH_PX) {
|
|
1188
|
+
height = height * MAX_IMAGE_WIDTH_PX / width;
|
|
1189
|
+
width = MAX_IMAGE_WIDTH_PX;
|
|
1190
|
+
}
|
|
1191
|
+
const cx = pxToEmu(width);
|
|
1192
|
+
const cy = pxToEmu(height);
|
|
1193
|
+
const id = ++this.docPrId;
|
|
1194
|
+
const title = spec.title || "";
|
|
1195
|
+
this.report.written.charts++;
|
|
1196
|
+
const drawing = new XmlWriter(false);
|
|
1197
|
+
drawing.open("w:r").open("w:drawing").open("wp:inline", { distT: 0, distB: 0, distL: 0, distR: 0 });
|
|
1198
|
+
drawing.empty("wp:extent", { cx, cy }).empty("wp:effectExtent", { l: 0, t: 0, r: 0, b: 0 });
|
|
1199
|
+
drawing.empty("wp:docPr", { id, name: `Chart ${id}`, descr: title || void 0, title: title || void 0 });
|
|
1200
|
+
drawing.empty("wp:cNvGraphicFramePr");
|
|
1201
|
+
drawing.open("a:graphic").open("a:graphicData", { uri: _chunk3JNRQVTScjs.CHART_OOXML_NS });
|
|
1202
|
+
drawing.empty("c:chart", { "xmlns:c": _chunk3JNRQVTScjs.CHART_OOXML_NS, "r:id": relId });
|
|
1203
|
+
drawing.close("a:graphicData").close("a:graphic").close("wp:inline").close("w:drawing").close("w:r");
|
|
1204
|
+
this.report.written.paragraphs++;
|
|
1205
|
+
w.open("w:p");
|
|
1206
|
+
const indent = ctx.quoteLevel * INDENT_STEP;
|
|
1207
|
+
const jc = alignment(_optionalChain([node, 'access', _95 => _95.attrs, 'optionalAccess', _96 => _96.textAlign]));
|
|
1208
|
+
if (indent || jc) {
|
|
1209
|
+
w.open("w:pPr");
|
|
1210
|
+
if (indent) w.empty("w:ind", { "w:left": indent });
|
|
1211
|
+
if (jc) w.val("w:jc", jc);
|
|
1212
|
+
w.close("w:pPr");
|
|
1213
|
+
}
|
|
1214
|
+
this.commentStarts(w, _nullishCoalesce(node.marks, () => ( [])));
|
|
1215
|
+
w.raw(drawing.toString());
|
|
1216
|
+
this.commentEndsAfter(w, node);
|
|
1217
|
+
w.close("w:p");
|
|
1218
|
+
}
|
|
1152
1219
|
// -- Tables -------------------------------------------------------------------
|
|
1153
1220
|
table(w, node, ctx) {
|
|
1154
|
-
const rows = (_nullishCoalesce(node.content, () => ( []))).filter((row) => row.type === "tableRow" || _optionalChain([row, 'access',
|
|
1221
|
+
const rows = (_nullishCoalesce(node.content, () => ( []))).filter((row) => row.type === "tableRow" || _optionalChain([row, 'access', _97 => _97.content, 'optionalAccess', _98 => _98.length]));
|
|
1155
1222
|
if (!rows.length) {
|
|
1156
1223
|
this.drop("node", "table", "empty table");
|
|
1157
1224
|
return;
|
|
@@ -1161,8 +1228,8 @@ var DocxBuilder = (_class3 = class {
|
|
|
1161
1228
|
let col = 0;
|
|
1162
1229
|
for (const cell of _nullishCoalesce(row.content, () => ( []))) {
|
|
1163
1230
|
while (grid[r][col]) col++;
|
|
1164
|
-
const colspan = Math.max(1, Math.min(63, Number(_optionalChain([cell, 'access',
|
|
1165
|
-
const rowspan = Math.max(1, Math.min(rows.length - r, Number(_optionalChain([cell, 'access',
|
|
1231
|
+
const colspan = Math.max(1, Math.min(63, Number(_optionalChain([cell, 'access', _99 => _99.attrs, 'optionalAccess', _100 => _100.colspan])) || 1));
|
|
1232
|
+
const rowspan = Math.max(1, Math.min(rows.length - r, Number(_optionalChain([cell, 'access', _101 => _101.attrs, 'optionalAccess', _102 => _102.rowspan])) || 1));
|
|
1166
1233
|
for (let i = 0; i < rowspan; i++) {
|
|
1167
1234
|
for (let j = 0; j < colspan; j++) {
|
|
1168
1235
|
grid[r + i][col + j] = { cell, rowOffset: i, colOffset: j, colspan, rowspan };
|
|
@@ -1175,7 +1242,7 @@ var DocxBuilder = (_class3 = class {
|
|
|
1175
1242
|
const widths = [];
|
|
1176
1243
|
for (let c = 0; c < cols; c++) {
|
|
1177
1244
|
const slot = grid[0][c];
|
|
1178
|
-
const colwidth = _optionalChain([slot, 'optionalAccess',
|
|
1245
|
+
const colwidth = _optionalChain([slot, 'optionalAccess', _103 => _103.cell, 'access', _104 => _104.attrs, 'optionalAccess', _105 => _105.colwidth]);
|
|
1179
1246
|
const px = Array.isArray(colwidth) ? Number(colwidth[slot.colOffset]) : NaN;
|
|
1180
1247
|
widths.push(Number.isFinite(px) && px > 0 ? pxToTwips(px) : 0);
|
|
1181
1248
|
}
|
|
@@ -1206,7 +1273,7 @@ var DocxBuilder = (_class3 = class {
|
|
|
1206
1273
|
for (let c = 0; c < cols; c++) {
|
|
1207
1274
|
const slot = grid[r][c];
|
|
1208
1275
|
if (slot && slot.colOffset > 0) continue;
|
|
1209
|
-
const span = _nullishCoalesce(_optionalChain([slot, 'optionalAccess',
|
|
1276
|
+
const span = _nullishCoalesce(_optionalChain([slot, 'optionalAccess', _106 => _106.colspan]), () => ( 1));
|
|
1210
1277
|
const width = widths.slice(c, c + span).reduce((n, v) => n + v, 0);
|
|
1211
1278
|
w.open("w:tc").open("w:tcPr").empty("w:tcW", { "w:w": width, "w:type": "dxa" });
|
|
1212
1279
|
if (span > 1) w.val("w:gridSpan", span);
|
|
@@ -1217,7 +1284,7 @@ var DocxBuilder = (_class3 = class {
|
|
|
1217
1284
|
w.close("w:tcPr");
|
|
1218
1285
|
const content = slot && slot.rowOffset === 0 ? _nullishCoalesce(slot.cell.content, () => ( [])) : [];
|
|
1219
1286
|
if (content.length) this.blocks(w, content, cellCtx);
|
|
1220
|
-
const lastType = _optionalChain([content, 'access',
|
|
1287
|
+
const lastType = _optionalChain([content, 'access', _107 => _107[content.length - 1], 'optionalAccess', _108 => _108.type]);
|
|
1221
1288
|
if (!content.length || lastType === "table") w.empty("w:p");
|
|
1222
1289
|
w.close("w:tc");
|
|
1223
1290
|
}
|
|
@@ -1304,14 +1371,14 @@ var DocxBuilder = (_class3 = class {
|
|
|
1304
1371
|
w.val("w:name", fileStyleName(style.name || style.id));
|
|
1305
1372
|
const base = style.basedOn && byId.has(style.basedOn) && byId.get(style.basedOn).kind === style.kind ? style.basedOn : void 0;
|
|
1306
1373
|
if (base) w.val("w:basedOn", base);
|
|
1307
|
-
if (style.kind === "paragraph" && style.next && _optionalChain([byId, 'access',
|
|
1374
|
+
if (style.kind === "paragraph" && style.next && _optionalChain([byId, 'access', _109 => _109.get, 'call', _110 => _110(style.next), 'optionalAccess', _111 => _111.kind]) === "paragraph") w.val("w:next", style.next);
|
|
1308
1375
|
if (style.linked && byId.has(style.linked)) w.val("w:link", style.linked);
|
|
1309
1376
|
if (style.priority !== void 0 && Number.isFinite(style.priority)) w.val("w:uiPriority", Math.max(0, Math.round(style.priority)));
|
|
1310
1377
|
if (style.hidden) w.empty("w:semiHidden").empty("w:unhideWhenUsed");
|
|
1311
1378
|
if (style.quick) w.empty("w:qFormat");
|
|
1312
1379
|
const block = style.kind === "paragraph" ? blockOf(style) : null;
|
|
1313
1380
|
const ownBlock = style.kind === "paragraph" ? style.block : null;
|
|
1314
|
-
const outline = _optionalChain([ownBlock, 'optionalAccess',
|
|
1381
|
+
const outline = _optionalChain([ownBlock, 'optionalAccess', _112 => _112.type]) === "heading" ? Math.max(0, Math.min(8, (Number(_optionalChain([ownBlock, 'access', _113 => _113.attrs, 'optionalAccess', _114 => _114.level])) || 1) - 1)) : void 0;
|
|
1315
1382
|
if (style.kind === "paragraph" && (style.paragraph || outline !== void 0)) {
|
|
1316
1383
|
const p = new XmlWriter(false);
|
|
1317
1384
|
writeParagraphFormat(p, style.paragraph, outline);
|
|
@@ -1319,7 +1386,7 @@ var DocxBuilder = (_class3 = class {
|
|
|
1319
1386
|
if (xml) w.open("w:pPr").raw(xml).close("w:pPr");
|
|
1320
1387
|
}
|
|
1321
1388
|
const run = characterFormatToRun(style.character);
|
|
1322
|
-
if (_optionalChain([block, 'optionalAccess',
|
|
1389
|
+
if (_optionalChain([block, 'optionalAccess', _115 => _115.type]) === "codeBlock" && !run.font) run.font = "Consolas";
|
|
1323
1390
|
if (hasRunProps(run)) {
|
|
1324
1391
|
w.open("w:rPr");
|
|
1325
1392
|
writeRunProps(w, run);
|
|
@@ -1380,7 +1447,7 @@ var DocxBuilder = (_class3 = class {
|
|
|
1380
1447
|
return { comments: w.toString(), extended: ext.toString() };
|
|
1381
1448
|
}
|
|
1382
1449
|
comment(w, id, author, createdAt, body) {
|
|
1383
|
-
const name = this.authorName(_optionalChain([author, 'optionalAccess',
|
|
1450
|
+
const name = this.authorName(_optionalChain([author, 'optionalAccess', _116 => _116.name]), _optionalChain([author, 'optionalAccess', _117 => _117.id]));
|
|
1384
1451
|
w.open("w:comment", {
|
|
1385
1452
|
"w:id": id,
|
|
1386
1453
|
"w:author": name,
|
|
@@ -1425,7 +1492,7 @@ var DocxBuilder = (_class3 = class {
|
|
|
1425
1492
|
"xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance"
|
|
1426
1493
|
});
|
|
1427
1494
|
if (this.options.title) w.leaf("dc:title", void 0, this.options.title);
|
|
1428
|
-
const creator = this.anonymous ? void 0 : _optionalChain([this, 'access',
|
|
1495
|
+
const creator = this.anonymous ? void 0 : _optionalChain([this, 'access', _118 => _118.defaultAuthor, 'optionalAccess', _119 => _119.name]);
|
|
1429
1496
|
if (creator) w.leaf("dc:creator", void 0, creator).leaf("cp:lastModifiedBy", void 0, creator);
|
|
1430
1497
|
const date = _nullishCoalesce(isoDate(now.getTime()), () => ( "2026-01-01T00:00:00Z"));
|
|
1431
1498
|
w.leaf("dcterms:created", { "xsi:type": "dcterms:W3CDTF" }, date);
|
|
@@ -1465,6 +1532,7 @@ var DocxBuilder = (_class3 = class {
|
|
|
1465
1532
|
if (people) add("word/people.xml", people, `${CT_WML}people+xml`);
|
|
1466
1533
|
parts.push({ name: "word/_rels/document.xml.rels", data: this.rels.xml() });
|
|
1467
1534
|
for (const file of this.media) parts.push({ name: `word/media/${file.name}`, data: file.bytes });
|
|
1535
|
+
this.charts.forEach((xml, i) => add(`word/charts/chart${i + 1}.xml`, xml, _chunk3JNRQVTScjs.CHART_OOXML_CONTENT_TYPE));
|
|
1468
1536
|
add("docProps/core.xml", this.coreXml(now), "application/vnd.openxmlformats-package.core-properties+xml");
|
|
1469
1537
|
const app = new XmlWriter();
|
|
1470
1538
|
app.open("Properties", { xmlns: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" });
|
|
@@ -1488,7 +1556,18 @@ var DocxBuilder = (_class3 = class {
|
|
|
1488
1556
|
];
|
|
1489
1557
|
}
|
|
1490
1558
|
}, _class3);
|
|
1491
|
-
var
|
|
1559
|
+
var SPARK_BARS = "\u2581\u2582\u2583\u2584\u2585\u2586\u2587\u2588";
|
|
1560
|
+
function sparklineText(attrs2) {
|
|
1561
|
+
if (typeof _optionalChain([attrs2, 'optionalAccess', _120 => _120.label]) === "string" && attrs2.label.trim()) return attrs2.label;
|
|
1562
|
+
const values = (Array.isArray(_optionalChain([attrs2, 'optionalAccess', _121 => _121.values])) ? attrs2.values : []).filter(
|
|
1563
|
+
(v) => typeof v === "number" && Number.isFinite(v)
|
|
1564
|
+
);
|
|
1565
|
+
if (!values.length) return "";
|
|
1566
|
+
const min = Math.min(...values);
|
|
1567
|
+
const span = Math.max(...values) - min;
|
|
1568
|
+
return values.map((v) => SPARK_BARS[span ? Math.round((v - min) / span * (SPARK_BARS.length - 1)) : 3]).join("");
|
|
1569
|
+
}
|
|
1570
|
+
var isInlineType = (type) => type === "hardBreak" || type === "image" || type === "mention" || type === "sparkline" || type === "text";
|
|
1492
1571
|
var EXTRA_STYLES = {
|
|
1493
1572
|
BlockText: {
|
|
1494
1573
|
id: "BlockText",
|
|
@@ -1570,8 +1649,8 @@ function resolveInput(input, options) {
|
|
|
1570
1649
|
doc: input.getJSON(),
|
|
1571
1650
|
options: {
|
|
1572
1651
|
...options,
|
|
1573
|
-
comments: options.comments !== void 0 ? options.comments : _nullishCoalesce(_optionalChain([storage, 'access',
|
|
1574
|
-
styles: _nullishCoalesce(_nullishCoalesce(options.styles, () => ( _optionalChain([storage, 'access',
|
|
1652
|
+
comments: options.comments !== void 0 ? options.comments : _nullishCoalesce(_optionalChain([storage, 'access', _122 => _122.comment, 'optionalAccess', _123 => _123.store]), () => ( null)),
|
|
1653
|
+
styles: _nullishCoalesce(_nullishCoalesce(options.styles, () => ( _optionalChain([storage, 'access', _124 => _124.paragraphStyles, 'optionalAccess', _125 => _125.registry]))), () => ( void 0))
|
|
1575
1654
|
}
|
|
1576
1655
|
};
|
|
1577
1656
|
}
|
|
@@ -1583,7 +1662,7 @@ function createDocxParts(input, options = {}) {
|
|
|
1583
1662
|
threadsOf(resolved.options.comments),
|
|
1584
1663
|
stylesOf(resolved.options.styles)
|
|
1585
1664
|
);
|
|
1586
|
-
const parts = builder.parts(_nullishCoalesce(_optionalChain([resolved, 'access',
|
|
1665
|
+
const parts = builder.parts(_nullishCoalesce(_optionalChain([resolved, 'access', _126 => _126.options, 'access', _127 => _127.now, 'optionalCall', _128 => _128()]), () => ( /* @__PURE__ */ new Date())));
|
|
1587
1666
|
return { parts, report: builder.report };
|
|
1588
1667
|
}
|
|
1589
1668
|
async function exportDocx(input, options = {}) {
|
|
@@ -1618,20 +1697,20 @@ function docxFileName(name) {
|
|
|
1618
1697
|
return `${base || "document"}.docx`;
|
|
1619
1698
|
}
|
|
1620
1699
|
var DocxExportController = (_class4 = class {
|
|
1621
|
-
constructor(getSource, options = {}) {;_class4.prototype.
|
|
1700
|
+
constructor(getSource, options = {}) {;_class4.prototype.__init19.call(this);_class4.prototype.__init20.call(this);_class4.prototype.__init21.call(this);_class4.prototype.__init22.call(this);_class4.prototype.__init23.call(this);
|
|
1622
1701
|
this.getSource = getSource;
|
|
1623
1702
|
this.options = options;
|
|
1624
1703
|
}
|
|
1625
1704
|
|
|
1626
1705
|
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1706
|
+
__init19() {this.state = { isExporting: false, error: null, lastReport: null }}
|
|
1707
|
+
__init20() {this.listeners = /* @__PURE__ */ new Set()}
|
|
1708
|
+
__init21() {this.pending = 0}
|
|
1630
1709
|
setOptions(options) {
|
|
1631
1710
|
this.options = options;
|
|
1632
1711
|
}
|
|
1633
|
-
|
|
1634
|
-
|
|
1712
|
+
__init22() {this.getState = () => this.state}
|
|
1713
|
+
__init23() {this.subscribe = (listener) => {
|
|
1635
1714
|
this.listeners.add(listener);
|
|
1636
1715
|
return () => {
|
|
1637
1716
|
this.listeners.delete(listener);
|
|
@@ -1651,7 +1730,7 @@ var DocxExportController = (_class4 = class {
|
|
|
1651
1730
|
const { fileName: _fileName, onExport: _onExport, onError: _onError, ...exportOptions } = this.options;
|
|
1652
1731
|
const result = await exportDocxBlob(source, exportOptions);
|
|
1653
1732
|
this.setState({ lastReport: result.report });
|
|
1654
|
-
_optionalChain([this, 'access',
|
|
1733
|
+
_optionalChain([this, 'access', _129 => _129.options, 'access', _130 => _130.onExport, 'optionalCall', _131 => _131(result.report, result.blob)]);
|
|
1655
1734
|
return result;
|
|
1656
1735
|
} catch (error) {
|
|
1657
1736
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
@@ -1693,4 +1772,4 @@ function createDocxExportController(getSource, options) {
|
|
|
1693
1772
|
|
|
1694
1773
|
|
|
1695
1774
|
exports.stripInvalidXmlChars = stripInvalidXmlChars; exports.escapeXmlText = escapeXmlText; exports.escapeXmlAttr = escapeXmlAttr; exports.XmlWriter = XmlWriter; exports.deflateRaw = deflateRaw; exports.writeZip = writeZip; exports.DOCX_EXPORT_MIME_TYPE = DOCX_EXPORT_MIME_TYPE; exports.DOCX_ANONYMOUS_AUTHOR = DOCX_ANONYMOUS_AUTHOR; exports.createDocxParts = createDocxParts; exports.exportDocx = exportDocx; exports.exportDocxBlob = exportDocxBlob; exports.downloadBlob = downloadBlob; exports.docxFileName = docxFileName; exports.DocxExportController = DocxExportController; exports.createDocxExportController = createDocxExportController;
|
|
1696
|
-
//# sourceMappingURL=chunk-
|
|
1775
|
+
//# sourceMappingURL=chunk-2Q46FKZK.cjs.map
|