abstract-document 20.2.0 → 20.2.2

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 (36) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/abstract-document-jsx/index.js.map +1 -1
  3. package/lib/abstract-document-xml/abstract-doc-of-xml/abstract-doc-of-xml.js +1 -0
  4. package/lib/abstract-document-xml/abstract-doc-of-xml/abstract-doc-of-xml.js.map +1 -1
  5. package/lib/abstract-document-xml/abstract-doc-of-xml/creator.d.ts.map +1 -1
  6. package/lib/abstract-document-xml/abstract-doc-of-xml/creator.js +41 -9
  7. package/lib/abstract-document-xml/abstract-doc-of-xml/creator.js.map +1 -1
  8. package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.d.ts +15 -0
  9. package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.d.ts.map +1 -1
  10. package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.js +21 -1
  11. package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.js.map +1 -1
  12. package/lib/abstract-document-xml/xsd-template/custom-elements.d.ts +6 -0
  13. package/lib/abstract-document-xml/xsd-template/custom-elements.d.ts.map +1 -1
  14. package/lib/abstract-document-xml/xsd-template/custom-elements.js +55 -0
  15. package/lib/abstract-document-xml/xsd-template/custom-elements.js.map +1 -1
  16. package/lib/abstract-document-xml/xsd-template/elements.d.ts +13 -12
  17. package/lib/abstract-document-xml/xsd-template/elements.d.ts.map +1 -1
  18. package/lib/abstract-document-xml/xsd-template/elements.js +18 -4
  19. package/lib/abstract-document-xml/xsd-template/elements.js.map +1 -1
  20. package/lib/abstract-document-xml/xsd-template/xsd-template.d.ts +2 -2
  21. package/lib/abstract-document-xml/xsd-template/xsd-template.d.ts.map +1 -1
  22. package/lib/abstract-document-xml/xsd-template/xsd-template.js +4 -0
  23. package/lib/abstract-document-xml/xsd-template/xsd-template.js.map +1 -1
  24. package/package.json +4 -4
  25. package/src/abstract-document-jsx/index.ts +2 -2
  26. package/src/abstract-document-xml/abstract-doc-of-xml/abstract-doc-of-xml.ts +1 -0
  27. package/src/abstract-document-xml/abstract-doc-of-xml/creator.ts +62 -10
  28. package/src/abstract-document-xml/abstract-doc-of-xml/custom-elements.tsx +42 -1
  29. package/src/abstract-document-xml/xsd-template/custom-elements.ts +58 -0
  30. package/src/abstract-document-xml/xsd-template/elements.ts +19 -4
  31. package/src/abstract-document-xml/xsd-template/xsd-template.ts +4 -0
  32. package/src/custom_typings/pdf2json/index.d.ts +10 -1
  33. package/src/custom_typings/remark-parse/index.d.ts +4 -1
  34. package/src/custom_typings/remark-sub-super/index.d.ts +4 -1
  35. package/src/custom_typings/svg-to-pdfkit/index.d.ts +4 -1
  36. package/src/custom_typings/unified/index.d.ts +8 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "abstract-document",
3
- "version": "20.2.0",
4
- "gitHead": "09174caac85ce546198a6aefad838b7dff393ea9",
3
+ "version": "20.2.2",
4
+ "gitHead": "1f7b1d4af06f5e7e7e16edcec9078c9b852a0dd1",
5
5
  "description": "Dynamically create documents using code or JSX and render to any format",
6
6
  "license": "MIT",
7
7
  "repository": "https://github.com/dividab/abstract-visuals/tree/master/packages/abstract-document",
@@ -41,11 +41,11 @@
41
41
  }
42
42
  },
43
43
  "dependencies": {
44
- "abstract-image": "^13.2.0",
44
+ "abstract-image": "^13.2.1",
45
45
  "docx": "^9.7.1",
46
46
  "fast-xml-parser": "^4.5.0",
47
47
  "handlebars": "4.7.8",
48
- "handlebars-xml": "^0.6.0",
48
+ "handlebars-xml": "^0.6.1",
49
49
  "moment": "^2.30.1",
50
50
  "pdfkit": "^0.20.2",
51
51
  "remark-parse": "^6.0.3",
@@ -79,9 +79,9 @@ function renderChildren(element: FakeElement): Array<unknown> {
79
79
  return [];
80
80
  }
81
81
  if (Array.isArray(c)) {
82
- return c.map(render);
82
+ return c.map(render) as Array<unknown>;
83
83
  }
84
- return render(c);
84
+ return render(c) as unknown;
85
85
  });
86
86
  } else {
87
87
  const elements = render(element.props.children); // Markdown returns an array of elements already
@@ -138,6 +138,7 @@ function abstractDocXmlRecursive(creators: Record<string, ADCreatorFn>, xmlEleme
138
138
  break;
139
139
  case "TextField":
140
140
  case "HyperLink":
141
+ case "LineBreak":
141
142
  case "TextRun":
142
143
  obj["style"] = { ...obj["style"], type: "TextStyle" };
143
144
  break;
@@ -4,7 +4,10 @@ import {
4
4
  AbstractDoc,
5
5
  DefaultStyles,
6
6
  Group,
7
+ HyperLink,
7
8
  Image,
9
+ LineBreak,
10
+ LinkTarget,
8
11
  Markdown,
9
12
  PageBreak,
10
13
  Paragraph,
@@ -17,8 +20,18 @@ import {
17
20
  TocSeparator,
18
21
  ImageResource,
19
22
  } from "../../abstract-document/index.js";
20
- import type { TextRowProps, TextCellProps, TextParagraphProps, ImageCellProps, ImageParagraphProps, ImageRowProps } from "./custom-elements.js";
21
- import { TextRow, TextCell, TextParagraph, ImageCell, ImageParagraph, ImageRow } from "./custom-elements.js";
23
+ import type { ImageCellProps, ImageParagraphProps, ImageRowProps } from "./custom-elements.js";
24
+ import {
25
+ TextRow,
26
+ TextCell,
27
+ TextParagraph,
28
+ HyperLinkRow,
29
+ HyperLinkCell,
30
+ HyperLinkParagraph,
31
+ ImageCell,
32
+ ImageParagraph,
33
+ ImageRow,
34
+ } from "./custom-elements.js";
22
35
 
23
36
  export type ADCreatorFn = (props?: Record<string, unknown>, children?: ReadonlyArray<unknown>) => unknown;
24
37
 
@@ -27,22 +40,30 @@ export const creators: (styleNames: Record<string, string>) => Record<string, AD
27
40
  AbstractDoc: ((props, children: ReadonlyArray<Section.Section>) => AbstractDoc.create(props, children)) as ADCreatorFn,
28
41
  Section: ((props, children: ReadonlyArray<SectionElement.SectionElement>) => Section.create(props, children)) as ADCreatorFn,
29
42
  Paragraph: ((props, children: ReadonlyArray<Atom.Atom>) => Paragraph.create(props, children)) as ADCreatorFn,
30
- TextRow: ((props: TextRowProps) => TextRow(props, styleNames)) as ADCreatorFn,
31
- TextCell: ((props: TextCellProps) => TextCell(props, styleNames)) as ADCreatorFn,
32
- TextParagraph: ((props: TextParagraphProps) => TextParagraph(props, styleNames)) as ADCreatorFn,
33
- TextRun: (props) => TextRun.create(props as unknown as TextRun.TextRunProps),
43
+ TextRow: (props) => TextRow({ ...props, text: requireText(props) }, styleNames),
44
+ TextCell: (props) => TextCell({ ...props, text: requireText(props) }, styleNames),
45
+ TextParagraph: (props) => TextParagraph({ ...props, text: requireText(props) }, styleNames),
46
+ HyperLinkRow: (props) => HyperLinkRow({ ...props, text: requireText(props), target: requireTarget(props, "HyperLinkRow") }, styleNames),
47
+ HyperLinkParagraph: (props) =>
48
+ HyperLinkParagraph({ ...props, text: requireText(props), target: requireTarget(props, "HyperLinkParagraph") }, styleNames),
49
+ HyperLinkCell: (props) => HyperLinkCell({ ...props, text: requireText(props), target: requireTarget(props, "HyperLinkCell") }, styleNames),
50
+ TextRun: (props) => TextRun.create({ ...props, text: requireText(props) }),
51
+ HyperLink: (props) => HyperLink.create({ ...props, text: requireText(props), target: requireTarget(props, "HyperLink") }),
52
+ LinkTarget: (props) => LinkTarget.create({ name: requireName(props) }),
53
+ LineBreak: (props) => LineBreak.create(props),
34
54
  ImageRow: ((props: Record<string, unknown>) => ImageRow(imageProps(props) as unknown as ImageRowProps, styleNames)) as ADCreatorFn,
35
55
  ImageCell: ((props: Record<string, unknown>) => ImageCell(imageProps(props) as unknown as ImageCellProps, styleNames)) as ADCreatorFn,
36
56
  ImageParagraph: ((props: Record<string, unknown>) =>
37
57
  ImageParagraph(imageProps(props) as unknown as ImageParagraphProps, styleNames)) as ADCreatorFn,
38
58
  Image: ((props: Record<string, unknown>) => Image.create(imageProps(props) as unknown as Image.ImageProps)) as ADCreatorFn,
39
- Table: ((props, children: ReadonlyArray<TableRow.TableRow>) => Table.create(props as unknown as Table.TableProps, children)) as ADCreatorFn,
59
+ Table: ((props, children: ReadonlyArray<TableRow.TableRow>) =>
60
+ Table.create({ ...props, columnWidths: props?.["columnWidths"] ?? [] } as unknown as Table.TableProps, children)) as ADCreatorFn,
40
61
  TableRow: ((props, children: ReadonlyArray<TableCell.TableCell>) => TableRow.create(props, children)) as ADCreatorFn,
41
62
  TableCell: ((props, children: ReadonlyArray<SectionElement.SectionElement>) => TableCell.create(props, children)) as ADCreatorFn,
42
- TextField: (props) => TextField.create(props as unknown as TextField.TextFieldProps),
43
- Group: (props, children) => Group.create(props, children as ReadonlyArray<Group.Group>),
63
+ TextField: (props) => TextField.create({ ...props, fieldType: requireFieldType(props) }),
64
+ Group: (props, children) => Group.create(props, children as ReadonlyArray<SectionElement.SectionElement>),
44
65
  PageBreak: () => PageBreak.create(),
45
- Markdown: (props) => Markdown.create(props as unknown as Markdown.MarkdownProps),
66
+ Markdown: (props) => Markdown.create({ ...props, text: requireText(props) }),
46
67
  TocSeparator: (props) => TocSeparator.create(props as TocSeparator.TocSeparatorProps),
47
68
  };
48
69
  };
@@ -340,6 +361,37 @@ export const propsCreators: Record<string, ADCreatorFn> = {
340
361
  differentFirstPage: ((props: { readonly differentFirstPage: string }): unknown => strToBool(props.differentFirstPage)) as ADCreatorFn,
341
362
  };
342
363
 
364
+ function requireText(props: Record<string, unknown> | undefined): string {
365
+ const text = props?.["text"];
366
+ return typeof text === "string" ? text : "";
367
+ }
368
+
369
+ function requireTarget(props: Record<string, unknown> | undefined, element: string): string {
370
+ const target = props?.["target"];
371
+ if (typeof target !== "string") {
372
+ throw new Error(`<${element}> requires a "target" attribute`);
373
+ }
374
+ return target;
375
+ }
376
+
377
+ function requireName(props: Record<string, unknown> | undefined): string {
378
+ const name = props?.["name"];
379
+ if (typeof name !== "string") {
380
+ throw new Error('<LinkTarget> requires a "name" attribute');
381
+ }
382
+ return name;
383
+ }
384
+
385
+ const validFieldTypes: ReadonlyArray<TextField.FieldType> = ["Date", "PageNumber", "TotalPages", "PageNumberOf"];
386
+
387
+ function requireFieldType(props: Record<string, unknown> | undefined): TextField.FieldType {
388
+ const fieldType = props?.["fieldType"];
389
+ if (validFieldTypes.includes(fieldType as TextField.FieldType)) {
390
+ return fieldType as TextField.FieldType;
391
+ }
392
+ throw new Error(`<TextField> requires a "fieldType" attribute of ${validFieldTypes.join(", ")}, got: ${String(fieldType)}`);
393
+ }
394
+
343
395
  const zero = createPoint(0, 0);
344
396
  const size = createSize(0, 0);
345
397
  function imageProps(props: Record<string, unknown>): Record<string, unknown> {
@@ -1,6 +1,6 @@
1
1
  import type { ImageProps } from "../../abstract-document/atoms/image.js";
2
2
  import type { TextStyle, ParagraphStyle, TableCellStyle } from "../../abstract-document/index.js";
3
- import { TextRun, Paragraph, TableCell, TableRow, Image } from "../../abstract-document/index.js";
3
+ import { TextRun, Paragraph, TableCell, TableRow, Image, HyperLink } from "../../abstract-document/index.js";
4
4
  import type { ParagraphProps } from "../../abstract-document/section-elements/paragraph.js";
5
5
  //dummy2
6
6
 
@@ -87,6 +87,47 @@ export function TextParagraph(props: TextParagraphProps, styleNameTypes: Record<
87
87
  return Paragraph.create({ style, styleName: styleNames.ParagraphStyle }, [textRun]);
88
88
  }
89
89
 
90
+ export type HyperLinkParagraphProps = TextParagraphProps & {
91
+ readonly target: string;
92
+ };
93
+
94
+ export function HyperLinkParagraph(props: HyperLinkParagraphProps, styleNameTypes: Record<string, string>): Paragraph.Paragraph {
95
+ const { text, target, textStyle, style } = props;
96
+ const styleNames = extractStyleNames(props.styleNames, styleNameTypes);
97
+ const hyperLink = HyperLink.create({
98
+ text,
99
+ target,
100
+ style: textStyle ? { ...textStyle, type: "TextStyle" } : undefined,
101
+ styleName: styleNames.TextStyle,
102
+ });
103
+ return Paragraph.create({ style, styleName: styleNames.ParagraphStyle }, [hyperLink]);
104
+ }
105
+
106
+ export type HyperLinkCellProps = Omit<HyperLinkParagraphProps, "style"> & {
107
+ readonly columnSpan?: number;
108
+ readonly rowSpan?: number;
109
+ readonly style?: TableCellStyle.TableCellStyle;
110
+ readonly paragraphStyle?: ParagraphStyle.ParagraphStyle;
111
+ };
112
+
113
+ export function HyperLinkCell(props: HyperLinkCellProps, styleNameTypes: Record<string, string>): TableCell.TableCell {
114
+ const { paragraphStyle, style, columnSpan, rowSpan } = props;
115
+ const styleNames = extractStyleNames(props.styleNames, styleNameTypes);
116
+ const paragraph = HyperLinkParagraph(
117
+ { ...props, style: paragraphStyle ? { ...paragraphStyle, type: "ParagraphStyle" } : undefined },
118
+ styleNameTypes
119
+ );
120
+ return TableCell.create({ columnSpan, rowSpan, style, styleName: styleNames.TableCellStyle }, [paragraph]);
121
+ }
122
+
123
+ export type HyperLinkRowProps = Omit<HyperLinkCellProps, "style"> & {
124
+ readonly cellStyle?: TableCellStyle.TableCellStyle;
125
+ };
126
+
127
+ export function HyperLinkRow(props: HyperLinkRowProps, styleNameTypes: Record<string, string>): TableRow.TableRow {
128
+ return TableRow.create({}, [HyperLinkCell({ ...props, style: props.cellStyle }, styleNameTypes)]);
129
+ }
130
+
90
131
  export type ImageRowProps = Omit<ImageCellProps, "style"> & {
91
132
  readonly cellStyle?: TableCellStyle.TableCellStyle;
92
133
  };
@@ -68,6 +68,64 @@ export const textParagraph = `<xs:complexType name="TextParagraph">
68
68
  </xs:complexType>`;
69
69
  export const textParagraphElement = `<xs:element name="TextParagraph" type="TextParagraph" maxOccurs="unbounded" />`;
70
70
 
71
+ export const hyperLinkParagraph = `<xs:complexType name="HyperLinkParagraph">
72
+ <xs:annotation>
73
+ <xs:documentation>Shortcut to create \\<Paragraph> \\<HyperLink text="..." target="..." /> \\</Paragraph></xs:documentation>
74
+ </xs:annotation>
75
+ <xs:choice minOccurs="0" maxOccurs="1">
76
+ <xs:element name="style" type="ParagraphStyle" />
77
+ </xs:choice>
78
+ <xs:choice minOccurs="0" maxOccurs="1">
79
+ <xs:element name="textStyle" type="TextStyle" />
80
+ </xs:choice>
81
+ <xs:attribute name="styleNames" type="xs:string" />
82
+ <xs:attribute name="target" type="xs:string" use="required" />
83
+ <xs:attribute name="text" type="xs:string" use="required" />
84
+ </xs:complexType>`;
85
+ export const hyperLinkParagraphElement = `<xs:element name="HyperLinkParagraph" type="HyperLinkParagraph" maxOccurs="unbounded" />`;
86
+
87
+ export const hyperLinkCell = `<xs:complexType name="HyperLinkCell">
88
+ <xs:annotation>
89
+ <xs:documentation>Shortcut to create a \\<TableCell> \\<Paragraph> \\<HyperLink text="..." target="..." /> \\</Paragraph> \\</TableCell></xs:documentation>
90
+ </xs:annotation>
91
+ <xs:choice minOccurs="0" maxOccurs="1">
92
+ <xs:element name="style" type="TableCellStyle" />
93
+ </xs:choice>
94
+ <xs:choice minOccurs="0" maxOccurs="1">
95
+ <xs:element name="paragraphStyle" type="ParagraphStyle" />
96
+ </xs:choice>
97
+ <xs:choice minOccurs="0" maxOccurs="1">
98
+ <xs:element name="textStyle" type="TextStyle" />
99
+ </xs:choice>
100
+ <xs:attribute name="styleNames" type="xs:string" />
101
+ <xs:attribute name="target" type="xs:string" use="required" />
102
+ <xs:attribute name="columnSpan" type="xs:integer" />
103
+ <xs:attribute name="rowSpan" type="xs:integer" />
104
+ <xs:attribute name="text" type="xs:string" use="required" />
105
+ </xs:complexType>`;
106
+ export const hyperLinkCellElement = `<xs:element name="HyperLinkCell" type="HyperLinkCell" minOccurs="0" maxOccurs="unbounded" />`;
107
+
108
+ export const hyperLinkRow = `<xs:complexType name="HyperLinkRow">
109
+ <xs:annotation>
110
+ <xs:documentation>Shortcut to create a \\<TableRow> \\<TableCell> \\<Paragraph> \\<HyperLink text="..." target="..." /> \\</Paragraph> \\</TableCell> \\</TableRow></xs:documentation>
111
+ </xs:annotation>
112
+ <xs:choice minOccurs="0" maxOccurs="1">
113
+ <xs:element name="cellStyle" type="TableCellStyle" />
114
+ </xs:choice>
115
+ <xs:choice minOccurs="0" maxOccurs="1">
116
+ <xs:element name="paragraphStyle" type="ParagraphStyle" />
117
+ </xs:choice>
118
+ <xs:choice minOccurs="0" maxOccurs="1">
119
+ <xs:element name="textStyle" type="TextStyle" />
120
+ </xs:choice>
121
+ <xs:attribute name="styleNames" type="xs:string" />
122
+ <xs:attribute name="target" type="xs:string" use="required" />
123
+ <xs:attribute name="columnSpan" type="xs:integer" />
124
+ <xs:attribute name="rowSpan" type="xs:integer" />
125
+ <xs:attribute name="text" type="xs:string" use="required" />
126
+ </xs:complexType>`;
127
+ export const hyperLinkRowElement = `<xs:element name="HyperLinkRow" type="HyperLinkRow" maxOccurs="unbounded" />`;
128
+
71
129
  export const imageRow = `<xs:complexType name="ImageRow">
72
130
  <xs:annotation>
73
131
  <xs:documentation>Shortcut to create a \\<TableRow> \\<TableCell> \\<Paragraph> \\<Image src text="..." /> \\</Paragraph> \\</TableCell> \\</TableRow></xs:documentation>
@@ -16,6 +16,7 @@ export const section = `<xs:complexType name="Section">
16
16
  <xs:element name="PageBreak" type="PageBreak" minOccurs="0" />
17
17
  <xs:element name="Paragraph" type="Paragraph" minOccurs="0" />
18
18
  ${Custom.textParagraphElement}
19
+ ${Custom.hyperLinkParagraphElement}
19
20
  ${Custom.imageParagraphElement}
20
21
  <xs:element name="Markdown" type="Markdown" minOccurs="0" />
21
22
  <xs:element name="page" type="page" minOccurs="0" maxOccurs="1"></xs:element>
@@ -38,6 +39,7 @@ const sectionElementBody = `<xs:element name="Table" type="Table" minOccurs="0"
38
39
  <xs:element name="PageBreak" type="PageBreak" minOccurs="0" />
39
40
  <xs:element name="Paragraph" type="Paragraph" minOccurs="0" />
40
41
  ${Custom.textParagraphElement}
42
+ ${Custom.hyperLinkParagraphElement}
41
43
  ${Custom.imageParagraphElement}
42
44
  <xs:element name="Markdown" type="Markdown" minOccurs="0" />`;
43
45
 
@@ -61,6 +63,7 @@ export const group = `<xs:complexType name="Group">
61
63
  <xs:element name="PageBreak" type="PageBreak" minOccurs="0" />
62
64
  <xs:element name="Paragraph" type="Paragraph" minOccurs="0" />
63
65
  ${Custom.textParagraphElement}
66
+ ${Custom.hyperLinkParagraphElement}
64
67
  ${Custom.imageParagraphElement}
65
68
  <xs:element name="style" type="GroupStyle" minOccurs="0" />
66
69
  </xs:choice>
@@ -75,6 +78,7 @@ export const table = `<xs:complexType name="Table">
75
78
  <xs:choice minOccurs="1">
76
79
  <xs:element name="TableRow" type="TableRow" maxOccurs="unbounded" />
77
80
  ${Custom.textRowElement}
81
+ ${Custom.hyperLinkRowElement}
78
82
  ${Custom.imageRowElement}
79
83
  </xs:choice>
80
84
  </xs:sequence>
@@ -96,6 +100,7 @@ export const headerRows = `<xs:complexType name="headerRows">
96
100
  <xs:choice minOccurs="1" maxOccurs="unbounded">
97
101
  <xs:element name="TableRow" type="TableRow"/>
98
102
  ${Custom.textRowElement}
103
+ ${Custom.hyperLinkRowElement}
99
104
  ${Custom.imageRowElement}
100
105
  </xs:choice>
101
106
  </xs:sequence>
@@ -105,6 +110,7 @@ export const tableRow = `<xs:complexType name="TableRow">
105
110
  <xs:choice maxOccurs="unbounded">
106
111
  <xs:element name="TableCell" type="TableCell" minOccurs="0" maxOccurs="unbounded" />
107
112
  ${Custom.textCellElement}
113
+ ${Custom.hyperLinkCellElement}
108
114
  ${Custom.imageCellElement}
109
115
  </xs:choice>
110
116
  </xs:complexType>`;
@@ -117,6 +123,7 @@ export const tableCell = `<xs:complexType name="TableCell">
117
123
  <xs:element name="PageBreak" type="PageBreak" minOccurs="0" maxOccurs="unbounded" />
118
124
  <xs:element name="Paragraph" type="Paragraph" minOccurs="0" maxOccurs="unbounded" />
119
125
  ${Custom.textParagraphElement}
126
+ ${Custom.hyperLinkParagraphElement}
120
127
  ${Custom.imageParagraphElement}
121
128
  <xs:element name="Markdown" type="Markdown" minOccurs="0" maxOccurs="unbounded" />
122
129
  </xs:choice>
@@ -141,7 +148,8 @@ export const paragraph = `<xs:complexType name="Paragraph">
141
148
  <xs:element name="Image" type="Image" minOccurs="0" maxOccurs="unbounded"></xs:element>
142
149
  <xs:element name="HyperLink" type="HyperLink" minOccurs="0" maxOccurs="unbounded"></xs:element>
143
150
  <xs:element name="LinkTarget" type="LinkTarget" minOccurs="0" maxOccurs="unbounded"></xs:element>
144
- <xs:element name="TocSeperator" type="TocSeperator" minOccurs="0" maxOccurs="unbounded"></xs:element>
151
+ <xs:element name="LineBreak" type="LineBreak" minOccurs="0" maxOccurs="unbounded"></xs:element>
152
+ <xs:element name="TocSeparator" type="TocSeparator" minOccurs="0" maxOccurs="unbounded"></xs:element>
145
153
  <xs:element name="style" type="ParagraphStyle" minOccurs="0" maxOccurs="1"></xs:element>
146
154
  </xs:choice>
147
155
  <xs:attribute name="styleName" type="xs:string" >
@@ -160,16 +168,23 @@ export const hyperLink = `<xs:complexType name="HyperLink">
160
168
  <xs:documentation>Refrence to a TextStyle that is defined in \\<AbstractDoc> \\<StyleNames> \\<StyleName name="..." /> \\</StyleNames> \\</AbstractDoc></xs:documentation>
161
169
  </xs:annotation>
162
170
  </xs:attribute>
163
- <xs:attribute name="target" type="xs:string" />
171
+ <xs:attribute name="target" type="xs:string" use="required" />
164
172
  <xs:attribute name="text" type="xs:string" />
165
173
  </xs:complexType>`;
166
174
 
167
- export const tocSeparator = `<xs:complexType name="TocSeperator">
175
+ export const tocSeparator = `<xs:complexType name="TocSeparator">
168
176
  <xs:attribute name="width" type="xs:decimal" />
169
177
  </xs:complexType>`;
170
178
 
171
179
  export const linkTarget = `<xs:complexType name="LinkTarget">
172
- <xs:attribute name="name" type="xs:string" />
180
+ <xs:attribute name="name" type="xs:string" use="required" />
181
+ </xs:complexType>`;
182
+
183
+ export const lineBreak = `<xs:complexType name="LineBreak">
184
+ <xs:choice minOccurs="0" maxOccurs="1">
185
+ <xs:element name="style" type="TextStyle" />
186
+ </xs:choice>
187
+ <xs:attribute name="styleName" type="xs:string" />
173
188
  </xs:complexType>`;
174
189
 
175
190
  export const textRun = `<xs:complexType name="TextRun">
@@ -14,6 +14,7 @@ ${Elements.image}
14
14
  ${Elements.textField}
15
15
  ${Elements.textRun}
16
16
  ${Elements.hyperLink}
17
+ ${Elements.lineBreak}
17
18
  ${Elements.tocSeparator}
18
19
  ${Elements.linkTarget}
19
20
  ${Styles.position}
@@ -33,6 +34,9 @@ ${Elements.tableCell}
33
34
  ${CustomElements.textRow}
34
35
  ${CustomElements.textCell}
35
36
  ${CustomElements.textParagraph}
37
+ ${CustomElements.hyperLinkParagraph}
38
+ ${CustomElements.hyperLinkCell}
39
+ ${CustomElements.hyperLinkRow}
36
40
  ${CustomElements.imageRow}
37
41
  ${CustomElements.imageCell}
38
42
  ${CustomElements.imageParagraph}`;
@@ -1 +1,10 @@
1
- declare module "pdf2json";
1
+ declare module "pdf2json" {
2
+ // oxlint-disable-next-line no-redeclare -- value + type share a name, the standard pattern for typing a constructible class from an untyped module
3
+ interface PDFParser {
4
+ on: ((event: "pdfParser_dataError", callback: (data: { parserError: string }) => void) => void) &
5
+ ((event: "pdfParser_dataReady", callback: (data: unknown) => void) => void);
6
+ parseBuffer: (buffer: Buffer) => void;
7
+ }
8
+ const PDFParser: new () => PDFParser;
9
+ export default PDFParser;
10
+ }
@@ -1 +1,4 @@
1
- declare module "remark-parse";
1
+ declare module "remark-parse" {
2
+ const remarkParse: unknown;
3
+ export default remarkParse;
4
+ }
@@ -1 +1,4 @@
1
- declare module "remark-sub-super";
1
+ declare module "remark-sub-super" {
2
+ const remarkSubSuper: unknown;
3
+ export default remarkSubSuper;
4
+ }
@@ -1 +1,4 @@
1
- declare module "svg-to-pdfkit";
1
+ declare module "svg-to-pdfkit" {
2
+ function svgToPdfKit(doc: PDFKit.PDFDocument, svg: string, x: number, y: number, options?: Record<string, unknown>): void;
3
+ export default svgToPdfKit;
4
+ }
@@ -1 +1,8 @@
1
- declare module "unified";
1
+ declare module "unified" {
2
+ interface Processor {
3
+ use: (plugin: unknown, ...settings: Array<unknown>) => Processor;
4
+ parse: (source: string) => unknown;
5
+ }
6
+ function unified(): Processor;
7
+ export default unified;
8
+ }