abstract-document 20.1.5 → 20.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/abstract-document/atoms/text-run.d.ts.map +1 -1
  3. package/lib/abstract-document/atoms/text-run.js +1 -7
  4. package/lib/abstract-document/atoms/text-run.js.map +1 -1
  5. package/lib/abstract-document/markdown/markdown.d.ts.map +1 -1
  6. package/lib/abstract-document/markdown/markdown.js +58 -60
  7. package/lib/abstract-document/markdown/markdown.js.map +1 -1
  8. package/lib/abstract-document/resources.d.ts.map +1 -1
  9. package/lib/abstract-document/resources.js +1 -3
  10. package/lib/abstract-document/resources.js.map +1 -1
  11. package/lib/abstract-document/styles/table-style.js +2 -2
  12. package/lib/abstract-document/styles/table-style.js.map +1 -1
  13. package/lib/abstract-document/styles/text-style.js +6 -6
  14. package/lib/abstract-document/styles/text-style.js.map +1 -1
  15. package/lib/abstract-document-exporters/docx/xml-writer.d.ts.map +1 -1
  16. package/lib/abstract-document-exporters/docx/xml-writer.js +14 -17
  17. package/lib/abstract-document-exporters/docx/xml-writer.js.map +1 -1
  18. package/lib/abstract-document-exporters/docx2/render-image.js +9 -11
  19. package/lib/abstract-document-exporters/docx2/render-image.js.map +1 -1
  20. package/lib/abstract-document-exporters/docx2/render.js +2 -6
  21. package/lib/abstract-document-exporters/docx2/render.js.map +1 -1
  22. package/lib/abstract-document-exporters/pdf/font.d.ts.map +1 -1
  23. package/lib/abstract-document-exporters/pdf/font.js +1 -2
  24. package/lib/abstract-document-exporters/pdf/font.js.map +1 -1
  25. package/lib/abstract-document-exporters/pdf/measure.js +3 -3
  26. package/lib/abstract-document-exporters/pdf/measure.js.map +1 -1
  27. package/lib/abstract-document-exporters/pdf/paginate.js +1 -0
  28. package/lib/abstract-document-exporters/pdf/paginate.js.map +1 -1
  29. package/lib/abstract-document-exporters/pdf/pre-process.js +4 -6
  30. package/lib/abstract-document-exporters/pdf/pre-process.js.map +1 -1
  31. package/lib/abstract-document-exporters/pdf/render-image.js +2 -2
  32. package/lib/abstract-document-exporters/pdf/render-image.js.map +1 -1
  33. package/lib/abstract-document-exporters/pdf/render.js +23 -26
  34. package/lib/abstract-document-exporters/pdf/render.js.map +1 -1
  35. package/lib/abstract-document-exporters/pdf/textRunRow.d.ts.map +1 -1
  36. package/lib/abstract-document-exporters/pdf/textRunRow.js +21 -23
  37. package/lib/abstract-document-exporters/pdf/textRunRow.js.map +1 -1
  38. package/lib/abstract-document-jsx/index.d.ts.map +1 -1
  39. package/lib/abstract-document-jsx/index.js +5 -5
  40. package/lib/abstract-document-jsx/index.js.map +1 -1
  41. package/lib/abstract-document-xml/abstract-doc-of-xml/abstract-doc-of-xml.d.ts.map +1 -1
  42. package/lib/abstract-document-xml/abstract-doc-of-xml/abstract-doc-of-xml.js +32 -29
  43. package/lib/abstract-document-xml/abstract-doc-of-xml/abstract-doc-of-xml.js.map +1 -1
  44. package/lib/abstract-document-xml/abstract-doc-of-xml/creator.d.ts.map +1 -1
  45. package/lib/abstract-document-xml/abstract-doc-of-xml/creator.js +10 -39
  46. package/lib/abstract-document-xml/abstract-doc-of-xml/creator.js.map +1 -1
  47. package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.d.ts.map +1 -1
  48. package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.js +16 -5
  49. package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.js.map +1 -1
  50. package/package.json +4 -4
  51. package/src/abstract-document/atoms/text-run.ts +1 -7
  52. package/src/abstract-document/markdown/markdown.ts +74 -76
  53. package/src/abstract-document/resources.ts +1 -3
  54. package/src/abstract-document/styles/table-style.ts +2 -2
  55. package/src/abstract-document/styles/text-style.ts +6 -6
  56. package/src/abstract-document-exporters/docx/xml-writer.ts +16 -19
  57. package/src/abstract-document-exporters/docx2/render-image.ts +11 -13
  58. package/src/abstract-document-exporters/docx2/render.ts +3 -7
  59. package/src/abstract-document-exporters/pdf/font.ts +1 -2
  60. package/src/abstract-document-exporters/pdf/measure.ts +9 -9
  61. package/src/abstract-document-exporters/pdf/paginate.ts +3 -2
  62. package/src/abstract-document-exporters/pdf/pre-process.ts +5 -7
  63. package/src/abstract-document-exporters/pdf/render-image.ts +9 -9
  64. package/src/abstract-document-exporters/pdf/render.ts +25 -28
  65. package/src/abstract-document-exporters/pdf/textRunRow.ts +32 -35
  66. package/src/abstract-document-jsx/index.ts +5 -5
  67. package/src/abstract-document-xml/abstract-doc-of-xml/abstract-doc-of-xml.ts +30 -27
  68. package/src/abstract-document-xml/abstract-doc-of-xml/creator.ts +13 -42
  69. package/src/abstract-document-xml/abstract-doc-of-xml/custom-elements.tsx +22 -8
@@ -35,7 +35,9 @@ export function extractStyleNames(styleNames: string | undefined, styleNameTypes
35
35
  return styleNameProps;
36
36
  }
37
37
 
38
- export type TextRowProps = Omit<TextCellProps, "style"> & { readonly cellStyle?: TableCellStyle.TableCellStyle };
38
+ export type TextRowProps = Omit<TextCellProps, "style"> & {
39
+ readonly cellStyle?: TableCellStyle.TableCellStyle;
40
+ };
39
41
 
40
42
  export function TextRow(props: TextRowProps, styleNameTypes: Record<string, string>): TableRow.TableRow {
41
43
  return TableRow.create({}, [TextCell({ ...props, style: props.cellStyle }, styleNameTypes)]);
@@ -85,7 +87,9 @@ export function TextParagraph(props: TextParagraphProps, styleNameTypes: Record<
85
87
  return Paragraph.create({ style, styleName: styleNames.ParagraphStyle }, [textRun]);
86
88
  }
87
89
 
88
- export type ImageRowProps = Omit<ImageCellProps, "style"> & { readonly cellStyle?: TableCellStyle.TableCellStyle };
90
+ export type ImageRowProps = Omit<ImageCellProps, "style"> & {
91
+ readonly cellStyle?: TableCellStyle.TableCellStyle;
92
+ };
89
93
 
90
94
  export function ImageRow(props: ImageRowProps, styleNameTypes: Record<string, string>): TableRow.TableRow {
91
95
  return TableRow.create({}, [ImageCell({ ...props, style: props.cellStyle }, styleNameTypes)]);
@@ -101,12 +105,18 @@ export type ImageCellProps = Omit<ImageParagraphProps, "style"> & {
101
105
  export function ImageCell(props: ImageCellProps, styleNameTypes: Record<string, string>): TableCell.TableCell {
102
106
  const { imageResource, width, height, horizontalAlignment, verticalAlignment, paragraphStyle, style, columnSpan, rowSpan } = props;
103
107
  const styleNames = extractStyleNames(props.styleNames, styleNameTypes);
104
- const imageElement = imageResource && Image.create({ imageResource, width, height, horizontalAlignment, verticalAlignment });
108
+ const imageElement = Image.create({
109
+ imageResource,
110
+ width,
111
+ height,
112
+ horizontalAlignment,
113
+ verticalAlignment,
114
+ });
105
115
  const pararaphProps = {
106
116
  style: paragraphStyle ? { ...paragraphStyle, type: "ParagraphStyle" } : undefined,
107
117
  styleName: styleNames.ParagraphStyle,
108
118
  } as ParagraphProps;
109
- const paragraph = imageElement ? Paragraph.create(pararaphProps, [imageElement]) : Paragraph.create(pararaphProps, [ImageMissing]);
119
+ const paragraph = Paragraph.create(pararaphProps, [imageElement]);
110
120
  return TableCell.create({ columnSpan, rowSpan, style, styleName: styleNames.TableCellStyle }, [paragraph]);
111
121
  }
112
122
 
@@ -118,9 +128,13 @@ export type ImageParagraphProps = ImageProps & {
118
128
  export function ImageParagraph(props: ImageParagraphProps, styleNameTypes: Record<string, string>): Paragraph.Paragraph | undefined {
119
129
  const { imageResource, width, height, style, horizontalAlignment, verticalAlignment } = props;
120
130
  const styleNames = extractStyleNames(props.styleNames, styleNameTypes);
121
- const imageElement = imageResource && Image.create({ imageResource, width, height, horizontalAlignment, verticalAlignment });
131
+ const imageElement = Image.create({
132
+ imageResource,
133
+ width,
134
+ height,
135
+ horizontalAlignment,
136
+ verticalAlignment,
137
+ });
122
138
  const pararaphProps = { style, styleName: styleNames.ParagraphStyle };
123
- return imageElement ? Paragraph.create(pararaphProps, [imageElement]) : Paragraph.create(pararaphProps, [ImageMissing]);
139
+ return Paragraph.create(pararaphProps, [imageElement]);
124
140
  }
125
-
126
- const ImageMissing = TextRun.create({ text: "Image missing" });