js.documents 7.11.7 → 7.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/convert/port.d.cts +2 -2
- package/dist/convert/port.d.ts +2 -2
- package/dist/edit/ods/floating.cjs +12 -6
- package/dist/edit/ods/floating.d.cts +1 -1
- package/dist/edit/ods/floating.d.ts +1 -1
- package/dist/edit/ods/floating.js +13 -7
- package/dist/edit/ods/sheet.cjs +7 -1
- package/dist/edit/ods/sheet.d.cts +2 -0
- package/dist/edit/ods/sheet.d.ts +2 -0
- package/dist/edit/ods/sheet.js +7 -1
- package/dist/edit/odt/editor.cjs +6 -0
- package/dist/edit/odt/editor.js +7 -1
- package/package.json +2 -2
package/dist/convert/port.d.cts
CHANGED
|
@@ -4,7 +4,6 @@ import { MarkdownImageResolver } from "markdown-codec";
|
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region src/convert/port.d.ts
|
|
6
6
|
declare const DocumentFormatSchema: z.ZodEnum<{
|
|
7
|
-
wpd: "wpd";
|
|
8
7
|
docx: "docx";
|
|
9
8
|
pptx: "pptx";
|
|
10
9
|
xlsx: "xlsx";
|
|
@@ -13,14 +12,15 @@ declare const DocumentFormatSchema: z.ZodEnum<{
|
|
|
13
12
|
ods: "ods";
|
|
14
13
|
odg: "odg";
|
|
15
14
|
svg: "svg";
|
|
15
|
+
odf: "odf";
|
|
16
16
|
csv: "csv";
|
|
17
17
|
markdown: "markdown";
|
|
18
18
|
rtf: "rtf";
|
|
19
19
|
doc: "doc";
|
|
20
20
|
xls: "xls";
|
|
21
21
|
ppt: "ppt";
|
|
22
|
+
wpd: "wpd";
|
|
22
23
|
epub: "epub";
|
|
23
|
-
odf: "odf";
|
|
24
24
|
pdf: "pdf";
|
|
25
25
|
}>;
|
|
26
26
|
type DocumentFormat = z.infer<typeof DocumentFormatSchema>;
|
package/dist/convert/port.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { z } from "zod";
|
|
|
4
4
|
import { MarkdownImageResolver } from "markdown-codec";
|
|
5
5
|
//#region src/convert/port.d.ts
|
|
6
6
|
declare const DocumentFormatSchema: z.ZodEnum<{
|
|
7
|
-
wpd: "wpd";
|
|
8
7
|
docx: "docx";
|
|
9
8
|
pptx: "pptx";
|
|
10
9
|
xlsx: "xlsx";
|
|
@@ -13,14 +12,15 @@ declare const DocumentFormatSchema: z.ZodEnum<{
|
|
|
13
12
|
ods: "ods";
|
|
14
13
|
odg: "odg";
|
|
15
14
|
svg: "svg";
|
|
15
|
+
odf: "odf";
|
|
16
16
|
csv: "csv";
|
|
17
17
|
markdown: "markdown";
|
|
18
18
|
rtf: "rtf";
|
|
19
19
|
doc: "doc";
|
|
20
20
|
xls: "xls";
|
|
21
21
|
ppt: "ppt";
|
|
22
|
+
wpd: "wpd";
|
|
22
23
|
epub: "epub";
|
|
23
|
-
odf: "odf";
|
|
24
24
|
pdf: "pdf";
|
|
25
25
|
}>;
|
|
26
26
|
type DocumentFormat = z.infer<typeof DocumentFormatSchema>;
|
|
@@ -78,12 +78,18 @@ function insertSheetImage(pkg, tableElement, image) {
|
|
|
78
78
|
const frame = buildAbsoluteFrame(xPt, yPt, image.widthPt, image.heightPt, imageElement);
|
|
79
79
|
ensureTableShapes(tableElement).children.push(frame);
|
|
80
80
|
}
|
|
81
|
-
function insertSheetEmbeddedObject(pkg, tableElement, object) {
|
|
82
|
-
if (object.document.kind
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
function insertSheetEmbeddedObject(pkg, tableElement, object, nextObjectName) {
|
|
82
|
+
if (object.document.kind === "formula") {
|
|
83
|
+
const { href } = require_odf_package_formula.addFormulaObject(pkg, object.document.formula);
|
|
84
|
+
insertObjectFrame(tableElement, object.frame, require_xml_fragment.el("draw:object", { "xlink:href": href }));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (object.objectKind === "chart") return;
|
|
88
|
+
insertObjectFrame(tableElement, object.frame, (0, odf_js.writeEmbeddedObject)(object, nextObjectName(), pkg));
|
|
89
|
+
}
|
|
90
|
+
function insertObjectFrame(tableElement, frame, objectElement) {
|
|
91
|
+
const frameElement = buildAbsoluteFrame(frame.xPt, frame.yPt, frame.widthPt, frame.heightPt, objectElement);
|
|
92
|
+
ensureTableShapes(tableElement).children.push(frameElement);
|
|
87
93
|
}
|
|
88
94
|
//#endregion
|
|
89
95
|
exports.insertSheetEmbeddedObject = insertSheetEmbeddedObject;
|
|
@@ -2,6 +2,6 @@ import { ContentEmbeddedObject, ContentSheetImage } from "document-schema.js";
|
|
|
2
2
|
import { Package, XmlElement } from "odf.js";
|
|
3
3
|
//#region src/edit/ods/floating.d.ts
|
|
4
4
|
declare function insertSheetImage(pkg: Package, tableElement: XmlElement, image: ContentSheetImage): void;
|
|
5
|
-
declare function insertSheetEmbeddedObject(pkg: Package, tableElement: XmlElement, object: ContentEmbeddedObject): void;
|
|
5
|
+
declare function insertSheetEmbeddedObject(pkg: Package, tableElement: XmlElement, object: ContentEmbeddedObject, nextObjectName: () => string): void;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { insertSheetEmbeddedObject, insertSheetImage };
|
|
@@ -2,6 +2,6 @@ import { ContentEmbeddedObject, ContentSheetImage } from "document-schema.js";
|
|
|
2
2
|
import { Package, XmlElement } from "odf.js";
|
|
3
3
|
//#region src/edit/ods/floating.d.ts
|
|
4
4
|
declare function insertSheetImage(pkg: Package, tableElement: XmlElement, image: ContentSheetImage): void;
|
|
5
|
-
declare function insertSheetEmbeddedObject(pkg: Package, tableElement: XmlElement, object: ContentEmbeddedObject): void;
|
|
5
|
+
declare function insertSheetEmbeddedObject(pkg: Package, tableElement: XmlElement, object: ContentEmbeddedObject, nextObjectName: () => string): void;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { insertSheetEmbeddedObject, insertSheetImage };
|
|
@@ -4,7 +4,7 @@ import { addFormulaObject } from "../../odf-package/formula.js";
|
|
|
4
4
|
import { addImageMedia } from "../../odf-package/media.js";
|
|
5
5
|
import { COLUMN_REPEAT_ATTR, COLUMN_TAG, HEADER_COLUMNS_TAG, HEADER_ROWS_TAG, ROW_REPEAT_ATTR, ROW_TAG, collectRunMembers, isElementWithTag, readRunRepeatCount } from "./address.js";
|
|
6
6
|
import { attr } from "ooxml.js";
|
|
7
|
-
import { base64ToBytes as base64ToBytes$1, findStyleElement, formatOdfLength, parseOdfLength } from "odf.js";
|
|
7
|
+
import { base64ToBytes as base64ToBytes$1, findStyleElement, formatOdfLength, parseOdfLength, writeEmbeddedObject } from "odf.js";
|
|
8
8
|
//#region src/edit/ods/floating.ts
|
|
9
9
|
const SHAPES_TAG = "table:shapes";
|
|
10
10
|
const DEFAULT_COLUMN_WIDTH_PT = 64;
|
|
@@ -77,12 +77,18 @@ function insertSheetImage(pkg, tableElement, image) {
|
|
|
77
77
|
const frame = buildAbsoluteFrame(xPt, yPt, image.widthPt, image.heightPt, imageElement);
|
|
78
78
|
ensureTableShapes(tableElement).children.push(frame);
|
|
79
79
|
}
|
|
80
|
-
function insertSheetEmbeddedObject(pkg, tableElement, object) {
|
|
81
|
-
if (object.document.kind
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
function insertSheetEmbeddedObject(pkg, tableElement, object, nextObjectName) {
|
|
81
|
+
if (object.document.kind === "formula") {
|
|
82
|
+
const { href } = addFormulaObject(pkg, object.document.formula);
|
|
83
|
+
insertObjectFrame(tableElement, object.frame, el("draw:object", { "xlink:href": href }));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (object.objectKind === "chart") return;
|
|
87
|
+
insertObjectFrame(tableElement, object.frame, writeEmbeddedObject(object, nextObjectName(), pkg));
|
|
88
|
+
}
|
|
89
|
+
function insertObjectFrame(tableElement, frame, objectElement) {
|
|
90
|
+
const frameElement = buildAbsoluteFrame(frame.xPt, frame.yPt, frame.widthPt, frame.heightPt, objectElement);
|
|
91
|
+
ensureTableShapes(tableElement).children.push(frameElement);
|
|
86
92
|
}
|
|
87
93
|
//#endregion
|
|
88
94
|
export { insertSheetEmbeddedObject, insertSheetImage };
|
package/dist/edit/ods/sheet.cjs
CHANGED
|
@@ -53,7 +53,13 @@ var OdsSheet = class {
|
|
|
53
53
|
require_edit_ods_floating.insertSheetImage(this.pkg, this.live(), image);
|
|
54
54
|
}
|
|
55
55
|
addEmbeddedObject(object) {
|
|
56
|
-
require_edit_ods_floating.insertSheetEmbeddedObject(this.pkg, this.live(), object);
|
|
56
|
+
require_edit_ods_floating.insertSheetEmbeddedObject(this.pkg, this.live(), object, () => `Object ${this.nextEmbeddedObjectName()}`);
|
|
57
|
+
}
|
|
58
|
+
nextEmbeddedObjectNameCounter = 1;
|
|
59
|
+
nextEmbeddedObjectName() {
|
|
60
|
+
const name = String(this.nextEmbeddedObjectNameCounter);
|
|
61
|
+
this.nextEmbeddedObjectNameCounter += 1;
|
|
62
|
+
return name;
|
|
57
63
|
}
|
|
58
64
|
cell(row, column) {
|
|
59
65
|
const tableElement = this.live();
|
|
@@ -19,6 +19,8 @@ declare class OdsSheet {
|
|
|
19
19
|
setRowHidden(index: number, hidden: boolean): void;
|
|
20
20
|
addImage(image: ContentSheetImage): void;
|
|
21
21
|
addEmbeddedObject(object: ContentEmbeddedObject): void;
|
|
22
|
+
private nextEmbeddedObjectNameCounter;
|
|
23
|
+
private nextEmbeddedObjectName;
|
|
22
24
|
cell(row: number, column: number): OdsCell;
|
|
23
25
|
cellAt(reference: string): OdsCell;
|
|
24
26
|
mergeCells(startRow: number, startColumn: number, rowSpan: number, colSpan: number): OdsCell;
|
package/dist/edit/ods/sheet.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ declare class OdsSheet {
|
|
|
19
19
|
setRowHidden(index: number, hidden: boolean): void;
|
|
20
20
|
addImage(image: ContentSheetImage): void;
|
|
21
21
|
addEmbeddedObject(object: ContentEmbeddedObject): void;
|
|
22
|
+
private nextEmbeddedObjectNameCounter;
|
|
23
|
+
private nextEmbeddedObjectName;
|
|
22
24
|
cell(row: number, column: number): OdsCell;
|
|
23
25
|
cellAt(reference: string): OdsCell;
|
|
24
26
|
mergeCells(startRow: number, startColumn: number, rowSpan: number, colSpan: number): OdsCell;
|
package/dist/edit/ods/sheet.js
CHANGED
|
@@ -52,7 +52,13 @@ var OdsSheet = class {
|
|
|
52
52
|
insertSheetImage(this.pkg, this.live(), image);
|
|
53
53
|
}
|
|
54
54
|
addEmbeddedObject(object) {
|
|
55
|
-
insertSheetEmbeddedObject(this.pkg, this.live(), object);
|
|
55
|
+
insertSheetEmbeddedObject(this.pkg, this.live(), object, () => `Object ${this.nextEmbeddedObjectName()}`);
|
|
56
|
+
}
|
|
57
|
+
nextEmbeddedObjectNameCounter = 1;
|
|
58
|
+
nextEmbeddedObjectName() {
|
|
59
|
+
const name = String(this.nextEmbeddedObjectNameCounter);
|
|
60
|
+
this.nextEmbeddedObjectNameCounter += 1;
|
|
61
|
+
return name;
|
|
56
62
|
}
|
|
57
63
|
cell(row, column) {
|
|
58
64
|
const tableElement = this.live();
|
package/dist/edit/odt/editor.cjs
CHANGED
|
@@ -56,6 +56,12 @@ var OdtBodyImpl = class {
|
|
|
56
56
|
this.officeText.children.push(paragraphElement);
|
|
57
57
|
return new require_edit_odt_paragraph.OdtParagraph(this.officeText.children, paragraphElement, this.pkg);
|
|
58
58
|
}
|
|
59
|
+
appendEmbeddedObject(object, directory) {
|
|
60
|
+
const paragraphElement = require_edit_odt_paragraph.buildParagraph(this.pkg);
|
|
61
|
+
paragraphElement.children.push((0, odf_js.writeEmbeddedObject)(object, directory, this.pkg));
|
|
62
|
+
this.officeText.children.push(paragraphElement);
|
|
63
|
+
return new require_edit_odt_paragraph.OdtParagraph(this.officeText.children, paragraphElement, this.pkg);
|
|
64
|
+
}
|
|
59
65
|
appendVectors(vectors) {
|
|
60
66
|
const paragraphElement = require_edit_odt_paragraph.buildParagraph(this.pkg);
|
|
61
67
|
for (const vector of vectors) paragraphElement.children.push(require_edit_odg_vector.buildVectorElement(this.pkg, vector, { textFlowAnchored: true }));
|
package/dist/edit/odt/editor.js
CHANGED
|
@@ -9,7 +9,7 @@ import { OdtParagraph, buildParagraph } from "./paragraph.js";
|
|
|
9
9
|
import { OdtList, buildList } from "./list.js";
|
|
10
10
|
import { createEmptyOdtPackage } from "./scaffold.js";
|
|
11
11
|
import { OdtTable, buildTable } from "./table.js";
|
|
12
|
-
import { decodePackage, encodePackage, readOdfMetadata } from "odf.js";
|
|
12
|
+
import { decodePackage, encodePackage, readOdfMetadata, writeEmbeddedObject } from "odf.js";
|
|
13
13
|
//#region src/edit/odt/editor.ts
|
|
14
14
|
const CONTENT_PART_PATH = "content.xml";
|
|
15
15
|
function findContentRoot(pkg) {
|
|
@@ -55,6 +55,12 @@ var OdtBodyImpl = class {
|
|
|
55
55
|
this.officeText.children.push(paragraphElement);
|
|
56
56
|
return new OdtParagraph(this.officeText.children, paragraphElement, this.pkg);
|
|
57
57
|
}
|
|
58
|
+
appendEmbeddedObject(object, directory) {
|
|
59
|
+
const paragraphElement = buildParagraph(this.pkg);
|
|
60
|
+
paragraphElement.children.push(writeEmbeddedObject(object, directory, this.pkg));
|
|
61
|
+
this.officeText.children.push(paragraphElement);
|
|
62
|
+
return new OdtParagraph(this.officeText.children, paragraphElement, this.pkg);
|
|
63
|
+
}
|
|
58
64
|
appendVectors(vectors) {
|
|
59
65
|
const paragraphElement = buildParagraph(this.pkg);
|
|
60
66
|
for (const vector of vectors) paragraphElement.children.push(buildVectorElement(this.pkg, vector, { textFlowAnchored: true }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js.documents",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.12.0",
|
|
4
4
|
"description": "Bidirectional docx/pptx <-> PDF conversion and a read+write editable OOXML document model, built on ooxml.js and Zod 4 codecs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"epub-codec": "1.3.3",
|
|
85
85
|
"fflate": "0.8.3",
|
|
86
86
|
"markdown-codec": "6.6.0",
|
|
87
|
-
"odf.js": "7.
|
|
87
|
+
"odf.js": "7.19.0",
|
|
88
88
|
"ooxml.js": "8.9.0",
|
|
89
89
|
"pdf-codec": "4.1.0",
|
|
90
90
|
"ppt-codec": "1.4.4",
|