odf.js 1.5.0 → 1.6.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/README.md +4 -3
- package/dist/index.cjs +563 -35
- package/dist/index.d.cts +53 -2
- package/dist/index.d.ts +53 -2
- package/dist/index.js +554 -36
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { Alignment, AlignmentSchema, Box, Color, ContentParagraph, ContentSection, ContentShape, ContentSlide, ContentTable, LayoutMetadata, Margins, PageSize } from "document-content-model";
|
|
2
|
+
import { Alignment, AlignmentSchema, Box, Color, ContentDrawPage, ContentParagraph, ContentPathPoint, ContentSection, ContentShape, ContentSlide, ContentSubpath, ContentTable, ContentVector, LayoutMetadata, Margins, PageSize } from "document-content-model";
|
|
3
3
|
//#region src/model/node.d.ts
|
|
4
4
|
declare const AttributeSchema: z.ZodObject<{
|
|
5
5
|
name: z.ZodString;
|
|
@@ -503,6 +503,10 @@ declare function formatOdfColor(color: Color): string;
|
|
|
503
503
|
declare function parsePageSize(pageLayoutProperties: XmlElement): PageSize | undefined;
|
|
504
504
|
declare function parseMargins(pageLayoutProperties: XmlElement): Margins | undefined;
|
|
505
505
|
declare function parseBox(element: XmlElement): Box | undefined;
|
|
506
|
+
declare function parseLinePoints(element: XmlElement): {
|
|
507
|
+
from: ContentPathPoint;
|
|
508
|
+
to: ContentPathPoint;
|
|
509
|
+
} | undefined;
|
|
506
510
|
//#endregion
|
|
507
511
|
//#region src/typed/shared/text.d.ts
|
|
508
512
|
declare function getOdfSpaceCount(element: XmlElement): number;
|
|
@@ -560,9 +564,49 @@ interface OdfShapeGeometry {
|
|
|
560
564
|
declare function resolveOdfShapeGeometry(element: XmlElement): OdfShapeGeometry | undefined;
|
|
561
565
|
declare function composeOdfGroupTransform(groupFunctions: readonly OdfTransformFunction[], child: OdfShapeGeometry): OdfShapeGeometry;
|
|
562
566
|
//#endregion
|
|
567
|
+
//#region src/typed/shared/masterpage.d.ts
|
|
568
|
+
declare function resolveDrawPageSize(page: XmlElement, pkg: Package): PageSize | undefined;
|
|
569
|
+
//#endregion
|
|
570
|
+
//#region src/typed/shared/path.d.ts
|
|
571
|
+
interface OdfRawPoint {
|
|
572
|
+
readonly x: number;
|
|
573
|
+
readonly y: number;
|
|
574
|
+
}
|
|
575
|
+
type OdfRawSegment = {
|
|
576
|
+
readonly kind: 'line';
|
|
577
|
+
readonly to: OdfRawPoint;
|
|
578
|
+
} | {
|
|
579
|
+
readonly kind: 'cubic';
|
|
580
|
+
readonly control1: OdfRawPoint;
|
|
581
|
+
readonly control2: OdfRawPoint;
|
|
582
|
+
readonly to: OdfRawPoint;
|
|
583
|
+
};
|
|
584
|
+
interface OdfRawSubpath {
|
|
585
|
+
readonly start: OdfRawPoint;
|
|
586
|
+
readonly segments: readonly OdfRawSegment[];
|
|
587
|
+
readonly closed: boolean;
|
|
588
|
+
}
|
|
589
|
+
interface OdfViewBox {
|
|
590
|
+
readonly minX: number;
|
|
591
|
+
readonly minY: number;
|
|
592
|
+
readonly width: number;
|
|
593
|
+
readonly height: number;
|
|
594
|
+
}
|
|
595
|
+
declare function parseOdfViewBox(value: string): OdfViewBox | undefined;
|
|
596
|
+
declare function parseOdfPointsList(value: string): OdfRawPoint[];
|
|
597
|
+
declare function rawSubpathFromPoints(points: readonly OdfRawPoint[], closed: boolean): OdfRawSubpath | undefined;
|
|
598
|
+
declare function parseOdfPathData(d: string): OdfRawSubpath[];
|
|
599
|
+
declare function scaleOdfRawPoint(point: OdfRawPoint, viewBox: OdfViewBox, frame: Box): ContentPathPoint;
|
|
600
|
+
declare function buildOdfSubpaths(rawSubpaths: readonly OdfRawSubpath[], viewBox: OdfViewBox, frame: Box): ContentSubpath[];
|
|
601
|
+
//#endregion
|
|
563
602
|
//#region src/typed/draw/shapes.d.ts
|
|
564
603
|
declare function readDrawFrame(frame: XmlElement, groupFunctions: readonly OdfTransformFunction[], pkg: Package): ContentShape | undefined;
|
|
565
604
|
declare function walkDrawShapes(children: readonly XmlNode[], groupFunctions: readonly OdfTransformFunction[], pkg: Package, out: ContentShape[]): void;
|
|
605
|
+
interface DrawPageContent {
|
|
606
|
+
readonly shapes: ContentShape[];
|
|
607
|
+
readonly vectors: ContentVector[];
|
|
608
|
+
}
|
|
609
|
+
declare function readDrawPageContent(children: readonly XmlNode[], pkg: Package): DrawPageContent;
|
|
566
610
|
//#endregion
|
|
567
611
|
//#region src/typed/odp/read.d.ts
|
|
568
612
|
interface OdpDocument {
|
|
@@ -578,4 +622,11 @@ interface OdtDocument {
|
|
|
578
622
|
}
|
|
579
623
|
declare function readOdt(pkg: Package): OdtDocument;
|
|
580
624
|
//#endregion
|
|
581
|
-
|
|
625
|
+
//#region src/typed/odg/read.d.ts
|
|
626
|
+
interface OdgDocument {
|
|
627
|
+
metadata: LayoutMetadata;
|
|
628
|
+
pages: ContentDrawPage[];
|
|
629
|
+
}
|
|
630
|
+
declare function readOdg(pkg: Package): OdgDocument;
|
|
631
|
+
//#endregion
|
|
632
|
+
export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, type DrawPageContent, type ImageFormat, type InternRequest, type LengthUnit, MANIFEST_PART, META_PART, MIMETYPE_PART, type Manifest, type ManifestEntry, ManifestEntrySchema, type ManifestProblem, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, type OdfExtension, type OdfNamespacePrefix, type OdfPoint, type OdfRawPoint, type OdfRawSegment, type OdfRawSubpath, type OdfShapeGeometry, type OdfTransformFunction, type OdfViewBox, type OdgDocument, type OdpDocument, type OdtDocument, type OtherPartRef, type Package, PackageSchema, type ParsedProperties, type Part, PartSchema, STYLE_FAMILIES, type StyleCascadeResult, type StyleElementChainResult, type StyleFamily, type StyleProperties, StylePropertiesSchema, StyleRegistry, type StyleRegistryOptions, TableCursor, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, type ZipEntry, applyOdfTransform, attrValue, base64ToBytes, buildManifest, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseLength, parseLinePoints, parseMargins, parseOdfColor, parseOdfLength, parseOdfPathData, parseOdfPointsList, parseOdfTransform, parseOdfViewBox, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, rawSubpathFromPoints, readDrawFrame, readDrawPageContent, readManifest, readMimetype, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdp, readOdt, resolveDrawPageSize, resolveOdfShapeGeometry, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, serializePackage, setDocumentMediaType, sniffImageFormat, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { Alignment, AlignmentSchema, Box, Color, ContentParagraph, ContentSection, ContentShape, ContentSlide, ContentTable, LayoutMetadata, Margins, PageSize } from "document-content-model";
|
|
2
|
+
import { Alignment, AlignmentSchema, Box, Color, ContentDrawPage, ContentParagraph, ContentPathPoint, ContentSection, ContentShape, ContentSlide, ContentSubpath, ContentTable, ContentVector, LayoutMetadata, Margins, PageSize } from "document-content-model";
|
|
3
3
|
//#region src/model/node.d.ts
|
|
4
4
|
declare const AttributeSchema: z.ZodObject<{
|
|
5
5
|
name: z.ZodString;
|
|
@@ -503,6 +503,10 @@ declare function formatOdfColor(color: Color): string;
|
|
|
503
503
|
declare function parsePageSize(pageLayoutProperties: XmlElement): PageSize | undefined;
|
|
504
504
|
declare function parseMargins(pageLayoutProperties: XmlElement): Margins | undefined;
|
|
505
505
|
declare function parseBox(element: XmlElement): Box | undefined;
|
|
506
|
+
declare function parseLinePoints(element: XmlElement): {
|
|
507
|
+
from: ContentPathPoint;
|
|
508
|
+
to: ContentPathPoint;
|
|
509
|
+
} | undefined;
|
|
506
510
|
//#endregion
|
|
507
511
|
//#region src/typed/shared/text.d.ts
|
|
508
512
|
declare function getOdfSpaceCount(element: XmlElement): number;
|
|
@@ -560,9 +564,49 @@ interface OdfShapeGeometry {
|
|
|
560
564
|
declare function resolveOdfShapeGeometry(element: XmlElement): OdfShapeGeometry | undefined;
|
|
561
565
|
declare function composeOdfGroupTransform(groupFunctions: readonly OdfTransformFunction[], child: OdfShapeGeometry): OdfShapeGeometry;
|
|
562
566
|
//#endregion
|
|
567
|
+
//#region src/typed/shared/masterpage.d.ts
|
|
568
|
+
declare function resolveDrawPageSize(page: XmlElement, pkg: Package): PageSize | undefined;
|
|
569
|
+
//#endregion
|
|
570
|
+
//#region src/typed/shared/path.d.ts
|
|
571
|
+
interface OdfRawPoint {
|
|
572
|
+
readonly x: number;
|
|
573
|
+
readonly y: number;
|
|
574
|
+
}
|
|
575
|
+
type OdfRawSegment = {
|
|
576
|
+
readonly kind: 'line';
|
|
577
|
+
readonly to: OdfRawPoint;
|
|
578
|
+
} | {
|
|
579
|
+
readonly kind: 'cubic';
|
|
580
|
+
readonly control1: OdfRawPoint;
|
|
581
|
+
readonly control2: OdfRawPoint;
|
|
582
|
+
readonly to: OdfRawPoint;
|
|
583
|
+
};
|
|
584
|
+
interface OdfRawSubpath {
|
|
585
|
+
readonly start: OdfRawPoint;
|
|
586
|
+
readonly segments: readonly OdfRawSegment[];
|
|
587
|
+
readonly closed: boolean;
|
|
588
|
+
}
|
|
589
|
+
interface OdfViewBox {
|
|
590
|
+
readonly minX: number;
|
|
591
|
+
readonly minY: number;
|
|
592
|
+
readonly width: number;
|
|
593
|
+
readonly height: number;
|
|
594
|
+
}
|
|
595
|
+
declare function parseOdfViewBox(value: string): OdfViewBox | undefined;
|
|
596
|
+
declare function parseOdfPointsList(value: string): OdfRawPoint[];
|
|
597
|
+
declare function rawSubpathFromPoints(points: readonly OdfRawPoint[], closed: boolean): OdfRawSubpath | undefined;
|
|
598
|
+
declare function parseOdfPathData(d: string): OdfRawSubpath[];
|
|
599
|
+
declare function scaleOdfRawPoint(point: OdfRawPoint, viewBox: OdfViewBox, frame: Box): ContentPathPoint;
|
|
600
|
+
declare function buildOdfSubpaths(rawSubpaths: readonly OdfRawSubpath[], viewBox: OdfViewBox, frame: Box): ContentSubpath[];
|
|
601
|
+
//#endregion
|
|
563
602
|
//#region src/typed/draw/shapes.d.ts
|
|
564
603
|
declare function readDrawFrame(frame: XmlElement, groupFunctions: readonly OdfTransformFunction[], pkg: Package): ContentShape | undefined;
|
|
565
604
|
declare function walkDrawShapes(children: readonly XmlNode[], groupFunctions: readonly OdfTransformFunction[], pkg: Package, out: ContentShape[]): void;
|
|
605
|
+
interface DrawPageContent {
|
|
606
|
+
readonly shapes: ContentShape[];
|
|
607
|
+
readonly vectors: ContentVector[];
|
|
608
|
+
}
|
|
609
|
+
declare function readDrawPageContent(children: readonly XmlNode[], pkg: Package): DrawPageContent;
|
|
566
610
|
//#endregion
|
|
567
611
|
//#region src/typed/odp/read.d.ts
|
|
568
612
|
interface OdpDocument {
|
|
@@ -578,4 +622,11 @@ interface OdtDocument {
|
|
|
578
622
|
}
|
|
579
623
|
declare function readOdt(pkg: Package): OdtDocument;
|
|
580
624
|
//#endregion
|
|
581
|
-
|
|
625
|
+
//#region src/typed/odg/read.d.ts
|
|
626
|
+
interface OdgDocument {
|
|
627
|
+
metadata: LayoutMetadata;
|
|
628
|
+
pages: ContentDrawPage[];
|
|
629
|
+
}
|
|
630
|
+
declare function readOdg(pkg: Package): OdgDocument;
|
|
631
|
+
//#endregion
|
|
632
|
+
export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, type DrawPageContent, type ImageFormat, type InternRequest, type LengthUnit, MANIFEST_PART, META_PART, MIMETYPE_PART, type Manifest, type ManifestEntry, ManifestEntrySchema, type ManifestProblem, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, type OdfExtension, type OdfNamespacePrefix, type OdfPoint, type OdfRawPoint, type OdfRawSegment, type OdfRawSubpath, type OdfShapeGeometry, type OdfTransformFunction, type OdfViewBox, type OdgDocument, type OdpDocument, type OdtDocument, type OtherPartRef, type Package, PackageSchema, type ParsedProperties, type Part, PartSchema, STYLE_FAMILIES, type StyleCascadeResult, type StyleElementChainResult, type StyleFamily, type StyleProperties, StylePropertiesSchema, StyleRegistry, type StyleRegistryOptions, TableCursor, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, type ZipEntry, applyOdfTransform, attrValue, base64ToBytes, buildManifest, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseLength, parseLinePoints, parseMargins, parseOdfColor, parseOdfLength, parseOdfPathData, parseOdfPointsList, parseOdfTransform, parseOdfViewBox, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, rawSubpathFromPoints, readDrawFrame, readDrawPageContent, readManifest, readMimetype, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdp, readOdt, resolveDrawPageSize, resolveOdfShapeGeometry, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, serializePackage, setDocumentMediaType, sniffImageFormat, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
|