odf.js 1.5.0 → 1.7.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/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, ContentSheet, 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;
@@ -486,6 +486,11 @@ declare function attrValue(element: XmlElement, name: string): string | undefine
486
486
  //#region src/typed/shared/a1.d.ts
487
487
  declare function columnIndexToLetters(index: number): string;
488
488
  declare function cellReference(columnIndex: number, rowIndex: number): string;
489
+ declare function columnLettersToIndex(letters: string): number | undefined;
490
+ declare function parseCellReference(reference: string): {
491
+ column: number;
492
+ row: number;
493
+ } | undefined;
489
494
  declare class TableCursor {
490
495
  private columnCursor;
491
496
  private rowCursor;
@@ -503,6 +508,10 @@ declare function formatOdfColor(color: Color): string;
503
508
  declare function parsePageSize(pageLayoutProperties: XmlElement): PageSize | undefined;
504
509
  declare function parseMargins(pageLayoutProperties: XmlElement): Margins | undefined;
505
510
  declare function parseBox(element: XmlElement): Box | undefined;
511
+ declare function parseLinePoints(element: XmlElement): {
512
+ from: ContentPathPoint;
513
+ to: ContentPathPoint;
514
+ } | undefined;
506
515
  //#endregion
507
516
  //#region src/typed/shared/text.d.ts
508
517
  declare function getOdfSpaceCount(element: XmlElement): number;
@@ -560,9 +569,50 @@ interface OdfShapeGeometry {
560
569
  declare function resolveOdfShapeGeometry(element: XmlElement): OdfShapeGeometry | undefined;
561
570
  declare function composeOdfGroupTransform(groupFunctions: readonly OdfTransformFunction[], child: OdfShapeGeometry): OdfShapeGeometry;
562
571
  //#endregion
572
+ //#region src/typed/shared/masterpage.d.ts
573
+ declare function resolvePageLayoutProperties(pkg: Package, masterPageName: string | undefined): XmlElement | undefined;
574
+ declare function resolveDrawPageSize(page: XmlElement, pkg: Package): PageSize | undefined;
575
+ //#endregion
576
+ //#region src/typed/shared/path.d.ts
577
+ interface OdfRawPoint {
578
+ readonly x: number;
579
+ readonly y: number;
580
+ }
581
+ type OdfRawSegment = {
582
+ readonly kind: 'line';
583
+ readonly to: OdfRawPoint;
584
+ } | {
585
+ readonly kind: 'cubic';
586
+ readonly control1: OdfRawPoint;
587
+ readonly control2: OdfRawPoint;
588
+ readonly to: OdfRawPoint;
589
+ };
590
+ interface OdfRawSubpath {
591
+ readonly start: OdfRawPoint;
592
+ readonly segments: readonly OdfRawSegment[];
593
+ readonly closed: boolean;
594
+ }
595
+ interface OdfViewBox {
596
+ readonly minX: number;
597
+ readonly minY: number;
598
+ readonly width: number;
599
+ readonly height: number;
600
+ }
601
+ declare function parseOdfViewBox(value: string): OdfViewBox | undefined;
602
+ declare function parseOdfPointsList(value: string): OdfRawPoint[];
603
+ declare function rawSubpathFromPoints(points: readonly OdfRawPoint[], closed: boolean): OdfRawSubpath | undefined;
604
+ declare function parseOdfPathData(d: string): OdfRawSubpath[];
605
+ declare function scaleOdfRawPoint(point: OdfRawPoint, viewBox: OdfViewBox, frame: Box): ContentPathPoint;
606
+ declare function buildOdfSubpaths(rawSubpaths: readonly OdfRawSubpath[], viewBox: OdfViewBox, frame: Box): ContentSubpath[];
607
+ //#endregion
563
608
  //#region src/typed/draw/shapes.d.ts
564
609
  declare function readDrawFrame(frame: XmlElement, groupFunctions: readonly OdfTransformFunction[], pkg: Package): ContentShape | undefined;
565
610
  declare function walkDrawShapes(children: readonly XmlNode[], groupFunctions: readonly OdfTransformFunction[], pkg: Package, out: ContentShape[]): void;
611
+ interface DrawPageContent {
612
+ readonly shapes: ContentShape[];
613
+ readonly vectors: ContentVector[];
614
+ }
615
+ declare function readDrawPageContent(children: readonly XmlNode[], pkg: Package): DrawPageContent;
566
616
  //#endregion
567
617
  //#region src/typed/odp/read.d.ts
568
618
  interface OdpDocument {
@@ -578,4 +628,18 @@ interface OdtDocument {
578
628
  }
579
629
  declare function readOdt(pkg: Package): OdtDocument;
580
630
  //#endregion
581
- export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, 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 OdfShapeGeometry, type OdfTransformFunction, 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, 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, parseMargins, parseOdfColor, parseOdfLength, parseOdfTransform, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, readDrawFrame, readManifest, readMimetype, readOdfMetadata, readOdfParagraph, readOdfTable, readOdp, readOdt, resolveOdfShapeGeometry, resolveStyle, resolveStyleElementChain, rootElement, serializePackage, setDocumentMediaType, sniffImageFormat, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
631
+ //#region src/typed/odg/read.d.ts
632
+ interface OdgDocument {
633
+ metadata: LayoutMetadata;
634
+ pages: ContentDrawPage[];
635
+ }
636
+ declare function readOdg(pkg: Package): OdgDocument;
637
+ //#endregion
638
+ //#region src/typed/ods/read.d.ts
639
+ interface OdsDocument {
640
+ metadata: LayoutMetadata;
641
+ sheets: ContentSheet[];
642
+ }
643
+ declare function readOds(pkg: Package): OdsDocument;
644
+ //#endregion
645
+ 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 OdsDocument, 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, columnLettersToIndex, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseCellReference, 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, readOds, readOdt, resolveDrawPageSize, resolveOdfShapeGeometry, resolvePageLayoutProperties, 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, ContentSheet, 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;
@@ -486,6 +486,11 @@ declare function attrValue(element: XmlElement, name: string): string | undefine
486
486
  //#region src/typed/shared/a1.d.ts
487
487
  declare function columnIndexToLetters(index: number): string;
488
488
  declare function cellReference(columnIndex: number, rowIndex: number): string;
489
+ declare function columnLettersToIndex(letters: string): number | undefined;
490
+ declare function parseCellReference(reference: string): {
491
+ column: number;
492
+ row: number;
493
+ } | undefined;
489
494
  declare class TableCursor {
490
495
  private columnCursor;
491
496
  private rowCursor;
@@ -503,6 +508,10 @@ declare function formatOdfColor(color: Color): string;
503
508
  declare function parsePageSize(pageLayoutProperties: XmlElement): PageSize | undefined;
504
509
  declare function parseMargins(pageLayoutProperties: XmlElement): Margins | undefined;
505
510
  declare function parseBox(element: XmlElement): Box | undefined;
511
+ declare function parseLinePoints(element: XmlElement): {
512
+ from: ContentPathPoint;
513
+ to: ContentPathPoint;
514
+ } | undefined;
506
515
  //#endregion
507
516
  //#region src/typed/shared/text.d.ts
508
517
  declare function getOdfSpaceCount(element: XmlElement): number;
@@ -560,9 +569,50 @@ interface OdfShapeGeometry {
560
569
  declare function resolveOdfShapeGeometry(element: XmlElement): OdfShapeGeometry | undefined;
561
570
  declare function composeOdfGroupTransform(groupFunctions: readonly OdfTransformFunction[], child: OdfShapeGeometry): OdfShapeGeometry;
562
571
  //#endregion
572
+ //#region src/typed/shared/masterpage.d.ts
573
+ declare function resolvePageLayoutProperties(pkg: Package, masterPageName: string | undefined): XmlElement | undefined;
574
+ declare function resolveDrawPageSize(page: XmlElement, pkg: Package): PageSize | undefined;
575
+ //#endregion
576
+ //#region src/typed/shared/path.d.ts
577
+ interface OdfRawPoint {
578
+ readonly x: number;
579
+ readonly y: number;
580
+ }
581
+ type OdfRawSegment = {
582
+ readonly kind: 'line';
583
+ readonly to: OdfRawPoint;
584
+ } | {
585
+ readonly kind: 'cubic';
586
+ readonly control1: OdfRawPoint;
587
+ readonly control2: OdfRawPoint;
588
+ readonly to: OdfRawPoint;
589
+ };
590
+ interface OdfRawSubpath {
591
+ readonly start: OdfRawPoint;
592
+ readonly segments: readonly OdfRawSegment[];
593
+ readonly closed: boolean;
594
+ }
595
+ interface OdfViewBox {
596
+ readonly minX: number;
597
+ readonly minY: number;
598
+ readonly width: number;
599
+ readonly height: number;
600
+ }
601
+ declare function parseOdfViewBox(value: string): OdfViewBox | undefined;
602
+ declare function parseOdfPointsList(value: string): OdfRawPoint[];
603
+ declare function rawSubpathFromPoints(points: readonly OdfRawPoint[], closed: boolean): OdfRawSubpath | undefined;
604
+ declare function parseOdfPathData(d: string): OdfRawSubpath[];
605
+ declare function scaleOdfRawPoint(point: OdfRawPoint, viewBox: OdfViewBox, frame: Box): ContentPathPoint;
606
+ declare function buildOdfSubpaths(rawSubpaths: readonly OdfRawSubpath[], viewBox: OdfViewBox, frame: Box): ContentSubpath[];
607
+ //#endregion
563
608
  //#region src/typed/draw/shapes.d.ts
564
609
  declare function readDrawFrame(frame: XmlElement, groupFunctions: readonly OdfTransformFunction[], pkg: Package): ContentShape | undefined;
565
610
  declare function walkDrawShapes(children: readonly XmlNode[], groupFunctions: readonly OdfTransformFunction[], pkg: Package, out: ContentShape[]): void;
611
+ interface DrawPageContent {
612
+ readonly shapes: ContentShape[];
613
+ readonly vectors: ContentVector[];
614
+ }
615
+ declare function readDrawPageContent(children: readonly XmlNode[], pkg: Package): DrawPageContent;
566
616
  //#endregion
567
617
  //#region src/typed/odp/read.d.ts
568
618
  interface OdpDocument {
@@ -578,4 +628,18 @@ interface OdtDocument {
578
628
  }
579
629
  declare function readOdt(pkg: Package): OdtDocument;
580
630
  //#endregion
581
- export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, 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 OdfShapeGeometry, type OdfTransformFunction, 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, 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, parseMargins, parseOdfColor, parseOdfLength, parseOdfTransform, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, readDrawFrame, readManifest, readMimetype, readOdfMetadata, readOdfParagraph, readOdfTable, readOdp, readOdt, resolveOdfShapeGeometry, resolveStyle, resolveStyleElementChain, rootElement, serializePackage, setDocumentMediaType, sniffImageFormat, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
631
+ //#region src/typed/odg/read.d.ts
632
+ interface OdgDocument {
633
+ metadata: LayoutMetadata;
634
+ pages: ContentDrawPage[];
635
+ }
636
+ declare function readOdg(pkg: Package): OdgDocument;
637
+ //#endregion
638
+ //#region src/typed/ods/read.d.ts
639
+ interface OdsDocument {
640
+ metadata: LayoutMetadata;
641
+ sheets: ContentSheet[];
642
+ }
643
+ declare function readOds(pkg: Package): OdsDocument;
644
+ //#endregion
645
+ 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 OdsDocument, 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, columnLettersToIndex, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseCellReference, 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, readOds, readOdt, resolveDrawPageSize, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, serializePackage, setDocumentMediaType, sniffImageFormat, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };