documents.js 1.65.0 → 1.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -11
- package/dist/color-C98dn-pT.d.ts +2 -0
- package/dist/convert/convert.cjs +2 -1
- package/dist/convert/convert.js +2 -1
- package/dist/edit/docx/content.cjs +5 -0
- package/dist/edit/docx/content.js +5 -0
- package/dist/edit/docx/image.cjs +1 -0
- package/dist/edit/docx/image.d.cts +2 -2
- package/dist/edit/docx/image.d.ts +2 -2
- package/dist/edit/docx/image.js +1 -1
- package/dist/edit/docx/paragraph.cjs +10 -1
- package/dist/edit/docx/paragraph.d.cts +4 -3
- package/dist/edit/docx/paragraph.d.ts +4 -3
- package/dist/edit/docx/paragraph.js +13 -4
- package/dist/edit/docx/props.d.ts +1 -1
- package/dist/edit/docx/run.cjs +8 -1
- package/dist/edit/docx/run.d.cts +2 -2
- package/dist/edit/docx/run.d.ts +2 -2
- package/dist/edit/docx/run.js +8 -2
- package/dist/edit/docx/vector.cjs +69 -0
- package/dist/edit/docx/vector.d.cts +6 -0
- package/dist/edit/docx/vector.d.ts +6 -0
- package/dist/edit/docx/vector.js +68 -0
- package/dist/edit/drawingml/vector.cjs +113 -0
- package/dist/edit/drawingml/vector.d.cts +9 -0
- package/dist/edit/drawingml/vector.d.ts +9 -0
- package/dist/edit/drawingml/vector.js +109 -0
- package/dist/edit/odg/content.cjs +1 -26
- package/dist/edit/odg/content.js +1 -26
- package/dist/edit/odg/page.cjs +14 -1
- package/dist/edit/odg/page.d.cts +5 -3
- package/dist/edit/odg/page.d.ts +5 -3
- package/dist/edit/odg/page.js +14 -1
- package/dist/edit/odg/style.cjs +17 -3
- package/dist/edit/odg/style.d.cts +1 -0
- package/dist/edit/odg/style.d.ts +1 -0
- package/dist/edit/odg/style.js +17 -3
- package/dist/edit/odg/vector.cjs +65 -3
- package/dist/edit/odg/vector.d.cts +2 -2
- package/dist/edit/odg/vector.d.ts +2 -2
- package/dist/edit/odg/vector.js +63 -4
- package/dist/edit/odp/content.cjs +4 -1
- package/dist/edit/odp/content.js +5 -2
- package/dist/edit/odp/shape.cjs +1 -1
- package/dist/edit/odp/shape.d.cts +1 -1
- package/dist/edit/odp/shape.d.ts +1 -1
- package/dist/edit/odp/shape.js +1 -1
- package/dist/edit/odp/slide.cjs +4 -0
- package/dist/edit/odp/slide.d.cts +8 -5
- package/dist/edit/odp/slide.d.ts +9 -6
- package/dist/edit/odp/slide.js +4 -0
- package/dist/edit/odt/content.cjs +5 -0
- package/dist/edit/odt/content.d.ts +2 -2
- package/dist/edit/odt/content.js +5 -0
- package/dist/edit/odt/editor.cjs +7 -0
- package/dist/edit/odt/editor.d.cts +3 -2
- package/dist/edit/odt/editor.d.ts +5 -4
- package/dist/edit/odt/editor.js +7 -0
- package/dist/edit/odt/list.cjs +13 -0
- package/dist/edit/odt/list.d.cts +1 -1
- package/dist/edit/odt/list.d.ts +1 -1
- package/dist/edit/odt/list.js +13 -0
- package/dist/edit/odt/paragraph.d.ts +1 -1
- package/dist/edit/odt/run.d.ts +1 -1
- package/dist/edit/odt/table.d.ts +1 -1
- package/dist/edit/pptx/content.cjs +5 -2
- package/dist/edit/pptx/content.js +5 -2
- package/dist/edit/pptx/shape.cjs +2 -5
- package/dist/edit/pptx/shape.d.ts +1 -1
- package/dist/edit/pptx/shape.js +2 -5
- package/dist/edit/pptx/slide.cjs +7 -0
- package/dist/edit/pptx/slide.d.cts +6 -4
- package/dist/edit/pptx/slide.d.ts +8 -6
- package/dist/edit/pptx/slide.js +7 -0
- package/dist/edit/pptx/table.d.ts +1 -1
- package/dist/edit/pptx/vector.cjs +17 -0
- package/dist/edit/pptx/vector.d.cts +6 -0
- package/dist/edit/pptx/vector.d.ts +6 -0
- package/dist/edit/pptx/vector.js +16 -0
- package/dist/{image-BfRLAD9B.d.cts → image-DRqXQmEg.d.cts} +2 -1
- package/dist/{image-BfRLAD9B.d.ts → image-DRqXQmEg.d.ts} +2 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +12 -12
- package/dist/index.js +2 -2
- package/dist/layout/engine.cjs +1 -5
- package/dist/layout/engine.js +1 -5
- package/dist/layout/shared.cjs +6 -0
- package/dist/layout/shared.d.cts +2 -1
- package/dist/layout/shared.d.ts +2 -1
- package/dist/layout/shared.js +6 -1
- package/dist/layout/sheets.cjs +70 -9
- package/dist/layout/sheets.d.cts +7 -3
- package/dist/layout/sheets.d.ts +7 -3
- package/dist/layout/sheets.js +72 -11
- package/dist/layout/slides.cjs +1 -5
- package/dist/layout/slides.js +1 -5
- package/dist/{list-BuBM9rwQ.d.cts → list-BzcN-LTJ.d.cts} +3 -0
- package/dist/{list-CvKxhy3y.d.ts → list-nlhN5bat.d.ts} +4 -1
- package/dist/markdown/write.cjs +1 -1
- package/dist/markdown/write.js +1 -1
- package/dist/model/color.d.ts +1 -1
- package/dist/model/embedded-drawing.cjs +47 -0
- package/dist/model/embedded-drawing.d.cts +4 -2
- package/dist/model/embedded-drawing.d.ts +4 -2
- package/dist/model/embedded-drawing.js +46 -1
- package/dist/{paragraph-CoUi_88j.d.ts → paragraph-DndYbWuT.d.ts} +1 -1
- package/dist/{run-D2rTWHbt.d.ts → run-BhYv2wJf.d.ts} +3 -2
- package/dist/{run-CJfh8rv3.d.ts → run-DtrwZwN6.d.ts} +1 -1
- package/dist/{run-B3GNScJH.d.cts → run-P0b2pDdX.d.cts} +2 -1
- package/dist/{shape-BkVcwPcf.d.ts → shape-B-TjU_Ej.d.ts} +1 -1
- package/dist/{shape-CXZ6fejV.d.cts → shape-C8qDhn0l.d.cts} +1 -1
- package/dist/{shape-CVXedeL7.d.ts → shape-XGp__l-J.d.ts} +2 -2
- package/dist/{table-DqfqMkVq.d.ts → table-BHeUmLzZ.d.ts} +1 -1
- package/dist/{table-DvS_7UQS.d.ts → table-DQpKafyl.d.ts} +1 -1
- package/dist/{vector-Puuqu_IT.d.cts → vector-D03KX8Ux.d.cts} +15 -2
- package/dist/{vector-Puuqu_IT.d.ts → vector-D03KX8Ux.d.ts} +15 -2
- package/package.json +3 -3
- package/dist/color-Bo228AY2.d.ts +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -9,23 +9,23 @@ import { createLocalDocumentConverter } from "./convert/local.js";
|
|
|
9
9
|
import { BuildDocxPackageOptions, buildDocxPackage } from "./edit/docx/content.js";
|
|
10
10
|
import { c as firstChildByLocalName, d as textContent, i as MathMlText, l as isMathMlElement, n as MathMlElement, o as elementChildren, r as MathMlNode, s as elementLocalName, t as MathMlAttribute, u as localName } from "./nodes-pArN9ilm.js";
|
|
11
11
|
import { n as buildOfficeMath, r as buildOfficeMathParagraph, t as OmmlWriteResult } from "./write-THs7ipBq.js";
|
|
12
|
-
import { a as rgbHexToColor, n as LayoutColor, t as COLOR_BLACK } from "./color-
|
|
13
|
-
import { t as DocxRun } from "./run-
|
|
12
|
+
import { a as rgbHexToColor, n as LayoutColor, t as COLOR_BLACK } from "./color-C98dn-pT.js";
|
|
13
|
+
import { t as DocxRun } from "./run-BhYv2wJf.js";
|
|
14
14
|
import { DocxParagraph } from "./edit/docx/paragraph.js";
|
|
15
15
|
import { DocxTable, DocxTableCell, DocxTableRow, DocxVerticalMerge } from "./edit/docx/table.js";
|
|
16
16
|
import { DocxBody, DocxEditor, createDocx, openDocx } from "./edit/docx/editor.js";
|
|
17
17
|
import { a as PAGE_SIZE_A4, d as flipY, l as SLIDE_SIZE_STANDARD, o as PAGE_SIZE_LETTER, r as Margins, s as PageSize, t as Box, u as SLIDE_SIZE_WIDESCREEN } from "./geometry-DaJr8yQW.js";
|
|
18
18
|
import { buildOdgPackage } from "./edit/odg/content.js";
|
|
19
19
|
import { i as LayoutFont, r as DEFAULT_LAYOUT_FONT, t as Alignment } from "./style-DkamR3aY.js";
|
|
20
|
-
import { n as RunInit, t as OdtRun } from "./run-
|
|
21
|
-
import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-
|
|
22
|
-
import { n as OdtListItem, t as OdtList } from "./list-
|
|
23
|
-
import { t as OdpShape } from "./shape-
|
|
24
|
-
import { a as OdgLineVector, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as
|
|
20
|
+
import { n as RunInit, t as OdtRun } from "./run-DtrwZwN6.js";
|
|
21
|
+
import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-DndYbWuT.js";
|
|
22
|
+
import { n as OdtListItem, t as OdtList } from "./list-nlhN5bat.js";
|
|
23
|
+
import { t as OdpShape } from "./shape-XGp__l-J.js";
|
|
24
|
+
import { a as OdgLineVector, c as OdgVectorKind, l as PathVectorInit, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit } from "./vector-D03KX8Ux.js";
|
|
25
25
|
import { OdgPage, PageImageInit, TextBoxInit } from "./edit/odg/page.js";
|
|
26
26
|
import { OdgEditor, createOdg, openOdg } from "./edit/odg/editor.js";
|
|
27
27
|
import { buildOdpPackage } from "./edit/odp/content.js";
|
|
28
|
-
import { i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "./table-
|
|
28
|
+
import { i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "./table-BHeUmLzZ.js";
|
|
29
29
|
import { OdpSlide, SlideImageInit, SlideTableInit, TextBoxInit as TextBoxInit$1 } from "./edit/odp/slide.js";
|
|
30
30
|
import { OdpEditor, createOdp, openOdp } from "./edit/odp/editor.js";
|
|
31
31
|
import { t as OdsCell } from "./cell-CNHPsDEk.js";
|
|
@@ -35,8 +35,8 @@ import { OdsEditor, createOds, openOds } from "./edit/ods/editor.js";
|
|
|
35
35
|
import { buildOdtPackage } from "./edit/odt/content.js";
|
|
36
36
|
import { OdtBody, OdtEditor, createOdt, openOdt } from "./edit/odt/editor.js";
|
|
37
37
|
import { buildPptxPackage } from "./edit/pptx/content.js";
|
|
38
|
-
import { n as DrawingRunInit, r as PptxShape, t as DrawingParagraphInit } from "./shape-
|
|
39
|
-
import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-
|
|
38
|
+
import { n as DrawingRunInit, r as PptxShape, t as DrawingParagraphInit } from "./shape-B-TjU_Ej.js";
|
|
39
|
+
import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-DQpKafyl.js";
|
|
40
40
|
import { PptxSlide, SlideImageInit as SlideImageInit$1, SlideTableInit as SlideTableInit$1, TextBoxInit as TextBoxInit$2 } from "./edit/pptx/slide.js";
|
|
41
41
|
import { PptxEditor, createPptx, openPptx } from "./edit/pptx/editor.js";
|
|
42
42
|
import { a as parseHsqldbScript, i as displayTextFor, n as HsqldbScriptParseError, r as HsqldbTable, t as HsqldbColumn } from "./script-DsGGIzGU.js";
|
|
@@ -71,7 +71,7 @@ import { buildFormulaBlock, formulaDocument, formulaOfBlock, formulaPlaceholderT
|
|
|
71
71
|
import { buildDrawingBlock, drawingOfBlock } from "./model/embedded-drawing.js";
|
|
72
72
|
import { EngineLayoutOptions, WordprocessingLayoutResult, convertWordprocessingToLayout } from "./layout/engine.js";
|
|
73
73
|
import { PresentationLayoutResult, SlidesLayoutOptions, convertPresentationToLayout } from "./layout/slides.js";
|
|
74
|
-
import { SheetsLayoutOptions, convertSpreadsheetToLayout } from "./layout/sheets.js";
|
|
74
|
+
import { SheetsLayoutOptions, SpreadsheetLayoutResult, convertSpreadsheetToLayout } from "./layout/sheets.js";
|
|
75
75
|
import { DrawingLayoutOptions, convertDrawingToLayout } from "./layout/drawing.js";
|
|
76
76
|
import { CellTypeDeclineReason, CellTypeInference, CellTypeInferenceResult, CellTypeInferenceSink, CellTypeRule, inferCellValue } from "./layout/cell-typing.js";
|
|
77
77
|
import { ReconstructOptions, reconstructDrawing, reconstructPresentation, reconstructSpreadsheet, reconstructWordprocessing } from "./layout/reconstruct.js";
|
|
@@ -97,4 +97,4 @@ import { Attribute, AttributeSchema, BinaryPart, BinaryPartSchema, Comment, Comm
|
|
|
97
97
|
import { CONTENT_FORMAT_VERSION, ContentBlock, ContentBlockSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocumentJson, ContentDocumentSchema, ContentDrawPage, ContentDrawPageSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentPathPoint, ContentPathPointSchema, ContentPathSegment, ContentPathSegmentSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStroke, ContentStrokeSchema, ContentSubpath, ContentSubpathSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, ContentVector, ContentVectorSchema, DocumentJsonResult, DocumentPackage, DocumentPackageJson, DocumentPackageSchema, DocumentSchemaKind, LAYOUT_FORMAT_VERSION, LayoutDocument, LayoutDocumentJson, LayoutDocumentSchema, LayoutEllipse, LayoutImage, LayoutImageAsset, LayoutItem, LayoutLine, LayoutLink, LayoutMetadata, LayoutPage, LayoutPath, LayoutPathSegment, LayoutRect, LayoutSubpath, LayoutText, UnrecognizedDocumentSchemaError, contentDocumentWithSchema, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, isContentBlock, layoutDocumentWithSchema, schemaUriFor } from "document-schema.js";
|
|
98
98
|
import { OdbComponentInfo, OdbConnectionInfo, OdbForm, OdbFormControl, OdbFormDefinition, OdbInventory, OdbQueryInfo, OdbReport, OdbReportBand, OdbReportElement, OdbReportFunction, OdbReportGroup, readOdbForm, readOdbInventory, readOdbReport, resolveOdbComponent } from "odf.js";
|
|
99
99
|
import { FontRegistry, FontRegistryOptions, FontSubstitution, LoadedMathFont, MathFont, MathFontDescriptorMetrics, NOOP_DIAGNOSTIC_SINK, PdfDiagnostic, PdfDiagnosticSeverity, PdfDiagnosticSink, PdfEncryptedError, PdfParseError, PositionedFormula, ProvidedFont, ReadPdfOptions, ResolvedFace, WinAnsiSubstitution, WritePdfOptions, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, loadMathFont, pdfCodec, readPdf, writePdf } from "pdf-codec";
|
|
100
|
-
export { type Alignment, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type Box, type BuildDocxPackageOptions, COLOR_BLACK, CONTENT_FORMAT_VERSION, 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 ContentBlock, ContentBlockSchema, type ContentCellValue, ContentCellValueSchema, type ContentDocument, type ContentDocumentJson, ContentDocumentSchema, type ContentDrawPage, ContentDrawPageSchema, 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 ConversionRequest, type ConversionResult, DEFAULT_LAYOUT_FONT, type DefinedName, DefinedNameSchema, type Diagnostic, type DocumentBridgeOptions, type DocumentConverter, type DocumentFontRegistryOptions, type DocumentFormat, type DocumentJsonResult, type DocumentPackage, type DocumentPackageJson, DocumentPackageSchema, type DocumentPayload, type DocumentSchemaKind, type DocumentToPdfOptions, type DocxBody, DocxBytesSchema, DocxEditor, type DocxExtras, DocxParagraph, DocxRun, DocxTable, DocxTableCell, DocxTableRow, type DocxVerticalMerge, type DrawingLayoutOptions, type DrawingParagraphInit, type DrawingRunInit, type EngineLayoutOptions, SUPPORTED_BACKUP_FORMAT_VERSION as FIREBIRD_SUPPORTED_BACKUP_FORMAT_VERSION, FirebirdBackupFormatError, FirebirdBackupParseError, type FirebirdBackupSummary, FirebirdCompositeRecordUnsupportedError, FirebirdDataParseError, FirebirdSchemaParseError, FirebirdUnsupportedFieldTypeError, FontDeobfuscationError, type FontRegistry, type FontRegistryOptions, type FontSourcePackage, type FontSubstitution, type Footnote, FootnoteSchema, type GridLattice, type HsqldbBinaryScript, HsqldbBinaryScriptParseError, type HsqldbColumn, type HsqldbDecodeOptions, HsqldbRowFormatError, HsqldbScriptParseError, HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, type HsqldbTable, LAYOUT_FORMAT_VERSION, type LayoutColor, type LayoutDocument, type LayoutDocumentJson, 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 Margins, MarkdownBytesSchema, 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 MathMlAttribute, type MathMlElement, type MathMlNode, type MathMlText, type MathRule, type MathStretchAxis, type MathStretchGlyph, type MathStretchResult, type MathStroke, type MathVariant, 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, 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 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, OdtEditor, OdtList, OdtListItem, OdtParagraph, type ParagraphInit as OdtParagraphInit, OdtRun, type RunInit as OdtRunInit, OdtTable, OdtTableCell, type TableInit as OdtTableInit, OdtTableRow, type OmmlDiagnostic, type OmmlDiagnosticKind, type OmmlReadResult, type OmmlWriteResult, OoxmlEmbeddedFontError, type OperatorProperties, PAGE_SIZE_A4, PAGE_SIZE_LETTER, type Package, PackageSchema, type PageSize, type Part, PartSchema, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEncryptedError, PdfParseError, type PdfToDocumentOptions, type PositionedFormula, PptxBytesSchema, PptxEditor, PptxShape, PptxSlide, PptxTable, PptxTableCell, type PptxTableInit, PptxTableRow, type PresentationLayoutResult, type ProvidedFont, type ReadDocxContentOptions, type ReadFirebirdBackupResult, type ReadPdfOptions, type ReconstructOptions, type Relationship, 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, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, type SheetsLayoutOptions, type SlideImageInit$1 as SlideImageInit, type SlideTableInit$1 as SlideTableInit, type SlidesLayoutOptions, type SqlAggregateArgument, type SqlAggregateFunction, type SqlColumnRef, type SqlComparisonOperator, type SqlLiteral, type SqlNameRef, type SqlOperand, type SqlOrderByTerm, type SqlPredicate, type SqlPunctuation, type SqlResultSet, type SqlSelectItem, type SqlSelectStatement, type SqlSortDirection, type SqlToken, type TextBoxInit$2 as TextBoxInit, UnrecognizedDocumentSchemaError, type WinAnsiSubstitution, type WordprocessingLayoutResult, type WritePdfOptions, 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, buildDocxPackage, buildDrawingBlock, buildFormulaBlock, buildMarkdownText, buildOdgPackage, buildOdpPackage, buildOdsPackage, buildOdtPackage, buildOfficeMath, buildOfficeMathParagraph, buildPptxPackage, buildXml, bytesToBase64, childrenWithTag, collectOfficeMathElements, compactCodec, compactPackageCodec, contentDocumentWithSchema, convertDrawingToLayout, convertPresentationToLayout, convertSpreadsheetToLayout, convertWordprocessingToLayout, createDocumentFontRegistry, createDocx, createFontMeasurer, createFontRegistry, createLocalDocumentConverter, createOdg, createOdp, createOds, createOdt, createPptx, createStandardFontMeasurer, decodeCompactPackage, decodeEntities, decodeHsqldbCachedTables, decodeMarkdownText, decodePackage, deobfuscateEmbeddedFont, deriveFontKey, detectGridLattice, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, docxPdfCodec, docxToMarkdown, docxToOdt, docxToPdf, drawingOfBlock, elementChildren, elementLocalName, elementsWithTag, encodeCompactPackage, encodeMarkdownText, encodePackage, evaluateRptBandOutsideData, evaluateSelect, extractOdfEmbeddedFonts, extractOoxmlEmbeddedFonts, extractSourceFonts, firstChildByLocalName, fixedClock, flipY, formulaDocument, formulaOfBlock, formulaPlaceholderText, fromCompact, displayTextFor as hsqldbCellDisplayText, inferCellValue, inflateHsqldbCompressedScript, isCompactXmlNode, isContentBlock, isMathMlElement, isMathVariant, isXmlNode, layoutDocumentWithSchema, layoutFormula, loadMathFont, localName, looksLikeSfnt, mapMathVariant, markdownDocxCodec, markdownOdtCodec, markdownPdfCodec, markdownToDocx, markdownToOdt, markdownToPdf, textContent as mathMlTextContent, odbReportCommandSql, odbReportGroupChain, odbTablesToSpreadsheetDocument, odbToCsv, odbToXlsx, odfToPdf, odgPdfCodec, odgToPdf, odmToPdf, odpPdfCodec, odpPptxCodec, odpToPdf, odpToPptx, odsPdfCodec, odsToPdf, odsToXlsx, odsXlsxCodec, odtDocxCodec, odtPdfCodec, odtToDocx, odtToMarkdown, odtToPdf, openDocx, openOdg, openOdp, openOds, openOdt, openPptx, operatorProperties, packageCodec, parseHsqldbBinaryScript, parseHsqldbScript, parsePackage, parseRptFormula, parseSelect, parseXml, pdfCodec, pdfToDocx, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pdfToXlsx, pptxPdfCodec, pptxToOdp, pptxToPdf, readDocxContent, readDocxExtras, readFirebirdBackup, readMarkdownContent, readOdbForm, readOdbForms, readOdbInventory, readOdbReport, readOdbReportContent, readOdbReports, readOdbTables, readOdfEmbeddedFormula, readOdfFormulaContent, readOdgContent, readOdpContent, readOdsContent, readOdtContent, readOfficeMath, readPdf, readPptxContent, reconstructDrawing, reconstructPresentation, reconstructSpreadsheet, reconstructWordprocessing, renderOdbReportContent, resolveOdbComponent, resolveOdbReportRows, resolveRelationships, rgbHexToColor, rootElement, rptBandDefinition, rptDefinitionFromReport, runRptReport, schemaUriFor, serializePackage, systemClock, textContent$1 as textContent, throwIfAborted, toCompact, tokenizeSql, unzipPackage, walk, writePdf, xlsxPdfCodec, xlsxToOds, xlsxToPdf, xmlCodec, zipPackage };
|
|
100
|
+
export { type Alignment, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type Box, type BuildDocxPackageOptions, COLOR_BLACK, CONTENT_FORMAT_VERSION, 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 ContentBlock, ContentBlockSchema, type ContentCellValue, ContentCellValueSchema, type ContentDocument, type ContentDocumentJson, ContentDocumentSchema, type ContentDrawPage, ContentDrawPageSchema, 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 ConversionRequest, type ConversionResult, DEFAULT_LAYOUT_FONT, type DefinedName, DefinedNameSchema, type Diagnostic, type DocumentBridgeOptions, type DocumentConverter, type DocumentFontRegistryOptions, type DocumentFormat, type DocumentJsonResult, type DocumentPackage, type DocumentPackageJson, DocumentPackageSchema, type DocumentPayload, type DocumentSchemaKind, type DocumentToPdfOptions, type DocxBody, DocxBytesSchema, DocxEditor, type DocxExtras, DocxParagraph, DocxRun, DocxTable, DocxTableCell, DocxTableRow, type DocxVerticalMerge, type DrawingLayoutOptions, type DrawingParagraphInit, type DrawingRunInit, type EngineLayoutOptions, SUPPORTED_BACKUP_FORMAT_VERSION as FIREBIRD_SUPPORTED_BACKUP_FORMAT_VERSION, FirebirdBackupFormatError, FirebirdBackupParseError, type FirebirdBackupSummary, FirebirdCompositeRecordUnsupportedError, FirebirdDataParseError, FirebirdSchemaParseError, FirebirdUnsupportedFieldTypeError, FontDeobfuscationError, type FontRegistry, type FontRegistryOptions, type FontSourcePackage, type FontSubstitution, type Footnote, FootnoteSchema, type GridLattice, type HsqldbBinaryScript, HsqldbBinaryScriptParseError, type HsqldbColumn, type HsqldbDecodeOptions, HsqldbRowFormatError, HsqldbScriptParseError, HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, type HsqldbTable, LAYOUT_FORMAT_VERSION, type LayoutColor, type LayoutDocument, type LayoutDocumentJson, 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 Margins, MarkdownBytesSchema, 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 MathMlAttribute, type MathMlElement, type MathMlNode, type MathMlText, type MathRule, type MathStretchAxis, type MathStretchGlyph, type MathStretchResult, type MathStroke, type MathVariant, 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, 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, OdtEditor, OdtList, OdtListItem, OdtParagraph, type ParagraphInit as OdtParagraphInit, OdtRun, type RunInit as OdtRunInit, OdtTable, OdtTableCell, type TableInit as OdtTableInit, OdtTableRow, type OmmlDiagnostic, type OmmlDiagnosticKind, type OmmlReadResult, type OmmlWriteResult, OoxmlEmbeddedFontError, type OperatorProperties, PAGE_SIZE_A4, PAGE_SIZE_LETTER, type Package, PackageSchema, type PageSize, type Part, PartSchema, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEncryptedError, PdfParseError, type PdfToDocumentOptions, type PositionedFormula, PptxBytesSchema, PptxEditor, PptxShape, PptxSlide, PptxTable, PptxTableCell, type PptxTableInit, PptxTableRow, type PresentationLayoutResult, type ProvidedFont, type ReadDocxContentOptions, type ReadFirebirdBackupResult, type ReadPdfOptions, type ReconstructOptions, type Relationship, 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, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, 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 SqlLiteral, type SqlNameRef, type SqlOperand, type SqlOrderByTerm, type SqlPredicate, type SqlPunctuation, type SqlResultSet, type SqlSelectItem, type SqlSelectStatement, type SqlSortDirection, type SqlToken, type TextBoxInit$2 as TextBoxInit, UnrecognizedDocumentSchemaError, type WinAnsiSubstitution, type WordprocessingLayoutResult, type WritePdfOptions, 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, buildDocxPackage, buildDrawingBlock, buildFormulaBlock, buildMarkdownText, buildOdgPackage, buildOdpPackage, buildOdsPackage, buildOdtPackage, buildOfficeMath, buildOfficeMathParagraph, buildPptxPackage, buildXml, bytesToBase64, childrenWithTag, collectOfficeMathElements, compactCodec, compactPackageCodec, contentDocumentWithSchema, convertDrawingToLayout, convertPresentationToLayout, convertSpreadsheetToLayout, convertWordprocessingToLayout, createDocumentFontRegistry, createDocx, createFontMeasurer, createFontRegistry, createLocalDocumentConverter, createOdg, createOdp, createOds, createOdt, createPptx, createStandardFontMeasurer, decodeCompactPackage, decodeEntities, decodeHsqldbCachedTables, decodeMarkdownText, decodePackage, deobfuscateEmbeddedFont, deriveFontKey, detectGridLattice, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, docxPdfCodec, docxToMarkdown, docxToOdt, docxToPdf, drawingOfBlock, elementChildren, elementLocalName, elementsWithTag, encodeCompactPackage, encodeMarkdownText, encodePackage, evaluateRptBandOutsideData, evaluateSelect, extractOdfEmbeddedFonts, extractOoxmlEmbeddedFonts, extractSourceFonts, firstChildByLocalName, fixedClock, flipY, formulaDocument, formulaOfBlock, formulaPlaceholderText, fromCompact, displayTextFor as hsqldbCellDisplayText, inferCellValue, inflateHsqldbCompressedScript, isCompactXmlNode, isContentBlock, isMathMlElement, isMathVariant, isXmlNode, layoutDocumentWithSchema, layoutFormula, loadMathFont, localName, looksLikeSfnt, mapMathVariant, markdownDocxCodec, markdownOdtCodec, markdownPdfCodec, markdownToDocx, markdownToOdt, markdownToPdf, textContent as mathMlTextContent, odbReportCommandSql, odbReportGroupChain, odbTablesToSpreadsheetDocument, odbToCsv, odbToXlsx, odfToPdf, odgPdfCodec, odgToPdf, odmToPdf, odpPdfCodec, odpPptxCodec, odpToPdf, odpToPptx, odsPdfCodec, odsToPdf, odsToXlsx, odsXlsxCodec, odtDocxCodec, odtPdfCodec, odtToDocx, odtToMarkdown, odtToPdf, openDocx, openOdg, openOdp, openOds, openOdt, openPptx, operatorProperties, packageCodec, parseHsqldbBinaryScript, parseHsqldbScript, parsePackage, parseRptFormula, parseSelect, parseXml, pdfCodec, pdfToDocx, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pdfToXlsx, pptxPdfCodec, pptxToOdp, pptxToPdf, readDocxContent, readDocxExtras, readFirebirdBackup, readMarkdownContent, readOdbForm, readOdbForms, readOdbInventory, readOdbReport, readOdbReportContent, readOdbReports, readOdbTables, readOdfEmbeddedFormula, readOdfFormulaContent, readOdgContent, readOdpContent, readOdsContent, readOdtContent, readOfficeMath, readPdf, readPptxContent, reconstructDrawing, reconstructPresentation, reconstructSpreadsheet, reconstructWordprocessing, renderOdbReportContent, resolveOdbComponent, resolveOdbReportRows, resolveRelationships, rgbHexToColor, rootElement, rptBandDefinition, rptDefinitionFromReport, runRptReport, schemaUriFor, serializePackage, systemClock, textContent$1 as textContent, throwIfAborted, toCompact, tokenizeSql, unzipPackage, walk, writePdf, xlsxPdfCodec, xlsxToOds, xlsxToPdf, xmlCodec, zipPackage };
|
package/dist/index.js
CHANGED
|
@@ -10,14 +10,15 @@ import { DocxRun } from "./edit/docx/run.js";
|
|
|
10
10
|
import { DocxParagraph } from "./edit/docx/paragraph.js";
|
|
11
11
|
import { DocxTable, DocxTableCell, DocxTableRow } from "./edit/docx/table.js";
|
|
12
12
|
import { DocxEditor, createDocx, openDocx } from "./edit/docx/editor.js";
|
|
13
|
+
import { buildDrawingBlock, drawingOfBlock } from "./model/embedded-drawing.js";
|
|
13
14
|
import { buildFormulaBlock, formulaDocument, formulaOfBlock, formulaPlaceholderText } from "./model/formula.js";
|
|
14
15
|
import { buildDocxPackage } from "./edit/docx/content.js";
|
|
15
16
|
import { PptxShape } from "./edit/pptx/shape.js";
|
|
16
17
|
import { PptxTable, PptxTableCell, PptxTableRow } from "./edit/pptx/table.js";
|
|
17
18
|
import { PptxSlide } from "./edit/pptx/slide.js";
|
|
18
19
|
import { PptxEditor, createPptx, openPptx } from "./edit/pptx/editor.js";
|
|
19
|
-
import { buildDrawingBlock, drawingOfBlock } from "./model/embedded-drawing.js";
|
|
20
20
|
import { buildPptxPackage } from "./edit/pptx/content.js";
|
|
21
|
+
import { OdgBoxVector, OdgLineVector, OdgPathVector } from "./edit/odg/vector.js";
|
|
21
22
|
import { OdtRun } from "./edit/odt/run.js";
|
|
22
23
|
import { OdtParagraph } from "./edit/odt/paragraph.js";
|
|
23
24
|
import { OdtList, OdtListItem } from "./edit/odt/list.js";
|
|
@@ -32,7 +33,6 @@ import { OdsCell } from "./edit/ods/cell.js";
|
|
|
32
33
|
import { OdsSheet } from "./edit/ods/sheet.js";
|
|
33
34
|
import { OdsEditor, createOds, openOds } from "./edit/ods/editor.js";
|
|
34
35
|
import { buildOdsPackage } from "./edit/ods/content.js";
|
|
35
|
-
import { OdgBoxVector, OdgLineVector, OdgPathVector } from "./edit/odg/vector.js";
|
|
36
36
|
import { OdgPage } from "./edit/odg/page.js";
|
|
37
37
|
import { OdgEditor, createOdg, openOdg } from "./edit/odg/editor.js";
|
|
38
38
|
import { buildOdgPackage } from "./edit/odg/content.js";
|
package/dist/layout/engine.cjs
CHANGED
|
@@ -6,10 +6,6 @@ const require_layout_shared = require("./shared.cjs");
|
|
|
6
6
|
let document_schema_js = require("document-schema.js");
|
|
7
7
|
let pdf_codec = require("pdf-codec");
|
|
8
8
|
//#region src/layout/engine.ts
|
|
9
|
-
const MIN_FORMULA_SIZE_PT = 8;
|
|
10
|
-
function formulaSizePtFromFrame(frameHeightPt) {
|
|
11
|
-
return Math.max(MIN_FORMULA_SIZE_PT, frameHeightPt / 2);
|
|
12
|
-
}
|
|
13
9
|
function newFlowState(section) {
|
|
14
10
|
return {
|
|
15
11
|
items: [],
|
|
@@ -179,7 +175,7 @@ function layoutFormulaFlow(block, section, pages, state, contentLeftXDown, conte
|
|
|
179
175
|
layoutFormulaFallback(block, section, pages, state, contentLeftXDown, contentWidthPt, contentBottomYDown, measurer);
|
|
180
176
|
return;
|
|
181
177
|
}
|
|
182
|
-
const sizePt = formulaSizePtFromFrame(block.frame.heightPt);
|
|
178
|
+
const sizePt = require_layout_shared.formulaSizePtFromFrame(block.frame.heightPt);
|
|
183
179
|
const metrics = (0, pdf_codec.loadMathFont)().metricsAt(sizePt);
|
|
184
180
|
const { box } = require_mathml_layout.layoutFormula(formula.mathml, {
|
|
185
181
|
metrics,
|
package/dist/layout/engine.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { flipY } from "../model/geometry.js";
|
|
2
2
|
import { formulaOfBlock, formulaPlaceholderText } from "../model/formula.js";
|
|
3
3
|
import { layoutFormula } from "../mathml/layout.js";
|
|
4
|
-
import { alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, justifyLineGapsPt, lineNaturalHeightPt, pushCellBorderLines, registerImage, sumColumnWidthsPt } from "./shared.js";
|
|
4
|
+
import { alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, formulaSizePtFromFrame, justifyLineGapsPt, lineNaturalHeightPt, pushCellBorderLines, registerImage, sumColumnWidthsPt } from "./shared.js";
|
|
5
5
|
import { COLOR_BLACK, LAYOUT_FORMAT_VERSION } from "document-schema.js";
|
|
6
6
|
import { loadMathFont, wrapRunsToWidth } from "pdf-codec";
|
|
7
7
|
//#region src/layout/engine.ts
|
|
8
|
-
const MIN_FORMULA_SIZE_PT = 8;
|
|
9
|
-
function formulaSizePtFromFrame(frameHeightPt) {
|
|
10
|
-
return Math.max(MIN_FORMULA_SIZE_PT, frameHeightPt / 2);
|
|
11
|
-
}
|
|
12
8
|
function newFlowState(section) {
|
|
13
9
|
return {
|
|
14
10
|
items: [],
|
package/dist/layout/shared.cjs
CHANGED
|
@@ -4,6 +4,10 @@ let pdf_codec = require("pdf-codec");
|
|
|
4
4
|
let document_schema_js = require("document-schema.js");
|
|
5
5
|
//#region src/layout/shared.ts
|
|
6
6
|
const NOMINAL_TEXT_SIZE_PT = 18;
|
|
7
|
+
const MIN_FORMULA_SIZE_PT = 8;
|
|
8
|
+
function formulaSizePtFromFrame(frameHeightPt) {
|
|
9
|
+
return Math.max(MIN_FORMULA_SIZE_PT, frameHeightPt / 2);
|
|
10
|
+
}
|
|
7
11
|
const FALLBACK_ROW_HEIGHT_PT = 20;
|
|
8
12
|
function runFont(run) {
|
|
9
13
|
return {
|
|
@@ -80,6 +84,7 @@ function pushBorderLine(border, x1Pt, y1Pt, x2Pt, y2Pt, sourcePath, out) {
|
|
|
80
84
|
y2Pt,
|
|
81
85
|
color: border.color,
|
|
82
86
|
widthPt: border.widthPt,
|
|
87
|
+
style: border.style,
|
|
83
88
|
sourcePath
|
|
84
89
|
});
|
|
85
90
|
}
|
|
@@ -147,6 +152,7 @@ exports.NOMINAL_TEXT_SIZE_PT = NOMINAL_TEXT_SIZE_PT;
|
|
|
147
152
|
exports.alignmentOffsetPt = alignmentOffsetPt;
|
|
148
153
|
exports.effectiveStyledRuns = effectiveStyledRuns;
|
|
149
154
|
exports.estimateRowHeightPt = estimateRowHeightPt;
|
|
155
|
+
exports.formulaSizePtFromFrame = formulaSizePtFromFrame;
|
|
150
156
|
exports.justifyLineGapsPt = justifyLineGapsPt;
|
|
151
157
|
exports.lineNaturalHeightPt = lineNaturalHeightPt;
|
|
152
158
|
exports.pushCellBorderLines = pushCellBorderLines;
|
package/dist/layout/shared.d.cts
CHANGED
|
@@ -3,6 +3,7 @@ import { Box, ContentCellBorders, ContentImageBlock, ContentRun, ContentTableRow
|
|
|
3
3
|
import { StyledRun, TextMeasurer, WrappedLine } from "pdf-codec";
|
|
4
4
|
//#region src/layout/shared.d.ts
|
|
5
5
|
declare const NOMINAL_TEXT_SIZE_PT = 18;
|
|
6
|
+
declare function formulaSizePtFromFrame(frameHeightPt: number): number;
|
|
6
7
|
declare function runFont(run: ContentRun): LayoutFont;
|
|
7
8
|
declare function toStyledRuns(runs: readonly ContentRun[], fontScale?: number): StyledRun[];
|
|
8
9
|
declare function effectiveStyledRuns(runs: readonly ContentRun[], fontScale?: number): StyledRun[];
|
|
@@ -14,4 +15,4 @@ declare function registerImage(block: ContentImageBlock, images: Record<string,
|
|
|
14
15
|
declare function sumColumnWidthsPt(columnWidthsPt: readonly number[], startIndex: number, span: number): number;
|
|
15
16
|
declare function estimateRowHeightPt(row: ContentTableRow, measurer: TextMeasurer, columnWidthsPt: readonly number[], scale: number): number;
|
|
16
17
|
//#endregion
|
|
17
|
-
export { NOMINAL_TEXT_SIZE_PT, alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, justifyLineGapsPt, lineNaturalHeightPt, pushCellBorderLines, registerImage, runFont, sumColumnWidthsPt, toStyledRuns };
|
|
18
|
+
export { NOMINAL_TEXT_SIZE_PT, alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, formulaSizePtFromFrame, justifyLineGapsPt, lineNaturalHeightPt, pushCellBorderLines, registerImage, runFont, sumColumnWidthsPt, toStyledRuns };
|
package/dist/layout/shared.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Box, ContentCellBorders, ContentImageBlock, ContentRun, ContentTableRow
|
|
|
3
3
|
import { StyledRun, TextMeasurer, WrappedLine } from "pdf-codec";
|
|
4
4
|
//#region src/layout/shared.d.ts
|
|
5
5
|
declare const NOMINAL_TEXT_SIZE_PT = 18;
|
|
6
|
+
declare function formulaSizePtFromFrame(frameHeightPt: number): number;
|
|
6
7
|
declare function runFont(run: ContentRun): LayoutFont;
|
|
7
8
|
declare function toStyledRuns(runs: readonly ContentRun[], fontScale?: number): StyledRun[];
|
|
8
9
|
declare function effectiveStyledRuns(runs: readonly ContentRun[], fontScale?: number): StyledRun[];
|
|
@@ -14,4 +15,4 @@ declare function registerImage(block: ContentImageBlock, images: Record<string,
|
|
|
14
15
|
declare function sumColumnWidthsPt(columnWidthsPt: readonly number[], startIndex: number, span: number): number;
|
|
15
16
|
declare function estimateRowHeightPt(row: ContentTableRow, measurer: TextMeasurer, columnWidthsPt: readonly number[], scale: number): number;
|
|
16
17
|
//#endregion
|
|
17
|
-
export { NOMINAL_TEXT_SIZE_PT, alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, justifyLineGapsPt, lineNaturalHeightPt, pushCellBorderLines, registerImage, runFont, sumColumnWidthsPt, toStyledRuns };
|
|
18
|
+
export { NOMINAL_TEXT_SIZE_PT, alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, formulaSizePtFromFrame, justifyLineGapsPt, lineNaturalHeightPt, pushCellBorderLines, registerImage, runFont, sumColumnWidthsPt, toStyledRuns };
|
package/dist/layout/shared.js
CHANGED
|
@@ -4,6 +4,10 @@ import { base64ToBytes } from "ooxml.js";
|
|
|
4
4
|
import { crc32, decodePng, readJpegInfo, wrapRunsToWidth } from "pdf-codec";
|
|
5
5
|
//#region src/layout/shared.ts
|
|
6
6
|
const NOMINAL_TEXT_SIZE_PT = 18;
|
|
7
|
+
const MIN_FORMULA_SIZE_PT = 8;
|
|
8
|
+
function formulaSizePtFromFrame(frameHeightPt) {
|
|
9
|
+
return Math.max(MIN_FORMULA_SIZE_PT, frameHeightPt / 2);
|
|
10
|
+
}
|
|
7
11
|
const FALLBACK_ROW_HEIGHT_PT = 20;
|
|
8
12
|
function runFont(run) {
|
|
9
13
|
return {
|
|
@@ -80,6 +84,7 @@ function pushBorderLine(border, x1Pt, y1Pt, x2Pt, y2Pt, sourcePath, out) {
|
|
|
80
84
|
y2Pt,
|
|
81
85
|
color: border.color,
|
|
82
86
|
widthPt: border.widthPt,
|
|
87
|
+
style: border.style,
|
|
83
88
|
sourcePath
|
|
84
89
|
});
|
|
85
90
|
}
|
|
@@ -143,4 +148,4 @@ function estimateRowHeightPt(row, measurer, columnWidthsPt, scale) {
|
|
|
143
148
|
return max;
|
|
144
149
|
}
|
|
145
150
|
//#endregion
|
|
146
|
-
export { NOMINAL_TEXT_SIZE_PT, alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, justifyLineGapsPt, lineNaturalHeightPt, pushCellBorderLines, registerImage, runFont, sumColumnWidthsPt, toStyledRuns };
|
|
151
|
+
export { NOMINAL_TEXT_SIZE_PT, alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, formulaSizePtFromFrame, justifyLineGapsPt, lineNaturalHeightPt, pushCellBorderLines, registerImage, runFont, sumColumnWidthsPt, toStyledRuns };
|
package/dist/layout/sheets.cjs
CHANGED
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_model_geometry = require("../model/geometry.cjs");
|
|
3
|
+
const require_mathml_layout = require("../mathml/layout.cjs");
|
|
3
4
|
const require_layout_shared = require("./shared.cjs");
|
|
4
5
|
const require_ports_abort = require("../ports/abort.cjs");
|
|
5
6
|
let document_schema_js = require("document-schema.js");
|
|
6
7
|
let pdf_codec = require("pdf-codec");
|
|
7
8
|
//#region src/layout/sheets.ts
|
|
9
|
+
function anchoredFormulas(sheet) {
|
|
10
|
+
const resolved = [];
|
|
11
|
+
for (const object of sheet.embeddedObjects ?? []) {
|
|
12
|
+
const anchored = resolveAnchoredFormula(object);
|
|
13
|
+
if (anchored !== void 0) resolved.push(anchored);
|
|
14
|
+
}
|
|
15
|
+
return resolved;
|
|
16
|
+
}
|
|
17
|
+
function resolveAnchoredFormula(object) {
|
|
18
|
+
if (object.objectKind !== "formula" || object.document.kind !== "formula" || object.document.formula.mathml.length === 0) return;
|
|
19
|
+
const { anchorRow, anchorColumn, offsetXPt, offsetYPt } = object;
|
|
20
|
+
if (anchorRow === void 0 || anchorColumn === void 0 || offsetXPt === void 0 || offsetYPt === void 0) return;
|
|
21
|
+
return {
|
|
22
|
+
formula: object.document.formula,
|
|
23
|
+
anchorRow,
|
|
24
|
+
anchorColumn,
|
|
25
|
+
offsetXPt,
|
|
26
|
+
offsetYPt,
|
|
27
|
+
frame: object.frame
|
|
28
|
+
};
|
|
29
|
+
}
|
|
8
30
|
const DEFAULT_COLUMN_WIDTH_PT = 64;
|
|
9
31
|
const DEFAULT_ROW_HEIGHT_PT = 15;
|
|
10
32
|
const NOMINAL_CELL_TEXT_SIZE_PT = 10;
|
|
@@ -26,9 +48,9 @@ function columnLetters(index) {
|
|
|
26
48
|
}
|
|
27
49
|
return letters;
|
|
28
50
|
}
|
|
29
|
-
function resolvePrintRange(sheet) {
|
|
51
|
+
function resolvePrintRange(sheet, formulas) {
|
|
30
52
|
if (sheet.printSettings.printRange !== void 0) return sheet.printSettings.printRange;
|
|
31
|
-
if (sheet.cells.length === 0) return;
|
|
53
|
+
if (sheet.cells.length === 0 && formulas.length === 0) return;
|
|
32
54
|
let startRow = Number.POSITIVE_INFINITY;
|
|
33
55
|
let startColumn = Number.POSITIVE_INFINITY;
|
|
34
56
|
let endRow = Number.NEGATIVE_INFINITY;
|
|
@@ -39,6 +61,12 @@ function resolvePrintRange(sheet) {
|
|
|
39
61
|
endRow = Math.max(endRow, cell.row + (cell.rowSpan ?? 1) - 1);
|
|
40
62
|
endColumn = Math.max(endColumn, cell.column + (cell.colSpan ?? 1) - 1);
|
|
41
63
|
}
|
|
64
|
+
for (const formula of formulas) {
|
|
65
|
+
startRow = Math.min(startRow, formula.anchorRow);
|
|
66
|
+
startColumn = Math.min(startColumn, formula.anchorColumn);
|
|
67
|
+
endRow = Math.max(endRow, formula.anchorRow);
|
|
68
|
+
endColumn = Math.max(endColumn, formula.anchorColumn);
|
|
69
|
+
}
|
|
42
70
|
return {
|
|
43
71
|
startRow,
|
|
44
72
|
startColumn,
|
|
@@ -331,6 +359,33 @@ function renderGridlines(gridLeftXPt, gridTopYDownPt, gridWidthPt, gridHeightPt,
|
|
|
331
359
|
out.push(line);
|
|
332
360
|
}
|
|
333
361
|
}
|
|
362
|
+
function renderAnchoredFormulas(formulas, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageHeightPt, pageIndex, hiddenColumnIndices, hiddenRowIndices, out) {
|
|
363
|
+
for (const anchored of formulas) {
|
|
364
|
+
const columnPosition = columnAxis.positionByIndex.get(anchored.anchorColumn);
|
|
365
|
+
const rowPosition = rowAxis.positionByIndex.get(anchored.anchorRow);
|
|
366
|
+
if (columnPosition === void 0 || rowPosition === void 0 || hiddenColumnIndices.has(anchored.anchorColumn) || hiddenRowIndices.has(anchored.anchorRow)) continue;
|
|
367
|
+
const sizePt = require_layout_shared.formulaSizePtFromFrame(anchored.frame.heightPt);
|
|
368
|
+
const metrics = (0, pdf_codec.loadMathFont)().metricsAt(sizePt);
|
|
369
|
+
const { box } = require_mathml_layout.layoutFormula(anchored.formula.mathml, {
|
|
370
|
+
metrics,
|
|
371
|
+
sizePt,
|
|
372
|
+
color: document_schema_js.COLOR_BLACK
|
|
373
|
+
});
|
|
374
|
+
const boxYDown = {
|
|
375
|
+
xPt: gridLeftXPt + columnAxis.offsetsPt[columnPosition] + anchored.offsetXPt,
|
|
376
|
+
yPt: gridTopYDownPt + rowAxis.offsetsPt[rowPosition] + anchored.offsetYPt,
|
|
377
|
+
widthPt: box.widthPt,
|
|
378
|
+
heightPt: box.heightPt
|
|
379
|
+
};
|
|
380
|
+
const flipped = require_model_geometry.flipY(boxYDown, pageHeightPt);
|
|
381
|
+
out.push({
|
|
382
|
+
pageIndex,
|
|
383
|
+
xPt: flipped.xPt,
|
|
384
|
+
yPt: flipped.yPt,
|
|
385
|
+
box
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
}
|
|
334
389
|
function bandableIndices(start, end, repeat) {
|
|
335
390
|
const indices = [];
|
|
336
391
|
for (let i = start; i <= end; i++) {
|
|
@@ -344,9 +399,10 @@ function rangeIndices(start, end) {
|
|
|
344
399
|
for (let i = start; i <= end; i++) indices.push(i);
|
|
345
400
|
return indices;
|
|
346
401
|
}
|
|
347
|
-
function convertSheetToPages(sheet, measurer, signal, out) {
|
|
402
|
+
function convertSheetToPages(sheet, measurer, signal, out, formulasOut) {
|
|
348
403
|
require_ports_abort.throwIfAborted(signal);
|
|
349
|
-
const
|
|
404
|
+
const formulas = anchoredFormulas(sheet);
|
|
405
|
+
const range = resolvePrintRange(sheet, formulas);
|
|
350
406
|
if (range === void 0) return;
|
|
351
407
|
const { printSettings } = sheet;
|
|
352
408
|
const { pageSize, margins } = printSettings;
|
|
@@ -432,6 +488,7 @@ function convertSheetToPages(sheet, measurer, signal, out) {
|
|
|
432
488
|
items.push(...borderItems);
|
|
433
489
|
if (printSettings.headers) renderHeaderLabels(gutter, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageSize.heightPt, measurer, items);
|
|
434
490
|
items.push(...textItems);
|
|
491
|
+
renderAnchoredFormulas(formulas, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageSize.heightPt, out.length, hiddenColumnIndices, hiddenRowIndices, formulasOut);
|
|
435
492
|
out.push({
|
|
436
493
|
widthPt: pageSize.widthPt,
|
|
437
494
|
heightPt: pageSize.heightPt,
|
|
@@ -441,12 +498,16 @@ function convertSheetToPages(sheet, measurer, signal, out) {
|
|
|
441
498
|
}
|
|
442
499
|
function convertSpreadsheetToLayout(doc, options) {
|
|
443
500
|
const pages = [];
|
|
444
|
-
|
|
501
|
+
const formulas = [];
|
|
502
|
+
for (const sheet of doc.sheets) convertSheetToPages(sheet, options.measurer, options.signal, pages, formulas);
|
|
445
503
|
return {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
504
|
+
document: {
|
|
505
|
+
formatVersion: document_schema_js.LAYOUT_FORMAT_VERSION,
|
|
506
|
+
metadata: doc.metadata,
|
|
507
|
+
pages,
|
|
508
|
+
images: {}
|
|
509
|
+
},
|
|
510
|
+
formulas
|
|
450
511
|
};
|
|
451
512
|
}
|
|
452
513
|
//#endregion
|
package/dist/layout/sheets.d.cts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { ContentDocument, LayoutDocument } from "document-schema.js";
|
|
2
|
-
import { TextMeasurer } from "pdf-codec";
|
|
2
|
+
import { PositionedFormula, TextMeasurer } from "pdf-codec";
|
|
3
3
|
//#region src/layout/sheets.d.ts
|
|
4
4
|
interface SheetsLayoutOptions {
|
|
5
5
|
readonly measurer: TextMeasurer;
|
|
6
6
|
readonly signal?: AbortSignal;
|
|
7
7
|
}
|
|
8
|
+
interface SpreadsheetLayoutResult {
|
|
9
|
+
readonly document: LayoutDocument;
|
|
10
|
+
readonly formulas: readonly PositionedFormula[];
|
|
11
|
+
}
|
|
8
12
|
type SpreadsheetContentDocument = Extract<ContentDocument, {
|
|
9
13
|
kind: 'spreadsheet';
|
|
10
14
|
}>;
|
|
11
|
-
declare function convertSpreadsheetToLayout(doc: SpreadsheetContentDocument, options: SheetsLayoutOptions):
|
|
15
|
+
declare function convertSpreadsheetToLayout(doc: SpreadsheetContentDocument, options: SheetsLayoutOptions): SpreadsheetLayoutResult;
|
|
12
16
|
//#endregion
|
|
13
|
-
export { SheetsLayoutOptions, convertSpreadsheetToLayout };
|
|
17
|
+
export { SheetsLayoutOptions, SpreadsheetLayoutResult, convertSpreadsheetToLayout };
|
package/dist/layout/sheets.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { ContentDocument, LayoutDocument } from "document-schema.js";
|
|
2
|
-
import { TextMeasurer } from "pdf-codec";
|
|
2
|
+
import { PositionedFormula, TextMeasurer } from "pdf-codec";
|
|
3
3
|
//#region src/layout/sheets.d.ts
|
|
4
4
|
interface SheetsLayoutOptions {
|
|
5
5
|
readonly measurer: TextMeasurer;
|
|
6
6
|
readonly signal?: AbortSignal;
|
|
7
7
|
}
|
|
8
|
+
interface SpreadsheetLayoutResult {
|
|
9
|
+
readonly document: LayoutDocument;
|
|
10
|
+
readonly formulas: readonly PositionedFormula[];
|
|
11
|
+
}
|
|
8
12
|
type SpreadsheetContentDocument = Extract<ContentDocument, {
|
|
9
13
|
kind: 'spreadsheet';
|
|
10
14
|
}>;
|
|
11
|
-
declare function convertSpreadsheetToLayout(doc: SpreadsheetContentDocument, options: SheetsLayoutOptions):
|
|
15
|
+
declare function convertSpreadsheetToLayout(doc: SpreadsheetContentDocument, options: SheetsLayoutOptions): SpreadsheetLayoutResult;
|
|
12
16
|
//#endregion
|
|
13
|
-
export { SheetsLayoutOptions, convertSpreadsheetToLayout };
|
|
17
|
+
export { SheetsLayoutOptions, SpreadsheetLayoutResult, convertSpreadsheetToLayout };
|
package/dist/layout/sheets.js
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
import { flipY } from "../model/geometry.js";
|
|
2
2
|
import { COLOR_BLACK as COLOR_BLACK$1, rgbHexToColor } from "../model/color.js";
|
|
3
3
|
import { DEFAULT_LAYOUT_FONT } from "../model/style.js";
|
|
4
|
-
import {
|
|
4
|
+
import { layoutFormula } from "../mathml/layout.js";
|
|
5
|
+
import { alignmentOffsetPt, formulaSizePtFromFrame, justifyLineGapsPt, lineNaturalHeightPt, pushCellBorderLines, sumColumnWidthsPt, toStyledRuns } from "./shared.js";
|
|
5
6
|
import { throwIfAborted } from "../ports/abort.js";
|
|
6
7
|
import { LAYOUT_FORMAT_VERSION } from "document-schema.js";
|
|
7
|
-
import { wrapRunsToWidth } from "pdf-codec";
|
|
8
|
+
import { loadMathFont, wrapRunsToWidth } from "pdf-codec";
|
|
8
9
|
//#region src/layout/sheets.ts
|
|
10
|
+
function anchoredFormulas(sheet) {
|
|
11
|
+
const resolved = [];
|
|
12
|
+
for (const object of sheet.embeddedObjects ?? []) {
|
|
13
|
+
const anchored = resolveAnchoredFormula(object);
|
|
14
|
+
if (anchored !== void 0) resolved.push(anchored);
|
|
15
|
+
}
|
|
16
|
+
return resolved;
|
|
17
|
+
}
|
|
18
|
+
function resolveAnchoredFormula(object) {
|
|
19
|
+
if (object.objectKind !== "formula" || object.document.kind !== "formula" || object.document.formula.mathml.length === 0) return;
|
|
20
|
+
const { anchorRow, anchorColumn, offsetXPt, offsetYPt } = object;
|
|
21
|
+
if (anchorRow === void 0 || anchorColumn === void 0 || offsetXPt === void 0 || offsetYPt === void 0) return;
|
|
22
|
+
return {
|
|
23
|
+
formula: object.document.formula,
|
|
24
|
+
anchorRow,
|
|
25
|
+
anchorColumn,
|
|
26
|
+
offsetXPt,
|
|
27
|
+
offsetYPt,
|
|
28
|
+
frame: object.frame
|
|
29
|
+
};
|
|
30
|
+
}
|
|
9
31
|
const DEFAULT_COLUMN_WIDTH_PT = 64;
|
|
10
32
|
const DEFAULT_ROW_HEIGHT_PT = 15;
|
|
11
33
|
const NOMINAL_CELL_TEXT_SIZE_PT = 10;
|
|
@@ -27,9 +49,9 @@ function columnLetters(index) {
|
|
|
27
49
|
}
|
|
28
50
|
return letters;
|
|
29
51
|
}
|
|
30
|
-
function resolvePrintRange(sheet) {
|
|
52
|
+
function resolvePrintRange(sheet, formulas) {
|
|
31
53
|
if (sheet.printSettings.printRange !== void 0) return sheet.printSettings.printRange;
|
|
32
|
-
if (sheet.cells.length === 0) return;
|
|
54
|
+
if (sheet.cells.length === 0 && formulas.length === 0) return;
|
|
33
55
|
let startRow = Number.POSITIVE_INFINITY;
|
|
34
56
|
let startColumn = Number.POSITIVE_INFINITY;
|
|
35
57
|
let endRow = Number.NEGATIVE_INFINITY;
|
|
@@ -40,6 +62,12 @@ function resolvePrintRange(sheet) {
|
|
|
40
62
|
endRow = Math.max(endRow, cell.row + (cell.rowSpan ?? 1) - 1);
|
|
41
63
|
endColumn = Math.max(endColumn, cell.column + (cell.colSpan ?? 1) - 1);
|
|
42
64
|
}
|
|
65
|
+
for (const formula of formulas) {
|
|
66
|
+
startRow = Math.min(startRow, formula.anchorRow);
|
|
67
|
+
startColumn = Math.min(startColumn, formula.anchorColumn);
|
|
68
|
+
endRow = Math.max(endRow, formula.anchorRow);
|
|
69
|
+
endColumn = Math.max(endColumn, formula.anchorColumn);
|
|
70
|
+
}
|
|
43
71
|
return {
|
|
44
72
|
startRow,
|
|
45
73
|
startColumn,
|
|
@@ -332,6 +360,33 @@ function renderGridlines(gridLeftXPt, gridTopYDownPt, gridWidthPt, gridHeightPt,
|
|
|
332
360
|
out.push(line);
|
|
333
361
|
}
|
|
334
362
|
}
|
|
363
|
+
function renderAnchoredFormulas(formulas, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageHeightPt, pageIndex, hiddenColumnIndices, hiddenRowIndices, out) {
|
|
364
|
+
for (const anchored of formulas) {
|
|
365
|
+
const columnPosition = columnAxis.positionByIndex.get(anchored.anchorColumn);
|
|
366
|
+
const rowPosition = rowAxis.positionByIndex.get(anchored.anchorRow);
|
|
367
|
+
if (columnPosition === void 0 || rowPosition === void 0 || hiddenColumnIndices.has(anchored.anchorColumn) || hiddenRowIndices.has(anchored.anchorRow)) continue;
|
|
368
|
+
const sizePt = formulaSizePtFromFrame(anchored.frame.heightPt);
|
|
369
|
+
const metrics = loadMathFont().metricsAt(sizePt);
|
|
370
|
+
const { box } = layoutFormula(anchored.formula.mathml, {
|
|
371
|
+
metrics,
|
|
372
|
+
sizePt,
|
|
373
|
+
color: COLOR_BLACK$1
|
|
374
|
+
});
|
|
375
|
+
const boxYDown = {
|
|
376
|
+
xPt: gridLeftXPt + columnAxis.offsetsPt[columnPosition] + anchored.offsetXPt,
|
|
377
|
+
yPt: gridTopYDownPt + rowAxis.offsetsPt[rowPosition] + anchored.offsetYPt,
|
|
378
|
+
widthPt: box.widthPt,
|
|
379
|
+
heightPt: box.heightPt
|
|
380
|
+
};
|
|
381
|
+
const flipped = flipY(boxYDown, pageHeightPt);
|
|
382
|
+
out.push({
|
|
383
|
+
pageIndex,
|
|
384
|
+
xPt: flipped.xPt,
|
|
385
|
+
yPt: flipped.yPt,
|
|
386
|
+
box
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
335
390
|
function bandableIndices(start, end, repeat) {
|
|
336
391
|
const indices = [];
|
|
337
392
|
for (let i = start; i <= end; i++) {
|
|
@@ -345,9 +400,10 @@ function rangeIndices(start, end) {
|
|
|
345
400
|
for (let i = start; i <= end; i++) indices.push(i);
|
|
346
401
|
return indices;
|
|
347
402
|
}
|
|
348
|
-
function convertSheetToPages(sheet, measurer, signal, out) {
|
|
403
|
+
function convertSheetToPages(sheet, measurer, signal, out, formulasOut) {
|
|
349
404
|
throwIfAborted(signal);
|
|
350
|
-
const
|
|
405
|
+
const formulas = anchoredFormulas(sheet);
|
|
406
|
+
const range = resolvePrintRange(sheet, formulas);
|
|
351
407
|
if (range === void 0) return;
|
|
352
408
|
const { printSettings } = sheet;
|
|
353
409
|
const { pageSize, margins } = printSettings;
|
|
@@ -433,6 +489,7 @@ function convertSheetToPages(sheet, measurer, signal, out) {
|
|
|
433
489
|
items.push(...borderItems);
|
|
434
490
|
if (printSettings.headers) renderHeaderLabels(gutter, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageSize.heightPt, measurer, items);
|
|
435
491
|
items.push(...textItems);
|
|
492
|
+
renderAnchoredFormulas(formulas, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageSize.heightPt, out.length, hiddenColumnIndices, hiddenRowIndices, formulasOut);
|
|
436
493
|
out.push({
|
|
437
494
|
widthPt: pageSize.widthPt,
|
|
438
495
|
heightPt: pageSize.heightPt,
|
|
@@ -442,12 +499,16 @@ function convertSheetToPages(sheet, measurer, signal, out) {
|
|
|
442
499
|
}
|
|
443
500
|
function convertSpreadsheetToLayout(doc, options) {
|
|
444
501
|
const pages = [];
|
|
445
|
-
|
|
502
|
+
const formulas = [];
|
|
503
|
+
for (const sheet of doc.sheets) convertSheetToPages(sheet, options.measurer, options.signal, pages, formulas);
|
|
446
504
|
return {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
505
|
+
document: {
|
|
506
|
+
formatVersion: LAYOUT_FORMAT_VERSION,
|
|
507
|
+
metadata: doc.metadata,
|
|
508
|
+
pages,
|
|
509
|
+
images: {}
|
|
510
|
+
},
|
|
511
|
+
formulas
|
|
451
512
|
};
|
|
452
513
|
}
|
|
453
514
|
//#endregion
|
package/dist/layout/slides.cjs
CHANGED
|
@@ -6,10 +6,6 @@ const require_layout_shared = require("./shared.cjs");
|
|
|
6
6
|
let document_schema_js = require("document-schema.js");
|
|
7
7
|
let pdf_codec = require("pdf-codec");
|
|
8
8
|
//#region src/layout/slides.ts
|
|
9
|
-
const MIN_FORMULA_SIZE_PT = 8;
|
|
10
|
-
function formulaSizePtFromFrame(frameHeightPt) {
|
|
11
|
-
return Math.max(MIN_FORMULA_SIZE_PT, frameHeightPt / 2);
|
|
12
|
-
}
|
|
13
9
|
function shapePlacement(flippedFrame, rotationDeg) {
|
|
14
10
|
if (rotationDeg === void 0 || rotationDeg === 0) return {
|
|
15
11
|
place: (p) => p,
|
|
@@ -120,7 +116,7 @@ function layoutTable(table, contentLeftXDown, contentWidthPt, startYDown, slideH
|
|
|
120
116
|
function layoutShapeFormula(block, flippedFrame, formulaContext) {
|
|
121
117
|
const formula = require_model_formula.formulaOfBlock(block);
|
|
122
118
|
if (formula === void 0 || formula.mathml.length === 0) return;
|
|
123
|
-
const sizePt = formulaSizePtFromFrame(block.frame.heightPt);
|
|
119
|
+
const sizePt = require_layout_shared.formulaSizePtFromFrame(block.frame.heightPt);
|
|
124
120
|
const metrics = (0, pdf_codec.loadMathFont)().metricsAt(sizePt);
|
|
125
121
|
const { box } = require_mathml_layout.layoutFormula(formula.mathml, {
|
|
126
122
|
metrics,
|
package/dist/layout/slides.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { flipY } from "../model/geometry.js";
|
|
2
2
|
import { formulaOfBlock } from "../model/formula.js";
|
|
3
3
|
import { layoutFormula } from "../mathml/layout.js";
|
|
4
|
-
import { alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, justifyLineGapsPt, lineNaturalHeightPt, registerImage, sumColumnWidthsPt } from "./shared.js";
|
|
4
|
+
import { alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, formulaSizePtFromFrame, justifyLineGapsPt, lineNaturalHeightPt, registerImage, sumColumnWidthsPt } from "./shared.js";
|
|
5
5
|
import { COLOR_BLACK, LAYOUT_FORMAT_VERSION } from "document-schema.js";
|
|
6
6
|
import { loadMathFont, rotatePointAboutCenter, wrapRunsToWidth } from "pdf-codec";
|
|
7
7
|
//#region src/layout/slides.ts
|
|
8
|
-
const MIN_FORMULA_SIZE_PT = 8;
|
|
9
|
-
function formulaSizePtFromFrame(frameHeightPt) {
|
|
10
|
-
return Math.max(MIN_FORMULA_SIZE_PT, frameHeightPt / 2);
|
|
11
|
-
}
|
|
12
8
|
function shapePlacement(flippedFrame, rotationDeg) {
|
|
13
9
|
if (rotationDeg === void 0 || rotationDeg === 0) return {
|
|
14
10
|
place: (p) => p,
|
|
@@ -5,6 +5,9 @@ declare class OdtListItem {
|
|
|
5
5
|
private readonly node;
|
|
6
6
|
private readonly pkg;
|
|
7
7
|
constructor(node: XmlElement, pkg: Package);
|
|
8
|
+
paragraphs(): OdtParagraph[];
|
|
9
|
+
get text(): string;
|
|
10
|
+
nestedLists(): OdtList[];
|
|
8
11
|
appendParagraph(init?: ParagraphInit): OdtParagraph;
|
|
9
12
|
addNestedList(): OdtList;
|
|
10
13
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-
|
|
1
|
+
import { n as ParagraphInit, t as OdtParagraph } from "./paragraph-DndYbWuT.js";
|
|
2
2
|
import { Package, XmlElement, XmlNode } from "odf.js";
|
|
3
3
|
//#region src/edit/odt/list.d.ts
|
|
4
4
|
declare class OdtListItem {
|
|
5
5
|
private readonly node;
|
|
6
6
|
private readonly pkg;
|
|
7
7
|
constructor(node: XmlElement, pkg: Package);
|
|
8
|
+
paragraphs(): OdtParagraph[];
|
|
9
|
+
get text(): string;
|
|
10
|
+
nestedLists(): OdtList[];
|
|
8
11
|
appendParagraph(init?: ParagraphInit): OdtParagraph;
|
|
9
12
|
addNestedList(): OdtList;
|
|
10
13
|
}
|
package/dist/markdown/write.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_model_formula = require("../model/formula.cjs");
|
|
3
2
|
const require_model_embedded_drawing = require("../model/embedded-drawing.cjs");
|
|
3
|
+
const require_model_formula = require("../model/formula.cjs");
|
|
4
4
|
let markdown_codec = require("markdown-codec");
|
|
5
5
|
//#region src/markdown/write.ts
|
|
6
6
|
function toLegacyEmbeddedDocument(document) {
|