json2pptx-schema 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -143,6 +143,118 @@ function migrateSlideType(type) {
143
143
  const normalized = type.trim().toLowerCase();
144
144
  return LEGACY_SLIDE_TYPE_MAP[normalized] ?? type;
145
145
  }
146
+ function toFiniteNumber(value) {
147
+ if (typeof value === "number" && Number.isFinite(value)) return value;
148
+ if (typeof value !== "string") return void 0;
149
+ const trimmed = value.trim();
150
+ if (!trimmed) return void 0;
151
+ const numeric = Number.parseFloat(trimmed);
152
+ return Number.isFinite(numeric) ? numeric : void 0;
153
+ }
154
+ function normalizeGradientType(value) {
155
+ if (typeof value !== "string" || !value.trim()) return "linear";
156
+ return value === "line" ? "linear" : value;
157
+ }
158
+ function normalizeGradientStopPosition(value) {
159
+ const numeric = toFiniteNumber(value);
160
+ if (numeric === void 0) return 0;
161
+ if (typeof value === "string" && value.trim().endsWith("%")) {
162
+ return numeric;
163
+ }
164
+ if (numeric > 1e3) return numeric / 1e3;
165
+ if (numeric > 100) return numeric / 1e3;
166
+ return numeric;
167
+ }
168
+ function migrateGradient(value) {
169
+ if (!isRecord(value)) return value;
170
+ const gradient = cloneValue(value);
171
+ const sourceColors = Array.isArray(gradient.colors) ? gradient.colors : [];
172
+ const rotate = toFiniteNumber(gradient.rotate ?? gradient.rot) ?? 0;
173
+ gradient.type = normalizeGradientType(gradient.type ?? gradient.path);
174
+ gradient.rotate = rotate;
175
+ gradient.colors = sourceColors.map((stop) => {
176
+ if (!isRecord(stop)) return stop;
177
+ const nextStop = cloneValue(stop);
178
+ nextStop.pos = normalizeGradientStopPosition(nextStop.pos);
179
+ return nextStop;
180
+ });
181
+ delete gradient.rot;
182
+ delete gradient.path;
183
+ return gradient;
184
+ }
185
+ function migrateFill(fill, options = {}) {
186
+ if (isRecord(options.gradient)) {
187
+ return {
188
+ type: "gradient",
189
+ gradient: migrateGradient(options.gradient)
190
+ };
191
+ }
192
+ if (typeof options.pattern === "string" && options.pattern.trim()) {
193
+ return {
194
+ type: "image",
195
+ src: options.pattern
196
+ };
197
+ }
198
+ if (typeof fill === "string") {
199
+ if (!fill.trim()) return void 0;
200
+ return {
201
+ type: "solid",
202
+ color: fill
203
+ };
204
+ }
205
+ if (!isRecord(fill)) {
206
+ return fill;
207
+ }
208
+ if (fill.type === "color" && typeof fill.value === "string") {
209
+ return {
210
+ type: "solid",
211
+ color: fill.value
212
+ };
213
+ }
214
+ if (isRecord(fill.gradient)) {
215
+ return {
216
+ type: "gradient",
217
+ gradient: migrateGradient(fill.gradient)
218
+ };
219
+ }
220
+ if (fill.type === "solid" || fill.type === void 0 && typeof fill.color === "string") {
221
+ return {
222
+ ...fill,
223
+ type: "solid",
224
+ color: fill.color
225
+ };
226
+ }
227
+ if (fill.type === "gradient") {
228
+ return {
229
+ type: "gradient",
230
+ gradient: migrateGradient(fill.gradient ?? fill.value ?? fill)
231
+ };
232
+ }
233
+ if (fill.type === "image" || fill.type === "pattern" || typeof fill.src === "string" || isRecord(fill.value)) {
234
+ const imageValue = isRecord(fill.value) ? fill.value : void 0;
235
+ const src = typeof fill.src === "string" ? fill.src : typeof imageValue?.picBase64 === "string" ? imageValue.picBase64 : void 0;
236
+ const opacity = toFiniteNumber(fill.opacity ?? imageValue?.opacity);
237
+ if (src) {
238
+ return {
239
+ type: "image",
240
+ src,
241
+ ...opacity === void 0 ? {} : { opacity }
242
+ };
243
+ }
244
+ }
245
+ return fill;
246
+ }
247
+ function migrateElement(element) {
248
+ if (!isRecord(element)) return element;
249
+ const nextElement = cloneValue(element);
250
+ nextElement.fill = migrateFill(nextElement.fill, {
251
+ gradient: nextElement.gradient,
252
+ pattern: nextElement.pattern
253
+ });
254
+ delete nextElement.gradient;
255
+ delete nextElement.pattern;
256
+ return nextElement;
257
+ }
146
258
  function migrateDocument(input, toVersion = DEFAULT_SCHEMA_VERSION) {
147
259
  if (!isRecord(input)) return input;
148
260
  const migrated = cloneValue(input);
@@ -169,6 +281,10 @@ function migrateDocument(input, toVersion = DEFAULT_SCHEMA_VERSION) {
169
281
  if (!isRecord(slide)) return slide;
170
282
  const nextSlide = cloneValue(slide);
171
283
  nextSlide.type = migrateSlideType(nextSlide.type);
284
+ nextSlide.background = migrateFill(nextSlide.background);
285
+ if (Array.isArray(nextSlide.elements)) {
286
+ nextSlide.elements = nextSlide.elements.map((element) => migrateElement(element));
287
+ }
172
288
  return nextSlide;
173
289
  });
174
290
  }
@@ -176,6 +292,7 @@ function migrateDocument(input, toVersion = DEFAULT_SCHEMA_VERSION) {
176
292
  }
177
293
 
178
294
  // runtime/normalize.ts
295
+ var TRANSPARENT_FILL = "rgba(255,255,255,0)";
179
296
  function isRecord2(value) {
180
297
  return typeof value === "object" && value !== null && !Array.isArray(value);
181
298
  }
@@ -191,6 +308,9 @@ function asString(value, fallback) {
191
308
  function asNumber(value, fallback) {
192
309
  return typeof value === "number" && Number.isFinite(value) ? value : fallback;
193
310
  }
311
+ function asOptionalNumber(value) {
312
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
313
+ }
194
314
  function asBoolean(value, fallback) {
195
315
  return typeof value === "boolean" ? value : fallback;
196
316
  }
@@ -236,17 +356,58 @@ function normalizeTheme(value) {
236
356
  outline: normalizeOutline(source.outline)
237
357
  };
238
358
  }
239
- function normalizeBackground(value, fallbackColor) {
359
+ function normalizeGradient(value) {
240
360
  if (!isRecord2(value)) return void 0;
241
- const type = typeof value.type === "string" && value.type.trim().length > 0 ? value.type : "solid";
242
- const normalized = {
361
+ const colors = Array.isArray(value.colors) ? value.colors.filter((stop) => isRecord2(stop)).map((stop) => ({
362
+ ...stop,
363
+ pos: asNumber(stop.pos, 0),
364
+ color: asString(stop.color, "#000000")
365
+ })) : [];
366
+ return {
243
367
  ...value,
244
- type
368
+ type: asString(value.type, "linear"),
369
+ rotate: asNumber(value.rotate, 0),
370
+ colors
245
371
  };
246
- if (type === "solid" && typeof normalized.color !== "string") {
247
- normalized.color = fallbackColor;
372
+ }
373
+ function normalizeFill(value, options = {}) {
374
+ if (!isRecord2(value)) {
375
+ if (!options.required) return void 0;
376
+ return {
377
+ type: "solid",
378
+ color: options.fallbackSolidColor ?? TRANSPARENT_FILL
379
+ };
248
380
  }
249
- return normalized;
381
+ if (value.type === "gradient") {
382
+ return {
383
+ ...value,
384
+ type: "gradient",
385
+ gradient: normalizeGradient(value.gradient) ?? normalizeGradient(void 0) ?? {
386
+ type: "linear",
387
+ rotate: 0,
388
+ colors: [
389
+ { pos: 0, color: options.fallbackSolidColor ?? TRANSPARENT_FILL },
390
+ { pos: 100, color: options.fallbackSolidColor ?? TRANSPARENT_FILL }
391
+ ]
392
+ }
393
+ };
394
+ }
395
+ if (value.type === "image") {
396
+ return {
397
+ ...value,
398
+ type: "image",
399
+ src: asString(value.src, ""),
400
+ ...asOptionalNumber(value.opacity) === void 0 ? {} : { opacity: asOptionalNumber(value.opacity) }
401
+ };
402
+ }
403
+ return {
404
+ ...value,
405
+ type: "solid",
406
+ color: asString(value.color, options.fallbackSolidColor ?? TRANSPARENT_FILL)
407
+ };
408
+ }
409
+ function normalizeBackground(value, fallbackColor) {
410
+ return normalizeFill(value, { fallbackSolidColor: fallbackColor });
250
411
  }
251
412
  function normalizeElement(value, slideIndex, elementIndex, theme) {
252
413
  const fallbackId = `slide-${slideIndex + 1}-element-${elementIndex + 1}`;
@@ -277,6 +438,7 @@ function normalizeElement(value, slideIndex, elementIndex, theme) {
277
438
  content: asString(value.content, ""),
278
439
  defaultColor: asString(value.defaultColor, theme.fontColor || DEFAULT_TEXT_COLOR),
279
440
  defaultFontName: asString(value.defaultFontName, theme.fontName),
441
+ fill: normalizeFill(value.fill),
280
442
  vertical: asBoolean(value.vertical, false)
281
443
  };
282
444
  return textElement;
@@ -291,7 +453,10 @@ function normalizeElement(value, slideIndex, elementIndex, theme) {
291
453
  height,
292
454
  path: asString(value.path, ""),
293
455
  viewBox: asPair(value.viewBox, [width, height]),
294
- fill: asString(value.fill, ""),
456
+ fill: normalizeFill(value.fill, {
457
+ fallbackSolidColor: TRANSPARENT_FILL,
458
+ required: true
459
+ }),
295
460
  fixedRatio: asBoolean(value.fixedRatio, DEFAULT_SHAPE_FIXED_RATIO)
296
461
  };
297
462
  return shapeElement;
@@ -381,18 +546,24 @@ var import_ajv = __toESM(require("ajv"));
381
546
  // versions/v1/schema.json
382
547
  var schema_default = {
383
548
  $schema: "http://json-schema.org/draft-07/schema#",
384
- $id: "https://json2pptx.dev/schema/v1",
549
+ $id: "https://json2pptx.dev/json2pptx-schema/v1",
385
550
  title: "json2pptx document schema v1",
386
551
  type: "object",
387
- required: ["slides"],
552
+ required: [
553
+ "slides"
554
+ ],
388
555
  properties: {
389
556
  schemaVersion: {
390
557
  const: "1.0.0"
391
558
  },
392
559
  version: {
393
560
  oneOf: [
394
- { type: "string" },
395
- { type: "number" }
561
+ {
562
+ type: "string"
563
+ },
564
+ {
565
+ type: "number"
566
+ }
396
567
  ]
397
568
  },
398
569
  title: {
@@ -420,40 +591,78 @@ var schema_default = {
420
591
  definitions: {
421
592
  shadow: {
422
593
  type: "object",
423
- required: ["h", "v", "blur", "color"],
594
+ required: [
595
+ "h",
596
+ "v",
597
+ "blur",
598
+ "color"
599
+ ],
424
600
  properties: {
425
- h: { type: "number" },
426
- v: { type: "number" },
427
- blur: { type: "number" },
428
- color: { type: "string" }
601
+ h: {
602
+ type: "number"
603
+ },
604
+ v: {
605
+ type: "number"
606
+ },
607
+ blur: {
608
+ type: "number"
609
+ },
610
+ color: {
611
+ type: "string"
612
+ }
429
613
  },
430
614
  additionalProperties: true
431
615
  },
432
616
  outline: {
433
617
  type: "object",
434
- required: ["width", "color", "style"],
618
+ required: [
619
+ "width",
620
+ "color",
621
+ "style"
622
+ ],
435
623
  properties: {
436
- width: { type: "number" },
437
- color: { type: "string" },
438
- style: { type: "string" }
624
+ width: {
625
+ type: "number"
626
+ },
627
+ color: {
628
+ type: "string"
629
+ },
630
+ style: {
631
+ type: "string"
632
+ }
439
633
  },
440
634
  additionalProperties: true
441
635
  },
442
636
  gradientStop: {
443
637
  type: "object",
444
- required: ["pos", "color"],
638
+ required: [
639
+ "pos",
640
+ "color"
641
+ ],
445
642
  properties: {
446
- pos: { type: "number" },
447
- color: { type: "string" }
643
+ pos: {
644
+ type: "number"
645
+ },
646
+ color: {
647
+ type: "string"
648
+ }
448
649
  },
449
650
  additionalProperties: true
450
651
  },
451
652
  gradient: {
452
653
  type: "object",
453
- required: ["type", "rotate", "colors"],
654
+ required: [
655
+ "type",
656
+ "rotate",
657
+ "colors"
658
+ ],
454
659
  properties: {
455
- type: { type: "string" },
456
- rotate: { type: "number" },
660
+ type: {
661
+ type: "string"
662
+ },
663
+ rotate: {
664
+ type: "number"
665
+ },
457
666
  colors: {
458
667
  type: "array",
459
668
  minItems: 2,
@@ -464,18 +673,94 @@ var schema_default = {
464
673
  },
465
674
  additionalProperties: true
466
675
  },
676
+ solidFill: {
677
+ type: "object",
678
+ required: [
679
+ "type",
680
+ "color"
681
+ ],
682
+ properties: {
683
+ type: {
684
+ const: "solid"
685
+ },
686
+ color: {
687
+ type: "string"
688
+ }
689
+ },
690
+ additionalProperties: true
691
+ },
692
+ gradientFill: {
693
+ type: "object",
694
+ required: [
695
+ "type",
696
+ "gradient"
697
+ ],
698
+ properties: {
699
+ type: {
700
+ const: "gradient"
701
+ },
702
+ gradient: {
703
+ $ref: "#/definitions/gradient"
704
+ }
705
+ },
706
+ additionalProperties: true
707
+ },
708
+ imageFill: {
709
+ type: "object",
710
+ required: [
711
+ "type",
712
+ "src"
713
+ ],
714
+ properties: {
715
+ type: {
716
+ const: "image"
717
+ },
718
+ src: {
719
+ type: "string"
720
+ },
721
+ opacity: {
722
+ type: "number"
723
+ }
724
+ },
725
+ additionalProperties: true
726
+ },
727
+ fill: {
728
+ oneOf: [
729
+ {
730
+ $ref: "#/definitions/solidFill"
731
+ },
732
+ {
733
+ $ref: "#/definitions/gradientFill"
734
+ },
735
+ {
736
+ $ref: "#/definitions/imageFill"
737
+ }
738
+ ]
739
+ },
467
740
  theme: {
468
741
  type: "object",
469
742
  properties: {
470
743
  themeColors: {
471
744
  type: "array",
472
- items: { type: "string" }
745
+ items: {
746
+ type: "string"
747
+ }
748
+ },
749
+ fontColor: {
750
+ type: "string"
473
751
  },
474
- fontColor: { type: "string" },
475
- fontName: { type: "string" },
476
- backgroundColor: { type: "string" },
477
- shadow: { $ref: "#/definitions/shadow" },
478
- outline: { $ref: "#/definitions/outline" }
752
+ fontName: {
753
+ type: "string"
754
+ },
755
+ backgroundColor: {
756
+ type: "string"
757
+ },
758
+ shadow: {
759
+ $ref: "#/definitions/shadow"
760
+ },
761
+ outline: {
762
+ $ref: "#/definitions/outline"
763
+ }
479
764
  },
480
765
  additionalProperties: true
481
766
  },
@@ -483,32 +768,55 @@ var schema_default = {
483
768
  type: "array",
484
769
  minItems: 2,
485
770
  maxItems: 2,
486
- items: { type: "number" }
771
+ items: {
772
+ type: "number"
773
+ }
487
774
  },
488
775
  linePoints: {
489
776
  type: "array",
490
777
  minItems: 2,
491
778
  maxItems: 2,
492
- items: { type: "string" }
779
+ items: {
780
+ type: "string"
781
+ }
493
782
  },
494
783
  shapeText: {
495
784
  type: "object",
496
- required: ["content"],
785
+ required: [
786
+ "content"
787
+ ],
497
788
  properties: {
498
- content: { type: "string" },
499
- defaultColor: { type: "string" },
500
- defaultFontName: { type: "string" },
501
- align: { type: "string" },
502
- lineHeight: { type: "number" },
503
- type: { type: "string" }
789
+ content: {
790
+ type: "string"
791
+ },
792
+ defaultColor: {
793
+ type: "string"
794
+ },
795
+ defaultFontName: {
796
+ type: "string"
797
+ },
798
+ align: {
799
+ type: "string"
800
+ },
801
+ lineHeight: {
802
+ type: "number"
803
+ },
804
+ type: {
805
+ type: "string"
806
+ }
504
807
  },
505
808
  additionalProperties: true
506
809
  },
507
810
  clip: {
508
811
  type: "object",
509
- required: ["shape", "range"],
812
+ required: [
813
+ "shape",
814
+ "range"
815
+ ],
510
816
  properties: {
511
- shape: { type: "string" },
817
+ shape: {
818
+ type: "string"
819
+ },
512
820
  range: {
513
821
  type: "array",
514
822
  minItems: 2,
@@ -525,32 +833,52 @@ var schema_default = {
525
833
  properties: {
526
834
  opacity: {
527
835
  oneOf: [
528
- { type: "string" },
529
- { type: "number" }
836
+ {
837
+ type: "string"
838
+ },
839
+ {
840
+ type: "number"
841
+ }
530
842
  ]
531
843
  },
532
844
  grayscale: {
533
845
  oneOf: [
534
- { type: "string" },
535
- { type: "number" }
846
+ {
847
+ type: "string"
848
+ },
849
+ {
850
+ type: "number"
851
+ }
536
852
  ]
537
853
  },
538
854
  blur: {
539
855
  oneOf: [
540
- { type: "string" },
541
- { type: "number" }
856
+ {
857
+ type: "string"
858
+ },
859
+ {
860
+ type: "number"
861
+ }
542
862
  ]
543
863
  },
544
864
  sepia: {
545
865
  oneOf: [
546
- { type: "string" },
547
- { type: "number" }
866
+ {
867
+ type: "string"
868
+ },
869
+ {
870
+ type: "number"
871
+ }
548
872
  ]
549
873
  },
550
874
  saturate: {
551
875
  oneOf: [
552
- { type: "string" },
553
- { type: "number" }
876
+ {
877
+ type: "string"
878
+ },
879
+ {
880
+ type: "number"
881
+ }
554
882
  ]
555
883
  }
556
884
  },
@@ -559,72 +887,154 @@ var schema_default = {
559
887
  tableCellStyle: {
560
888
  type: "object",
561
889
  properties: {
562
- fontname: { type: "string" },
563
- color: { type: "string" },
564
- align: { type: "string" },
565
- fontsize: { type: "string" },
566
- backcolor: { type: "string" }
890
+ fontname: {
891
+ type: "string"
892
+ },
893
+ color: {
894
+ type: "string"
895
+ },
896
+ align: {
897
+ type: "string"
898
+ },
899
+ fontsize: {
900
+ type: "string"
901
+ },
902
+ backcolor: {
903
+ type: "string"
904
+ }
567
905
  },
568
906
  additionalProperties: true
569
907
  },
570
908
  tableCell: {
571
909
  type: "object",
572
910
  properties: {
573
- id: { type: "string" },
574
- colspan: { type: "number" },
575
- rowspan: { type: "number" },
576
- text: { type: "string" },
577
- style: { $ref: "#/definitions/tableCellStyle" }
911
+ id: {
912
+ type: "string"
913
+ },
914
+ colspan: {
915
+ type: "number"
916
+ },
917
+ rowspan: {
918
+ type: "number"
919
+ },
920
+ text: {
921
+ type: "string"
922
+ },
923
+ style: {
924
+ $ref: "#/definitions/tableCellStyle"
925
+ }
578
926
  },
579
927
  additionalProperties: true
580
928
  },
581
929
  element: {
582
930
  type: "object",
583
- required: ["type"],
931
+ required: [
932
+ "type"
933
+ ],
584
934
  properties: {
585
- type: { type: "string" },
586
- id: { type: "string" },
587
- groupId: { type: "string" },
588
- left: { type: "number" },
589
- top: { type: "number" },
590
- width: { type: "number" },
591
- height: { type: "number" },
592
- rotate: { type: "number" },
593
- lock: { type: "boolean" },
594
- opacity: { type: "number" },
595
- flipH: { type: "boolean" },
596
- flipV: { type: "boolean" },
597
- shadow: { $ref: "#/definitions/shadow" },
598
- outline: { $ref: "#/definitions/outline" }
935
+ type: {
936
+ type: "string"
937
+ },
938
+ id: {
939
+ type: "string"
940
+ },
941
+ groupId: {
942
+ type: "string"
943
+ },
944
+ left: {
945
+ type: "number"
946
+ },
947
+ top: {
948
+ type: "number"
949
+ },
950
+ width: {
951
+ type: "number"
952
+ },
953
+ height: {
954
+ type: "number"
955
+ },
956
+ rotate: {
957
+ type: "number"
958
+ },
959
+ lock: {
960
+ type: "boolean"
961
+ },
962
+ opacity: {
963
+ type: "number"
964
+ },
965
+ flipH: {
966
+ type: "boolean"
967
+ },
968
+ flipV: {
969
+ type: "boolean"
970
+ },
971
+ shadow: {
972
+ $ref: "#/definitions/shadow"
973
+ },
974
+ outline: {
975
+ $ref: "#/definitions/outline"
976
+ }
599
977
  },
600
978
  allOf: [
601
979
  {
602
980
  if: {
603
- required: ["type"],
981
+ required: [
982
+ "type"
983
+ ],
604
984
  properties: {
605
- type: { const: "text" }
985
+ type: {
986
+ const: "text"
987
+ }
606
988
  }
607
989
  },
608
990
  then: {
609
- required: ["content", "left", "top", "width", "height"],
991
+ required: [
992
+ "content",
993
+ "left",
994
+ "top",
995
+ "width",
996
+ "height"
997
+ ],
610
998
  properties: {
611
- content: { type: "string" },
612
- defaultColor: { type: "string" },
613
- defaultFontName: { type: "string" },
614
- fill: { type: "string" },
615
- lineHeight: { type: "number" },
616
- paragraphSpace: { type: "number" },
617
- textType: { type: "string" },
618
- vertical: { type: "boolean" },
619
- wordSpace: { type: "number" }
999
+ content: {
1000
+ type: "string"
1001
+ },
1002
+ defaultColor: {
1003
+ type: "string"
1004
+ },
1005
+ defaultFontName: {
1006
+ type: "string"
1007
+ },
1008
+ fill: {
1009
+ $ref: "#/definitions/fill"
1010
+ },
1011
+ lineHeight: {
1012
+ type: "number"
1013
+ },
1014
+ paragraphSpace: {
1015
+ type: "number"
1016
+ },
1017
+ textType: {
1018
+ type: "string"
1019
+ },
1020
+ vertical: {
1021
+ type: "boolean"
1022
+ },
1023
+ wordSpace: {
1024
+ type: "number"
1025
+ }
620
1026
  }
621
1027
  }
622
1028
  },
623
1029
  {
624
1030
  if: {
625
- required: ["type"],
1031
+ required: [
1032
+ "type"
1033
+ ],
626
1034
  properties: {
627
- type: { const: "shape" }
1035
+ type: {
1036
+ const: "shape"
1037
+ }
628
1038
  }
629
1039
  },
630
1040
  then: {
@@ -638,26 +1048,45 @@ var schema_default = {
638
1048
  "height"
639
1049
  ],
640
1050
  properties: {
641
- path: { type: "string" },
642
- viewBox: { $ref: "#/definitions/pair" },
643
- fill: { type: "string" },
644
- fixedRatio: { type: "boolean" },
1051
+ path: {
1052
+ type: "string"
1053
+ },
1054
+ viewBox: {
1055
+ $ref: "#/definitions/pair"
1056
+ },
1057
+ fill: {
1058
+ $ref: "#/definitions/fill"
1059
+ },
1060
+ fixedRatio: {
1061
+ type: "boolean"
1062
+ },
645
1063
  keypoints: {
646
1064
  type: "array",
647
- items: { type: "number" }
1065
+ items: {
1066
+ type: "number"
1067
+ }
1068
+ },
1069
+ pathFormula: {
1070
+ type: "string"
648
1071
  },
649
- pathFormula: { type: "string" },
650
- gradient: { $ref: "#/definitions/gradient" },
651
- special: { type: "boolean" },
652
- text: { $ref: "#/definitions/shapeText" }
1072
+ special: {
1073
+ type: "boolean"
1074
+ },
1075
+ text: {
1076
+ $ref: "#/definitions/shapeText"
1077
+ }
653
1078
  }
654
1079
  }
655
1080
  },
656
1081
  {
657
1082
  if: {
658
- required: ["type"],
1083
+ required: [
1084
+ "type"
1085
+ ],
659
1086
  properties: {
660
- type: { const: "line" }
1087
+ type: {
1088
+ const: "line"
1089
+ }
661
1090
  }
662
1091
  },
663
1092
  then: {
@@ -671,49 +1100,98 @@ var schema_default = {
671
1100
  "top"
672
1101
  ],
673
1102
  properties: {
674
- start: { $ref: "#/definitions/pair" },
675
- end: { $ref: "#/definitions/pair" },
676
- points: { $ref: "#/definitions/linePoints" },
677
- broken: { $ref: "#/definitions/pair" },
678
- color: { type: "string" },
679
- style: { type: "string" },
680
- width: { type: "number" }
1103
+ start: {
1104
+ $ref: "#/definitions/pair"
1105
+ },
1106
+ end: {
1107
+ $ref: "#/definitions/pair"
1108
+ },
1109
+ points: {
1110
+ $ref: "#/definitions/linePoints"
1111
+ },
1112
+ broken: {
1113
+ $ref: "#/definitions/pair"
1114
+ },
1115
+ color: {
1116
+ type: "string"
1117
+ },
1118
+ style: {
1119
+ type: "string"
1120
+ },
1121
+ width: {
1122
+ type: "number"
1123
+ }
681
1124
  }
682
1125
  }
683
1126
  },
684
1127
  {
685
1128
  if: {
686
- required: ["type"],
1129
+ required: [
1130
+ "type"
1131
+ ],
687
1132
  properties: {
688
- type: { const: "image" }
1133
+ type: {
1134
+ const: "image"
1135
+ }
689
1136
  }
690
1137
  },
691
1138
  then: {
692
- required: ["src", "left", "top", "width", "height"],
1139
+ required: [
1140
+ "src",
1141
+ "left",
1142
+ "top",
1143
+ "width",
1144
+ "height"
1145
+ ],
693
1146
  properties: {
694
- src: { type: "string" },
695
- fixedRatio: { type: "boolean" },
696
- clip: { $ref: "#/definitions/clip" },
697
- filters: { $ref: "#/definitions/filters" },
698
- imageType: { type: "string" },
699
- radius: { type: "number" },
700
- colorMask: { type: "string" }
1147
+ src: {
1148
+ type: "string"
1149
+ },
1150
+ fixedRatio: {
1151
+ type: "boolean"
1152
+ },
1153
+ clip: {
1154
+ $ref: "#/definitions/clip"
1155
+ },
1156
+ filters: {
1157
+ $ref: "#/definitions/filters"
1158
+ },
1159
+ imageType: {
1160
+ type: "string"
1161
+ },
1162
+ radius: {
1163
+ type: "number"
1164
+ },
1165
+ colorMask: {
1166
+ type: "string"
1167
+ }
701
1168
  }
702
1169
  }
703
1170
  },
704
1171
  {
705
1172
  if: {
706
- required: ["type"],
1173
+ required: [
1174
+ "type"
1175
+ ],
707
1176
  properties: {
708
- type: { const: "table" }
1177
+ type: {
1178
+ const: "table"
1179
+ }
709
1180
  }
710
1181
  },
711
1182
  then: {
712
- required: ["left", "top", "width", "height"],
1183
+ required: [
1184
+ "left",
1185
+ "top",
1186
+ "width",
1187
+ "height"
1188
+ ],
713
1189
  properties: {
714
1190
  colWidths: {
715
1191
  type: "array",
716
- items: { type: "number" }
1192
+ items: {
1193
+ type: "number"
1194
+ }
717
1195
  },
718
1196
  data: {
719
1197
  type: "array",
@@ -724,7 +1202,9 @@ var schema_default = {
724
1202
  }
725
1203
  }
726
1204
  },
727
- cellMinHeight: { type: "number" }
1205
+ cellMinHeight: {
1206
+ type: "number"
1207
+ }
728
1208
  }
729
1209
  }
730
1210
  }
@@ -732,23 +1212,26 @@ var schema_default = {
732
1212
  additionalProperties: true
733
1213
  },
734
1214
  slideBackground: {
735
- type: "object",
736
- properties: {
737
- type: { type: "string" },
738
- color: { type: "string" },
739
- src: { type: "string" },
740
- gradient: { $ref: "#/definitions/gradient" }
741
- },
742
- additionalProperties: true
1215
+ $ref: "#/definitions/fill"
743
1216
  },
744
1217
  slide: {
745
1218
  type: "object",
746
- required: ["elements"],
1219
+ required: [
1220
+ "elements"
1221
+ ],
747
1222
  properties: {
748
- id: { type: "string" },
749
- type: { type: "string" },
750
- remark: { type: "string" },
751
- background: { $ref: "#/definitions/slideBackground" },
1223
+ id: {
1224
+ type: "string"
1225
+ },
1226
+ type: {
1227
+ type: "string"
1228
+ },
1229
+ remark: {
1230
+ type: "string"
1231
+ },
1232
+ background: {
1233
+ $ref: "#/definitions/slideBackground"
1234
+ },
752
1235
  elements: {
753
1236
  type: "array",
754
1237
  items: {