ts-d2 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.mts +37 -13
- package/dist/index.d.ts +37 -13
- package/dist/index.js +93 -17
- package/dist/index.mjs +157 -81
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,6 +44,7 @@ The following leaf elements are currently supported:
|
|
|
44
44
|
* Footer
|
|
45
45
|
* Formatted (may be used to directly insert docTYPE code and/or HTML code)
|
|
46
46
|
* Header
|
|
47
|
+
* Linebreak
|
|
47
48
|
* Pagebreak
|
|
48
49
|
* PageDefinition (only useful for page-based formats)
|
|
49
50
|
* Paragraph
|
|
@@ -84,7 +85,6 @@ The following branch elements are supported:
|
|
|
84
85
|
* Directory
|
|
85
86
|
* Document
|
|
86
87
|
* Footer
|
|
87
|
-
* Formatted
|
|
88
88
|
* Header
|
|
89
89
|
* Paragraph
|
|
90
90
|
* Span
|
package/dist/index.d.mts
CHANGED
|
@@ -124,6 +124,17 @@ declare class Table extends BranchDocumentElement<TableSettings> {
|
|
|
124
124
|
toDocFrame(): Proto.Node;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
interface SpanProperties {
|
|
128
|
+
bold?: boolean;
|
|
129
|
+
italic?: boolean;
|
|
130
|
+
underline?: boolean;
|
|
131
|
+
strikethrough?: boolean;
|
|
132
|
+
}
|
|
133
|
+
declare class Span extends BranchDocumentElement<SpanProperties> {
|
|
134
|
+
constructor(content?: Content, props?: SpanProperties);
|
|
135
|
+
toDocFrame(): Proto.Node;
|
|
136
|
+
}
|
|
137
|
+
|
|
127
138
|
declare class SpaceVertically extends DocumentElement {
|
|
128
139
|
space: AbsoluteMeasure;
|
|
129
140
|
constructor(space: AbsoluteMeasure);
|
|
@@ -167,10 +178,6 @@ declare class Paragraph extends BranchDocumentElement<ParagraphSettings> {
|
|
|
167
178
|
toDocFrame(): Proto.Node;
|
|
168
179
|
}
|
|
169
180
|
|
|
170
|
-
declare class Pagebreak extends DocumentElement {
|
|
171
|
-
toDocFrame(): Proto.Node;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
181
|
declare class PageDefinition {
|
|
175
182
|
width?: AbsoluteMeasure;
|
|
176
183
|
height?: AbsoluteMeasure;
|
|
@@ -179,6 +186,18 @@ declare class PageDefinition {
|
|
|
179
186
|
toDocFrame(): Proto.ProtoPDef;
|
|
180
187
|
}
|
|
181
188
|
|
|
189
|
+
declare class Pagebreak extends DocumentElement {
|
|
190
|
+
toDocFrame(): Proto.Node;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare class Linebreak extends DocumentElement {
|
|
194
|
+
toDocFrame(): Proto.Node;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
declare class Header extends BranchDocumentElement<never> {
|
|
198
|
+
toDocFrame(): Proto.Node;
|
|
199
|
+
}
|
|
200
|
+
|
|
182
201
|
declare class Formatted extends DocumentElement {
|
|
183
202
|
constructor(doctypeContent: string | undefined, htmlContent?: string);
|
|
184
203
|
content: {
|
|
@@ -188,6 +207,10 @@ declare class Formatted extends DocumentElement {
|
|
|
188
207
|
toDocFrame(): Proto.Node;
|
|
189
208
|
}
|
|
190
209
|
|
|
210
|
+
declare class Footer extends BranchDocumentElement {
|
|
211
|
+
toDocFrame(): Proto.Node;
|
|
212
|
+
}
|
|
213
|
+
|
|
191
214
|
declare enum OutputFormat {
|
|
192
215
|
PDF = "pdf",
|
|
193
216
|
PNG = "png",
|
|
@@ -253,14 +276,6 @@ declare class ColumnDefinition {
|
|
|
253
276
|
toDocFrame(applyImmediate: boolean): Proto.Node[];
|
|
254
277
|
}
|
|
255
278
|
|
|
256
|
-
declare class Footer extends BranchDocumentElement {
|
|
257
|
-
toDocFrame(): Proto.Node;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
declare class Header extends BranchDocumentElement<never> {
|
|
261
|
-
toDocFrame(): Proto.Node;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
279
|
interface DocumentProperties {
|
|
265
280
|
pageDefinition: PageDefinition;
|
|
266
281
|
columnDefinition: ColumnDefinition;
|
|
@@ -278,6 +293,10 @@ declare class Document extends BranchDocumentElement<DocumentProperties> {
|
|
|
278
293
|
toDocFrame(): Proto.Node;
|
|
279
294
|
}
|
|
280
295
|
|
|
296
|
+
declare class Directory extends BranchDocumentElement {
|
|
297
|
+
toDocFrame(): Proto.Node;
|
|
298
|
+
}
|
|
299
|
+
|
|
281
300
|
/**
|
|
282
301
|
* A ReferencePoint is used for elements like barcodes to specify the reference point
|
|
283
302
|
* of an object.
|
|
@@ -329,12 +348,17 @@ declare const _default: {
|
|
|
329
348
|
Barcode: typeof Barcode;
|
|
330
349
|
ColumnDefinition: typeof ColumnDefinition;
|
|
331
350
|
ColumnPosition: typeof ColumnPosition;
|
|
351
|
+
Directory: typeof Directory;
|
|
332
352
|
Document: typeof Document;
|
|
353
|
+
Footer: typeof Footer;
|
|
333
354
|
Formatted: typeof Formatted;
|
|
334
|
-
|
|
355
|
+
Header: typeof Header;
|
|
356
|
+
Linebreak: typeof Linebreak;
|
|
335
357
|
Pagebreak: typeof Pagebreak;
|
|
358
|
+
PageDefinition: typeof PageDefinition;
|
|
336
359
|
Paragraph: typeof Paragraph;
|
|
337
360
|
SpaceVertically: typeof SpaceVertically;
|
|
361
|
+
Span: typeof Span;
|
|
338
362
|
Table: typeof Table;
|
|
339
363
|
TableCell: typeof TableCell;
|
|
340
364
|
TableRow: typeof TableRow;
|
package/dist/index.d.ts
CHANGED
|
@@ -124,6 +124,17 @@ declare class Table extends BranchDocumentElement<TableSettings> {
|
|
|
124
124
|
toDocFrame(): Proto.Node;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
interface SpanProperties {
|
|
128
|
+
bold?: boolean;
|
|
129
|
+
italic?: boolean;
|
|
130
|
+
underline?: boolean;
|
|
131
|
+
strikethrough?: boolean;
|
|
132
|
+
}
|
|
133
|
+
declare class Span extends BranchDocumentElement<SpanProperties> {
|
|
134
|
+
constructor(content?: Content, props?: SpanProperties);
|
|
135
|
+
toDocFrame(): Proto.Node;
|
|
136
|
+
}
|
|
137
|
+
|
|
127
138
|
declare class SpaceVertically extends DocumentElement {
|
|
128
139
|
space: AbsoluteMeasure;
|
|
129
140
|
constructor(space: AbsoluteMeasure);
|
|
@@ -167,10 +178,6 @@ declare class Paragraph extends BranchDocumentElement<ParagraphSettings> {
|
|
|
167
178
|
toDocFrame(): Proto.Node;
|
|
168
179
|
}
|
|
169
180
|
|
|
170
|
-
declare class Pagebreak extends DocumentElement {
|
|
171
|
-
toDocFrame(): Proto.Node;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
181
|
declare class PageDefinition {
|
|
175
182
|
width?: AbsoluteMeasure;
|
|
176
183
|
height?: AbsoluteMeasure;
|
|
@@ -179,6 +186,18 @@ declare class PageDefinition {
|
|
|
179
186
|
toDocFrame(): Proto.ProtoPDef;
|
|
180
187
|
}
|
|
181
188
|
|
|
189
|
+
declare class Pagebreak extends DocumentElement {
|
|
190
|
+
toDocFrame(): Proto.Node;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare class Linebreak extends DocumentElement {
|
|
194
|
+
toDocFrame(): Proto.Node;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
declare class Header extends BranchDocumentElement<never> {
|
|
198
|
+
toDocFrame(): Proto.Node;
|
|
199
|
+
}
|
|
200
|
+
|
|
182
201
|
declare class Formatted extends DocumentElement {
|
|
183
202
|
constructor(doctypeContent: string | undefined, htmlContent?: string);
|
|
184
203
|
content: {
|
|
@@ -188,6 +207,10 @@ declare class Formatted extends DocumentElement {
|
|
|
188
207
|
toDocFrame(): Proto.Node;
|
|
189
208
|
}
|
|
190
209
|
|
|
210
|
+
declare class Footer extends BranchDocumentElement {
|
|
211
|
+
toDocFrame(): Proto.Node;
|
|
212
|
+
}
|
|
213
|
+
|
|
191
214
|
declare enum OutputFormat {
|
|
192
215
|
PDF = "pdf",
|
|
193
216
|
PNG = "png",
|
|
@@ -253,14 +276,6 @@ declare class ColumnDefinition {
|
|
|
253
276
|
toDocFrame(applyImmediate: boolean): Proto.Node[];
|
|
254
277
|
}
|
|
255
278
|
|
|
256
|
-
declare class Footer extends BranchDocumentElement {
|
|
257
|
-
toDocFrame(): Proto.Node;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
declare class Header extends BranchDocumentElement<never> {
|
|
261
|
-
toDocFrame(): Proto.Node;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
279
|
interface DocumentProperties {
|
|
265
280
|
pageDefinition: PageDefinition;
|
|
266
281
|
columnDefinition: ColumnDefinition;
|
|
@@ -278,6 +293,10 @@ declare class Document extends BranchDocumentElement<DocumentProperties> {
|
|
|
278
293
|
toDocFrame(): Proto.Node;
|
|
279
294
|
}
|
|
280
295
|
|
|
296
|
+
declare class Directory extends BranchDocumentElement {
|
|
297
|
+
toDocFrame(): Proto.Node;
|
|
298
|
+
}
|
|
299
|
+
|
|
281
300
|
/**
|
|
282
301
|
* A ReferencePoint is used for elements like barcodes to specify the reference point
|
|
283
302
|
* of an object.
|
|
@@ -329,12 +348,17 @@ declare const _default: {
|
|
|
329
348
|
Barcode: typeof Barcode;
|
|
330
349
|
ColumnDefinition: typeof ColumnDefinition;
|
|
331
350
|
ColumnPosition: typeof ColumnPosition;
|
|
351
|
+
Directory: typeof Directory;
|
|
332
352
|
Document: typeof Document;
|
|
353
|
+
Footer: typeof Footer;
|
|
333
354
|
Formatted: typeof Formatted;
|
|
334
|
-
|
|
355
|
+
Header: typeof Header;
|
|
356
|
+
Linebreak: typeof Linebreak;
|
|
335
357
|
Pagebreak: typeof Pagebreak;
|
|
358
|
+
PageDefinition: typeof PageDefinition;
|
|
336
359
|
Paragraph: typeof Paragraph;
|
|
337
360
|
SpaceVertically: typeof SpaceVertically;
|
|
361
|
+
Span: typeof Span;
|
|
338
362
|
Table: typeof Table;
|
|
339
363
|
TableCell: typeof TableCell;
|
|
340
364
|
TableRow: typeof TableRow;
|
package/dist/index.js
CHANGED
|
@@ -357,24 +357,9 @@ var ColumnDefinitions = {
|
|
|
357
357
|
}
|
|
358
358
|
};
|
|
359
359
|
|
|
360
|
-
// src/Content/
|
|
360
|
+
// src/Content/Directory/index.ts
|
|
361
361
|
|
|
362
362
|
|
|
363
|
-
// src/OutputFormat/index.ts
|
|
364
|
-
var OutputFormat_exports = {};
|
|
365
|
-
__export(OutputFormat_exports, {
|
|
366
|
-
OutputFormat: () => OutputFormat
|
|
367
|
-
});
|
|
368
|
-
var OutputFormat = /* @__PURE__ */ ((OutputFormat2) => {
|
|
369
|
-
OutputFormat2["PDF"] = "pdf";
|
|
370
|
-
OutputFormat2["PNG"] = "png";
|
|
371
|
-
OutputFormat2["JPEG"] = "jpeg";
|
|
372
|
-
OutputFormat2["HTML"] = "html";
|
|
373
|
-
OutputFormat2["PS"] = "ps";
|
|
374
|
-
OutputFormat2["TEXT"] = "text";
|
|
375
|
-
return OutputFormat2;
|
|
376
|
-
})(OutputFormat || {});
|
|
377
|
-
|
|
378
363
|
// src/Content/Text/index.ts
|
|
379
364
|
|
|
380
365
|
var Text = class extends DocumentElement {
|
|
@@ -435,6 +420,34 @@ function documentElementsFromContent(content) {
|
|
|
435
420
|
}
|
|
436
421
|
}
|
|
437
422
|
|
|
423
|
+
// src/Content/Directory/index.ts
|
|
424
|
+
var Directory = class extends BranchDocumentElement {
|
|
425
|
+
toDocFrame() {
|
|
426
|
+
return _docframetypes2.default.Node.create({
|
|
427
|
+
directory: _docframetypes2.default.ProtoDirectory.create({}),
|
|
428
|
+
children: this.childrenToDocFrame()
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
// src/Content/Document/index.ts
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
// src/OutputFormat/index.ts
|
|
437
|
+
var OutputFormat_exports = {};
|
|
438
|
+
__export(OutputFormat_exports, {
|
|
439
|
+
OutputFormat: () => OutputFormat
|
|
440
|
+
});
|
|
441
|
+
var OutputFormat = /* @__PURE__ */ ((OutputFormat2) => {
|
|
442
|
+
OutputFormat2["PDF"] = "pdf";
|
|
443
|
+
OutputFormat2["PNG"] = "png";
|
|
444
|
+
OutputFormat2["JPEG"] = "jpeg";
|
|
445
|
+
OutputFormat2["HTML"] = "html";
|
|
446
|
+
OutputFormat2["PS"] = "ps";
|
|
447
|
+
OutputFormat2["TEXT"] = "text";
|
|
448
|
+
return OutputFormat2;
|
|
449
|
+
})(OutputFormat || {});
|
|
450
|
+
|
|
438
451
|
// src/Content/Footer/index.ts
|
|
439
452
|
|
|
440
453
|
var Footer = class extends BranchDocumentElement {
|
|
@@ -742,6 +755,16 @@ var Formatted = class extends DocumentElement {
|
|
|
742
755
|
}
|
|
743
756
|
};
|
|
744
757
|
|
|
758
|
+
// src/Content/Linebreak/index.ts
|
|
759
|
+
|
|
760
|
+
var Linebreak = class extends DocumentElement {
|
|
761
|
+
toDocFrame() {
|
|
762
|
+
return _docframetypes2.default.Node.create({
|
|
763
|
+
linebreak: _docframetypes2.default.ProtoLinebreak.create({})
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
|
|
745
768
|
// src/Content/Pagebreak/index.ts
|
|
746
769
|
|
|
747
770
|
var Pagebreak = class extends DocumentElement {
|
|
@@ -782,6 +805,54 @@ var Paragraph = class extends BranchDocumentElement {
|
|
|
782
805
|
}
|
|
783
806
|
};
|
|
784
807
|
|
|
808
|
+
// src/Content/Span/index.ts
|
|
809
|
+
|
|
810
|
+
var Span = class extends BranchDocumentElement {
|
|
811
|
+
constructor(content, props) {
|
|
812
|
+
super(content, props || {});
|
|
813
|
+
}
|
|
814
|
+
toDocFrame() {
|
|
815
|
+
var _a, _b, _c, _d;
|
|
816
|
+
let bold = void 0;
|
|
817
|
+
if (((_a = this.props) == null ? void 0 : _a.bold) !== void 0) {
|
|
818
|
+
bold = _docframetypes2.default.ProtoBoxedBool.create({
|
|
819
|
+
isNull: false,
|
|
820
|
+
value: this.props.bold
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
let italic = void 0;
|
|
824
|
+
if (((_b = this.props) == null ? void 0 : _b.italic) !== void 0) {
|
|
825
|
+
italic = _docframetypes2.default.ProtoBoxedBool.create({
|
|
826
|
+
isNull: false,
|
|
827
|
+
value: this.props.italic
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
let underline = void 0;
|
|
831
|
+
if (((_c = this.props) == null ? void 0 : _c.underline) !== void 0) {
|
|
832
|
+
underline = _docframetypes2.default.ProtoBoxedBool.create({
|
|
833
|
+
isNull: false,
|
|
834
|
+
value: this.props.underline
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
let strikethrough = void 0;
|
|
838
|
+
if (((_d = this.props) == null ? void 0 : _d.strikethrough) !== void 0) {
|
|
839
|
+
strikethrough = _docframetypes2.default.ProtoBoxedBool.create({
|
|
840
|
+
isNull: false,
|
|
841
|
+
value: this.props.strikethrough
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
return _docframetypes2.default.Node.create({
|
|
845
|
+
span: _docframetypes2.default.ProtoSpan.create({
|
|
846
|
+
bold,
|
|
847
|
+
italic,
|
|
848
|
+
underline,
|
|
849
|
+
strikethrough
|
|
850
|
+
}),
|
|
851
|
+
children: this.childrenToDocFrame()
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
|
|
785
856
|
// src/Content/Table/index.ts
|
|
786
857
|
|
|
787
858
|
var Table = class extends BranchDocumentElement {
|
|
@@ -866,12 +937,17 @@ var Content_default = {
|
|
|
866
937
|
Barcode,
|
|
867
938
|
ColumnDefinition,
|
|
868
939
|
ColumnPosition,
|
|
940
|
+
Directory,
|
|
869
941
|
Document,
|
|
942
|
+
Footer,
|
|
870
943
|
Formatted,
|
|
871
|
-
|
|
944
|
+
Header,
|
|
945
|
+
Linebreak,
|
|
872
946
|
Pagebreak,
|
|
947
|
+
PageDefinition,
|
|
873
948
|
Paragraph,
|
|
874
949
|
SpaceVertically,
|
|
950
|
+
Span,
|
|
875
951
|
Table,
|
|
876
952
|
TableCell,
|
|
877
953
|
TableRow,
|
package/dist/index.mjs
CHANGED
|
@@ -357,23 +357,8 @@ var ColumnDefinitions = {
|
|
|
357
357
|
}
|
|
358
358
|
};
|
|
359
359
|
|
|
360
|
-
// src/Content/
|
|
361
|
-
import
|
|
362
|
-
|
|
363
|
-
// src/OutputFormat/index.ts
|
|
364
|
-
var OutputFormat_exports = {};
|
|
365
|
-
__export(OutputFormat_exports, {
|
|
366
|
-
OutputFormat: () => OutputFormat
|
|
367
|
-
});
|
|
368
|
-
var OutputFormat = /* @__PURE__ */ ((OutputFormat2) => {
|
|
369
|
-
OutputFormat2["PDF"] = "pdf";
|
|
370
|
-
OutputFormat2["PNG"] = "png";
|
|
371
|
-
OutputFormat2["JPEG"] = "jpeg";
|
|
372
|
-
OutputFormat2["HTML"] = "html";
|
|
373
|
-
OutputFormat2["PS"] = "ps";
|
|
374
|
-
OutputFormat2["TEXT"] = "text";
|
|
375
|
-
return OutputFormat2;
|
|
376
|
-
})(OutputFormat || {});
|
|
360
|
+
// src/Content/Directory/index.ts
|
|
361
|
+
import Proto9 from "docframe-types";
|
|
377
362
|
|
|
378
363
|
// src/Content/Text/index.ts
|
|
379
364
|
import Proto8 from "docframe-types";
|
|
@@ -435,30 +420,58 @@ function documentElementsFromContent(content) {
|
|
|
435
420
|
}
|
|
436
421
|
}
|
|
437
422
|
|
|
423
|
+
// src/Content/Directory/index.ts
|
|
424
|
+
var Directory = class extends BranchDocumentElement {
|
|
425
|
+
toDocFrame() {
|
|
426
|
+
return Proto9.Node.create({
|
|
427
|
+
directory: Proto9.ProtoDirectory.create({}),
|
|
428
|
+
children: this.childrenToDocFrame()
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
// src/Content/Document/index.ts
|
|
434
|
+
import Proto15 from "docframe-types";
|
|
435
|
+
|
|
436
|
+
// src/OutputFormat/index.ts
|
|
437
|
+
var OutputFormat_exports = {};
|
|
438
|
+
__export(OutputFormat_exports, {
|
|
439
|
+
OutputFormat: () => OutputFormat
|
|
440
|
+
});
|
|
441
|
+
var OutputFormat = /* @__PURE__ */ ((OutputFormat2) => {
|
|
442
|
+
OutputFormat2["PDF"] = "pdf";
|
|
443
|
+
OutputFormat2["PNG"] = "png";
|
|
444
|
+
OutputFormat2["JPEG"] = "jpeg";
|
|
445
|
+
OutputFormat2["HTML"] = "html";
|
|
446
|
+
OutputFormat2["PS"] = "ps";
|
|
447
|
+
OutputFormat2["TEXT"] = "text";
|
|
448
|
+
return OutputFormat2;
|
|
449
|
+
})(OutputFormat || {});
|
|
450
|
+
|
|
438
451
|
// src/Content/Footer/index.ts
|
|
439
|
-
import
|
|
452
|
+
import Proto10 from "docframe-types";
|
|
440
453
|
var Footer = class extends BranchDocumentElement {
|
|
441
454
|
toDocFrame() {
|
|
442
|
-
return
|
|
443
|
-
footer:
|
|
455
|
+
return Proto10.Node.create({
|
|
456
|
+
footer: Proto10.ProtoFooter.create(),
|
|
444
457
|
children: this.childrenToDocFrame()
|
|
445
458
|
});
|
|
446
459
|
}
|
|
447
460
|
};
|
|
448
461
|
|
|
449
462
|
// src/Content/Header/index.ts
|
|
450
|
-
import
|
|
463
|
+
import Proto11 from "docframe-types";
|
|
451
464
|
var Header = class extends BranchDocumentElement {
|
|
452
465
|
toDocFrame() {
|
|
453
|
-
return
|
|
454
|
-
header:
|
|
466
|
+
return Proto11.Node.create({
|
|
467
|
+
header: Proto11.ProtoHeader.create(),
|
|
455
468
|
children: this.childrenToDocFrame()
|
|
456
469
|
});
|
|
457
470
|
}
|
|
458
471
|
};
|
|
459
472
|
|
|
460
473
|
// src/Content/PageDefinition/index.ts
|
|
461
|
-
import
|
|
474
|
+
import Proto12 from "docframe-types";
|
|
462
475
|
import { v4 } from "uuid";
|
|
463
476
|
var PageDefinition = class {
|
|
464
477
|
constructor(width, height) {
|
|
@@ -468,12 +481,12 @@ var PageDefinition = class {
|
|
|
468
481
|
}
|
|
469
482
|
toDocFrame() {
|
|
470
483
|
var _a, _b;
|
|
471
|
-
return new
|
|
472
|
-
pageDepth: new
|
|
484
|
+
return new Proto12.ProtoPDef({
|
|
485
|
+
pageDepth: new Proto12.ProtoBoxedMeasure({
|
|
473
486
|
isNull: this.height === void 0,
|
|
474
487
|
value: (_a = this.height) == null ? void 0 : _a.toDocFrame()
|
|
475
488
|
}),
|
|
476
|
-
pageWidth: new
|
|
489
|
+
pageWidth: new Proto12.ProtoBoxedMeasure({
|
|
477
490
|
isNull: this.width === void 0,
|
|
478
491
|
value: (_b = this.width) == null ? void 0 : _b.toDocFrame()
|
|
479
492
|
}),
|
|
@@ -498,7 +511,7 @@ var PageDefinitions;
|
|
|
498
511
|
})(PageDefinitions || (PageDefinitions = {}));
|
|
499
512
|
|
|
500
513
|
// src/ParagraphFormat/index.ts
|
|
501
|
-
import
|
|
514
|
+
import Proto13 from "docframe-types";
|
|
502
515
|
import { v4 as uuidv42 } from "uuid";
|
|
503
516
|
var ParagraphFormat = class {
|
|
504
517
|
constructor(props) {
|
|
@@ -507,101 +520,101 @@ var ParagraphFormat = class {
|
|
|
507
520
|
}
|
|
508
521
|
toDocFrame() {
|
|
509
522
|
let format = {
|
|
510
|
-
default:
|
|
523
|
+
default: Proto13.ProtoBoxedBool.create({
|
|
511
524
|
isNull: false,
|
|
512
525
|
value: this.props.default || false
|
|
513
526
|
}),
|
|
514
|
-
name:
|
|
527
|
+
name: Proto13.ProtoBoxedString.create({
|
|
515
528
|
isNull: false,
|
|
516
529
|
value: this.props.name
|
|
517
530
|
})
|
|
518
531
|
};
|
|
519
532
|
if (this.props.alignment) {
|
|
520
|
-
format.alignment =
|
|
533
|
+
format.alignment = Proto13.ProtoBoxedHorizontalAlignment.create({
|
|
521
534
|
isNull: false,
|
|
522
535
|
value: this.props.alignment.toDocFrame()
|
|
523
536
|
});
|
|
524
537
|
}
|
|
525
538
|
if (this.props.font) {
|
|
526
|
-
format.font =
|
|
539
|
+
format.font = Proto13.ProtoBoxedFont.create({
|
|
527
540
|
isNull: false,
|
|
528
541
|
value: this.props.font.toDocFrame()
|
|
529
542
|
});
|
|
530
543
|
}
|
|
531
544
|
if (this.props.fontSize) {
|
|
532
|
-
format.fontSize =
|
|
545
|
+
format.fontSize = Proto13.ProtoBoxedMeasure.create({
|
|
533
546
|
isNull: false,
|
|
534
547
|
value: this.props.fontSize.toDocFrame()
|
|
535
548
|
});
|
|
536
549
|
}
|
|
537
550
|
if (this.props.characterWidth) {
|
|
538
|
-
format.characterWidth =
|
|
551
|
+
format.characterWidth = Proto13.ProtoBoxedMeasure.create({
|
|
539
552
|
isNull: false,
|
|
540
553
|
value: this.props.characterWidth.toDocFrame()
|
|
541
554
|
});
|
|
542
555
|
}
|
|
543
556
|
if (this.props.characterSpacing) {
|
|
544
|
-
format.characterSpacing =
|
|
557
|
+
format.characterSpacing = Proto13.ProtoBoxedMeasure.create({
|
|
545
558
|
isNull: false,
|
|
546
559
|
value: this.props.characterSpacing.toDocFrame()
|
|
547
560
|
});
|
|
548
561
|
}
|
|
549
562
|
if (this.props.lineFeed) {
|
|
550
|
-
format.lineFeed =
|
|
563
|
+
format.lineFeed = Proto13.ProtoBoxedMeasure.create({
|
|
551
564
|
isNull: false,
|
|
552
565
|
value: this.props.lineFeed.toDocFrame()
|
|
553
566
|
});
|
|
554
567
|
}
|
|
555
568
|
if (this.props.indentionLevel !== void 0) {
|
|
556
|
-
format.indentionLevel =
|
|
569
|
+
format.indentionLevel = Proto13.ProtoBoxedInt32.create({
|
|
557
570
|
isNull: false,
|
|
558
571
|
value: this.props.indentionLevel
|
|
559
572
|
});
|
|
560
573
|
}
|
|
561
574
|
if (this.props.indentionWidth) {
|
|
562
|
-
format.indentionWidth =
|
|
575
|
+
format.indentionWidth = Proto13.ProtoBoxedMeasure.create({
|
|
563
576
|
isNull: false,
|
|
564
577
|
value: this.props.indentionWidth.toDocFrame()
|
|
565
578
|
});
|
|
566
579
|
}
|
|
567
580
|
if (this.props.bold !== void 0) {
|
|
568
|
-
format.bold =
|
|
581
|
+
format.bold = Proto13.ProtoBoxedBool.create({
|
|
569
582
|
isNull: false,
|
|
570
583
|
value: !!this.props.bold
|
|
571
584
|
});
|
|
572
585
|
}
|
|
573
586
|
if (this.props.italic !== void 0) {
|
|
574
|
-
format.italic =
|
|
587
|
+
format.italic = Proto13.ProtoBoxedBool.create({
|
|
575
588
|
isNull: false,
|
|
576
589
|
value: !!this.props.italic
|
|
577
590
|
});
|
|
578
591
|
}
|
|
579
592
|
if (this.props.spaceAbove) {
|
|
580
|
-
format.spaceAbove =
|
|
593
|
+
format.spaceAbove = Proto13.ProtoBoxedMeasure.create({
|
|
581
594
|
isNull: false,
|
|
582
595
|
value: this.props.spaceAbove.toDocFrame()
|
|
583
596
|
});
|
|
584
597
|
}
|
|
585
598
|
if (this.props.spaceBelow) {
|
|
586
|
-
format.spaceBelow =
|
|
599
|
+
format.spaceBelow = Proto13.ProtoBoxedMeasure.create({
|
|
587
600
|
isNull: false,
|
|
588
601
|
value: this.props.spaceBelow.toDocFrame()
|
|
589
602
|
});
|
|
590
603
|
}
|
|
591
|
-
return
|
|
604
|
+
return Proto13.ProtoParagraphFormat.create(format);
|
|
592
605
|
}
|
|
593
606
|
};
|
|
594
607
|
|
|
595
608
|
// src/Content/SpaceVertically/index.ts
|
|
596
|
-
import
|
|
609
|
+
import Proto14 from "docframe-types";
|
|
597
610
|
var SpaceVertically = class extends DocumentElement {
|
|
598
611
|
constructor(space) {
|
|
599
612
|
super();
|
|
600
613
|
this.space = space;
|
|
601
614
|
}
|
|
602
615
|
toDocFrame() {
|
|
603
|
-
return
|
|
604
|
-
spaceVertically:
|
|
616
|
+
return Proto14.Node.create({
|
|
617
|
+
spaceVertically: Proto14.ProtoSpaceVertically.create({
|
|
605
618
|
space: this.space.toDocFrame()
|
|
606
619
|
})
|
|
607
620
|
});
|
|
@@ -688,15 +701,15 @@ var Document = class extends BranchDocumentElement {
|
|
|
688
701
|
toDocFrame() {
|
|
689
702
|
const props = this.props;
|
|
690
703
|
const docSettings = Object.values(this.paragraphFormats).map(
|
|
691
|
-
(pf) =>
|
|
704
|
+
(pf) => Proto15.Node.create({
|
|
692
705
|
paragraphFormat: pf.toDocFrame()
|
|
693
706
|
})
|
|
694
707
|
).concat([
|
|
695
|
-
|
|
708
|
+
Proto15.Node.create({
|
|
696
709
|
pDef: props.pageDefinition.toDocFrame()
|
|
697
710
|
}),
|
|
698
|
-
|
|
699
|
-
applyPDef:
|
|
711
|
+
Proto15.Node.create({
|
|
712
|
+
applyPDef: Proto15.ProtoApplyProtoPDef.create({
|
|
700
713
|
pDefUuid: props.pageDefinition.uuid
|
|
701
714
|
})
|
|
702
715
|
}),
|
|
@@ -711,19 +724,19 @@ var Document = class extends BranchDocumentElement {
|
|
|
711
724
|
const content = this.childrenToDocFrame();
|
|
712
725
|
for (const format of Object.values(this.paragraphFormats)) {
|
|
713
726
|
docSettings.push(
|
|
714
|
-
|
|
727
|
+
Proto15.Node.create({
|
|
715
728
|
paragraphFormat: format.toDocFrame()
|
|
716
729
|
})
|
|
717
730
|
);
|
|
718
731
|
}
|
|
719
|
-
return
|
|
732
|
+
return Proto15.Node.create({
|
|
720
733
|
children: docSettings.concat(...content)
|
|
721
734
|
});
|
|
722
735
|
}
|
|
723
736
|
};
|
|
724
737
|
|
|
725
738
|
// src/Content/Formatted/index.ts
|
|
726
|
-
import
|
|
739
|
+
import Proto16 from "docframe-types";
|
|
727
740
|
var Formatted = class extends DocumentElement {
|
|
728
741
|
constructor(doctypeContent, htmlContent) {
|
|
729
742
|
super();
|
|
@@ -733,8 +746,8 @@ var Formatted = class extends DocumentElement {
|
|
|
733
746
|
};
|
|
734
747
|
}
|
|
735
748
|
toDocFrame() {
|
|
736
|
-
return
|
|
737
|
-
formatted:
|
|
749
|
+
return Proto16.Node.create({
|
|
750
|
+
formatted: Proto16.ProtoFormatted.create({
|
|
738
751
|
doctypeContent: this.content.doctype,
|
|
739
752
|
htmlContent: this.content.html
|
|
740
753
|
})
|
|
@@ -742,18 +755,28 @@ var Formatted = class extends DocumentElement {
|
|
|
742
755
|
}
|
|
743
756
|
};
|
|
744
757
|
|
|
758
|
+
// src/Content/Linebreak/index.ts
|
|
759
|
+
import Proto17 from "docframe-types";
|
|
760
|
+
var Linebreak = class extends DocumentElement {
|
|
761
|
+
toDocFrame() {
|
|
762
|
+
return Proto17.Node.create({
|
|
763
|
+
linebreak: Proto17.ProtoLinebreak.create({})
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
|
|
745
768
|
// src/Content/Pagebreak/index.ts
|
|
746
|
-
import
|
|
769
|
+
import Proto18 from "docframe-types";
|
|
747
770
|
var Pagebreak = class extends DocumentElement {
|
|
748
771
|
toDocFrame() {
|
|
749
|
-
return
|
|
750
|
-
newPage:
|
|
772
|
+
return Proto18.Node.create({
|
|
773
|
+
newPage: Proto18.ProtoNewPage.create({})
|
|
751
774
|
});
|
|
752
775
|
}
|
|
753
776
|
};
|
|
754
777
|
|
|
755
778
|
// src/Content/Paragraph/index.ts
|
|
756
|
-
import
|
|
779
|
+
import Proto19 from "docframe-types";
|
|
757
780
|
var Paragraph = class extends BranchDocumentElement {
|
|
758
781
|
constructor(content, paragraphFormatName, overwrite) {
|
|
759
782
|
var _a;
|
|
@@ -768,22 +791,70 @@ var Paragraph = class extends BranchDocumentElement {
|
|
|
768
791
|
par.overwrite = this.props.overwrite.toDocFrame();
|
|
769
792
|
}
|
|
770
793
|
if (this.props.paragraphFormatName) {
|
|
771
|
-
par.format =
|
|
772
|
-
name:
|
|
794
|
+
par.format = Proto19.ProtoParagraphFormat.create({
|
|
795
|
+
name: Proto19.ProtoBoxedString.create({
|
|
773
796
|
isNull: false,
|
|
774
797
|
value: this.props.paragraphFormatName
|
|
775
798
|
})
|
|
776
799
|
});
|
|
777
800
|
}
|
|
778
|
-
return
|
|
779
|
-
paragraph:
|
|
801
|
+
return Proto19.Node.create({
|
|
802
|
+
paragraph: Proto19.ProtoParagraph.create(par),
|
|
803
|
+
children: this.childrenToDocFrame()
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
// src/Content/Span/index.ts
|
|
809
|
+
import Proto20 from "docframe-types";
|
|
810
|
+
var Span = class extends BranchDocumentElement {
|
|
811
|
+
constructor(content, props) {
|
|
812
|
+
super(content, props || {});
|
|
813
|
+
}
|
|
814
|
+
toDocFrame() {
|
|
815
|
+
var _a, _b, _c, _d;
|
|
816
|
+
let bold = void 0;
|
|
817
|
+
if (((_a = this.props) == null ? void 0 : _a.bold) !== void 0) {
|
|
818
|
+
bold = Proto20.ProtoBoxedBool.create({
|
|
819
|
+
isNull: false,
|
|
820
|
+
value: this.props.bold
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
let italic = void 0;
|
|
824
|
+
if (((_b = this.props) == null ? void 0 : _b.italic) !== void 0) {
|
|
825
|
+
italic = Proto20.ProtoBoxedBool.create({
|
|
826
|
+
isNull: false,
|
|
827
|
+
value: this.props.italic
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
let underline = void 0;
|
|
831
|
+
if (((_c = this.props) == null ? void 0 : _c.underline) !== void 0) {
|
|
832
|
+
underline = Proto20.ProtoBoxedBool.create({
|
|
833
|
+
isNull: false,
|
|
834
|
+
value: this.props.underline
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
let strikethrough = void 0;
|
|
838
|
+
if (((_d = this.props) == null ? void 0 : _d.strikethrough) !== void 0) {
|
|
839
|
+
strikethrough = Proto20.ProtoBoxedBool.create({
|
|
840
|
+
isNull: false,
|
|
841
|
+
value: this.props.strikethrough
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
return Proto20.Node.create({
|
|
845
|
+
span: Proto20.ProtoSpan.create({
|
|
846
|
+
bold,
|
|
847
|
+
italic,
|
|
848
|
+
underline,
|
|
849
|
+
strikethrough
|
|
850
|
+
}),
|
|
780
851
|
children: this.childrenToDocFrame()
|
|
781
852
|
});
|
|
782
853
|
}
|
|
783
854
|
};
|
|
784
855
|
|
|
785
856
|
// src/Content/Table/index.ts
|
|
786
|
-
import
|
|
857
|
+
import Proto21 from "docframe-types";
|
|
787
858
|
var Table = class extends BranchDocumentElement {
|
|
788
859
|
constructor(content, props) {
|
|
789
860
|
super(content, props || {});
|
|
@@ -794,11 +865,11 @@ var Table = class extends BranchDocumentElement {
|
|
|
794
865
|
toDocFrame() {
|
|
795
866
|
var _a, _b;
|
|
796
867
|
const props = this.props;
|
|
797
|
-
return
|
|
798
|
-
table:
|
|
799
|
-
settings:
|
|
868
|
+
return Proto21.Node.create({
|
|
869
|
+
table: Proto21.ProtoTable.create({
|
|
870
|
+
settings: Proto21.ProtoTableSettings.create({
|
|
800
871
|
width: (_a = props.width) == null ? void 0 : _a.toDocFrame(),
|
|
801
|
-
leftMeasure:
|
|
872
|
+
leftMeasure: Proto21.ProtoBoxedBool.create({
|
|
802
873
|
isNull: false,
|
|
803
874
|
value: false
|
|
804
875
|
}),
|
|
@@ -811,7 +882,7 @@ var Table = class extends BranchDocumentElement {
|
|
|
811
882
|
};
|
|
812
883
|
|
|
813
884
|
// src/Content/TableCell/index.ts
|
|
814
|
-
import
|
|
885
|
+
import Proto22 from "docframe-types";
|
|
815
886
|
var TableCell = class extends BranchDocumentElement {
|
|
816
887
|
constructor(content, props) {
|
|
817
888
|
super(content, props || {});
|
|
@@ -819,20 +890,20 @@ var TableCell = class extends BranchDocumentElement {
|
|
|
819
890
|
toDocFrame() {
|
|
820
891
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
821
892
|
const props = this.props;
|
|
822
|
-
return
|
|
823
|
-
tableCell:
|
|
824
|
-
settings:
|
|
825
|
-
align:
|
|
893
|
+
return Proto22.Node.create({
|
|
894
|
+
tableCell: Proto22.ProtoTableCell.create({
|
|
895
|
+
settings: Proto22.ProtoTableCellSettings.create({
|
|
896
|
+
align: Proto22.ProtoBoxedHorizontalAlignment.create({
|
|
826
897
|
isNull: false,
|
|
827
|
-
value: ((_a = props.alignment) == null ? void 0 : _a.toDocFrame()) ||
|
|
898
|
+
value: ((_a = props.alignment) == null ? void 0 : _a.toDocFrame()) || Proto22.ProtoHorizontalAlignment.ALIGN_LEFT
|
|
828
899
|
}),
|
|
829
900
|
backgroundColor: (_b = props.backgroundColor) == null ? void 0 : _b.toDocFrame(),
|
|
830
901
|
border: (_c = props.border) == null ? void 0 : _c.toDocFrame(),
|
|
831
902
|
margin: (_d = props.margin) == null ? void 0 : _d.toDocFrame(),
|
|
832
903
|
padding: (_e = props.padding) == null ? void 0 : _e.toDocFrame(),
|
|
833
|
-
valign:
|
|
904
|
+
valign: Proto22.ProtoBoxedVerticalAlignment.create({
|
|
834
905
|
isNull: false,
|
|
835
|
-
value: ((_f = props.verticalAlignment) == null ? void 0 : _f.toDocFrame()) ||
|
|
906
|
+
value: ((_f = props.verticalAlignment) == null ? void 0 : _f.toDocFrame()) || Proto22.ProtoVerticalAlignment.TOP
|
|
836
907
|
}),
|
|
837
908
|
width: (_g = props.width) == null ? void 0 : _g.toDocFrame()
|
|
838
909
|
})
|
|
@@ -843,16 +914,16 @@ var TableCell = class extends BranchDocumentElement {
|
|
|
843
914
|
};
|
|
844
915
|
|
|
845
916
|
// src/Content/TableRow/index.ts
|
|
846
|
-
import
|
|
917
|
+
import Proto23 from "docframe-types";
|
|
847
918
|
var TableRow = class extends BranchDocumentElement {
|
|
848
919
|
constructor(content, props) {
|
|
849
920
|
super(content, props || {});
|
|
850
921
|
}
|
|
851
922
|
toDocFrame() {
|
|
852
923
|
var _a;
|
|
853
|
-
return
|
|
854
|
-
tableRow:
|
|
855
|
-
settings:
|
|
924
|
+
return Proto23.Node.create({
|
|
925
|
+
tableRow: Proto23.ProtoTableRow.create({
|
|
926
|
+
settings: Proto23.ProtoTableRowSettings.create({
|
|
856
927
|
minHeight: (_a = this.props.minHeight) == null ? void 0 : _a.toDocFrame()
|
|
857
928
|
})
|
|
858
929
|
}),
|
|
@@ -866,12 +937,17 @@ var Content_default = {
|
|
|
866
937
|
Barcode,
|
|
867
938
|
ColumnDefinition,
|
|
868
939
|
ColumnPosition,
|
|
940
|
+
Directory,
|
|
869
941
|
Document,
|
|
942
|
+
Footer,
|
|
870
943
|
Formatted,
|
|
871
|
-
|
|
944
|
+
Header,
|
|
945
|
+
Linebreak,
|
|
872
946
|
Pagebreak,
|
|
947
|
+
PageDefinition,
|
|
873
948
|
Paragraph,
|
|
874
949
|
SpaceVertically,
|
|
950
|
+
Span,
|
|
875
951
|
Table,
|
|
876
952
|
TableCell,
|
|
877
953
|
TableRow,
|