odf.js 1.1.0 → 1.2.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
@@ -386,4 +386,86 @@ declare function syncManifest(pkg: Package, options?: BuildManifestOptions): voi
386
386
  declare function validateManifest(pkg: Package): ManifestProblem[];
387
387
  declare function setDocumentMediaType(pkg: Package, mediaType: string, version?: string): void;
388
388
  //#endregion
389
- export { type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type ImageFormat, MANIFEST_PART, MIMETYPE_PART, type Manifest, type ManifestEntry, ManifestEntrySchema, type ManifestProblem, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, type OdfExtension, type OdfNamespacePrefix, type Package, PackageSchema, type Part, PartSchema, 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, base64ToBytes, buildManifest, buildXml, bytesToBase64, decodePackage, el, encodePackage, encodeXmlText, isXmlNode, mediaTypeForExtension, packageCodec, parsePackage, parseXml, readManifest, readMimetype, serializePackage, setDocumentMediaType, sniffImageFormat, syncManifest, txt, unzipPackage, validateManifest, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
389
+ //#region src/styles/properties.d.ts
390
+ declare const StylePropertiesSchema: z.ZodObject<{
391
+ bold: z.ZodOptional<z.ZodBoolean>;
392
+ italic: z.ZodOptional<z.ZodBoolean>;
393
+ underline: z.ZodOptional<z.ZodBoolean>;
394
+ strike: z.ZodOptional<z.ZodBoolean>;
395
+ fontFamily: z.ZodOptional<z.ZodString>;
396
+ sizePt: z.ZodOptional<z.ZodNumber>;
397
+ color: z.ZodOptional<z.ZodObject<{
398
+ r: z.ZodNumber;
399
+ g: z.ZodNumber;
400
+ b: z.ZodNumber;
401
+ }, z.core.$strip>>;
402
+ alignment: z.ZodOptional<z.ZodEnum<{
403
+ left: "left";
404
+ center: "center";
405
+ right: "right";
406
+ justify: "justify";
407
+ }>>;
408
+ spacingBeforePt: z.ZodOptional<z.ZodNumber>;
409
+ spacingAfterPt: z.ZodOptional<z.ZodNumber>;
410
+ lineSpacing: z.ZodOptional<z.ZodNumber>;
411
+ indentLeftPt: z.ZodOptional<z.ZodNumber>;
412
+ indentFirstLinePt: z.ZodOptional<z.ZodNumber>;
413
+ }, z.core.$strip>;
414
+ type StyleProperties = z.infer<typeof StylePropertiesSchema>;
415
+ interface ParsedProperties {
416
+ properties: Partial<StyleProperties>;
417
+ hasUnknown: boolean;
418
+ }
419
+ declare function parseLength(value: string): number | undefined;
420
+ declare function formatPt(valuePt: number): string;
421
+ declare function formatPercentageMultiplier(multiplier: number): string;
422
+ declare function parseTextProperties(element: XmlElement): ParsedProperties;
423
+ declare function parseParagraphProperties(element: XmlElement): ParsedProperties;
424
+ declare function parseStyleElementProperties(styleElement: XmlElement): {
425
+ properties: StyleProperties;
426
+ hasUnknown: boolean;
427
+ };
428
+ declare function textPropertiesToAttributes(properties: StyleProperties): Attribute[];
429
+ declare function paragraphPropertiesToAttributes(properties: StyleProperties): Attribute[];
430
+ //#endregion
431
+ //#region src/styles/serialize.d.ts
432
+ declare function buildStylePropertyElements(properties: StyleProperties): XmlElement[];
433
+ declare function canonicalPropertiesString(properties: StyleProperties): string;
434
+ //#endregion
435
+ //#region src/styles/registry.d.ts
436
+ declare const STYLE_FAMILIES: readonly ["paragraph", "text", "table", "table-column", "table-row", "table-cell", "graphic"];
437
+ type StyleFamily = (typeof STYLE_FAMILIES)[number];
438
+ interface InternRequest {
439
+ properties: StyleProperties;
440
+ family: StyleFamily;
441
+ parentStyleName?: string;
442
+ }
443
+ interface OtherPartRef {
444
+ pkg: Package;
445
+ partPath: string;
446
+ }
447
+ interface StyleRegistryOptions {
448
+ otherPart?: OtherPartRef;
449
+ additionalReservedNames?: readonly string[];
450
+ }
451
+ declare class StyleRegistry {
452
+ private readonly automaticStyles;
453
+ private readonly prefixes;
454
+ private readonly reservedByFamily;
455
+ private readonly knownStyles;
456
+ private readonly fingerprintToName;
457
+ private readonly nameToFingerprint;
458
+ private readonly familyCounters;
459
+ private constructor();
460
+ static forPart(pkg: Package, partPath: string, options?: StyleRegistryOptions): StyleRegistry;
461
+ fingerprint(request: InternRequest): string;
462
+ intern(request: InternRequest): string;
463
+ private mintName;
464
+ names(): readonly string[];
465
+ gc(referenced: ReadonlySet<string>): number;
466
+ }
467
+ //#endregion
468
+ //#region src/styles/span.d.ts
469
+ declare function ensureSpan(paragraph: XmlElement, start: number, end: number, styleName: string): XmlElement;
470
+ //#endregion
471
+ export { type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type ImageFormat, type InternRequest, MANIFEST_PART, MIMETYPE_PART, type Manifest, type ManifestEntry, ManifestEntrySchema, type ManifestProblem, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, type OdfExtension, type OdfNamespacePrefix, type OtherPartRef, type Package, PackageSchema, type ParsedProperties, type Part, PartSchema, STYLE_FAMILIES, type StyleFamily, type StyleProperties, StylePropertiesSchema, StyleRegistry, type StyleRegistryOptions, 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, base64ToBytes, buildManifest, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, decodePackage, el, encodePackage, encodeXmlText, ensureSpan, formatPercentageMultiplier, formatPt, isXmlNode, mediaTypeForExtension, packageCodec, paragraphPropertiesToAttributes, parseLength, parsePackage, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, readManifest, readMimetype, serializePackage, setDocumentMediaType, sniffImageFormat, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
package/dist/index.d.ts CHANGED
@@ -386,4 +386,86 @@ declare function syncManifest(pkg: Package, options?: BuildManifestOptions): voi
386
386
  declare function validateManifest(pkg: Package): ManifestProblem[];
387
387
  declare function setDocumentMediaType(pkg: Package, mediaType: string, version?: string): void;
388
388
  //#endregion
389
- export { type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type ImageFormat, MANIFEST_PART, MIMETYPE_PART, type Manifest, type ManifestEntry, ManifestEntrySchema, type ManifestProblem, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, type OdfExtension, type OdfNamespacePrefix, type Package, PackageSchema, type Part, PartSchema, 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, base64ToBytes, buildManifest, buildXml, bytesToBase64, decodePackage, el, encodePackage, encodeXmlText, isXmlNode, mediaTypeForExtension, packageCodec, parsePackage, parseXml, readManifest, readMimetype, serializePackage, setDocumentMediaType, sniffImageFormat, syncManifest, txt, unzipPackage, validateManifest, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
389
+ //#region src/styles/properties.d.ts
390
+ declare const StylePropertiesSchema: z.ZodObject<{
391
+ bold: z.ZodOptional<z.ZodBoolean>;
392
+ italic: z.ZodOptional<z.ZodBoolean>;
393
+ underline: z.ZodOptional<z.ZodBoolean>;
394
+ strike: z.ZodOptional<z.ZodBoolean>;
395
+ fontFamily: z.ZodOptional<z.ZodString>;
396
+ sizePt: z.ZodOptional<z.ZodNumber>;
397
+ color: z.ZodOptional<z.ZodObject<{
398
+ r: z.ZodNumber;
399
+ g: z.ZodNumber;
400
+ b: z.ZodNumber;
401
+ }, z.core.$strip>>;
402
+ alignment: z.ZodOptional<z.ZodEnum<{
403
+ left: "left";
404
+ center: "center";
405
+ right: "right";
406
+ justify: "justify";
407
+ }>>;
408
+ spacingBeforePt: z.ZodOptional<z.ZodNumber>;
409
+ spacingAfterPt: z.ZodOptional<z.ZodNumber>;
410
+ lineSpacing: z.ZodOptional<z.ZodNumber>;
411
+ indentLeftPt: z.ZodOptional<z.ZodNumber>;
412
+ indentFirstLinePt: z.ZodOptional<z.ZodNumber>;
413
+ }, z.core.$strip>;
414
+ type StyleProperties = z.infer<typeof StylePropertiesSchema>;
415
+ interface ParsedProperties {
416
+ properties: Partial<StyleProperties>;
417
+ hasUnknown: boolean;
418
+ }
419
+ declare function parseLength(value: string): number | undefined;
420
+ declare function formatPt(valuePt: number): string;
421
+ declare function formatPercentageMultiplier(multiplier: number): string;
422
+ declare function parseTextProperties(element: XmlElement): ParsedProperties;
423
+ declare function parseParagraphProperties(element: XmlElement): ParsedProperties;
424
+ declare function parseStyleElementProperties(styleElement: XmlElement): {
425
+ properties: StyleProperties;
426
+ hasUnknown: boolean;
427
+ };
428
+ declare function textPropertiesToAttributes(properties: StyleProperties): Attribute[];
429
+ declare function paragraphPropertiesToAttributes(properties: StyleProperties): Attribute[];
430
+ //#endregion
431
+ //#region src/styles/serialize.d.ts
432
+ declare function buildStylePropertyElements(properties: StyleProperties): XmlElement[];
433
+ declare function canonicalPropertiesString(properties: StyleProperties): string;
434
+ //#endregion
435
+ //#region src/styles/registry.d.ts
436
+ declare const STYLE_FAMILIES: readonly ["paragraph", "text", "table", "table-column", "table-row", "table-cell", "graphic"];
437
+ type StyleFamily = (typeof STYLE_FAMILIES)[number];
438
+ interface InternRequest {
439
+ properties: StyleProperties;
440
+ family: StyleFamily;
441
+ parentStyleName?: string;
442
+ }
443
+ interface OtherPartRef {
444
+ pkg: Package;
445
+ partPath: string;
446
+ }
447
+ interface StyleRegistryOptions {
448
+ otherPart?: OtherPartRef;
449
+ additionalReservedNames?: readonly string[];
450
+ }
451
+ declare class StyleRegistry {
452
+ private readonly automaticStyles;
453
+ private readonly prefixes;
454
+ private readonly reservedByFamily;
455
+ private readonly knownStyles;
456
+ private readonly fingerprintToName;
457
+ private readonly nameToFingerprint;
458
+ private readonly familyCounters;
459
+ private constructor();
460
+ static forPart(pkg: Package, partPath: string, options?: StyleRegistryOptions): StyleRegistry;
461
+ fingerprint(request: InternRequest): string;
462
+ intern(request: InternRequest): string;
463
+ private mintName;
464
+ names(): readonly string[];
465
+ gc(referenced: ReadonlySet<string>): number;
466
+ }
467
+ //#endregion
468
+ //#region src/styles/span.d.ts
469
+ declare function ensureSpan(paragraph: XmlElement, start: number, end: number, styleName: string): XmlElement;
470
+ //#endregion
471
+ export { type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type ImageFormat, type InternRequest, MANIFEST_PART, MIMETYPE_PART, type Manifest, type ManifestEntry, ManifestEntrySchema, type ManifestProblem, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, type OdfExtension, type OdfNamespacePrefix, type OtherPartRef, type Package, PackageSchema, type ParsedProperties, type Part, PartSchema, STYLE_FAMILIES, type StyleFamily, type StyleProperties, StylePropertiesSchema, StyleRegistry, type StyleRegistryOptions, 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, base64ToBytes, buildManifest, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, decodePackage, el, encodePackage, encodeXmlText, ensureSpan, formatPercentageMultiplier, formatPt, isXmlNode, mediaTypeForExtension, packageCodec, paragraphPropertiesToAttributes, parseLength, parsePackage, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, readManifest, readMimetype, serializePackage, setDocumentMediaType, sniffImageFormat, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };