@pixerate/editor 0.50.0 → 0.52.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.
Files changed (45) hide show
  1. package/dist/chart/index.cjs +509 -56
  2. package/dist/chart/index.cjs.map +1 -1
  3. package/dist/chart/index.d.cts +194 -7
  4. package/dist/chart/index.d.ts +194 -7
  5. package/dist/chart/index.js +461 -8
  6. package/dist/chart/index.js.map +1 -1
  7. package/dist/{chunk-2Q46FKZK.cjs → chunk-2DEBI6KU.cjs} +23 -23
  8. package/dist/{chunk-2Q46FKZK.cjs.map → chunk-2DEBI6KU.cjs.map} +1 -1
  9. package/dist/{chunk-3JNRQVTS.cjs → chunk-3ZBAXET6.cjs} +323 -3
  10. package/dist/chunk-3ZBAXET6.cjs.map +1 -0
  11. package/dist/{chunk-T6XU4B54.js → chunk-5N6AQCVB.js} +6 -6
  12. package/dist/{chunk-MR2764X2.js → chunk-AGGUNWT6.js} +2 -322
  13. package/dist/chunk-AGGUNWT6.js.map +1 -0
  14. package/dist/{chunk-LNKZPIQD.cjs → chunk-M5Z77GFH.cjs} +21 -21
  15. package/dist/{chunk-LNKZPIQD.cjs.map → chunk-M5Z77GFH.cjs.map} +1 -1
  16. package/dist/{chunk-3CC7OPUQ.cjs → chunk-O6FO6VI3.cjs} +3 -323
  17. package/dist/chunk-O6FO6VI3.cjs.map +1 -0
  18. package/dist/{chunk-GJBIVWB2.js → chunk-UAW5FEMD.js} +322 -2
  19. package/dist/chunk-UAW5FEMD.js.map +1 -0
  20. package/dist/{chunk-DQPBQXKG.js → chunk-YMKPMXZ4.js} +6 -6
  21. package/dist/{controller-DtbEo3om.d.ts → controller-BdKzaxs2.d.ts} +1 -1
  22. package/dist/{controller-ChjCCMLl.d.cts → controller-DS3drIvy.d.cts} +1 -1
  23. package/dist/export/index.cjs +4 -4
  24. package/dist/export/index.js +3 -3
  25. package/dist/extensions/index.cjs +4 -4
  26. package/dist/extensions/index.d.cts +2 -2
  27. package/dist/extensions/index.d.ts +2 -2
  28. package/dist/extensions/index.js +3 -3
  29. package/dist/{index-DoHqT1mq.d.cts → index-DOy9HzfC.d.cts} +1 -1
  30. package/dist/{index-YLZ0fKqE.d.ts → index-Dt9lzydb.d.ts} +1 -1
  31. package/dist/index.cjs +12 -11
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +6 -113
  34. package/dist/index.d.ts +6 -113
  35. package/dist/index.js +10 -9
  36. package/dist/index.js.map +1 -1
  37. package/dist/zip-4nG0YAH7.d.cts +110 -0
  38. package/dist/zip-4nG0YAH7.d.ts +110 -0
  39. package/package.json +1 -1
  40. package/dist/chunk-3CC7OPUQ.cjs.map +0 -1
  41. package/dist/chunk-3JNRQVTS.cjs.map +0 -1
  42. package/dist/chunk-GJBIVWB2.js.map +0 -1
  43. package/dist/chunk-MR2764X2.js.map +0 -1
  44. /package/dist/{chunk-T6XU4B54.js.map → chunk-5N6AQCVB.js.map} +0 -0
  45. /package/dist/{chunk-DQPBQXKG.js.map → chunk-YMKPMXZ4.js.map} +0 -0
@@ -2,14 +2,14 @@
2
2
 
3
3
 
4
4
 
5
+ var _chunkO6FO6VI3cjs = require('./chunk-O6FO6VI3.cjs');
5
6
 
6
- var _chunk3CC7OPUQcjs = require('./chunk-3CC7OPUQ.cjs');
7
7
 
8
8
 
9
9
 
10
10
 
11
11
 
12
- var _chunk3JNRQVTScjs = require('./chunk-3JNRQVTS.cjs');
12
+ var _chunk3ZBAXET6cjs = require('./chunk-3ZBAXET6.cjs');
13
13
 
14
14
 
15
15
  var _chunkJOX6MJW4cjs = require('./chunk-JOX6MJW4.cjs');
@@ -336,7 +336,7 @@ async function writeZip(entries, options = {}) {
336
336
  const body = useDeflate ? deflated : raw;
337
337
  const method = useDeflate ? 8 : 0;
338
338
  const nameBytes = encoder.encode(name);
339
- const crc = _chunk3CC7OPUQcjs.zipCrc32.call(void 0, raw);
339
+ const crc = _chunk3ZBAXET6cjs.zipCrc32.call(void 0, raw);
340
340
  const offset = out.length;
341
341
  if (body.length > MAX_SIZE || raw.length > MAX_SIZE || offset > MAX_SIZE) {
342
342
  throw new RangeError("ZIP archive too large (no ZIP64 support).");
@@ -464,7 +464,7 @@ function threadsOf(source) {
464
464
  return Array.isArray(value.threads) ? [...value.threads] : [];
465
465
  }
466
466
  function stylesOf(source) {
467
- if (!source) return { styles: _chunk3CC7OPUQcjs.DEFAULT_STYLES.map((s) => ({ ...s })), defaults: {} };
467
+ if (!source) return { styles: _chunkO6FO6VI3cjs.DEFAULT_STYLES.map((s) => ({ ...s })), defaults: {} };
468
468
  if (Array.isArray(source)) return { styles: [...source], defaults: {} };
469
469
  const value = source;
470
470
  const json = typeof value.toJSON === "function" ? value.toJSON() : value;
@@ -532,7 +532,7 @@ function runFormatOf(marks) {
532
532
  break;
533
533
  }
534
534
  case "characterStyle":
535
- if (_chunk3CC7OPUQcjs.isValidStyleId.call(void 0, attrs2.styleId)) format.charStyle = attrs2.styleId;
535
+ if (_chunkO6FO6VI3cjs.isValidStyleId.call(void 0, attrs2.styleId)) format.charStyle = attrs2.styleId;
536
536
  break;
537
537
  case "link":
538
538
  format.charStyle ??= "Hyperlink";
@@ -670,7 +670,7 @@ var DocxBuilder = (_class3 = class {
670
670
  this.styles = styles;
671
671
  this.anonymous = options.privacy === "strip-authors";
672
672
  this.defaultAuthor = authorOf(options.author);
673
- this.styleIds = new Set(styles.styles.filter((s) => _chunk3CC7OPUQcjs.isValidStyleId.call(void 0, s.id)).map((s) => s.id));
673
+ this.styleIds = new Set(styles.styles.filter((s) => _chunkO6FO6VI3cjs.isValidStyleId.call(void 0, s.id)).map((s) => s.id));
674
674
  }
675
675
 
676
676
 
@@ -861,7 +861,7 @@ var DocxBuilder = (_class3 = class {
861
861
  styleFor(node, ctx, opts) {
862
862
  const own = _optionalChain([node, 'access', _37 => _37.attrs, 'optionalAccess', _38 => _38.styleId]);
863
863
  if (own) {
864
- if (_chunk3CC7OPUQcjs.isValidStyleId.call(void 0, own) && this.styleIds.has(own)) return own;
864
+ if (_chunkO6FO6VI3cjs.isValidStyleId.call(void 0, own) && this.styleIds.has(own)) return own;
865
865
  this.drop("style", String(own), "style is not in the registry");
866
866
  }
867
867
  if (opts.heading) return this.needStyle(`Heading${opts.heading}`);
@@ -878,7 +878,7 @@ var DocxBuilder = (_class3 = class {
878
878
  previousStyle(previous) {
879
879
  if (!previous) return void 0;
880
880
  const id = _optionalChain([previous, 'access', _39 => _39.attrs, 'optionalAccess', _40 => _40.styleId]);
881
- if (_chunk3CC7OPUQcjs.isValidStyleId.call(void 0, id) && this.styleIds.has(id)) return id;
881
+ if (_chunkO6FO6VI3cjs.isValidStyleId.call(void 0, id) && this.styleIds.has(id)) return id;
882
882
  if (previous.type === "heading") return this.needStyle(`Heading${Math.max(1, Math.min(6, Number(_optionalChain([previous, 'access', _41 => _41.attrs, 'optionalAccess', _42 => _42.level])) || 1))}`);
883
883
  if (previous.type === "codeBlock") return this.needStyle("Code");
884
884
  return void 0;
@@ -1177,11 +1177,11 @@ var DocxBuilder = (_class3 = class {
1177
1177
  return;
1178
1178
  }
1179
1179
  const spec = _chunkJOX6MJW4cjs.normalizeChartSpec.call(void 0, raw).spec;
1180
- const written = _chunk3JNRQVTScjs.chartToOoxml.call(void 0, spec);
1180
+ const written = _chunk3ZBAXET6cjs.chartToOoxml.call(void 0, spec);
1181
1181
  for (const issue of written.issues) this.drop("node", "chart", issue);
1182
1182
  const name = `chart${this.charts.length + 1}.xml`;
1183
1183
  this.charts.push(written.xml);
1184
- const relId = this.rels.add(_chunk3JNRQVTScjs.CHART_OOXML_RELATIONSHIP, `charts/${name}`);
1184
+ const relId = this.rels.add(_chunk3ZBAXET6cjs.CHART_OOXML_RELATIONSHIP, `charts/${name}`);
1185
1185
  let width = _nullishCoalesce(pixelAttr(_optionalChain([node, 'access', _91 => _91.attrs, 'optionalAccess', _92 => _92.width])), () => ( MAX_IMAGE_WIDTH_PX));
1186
1186
  let height = _nullishCoalesce(pixelAttr(_optionalChain([node, 'access', _93 => _93.attrs, 'optionalAccess', _94 => _94.height])), () => ( 320));
1187
1187
  if (width > MAX_IMAGE_WIDTH_PX) {
@@ -1198,8 +1198,8 @@ var DocxBuilder = (_class3 = class {
1198
1198
  drawing.empty("wp:extent", { cx, cy }).empty("wp:effectExtent", { l: 0, t: 0, r: 0, b: 0 });
1199
1199
  drawing.empty("wp:docPr", { id, name: `Chart ${id}`, descr: title || void 0, title: title || void 0 });
1200
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 });
1201
+ drawing.open("a:graphic").open("a:graphicData", { uri: _chunk3ZBAXET6cjs.CHART_OOXML_NS });
1202
+ drawing.empty("c:chart", { "xmlns:c": _chunk3ZBAXET6cjs.CHART_OOXML_NS, "r:id": relId });
1203
1203
  drawing.close("a:graphicData").close("a:graphic").close("wp:inline").close("w:drawing").close("w:r");
1204
1204
  this.report.written.paragraphs++;
1205
1205
  w.open("w:p");
@@ -1348,7 +1348,7 @@ var DocxBuilder = (_class3 = class {
1348
1348
  if (defaults.paragraph && Object.keys(defaults.paragraph).length) writeParagraphFormat(w, defaults.paragraph);
1349
1349
  else w.empty("w:spacing", { "w:after": 160, "w:line": 259, "w:lineRule": "auto" });
1350
1350
  w.close("w:pPr").close("w:pPrDefault").close("w:docDefaults");
1351
- const byId = new Map(this.styles.styles.filter((s) => _chunk3CC7OPUQcjs.isValidStyleId.call(void 0, s.id)).map((s) => [s.id, s]));
1351
+ const byId = new Map(this.styles.styles.filter((s) => _chunkO6FO6VI3cjs.isValidStyleId.call(void 0, s.id)).map((s) => [s.id, s]));
1352
1352
  const written = /* @__PURE__ */ new Set();
1353
1353
  const blockOf = (style) => {
1354
1354
  let current = style;
@@ -1361,7 +1361,7 @@ var DocxBuilder = (_class3 = class {
1361
1361
  const writeStyle = (style) => {
1362
1362
  if (written.has(style.id)) return;
1363
1363
  written.add(style.id);
1364
- const isNormal = style.kind === "paragraph" && style.id === _chunk3CC7OPUQcjs.NORMAL_STYLE_ID;
1364
+ const isNormal = style.kind === "paragraph" && style.id === _chunkO6FO6VI3cjs.NORMAL_STYLE_ID;
1365
1365
  w.open("w:style", {
1366
1366
  "w:type": style.kind === "character" ? "character" : "paragraph",
1367
1367
  "w:default": isNormal ? 1 : void 0,
@@ -1403,7 +1403,7 @@ var DocxBuilder = (_class3 = class {
1403
1403
  byId.forEach((style) => visit(style));
1404
1404
  for (const id of this.extraStyles) {
1405
1405
  if (written.has(id)) continue;
1406
- const extra = _nullishCoalesce(EXTRA_STYLES[id], () => ( { id, name: id, kind: "paragraph", basedOn: _chunk3CC7OPUQcjs.NORMAL_STYLE_ID }));
1406
+ const extra = _nullishCoalesce(EXTRA_STYLES[id], () => ( { id, name: id, kind: "paragraph", basedOn: _chunkO6FO6VI3cjs.NORMAL_STYLE_ID }));
1407
1407
  byId.set(id, extra);
1408
1408
  writeStyle(extra);
1409
1409
  }
@@ -1532,7 +1532,7 @@ var DocxBuilder = (_class3 = class {
1532
1532
  if (people) add("word/people.xml", people, `${CT_WML}people+xml`);
1533
1533
  parts.push({ name: "word/_rels/document.xml.rels", data: this.rels.xml() });
1534
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));
1535
+ this.charts.forEach((xml, i) => add(`word/charts/chart${i + 1}.xml`, xml, _chunk3ZBAXET6cjs.CHART_OOXML_CONTENT_TYPE));
1536
1536
  add("docProps/core.xml", this.coreXml(now), "application/vnd.openxmlformats-package.core-properties+xml");
1537
1537
  const app = new XmlWriter();
1538
1538
  app.open("Properties", { xmlns: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" });
@@ -1573,7 +1573,7 @@ var EXTRA_STYLES = {
1573
1573
  id: "BlockText",
1574
1574
  name: "Block Text",
1575
1575
  kind: "paragraph",
1576
- basedOn: _chunk3CC7OPUQcjs.NORMAL_STYLE_ID,
1576
+ basedOn: _chunkO6FO6VI3cjs.NORMAL_STYLE_ID,
1577
1577
  paragraph: { indentLeft: "0.5in", indentRight: "0.5in" },
1578
1578
  character: { italic: true },
1579
1579
  priority: 99,
@@ -1583,7 +1583,7 @@ var EXTRA_STYLES = {
1583
1583
  id: "ListParagraph",
1584
1584
  name: "List Paragraph",
1585
1585
  kind: "paragraph",
1586
- basedOn: _chunk3CC7OPUQcjs.NORMAL_STYLE_ID,
1586
+ basedOn: _chunkO6FO6VI3cjs.NORMAL_STYLE_ID,
1587
1587
  paragraph: { indentLeft: "0.5in" },
1588
1588
  priority: 34,
1589
1589
  quick: true,
@@ -1593,7 +1593,7 @@ var EXTRA_STYLES = {
1593
1593
  id: "Code",
1594
1594
  name: "Code",
1595
1595
  kind: "paragraph",
1596
- basedOn: _chunk3CC7OPUQcjs.NORMAL_STYLE_ID,
1596
+ basedOn: _chunkO6FO6VI3cjs.NORMAL_STYLE_ID,
1597
1597
  block: { type: "codeBlock" },
1598
1598
  character: { fontFamily: "Consolas", fontSize: "10pt" },
1599
1599
  paragraph: { spaceAfter: "0pt", lineHeight: "1" },
@@ -1621,7 +1621,7 @@ var EXTRA_STYLES = {
1621
1621
  id: "CommentText",
1622
1622
  name: "annotation text",
1623
1623
  kind: "paragraph",
1624
- basedOn: _chunk3CC7OPUQcjs.NORMAL_STYLE_ID,
1624
+ basedOn: _chunkO6FO6VI3cjs.NORMAL_STYLE_ID,
1625
1625
  character: { fontSize: "10pt" },
1626
1626
  priority: 99,
1627
1627
  hidden: true,
@@ -1633,8 +1633,8 @@ for (let level = 1; level <= 6; level++) {
1633
1633
  id: `Heading${level}`,
1634
1634
  name: `Heading ${level}`,
1635
1635
  kind: "paragraph",
1636
- basedOn: _chunk3CC7OPUQcjs.NORMAL_STYLE_ID,
1637
- next: _chunk3CC7OPUQcjs.NORMAL_STYLE_ID,
1636
+ basedOn: _chunkO6FO6VI3cjs.NORMAL_STYLE_ID,
1637
+ next: _chunkO6FO6VI3cjs.NORMAL_STYLE_ID,
1638
1638
  block: { type: "heading", attrs: { level } },
1639
1639
  character: { bold: true },
1640
1640
  priority: 9,
@@ -1772,4 +1772,4 @@ function createDocxExportController(getSource, options) {
1772
1772
 
1773
1773
 
1774
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;
1775
- //# sourceMappingURL=chunk-2Q46FKZK.cjs.map
1775
+ //# sourceMappingURL=chunk-2DEBI6KU.cjs.map