js.documents 13.0.0 → 14.0.1
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 +1 -1
- package/dist/codecs/read.cjs +1 -1
- package/dist/codecs/read.js +1 -1
- package/dist/codecs/registry.cjs +1 -1
- package/dist/codecs/registry.js +1 -1
- package/dist/convert/composition.cjs +1 -1
- package/dist/convert/composition.js +1 -1
- package/dist/edit/docx/content.cjs +1 -0
- package/dist/edit/docx/content.js +1 -0
- package/dist/edit/docx/table.cjs +14 -0
- package/dist/edit/docx/table.d.cts +2 -0
- package/dist/edit/docx/table.d.ts +2 -0
- package/dist/edit/docx/table.js +14 -0
- package/dist/edit/odp/slide.d.cts +1 -1
- package/dist/edit/odp/slide.d.ts +1 -1
- package/dist/edit/odt/content.cjs +2 -0
- package/dist/edit/odt/content.d.cts +1 -1
- package/dist/edit/odt/content.d.ts +1 -1
- package/dist/edit/odt/content.js +2 -0
- package/dist/edit/odt/editor.d.cts +1 -1
- package/dist/edit/odt/editor.d.ts +1 -1
- package/dist/edit/odt/table.cjs +59 -6
- package/dist/edit/odt/table.d.cts +1 -1
- package/dist/edit/odt/table.d.ts +1 -1
- package/dist/edit/odt/table.js +59 -6
- package/dist/index.cjs +3 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/model/bytes.cjs +5 -8
- package/dist/model/bytes.js +5 -8
- package/dist/svg/text.cjs +41 -8
- package/dist/svg/text.d.cts +25 -3
- package/dist/svg/text.d.ts +25 -3
- package/dist/svg/text.js +40 -8
- package/dist/svg/xml-encoding.cjs +91 -0
- package/dist/svg/xml-encoding.d.cts +32 -0
- package/dist/svg/xml-encoding.d.ts +32 -0
- package/dist/svg/xml-encoding.js +88 -0
- package/dist/{table-BT3wN3Hd.d.cts → table-Bt9ahRyh.d.cts} +2 -0
- package/dist/{table-DhTy5Re7.d.ts → table-Cou5rKOo.d.ts} +2 -0
- package/package.json +14 -14
package/dist/index.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ import { OdgPage, PageImageInit, TextBoxInit } from "./edit/odg/page.js";
|
|
|
47
47
|
import { CreateOdgOptions, OdgEditor, createOdg, openOdg } from "./edit/odg/editor.js";
|
|
48
48
|
import { CreateEmptyOdgPackageOptions } from "./edit/odg/scaffold.js";
|
|
49
49
|
import { BuildOdpPackageOptions, buildOdpPackage } from "./edit/odp/content.js";
|
|
50
|
-
import { a as OdtTableRow, i as OdtTableCell, n as OdtCoveredTableCell, o as TableInit$2, r as OdtTable } from "./table-
|
|
50
|
+
import { a as OdtTableRow, i as OdtTableCell, n as OdtCoveredTableCell, o as TableInit$2, r as OdtTable } from "./table-Cou5rKOo.js";
|
|
51
51
|
import { OdpSlide, SlideImageInit, SlideTableInit, TextBoxInit as TextBoxInit$1 } from "./edit/odp/slide.js";
|
|
52
52
|
import { CreateOdpOptions, OdpEditor, createOdp, openOdp } from "./edit/odp/editor.js";
|
|
53
53
|
import { CreateEmptyOdpPackageOptions } from "./edit/odp/scaffold.js";
|
|
@@ -105,7 +105,7 @@ import { readOdfEmbeddedFormula, readOdfFormulaContent } from "./odf/formula/rea
|
|
|
105
105
|
import { decodeMarkdownText, encodeMarkdownText } from "./markdown/text.js";
|
|
106
106
|
import { readMarkdownContent } from "./markdown/read.js";
|
|
107
107
|
import { buildMarkdownText } from "./markdown/write.js";
|
|
108
|
-
import {
|
|
108
|
+
import { SvgUndecodableTextError, SvgUnsupportedEncodingError, decodeSvgText, encodeSvgText } from "./svg/text.js";
|
|
109
109
|
import { ReadSvgContentOptions, SvgMissingRootElementError, readSvgContent } from "./svg/read.js";
|
|
110
110
|
import { BuildSvgTextOptions, SvgMultiPageNotSpecifiedError, SvgPageNotFoundError, SvgUnsupportedDocumentKindError, buildSvgText } from "./svg/write.js";
|
|
111
111
|
import { readPptContent } from "./ppt/read.js";
|
|
@@ -147,4 +147,4 @@ import { XlsContentDocument, readXlsContent, writeXlsContent } from "xls-codec";
|
|
|
147
147
|
import { RtfBytesSchema, readRtfContent, writeRtfContent } from "rtf-codec";
|
|
148
148
|
import { EpubBytesSchema, readEpubContent, writeEpubContent } from "epub-codec";
|
|
149
149
|
import { readWpdContent } from "wpd-codec";
|
|
150
|
-
export { type Alignment, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type Box, type BuildCsvTextOptions, type BuildDocxPackageOptions, type BuildOdgPackageOptions, type BuildOdpPackageOptions, type BuildOdsPackageOptions, type BuildOdtPackageOptions, type BuildPptxPackageOptions, type BuildSvgTextOptions, COLOR_BLACK, type CellPosition, type CellRange, type CellTypeDeclineReason, type CellTypeInference, type CellTypeInferenceResult, type CellTypeInferenceSink, type CellTypeRule, type ClockPort, type Comment, CommentSchema, type CompactAttrPairs, type CompactPackage, CompactPackageSchema, type CompactPart, CompactPartSchema, type CompactXmlNode, CompactXmlNodeSchema, type CompositionHop, type ContentBlock, ContentBlockSchema, type ContentCellFill, type ContentCellValue, ContentCellValueSchema, type ContentDocument, type ContentDocumentJson, ContentDocumentSchema, type ContentDrawPage, ContentDrawPageSchema, type ContentEmbeddedObject, type ContentEmbeddedObjectBlock, ContentEmbeddedObjectBlockSchema, type ContentEmbeddedObjectKind, ContentEmbeddedObjectSchema, type ContentImageBlock, ContentImageBlockSchema, type ContentListMembership, type ContentPageBreak, ContentPageBreakSchema, type ContentParagraph, ContentParagraphSchema, type ContentPathPoint, ContentPathPointSchema, type ContentPathSegment, ContentPathSegmentSchema, type ContentRun, ContentRunSchema, type ContentSection, ContentSectionSchema, type ContentShape, ContentShapeSchema, type ContentSheet, type ContentSheetCell, ContentSheetCellSchema, type ContentSheetColumn, ContentSheetColumnSchema, type ContentSheetImage, type ContentSheetPrintRange, ContentSheetPrintRangeSchema, type ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, type ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, type ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, type ContentSlide, ContentSlideSchema, type ContentStroke, ContentStrokeSchema, type ContentSubpath, ContentSubpathSchema, type ContentTable, type ContentTableCell, ContentTableCellSchema, type ContentTableRow, ContentTableRowSchema, ContentTableSchema, type ContentVector, ContentVectorSchema, type ConversionOptions, type ConversionPlan, type ConversionRequest, type ConversionResult, type CreateDocOptions, type CreateDocxOptions, type CreateEmptyDocxPackageOptions, type CreateEmptyOdgPackageOptions, type CreateEmptyOdpPackageOptions, type CreateEmptyOdsPackageOptions, type CreateEmptyOdtPackageOptions, type CreateEmptyPptxPackageOptions, type CreateMarkdownEditorOptions, type CreateOdgOptions, type CreateOdpOptions, type CreateOdsOptions, type CreateOdtOptions, type CreatePdfOptions, type CreatePptOptions, type CreatePptxOptions, type CreateXlsOptions, CsvBytesSchema, CsvParseError, type CsvReadOptions, CsvSheetNotFoundError, CsvSheetNotSpecifiedError, CsvUndecodableTextError, CsvUnsupportedDocumentKindError, type CsvWriteOptions, DEFAULT_LAYOUT_FONT, DOCUMENT_FORMATS, type DefinedName, DefinedNameSchema, type Diagnostic, DocBytesSchema, DocEditor, DocParagraph, type ParagraphInit as DocParagraphInit, DocRun, type RunInit as DocRunInit, DocSection, type SectionInit as DocSectionInit, DocTable, DocTableCell, type TableInit as DocTableInit, DocTableRow, type DocumentBridgeOptions, type DocumentConverter, type DocumentFontRegistryOptions, type DocumentFormat, DocumentFormatSchema, type DocumentFormulaEntry, type DocumentJsonResult, type DocumentPayload, type DocumentSchemaKind, type DocumentToPdfOptions, type DocumentTree, type DocumentTreeJson, DocumentTreeSchema, type DocxBody, DocxBytesSchema, DocxEditor, type DocxExtras, DocxParagraph, DocxRun, DocxTable, DocxTableCell, DocxTableRow, type DocxVerticalMerge, type DrawingLayoutOptions, type DrawingLayoutResult, type DrawingParagraphInit, type DrawingRunInit, type EngineLayoutOptions, EpubBytesSchema, SUPPORTED_BACKUP_FORMAT_VERSION as FIREBIRD_SUPPORTED_BACKUP_FORMAT_VERSION, FirebirdBackupFormatError, FirebirdBackupParseError, type FirebirdBackupSummary, FirebirdCompositeRecordUnsupportedError, FirebirdDataParseError, FirebirdSchemaParseError, FirebirdUnsupportedFieldTypeError, FontDeobfuscationError, type FontFace, FontFaceParseError, type FontRegistry, type FontRegistryOptions, type FontSourcePackage, type FontSubstitution, type Footnote, FootnoteSchema, type GridLattice, type HeaderFooterPart, HeaderFooterPartSchema, type HsqldbBinaryScript, HsqldbBinaryScriptParseError, type HsqldbColumn, type HsqldbDecodeOptions, HsqldbRowFormatError, HsqldbScriptParseError, HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, type HsqldbTable, LATEX_DIAGNOSTIC_CODES, LAYOUT_FORMAT_VERSION, type LatexDiagnostic, type LatexDiagnosticCode, type LatexDiagnosticSink, type LatexFormulaOptions, type LatexFormulaResult, type LatexLoweringResult, type LayoutColor, type LayoutDocument, LayoutDocumentSchema, type LayoutEllipse, type LayoutFont, type LayoutFormulaOptions, type LayoutImage, type LayoutImageAsset, type LayoutItem, type LayoutLine, type LayoutLink, type LayoutMetadata, type LayoutPage, type LayoutPath, type LayoutPathSegment, type LayoutRect, type LayoutSubpath, type LayoutText, type LoadedMathFont, type LowerLatexOptions, MATH_LINT_CODES, type Margins, type MarkdownBody, MarkdownBytesSchema, MarkdownEditor, MarkdownList, type MarkdownListInit, type MarkdownMathLoweringOptions, MarkdownParagraph, type ParagraphInit$1 as MarkdownParagraphInit, type MarkdownRenderDiagnostic, type MarkdownRenderDiagnosticCode, MarkdownRenderDiagnosticCodes, type MarkdownRenderDiagnosticSeverity, type MarkdownRenderDiagnosticSink, MarkdownRun, type RunInit$1 as MarkdownRunInit, MarkdownTable, MarkdownTableCell, type TableInit$1 as MarkdownTableInit, MarkdownTableRow, type MathAssembledGlyphs, type MathBox, type MathColor, type MathDiagnostic, type MathDiagnosticKind, type MathFont, type MathFontDescriptorMetrics, type MathFontMetrics, type MathGlyphMetrics, type MathGlyphPlacement, type MathGlyphRun, type MathLayoutItem, type MathLayoutResult, type MathLintCode, type MathLintDiagnostic, type MathMlAttribute, type MathMlElement, type MathMlNode, type MathMlText, type MathRule, type MathStretchAxis, type MathStretchGlyph, type MathStretchResult, type MathStroke, type MathVariant, type MetadataOverrides, NOOP_DIAGNOSTIC_SINK, type NumberingDefinition, NumberingDefinitionSchema, type NumberingDefinitions, type NumberingLevel, NumberingLevelSchema, type OdbComponentInfo, type OdbConnectionInfo, type OdbConversionOptions, type OdbForm, type OdbFormControl, type OdbFormDefinition, type OdbInventory, OdbNoEmbeddedDataSourceError, type OdbQueryInfo, type OdbReport, type OdbReportBand, type OdbReportContentOptions, OdbReportDataSourceError, type OdbReportElement, type OdbReportFunction, type OdbReportGroup, OdbReportNotSpecifiedError, type OdbReportToDocxOptions, type OdbReportToOdtOptions, OdbTableNotFoundError, OdbTableNotSpecifiedError, type OdbToCsvOptions, type OdbUnsupportedFormat, OdbUnsupportedFormatError, OdfEmbeddedFontError, OdgBoxVector, type BoxVectorInit as OdgBoxVectorInit, OdgBytesSchema, OdgEditor, OdgLineVector, type LineVectorInit as OdgLineVectorInit, OdgPage, type PageImageInit as OdgPageImageInit, OdgPathVector, type PathVectorInit as OdgPathVectorInit, type TextBoxInit as OdgTextBoxInit, type OdgVector, type OdgVectorKind, type OdmToPdfOptions, OdmUnresolvedSectionError, OdpBytesSchema, OdpEditor, OdpShape, OdpSlide, type SlideImageInit as OdpSlideImageInit, type SlideTableInit as OdpSlideTableInit, type TextBoxInit$1 as OdpTextBoxInit, OdsBytesSchema, OdsCell, OdsEditor, OdsSheet, type OdtBody, OdtBytesSchema, OdtCoveredTableCell, OdtEditor, OdtList, OdtListItem, OdtParagraph, type ParagraphInit$2 as OdtParagraphInit, OdtRun, type RunInit$2 as OdtRunInit, OdtTable, OdtTableCell, type TableInit$2 as OdtTableInit, OdtTableRow, type OmmlDiagnostic, type OmmlDiagnosticKind, type OmmlReadResult, type OmmlWriteResult, OoxmlEmbeddedFontError, type OperatorProperties, PAGE_SIZE_A4, PAGE_SIZE_LETTER, type Package, PackageSchema, type PageInit, type PageSize, type Part, PartSchema, type PatchDocxMetadataOptions, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEditor, type PdfEllipseInit, PdfEllipseItem, PdfEncryptedError, type PdfImageInit, PdfImageItem, PdfInternalLinkItem, type PdfItem, type PdfLineInit, PdfLineItem, type PdfLinkInit, PdfLinkItem, PdfPage, PdfParseError, type PdfPathInit, PdfPathItem, type PdfRectInit, PdfRectItem, type PdfTextInit, PdfTextItem, type PdfToDocumentOptions, type PositionedFormula, PptBytesSchema, PptEditor, PptShape, PptSlide, PptxBytesSchema, PptxEditor, PptxShape, PptxSlide, PptxTable, PptxTableCell, type PptxTableInit, PptxTableRow, type PresentationLayoutResult, type ProvidedFont, type ReadCsvContentOptions, type ReadDocumentMetadataOptions, type ReadDocxContentOptions, type ReadFirebirdBackupResult, type ReadNativeDocumentTreeOptions, type ReadPdfOptions, type ReadSvgContentOptions, type ReconstructOptions, type Relationship, type RenderMarkdownOptions, type ResolvedFace, type RptAggregateFunction, type RptBandDefinition, type RptBandInstance, type RptBandKind, type RptFormula, RptFormulaEvaluationError, RptFormulaParseError, RptFormulaUnsupportedError, type RptGroupDefinition, type RptNamedFunctionDefinition, type RptReference, type RptReportDefinition, type RptReportRun, RptReportStructureError, type RptScope, RtfBytesSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, SVG_DIAGNOSTIC_CODES, type SectionHeaderFooterReferences, SectionHeaderFooterReferencesSchema, type SetDocumentMetadataOptions, type SheetsLayoutOptions, type SlideImageInit$1 as SlideImageInit, type SlideTableInit$1 as SlideTableInit, type SlidesLayoutOptions, type SpreadsheetLayoutResult, type SqlAggregateArgument, type SqlAggregateFunction, type SqlColumnRef, type SqlComparisonOperator, type SqlFromClause, type SqlFromSource, type SqlJoinClause, type SqlLiteral, type SqlNameRef, type SqlOperand, type SqlOrderByTerm, type SqlPredicate, type SqlPunctuation, type SqlResultSet, type SqlSelectItem, type SqlSelectStatement, type SqlSortDirection, type SqlToken, SvgBytesSchema, type SvgDiagnostic, type SvgDiagnosticCode, type SvgDiagnosticSink, SvgInvalidUtf8Error, SvgMissingRootElementError, SvgMultiPageNotSpecifiedError, SvgPageNotFoundError, type SvgReadOptions, SvgUnsupportedDocumentKindError, type SvgWriteOptions, type TableGridCell, type TableGridRows, type TextBoxInit$2 as TextBoxInit, type UnifiedConversionOptions, UnrecognizedDocumentSchemaError, UnsupportedFontSourceFormatError, UnsupportedPackageFormatError, type WinAnsiSubstitution, type WordprocessingLayoutResult, type WritePdfOptions, XlsBytesSchema, XlsCell, type XlsContentDocument, XlsEditor, XlsSheet, XlsxBytesSchema, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, applyMathVariant, attr, base64ToBytes, buildCsvText, buildDocumentBytes, buildDocxPackage, buildDrawingBlock, buildFormulaBlock, buildMarkdownText, buildOdgPackage, buildOdpPackage, buildOdsPackage, buildOdtPackage, buildOfficeMath, buildOfficeMathParagraph, buildPptxPackage, buildSvgText, buildXlsxPackage, buildXml, bytesToBase64, cellReference, childrenWithTag, collectDocumentFormulas, collectOfficeMathElements, columnIndexToLetters, columnLettersToIndex, compactCodec, compactPackageCodec, contentDocumentWithSchema, convertDocument, convertDrawingToLayout, convertPresentationToLayout, convertSpreadsheetToLayout, convertWordprocessingToLayout, createDoc, createDocumentFontRegistry, createDocx, createFontMeasurer, createFontRegistry, createLocalDocumentConverter, createMarkdownEditor, createOdg, createOdp, createOds, createOdt, createPdf, createPpt, createPptx, createStandardFontMeasurer, createXls, csvMarkdownCodec, csvPdfCodec, csvToMarkdown, csvToOds, csvToPdf, csvToXlsx, decodeCompactPackage, decodeCsvText, decodeDocumentPackage, decodeEntities, decodeHsqldbCachedTables, decodeMarkdownText, decodeOdbPackage, decodePackage, decodeSvgText, deobfuscateEmbeddedFont, deriveFontKey, describeFontFace, detectGridLattice, docPdfCodec, docToPdf, documentFromJson, documentSchemaKindOf, documentTreeWithSchema, docxPdfCodec, docxToMarkdown, docxToOdt, docxToPdf, docxToPptx, drawingOfBlock, elementChildren, elementLocalName, elementsWithTag, embeddedPresentationSerialiser, encodeCompactPackage, encodeCsvText, encodeDocumentPackage, encodeMarkdownText, encodePackage, encodeSvgText, epubPdfCodec, epubToPdf, evaluateRptBandOutsideData, evaluateSelect, extractOdfEmbeddedFonts, extractOoxmlEmbeddedFonts, extractSourceFonts, extractSourceFontsForFormat, firstChildByLocalName, fixedClock, flipY, formulaDocument, formulaOfBlock, formulaPlaceholderText, fromCompact, displayTextFor as hsqldbCellDisplayText, inferCellValue, inflateHsqldbCompressedScript, isCompactXmlNode, isContentBlock, isMathMlElement, isMathVariant, isXmlNode, latexToFormula, layoutDocumentFromPackage, layoutFormula, lintMathCoherence, loadMathFont, localName, looksLikeSfnt, lowerLatex, lowerMarkdownMath, mapMathVariant, markdownDocxCodec, markdownOdtCodec, markdownPdfCodec, markdownToCsv, markdownToDocx, markdownToOdt, markdownToPdf, markdownToXlsx, textContent as mathMlTextContent, odbReportCommandSql, odbReportGroupChain, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbTablesToSpreadsheetDocument, odbToCsv, odbToXlsx, odfToPdf, odgPdfCodec, odgSvgCodec, odgToPdf, odgToSvg, odmToPdf, odpPdfCodec, odpPptxCodec, odpToOdt, odpToPdf, odpToPptx, odsCsvCodec, odsPdfCodec, odsToCsv, odsToPdf, odsToXlsx, odsXlsxCodec, odtDocxCodec, odtPdfCodec, odtToDocx, odtToMarkdown, odtToOdp, odtToPdf, openDoc, openDocx, openMarkdown, openOdg, openOdp, openOds, openOdt, openPdf, openPpt, openPptx, openXls, operatorProperties, packageCodec, parseCellReference, parseHsqldbBinaryScript, parseHsqldbScript, parsePackage, parseRangeReference, parseRptFormula, parseSelect, parseXml, patchDocxMetadata, pdfCodec, pdfToCsv, pdfToDoc, pdfToDocx, pdfToEpub, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPpt, pdfToPptx, pdfToRtf, pdfToSvg, pdfToXls, pdfToXlsx, pptPdfCodec, pptToPdf, pptxPdfCodec, pptxToDocx, pptxToOdp, pptxToPdf, rangeReference, readCsvContent, readDocContent, readDocumentMetadata, readDocxContent, readDocxExtras, readEpubContent, readFirebirdBackup, readMarkdownContent, readNativeDocumentTree, readOdbForm, readOdbForms, readOdbInventory, readOdbReport, readOdbReportContent, readOdbReports, readOdbTables, readOdfEmbeddedFormula, readOdfFormulaContent, readOdgContent, readOdpContent, readOdsContent, readOdtContent, readOfficeMath, readPdf, readPptContent, readPptxContent, readRtfContent, readSvgContent, readWpdContent, readXlsContent, readXlsxContent, reconstructDrawing, reconstructPresentation, reconstructSpreadsheet, reconstructWordprocessing, renderContentDocumentToMarkdown, renderOdbReportContent, resolveCompositionPlan, resolveMetadataTimestamps, resolveOdbComponent, resolveOdbReportRows, resolveRelationships, rgbHexToColor, rootElement, rptBandDefinition, rptDefinitionFromReport, rtfPdfCodec, rtfToPdf, runRptReport, schemaUriFor, serializePackage, setDocumentMetadata, svgPdfCodec, svgToOdg, svgToPdf, systemClock, textContent$1 as textContent, throwIfAborted, toCompact, tokenizeSql, unzipPackage, walk, writeDocContent, writeEpubContent, writePdf, writePptContent, writeRtfContent, writeXlsContent, displayTextOfValue as xlsDisplayTextOfValue, xlsPdfCodec, xlsToPdf, xlsxCsvCodec, xlsxMarkdownCodec, xlsxPdfCodec, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf, xmlCodec, zipPackage };
|
|
150
|
+
export { type Alignment, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type Box, type BuildCsvTextOptions, type BuildDocxPackageOptions, type BuildOdgPackageOptions, type BuildOdpPackageOptions, type BuildOdsPackageOptions, type BuildOdtPackageOptions, type BuildPptxPackageOptions, type BuildSvgTextOptions, COLOR_BLACK, type CellPosition, type CellRange, type CellTypeDeclineReason, type CellTypeInference, type CellTypeInferenceResult, type CellTypeInferenceSink, type CellTypeRule, type ClockPort, type Comment, CommentSchema, type CompactAttrPairs, type CompactPackage, CompactPackageSchema, type CompactPart, CompactPartSchema, type CompactXmlNode, CompactXmlNodeSchema, type CompositionHop, type ContentBlock, ContentBlockSchema, type ContentCellFill, type ContentCellValue, ContentCellValueSchema, type ContentDocument, type ContentDocumentJson, ContentDocumentSchema, type ContentDrawPage, ContentDrawPageSchema, type ContentEmbeddedObject, type ContentEmbeddedObjectBlock, ContentEmbeddedObjectBlockSchema, type ContentEmbeddedObjectKind, ContentEmbeddedObjectSchema, type ContentImageBlock, ContentImageBlockSchema, type ContentListMembership, type ContentPageBreak, ContentPageBreakSchema, type ContentParagraph, ContentParagraphSchema, type ContentPathPoint, ContentPathPointSchema, type ContentPathSegment, ContentPathSegmentSchema, type ContentRun, ContentRunSchema, type ContentSection, ContentSectionSchema, type ContentShape, ContentShapeSchema, type ContentSheet, type ContentSheetCell, ContentSheetCellSchema, type ContentSheetColumn, ContentSheetColumnSchema, type ContentSheetImage, type ContentSheetPrintRange, ContentSheetPrintRangeSchema, type ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, type ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, type ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, type ContentSlide, ContentSlideSchema, type ContentStroke, ContentStrokeSchema, type ContentSubpath, ContentSubpathSchema, type ContentTable, type ContentTableCell, ContentTableCellSchema, type ContentTableRow, ContentTableRowSchema, ContentTableSchema, type ContentVector, ContentVectorSchema, type ConversionOptions, type ConversionPlan, type ConversionRequest, type ConversionResult, type CreateDocOptions, type CreateDocxOptions, type CreateEmptyDocxPackageOptions, type CreateEmptyOdgPackageOptions, type CreateEmptyOdpPackageOptions, type CreateEmptyOdsPackageOptions, type CreateEmptyOdtPackageOptions, type CreateEmptyPptxPackageOptions, type CreateMarkdownEditorOptions, type CreateOdgOptions, type CreateOdpOptions, type CreateOdsOptions, type CreateOdtOptions, type CreatePdfOptions, type CreatePptOptions, type CreatePptxOptions, type CreateXlsOptions, CsvBytesSchema, CsvParseError, type CsvReadOptions, CsvSheetNotFoundError, CsvSheetNotSpecifiedError, CsvUndecodableTextError, CsvUnsupportedDocumentKindError, type CsvWriteOptions, DEFAULT_LAYOUT_FONT, DOCUMENT_FORMATS, type DefinedName, DefinedNameSchema, type Diagnostic, DocBytesSchema, DocEditor, DocParagraph, type ParagraphInit as DocParagraphInit, DocRun, type RunInit as DocRunInit, DocSection, type SectionInit as DocSectionInit, DocTable, DocTableCell, type TableInit as DocTableInit, DocTableRow, type DocumentBridgeOptions, type DocumentConverter, type DocumentFontRegistryOptions, type DocumentFormat, DocumentFormatSchema, type DocumentFormulaEntry, type DocumentJsonResult, type DocumentPayload, type DocumentSchemaKind, type DocumentToPdfOptions, type DocumentTree, type DocumentTreeJson, DocumentTreeSchema, type DocxBody, DocxBytesSchema, DocxEditor, type DocxExtras, DocxParagraph, DocxRun, DocxTable, DocxTableCell, DocxTableRow, type DocxVerticalMerge, type DrawingLayoutOptions, type DrawingLayoutResult, type DrawingParagraphInit, type DrawingRunInit, type EngineLayoutOptions, EpubBytesSchema, SUPPORTED_BACKUP_FORMAT_VERSION as FIREBIRD_SUPPORTED_BACKUP_FORMAT_VERSION, FirebirdBackupFormatError, FirebirdBackupParseError, type FirebirdBackupSummary, FirebirdCompositeRecordUnsupportedError, FirebirdDataParseError, FirebirdSchemaParseError, FirebirdUnsupportedFieldTypeError, FontDeobfuscationError, type FontFace, FontFaceParseError, type FontRegistry, type FontRegistryOptions, type FontSourcePackage, type FontSubstitution, type Footnote, FootnoteSchema, type GridLattice, type HeaderFooterPart, HeaderFooterPartSchema, type HsqldbBinaryScript, HsqldbBinaryScriptParseError, type HsqldbColumn, type HsqldbDecodeOptions, HsqldbRowFormatError, HsqldbScriptParseError, HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, type HsqldbTable, LATEX_DIAGNOSTIC_CODES, LAYOUT_FORMAT_VERSION, type LatexDiagnostic, type LatexDiagnosticCode, type LatexDiagnosticSink, type LatexFormulaOptions, type LatexFormulaResult, type LatexLoweringResult, type LayoutColor, type LayoutDocument, LayoutDocumentSchema, type LayoutEllipse, type LayoutFont, type LayoutFormulaOptions, type LayoutImage, type LayoutImageAsset, type LayoutItem, type LayoutLine, type LayoutLink, type LayoutMetadata, type LayoutPage, type LayoutPath, type LayoutPathSegment, type LayoutRect, type LayoutSubpath, type LayoutText, type LoadedMathFont, type LowerLatexOptions, MATH_LINT_CODES, type Margins, type MarkdownBody, MarkdownBytesSchema, MarkdownEditor, MarkdownList, type MarkdownListInit, type MarkdownMathLoweringOptions, MarkdownParagraph, type ParagraphInit$1 as MarkdownParagraphInit, type MarkdownRenderDiagnostic, type MarkdownRenderDiagnosticCode, MarkdownRenderDiagnosticCodes, type MarkdownRenderDiagnosticSeverity, type MarkdownRenderDiagnosticSink, MarkdownRun, type RunInit$1 as MarkdownRunInit, MarkdownTable, MarkdownTableCell, type TableInit$1 as MarkdownTableInit, MarkdownTableRow, type MathAssembledGlyphs, type MathBox, type MathColor, type MathDiagnostic, type MathDiagnosticKind, type MathFont, type MathFontDescriptorMetrics, type MathFontMetrics, type MathGlyphMetrics, type MathGlyphPlacement, type MathGlyphRun, type MathLayoutItem, type MathLayoutResult, type MathLintCode, type MathLintDiagnostic, type MathMlAttribute, type MathMlElement, type MathMlNode, type MathMlText, type MathRule, type MathStretchAxis, type MathStretchGlyph, type MathStretchResult, type MathStroke, type MathVariant, type MetadataOverrides, NOOP_DIAGNOSTIC_SINK, type NumberingDefinition, NumberingDefinitionSchema, type NumberingDefinitions, type NumberingLevel, NumberingLevelSchema, type OdbComponentInfo, type OdbConnectionInfo, type OdbConversionOptions, type OdbForm, type OdbFormControl, type OdbFormDefinition, type OdbInventory, OdbNoEmbeddedDataSourceError, type OdbQueryInfo, type OdbReport, type OdbReportBand, type OdbReportContentOptions, OdbReportDataSourceError, type OdbReportElement, type OdbReportFunction, type OdbReportGroup, OdbReportNotSpecifiedError, type OdbReportToDocxOptions, type OdbReportToOdtOptions, OdbTableNotFoundError, OdbTableNotSpecifiedError, type OdbToCsvOptions, type OdbUnsupportedFormat, OdbUnsupportedFormatError, OdfEmbeddedFontError, OdgBoxVector, type BoxVectorInit as OdgBoxVectorInit, OdgBytesSchema, OdgEditor, OdgLineVector, type LineVectorInit as OdgLineVectorInit, OdgPage, type PageImageInit as OdgPageImageInit, OdgPathVector, type PathVectorInit as OdgPathVectorInit, type TextBoxInit as OdgTextBoxInit, type OdgVector, type OdgVectorKind, type OdmToPdfOptions, OdmUnresolvedSectionError, OdpBytesSchema, OdpEditor, OdpShape, OdpSlide, type SlideImageInit as OdpSlideImageInit, type SlideTableInit as OdpSlideTableInit, type TextBoxInit$1 as OdpTextBoxInit, OdsBytesSchema, OdsCell, OdsEditor, OdsSheet, type OdtBody, OdtBytesSchema, OdtCoveredTableCell, OdtEditor, OdtList, OdtListItem, OdtParagraph, type ParagraphInit$2 as OdtParagraphInit, OdtRun, type RunInit$2 as OdtRunInit, OdtTable, OdtTableCell, type TableInit$2 as OdtTableInit, OdtTableRow, type OmmlDiagnostic, type OmmlDiagnosticKind, type OmmlReadResult, type OmmlWriteResult, OoxmlEmbeddedFontError, type OperatorProperties, PAGE_SIZE_A4, PAGE_SIZE_LETTER, type Package, PackageSchema, type PageInit, type PageSize, type Part, PartSchema, type PatchDocxMetadataOptions, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEditor, type PdfEllipseInit, PdfEllipseItem, PdfEncryptedError, type PdfImageInit, PdfImageItem, PdfInternalLinkItem, type PdfItem, type PdfLineInit, PdfLineItem, type PdfLinkInit, PdfLinkItem, PdfPage, PdfParseError, type PdfPathInit, PdfPathItem, type PdfRectInit, PdfRectItem, type PdfTextInit, PdfTextItem, type PdfToDocumentOptions, type PositionedFormula, PptBytesSchema, PptEditor, PptShape, PptSlide, PptxBytesSchema, PptxEditor, PptxShape, PptxSlide, PptxTable, PptxTableCell, type PptxTableInit, PptxTableRow, type PresentationLayoutResult, type ProvidedFont, type ReadCsvContentOptions, type ReadDocumentMetadataOptions, type ReadDocxContentOptions, type ReadFirebirdBackupResult, type ReadNativeDocumentTreeOptions, type ReadPdfOptions, type ReadSvgContentOptions, type ReconstructOptions, type Relationship, type RenderMarkdownOptions, type ResolvedFace, type RptAggregateFunction, type RptBandDefinition, type RptBandInstance, type RptBandKind, type RptFormula, RptFormulaEvaluationError, RptFormulaParseError, RptFormulaUnsupportedError, type RptGroupDefinition, type RptNamedFunctionDefinition, type RptReference, type RptReportDefinition, type RptReportRun, RptReportStructureError, type RptScope, RtfBytesSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, SVG_DIAGNOSTIC_CODES, type SectionHeaderFooterReferences, SectionHeaderFooterReferencesSchema, type SetDocumentMetadataOptions, type SheetsLayoutOptions, type SlideImageInit$1 as SlideImageInit, type SlideTableInit$1 as SlideTableInit, type SlidesLayoutOptions, type SpreadsheetLayoutResult, type SqlAggregateArgument, type SqlAggregateFunction, type SqlColumnRef, type SqlComparisonOperator, type SqlFromClause, type SqlFromSource, type SqlJoinClause, type SqlLiteral, type SqlNameRef, type SqlOperand, type SqlOrderByTerm, type SqlPredicate, type SqlPunctuation, type SqlResultSet, type SqlSelectItem, type SqlSelectStatement, type SqlSortDirection, type SqlToken, SvgBytesSchema, type SvgDiagnostic, type SvgDiagnosticCode, type SvgDiagnosticSink, SvgMissingRootElementError, SvgMultiPageNotSpecifiedError, SvgPageNotFoundError, type SvgReadOptions, SvgUndecodableTextError, SvgUnsupportedDocumentKindError, SvgUnsupportedEncodingError, type SvgWriteOptions, type TableGridCell, type TableGridRows, type TextBoxInit$2 as TextBoxInit, type UnifiedConversionOptions, UnrecognizedDocumentSchemaError, UnsupportedFontSourceFormatError, UnsupportedPackageFormatError, type WinAnsiSubstitution, type WordprocessingLayoutResult, type WritePdfOptions, XlsBytesSchema, XlsCell, type XlsContentDocument, XlsEditor, XlsSheet, XlsxBytesSchema, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, applyMathVariant, attr, base64ToBytes, buildCsvText, buildDocumentBytes, buildDocxPackage, buildDrawingBlock, buildFormulaBlock, buildMarkdownText, buildOdgPackage, buildOdpPackage, buildOdsPackage, buildOdtPackage, buildOfficeMath, buildOfficeMathParagraph, buildPptxPackage, buildSvgText, buildXlsxPackage, buildXml, bytesToBase64, cellReference, childrenWithTag, collectDocumentFormulas, collectOfficeMathElements, columnIndexToLetters, columnLettersToIndex, compactCodec, compactPackageCodec, contentDocumentWithSchema, convertDocument, convertDrawingToLayout, convertPresentationToLayout, convertSpreadsheetToLayout, convertWordprocessingToLayout, createDoc, createDocumentFontRegistry, createDocx, createFontMeasurer, createFontRegistry, createLocalDocumentConverter, createMarkdownEditor, createOdg, createOdp, createOds, createOdt, createPdf, createPpt, createPptx, createStandardFontMeasurer, createXls, csvMarkdownCodec, csvPdfCodec, csvToMarkdown, csvToOds, csvToPdf, csvToXlsx, decodeCompactPackage, decodeCsvText, decodeDocumentPackage, decodeEntities, decodeHsqldbCachedTables, decodeMarkdownText, decodeOdbPackage, decodePackage, decodeSvgText, deobfuscateEmbeddedFont, deriveFontKey, describeFontFace, detectGridLattice, docPdfCodec, docToPdf, documentFromJson, documentSchemaKindOf, documentTreeWithSchema, docxPdfCodec, docxToMarkdown, docxToOdt, docxToPdf, docxToPptx, drawingOfBlock, elementChildren, elementLocalName, elementsWithTag, embeddedPresentationSerialiser, encodeCompactPackage, encodeCsvText, encodeDocumentPackage, encodeMarkdownText, encodePackage, encodeSvgText, epubPdfCodec, epubToPdf, evaluateRptBandOutsideData, evaluateSelect, extractOdfEmbeddedFonts, extractOoxmlEmbeddedFonts, extractSourceFonts, extractSourceFontsForFormat, firstChildByLocalName, fixedClock, flipY, formulaDocument, formulaOfBlock, formulaPlaceholderText, fromCompact, displayTextFor as hsqldbCellDisplayText, inferCellValue, inflateHsqldbCompressedScript, isCompactXmlNode, isContentBlock, isMathMlElement, isMathVariant, isXmlNode, latexToFormula, layoutDocumentFromPackage, layoutFormula, lintMathCoherence, loadMathFont, localName, looksLikeSfnt, lowerLatex, lowerMarkdownMath, mapMathVariant, markdownDocxCodec, markdownOdtCodec, markdownPdfCodec, markdownToCsv, markdownToDocx, markdownToOdt, markdownToPdf, markdownToXlsx, textContent as mathMlTextContent, odbReportCommandSql, odbReportGroupChain, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbTablesToSpreadsheetDocument, odbToCsv, odbToXlsx, odfToPdf, odgPdfCodec, odgSvgCodec, odgToPdf, odgToSvg, odmToPdf, odpPdfCodec, odpPptxCodec, odpToOdt, odpToPdf, odpToPptx, odsCsvCodec, odsPdfCodec, odsToCsv, odsToPdf, odsToXlsx, odsXlsxCodec, odtDocxCodec, odtPdfCodec, odtToDocx, odtToMarkdown, odtToOdp, odtToPdf, openDoc, openDocx, openMarkdown, openOdg, openOdp, openOds, openOdt, openPdf, openPpt, openPptx, openXls, operatorProperties, packageCodec, parseCellReference, parseHsqldbBinaryScript, parseHsqldbScript, parsePackage, parseRangeReference, parseRptFormula, parseSelect, parseXml, patchDocxMetadata, pdfCodec, pdfToCsv, pdfToDoc, pdfToDocx, pdfToEpub, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPpt, pdfToPptx, pdfToRtf, pdfToSvg, pdfToXls, pdfToXlsx, pptPdfCodec, pptToPdf, pptxPdfCodec, pptxToDocx, pptxToOdp, pptxToPdf, rangeReference, readCsvContent, readDocContent, readDocumentMetadata, readDocxContent, readDocxExtras, readEpubContent, readFirebirdBackup, readMarkdownContent, readNativeDocumentTree, readOdbForm, readOdbForms, readOdbInventory, readOdbReport, readOdbReportContent, readOdbReports, readOdbTables, readOdfEmbeddedFormula, readOdfFormulaContent, readOdgContent, readOdpContent, readOdsContent, readOdtContent, readOfficeMath, readPdf, readPptContent, readPptxContent, readRtfContent, readSvgContent, readWpdContent, readXlsContent, readXlsxContent, reconstructDrawing, reconstructPresentation, reconstructSpreadsheet, reconstructWordprocessing, renderContentDocumentToMarkdown, renderOdbReportContent, resolveCompositionPlan, resolveMetadataTimestamps, resolveOdbComponent, resolveOdbReportRows, resolveRelationships, rgbHexToColor, rootElement, rptBandDefinition, rptDefinitionFromReport, rtfPdfCodec, rtfToPdf, runRptReport, schemaUriFor, serializePackage, setDocumentMetadata, svgPdfCodec, svgToOdg, svgToPdf, systemClock, textContent$1 as textContent, throwIfAborted, toCompact, tokenizeSql, unzipPackage, walk, writeDocContent, writeEpubContent, writePdf, writePptContent, writeRtfContent, writeXlsContent, displayTextOfValue as xlsDisplayTextOfValue, xlsPdfCodec, xlsToPdf, xlsxCsvCodec, xlsxMarkdownCodec, xlsxPdfCodec, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf, xmlCodec, zipPackage };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { flipY } from "./model/geometry.js";
|
|
2
|
+
import { SvgUndecodableTextError, SvgUnsupportedEncodingError, decodeSvgText, encodeSvgText } from "./svg/text.js";
|
|
2
3
|
import { CsvBytesSchema, DocBytesSchema, DocxBytesSchema, MarkdownBytesSchema, OdgBytesSchema, OdpBytesSchema, OdsBytesSchema, OdtBytesSchema, PdfBytesSchema, PptBytesSchema, PptxBytesSchema, SvgBytesSchema, XlsBytesSchema, XlsxBytesSchema } from "./model/bytes.js";
|
|
3
4
|
import { resolveMetadataTimestamps } from "./model/metadata.js";
|
|
4
5
|
import { fixedClock, systemClock } from "./ports/clock.js";
|
|
@@ -81,7 +82,6 @@ import { inferCellValue } from "./layout/cell-typing.js";
|
|
|
81
82
|
import { CsvParseError } from "./csv/records.js";
|
|
82
83
|
import { readCsvContent } from "./csv/read.js";
|
|
83
84
|
import { CsvSheetNotFoundError, CsvSheetNotSpecifiedError, CsvUnsupportedDocumentKindError, buildCsvText } from "./csv/write.js";
|
|
84
|
-
import { SvgInvalidUtf8Error, decodeSvgText, encodeSvgText } from "./svg/text.js";
|
|
85
85
|
import { SvgMissingRootElementError, readSvgContent } from "./svg/read.js";
|
|
86
86
|
import { SvgMultiPageNotSpecifiedError, SvgPageNotFoundError, SvgUnsupportedDocumentKindError, buildSvgText } from "./svg/write.js";
|
|
87
87
|
import { SVG_DIAGNOSTIC_CODES } from "./svg/diagnostics.js";
|
|
@@ -137,4 +137,4 @@ import { readXlsContent, writeXlsContent } from "xls-codec";
|
|
|
137
137
|
import { RtfBytesSchema, readRtfContent, writeRtfContent } from "rtf-codec";
|
|
138
138
|
import { EpubBytesSchema, readEpubContent, writeEpubContent } from "epub-codec";
|
|
139
139
|
import { readWpdContent } from "wpd-codec";
|
|
140
|
-
export { AttributeSchema, BinaryPartSchema, COLOR_BLACK, CommentSchema, CompactPackageSchema, CompactPartSchema, CompactXmlNodeSchema, ContentBlockSchema, ContentCellValueSchema, ContentDocumentSchema, ContentDrawPageSchema, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectSchema, ContentImageBlockSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentStrokeSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, ContentVectorSchema, CsvBytesSchema, CsvParseError, CsvSheetNotFoundError, CsvSheetNotSpecifiedError, CsvUndecodableTextError, CsvUnsupportedDocumentKindError, DEFAULT_LAYOUT_FONT, DOCUMENT_FORMATS, DefinedNameSchema, DocBytesSchema, DocEditor, DocParagraph, DocRun, DocSection, DocTable, DocTableCell, DocTableRow, DocumentFormatSchema, DocumentTreeSchema, DocxBytesSchema, DocxEditor, DocxParagraph, DocxRun, DocxTable, DocxTableCell, DocxTableRow, EpubBytesSchema, SUPPORTED_BACKUP_FORMAT_VERSION as FIREBIRD_SUPPORTED_BACKUP_FORMAT_VERSION, FirebirdBackupFormatError, FirebirdBackupParseError, FirebirdCompositeRecordUnsupportedError, FirebirdDataParseError, FirebirdSchemaParseError, FirebirdUnsupportedFieldTypeError, FontDeobfuscationError, FontFaceParseError, FootnoteSchema, HeaderFooterPartSchema, HsqldbBinaryScriptParseError, HsqldbRowFormatError, HsqldbScriptParseError, HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, LATEX_DIAGNOSTIC_CODES, LAYOUT_FORMAT_VERSION, LayoutDocumentSchema, MATH_LINT_CODES, MarkdownBytesSchema, MarkdownEditor, MarkdownList, MarkdownParagraph, MarkdownRenderDiagnosticCodes, MarkdownRun, MarkdownTable, MarkdownTableCell, MarkdownTableRow, NOOP_DIAGNOSTIC_SINK, NumberingDefinitionSchema, NumberingLevelSchema, OdbNoEmbeddedDataSourceError, OdbReportDataSourceError, OdbReportNotSpecifiedError, OdbTableNotFoundError, OdbTableNotSpecifiedError, OdbUnsupportedFormatError, OdfEmbeddedFontError, OdgBoxVector, OdgBytesSchema, OdgEditor, OdgLineVector, OdgPage, OdgPathVector, OdmUnresolvedSectionError, OdpBytesSchema, OdpEditor, OdpShape, OdpSlide, OdsBytesSchema, OdsCell, OdsEditor, OdsSheet, OdtBytesSchema, OdtCoveredTableCell, OdtEditor, OdtList, OdtListItem, OdtParagraph, OdtRun, OdtTable, OdtTableCell, OdtTableRow, OoxmlEmbeddedFontError, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PackageSchema, PartSchema, PdfBytesSchema, PdfEditor, PdfEllipseItem, PdfEncryptedError, PdfImageItem, PdfInternalLinkItem, PdfLineItem, PdfLinkItem, PdfPage, PdfParseError, PdfPathItem, PdfRectItem, PdfTextItem, PptBytesSchema, PptEditor, PptShape, PptSlide, PptxBytesSchema, PptxEditor, PptxShape, PptxSlide, PptxTable, PptxTableCell, PptxTableRow, RptFormulaEvaluationError, RptFormulaParseError, RptFormulaUnsupportedError, RptReportStructureError, RtfBytesSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, SVG_DIAGNOSTIC_CODES, SectionHeaderFooterReferencesSchema, SvgBytesSchema,
|
|
140
|
+
export { AttributeSchema, BinaryPartSchema, COLOR_BLACK, CommentSchema, CompactPackageSchema, CompactPartSchema, CompactXmlNodeSchema, ContentBlockSchema, ContentCellValueSchema, ContentDocumentSchema, ContentDrawPageSchema, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectSchema, ContentImageBlockSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentStrokeSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, ContentVectorSchema, CsvBytesSchema, CsvParseError, CsvSheetNotFoundError, CsvSheetNotSpecifiedError, CsvUndecodableTextError, CsvUnsupportedDocumentKindError, DEFAULT_LAYOUT_FONT, DOCUMENT_FORMATS, DefinedNameSchema, DocBytesSchema, DocEditor, DocParagraph, DocRun, DocSection, DocTable, DocTableCell, DocTableRow, DocumentFormatSchema, DocumentTreeSchema, DocxBytesSchema, DocxEditor, DocxParagraph, DocxRun, DocxTable, DocxTableCell, DocxTableRow, EpubBytesSchema, SUPPORTED_BACKUP_FORMAT_VERSION as FIREBIRD_SUPPORTED_BACKUP_FORMAT_VERSION, FirebirdBackupFormatError, FirebirdBackupParseError, FirebirdCompositeRecordUnsupportedError, FirebirdDataParseError, FirebirdSchemaParseError, FirebirdUnsupportedFieldTypeError, FontDeobfuscationError, FontFaceParseError, FootnoteSchema, HeaderFooterPartSchema, HsqldbBinaryScriptParseError, HsqldbRowFormatError, HsqldbScriptParseError, HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, LATEX_DIAGNOSTIC_CODES, LAYOUT_FORMAT_VERSION, LayoutDocumentSchema, MATH_LINT_CODES, MarkdownBytesSchema, MarkdownEditor, MarkdownList, MarkdownParagraph, MarkdownRenderDiagnosticCodes, MarkdownRun, MarkdownTable, MarkdownTableCell, MarkdownTableRow, NOOP_DIAGNOSTIC_SINK, NumberingDefinitionSchema, NumberingLevelSchema, OdbNoEmbeddedDataSourceError, OdbReportDataSourceError, OdbReportNotSpecifiedError, OdbTableNotFoundError, OdbTableNotSpecifiedError, OdbUnsupportedFormatError, OdfEmbeddedFontError, OdgBoxVector, OdgBytesSchema, OdgEditor, OdgLineVector, OdgPage, OdgPathVector, OdmUnresolvedSectionError, OdpBytesSchema, OdpEditor, OdpShape, OdpSlide, OdsBytesSchema, OdsCell, OdsEditor, OdsSheet, OdtBytesSchema, OdtCoveredTableCell, OdtEditor, OdtList, OdtListItem, OdtParagraph, OdtRun, OdtTable, OdtTableCell, OdtTableRow, OoxmlEmbeddedFontError, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PackageSchema, PartSchema, PdfBytesSchema, PdfEditor, PdfEllipseItem, PdfEncryptedError, PdfImageItem, PdfInternalLinkItem, PdfLineItem, PdfLinkItem, PdfPage, PdfParseError, PdfPathItem, PdfRectItem, PdfTextItem, PptBytesSchema, PptEditor, PptShape, PptSlide, PptxBytesSchema, PptxEditor, PptxShape, PptxSlide, PptxTable, PptxTableCell, PptxTableRow, RptFormulaEvaluationError, RptFormulaParseError, RptFormulaUnsupportedError, RptReportStructureError, RtfBytesSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, SVG_DIAGNOSTIC_CODES, SectionHeaderFooterReferencesSchema, SvgBytesSchema, SvgMissingRootElementError, SvgMultiPageNotSpecifiedError, SvgPageNotFoundError, SvgUndecodableTextError, SvgUnsupportedDocumentKindError, SvgUnsupportedEncodingError, UnrecognizedDocumentSchemaError, UnsupportedFontSourceFormatError, UnsupportedPackageFormatError, XlsBytesSchema, XlsCell, XlsEditor, XlsSheet, XlsxBytesSchema, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPartSchema, XmlPiSchema, XmlTextSchema, applyMathVariant, attr, base64ToBytes, buildCsvText, buildDocumentBytes, buildDocxPackage, buildDrawingBlock, buildFormulaBlock, buildMarkdownText, buildOdgPackage, buildOdpPackage, buildOdsPackage, buildOdtPackage, buildOfficeMath, buildOfficeMathParagraph, buildPptxPackage, buildSvgText, buildXlsxPackage, buildXml, bytesToBase64, cellReference, childrenWithTag, collectDocumentFormulas, collectOfficeMathElements, columnIndexToLetters, columnLettersToIndex, compactCodec, compactPackageCodec, contentDocumentWithSchema, convertDocument, convertDrawingToLayout, convertPresentationToLayout, convertSpreadsheetToLayout, convertWordprocessingToLayout, createDoc, createDocumentFontRegistry, createDocx, createFontMeasurer, createFontRegistry, createLocalDocumentConverter, createMarkdownEditor, createOdg, createOdp, createOds, createOdt, createPdf, createPpt, createPptx, createStandardFontMeasurer, createXls, csvMarkdownCodec, csvPdfCodec, csvToMarkdown, csvToOds, csvToPdf, csvToXlsx, decodeCompactPackage, decodeCsvText, decodeDocumentPackage, decodeEntities, decodeHsqldbCachedTables, decodeMarkdownText, decodeOdbPackage, decodePackage, decodeSvgText, deobfuscateEmbeddedFont, deriveFontKey, describeFontFace, detectGridLattice, docPdfCodec, docToPdf, documentFromJson, documentSchemaKindOf, documentTreeWithSchema, docxPdfCodec, docxToMarkdown, docxToOdt, docxToPdf, docxToPptx, drawingOfBlock, elementChildren, elementLocalName, elementsWithTag, embeddedPresentationSerialiser, encodeCompactPackage, encodeCsvText, encodeDocumentPackage, encodeMarkdownText, encodePackage, encodeSvgText, epubPdfCodec, epubToPdf, evaluateRptBandOutsideData, evaluateSelect, extractOdfEmbeddedFonts, extractOoxmlEmbeddedFonts, extractSourceFonts, extractSourceFontsForFormat, firstChildByLocalName, fixedClock, flipY, formulaDocument, formulaOfBlock, formulaPlaceholderText, fromCompact, displayTextFor as hsqldbCellDisplayText, inferCellValue, inflateHsqldbCompressedScript, isCompactXmlNode, isContentBlock, isMathMlElement, isMathVariant, isXmlNode, latexToFormula, layoutDocumentFromPackage, layoutFormula, lintMathCoherence, loadMathFont, localName, looksLikeSfnt, lowerLatex, lowerMarkdownMath, mapMathVariant, markdownDocxCodec, markdownOdtCodec, markdownPdfCodec, markdownToCsv, markdownToDocx, markdownToOdt, markdownToPdf, markdownToXlsx, textContent as mathMlTextContent, odbReportCommandSql, odbReportGroupChain, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbTablesToSpreadsheetDocument, odbToCsv, odbToXlsx, odfToPdf, odgPdfCodec, odgSvgCodec, odgToPdf, odgToSvg, odmToPdf, odpPdfCodec, odpPptxCodec, odpToOdt, odpToPdf, odpToPptx, odsCsvCodec, odsPdfCodec, odsToCsv, odsToPdf, odsToXlsx, odsXlsxCodec, odtDocxCodec, odtPdfCodec, odtToDocx, odtToMarkdown, odtToOdp, odtToPdf, openDoc, openDocx, openMarkdown, openOdg, openOdp, openOds, openOdt, openPdf, openPpt, openPptx, openXls, operatorProperties, packageCodec, parseCellReference, parseHsqldbBinaryScript, parseHsqldbScript, parsePackage, parseRangeReference, parseRptFormula, parseSelect, parseXml, patchDocxMetadata, pdfCodec, pdfToCsv, pdfToDoc, pdfToDocx, pdfToEpub, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPpt, pdfToPptx, pdfToRtf, pdfToSvg, pdfToXls, pdfToXlsx, pptPdfCodec, pptToPdf, pptxPdfCodec, pptxToDocx, pptxToOdp, pptxToPdf, rangeReference, readCsvContent, readDocContent, readDocumentMetadata, readDocxContent, readDocxExtras, readEpubContent, readFirebirdBackup, readMarkdownContent, readNativeDocumentTree, readOdbForm, readOdbForms, readOdbInventory, readOdbReport, readOdbReportContent, readOdbReports, readOdbTables, readOdfEmbeddedFormula, readOdfFormulaContent, readOdgContent, readOdpContent, readOdsContent, readOdtContent, readOfficeMath, readPdf, readPptContent, readPptxContent, readRtfContent, readSvgContent, readWpdContent, readXlsContent, readXlsxContent, reconstructDrawing, reconstructPresentation, reconstructSpreadsheet, reconstructWordprocessing, renderContentDocumentToMarkdown, renderOdbReportContent, resolveCompositionPlan, resolveMetadataTimestamps, resolveOdbComponent, resolveOdbReportRows, resolveRelationships, rgbHexToColor, rootElement, rptBandDefinition, rptDefinitionFromReport, rtfPdfCodec, rtfToPdf, runRptReport, schemaUriFor, serializePackage, setDocumentMetadata, svgPdfCodec, svgToOdg, svgToPdf, systemClock, textContent$1 as textContent, throwIfAborted, toCompact, tokenizeSql, unzipPackage, walk, writeDocContent, writeEpubContent, writePdf, writePptContent, writeRtfContent, writeXlsContent, displayTextOfValue as xlsDisplayTextOfValue, xlsPdfCodec, xlsToPdf, xlsxCsvCodec, xlsxMarkdownCodec, xlsxPdfCodec, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf, xmlCodec, zipPackage };
|
package/dist/model/bytes.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_svg_text = require("../svg/text.cjs");
|
|
2
3
|
let zod = require("zod");
|
|
3
4
|
let byte_codec = require("byte-codec");
|
|
4
5
|
let odf_js = require("odf.js");
|
|
@@ -102,18 +103,14 @@ function isDecodableText(bytes) {
|
|
|
102
103
|
}
|
|
103
104
|
const MarkdownBytesSchema = zod.z.instanceof(Uint8Array).refine(isDecodableText, { message: "not text in any supported character encoding" });
|
|
104
105
|
const CsvBytesSchema = zod.z.instanceof(Uint8Array).refine(isDecodableText, { message: "not text in any supported character encoding" });
|
|
105
|
-
function
|
|
106
|
+
function trySvgText(bytes) {
|
|
106
107
|
try {
|
|
107
|
-
|
|
108
|
-
return true;
|
|
108
|
+
return require_svg_text.decodeSvgText(bytes);
|
|
109
109
|
} catch {
|
|
110
|
-
return
|
|
110
|
+
return;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
const SvgBytesSchema = zod.z.instanceof(Uint8Array).refine((bytes) => {
|
|
114
|
-
if (!isWellFormedUtf8Text(bytes)) return false;
|
|
115
|
-
return new TextDecoder().decode(bytes).toLowerCase().includes("<svg");
|
|
116
|
-
}, { message: "not a valid SVG file: not well-formed UTF-8 text containing an <svg root element" });
|
|
113
|
+
const SvgBytesSchema = zod.z.instanceof(Uint8Array).refine((bytes) => trySvgText(bytes)?.toLowerCase().includes("<svg") ?? false, { message: "not a valid SVG file: not decodable text (per its own declared encoding, or UTF-8 by XML's default) containing an <svg root element" });
|
|
117
114
|
function isArrayBufferBacked(bytes) {
|
|
118
115
|
return bytes.buffer instanceof ArrayBuffer;
|
|
119
116
|
}
|
package/dist/model/bytes.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { decodeSvgText } from "../svg/text.js";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
import { tryDecodeText } from "byte-codec";
|
|
3
4
|
import { ODF_MEDIA_TYPES } from "odf.js";
|
|
@@ -101,18 +102,14 @@ function isDecodableText(bytes) {
|
|
|
101
102
|
}
|
|
102
103
|
const MarkdownBytesSchema = z.instanceof(Uint8Array).refine(isDecodableText, { message: "not text in any supported character encoding" });
|
|
103
104
|
const CsvBytesSchema = z.instanceof(Uint8Array).refine(isDecodableText, { message: "not text in any supported character encoding" });
|
|
104
|
-
function
|
|
105
|
+
function trySvgText(bytes) {
|
|
105
106
|
try {
|
|
106
|
-
|
|
107
|
-
return true;
|
|
107
|
+
return decodeSvgText(bytes);
|
|
108
108
|
} catch {
|
|
109
|
-
return
|
|
109
|
+
return;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
const SvgBytesSchema = z.instanceof(Uint8Array).refine((bytes) => {
|
|
113
|
-
if (!isWellFormedUtf8Text(bytes)) return false;
|
|
114
|
-
return new TextDecoder().decode(bytes).toLowerCase().includes("<svg");
|
|
115
|
-
}, { message: "not a valid SVG file: not well-formed UTF-8 text containing an <svg root element" });
|
|
112
|
+
const SvgBytesSchema = z.instanceof(Uint8Array).refine((bytes) => trySvgText(bytes)?.toLowerCase().includes("<svg") ?? false, { message: "not a valid SVG file: not decodable text (per its own declared encoding, or UTF-8 by XML's default) containing an <svg root element" });
|
|
116
113
|
function isArrayBufferBacked(bytes) {
|
|
117
114
|
return bytes.buffer instanceof ArrayBuffer;
|
|
118
115
|
}
|
package/dist/svg/text.cjs
CHANGED
|
@@ -1,22 +1,55 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_svg_xml_encoding = require("./xml-encoding.cjs");
|
|
3
|
+
let byte_codec = require("byte-codec");
|
|
2
4
|
//#region src/svg/text.ts
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/** Thrown when an SVG document's own `<?xml ... encoding="..."?>` declaration names an encoding outside byte-codec's own bounded decodeText set: a legacy CJK or Cyrillic code page, or a name this package does not recognise as an alias of one of the six it does support (ExaDev/documents.js#1361). */
|
|
6
|
+
var SvgUnsupportedEncodingError = class extends Error {
|
|
7
|
+
/** The declaration's own raw label, exactly as written in the document. */
|
|
8
|
+
label;
|
|
9
|
+
constructor(label) {
|
|
10
|
+
super(`svg declares an encoding this package cannot decode: "${label}" (ExaDev/documents.js#1361)`);
|
|
11
|
+
this.name = "SvgUnsupportedEncodingError";
|
|
12
|
+
this.label = label;
|
|
7
13
|
}
|
|
8
14
|
};
|
|
15
|
+
/** Thrown when svg bytes cannot be decoded as text under the encoding that settled it: a byte order mark or an `<?xml ...?>` declaration named one the bytes then contradict, or, with neither present, the bytes are not well-formed UTF-8, XML's own default. */
|
|
16
|
+
var SvgUndecodableTextError = class extends Error {
|
|
17
|
+
/** The encoding the bytes were decoded against and failed. */
|
|
18
|
+
encoding;
|
|
19
|
+
constructor(encoding, cause) {
|
|
20
|
+
super(`svg bytes are not well-formed ${encoding}: ${cause.message}`, { cause });
|
|
21
|
+
this.name = "SvgUndecodableTextError";
|
|
22
|
+
this.encoding = encoding;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Decodes svg bytes to text, honouring the encoding a byte order mark or an `<?xml ...?>` declaration names and defaulting to strict UTF-8, XML's own default, when neither is present.
|
|
27
|
+
* @param bytes - The svg bytes.
|
|
28
|
+
* @throws SvgUnsupportedEncodingError When the declaration names an encoding outside byte-codec's own bounded set.
|
|
29
|
+
* @throws SvgUndecodableTextError When the bytes contradict the encoding that settled them.
|
|
30
|
+
* @returns The svg text.
|
|
31
|
+
*/
|
|
9
32
|
function decodeSvgText(bytes) {
|
|
33
|
+
const detected = require_svg_xml_encoding.detectSvgEncoding(bytes);
|
|
34
|
+
if (detected?.kind === "unsupported") throw new SvgUnsupportedEncodingError(detected.label);
|
|
35
|
+
const encoding = detected?.encoding ?? "utf-8";
|
|
10
36
|
try {
|
|
11
|
-
return
|
|
12
|
-
} catch {
|
|
13
|
-
throw new
|
|
37
|
+
return (0, byte_codec.decodeText)(bytes, { encoding }).text;
|
|
38
|
+
} catch (error) {
|
|
39
|
+
if (error instanceof byte_codec.UndecodableTextError) throw new SvgUndecodableTextError(encoding, error);
|
|
40
|
+
throw error;
|
|
14
41
|
}
|
|
15
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Encodes svg text as UTF-8 bytes, with no `<?xml ...?>` declaration of its own.
|
|
45
|
+
* @param text - The svg text.
|
|
46
|
+
* @returns The UTF-8 bytes. A byte stream with no declaration and no byte order mark is UTF-8 under XML's own default, so {@link decodeSvgText} reads it back correctly without one.
|
|
47
|
+
*/
|
|
16
48
|
function encodeSvgText(text) {
|
|
17
49
|
return new TextEncoder().encode(text);
|
|
18
50
|
}
|
|
19
51
|
//#endregion
|
|
20
|
-
exports.
|
|
52
|
+
exports.SvgUndecodableTextError = SvgUndecodableTextError;
|
|
53
|
+
exports.SvgUnsupportedEncodingError = SvgUnsupportedEncodingError;
|
|
21
54
|
exports.decodeSvgText = decodeSvgText;
|
|
22
55
|
exports.encodeSvgText = encodeSvgText;
|
package/dist/svg/text.d.cts
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
|
+
import { TextEncodingLabel, UndecodableTextError } from "byte-codec";
|
|
1
2
|
//#region src/svg/text.d.ts
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
/** Thrown when an SVG document's own `<?xml ... encoding="..."?>` declaration names an encoding outside byte-codec's own bounded decodeText set: a legacy CJK or Cyrillic code page, or a name this package does not recognise as an alias of one of the six it does support (ExaDev/documents.js#1361). */
|
|
4
|
+
declare class SvgUnsupportedEncodingError extends Error {
|
|
5
|
+
/** The declaration's own raw label, exactly as written in the document. */
|
|
6
|
+
readonly label: string;
|
|
7
|
+
constructor(label: string);
|
|
4
8
|
}
|
|
9
|
+
/** Thrown when svg bytes cannot be decoded as text under the encoding that settled it: a byte order mark or an `<?xml ...?>` declaration named one the bytes then contradict, or, with neither present, the bytes are not well-formed UTF-8, XML's own default. */
|
|
10
|
+
declare class SvgUndecodableTextError extends Error {
|
|
11
|
+
/** The encoding the bytes were decoded against and failed. */
|
|
12
|
+
readonly encoding: TextEncodingLabel;
|
|
13
|
+
constructor(encoding: TextEncodingLabel, cause: UndecodableTextError);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Decodes svg bytes to text, honouring the encoding a byte order mark or an `<?xml ...?>` declaration names and defaulting to strict UTF-8, XML's own default, when neither is present.
|
|
17
|
+
* @param bytes - The svg bytes.
|
|
18
|
+
* @throws SvgUnsupportedEncodingError When the declaration names an encoding outside byte-codec's own bounded set.
|
|
19
|
+
* @throws SvgUndecodableTextError When the bytes contradict the encoding that settled them.
|
|
20
|
+
* @returns The svg text.
|
|
21
|
+
*/
|
|
5
22
|
declare function decodeSvgText(bytes: Uint8Array): string;
|
|
23
|
+
/**
|
|
24
|
+
* Encodes svg text as UTF-8 bytes, with no `<?xml ...?>` declaration of its own.
|
|
25
|
+
* @param text - The svg text.
|
|
26
|
+
* @returns The UTF-8 bytes. A byte stream with no declaration and no byte order mark is UTF-8 under XML's own default, so {@link decodeSvgText} reads it back correctly without one.
|
|
27
|
+
*/
|
|
6
28
|
declare function encodeSvgText(text: string): Uint8Array<ArrayBuffer>;
|
|
7
29
|
//#endregion
|
|
8
|
-
export {
|
|
30
|
+
export { SvgUndecodableTextError, SvgUnsupportedEncodingError, decodeSvgText, encodeSvgText };
|
package/dist/svg/text.d.ts
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
|
+
import { TextEncodingLabel, UndecodableTextError } from "byte-codec";
|
|
1
2
|
//#region src/svg/text.d.ts
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
/** Thrown when an SVG document's own `<?xml ... encoding="..."?>` declaration names an encoding outside byte-codec's own bounded decodeText set: a legacy CJK or Cyrillic code page, or a name this package does not recognise as an alias of one of the six it does support (ExaDev/documents.js#1361). */
|
|
4
|
+
declare class SvgUnsupportedEncodingError extends Error {
|
|
5
|
+
/** The declaration's own raw label, exactly as written in the document. */
|
|
6
|
+
readonly label: string;
|
|
7
|
+
constructor(label: string);
|
|
4
8
|
}
|
|
9
|
+
/** Thrown when svg bytes cannot be decoded as text under the encoding that settled it: a byte order mark or an `<?xml ...?>` declaration named one the bytes then contradict, or, with neither present, the bytes are not well-formed UTF-8, XML's own default. */
|
|
10
|
+
declare class SvgUndecodableTextError extends Error {
|
|
11
|
+
/** The encoding the bytes were decoded against and failed. */
|
|
12
|
+
readonly encoding: TextEncodingLabel;
|
|
13
|
+
constructor(encoding: TextEncodingLabel, cause: UndecodableTextError);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Decodes svg bytes to text, honouring the encoding a byte order mark or an `<?xml ...?>` declaration names and defaulting to strict UTF-8, XML's own default, when neither is present.
|
|
17
|
+
* @param bytes - The svg bytes.
|
|
18
|
+
* @throws SvgUnsupportedEncodingError When the declaration names an encoding outside byte-codec's own bounded set.
|
|
19
|
+
* @throws SvgUndecodableTextError When the bytes contradict the encoding that settled them.
|
|
20
|
+
* @returns The svg text.
|
|
21
|
+
*/
|
|
5
22
|
declare function decodeSvgText(bytes: Uint8Array): string;
|
|
23
|
+
/**
|
|
24
|
+
* Encodes svg text as UTF-8 bytes, with no `<?xml ...?>` declaration of its own.
|
|
25
|
+
* @param text - The svg text.
|
|
26
|
+
* @returns The UTF-8 bytes. A byte stream with no declaration and no byte order mark is UTF-8 under XML's own default, so {@link decodeSvgText} reads it back correctly without one.
|
|
27
|
+
*/
|
|
6
28
|
declare function encodeSvgText(text: string): Uint8Array<ArrayBuffer>;
|
|
7
29
|
//#endregion
|
|
8
|
-
export {
|
|
30
|
+
export { SvgUndecodableTextError, SvgUnsupportedEncodingError, decodeSvgText, encodeSvgText };
|
package/dist/svg/text.js
CHANGED
|
@@ -1,19 +1,51 @@
|
|
|
1
|
+
import { detectSvgEncoding } from "./xml-encoding.js";
|
|
2
|
+
import { UndecodableTextError, decodeText } from "byte-codec";
|
|
1
3
|
//#region src/svg/text.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/** Thrown when an SVG document's own `<?xml ... encoding="..."?>` declaration names an encoding outside byte-codec's own bounded decodeText set: a legacy CJK or Cyrillic code page, or a name this package does not recognise as an alias of one of the six it does support (ExaDev/documents.js#1361). */
|
|
5
|
+
var SvgUnsupportedEncodingError = class extends Error {
|
|
6
|
+
/** The declaration's own raw label, exactly as written in the document. */
|
|
7
|
+
label;
|
|
8
|
+
constructor(label) {
|
|
9
|
+
super(`svg declares an encoding this package cannot decode: "${label}" (ExaDev/documents.js#1361)`);
|
|
10
|
+
this.name = "SvgUnsupportedEncodingError";
|
|
11
|
+
this.label = label;
|
|
6
12
|
}
|
|
7
13
|
};
|
|
14
|
+
/** Thrown when svg bytes cannot be decoded as text under the encoding that settled it: a byte order mark or an `<?xml ...?>` declaration named one the bytes then contradict, or, with neither present, the bytes are not well-formed UTF-8, XML's own default. */
|
|
15
|
+
var SvgUndecodableTextError = class extends Error {
|
|
16
|
+
/** The encoding the bytes were decoded against and failed. */
|
|
17
|
+
encoding;
|
|
18
|
+
constructor(encoding, cause) {
|
|
19
|
+
super(`svg bytes are not well-formed ${encoding}: ${cause.message}`, { cause });
|
|
20
|
+
this.name = "SvgUndecodableTextError";
|
|
21
|
+
this.encoding = encoding;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Decodes svg bytes to text, honouring the encoding a byte order mark or an `<?xml ...?>` declaration names and defaulting to strict UTF-8, XML's own default, when neither is present.
|
|
26
|
+
* @param bytes - The svg bytes.
|
|
27
|
+
* @throws SvgUnsupportedEncodingError When the declaration names an encoding outside byte-codec's own bounded set.
|
|
28
|
+
* @throws SvgUndecodableTextError When the bytes contradict the encoding that settled them.
|
|
29
|
+
* @returns The svg text.
|
|
30
|
+
*/
|
|
8
31
|
function decodeSvgText(bytes) {
|
|
32
|
+
const detected = detectSvgEncoding(bytes);
|
|
33
|
+
if (detected?.kind === "unsupported") throw new SvgUnsupportedEncodingError(detected.label);
|
|
34
|
+
const encoding = detected?.encoding ?? "utf-8";
|
|
9
35
|
try {
|
|
10
|
-
return
|
|
11
|
-
} catch {
|
|
12
|
-
throw new
|
|
36
|
+
return decodeText(bytes, { encoding }).text;
|
|
37
|
+
} catch (error) {
|
|
38
|
+
if (error instanceof UndecodableTextError) throw new SvgUndecodableTextError(encoding, error);
|
|
39
|
+
throw error;
|
|
13
40
|
}
|
|
14
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Encodes svg text as UTF-8 bytes, with no `<?xml ...?>` declaration of its own.
|
|
44
|
+
* @param text - The svg text.
|
|
45
|
+
* @returns The UTF-8 bytes. A byte stream with no declaration and no byte order mark is UTF-8 under XML's own default, so {@link decodeSvgText} reads it back correctly without one.
|
|
46
|
+
*/
|
|
15
47
|
function encodeSvgText(text) {
|
|
16
48
|
return new TextEncoder().encode(text);
|
|
17
49
|
}
|
|
18
50
|
//#endregion
|
|
19
|
-
export {
|
|
51
|
+
export { SvgUndecodableTextError, SvgUnsupportedEncodingError, decodeSvgText, encodeSvgText };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let byte_codec = require("byte-codec");
|
|
3
|
+
//#region src/svg/xml-encoding.ts
|
|
4
|
+
const XML_ENCODING_ALIASES = {
|
|
5
|
+
"utf-8": "utf-8",
|
|
6
|
+
utf8: "utf-8",
|
|
7
|
+
"unicode-1-1-utf-8": "utf-8",
|
|
8
|
+
unicode11utf8: "utf-8",
|
|
9
|
+
unicode20utf8: "utf-8",
|
|
10
|
+
"x-unicode20utf8": "utf-8",
|
|
11
|
+
"utf-16le": "utf-16le",
|
|
12
|
+
"utf-16": "utf-16le",
|
|
13
|
+
"ucs-2": "utf-16le",
|
|
14
|
+
unicode: "utf-16le",
|
|
15
|
+
unicodefeff: "utf-16le",
|
|
16
|
+
csunicode: "utf-16le",
|
|
17
|
+
"iso-10646-ucs-2": "utf-16le",
|
|
18
|
+
"utf-16be": "utf-16be",
|
|
19
|
+
unicodefffe: "utf-16be",
|
|
20
|
+
"utf-32le": "utf-32le",
|
|
21
|
+
"utf-32be": "utf-32be",
|
|
22
|
+
"windows-1252": "windows-1252",
|
|
23
|
+
cp1252: "windows-1252",
|
|
24
|
+
"x-cp1252": "windows-1252",
|
|
25
|
+
"iso-8859-1": "windows-1252",
|
|
26
|
+
"iso8859-1": "windows-1252",
|
|
27
|
+
"iso_8859-1": "windows-1252",
|
|
28
|
+
"iso_8859-1:1987": "windows-1252",
|
|
29
|
+
"iso-ir-100": "windows-1252",
|
|
30
|
+
csisolatin1: "windows-1252",
|
|
31
|
+
l1: "windows-1252",
|
|
32
|
+
latin1: "windows-1252",
|
|
33
|
+
cp819: "windows-1252",
|
|
34
|
+
ibm819: "windows-1252",
|
|
35
|
+
"us-ascii": "windows-1252",
|
|
36
|
+
ascii: "windows-1252",
|
|
37
|
+
"ansi_x3.4-1968": "windows-1252"
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Maps a name from an XML encoding declaration onto the encoding byte-codec's decodeText would decode it under, matched case-insensitively against the WHATWG Encoding Standard's own label table (restricted to the six encodings decodeText supports).
|
|
41
|
+
* @param label - The declaration's raw `encoding` value, exactly as written.
|
|
42
|
+
* @returns The matching {@link TextEncodingLabel}, or `undefined` when the name is outside decodeText's own bounded set (ExaDev/documents.js#1361).
|
|
43
|
+
*/
|
|
44
|
+
function mapXmlEncodingLabel(label) {
|
|
45
|
+
return XML_ENCODING_ALIASES[label.toLowerCase()];
|
|
46
|
+
}
|
|
47
|
+
const XML_DECLARATION_SEARCH_WINDOW = 512;
|
|
48
|
+
const XML_DECLARATION_START = "<?xml";
|
|
49
|
+
const XML_ENCODING_DECL_PATTERN = /\bencoding\s*=\s*(["'])([A-Za-z][A-Za-z0-9._-]*)\1/;
|
|
50
|
+
/**
|
|
51
|
+
* Reads the raw encoding label out of an `<?xml ...?>` declaration's own leading bytes, without decoding anything.
|
|
52
|
+
*
|
|
53
|
+
* Safe ahead of any real decode because the declaration's own grammar restricts every character in it to ASCII: XML mandates that a declaration, if present, start at the very first byte (a byte order mark aside), so bytes not beginning with the literal ASCII sequence `<?xml` carry no declaration to read, and bytes that do keep writing ASCII up to and including the encoding name itself, whatever that name turns out to be.
|
|
54
|
+
* @param bytes - The document's own leading bytes.
|
|
55
|
+
* @returns The declaration's raw `encoding` value, exactly as written, or `undefined` when the leading bytes carry no `<?xml ...?>` declaration, or that declaration names no encoding.
|
|
56
|
+
*/
|
|
57
|
+
function readXmlEncodingDeclarationLabel(bytes) {
|
|
58
|
+
const windowLength = Math.min(bytes.length, XML_DECLARATION_SEARCH_WINDOW);
|
|
59
|
+
let window = "";
|
|
60
|
+
for (let index = 0; index < windowLength; index += 1) window += String.fromCharCode(bytes[index]);
|
|
61
|
+
if (!window.startsWith(XML_DECLARATION_START)) return;
|
|
62
|
+
const declarationEnd = window.indexOf("?>");
|
|
63
|
+
const declaration = declarationEnd === -1 ? window : window.slice(0, declarationEnd);
|
|
64
|
+
return XML_ENCODING_DECL_PATTERN.exec(declaration)?.[2];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Detects the encoding SVG's own XML prolog declares, per XML 1.0's own external-encoding-detection algorithm: a byte order mark first, since it needs no decoding to trust, then the `<?xml ... encoding="..."?>` declaration.
|
|
68
|
+
* @param bytes - The document's own leading bytes.
|
|
69
|
+
* @returns How the encoding was settled, or `undefined` when the leading bytes carry neither a byte order mark nor a declared encoding. XML's own default of UTF-8 applies in that case, left for the caller to decode strictly rather than through decodeText's own guessing.
|
|
70
|
+
*/
|
|
71
|
+
function detectSvgEncoding(bytes) {
|
|
72
|
+
const bom = (0, byte_codec.detectByteOrderMark)(bytes);
|
|
73
|
+
if (bom !== void 0) return {
|
|
74
|
+
kind: "resolved",
|
|
75
|
+
encoding: bom.encoding
|
|
76
|
+
};
|
|
77
|
+
const label = readXmlEncodingDeclarationLabel(bytes);
|
|
78
|
+
if (label === void 0) return;
|
|
79
|
+
const encoding = mapXmlEncodingLabel(label);
|
|
80
|
+
return encoding === void 0 ? {
|
|
81
|
+
kind: "unsupported",
|
|
82
|
+
label
|
|
83
|
+
} : {
|
|
84
|
+
kind: "resolved",
|
|
85
|
+
encoding
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
exports.detectSvgEncoding = detectSvgEncoding;
|
|
90
|
+
exports.mapXmlEncodingLabel = mapXmlEncodingLabel;
|
|
91
|
+
exports.readXmlEncodingDeclarationLabel = readXmlEncodingDeclarationLabel;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TextEncodingLabel } from "byte-codec";
|
|
2
|
+
//#region src/svg/xml-encoding.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Maps a name from an XML encoding declaration onto the encoding byte-codec's decodeText would decode it under, matched case-insensitively against the WHATWG Encoding Standard's own label table (restricted to the six encodings decodeText supports).
|
|
5
|
+
* @param label - The declaration's raw `encoding` value, exactly as written.
|
|
6
|
+
* @returns The matching {@link TextEncodingLabel}, or `undefined` when the name is outside decodeText's own bounded set (ExaDev/documents.js#1361).
|
|
7
|
+
*/
|
|
8
|
+
declare function mapXmlEncodingLabel(label: string): TextEncodingLabel | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Reads the raw encoding label out of an `<?xml ...?>` declaration's own leading bytes, without decoding anything.
|
|
11
|
+
*
|
|
12
|
+
* Safe ahead of any real decode because the declaration's own grammar restricts every character in it to ASCII: XML mandates that a declaration, if present, start at the very first byte (a byte order mark aside), so bytes not beginning with the literal ASCII sequence `<?xml` carry no declaration to read, and bytes that do keep writing ASCII up to and including the encoding name itself, whatever that name turns out to be.
|
|
13
|
+
* @param bytes - The document's own leading bytes.
|
|
14
|
+
* @returns The declaration's raw `encoding` value, exactly as written, or `undefined` when the leading bytes carry no `<?xml ...?>` declaration, or that declaration names no encoding.
|
|
15
|
+
*/
|
|
16
|
+
declare function readXmlEncodingDeclarationLabel(bytes: Uint8Array): string | undefined;
|
|
17
|
+
/** How {@link detectSvgEncoding} settled the encoding: `resolved` when a byte order mark or a declaration named one decodeText can decode, `unsupported` when a declaration named something outside decodeText's own bounded set. */
|
|
18
|
+
type SvgEncodingDetection = {
|
|
19
|
+
readonly kind: "resolved";
|
|
20
|
+
readonly encoding: TextEncodingLabel;
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: "unsupported";
|
|
23
|
+
readonly label: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Detects the encoding SVG's own XML prolog declares, per XML 1.0's own external-encoding-detection algorithm: a byte order mark first, since it needs no decoding to trust, then the `<?xml ... encoding="..."?>` declaration.
|
|
27
|
+
* @param bytes - The document's own leading bytes.
|
|
28
|
+
* @returns How the encoding was settled, or `undefined` when the leading bytes carry neither a byte order mark nor a declared encoding. XML's own default of UTF-8 applies in that case, left for the caller to decode strictly rather than through decodeText's own guessing.
|
|
29
|
+
*/
|
|
30
|
+
declare function detectSvgEncoding(bytes: Uint8Array): SvgEncodingDetection | undefined;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { SvgEncodingDetection, detectSvgEncoding, mapXmlEncodingLabel, readXmlEncodingDeclarationLabel };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TextEncodingLabel } from "byte-codec";
|
|
2
|
+
//#region src/svg/xml-encoding.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Maps a name from an XML encoding declaration onto the encoding byte-codec's decodeText would decode it under, matched case-insensitively against the WHATWG Encoding Standard's own label table (restricted to the six encodings decodeText supports).
|
|
5
|
+
* @param label - The declaration's raw `encoding` value, exactly as written.
|
|
6
|
+
* @returns The matching {@link TextEncodingLabel}, or `undefined` when the name is outside decodeText's own bounded set (ExaDev/documents.js#1361).
|
|
7
|
+
*/
|
|
8
|
+
declare function mapXmlEncodingLabel(label: string): TextEncodingLabel | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Reads the raw encoding label out of an `<?xml ...?>` declaration's own leading bytes, without decoding anything.
|
|
11
|
+
*
|
|
12
|
+
* Safe ahead of any real decode because the declaration's own grammar restricts every character in it to ASCII: XML mandates that a declaration, if present, start at the very first byte (a byte order mark aside), so bytes not beginning with the literal ASCII sequence `<?xml` carry no declaration to read, and bytes that do keep writing ASCII up to and including the encoding name itself, whatever that name turns out to be.
|
|
13
|
+
* @param bytes - The document's own leading bytes.
|
|
14
|
+
* @returns The declaration's raw `encoding` value, exactly as written, or `undefined` when the leading bytes carry no `<?xml ...?>` declaration, or that declaration names no encoding.
|
|
15
|
+
*/
|
|
16
|
+
declare function readXmlEncodingDeclarationLabel(bytes: Uint8Array): string | undefined;
|
|
17
|
+
/** How {@link detectSvgEncoding} settled the encoding: `resolved` when a byte order mark or a declaration named one decodeText can decode, `unsupported` when a declaration named something outside decodeText's own bounded set. */
|
|
18
|
+
type SvgEncodingDetection = {
|
|
19
|
+
readonly kind: "resolved";
|
|
20
|
+
readonly encoding: TextEncodingLabel;
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: "unsupported";
|
|
23
|
+
readonly label: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Detects the encoding SVG's own XML prolog declares, per XML 1.0's own external-encoding-detection algorithm: a byte order mark first, since it needs no decoding to trust, then the `<?xml ... encoding="..."?>` declaration.
|
|
27
|
+
* @param bytes - The document's own leading bytes.
|
|
28
|
+
* @returns How the encoding was settled, or `undefined` when the leading bytes carry neither a byte order mark nor a declared encoding. XML's own default of UTF-8 applies in that case, left for the caller to decode strictly rather than through decodeText's own guessing.
|
|
29
|
+
*/
|
|
30
|
+
declare function detectSvgEncoding(bytes: Uint8Array): SvgEncodingDetection | undefined;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { SvgEncodingDetection, detectSvgEncoding, mapXmlEncodingLabel, readXmlEncodingDeclarationLabel };
|