json2pptx-schema 0.1.1 → 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.mjs CHANGED
@@ -91,6 +91,118 @@ function migrateSlideType(type) {
91
91
  const normalized = type.trim().toLowerCase();
92
92
  return LEGACY_SLIDE_TYPE_MAP[normalized] ?? type;
93
93
  }
94
+ function toFiniteNumber(value) {
95
+ if (typeof value === "number" && Number.isFinite(value)) return value;
96
+ if (typeof value !== "string") return void 0;
97
+ const trimmed = value.trim();
98
+ if (!trimmed) return void 0;
99
+ const numeric = Number.parseFloat(trimmed);
100
+ return Number.isFinite(numeric) ? numeric : void 0;
101
+ }
102
+ function normalizeGradientType(value) {
103
+ if (typeof value !== "string" || !value.trim()) return "linear";
104
+ return value === "line" ? "linear" : value;
105
+ }
106
+ function normalizeGradientStopPosition(value) {
107
+ const numeric = toFiniteNumber(value);
108
+ if (numeric === void 0) return 0;
109
+ if (typeof value === "string" && value.trim().endsWith("%")) {
110
+ return numeric;
111
+ }
112
+ if (numeric > 1e3) return numeric / 1e3;
113
+ if (numeric > 100) return numeric / 1e3;
114
+ return numeric;
115
+ }
116
+ function migrateGradient(value) {
117
+ if (!isRecord(value)) return value;
118
+ const gradient = cloneValue(value);
119
+ const sourceColors = Array.isArray(gradient.colors) ? gradient.colors : [];
120
+ const rotate = toFiniteNumber(gradient.rotate ?? gradient.rot) ?? 0;
121
+ gradient.type = normalizeGradientType(gradient.type ?? gradient.path);
122
+ gradient.rotate = rotate;
123
+ gradient.colors = sourceColors.map((stop) => {
124
+ if (!isRecord(stop)) return stop;
125
+ const nextStop = cloneValue(stop);
126
+ nextStop.pos = normalizeGradientStopPosition(nextStop.pos);
127
+ return nextStop;
128
+ });
129
+ delete gradient.rot;
130
+ delete gradient.path;
131
+ return gradient;
132
+ }
133
+ function migrateFill(fill, options = {}) {
134
+ if (isRecord(options.gradient)) {
135
+ return {
136
+ type: "gradient",
137
+ gradient: migrateGradient(options.gradient)
138
+ };
139
+ }
140
+ if (typeof options.pattern === "string" && options.pattern.trim()) {
141
+ return {
142
+ type: "image",
143
+ src: options.pattern
144
+ };
145
+ }
146
+ if (typeof fill === "string") {
147
+ if (!fill.trim()) return void 0;
148
+ return {
149
+ type: "solid",
150
+ color: fill
151
+ };
152
+ }
153
+ if (!isRecord(fill)) {
154
+ return fill;
155
+ }
156
+ if (fill.type === "color" && typeof fill.value === "string") {
157
+ return {
158
+ type: "solid",
159
+ color: fill.value
160
+ };
161
+ }
162
+ if (isRecord(fill.gradient)) {
163
+ return {
164
+ type: "gradient",
165
+ gradient: migrateGradient(fill.gradient)
166
+ };
167
+ }
168
+ if (fill.type === "solid" || fill.type === void 0 && typeof fill.color === "string") {
169
+ return {
170
+ ...fill,
171
+ type: "solid",
172
+ color: fill.color
173
+ };
174
+ }
175
+ if (fill.type === "gradient") {
176
+ return {
177
+ type: "gradient",
178
+ gradient: migrateGradient(fill.gradient ?? fill.value ?? fill)
179
+ };
180
+ }
181
+ if (fill.type === "image" || fill.type === "pattern" || typeof fill.src === "string" || isRecord(fill.value)) {
182
+ const imageValue = isRecord(fill.value) ? fill.value : void 0;
183
+ const src = typeof fill.src === "string" ? fill.src : typeof imageValue?.picBase64 === "string" ? imageValue.picBase64 : void 0;
184
+ const opacity = toFiniteNumber(fill.opacity ?? imageValue?.opacity);
185
+ if (src) {
186
+ return {
187
+ type: "image",
188
+ src,
189
+ ...opacity === void 0 ? {} : { opacity }
190
+ };
191
+ }
192
+ }
193
+ return fill;
194
+ }
195
+ function migrateElement(element) {
196
+ if (!isRecord(element)) return element;
197
+ const nextElement = cloneValue(element);
198
+ nextElement.fill = migrateFill(nextElement.fill, {
199
+ gradient: nextElement.gradient,
200
+ pattern: nextElement.pattern
201
+ });
202
+ delete nextElement.gradient;
203
+ delete nextElement.pattern;
204
+ return nextElement;
205
+ }
94
206
  function migrateDocument(input, toVersion = DEFAULT_SCHEMA_VERSION) {
95
207
  if (!isRecord(input)) return input;
96
208
  const migrated = cloneValue(input);
@@ -117,6 +229,10 @@ function migrateDocument(input, toVersion = DEFAULT_SCHEMA_VERSION) {
117
229
  if (!isRecord(slide)) return slide;
118
230
  const nextSlide = cloneValue(slide);
119
231
  nextSlide.type = migrateSlideType(nextSlide.type);
232
+ nextSlide.background = migrateFill(nextSlide.background);
233
+ if (Array.isArray(nextSlide.elements)) {
234
+ nextSlide.elements = nextSlide.elements.map((element) => migrateElement(element));
235
+ }
120
236
  return nextSlide;
121
237
  });
122
238
  }
@@ -124,6 +240,7 @@ function migrateDocument(input, toVersion = DEFAULT_SCHEMA_VERSION) {
124
240
  }
125
241
 
126
242
  // runtime/normalize.ts
243
+ var TRANSPARENT_FILL = "rgba(255,255,255,0)";
127
244
  function isRecord2(value) {
128
245
  return typeof value === "object" && value !== null && !Array.isArray(value);
129
246
  }
@@ -139,6 +256,9 @@ function asString(value, fallback) {
139
256
  function asNumber(value, fallback) {
140
257
  return typeof value === "number" && Number.isFinite(value) ? value : fallback;
141
258
  }
259
+ function asOptionalNumber(value) {
260
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
261
+ }
142
262
  function asBoolean(value, fallback) {
143
263
  return typeof value === "boolean" ? value : fallback;
144
264
  }
@@ -184,17 +304,58 @@ function normalizeTheme(value) {
184
304
  outline: normalizeOutline(source.outline)
185
305
  };
186
306
  }
187
- function normalizeBackground(value, fallbackColor) {
307
+ function normalizeGradient(value) {
188
308
  if (!isRecord2(value)) return void 0;
189
- const type = typeof value.type === "string" && value.type.trim().length > 0 ? value.type : "solid";
190
- const normalized = {
309
+ const colors = Array.isArray(value.colors) ? value.colors.filter((stop) => isRecord2(stop)).map((stop) => ({
310
+ ...stop,
311
+ pos: asNumber(stop.pos, 0),
312
+ color: asString(stop.color, "#000000")
313
+ })) : [];
314
+ return {
191
315
  ...value,
192
- type
316
+ type: asString(value.type, "linear"),
317
+ rotate: asNumber(value.rotate, 0),
318
+ colors
193
319
  };
194
- if (type === "solid" && typeof normalized.color !== "string") {
195
- normalized.color = fallbackColor;
320
+ }
321
+ function normalizeFill(value, options = {}) {
322
+ if (!isRecord2(value)) {
323
+ if (!options.required) return void 0;
324
+ return {
325
+ type: "solid",
326
+ color: options.fallbackSolidColor ?? TRANSPARENT_FILL
327
+ };
196
328
  }
197
- return normalized;
329
+ if (value.type === "gradient") {
330
+ return {
331
+ ...value,
332
+ type: "gradient",
333
+ gradient: normalizeGradient(value.gradient) ?? normalizeGradient(void 0) ?? {
334
+ type: "linear",
335
+ rotate: 0,
336
+ colors: [
337
+ { pos: 0, color: options.fallbackSolidColor ?? TRANSPARENT_FILL },
338
+ { pos: 100, color: options.fallbackSolidColor ?? TRANSPARENT_FILL }
339
+ ]
340
+ }
341
+ };
342
+ }
343
+ if (value.type === "image") {
344
+ return {
345
+ ...value,
346
+ type: "image",
347
+ src: asString(value.src, ""),
348
+ ...asOptionalNumber(value.opacity) === void 0 ? {} : { opacity: asOptionalNumber(value.opacity) }
349
+ };
350
+ }
351
+ return {
352
+ ...value,
353
+ type: "solid",
354
+ color: asString(value.color, options.fallbackSolidColor ?? TRANSPARENT_FILL)
355
+ };
356
+ }
357
+ function normalizeBackground(value, fallbackColor) {
358
+ return normalizeFill(value, { fallbackSolidColor: fallbackColor });
198
359
  }
199
360
  function normalizeElement(value, slideIndex, elementIndex, theme) {
200
361
  const fallbackId = `slide-${slideIndex + 1}-element-${elementIndex + 1}`;
@@ -225,6 +386,7 @@ function normalizeElement(value, slideIndex, elementIndex, theme) {
225
386
  content: asString(value.content, ""),
226
387
  defaultColor: asString(value.defaultColor, theme.fontColor || DEFAULT_TEXT_COLOR),
227
388
  defaultFontName: asString(value.defaultFontName, theme.fontName),
389
+ fill: normalizeFill(value.fill),
228
390
  vertical: asBoolean(value.vertical, false)
229
391
  };
230
392
  return textElement;
@@ -239,7 +401,10 @@ function normalizeElement(value, slideIndex, elementIndex, theme) {
239
401
  height,
240
402
  path: asString(value.path, ""),
241
403
  viewBox: asPair(value.viewBox, [width, height]),
242
- fill: asString(value.fill, ""),
404
+ fill: normalizeFill(value.fill, {
405
+ fallbackSolidColor: TRANSPARENT_FILL,
406
+ required: true
407
+ }),
243
408
  fixedRatio: asBoolean(value.fixedRatio, DEFAULT_SHAPE_FIXED_RATIO)
244
409
  };
245
410
  return shapeElement;
@@ -329,18 +494,24 @@ import Ajv from "ajv";
329
494
  // versions/v1/schema.json
330
495
  var schema_default = {
331
496
  $schema: "http://json-schema.org/draft-07/schema#",
332
- $id: "https://json2pptx.dev/schema/v1",
497
+ $id: "https://json2pptx.dev/json2pptx-schema/v1",
333
498
  title: "json2pptx document schema v1",
334
499
  type: "object",
335
- required: ["slides"],
500
+ required: [
501
+ "slides"
502
+ ],
336
503
  properties: {
337
504
  schemaVersion: {
338
505
  const: "1.0.0"
339
506
  },
340
507
  version: {
341
508
  oneOf: [
342
- { type: "string" },
343
- { type: "number" }
509
+ {
510
+ type: "string"
511
+ },
512
+ {
513
+ type: "number"
514
+ }
344
515
  ]
345
516
  },
346
517
  title: {
@@ -368,40 +539,78 @@ var schema_default = {
368
539
  definitions: {
369
540
  shadow: {
370
541
  type: "object",
371
- required: ["h", "v", "blur", "color"],
542
+ required: [
543
+ "h",
544
+ "v",
545
+ "blur",
546
+ "color"
547
+ ],
372
548
  properties: {
373
- h: { type: "number" },
374
- v: { type: "number" },
375
- blur: { type: "number" },
376
- color: { type: "string" }
549
+ h: {
550
+ type: "number"
551
+ },
552
+ v: {
553
+ type: "number"
554
+ },
555
+ blur: {
556
+ type: "number"
557
+ },
558
+ color: {
559
+ type: "string"
560
+ }
377
561
  },
378
562
  additionalProperties: true
379
563
  },
380
564
  outline: {
381
565
  type: "object",
382
- required: ["width", "color", "style"],
566
+ required: [
567
+ "width",
568
+ "color",
569
+ "style"
570
+ ],
383
571
  properties: {
384
- width: { type: "number" },
385
- color: { type: "string" },
386
- style: { type: "string" }
572
+ width: {
573
+ type: "number"
574
+ },
575
+ color: {
576
+ type: "string"
577
+ },
578
+ style: {
579
+ type: "string"
580
+ }
387
581
  },
388
582
  additionalProperties: true
389
583
  },
390
584
  gradientStop: {
391
585
  type: "object",
392
- required: ["pos", "color"],
586
+ required: [
587
+ "pos",
588
+ "color"
589
+ ],
393
590
  properties: {
394
- pos: { type: "number" },
395
- color: { type: "string" }
591
+ pos: {
592
+ type: "number"
593
+ },
594
+ color: {
595
+ type: "string"
596
+ }
396
597
  },
397
598
  additionalProperties: true
398
599
  },
399
600
  gradient: {
400
601
  type: "object",
401
- required: ["type", "rotate", "colors"],
602
+ required: [
603
+ "type",
604
+ "rotate",
605
+ "colors"
606
+ ],
402
607
  properties: {
403
- type: { type: "string" },
404
- rotate: { type: "number" },
608
+ type: {
609
+ type: "string"
610
+ },
611
+ rotate: {
612
+ type: "number"
613
+ },
405
614
  colors: {
406
615
  type: "array",
407
616
  minItems: 2,
@@ -412,18 +621,94 @@ var schema_default = {
412
621
  },
413
622
  additionalProperties: true
414
623
  },
624
+ solidFill: {
625
+ type: "object",
626
+ required: [
627
+ "type",
628
+ "color"
629
+ ],
630
+ properties: {
631
+ type: {
632
+ const: "solid"
633
+ },
634
+ color: {
635
+ type: "string"
636
+ }
637
+ },
638
+ additionalProperties: true
639
+ },
640
+ gradientFill: {
641
+ type: "object",
642
+ required: [
643
+ "type",
644
+ "gradient"
645
+ ],
646
+ properties: {
647
+ type: {
648
+ const: "gradient"
649
+ },
650
+ gradient: {
651
+ $ref: "#/definitions/gradient"
652
+ }
653
+ },
654
+ additionalProperties: true
655
+ },
656
+ imageFill: {
657
+ type: "object",
658
+ required: [
659
+ "type",
660
+ "src"
661
+ ],
662
+ properties: {
663
+ type: {
664
+ const: "image"
665
+ },
666
+ src: {
667
+ type: "string"
668
+ },
669
+ opacity: {
670
+ type: "number"
671
+ }
672
+ },
673
+ additionalProperties: true
674
+ },
675
+ fill: {
676
+ oneOf: [
677
+ {
678
+ $ref: "#/definitions/solidFill"
679
+ },
680
+ {
681
+ $ref: "#/definitions/gradientFill"
682
+ },
683
+ {
684
+ $ref: "#/definitions/imageFill"
685
+ }
686
+ ]
687
+ },
415
688
  theme: {
416
689
  type: "object",
417
690
  properties: {
418
691
  themeColors: {
419
692
  type: "array",
420
- items: { type: "string" }
693
+ items: {
694
+ type: "string"
695
+ }
696
+ },
697
+ fontColor: {
698
+ type: "string"
421
699
  },
422
- fontColor: { type: "string" },
423
- fontName: { type: "string" },
424
- backgroundColor: { type: "string" },
425
- shadow: { $ref: "#/definitions/shadow" },
426
- outline: { $ref: "#/definitions/outline" }
700
+ fontName: {
701
+ type: "string"
702
+ },
703
+ backgroundColor: {
704
+ type: "string"
705
+ },
706
+ shadow: {
707
+ $ref: "#/definitions/shadow"
708
+ },
709
+ outline: {
710
+ $ref: "#/definitions/outline"
711
+ }
427
712
  },
428
713
  additionalProperties: true
429
714
  },
@@ -431,32 +716,55 @@ var schema_default = {
431
716
  type: "array",
432
717
  minItems: 2,
433
718
  maxItems: 2,
434
- items: { type: "number" }
719
+ items: {
720
+ type: "number"
721
+ }
435
722
  },
436
723
  linePoints: {
437
724
  type: "array",
438
725
  minItems: 2,
439
726
  maxItems: 2,
440
- items: { type: "string" }
727
+ items: {
728
+ type: "string"
729
+ }
441
730
  },
442
731
  shapeText: {
443
732
  type: "object",
444
- required: ["content"],
733
+ required: [
734
+ "content"
735
+ ],
445
736
  properties: {
446
- content: { type: "string" },
447
- defaultColor: { type: "string" },
448
- defaultFontName: { type: "string" },
449
- align: { type: "string" },
450
- lineHeight: { type: "number" },
451
- type: { type: "string" }
737
+ content: {
738
+ type: "string"
739
+ },
740
+ defaultColor: {
741
+ type: "string"
742
+ },
743
+ defaultFontName: {
744
+ type: "string"
745
+ },
746
+ align: {
747
+ type: "string"
748
+ },
749
+ lineHeight: {
750
+ type: "number"
751
+ },
752
+ type: {
753
+ type: "string"
754
+ }
452
755
  },
453
756
  additionalProperties: true
454
757
  },
455
758
  clip: {
456
759
  type: "object",
457
- required: ["shape", "range"],
760
+ required: [
761
+ "shape",
762
+ "range"
763
+ ],
458
764
  properties: {
459
- shape: { type: "string" },
765
+ shape: {
766
+ type: "string"
767
+ },
460
768
  range: {
461
769
  type: "array",
462
770
  minItems: 2,
@@ -473,32 +781,52 @@ var schema_default = {
473
781
  properties: {
474
782
  opacity: {
475
783
  oneOf: [
476
- { type: "string" },
477
- { type: "number" }
784
+ {
785
+ type: "string"
786
+ },
787
+ {
788
+ type: "number"
789
+ }
478
790
  ]
479
791
  },
480
792
  grayscale: {
481
793
  oneOf: [
482
- { type: "string" },
483
- { type: "number" }
794
+ {
795
+ type: "string"
796
+ },
797
+ {
798
+ type: "number"
799
+ }
484
800
  ]
485
801
  },
486
802
  blur: {
487
803
  oneOf: [
488
- { type: "string" },
489
- { type: "number" }
804
+ {
805
+ type: "string"
806
+ },
807
+ {
808
+ type: "number"
809
+ }
490
810
  ]
491
811
  },
492
812
  sepia: {
493
813
  oneOf: [
494
- { type: "string" },
495
- { type: "number" }
814
+ {
815
+ type: "string"
816
+ },
817
+ {
818
+ type: "number"
819
+ }
496
820
  ]
497
821
  },
498
822
  saturate: {
499
823
  oneOf: [
500
- { type: "string" },
501
- { type: "number" }
824
+ {
825
+ type: "string"
826
+ },
827
+ {
828
+ type: "number"
829
+ }
502
830
  ]
503
831
  }
504
832
  },
@@ -507,72 +835,154 @@ var schema_default = {
507
835
  tableCellStyle: {
508
836
  type: "object",
509
837
  properties: {
510
- fontname: { type: "string" },
511
- color: { type: "string" },
512
- align: { type: "string" },
513
- fontsize: { type: "string" },
514
- backcolor: { type: "string" }
838
+ fontname: {
839
+ type: "string"
840
+ },
841
+ color: {
842
+ type: "string"
843
+ },
844
+ align: {
845
+ type: "string"
846
+ },
847
+ fontsize: {
848
+ type: "string"
849
+ },
850
+ backcolor: {
851
+ type: "string"
852
+ }
515
853
  },
516
854
  additionalProperties: true
517
855
  },
518
856
  tableCell: {
519
857
  type: "object",
520
858
  properties: {
521
- id: { type: "string" },
522
- colspan: { type: "number" },
523
- rowspan: { type: "number" },
524
- text: { type: "string" },
525
- style: { $ref: "#/definitions/tableCellStyle" }
859
+ id: {
860
+ type: "string"
861
+ },
862
+ colspan: {
863
+ type: "number"
864
+ },
865
+ rowspan: {
866
+ type: "number"
867
+ },
868
+ text: {
869
+ type: "string"
870
+ },
871
+ style: {
872
+ $ref: "#/definitions/tableCellStyle"
873
+ }
526
874
  },
527
875
  additionalProperties: true
528
876
  },
529
877
  element: {
530
878
  type: "object",
531
- required: ["type"],
879
+ required: [
880
+ "type"
881
+ ],
532
882
  properties: {
533
- type: { type: "string" },
534
- id: { type: "string" },
535
- groupId: { type: "string" },
536
- left: { type: "number" },
537
- top: { type: "number" },
538
- width: { type: "number" },
539
- height: { type: "number" },
540
- rotate: { type: "number" },
541
- lock: { type: "boolean" },
542
- opacity: { type: "number" },
543
- flipH: { type: "boolean" },
544
- flipV: { type: "boolean" },
545
- shadow: { $ref: "#/definitions/shadow" },
546
- outline: { $ref: "#/definitions/outline" }
883
+ type: {
884
+ type: "string"
885
+ },
886
+ id: {
887
+ type: "string"
888
+ },
889
+ groupId: {
890
+ type: "string"
891
+ },
892
+ left: {
893
+ type: "number"
894
+ },
895
+ top: {
896
+ type: "number"
897
+ },
898
+ width: {
899
+ type: "number"
900
+ },
901
+ height: {
902
+ type: "number"
903
+ },
904
+ rotate: {
905
+ type: "number"
906
+ },
907
+ lock: {
908
+ type: "boolean"
909
+ },
910
+ opacity: {
911
+ type: "number"
912
+ },
913
+ flipH: {
914
+ type: "boolean"
915
+ },
916
+ flipV: {
917
+ type: "boolean"
918
+ },
919
+ shadow: {
920
+ $ref: "#/definitions/shadow"
921
+ },
922
+ outline: {
923
+ $ref: "#/definitions/outline"
924
+ }
547
925
  },
548
926
  allOf: [
549
927
  {
550
928
  if: {
551
- required: ["type"],
929
+ required: [
930
+ "type"
931
+ ],
552
932
  properties: {
553
- type: { const: "text" }
933
+ type: {
934
+ const: "text"
935
+ }
554
936
  }
555
937
  },
556
938
  then: {
557
- required: ["content", "left", "top", "width", "height"],
939
+ required: [
940
+ "content",
941
+ "left",
942
+ "top",
943
+ "width",
944
+ "height"
945
+ ],
558
946
  properties: {
559
- content: { type: "string" },
560
- defaultColor: { type: "string" },
561
- defaultFontName: { type: "string" },
562
- fill: { type: "string" },
563
- lineHeight: { type: "number" },
564
- paragraphSpace: { type: "number" },
565
- textType: { type: "string" },
566
- vertical: { type: "boolean" },
567
- wordSpace: { type: "number" }
947
+ content: {
948
+ type: "string"
949
+ },
950
+ defaultColor: {
951
+ type: "string"
952
+ },
953
+ defaultFontName: {
954
+ type: "string"
955
+ },
956
+ fill: {
957
+ $ref: "#/definitions/fill"
958
+ },
959
+ lineHeight: {
960
+ type: "number"
961
+ },
962
+ paragraphSpace: {
963
+ type: "number"
964
+ },
965
+ textType: {
966
+ type: "string"
967
+ },
968
+ vertical: {
969
+ type: "boolean"
970
+ },
971
+ wordSpace: {
972
+ type: "number"
973
+ }
568
974
  }
569
975
  }
570
976
  },
571
977
  {
572
978
  if: {
573
- required: ["type"],
979
+ required: [
980
+ "type"
981
+ ],
574
982
  properties: {
575
- type: { const: "shape" }
983
+ type: {
984
+ const: "shape"
985
+ }
576
986
  }
577
987
  },
578
988
  then: {
@@ -586,26 +996,45 @@ var schema_default = {
586
996
  "height"
587
997
  ],
588
998
  properties: {
589
- path: { type: "string" },
590
- viewBox: { $ref: "#/definitions/pair" },
591
- fill: { type: "string" },
592
- fixedRatio: { type: "boolean" },
999
+ path: {
1000
+ type: "string"
1001
+ },
1002
+ viewBox: {
1003
+ $ref: "#/definitions/pair"
1004
+ },
1005
+ fill: {
1006
+ $ref: "#/definitions/fill"
1007
+ },
1008
+ fixedRatio: {
1009
+ type: "boolean"
1010
+ },
593
1011
  keypoints: {
594
1012
  type: "array",
595
- items: { type: "number" }
1013
+ items: {
1014
+ type: "number"
1015
+ }
1016
+ },
1017
+ pathFormula: {
1018
+ type: "string"
596
1019
  },
597
- pathFormula: { type: "string" },
598
- gradient: { $ref: "#/definitions/gradient" },
599
- special: { type: "boolean" },
600
- text: { $ref: "#/definitions/shapeText" }
1020
+ special: {
1021
+ type: "boolean"
1022
+ },
1023
+ text: {
1024
+ $ref: "#/definitions/shapeText"
1025
+ }
601
1026
  }
602
1027
  }
603
1028
  },
604
1029
  {
605
1030
  if: {
606
- required: ["type"],
1031
+ required: [
1032
+ "type"
1033
+ ],
607
1034
  properties: {
608
- type: { const: "line" }
1035
+ type: {
1036
+ const: "line"
1037
+ }
609
1038
  }
610
1039
  },
611
1040
  then: {
@@ -619,49 +1048,98 @@ var schema_default = {
619
1048
  "top"
620
1049
  ],
621
1050
  properties: {
622
- start: { $ref: "#/definitions/pair" },
623
- end: { $ref: "#/definitions/pair" },
624
- points: { $ref: "#/definitions/linePoints" },
625
- broken: { $ref: "#/definitions/pair" },
626
- color: { type: "string" },
627
- style: { type: "string" },
628
- width: { type: "number" }
1051
+ start: {
1052
+ $ref: "#/definitions/pair"
1053
+ },
1054
+ end: {
1055
+ $ref: "#/definitions/pair"
1056
+ },
1057
+ points: {
1058
+ $ref: "#/definitions/linePoints"
1059
+ },
1060
+ broken: {
1061
+ $ref: "#/definitions/pair"
1062
+ },
1063
+ color: {
1064
+ type: "string"
1065
+ },
1066
+ style: {
1067
+ type: "string"
1068
+ },
1069
+ width: {
1070
+ type: "number"
1071
+ }
629
1072
  }
630
1073
  }
631
1074
  },
632
1075
  {
633
1076
  if: {
634
- required: ["type"],
1077
+ required: [
1078
+ "type"
1079
+ ],
635
1080
  properties: {
636
- type: { const: "image" }
1081
+ type: {
1082
+ const: "image"
1083
+ }
637
1084
  }
638
1085
  },
639
1086
  then: {
640
- required: ["src", "left", "top", "width", "height"],
1087
+ required: [
1088
+ "src",
1089
+ "left",
1090
+ "top",
1091
+ "width",
1092
+ "height"
1093
+ ],
641
1094
  properties: {
642
- src: { type: "string" },
643
- fixedRatio: { type: "boolean" },
644
- clip: { $ref: "#/definitions/clip" },
645
- filters: { $ref: "#/definitions/filters" },
646
- imageType: { type: "string" },
647
- radius: { type: "number" },
648
- colorMask: { type: "string" }
1095
+ src: {
1096
+ type: "string"
1097
+ },
1098
+ fixedRatio: {
1099
+ type: "boolean"
1100
+ },
1101
+ clip: {
1102
+ $ref: "#/definitions/clip"
1103
+ },
1104
+ filters: {
1105
+ $ref: "#/definitions/filters"
1106
+ },
1107
+ imageType: {
1108
+ type: "string"
1109
+ },
1110
+ radius: {
1111
+ type: "number"
1112
+ },
1113
+ colorMask: {
1114
+ type: "string"
1115
+ }
649
1116
  }
650
1117
  }
651
1118
  },
652
1119
  {
653
1120
  if: {
654
- required: ["type"],
1121
+ required: [
1122
+ "type"
1123
+ ],
655
1124
  properties: {
656
- type: { const: "table" }
1125
+ type: {
1126
+ const: "table"
1127
+ }
657
1128
  }
658
1129
  },
659
1130
  then: {
660
- required: ["left", "top", "width", "height"],
1131
+ required: [
1132
+ "left",
1133
+ "top",
1134
+ "width",
1135
+ "height"
1136
+ ],
661
1137
  properties: {
662
1138
  colWidths: {
663
1139
  type: "array",
664
- items: { type: "number" }
1140
+ items: {
1141
+ type: "number"
1142
+ }
665
1143
  },
666
1144
  data: {
667
1145
  type: "array",
@@ -672,7 +1150,9 @@ var schema_default = {
672
1150
  }
673
1151
  }
674
1152
  },
675
- cellMinHeight: { type: "number" }
1153
+ cellMinHeight: {
1154
+ type: "number"
1155
+ }
676
1156
  }
677
1157
  }
678
1158
  }
@@ -680,23 +1160,26 @@ var schema_default = {
680
1160
  additionalProperties: true
681
1161
  },
682
1162
  slideBackground: {
683
- type: "object",
684
- properties: {
685
- type: { type: "string" },
686
- color: { type: "string" },
687
- src: { type: "string" },
688
- gradient: { $ref: "#/definitions/gradient" }
689
- },
690
- additionalProperties: true
1163
+ $ref: "#/definitions/fill"
691
1164
  },
692
1165
  slide: {
693
1166
  type: "object",
694
- required: ["elements"],
1167
+ required: [
1168
+ "elements"
1169
+ ],
695
1170
  properties: {
696
- id: { type: "string" },
697
- type: { type: "string" },
698
- remark: { type: "string" },
699
- background: { $ref: "#/definitions/slideBackground" },
1171
+ id: {
1172
+ type: "string"
1173
+ },
1174
+ type: {
1175
+ type: "string"
1176
+ },
1177
+ remark: {
1178
+ type: "string"
1179
+ },
1180
+ background: {
1181
+ $ref: "#/definitions/slideBackground"
1182
+ },
700
1183
  elements: {
701
1184
  type: "array",
702
1185
  items: {