ts-d2 0.0.20 → 0.0.22

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/dist/index.js CHANGED
@@ -4,15 +4,49 @@ var __export = (target, all) => {
4
4
  __defProp(target, name, { get: all[name], enumerable: true });
5
5
  };
6
6
 
7
- // src/Border/index.ts
7
+ // src/Alignment/index.ts
8
8
  import Proto from "docframe-types";
9
+ var HorizontalAlignment = class {
10
+ constructor(value) {
11
+ this.value = value;
12
+ }
13
+ toDocFrame() {
14
+ return this.value;
15
+ }
16
+ };
17
+ var VerticalAlignment = class {
18
+ constructor(value) {
19
+ this.value = value;
20
+ }
21
+ toDocFrame() {
22
+ return this.value;
23
+ }
24
+ };
25
+ var Alignment;
26
+ ((Alignment2) => {
27
+ Alignment2.Horizontal = {
28
+ Left: new HorizontalAlignment(Proto.ProtoHorizontalAlignment.ALIGN_LEFT),
29
+ Center: new HorizontalAlignment(Proto.ProtoHorizontalAlignment.ALIGN_CENTER),
30
+ Right: new HorizontalAlignment(Proto.ProtoHorizontalAlignment.ALIGN_RIGHT),
31
+ Justify: new HorizontalAlignment(Proto.ProtoHorizontalAlignment.ALIGN_JUSTIFY),
32
+ FullJustify: new HorizontalAlignment(Proto.ProtoHorizontalAlignment.ALIGN_FULL_JUSTIFY)
33
+ };
34
+ Alignment2.Vertical = {
35
+ Top: new VerticalAlignment(Proto.ProtoVerticalAlignment.TOP),
36
+ Middle: new VerticalAlignment(Proto.ProtoVerticalAlignment.MIDDLE),
37
+ Bottom: new VerticalAlignment(Proto.ProtoVerticalAlignment.BOTTOM)
38
+ };
39
+ })(Alignment || (Alignment = {}));
40
+
41
+ // src/Border/index.ts
42
+ import Proto2 from "docframe-types";
9
43
  var Border = class {
10
44
  constructor(width, color) {
11
45
  this.width = width;
12
46
  this.color = color;
13
47
  }
14
48
  toDocFrame() {
15
- return new Proto.ProtoBorder({
49
+ return new Proto2.ProtoBorder({
16
50
  weight: this.width.toDocFrame(),
17
51
  color: this.color.toDocFrame()
18
52
  });
@@ -24,7 +58,7 @@ var SideBorders = class {
24
58
  }
25
59
  toDocFrame() {
26
60
  var _a, _b, _c, _d;
27
- return new Proto.ProtoSideBorders({
61
+ return new Proto2.ProtoSideBorders({
28
62
  top: (_a = this.value.top) == null ? void 0 : _a.toDocFrame(),
29
63
  right: (_b = this.value.right) == null ? void 0 : _b.toDocFrame(),
30
64
  bottom: (_c = this.value.bottom) == null ? void 0 : _c.toDocFrame(),
@@ -34,7 +68,7 @@ var SideBorders = class {
34
68
  };
35
69
 
36
70
  // src/Color/index.ts
37
- import Proto2 from "docframe-types";
71
+ import Proto3 from "docframe-types";
38
72
  var Color = class _Color {
39
73
  static rgb(r, g, b) {
40
74
  if (r < 0 || r > 255) {
@@ -46,8 +80,8 @@ var Color = class _Color {
46
80
  if (b < 0 || b > 255) {
47
81
  throw new Error(`Invalid blue value: ${b}`);
48
82
  }
49
- return new _Color(Proto2.ProtoColor.create({
50
- type: Proto2.ProtoColorType.RGB,
83
+ return new _Color(Proto3.ProtoColor.create({
84
+ type: Proto3.ProtoColorType.RGB,
51
85
  r,
52
86
  g,
53
87
  b
@@ -66,8 +100,8 @@ var Color = class _Color {
66
100
  if (k < 0 || k > 100) {
67
101
  throw new Error(`Invalid black value: ${k}`);
68
102
  }
69
- return new _Color(Proto2.ProtoColor.create({
70
- type: Proto2.ProtoColorType.CMYK,
103
+ return new _Color(Proto3.ProtoColor.create({
104
+ type: Proto3.ProtoColorType.CMYK,
71
105
  c,
72
106
  m,
73
107
  y,
@@ -84,8 +118,8 @@ var Color = class _Color {
84
118
  const r = parseInt(hex.slice(0, 2), 16);
85
119
  const g = parseInt(hex.slice(2, 4), 16);
86
120
  const b = parseInt(hex.slice(4, 6), 16);
87
- return new _Color(Proto2.ProtoColor.create({
88
- type: Proto2.ProtoColorType.RGB,
121
+ return new _Color(Proto3.ProtoColor.create({
122
+ type: Proto3.ProtoColorType.RGB,
89
123
  r,
90
124
  g,
91
125
  b
@@ -108,7 +142,7 @@ var Colors;
108
142
  import axios from "axios";
109
143
  import FormData from "form-data";
110
144
  import dotenv from "dotenv";
111
- import Proto3 from "docframe-types";
145
+ import Proto4 from "docframe-types";
112
146
  dotenv.config();
113
147
  var Connection = class {
114
148
  constructor(url, token) {
@@ -120,7 +154,7 @@ var Connection = class {
120
154
  }
121
155
  convertTo(format, doc, outputParams, jobParams) {
122
156
  const node = doc.toDocFrame();
123
- const protoData = Proto3.Node.encode(node).finish();
157
+ const protoData = Proto4.Node.encode(node).finish();
124
158
  const form = new FormData();
125
159
  let meta = {
126
160
  format
@@ -166,13 +200,131 @@ var Connection = class {
166
200
  };
167
201
  var defaultConnection = new Connection();
168
202
 
169
- // src/Content/Barcode/index.ts
203
+ // src/Content/AdjustHorizontally/index.ts
170
204
  import Proto6 from "docframe-types";
171
205
 
172
206
  // src/Content/DocumentElement/index.ts
173
207
  var DocumentElement = class {
174
208
  };
175
209
 
210
+ // src/Content/Text/index.ts
211
+ import Proto5 from "docframe-types";
212
+ var Text = class extends DocumentElement {
213
+ constructor(content) {
214
+ super();
215
+ this.content = content;
216
+ }
217
+ toDocFrame() {
218
+ return Proto5.Node.create({
219
+ text: Proto5.ProtoText.create({
220
+ content: this.content
221
+ })
222
+ });
223
+ }
224
+ };
225
+
226
+ // src/Content/BranchDocumentElement/index.ts
227
+ var BranchDocumentElement = class extends DocumentElement {
228
+ constructor(children, props) {
229
+ super();
230
+ this.children = [];
231
+ this._props = props;
232
+ if (children === void 0) {
233
+ this.children = [];
234
+ return;
235
+ }
236
+ this.children = documentElementsFromContent(children);
237
+ }
238
+ appendChildren(children) {
239
+ this.children = this.children.concat(children);
240
+ }
241
+ appendChild(child) {
242
+ this.children.push(child);
243
+ }
244
+ prependChildren(children) {
245
+ this.children = children.concat(this.children);
246
+ }
247
+ prependChild(child) {
248
+ this.children.unshift(child);
249
+ }
250
+ childrenToDocFrame() {
251
+ return this.children.map((child) => child.toDocFrame());
252
+ }
253
+ set props(props) {
254
+ this._props = props;
255
+ }
256
+ get props() {
257
+ return this._props;
258
+ }
259
+ };
260
+ function documentElementsFromContent(content) {
261
+ if (typeof content === "string") {
262
+ return [new Text(content)];
263
+ } else if (Array.isArray(content)) {
264
+ return content.map(documentElementsFromContent).flat();
265
+ } else {
266
+ return [content];
267
+ }
268
+ }
269
+
270
+ // src/Content/AdjustHorizontally/index.ts
271
+ var AdjustHorizontally = class extends BranchDocumentElement {
272
+ constructor(content, props) {
273
+ super(content, props);
274
+ }
275
+ toDocFrame() {
276
+ var _a, _b, _c, _d;
277
+ return Proto6.Node.create({
278
+ adjustHorizontally: Proto6.ProtoAdjustHorizontally.create({
279
+ minFontSize: (_b = (_a = this.props) == null ? void 0 : _a.minFontSize) == null ? void 0 : _b.toDocFrame(),
280
+ maxFontSize: (_d = (_c = this.props) == null ? void 0 : _c.maxFontSize) == null ? void 0 : _d.toDocFrame()
281
+ }),
282
+ children: this.childrenToDocFrame()
283
+ });
284
+ }
285
+ };
286
+
287
+ // src/Content/AdvancedIllustrationArea/index.ts
288
+ import Proto7 from "docframe-types";
289
+ function textFlowTypeToDocFrame(type) {
290
+ switch (type) {
291
+ case "around":
292
+ return Proto7.ProtoAdvancedIllustrationAreaTextFlowType.AROUND;
293
+ case "no-flow":
294
+ return Proto7.ProtoAdvancedIllustrationAreaTextFlowType.NO_FLOW;
295
+ case "foreground":
296
+ return Proto7.ProtoAdvancedIllustrationAreaTextFlowType.FOREGROUND;
297
+ case "background":
298
+ return Proto7.ProtoAdvancedIllustrationAreaTextFlowType.BACKGROUND;
299
+ default:
300
+ throw new Error(`Unknown text flow type: ${type}`);
301
+ }
302
+ }
303
+ var AdvancedIllustrationArea = class extends BranchDocumentElement {
304
+ constructor(content, props) {
305
+ super(content, props);
306
+ }
307
+ toDocFrame() {
308
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
309
+ return Proto7.Node.create({
310
+ advancedIllustrationArea: Proto7.ProtoAdvancedIllustrationArea.create({
311
+ uuid: (_a = this.props) == null ? void 0 : _a.uuid,
312
+ absolute: (_b = this.props) == null ? void 0 : _b.absolute,
313
+ width: (_d = (_c = this.props) == null ? void 0 : _c.width) == null ? void 0 : _d.toDocFrame(),
314
+ height: (_f = (_e = this.props) == null ? void 0 : _e.height) == null ? void 0 : _f.toDocFrame(),
315
+ x: (_h = (_g = this.props) == null ? void 0 : _g.x) == null ? void 0 : _h.toDocFrame(),
316
+ y: (_j = (_i = this.props) == null ? void 0 : _i.y) == null ? void 0 : _j.toDocFrame(),
317
+ textFlow: ((_k = this.props) == null ? void 0 : _k.textFlow) ? textFlowTypeToDocFrame(this.props.textFlow) : void 0,
318
+ rotation: (_l = this.props) == null ? void 0 : _l.rotation
319
+ }),
320
+ children: this.childrenToDocFrame()
321
+ });
322
+ }
323
+ };
324
+
325
+ // src/Content/Barcode/index.ts
326
+ import Proto10 from "docframe-types";
327
+
176
328
  // src/Measure/index.ts
177
329
  var Measure_exports = {};
178
330
  __export(Measure_exports, {
@@ -183,7 +335,7 @@ __export(Measure_exports, {
183
335
  });
184
336
 
185
337
  // src/Measure/Measure.ts
186
- import Proto4 from "docframe-types";
338
+ import Proto8 from "docframe-types";
187
339
  var _Measure = class _Measure {
188
340
  constructor(value, unit) {
189
341
  this.value = value;
@@ -192,34 +344,34 @@ var _Measure = class _Measure {
192
344
  toDocFrame() {
193
345
  switch (this.unit) {
194
346
  case "pt":
195
- return new Proto4.ProtoMeasure({
347
+ return new Proto8.ProtoMeasure({
196
348
  value: this.value,
197
- mtype: Proto4.ProtoMeasureType.PT
349
+ mtype: Proto8.ProtoMeasureType.PT
198
350
  });
199
351
  case "cm":
200
- return new Proto4.ProtoMeasure({
352
+ return new Proto8.ProtoMeasure({
201
353
  value: this.value,
202
- mtype: Proto4.ProtoMeasureType.CM
354
+ mtype: Proto8.ProtoMeasureType.CM
203
355
  });
204
356
  case "mm":
205
- return new Proto4.ProtoMeasure({
357
+ return new Proto8.ProtoMeasure({
206
358
  value: this.value,
207
- mtype: Proto4.ProtoMeasureType.MM
359
+ mtype: Proto8.ProtoMeasureType.MM
208
360
  });
209
361
  case "in":
210
- return new Proto4.ProtoMeasure({
362
+ return new Proto8.ProtoMeasure({
211
363
  value: this.value,
212
- mtype: Proto4.ProtoMeasureType.IN
364
+ mtype: Proto8.ProtoMeasureType.IN
213
365
  });
214
366
  case "px":
215
- return new Proto4.ProtoMeasure({
367
+ return new Proto8.ProtoMeasure({
216
368
  value: this.value,
217
- mtype: Proto4.ProtoMeasureType.PX
369
+ mtype: Proto8.ProtoMeasureType.PX
218
370
  });
219
371
  case "%":
220
- return new Proto4.ProtoMeasure({
372
+ return new Proto8.ProtoMeasure({
221
373
  value: this.value,
222
- mtype: Proto4.ProtoMeasureType.PERCENT
374
+ mtype: Proto8.ProtoMeasureType.PERCENT
223
375
  });
224
376
  default:
225
377
  throw new Error(`Unknown measure unit: ${this.unit}`);
@@ -236,7 +388,7 @@ var SideMeasures = class {
236
388
  }
237
389
  toDocFrame() {
238
390
  var _a, _b, _c, _d;
239
- return new Proto4.ProtoSideMeasures({
391
+ return new Proto8.ProtoSideMeasures({
240
392
  top: (_a = this.value.top) == null ? void 0 : _a.toDocFrame(),
241
393
  right: (_b = this.value.right) == null ? void 0 : _b.toDocFrame(),
242
394
  bottom: (_c = this.value.bottom) == null ? void 0 : _c.toDocFrame(),
@@ -248,19 +400,19 @@ var Sides = class {
248
400
  };
249
401
 
250
402
  // src/Content/ReferencePoint/index.ts
251
- import Proto5 from "docframe-types";
403
+ import Proto9 from "docframe-types";
252
404
  function referencePointToDocFrame(point) {
253
405
  switch (point) {
254
406
  case "top-left":
255
- return Proto5.ProtoImageReferencePoint.REF_POINT_TOP_LEFT;
407
+ return Proto9.ProtoImageReferencePoint.REF_POINT_TOP_LEFT;
256
408
  case "top-right":
257
- return Proto5.ProtoImageReferencePoint.REF_POINT_TOP_RIGHT;
409
+ return Proto9.ProtoImageReferencePoint.REF_POINT_TOP_RIGHT;
258
410
  case "center":
259
- return Proto5.ProtoImageReferencePoint.REF_POINT_CENTER;
411
+ return Proto9.ProtoImageReferencePoint.REF_POINT_CENTER;
260
412
  case "bottom-left":
261
- return Proto5.ProtoImageReferencePoint.REF_POINT_BOTTOM_LEFT;
413
+ return Proto9.ProtoImageReferencePoint.REF_POINT_BOTTOM_LEFT;
262
414
  case "bottom-right":
263
- return Proto5.ProtoImageReferencePoint.REF_POINT_BOTTOM_RIGHT;
415
+ return Proto9.ProtoImageReferencePoint.REF_POINT_BOTTOM_RIGHT;
264
416
  default:
265
417
  throw new Error(`Unknown reference point: ${point}`);
266
418
  }
@@ -273,8 +425,8 @@ var Barcode = class extends DocumentElement {
273
425
  this.props = props;
274
426
  }
275
427
  toDocFrame() {
276
- return Proto6.Node.create({
277
- barcode: Proto6.ProtoBarcode.create({
428
+ return Proto10.Node.create({
429
+ barcode: Proto10.ProtoBarcode.create({
278
430
  type: this.props.type,
279
431
  positionAbsolute: this.props.positionAbsolute,
280
432
  referencePoint: referencePointToDocFrame(this.props.referencePoint),
@@ -283,15 +435,32 @@ var Barcode = class extends DocumentElement {
283
435
  rotation: this.props.rotation,
284
436
  width: this.props.width.toDocFrame(),
285
437
  height: this.props.height.toDocFrame(),
286
- padding: Measure.zero.toDocFrame(),
287
- data: this.props.data
438
+ padding: (this.props.padding ?? Measure.zero).toDocFrame(),
439
+ data: this.props.data,
440
+ code: this.props.code,
441
+ altText: this.props.altText,
442
+ uuid: this.props.uuid
288
443
  })
289
444
  });
290
445
  }
291
446
  };
292
447
 
448
+ // src/Content/CarryOver/index.ts
449
+ import Proto11 from "docframe-types";
450
+ var CarryOver = class extends BranchDocumentElement {
451
+ constructor(content) {
452
+ super(content);
453
+ }
454
+ toDocFrame() {
455
+ return Proto11.Node.create({
456
+ carryOver: Proto11.ProtoCarryOver.create({}),
457
+ children: this.childrenToDocFrame()
458
+ });
459
+ }
460
+ };
461
+
293
462
  // src/Content/ColumnDefinition/index.ts
294
- import Proto7 from "docframe-types";
463
+ import Proto12 from "docframe-types";
295
464
  import { v4 as uuidv4 } from "uuid";
296
465
  var ColumnPositionMode = class {
297
466
  constructor(value) {
@@ -303,12 +472,12 @@ var ColumnPositionMode = class {
303
472
  };
304
473
  var ColumnPosition;
305
474
  ((ColumnPosition2) => {
306
- ColumnPosition2.Center = new ColumnPositionMode(Proto7.ProtoPositionMode.CENTER);
307
- ColumnPosition2.Left = new ColumnPositionMode(Proto7.ProtoPositionMode.LEFT);
308
- ColumnPosition2.Folio = new ColumnPositionMode(Proto7.ProtoPositionMode.FOLIO);
309
- ColumnPosition2.Right = new ColumnPositionMode(Proto7.ProtoPositionMode.RIGHT);
475
+ ColumnPosition2.Center = new ColumnPositionMode(Proto12.ProtoPositionMode.CENTER);
476
+ ColumnPosition2.Left = new ColumnPositionMode(Proto12.ProtoPositionMode.LEFT);
477
+ ColumnPosition2.Folio = new ColumnPositionMode(Proto12.ProtoPositionMode.FOLIO);
478
+ ColumnPosition2.Right = new ColumnPositionMode(Proto12.ProtoPositionMode.RIGHT);
310
479
  ColumnPosition2.ReverseFolio = new ColumnPositionMode(
311
- Proto7.ProtoPositionMode.REVERSE_FOLIO
480
+ Proto12.ProtoPositionMode.REVERSE_FOLIO
312
481
  );
313
482
  })(ColumnPosition || (ColumnPosition = {}));
314
483
  var ColumnDefinition = class {
@@ -318,20 +487,20 @@ var ColumnDefinition = class {
318
487
  }
319
488
  toDocFrame(applyImmediate) {
320
489
  const result = [
321
- Proto7.Node.create({
322
- cDef: Proto7.ProtoCDef.create({
490
+ Proto12.Node.create({
491
+ cDef: Proto12.ProtoCDef.create({
323
492
  Uuid: this.uuid,
324
- columSettings: Proto7.ProtoColumnSettings.create({
325
- width: Proto7.ProtoBoxedMeasure.create({
493
+ columSettings: Proto12.ProtoColumnSettings.create({
494
+ width: Proto12.ProtoBoxedMeasure.create({
326
495
  isNull: false,
327
496
  value: this.props.width.toDocFrame()
328
497
  }),
329
- positionOffset: Proto7.ProtoBoxedMeasure.create({
498
+ positionOffset: Proto12.ProtoBoxedMeasure.create({
330
499
  isNull: false,
331
500
  value: this.props.positionOffset.toDocFrame()
332
501
  }),
333
502
  positionMode: this.props.position.toDocFrame(),
334
- interColumnSpace: Proto7.ProtoBoxedMeasure.create({
503
+ interColumnSpace: Proto12.ProtoBoxedMeasure.create({
335
504
  isNull: false,
336
505
  value: this.props.interColumnSpace.toDocFrame()
337
506
  })
@@ -341,8 +510,8 @@ var ColumnDefinition = class {
341
510
  ];
342
511
  if (applyImmediate) {
343
512
  result.push(
344
- Proto7.Node.create({
345
- applyCDef: Proto7.ProtoApplyProtoCDef.create({
513
+ Proto12.Node.create({
514
+ applyCDef: Proto12.ProtoApplyProtoCDef.create({
346
515
  cDefUuid: this.uuid
347
516
  })
348
517
  })
@@ -368,81 +537,63 @@ var ColumnDefinitions = {
368
537
  }
369
538
  };
370
539
 
371
- // src/Content/Directory/index.ts
372
- import Proto9 from "docframe-types";
373
-
374
- // src/Content/Text/index.ts
375
- import Proto8 from "docframe-types";
376
- var Text = class extends DocumentElement {
377
- constructor(content) {
378
- super();
379
- this.content = content;
540
+ // src/Content/Condition/index.ts
541
+ import Proto13 from "docframe-types";
542
+ var Condition = class extends BranchDocumentElement {
543
+ constructor(content, props) {
544
+ super(content, props);
380
545
  }
381
546
  toDocFrame() {
382
- return Proto8.Node.create({
383
- text: Proto8.ProtoText.create({
384
- content: this.content
385
- })
547
+ var _a, _b, _c, _d;
548
+ return Proto13.Node.create({
549
+ condition: Proto13.ProtoCondition.create({
550
+ uuid: (_a = this.props) == null ? void 0 : _a.uuid,
551
+ code: (_b = this.props) == null ? void 0 : _b.code,
552
+ result: (_c = this.props) == null ? void 0 : _c.result,
553
+ regenerate: (_d = this.props) == null ? void 0 : _d.regenerate
554
+ }),
555
+ children: this.childrenToDocFrame()
386
556
  });
387
557
  }
388
558
  };
389
559
 
390
- // src/Content/BranchDocumentElement/index.ts
391
- var BranchDocumentElement = class extends DocumentElement {
392
- constructor(children, props) {
393
- super();
394
- this.children = [];
395
- this._props = props;
396
- if (children === void 0) {
397
- this.children = [];
398
- return;
399
- }
400
- this.children = documentElementsFromContent(children);
401
- }
402
- appendChildren(children) {
403
- this.children = this.children.concat(children);
404
- }
405
- appendChild(child) {
406
- this.children.push(child);
407
- }
408
- prependChildren(children) {
409
- this.children = children.concat(this.children);
410
- }
411
- prependChild(child) {
412
- this.children.unshift(child);
413
- }
414
- childrenToDocFrame() {
415
- return this.children.map((child) => child.toDocFrame());
416
- }
417
- set props(props) {
418
- this._props = props;
419
- }
420
- get props() {
421
- return this._props;
422
- }
423
- };
424
- function documentElementsFromContent(content) {
425
- if (typeof content === "string") {
426
- return [new Text(content)];
427
- } else if (Array.isArray(content)) {
428
- return content.map(documentElementsFromContent).flat();
429
- } else {
430
- return [content];
560
+ // src/Content/Directory/index.ts
561
+ import Proto14 from "docframe-types";
562
+ function semanticTypeToDocFrame(type) {
563
+ switch (type) {
564
+ case "none":
565
+ return Proto14.ProtoSemanticType.SEMANTIC_TYPE_NONE;
566
+ case "part":
567
+ return Proto14.ProtoSemanticType.SEMANTIC_TYPE_PART;
568
+ case "art":
569
+ return Proto14.ProtoSemanticType.SEMANTIC_TYPE_ART;
570
+ case "sect":
571
+ return Proto14.ProtoSemanticType.SEMANTIC_TYPE_SECT;
572
+ case "div":
573
+ return Proto14.ProtoSemanticType.SEMANTIC_TYPE_DIV;
574
+ default:
575
+ throw new Error(`Unknown semantic type: ${type}`);
431
576
  }
432
577
  }
433
-
434
- // src/Content/Directory/index.ts
435
578
  var Directory = class extends BranchDocumentElement {
579
+ constructor(content, props) {
580
+ super(content, props);
581
+ }
436
582
  toDocFrame() {
437
- return Proto9.Node.create({
438
- directory: Proto9.ProtoDirectory.create({}),
583
+ var _a, _b, _c;
584
+ return Proto14.Node.create({
585
+ directory: Proto14.ProtoDirectory.create({
586
+ name: (_a = this.props) == null ? void 0 : _a.name,
587
+ editable: (_b = this.props) == null ? void 0 : _b.editable,
588
+ semanticType: ((_c = this.props) == null ? void 0 : _c.semanticType) ? semanticTypeToDocFrame(this.props.semanticType) : void 0
589
+ }),
439
590
  children: this.childrenToDocFrame()
440
591
  });
441
592
  }
442
593
  };
443
594
 
444
595
  // src/Content/Document/index.ts
445
- import Proto15 from "docframe-types";
596
+ import Proto21 from "docframe-types";
446
597
 
447
598
  // src/OutputFormat/index.ts
448
599
  var OutputFormat_exports = {};
@@ -460,29 +611,69 @@ var OutputFormat = /* @__PURE__ */ ((OutputFormat2) => {
460
611
  })(OutputFormat || {});
461
612
 
462
613
  // src/Content/Footer/index.ts
463
- import Proto10 from "docframe-types";
614
+ import Proto15 from "docframe-types";
615
+ function footerModeToDocFrame(mode) {
616
+ switch (mode) {
617
+ case "append-initial":
618
+ return Proto15.ProtoFooterMode.FOOTER_MODE_APPEND_INITIAL;
619
+ case "append":
620
+ return Proto15.ProtoFooterMode.FOOTER_MODE_APPEND;
621
+ case "extend":
622
+ return Proto15.ProtoFooterMode.FOOTER_MODE_EXTEND;
623
+ case "replace":
624
+ return Proto15.ProtoFooterMode.FOOTER_MODE_REPLACE;
625
+ default:
626
+ throw new Error(`Unknown footer mode: ${mode}`);
627
+ }
628
+ }
464
629
  var Footer = class extends BranchDocumentElement {
630
+ constructor(content, props) {
631
+ super(content, props);
632
+ }
465
633
  toDocFrame() {
466
- return Proto10.Node.create({
467
- footer: Proto10.ProtoFooter.create(),
634
+ var _a;
635
+ return Proto15.Node.create({
636
+ footer: Proto15.ProtoFooter.create({
637
+ mode: ((_a = this.props) == null ? void 0 : _a.mode) ? footerModeToDocFrame(this.props.mode) : void 0
638
+ }),
468
639
  children: this.childrenToDocFrame()
469
640
  });
470
641
  }
471
642
  };
472
643
 
473
644
  // src/Content/Header/index.ts
474
- import Proto11 from "docframe-types";
645
+ import Proto16 from "docframe-types";
646
+ function headerModeToDocFrame(mode) {
647
+ switch (mode) {
648
+ case "append-initial":
649
+ return Proto16.ProtoHeaderMode.HEADER_MODE_APPEND_INITIAL;
650
+ case "append":
651
+ return Proto16.ProtoHeaderMode.HEADER_MODE_APPEND;
652
+ case "extend":
653
+ return Proto16.ProtoHeaderMode.HEADER_MODE_EXTEND;
654
+ case "replace":
655
+ return Proto16.ProtoHeaderMode.HEADER_MODE_REPLACE;
656
+ default:
657
+ throw new Error(`Unknown header mode: ${mode}`);
658
+ }
659
+ }
475
660
  var Header = class extends BranchDocumentElement {
661
+ constructor(content, props) {
662
+ super(content, props);
663
+ }
476
664
  toDocFrame() {
477
- return Proto11.Node.create({
478
- header: Proto11.ProtoHeader.create(),
665
+ var _a;
666
+ return Proto16.Node.create({
667
+ header: Proto16.ProtoHeader.create({
668
+ mode: ((_a = this.props) == null ? void 0 : _a.mode) ? headerModeToDocFrame(this.props.mode) : void 0
669
+ }),
479
670
  children: this.childrenToDocFrame()
480
671
  });
481
672
  }
482
673
  };
483
674
 
484
675
  // src/Content/PageDefinition/index.ts
485
- import Proto12 from "docframe-types";
676
+ import Proto17 from "docframe-types";
486
677
  import { v4 } from "uuid";
487
678
  var PageDefinition = class {
488
679
  constructor(width, height) {
@@ -492,12 +683,12 @@ var PageDefinition = class {
492
683
  }
493
684
  toDocFrame() {
494
685
  var _a, _b;
495
- return new Proto12.ProtoPDef({
496
- pageDepth: new Proto12.ProtoBoxedMeasure({
686
+ return new Proto17.ProtoPDef({
687
+ pageDepth: new Proto17.ProtoBoxedMeasure({
497
688
  isNull: this.height === void 0,
498
689
  value: (_a = this.height) == null ? void 0 : _a.toDocFrame()
499
690
  }),
500
- pageWidth: new Proto12.ProtoBoxedMeasure({
691
+ pageWidth: new Proto17.ProtoBoxedMeasure({
501
692
  isNull: this.width === void 0,
502
693
  value: (_b = this.width) == null ? void 0 : _b.toDocFrame()
503
694
  }),
@@ -522,7 +713,7 @@ var PageDefinitions;
522
713
  })(PageDefinitions || (PageDefinitions = {}));
523
714
 
524
715
  // src/ParagraphFormat/index.ts
525
- import Proto13 from "docframe-types";
716
+ import Proto18 from "docframe-types";
526
717
  import { v4 as uuidv42 } from "uuid";
527
718
  var ParagraphFormat = class {
528
719
  constructor(props) {
@@ -531,101 +722,101 @@ var ParagraphFormat = class {
531
722
  }
532
723
  toDocFrame() {
533
724
  let format = {
534
- default: Proto13.ProtoBoxedBool.create({
725
+ default: Proto18.ProtoBoxedBool.create({
535
726
  isNull: false,
536
727
  value: this.props.default || false
537
728
  }),
538
- name: Proto13.ProtoBoxedString.create({
729
+ name: Proto18.ProtoBoxedString.create({
539
730
  isNull: false,
540
731
  value: this.props.name
541
732
  })
542
733
  };
543
734
  if (this.props.alignment) {
544
- format.alignment = Proto13.ProtoBoxedHorizontalAlignment.create({
735
+ format.alignment = Proto18.ProtoBoxedHorizontalAlignment.create({
545
736
  isNull: false,
546
737
  value: this.props.alignment.toDocFrame()
547
738
  });
548
739
  }
549
740
  if (this.props.font) {
550
- format.font = Proto13.ProtoBoxedFont.create({
741
+ format.font = Proto18.ProtoBoxedFont.create({
551
742
  isNull: false,
552
743
  value: this.props.font.toDocFrame()
553
744
  });
554
745
  }
555
746
  if (this.props.fontSize) {
556
- format.fontSize = Proto13.ProtoBoxedMeasure.create({
747
+ format.fontSize = Proto18.ProtoBoxedMeasure.create({
557
748
  isNull: false,
558
749
  value: this.props.fontSize.toDocFrame()
559
750
  });
560
751
  }
561
752
  if (this.props.characterWidth) {
562
- format.characterWidth = Proto13.ProtoBoxedMeasure.create({
753
+ format.characterWidth = Proto18.ProtoBoxedMeasure.create({
563
754
  isNull: false,
564
755
  value: this.props.characterWidth.toDocFrame()
565
756
  });
566
757
  }
567
758
  if (this.props.characterSpacing) {
568
- format.characterSpacing = Proto13.ProtoBoxedMeasure.create({
759
+ format.characterSpacing = Proto18.ProtoBoxedMeasure.create({
569
760
  isNull: false,
570
761
  value: this.props.characterSpacing.toDocFrame()
571
762
  });
572
763
  }
573
764
  if (this.props.lineFeed) {
574
- format.lineFeed = Proto13.ProtoBoxedMeasure.create({
765
+ format.lineFeed = Proto18.ProtoBoxedMeasure.create({
575
766
  isNull: false,
576
767
  value: this.props.lineFeed.toDocFrame()
577
768
  });
578
769
  }
579
770
  if (this.props.indentionLevel !== void 0) {
580
- format.indentionLevel = Proto13.ProtoBoxedInt32.create({
771
+ format.indentionLevel = Proto18.ProtoBoxedInt32.create({
581
772
  isNull: false,
582
773
  value: this.props.indentionLevel
583
774
  });
584
775
  }
585
776
  if (this.props.indentionWidth) {
586
- format.indentionWidth = Proto13.ProtoBoxedMeasure.create({
777
+ format.indentionWidth = Proto18.ProtoBoxedMeasure.create({
587
778
  isNull: false,
588
779
  value: this.props.indentionWidth.toDocFrame()
589
780
  });
590
781
  }
591
782
  if (this.props.bold !== void 0) {
592
- format.bold = Proto13.ProtoBoxedBool.create({
783
+ format.bold = Proto18.ProtoBoxedBool.create({
593
784
  isNull: false,
594
785
  value: !!this.props.bold
595
786
  });
596
787
  }
597
788
  if (this.props.italic !== void 0) {
598
- format.italic = Proto13.ProtoBoxedBool.create({
789
+ format.italic = Proto18.ProtoBoxedBool.create({
599
790
  isNull: false,
600
791
  value: !!this.props.italic
601
792
  });
602
793
  }
603
794
  if (this.props.spaceAbove) {
604
- format.spaceAbove = Proto13.ProtoBoxedMeasure.create({
795
+ format.spaceAbove = Proto18.ProtoBoxedMeasure.create({
605
796
  isNull: false,
606
797
  value: this.props.spaceAbove.toDocFrame()
607
798
  });
608
799
  }
609
800
  if (this.props.spaceBelow) {
610
- format.spaceBelow = Proto13.ProtoBoxedMeasure.create({
801
+ format.spaceBelow = Proto18.ProtoBoxedMeasure.create({
611
802
  isNull: false,
612
803
  value: this.props.spaceBelow.toDocFrame()
613
804
  });
614
805
  }
615
- return Proto13.ProtoParagraphFormat.create(format);
806
+ return Proto18.ProtoParagraphFormat.create(format);
616
807
  }
617
808
  };
618
809
 
619
810
  // src/Content/SpaceVertically/index.ts
620
- import Proto14 from "docframe-types";
811
+ import Proto19 from "docframe-types";
621
812
  var SpaceVertically = class extends DocumentElement {
622
813
  constructor(space) {
623
814
  super();
624
815
  this.space = space;
625
816
  }
626
817
  toDocFrame() {
627
- return Proto14.Node.create({
628
- spaceVertically: Proto14.ProtoSpaceVertically.create({
818
+ return Proto19.Node.create({
819
+ spaceVertically: Proto19.ProtoSpaceVertically.create({
629
820
  space: this.space.toDocFrame()
630
821
  })
631
822
  });
@@ -633,13 +824,13 @@ var SpaceVertically = class extends DocumentElement {
633
824
  };
634
825
 
635
826
  // src/Font/index.ts
636
- import { ProtoFont } from "docframe-types";
827
+ import Proto20 from "docframe-types";
637
828
  var Font = class {
638
829
  constructor(name) {
639
830
  this.name = name;
640
831
  }
641
832
  toDocFrame() {
642
- return ProtoFont.create({
833
+ return Proto20.ProtoFont.create({
643
834
  name: this.name,
644
835
  // TODO: suppot font mapping for docframe step
645
836
  id: 5
@@ -712,15 +903,15 @@ var Document = class extends BranchDocumentElement {
712
903
  toDocFrame() {
713
904
  const props = this.props;
714
905
  const docSettings = Object.values(this.paragraphFormats).map(
715
- (pf) => Proto15.Node.create({
906
+ (pf) => Proto21.Node.create({
716
907
  paragraphFormat: pf.toDocFrame()
717
908
  })
718
909
  ).concat([
719
- Proto15.Node.create({
910
+ Proto21.Node.create({
720
911
  pDef: props.pageDefinition.toDocFrame()
721
912
  }),
722
- Proto15.Node.create({
723
- applyPDef: Proto15.ProtoApplyProtoPDef.create({
913
+ Proto21.Node.create({
914
+ applyPDef: Proto21.ProtoApplyProtoPDef.create({
724
915
  pDefUuid: props.pageDefinition.uuid
725
916
  })
726
917
  }),
@@ -735,19 +926,19 @@ var Document = class extends BranchDocumentElement {
735
926
  const content = this.childrenToDocFrame();
736
927
  for (const format of Object.values(this.paragraphFormats)) {
737
928
  docSettings.push(
738
- Proto15.Node.create({
929
+ Proto21.Node.create({
739
930
  paragraphFormat: format.toDocFrame()
740
931
  })
741
932
  );
742
933
  }
743
- return Proto15.Node.create({
934
+ return Proto21.Node.create({
744
935
  children: docSettings.concat(...content)
745
936
  });
746
937
  }
747
938
  };
748
939
 
749
940
  // src/Content/Formatted/index.ts
750
- import Proto16 from "docframe-types";
941
+ import Proto22 from "docframe-types";
751
942
  var Formatted = class extends DocumentElement {
752
943
  constructor(doctypeContent, htmlContent) {
753
944
  super();
@@ -757,8 +948,8 @@ var Formatted = class extends DocumentElement {
757
948
  };
758
949
  }
759
950
  toDocFrame() {
760
- return Proto16.Node.create({
761
- formatted: Proto16.ProtoFormatted.create({
951
+ return Proto22.Node.create({
952
+ formatted: Proto22.ProtoFormatted.create({
762
953
  doctypeContent: this.content.doctype,
763
954
  htmlContent: this.content.html
764
955
  })
@@ -766,28 +957,249 @@ var Formatted = class extends DocumentElement {
766
957
  }
767
958
  };
768
959
 
960
+ // src/Content/Image/index.ts
961
+ import Proto23 from "docframe-types";
962
+ function imageScaleTypeToDocFrame(type) {
963
+ switch (type) {
964
+ case "relative":
965
+ return Proto23.ProtoImageScaleType.IMAGE_SCALE_TYPE_RELATIVE;
966
+ case "absolute":
967
+ return Proto23.ProtoImageScaleType.IMAGE_SCALE_TYPE_ABSOLUTE;
968
+ case "relative-to-column":
969
+ return Proto23.ProtoImageScaleType.IMAGE_SCALE_TYPE_RELATIVE_TO_COLUMN;
970
+ default:
971
+ throw new Error(`Unknown image scale type: ${type}`);
972
+ }
973
+ }
974
+ var Image = class extends DocumentElement {
975
+ constructor(props) {
976
+ super();
977
+ this.props = props;
978
+ }
979
+ toDocFrame() {
980
+ const p = this.props;
981
+ const image = {
982
+ alt: p.alt,
983
+ name: p.name,
984
+ src: p.src,
985
+ filename: p.filename,
986
+ rotation: p.rotation,
987
+ hyperlink: p.hyperlink,
988
+ uuid: p.uuid,
989
+ imageContent: p.imageContent
990
+ };
991
+ if (p.scale !== void 0) {
992
+ image.scale = Proto23.ProtoBoxedDouble.create({
993
+ isNull: false,
994
+ value: p.scale
995
+ });
996
+ }
997
+ if (p.columnScale !== void 0) {
998
+ image.columnScale = Proto23.ProtoBoxedDouble.create({
999
+ isNull: false,
1000
+ value: p.columnScale
1001
+ });
1002
+ }
1003
+ if (p.width) {
1004
+ image.width = Proto23.ProtoBoxedMeasure.create({
1005
+ isNull: false,
1006
+ value: p.width.toDocFrame()
1007
+ });
1008
+ }
1009
+ if (p.height) {
1010
+ image.height = Proto23.ProtoBoxedMeasure.create({
1011
+ isNull: false,
1012
+ value: p.height.toDocFrame()
1013
+ });
1014
+ }
1015
+ if (p.x) {
1016
+ image.x = Proto23.ProtoBoxedMeasure.create({
1017
+ isNull: false,
1018
+ value: p.x.toDocFrame()
1019
+ });
1020
+ }
1021
+ if (p.y) {
1022
+ image.y = Proto23.ProtoBoxedMeasure.create({
1023
+ isNull: false,
1024
+ value: p.y.toDocFrame()
1025
+ });
1026
+ }
1027
+ if (p.positionAbsolute !== void 0) {
1028
+ image.positionAbsolute = Proto23.ProtoBoxedBool.create({
1029
+ isNull: false,
1030
+ value: p.positionAbsolute
1031
+ });
1032
+ }
1033
+ if (p.flip) {
1034
+ image.flipSettings = Proto23.ProtoFlipSettings.create({
1035
+ x: p.flip.x,
1036
+ y: p.flip.y
1037
+ });
1038
+ }
1039
+ if (p.crop) {
1040
+ const cropSettings = {};
1041
+ if (p.crop.x) {
1042
+ cropSettings.x = Proto23.ProtoBoxedMeasure.create({
1043
+ isNull: false,
1044
+ value: p.crop.x.toDocFrame()
1045
+ });
1046
+ }
1047
+ if (p.crop.y) {
1048
+ cropSettings.y = Proto23.ProtoBoxedMeasure.create({
1049
+ isNull: false,
1050
+ value: p.crop.y.toDocFrame()
1051
+ });
1052
+ }
1053
+ if (p.crop.width) {
1054
+ cropSettings.width = Proto23.ProtoBoxedMeasure.create({
1055
+ isNull: false,
1056
+ value: p.crop.width.toDocFrame()
1057
+ });
1058
+ }
1059
+ if (p.crop.height) {
1060
+ cropSettings.height = Proto23.ProtoBoxedMeasure.create({
1061
+ isNull: false,
1062
+ value: p.crop.height.toDocFrame()
1063
+ });
1064
+ }
1065
+ image.cropSettings = Proto23.ProtoCropSettings.create(cropSettings);
1066
+ }
1067
+ if (p.referencePoint) {
1068
+ image.referencePoint = referencePointToDocFrame(p.referencePoint);
1069
+ }
1070
+ if (p.scaleType) {
1071
+ image.scaleType = imageScaleTypeToDocFrame(p.scaleType);
1072
+ }
1073
+ return Proto23.Node.create({
1074
+ image: Proto23.ProtoImage.create(image)
1075
+ });
1076
+ }
1077
+ };
1078
+
1079
+ // src/Content/Indentation/index.ts
1080
+ import Proto24 from "docframe-types";
1081
+ var Indentation = class extends BranchDocumentElement {
1082
+ constructor(content, props) {
1083
+ super(content, props);
1084
+ }
1085
+ toDocFrame() {
1086
+ var _a, _b, _c;
1087
+ const indent = {
1088
+ uuid: (_a = this.props) == null ? void 0 : _a.uuid
1089
+ };
1090
+ if ((_b = this.props) == null ? void 0 : _b.left) {
1091
+ indent.left = Proto24.ProtoBoxedMeasure.create({
1092
+ isNull: false,
1093
+ value: this.props.left.toDocFrame()
1094
+ });
1095
+ }
1096
+ if ((_c = this.props) == null ? void 0 : _c.right) {
1097
+ indent.right = Proto24.ProtoBoxedMeasure.create({
1098
+ isNull: false,
1099
+ value: this.props.right.toDocFrame()
1100
+ });
1101
+ }
1102
+ return Proto24.Node.create({
1103
+ indentation: Proto24.ProtoIndentation.create(indent),
1104
+ children: this.childrenToDocFrame()
1105
+ });
1106
+ }
1107
+ };
1108
+
769
1109
  // src/Content/Linebreak/index.ts
770
- import Proto17 from "docframe-types";
1110
+ import Proto25 from "docframe-types";
771
1111
  var Linebreak = class extends DocumentElement {
772
1112
  toDocFrame() {
773
- return Proto17.Node.create({
774
- linebreak: Proto17.ProtoLinebreak.create({})
1113
+ return Proto25.Node.create({
1114
+ linebreak: Proto25.ProtoLinebreak.create({})
1115
+ });
1116
+ }
1117
+ };
1118
+
1119
+ // src/Content/Link/index.ts
1120
+ import Proto26 from "docframe-types";
1121
+ var Link = class extends BranchDocumentElement {
1122
+ constructor(content, url) {
1123
+ super(content, url ? { url } : void 0);
1124
+ }
1125
+ toDocFrame() {
1126
+ var _a;
1127
+ return Proto26.Node.create({
1128
+ link: Proto26.ProtoLink.create({
1129
+ url: (_a = this.props) == null ? void 0 : _a.url
1130
+ }),
1131
+ children: this.childrenToDocFrame()
1132
+ });
1133
+ }
1134
+ };
1135
+
1136
+ // src/Content/Loop/index.ts
1137
+ import Proto27 from "docframe-types";
1138
+ var Loop = class extends BranchDocumentElement {
1139
+ constructor(content, props) {
1140
+ super(content, props);
1141
+ }
1142
+ toDocFrame() {
1143
+ var _a, _b;
1144
+ return Proto27.Node.create({
1145
+ loop: Proto27.ProtoLoop.create({
1146
+ path: (_a = this.props) == null ? void 0 : _a.path,
1147
+ uuid: (_b = this.props) == null ? void 0 : _b.uuid
1148
+ }),
1149
+ children: this.childrenToDocFrame()
1150
+ });
1151
+ }
1152
+ };
1153
+
1154
+ // src/Content/LoopEntry/index.ts
1155
+ import Proto28 from "docframe-types";
1156
+ var LoopEntry = class extends BranchDocumentElement {
1157
+ constructor(content, props) {
1158
+ super(content, props);
1159
+ }
1160
+ toDocFrame() {
1161
+ var _a, _b, _c;
1162
+ return Proto28.Node.create({
1163
+ loopEntry: Proto28.ProtoLoopEntry.create({
1164
+ path: (_a = this.props) == null ? void 0 : _a.path,
1165
+ index: (_b = this.props) == null ? void 0 : _b.index,
1166
+ uuid: (_c = this.props) == null ? void 0 : _c.uuid
1167
+ }),
1168
+ children: this.childrenToDocFrame()
775
1169
  });
776
1170
  }
777
1171
  };
778
1172
 
779
1173
  // src/Content/Pagebreak/index.ts
780
- import Proto18 from "docframe-types";
1174
+ import Proto29 from "docframe-types";
781
1175
  var Pagebreak = class extends DocumentElement {
782
1176
  toDocFrame() {
783
- return Proto18.Node.create({
784
- newPage: Proto18.ProtoNewPage.create({})
1177
+ return Proto29.Node.create({
1178
+ newPage: Proto29.ProtoNewPage.create({})
1179
+ });
1180
+ }
1181
+ };
1182
+
1183
+ // src/Content/PageCondition/index.ts
1184
+ import Proto30 from "docframe-types";
1185
+ var PageCondition = class extends BranchDocumentElement {
1186
+ constructor(content, props) {
1187
+ super(content, props);
1188
+ }
1189
+ toDocFrame() {
1190
+ var _a, _b;
1191
+ return Proto30.Node.create({
1192
+ pageCondition: Proto30.ProtoPageCondition.create({
1193
+ uuid: (_a = this.props) == null ? void 0 : _a.uuid,
1194
+ code: (_b = this.props) == null ? void 0 : _b.code
1195
+ }),
1196
+ children: this.childrenToDocFrame()
785
1197
  });
786
1198
  }
787
1199
  };
788
1200
 
789
1201
  // src/Content/Paragraph/index.ts
790
- import Proto19 from "docframe-types";
1202
+ import Proto31 from "docframe-types";
791
1203
  var Paragraph = class extends BranchDocumentElement {
792
1204
  constructor(content, paragraphFormatName, overwrite) {
793
1205
  var _a;
@@ -802,62 +1214,243 @@ var Paragraph = class extends BranchDocumentElement {
802
1214
  par.overwrite = this.props.overwrite.toDocFrame();
803
1215
  }
804
1216
  if (this.props.paragraphFormatName) {
805
- par.format = Proto19.ProtoParagraphFormat.create({
806
- name: Proto19.ProtoBoxedString.create({
1217
+ par.format = Proto31.ProtoParagraphFormat.create({
1218
+ name: Proto31.ProtoBoxedString.create({
807
1219
  isNull: false,
808
1220
  value: this.props.paragraphFormatName
809
1221
  })
810
1222
  });
811
1223
  }
812
- return Proto19.Node.create({
813
- paragraph: Proto19.ProtoParagraph.create(par),
1224
+ return Proto31.Node.create({
1225
+ paragraph: Proto31.ProtoParagraph.create(par),
1226
+ children: this.childrenToDocFrame()
1227
+ });
1228
+ }
1229
+ };
1230
+
1231
+ // src/Content/Rule/index.ts
1232
+ import Proto32 from "docframe-types";
1233
+ function ruleStyleToDocFrame(style) {
1234
+ switch (style) {
1235
+ case "solid":
1236
+ return Proto32.ProtoRuleStyle.SOLID;
1237
+ case "sparse-shading":
1238
+ return Proto32.ProtoRuleStyle.SPARSE_SHADING;
1239
+ case "medium-shading":
1240
+ return Proto32.ProtoRuleStyle.MEDIUM_SHADING;
1241
+ case "dense-shading":
1242
+ return Proto32.ProtoRuleStyle.DENSE_SHADING;
1243
+ case "light-dotted":
1244
+ return Proto32.ProtoRuleStyle.LIGHT_DOTTED;
1245
+ case "medium-dotted":
1246
+ return Proto32.ProtoRuleStyle.MEDIUM_DOTTED;
1247
+ case "heavy-dotted":
1248
+ return Proto32.ProtoRuleStyle.HEAVY_DOTTED;
1249
+ case "light-dashed":
1250
+ return Proto32.ProtoRuleStyle.LIGHT_DASHED;
1251
+ case "medium-dashed":
1252
+ return Proto32.ProtoRuleStyle.MEDIUM_DASHED;
1253
+ case "heavy-dashed":
1254
+ return Proto32.ProtoRuleStyle.HEAVY_DASHED;
1255
+ case "dash-pattern":
1256
+ return Proto32.ProtoRuleStyle.DASH_PATTERN;
1257
+ case "double":
1258
+ return Proto32.ProtoRuleStyle.DOUBLE;
1259
+ default:
1260
+ throw new Error(`Unknown rule style: ${style}`);
1261
+ }
1262
+ }
1263
+ function ruleModeToDocFrame(mode) {
1264
+ switch (mode) {
1265
+ case "normal":
1266
+ return Proto32.ProtoRuleMode.NORMAL;
1267
+ case "boundary":
1268
+ return Proto32.ProtoRuleMode.BOUNDARY;
1269
+ default:
1270
+ throw new Error(`Unknown rule mode: ${mode}`);
1271
+ }
1272
+ }
1273
+ var Rule = class extends DocumentElement {
1274
+ constructor(props) {
1275
+ super();
1276
+ this.props = props;
1277
+ }
1278
+ toDocFrame() {
1279
+ var _a, _b, _c, _d, _e, _f, _g;
1280
+ const rule = {
1281
+ xOffset: (_a = this.props.xOffset) == null ? void 0 : _a.toDocFrame(),
1282
+ yOffset: (_b = this.props.yOffset) == null ? void 0 : _b.toDocFrame(),
1283
+ width: (_c = this.props.width) == null ? void 0 : _c.toDocFrame(),
1284
+ thickness: (_d = this.props.thickness) == null ? void 0 : _d.toDocFrame(),
1285
+ rotation: this.props.rotation,
1286
+ color: (_e = this.props.color) == null ? void 0 : _e.toDocFrame()
1287
+ };
1288
+ if (this.props.style) {
1289
+ rule.style = ruleStyleToDocFrame(this.props.style);
1290
+ }
1291
+ if (this.props.mode) {
1292
+ rule.mode = ruleModeToDocFrame(this.props.mode);
1293
+ }
1294
+ if (this.props.boundaries) {
1295
+ rule.boundaries = Proto32.ProtoRuleBoundaries.create({
1296
+ start: (_f = this.props.boundaries.start) == null ? void 0 : _f.toDocFrame(),
1297
+ end: (_g = this.props.boundaries.end) == null ? void 0 : _g.toDocFrame()
1298
+ });
1299
+ }
1300
+ return Proto32.Node.create({
1301
+ rule: Proto32.ProtoRule.create(rule)
1302
+ });
1303
+ }
1304
+ };
1305
+
1306
+ // src/Content/Section/index.ts
1307
+ import Proto33 from "docframe-types";
1308
+ var Section = class extends BranchDocumentElement {
1309
+ constructor(content, props) {
1310
+ super(content, props);
1311
+ }
1312
+ toDocFrame() {
1313
+ var _a, _b;
1314
+ return Proto33.Node.create({
1315
+ section: Proto33.ProtoSection.create({
1316
+ uuid: (_a = this.props) == null ? void 0 : _a.uuid,
1317
+ cDefUuid: (_b = this.props) == null ? void 0 : _b.cDefUuid
1318
+ }),
1319
+ children: this.childrenToDocFrame()
1320
+ });
1321
+ }
1322
+ };
1323
+
1324
+ // src/Content/Selection/index.ts
1325
+ import Proto34 from "docframe-types";
1326
+ var Selection = class extends BranchDocumentElement {
1327
+ constructor(content, props) {
1328
+ super(content, props);
1329
+ }
1330
+ toDocFrame() {
1331
+ var _a, _b, _c, _d, _e, _f;
1332
+ return Proto34.Node.create({
1333
+ selection: Proto34.ProtoSelection.create({
1334
+ uuid: (_a = this.props) == null ? void 0 : _a.uuid,
1335
+ internalName: (_b = this.props) == null ? void 0 : _b.internalName,
1336
+ name: (_c = this.props) == null ? void 0 : _c.name,
1337
+ multi: (_d = this.props) == null ? void 0 : _d.multi,
1338
+ min: (_e = this.props) == null ? void 0 : _e.min,
1339
+ max: (_f = this.props) == null ? void 0 : _f.max
1340
+ }),
1341
+ children: this.childrenToDocFrame()
1342
+ });
1343
+ }
1344
+ };
1345
+
1346
+ // src/Content/SelectionEntry/index.ts
1347
+ import Proto35 from "docframe-types";
1348
+ var SelectionEntry = class extends BranchDocumentElement {
1349
+ constructor(content, props) {
1350
+ super(content, props);
1351
+ }
1352
+ toDocFrame() {
1353
+ var _a, _b, _c, _d;
1354
+ return Proto35.Node.create({
1355
+ selectionEntry: Proto35.ProtoSelectionEntry.create({
1356
+ uuid: (_a = this.props) == null ? void 0 : _a.uuid,
1357
+ internalName: (_b = this.props) == null ? void 0 : _b.internalName,
1358
+ name: (_c = this.props) == null ? void 0 : _c.name,
1359
+ selected: (_d = this.props) == null ? void 0 : _d.selected
1360
+ }),
814
1361
  children: this.childrenToDocFrame()
815
1362
  });
816
1363
  }
817
1364
  };
818
1365
 
819
1366
  // src/Content/Span/index.ts
820
- import Proto20 from "docframe-types";
1367
+ import Proto36 from "docframe-types";
821
1368
  var Span = class extends BranchDocumentElement {
822
1369
  constructor(content, props) {
823
1370
  super(content, props || {});
824
1371
  }
825
1372
  toDocFrame() {
826
- var _a, _b, _c, _d;
1373
+ var _a, _b, _c, _d, _e, _f, _g, _h;
827
1374
  let bold = void 0;
828
1375
  if (((_a = this.props) == null ? void 0 : _a.bold) !== void 0) {
829
- bold = Proto20.ProtoBoxedBool.create({
1376
+ bold = Proto36.ProtoBoxedBool.create({
830
1377
  isNull: false,
831
1378
  value: this.props.bold
832
1379
  });
833
1380
  }
834
1381
  let italic = void 0;
835
1382
  if (((_b = this.props) == null ? void 0 : _b.italic) !== void 0) {
836
- italic = Proto20.ProtoBoxedBool.create({
1383
+ italic = Proto36.ProtoBoxedBool.create({
837
1384
  isNull: false,
838
1385
  value: this.props.italic
839
1386
  });
840
1387
  }
841
1388
  let underline = void 0;
842
1389
  if (((_c = this.props) == null ? void 0 : _c.underline) !== void 0) {
843
- underline = Proto20.ProtoBoxedBool.create({
1390
+ underline = Proto36.ProtoBoxedBool.create({
844
1391
  isNull: false,
845
1392
  value: this.props.underline
846
1393
  });
847
1394
  }
848
1395
  let strikethrough = void 0;
849
1396
  if (((_d = this.props) == null ? void 0 : _d.strikethrough) !== void 0) {
850
- strikethrough = Proto20.ProtoBoxedBool.create({
1397
+ strikethrough = Proto36.ProtoBoxedBool.create({
851
1398
  isNull: false,
852
1399
  value: this.props.strikethrough
853
1400
  });
854
1401
  }
855
- return Proto20.Node.create({
856
- span: Proto20.ProtoSpan.create({
1402
+ let subscript = void 0;
1403
+ if (((_e = this.props) == null ? void 0 : _e.subscript) !== void 0) {
1404
+ subscript = Proto36.ProtoBoxedBool.create({
1405
+ isNull: false,
1406
+ value: this.props.subscript
1407
+ });
1408
+ }
1409
+ let superscript = void 0;
1410
+ if (((_f = this.props) == null ? void 0 : _f.superscript) !== void 0) {
1411
+ superscript = Proto36.ProtoBoxedBool.create({
1412
+ isNull: false,
1413
+ value: this.props.superscript
1414
+ });
1415
+ }
1416
+ return Proto36.Node.create({
1417
+ span: Proto36.ProtoSpan.create({
857
1418
  bold,
858
1419
  italic,
859
1420
  underline,
860
- strikethrough
1421
+ strikethrough,
1422
+ color: (_h = (_g = this.props) == null ? void 0 : _g.color) == null ? void 0 : _h.toDocFrame(),
1423
+ subscript,
1424
+ superscript
1425
+ }),
1426
+ children: this.childrenToDocFrame()
1427
+ });
1428
+ }
1429
+ };
1430
+
1431
+ // src/Content/SubTotal/index.ts
1432
+ import Proto37 from "docframe-types";
1433
+ function subTotalPositionToDocFrame(pos) {
1434
+ switch (pos) {
1435
+ case "above-footer":
1436
+ return Proto37.ProtoSubTotalPosition.POSITION_ABOVE_FOOTER;
1437
+ case "below-content":
1438
+ return Proto37.ProtoSubTotalPosition.POSITION_BELOW_CONTENT;
1439
+ default:
1440
+ throw new Error(`Unknown sub total position: ${pos}`);
1441
+ }
1442
+ }
1443
+ var SubTotal = class extends BranchDocumentElement {
1444
+ constructor(content, props) {
1445
+ super(content, props);
1446
+ }
1447
+ toDocFrame() {
1448
+ var _a, _b, _c, _d;
1449
+ return Proto37.Node.create({
1450
+ subTotal: Proto37.ProtoSubTotal.create({
1451
+ applyImmediate: (_a = this.props) == null ? void 0 : _a.applyImmediate,
1452
+ position: ((_b = this.props) == null ? void 0 : _b.position) ? subTotalPositionToDocFrame(this.props.position) : void 0,
1453
+ height: (_d = (_c = this.props) == null ? void 0 : _c.height) == null ? void 0 : _d.toDocFrame()
861
1454
  }),
862
1455
  children: this.childrenToDocFrame()
863
1456
  });
@@ -865,7 +1458,7 @@ var Span = class extends BranchDocumentElement {
865
1458
  };
866
1459
 
867
1460
  // src/Content/Table/index.ts
868
- import Proto21 from "docframe-types";
1461
+ import Proto38 from "docframe-types";
869
1462
  var Table = class extends BranchDocumentElement {
870
1463
  constructor(content, props) {
871
1464
  super(content, props || {});
@@ -876,16 +1469,23 @@ var Table = class extends BranchDocumentElement {
876
1469
  toDocFrame() {
877
1470
  var _a, _b;
878
1471
  const props = this.props;
879
- return Proto21.Node.create({
880
- table: Proto21.ProtoTable.create({
881
- settings: Proto21.ProtoTableSettings.create({
882
- width: (_a = props.width) == null ? void 0 : _a.toDocFrame(),
883
- leftMeasure: Proto21.ProtoBoxedBool.create({
884
- isNull: false,
885
- value: false
886
- }),
887
- xOffset: (_b = props.xOffset) == null ? void 0 : _b.toDocFrame()
888
- })
1472
+ const settings = {
1473
+ width: (_a = props.width) == null ? void 0 : _a.toDocFrame(),
1474
+ xOffset: (_b = props.xOffset) == null ? void 0 : _b.toDocFrame(),
1475
+ leftMeasure: Proto38.ProtoBoxedBool.create({
1476
+ isNull: false,
1477
+ value: props.leftMeasure ?? false
1478
+ })
1479
+ };
1480
+ if (props.repeatHeader !== void 0) {
1481
+ settings.repeatHeader = Proto38.ProtoBoxedUint32.create({
1482
+ isNull: false,
1483
+ value: props.repeatHeader
1484
+ });
1485
+ }
1486
+ return Proto38.Node.create({
1487
+ table: Proto38.ProtoTable.create({
1488
+ settings: Proto38.ProtoTableSettings.create(settings)
889
1489
  }),
890
1490
  children: this.childrenToDocFrame()
891
1491
  });
@@ -893,7 +1493,7 @@ var Table = class extends BranchDocumentElement {
893
1493
  };
894
1494
 
895
1495
  // src/Content/TableCell/index.ts
896
- import Proto22 from "docframe-types";
1496
+ import Proto39 from "docframe-types";
897
1497
  var TableCell = class extends BranchDocumentElement {
898
1498
  constructor(content, props) {
899
1499
  super(content, props || {});
@@ -901,23 +1501,53 @@ var TableCell = class extends BranchDocumentElement {
901
1501
  toDocFrame() {
902
1502
  var _a, _b, _c, _d, _e, _f, _g;
903
1503
  const props = this.props;
904
- return Proto22.Node.create({
905
- tableCell: Proto22.ProtoTableCell.create({
906
- settings: Proto22.ProtoTableCellSettings.create({
907
- align: Proto22.ProtoBoxedHorizontalAlignment.create({
908
- isNull: false,
909
- value: ((_a = props.alignment) == null ? void 0 : _a.toDocFrame()) || Proto22.ProtoHorizontalAlignment.ALIGN_LEFT
910
- }),
911
- backgroundColor: (_b = props.backgroundColor) == null ? void 0 : _b.toDocFrame(),
912
- border: (_c = props.border) == null ? void 0 : _c.toDocFrame(),
913
- margin: (_d = props.margin) == null ? void 0 : _d.toDocFrame(),
914
- padding: (_e = props.padding) == null ? void 0 : _e.toDocFrame(),
915
- valign: Proto22.ProtoBoxedVerticalAlignment.create({
916
- isNull: false,
917
- value: ((_f = props.verticalAlignment) == null ? void 0 : _f.toDocFrame()) || Proto22.ProtoVerticalAlignment.TOP
918
- }),
919
- width: (_g = props.width) == null ? void 0 : _g.toDocFrame()
920
- })
1504
+ const settings = {
1505
+ align: Proto39.ProtoBoxedHorizontalAlignment.create({
1506
+ isNull: false,
1507
+ value: ((_a = props.alignment) == null ? void 0 : _a.toDocFrame()) || Proto39.ProtoHorizontalAlignment.ALIGN_LEFT
1508
+ }),
1509
+ backgroundColor: (_b = props.backgroundColor) == null ? void 0 : _b.toDocFrame(),
1510
+ border: (_c = props.border) == null ? void 0 : _c.toDocFrame(),
1511
+ margin: (_d = props.margin) == null ? void 0 : _d.toDocFrame(),
1512
+ padding: (_e = props.padding) == null ? void 0 : _e.toDocFrame(),
1513
+ valign: Proto39.ProtoBoxedVerticalAlignment.create({
1514
+ isNull: false,
1515
+ value: ((_f = props.verticalAlignment) == null ? void 0 : _f.toDocFrame()) || Proto39.ProtoVerticalAlignment.TOP
1516
+ }),
1517
+ width: (_g = props.width) == null ? void 0 : _g.toDocFrame()
1518
+ };
1519
+ if (props.rotation !== void 0) {
1520
+ settings.rotation = Proto39.ProtoBoxedDouble.create({
1521
+ isNull: false,
1522
+ value: props.rotation
1523
+ });
1524
+ }
1525
+ if (props.defaultParagraphFormat !== void 0) {
1526
+ settings.defaultParagraphFormat = Proto39.ProtoBoxedString.create({
1527
+ isNull: false,
1528
+ value: props.defaultParagraphFormat
1529
+ });
1530
+ }
1531
+ return Proto39.Node.create({
1532
+ tableCell: Proto39.ProtoTableCell.create({
1533
+ settings: Proto39.ProtoTableCellSettings.create(settings)
1534
+ }),
1535
+ children: this.childrenToDocFrame()
1536
+ });
1537
+ }
1538
+ };
1539
+
1540
+ // src/Content/TableContentGroup/index.ts
1541
+ import Proto40 from "docframe-types";
1542
+ var TableContentGroup = class extends BranchDocumentElement {
1543
+ constructor(content, props) {
1544
+ super(content, props);
1545
+ }
1546
+ toDocFrame() {
1547
+ var _a;
1548
+ return Proto40.Node.create({
1549
+ tableContentGroup: Proto40.ProtoTableContentGroup.create({
1550
+ uuid: (_a = this.props) == null ? void 0 : _a.uuid
921
1551
  }),
922
1552
  children: this.childrenToDocFrame()
923
1553
  });
@@ -925,16 +1555,16 @@ var TableCell = class extends BranchDocumentElement {
925
1555
  };
926
1556
 
927
1557
  // src/Content/TableRow/index.ts
928
- import Proto23 from "docframe-types";
1558
+ import Proto41 from "docframe-types";
929
1559
  var TableRow = class extends BranchDocumentElement {
930
1560
  constructor(content, props) {
931
1561
  super(content, props || {});
932
1562
  }
933
1563
  toDocFrame() {
934
1564
  var _a;
935
- return Proto23.Node.create({
936
- tableRow: Proto23.ProtoTableRow.create({
937
- settings: Proto23.ProtoTableRowSettings.create({
1565
+ return Proto41.Node.create({
1566
+ tableRow: Proto41.ProtoTableRow.create({
1567
+ settings: Proto41.ProtoTableRowSettings.create({
938
1568
  minHeight: (_a = this.props.minHeight) == null ? void 0 : _a.toDocFrame()
939
1569
  })
940
1570
  }),
@@ -943,30 +1573,128 @@ var TableRow = class extends BranchDocumentElement {
943
1573
  }
944
1574
  };
945
1575
 
1576
+ // src/Content/Tag/index.ts
1577
+ import Proto42 from "docframe-types";
1578
+ var Tag = class extends DocumentElement {
1579
+ constructor(props) {
1580
+ super();
1581
+ this.props = props;
1582
+ }
1583
+ toDocFrame() {
1584
+ return Proto42.Node.create({
1585
+ tag: Proto42.ProtoTag.create({
1586
+ name: this.props.name,
1587
+ uuid: this.props.uuid,
1588
+ params: this.props.params,
1589
+ nameCode: this.props.nameCode,
1590
+ codeMode: this.props.codeMode
1591
+ })
1592
+ });
1593
+ }
1594
+ };
1595
+
1596
+ // src/Content/Variable/index.ts
1597
+ import Proto43 from "docframe-types";
1598
+ function specialTypeToDocFrame(type) {
1599
+ switch (type) {
1600
+ case "table-number":
1601
+ return Proto43.ProtoVariableSpecialType.TABLE_NUMBER;
1602
+ case "doc-page-count":
1603
+ return Proto43.ProtoVariableSpecialType.DOC_PAGE_COUNT;
1604
+ case "doc-cur-page":
1605
+ return Proto43.ProtoVariableSpecialType.DOC_CUR_PAGE;
1606
+ case "cur-page":
1607
+ return Proto43.ProtoVariableSpecialType.CUR_PAGE;
1608
+ case "page-count":
1609
+ return Proto43.ProtoVariableSpecialType.PAGE_COUNT;
1610
+ case "prev-page":
1611
+ return Proto43.ProtoVariableSpecialType.PREV_PAGE;
1612
+ case "section-page":
1613
+ return Proto43.ProtoVariableSpecialType.SECTION_PAGE;
1614
+ case "updated-at":
1615
+ return Proto43.ProtoVariableSpecialType.UPDATED_AT;
1616
+ case "generated-at":
1617
+ return Proto43.ProtoVariableSpecialType.GENERATED_AT;
1618
+ default:
1619
+ throw new Error(`Unknown variable special type: ${type}`);
1620
+ }
1621
+ }
1622
+ var Variable = class extends DocumentElement {
1623
+ constructor(props) {
1624
+ super();
1625
+ this.props = props;
1626
+ }
1627
+ toDocFrame() {
1628
+ return Proto43.Node.create({
1629
+ variable: Proto43.ProtoVariable.create({
1630
+ path: this.props.path,
1631
+ content: this.props.content,
1632
+ formatUuid: this.props.formatUuid,
1633
+ specialType: this.props.specialType ? specialTypeToDocFrame(this.props.specialType) : void 0,
1634
+ uuid: this.props.uuid
1635
+ })
1636
+ });
1637
+ }
1638
+ };
1639
+
1640
+ // src/Content/WsArea/index.ts
1641
+ import Proto44 from "docframe-types";
1642
+ var WsArea = class extends BranchDocumentElement {
1643
+ constructor(content) {
1644
+ super(content);
1645
+ }
1646
+ toDocFrame() {
1647
+ return Proto44.Node.create({
1648
+ wsArea: Proto44.ProtoWsArea.create({}),
1649
+ children: this.childrenToDocFrame()
1650
+ });
1651
+ }
1652
+ };
1653
+
946
1654
  // src/Content/index.ts
947
1655
  var Content_default = {
1656
+ AdjustHorizontally,
1657
+ AdvancedIllustrationArea,
948
1658
  Barcode,
1659
+ CarryOver,
949
1660
  ColumnDefinition,
950
1661
  ColumnPosition,
1662
+ Condition,
951
1663
  Directory,
952
1664
  Document,
953
1665
  Footer,
954
1666
  Formatted,
955
1667
  Header,
1668
+ Image,
1669
+ Indentation,
956
1670
  Linebreak,
1671
+ Link,
1672
+ Loop,
1673
+ LoopEntry,
957
1674
  Pagebreak,
1675
+ PageCondition,
958
1676
  PageDefinition,
959
1677
  Paragraph,
1678
+ Rule,
1679
+ Section,
1680
+ Selection,
1681
+ SelectionEntry,
960
1682
  SpaceVertically,
961
1683
  Span,
1684
+ SubTotal,
962
1685
  Table,
963
1686
  TableCell,
1687
+ TableContentGroup,
964
1688
  TableRow,
965
- Text
1689
+ Tag,
1690
+ Text,
1691
+ Variable,
1692
+ WsArea
966
1693
  };
967
1694
 
968
1695
  // src/index.ts
969
1696
  var index_default = {
1697
+ Alignment,
970
1698
  Border: {
971
1699
  Border,
972
1700
  SideBorders