cvdl-ts 1.0.23 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,6 @@
1
+
2
+ # CVDL-TS
3
+
4
+ CVDL is a prototype for Tail focusing on resume documents. `cvdl-ts` is the Typescript implementation of the rendering engine for CVDL.
5
+
6
+ Although we expect most users to use the [web-based editor](../cvdl-ts/), we provide a CLI for rendering CVDL documents locally.
package/dist/AnyLayout.js CHANGED
@@ -28,7 +28,7 @@ exports.render = render;
28
28
  const ResumeLayout_1 = require("./ResumeLayout");
29
29
  const fontkit = __importStar(require("fontkit"));
30
30
  const Layout = __importStar(require("./Layout"));
31
- const cartesian = (...a) => a.reduce((a, b) => a.flatMap(d => b.map(e => [d, e].flat())));
31
+ const cartesian = (...a) => a.reduce((a, b) => a.flatMap((d) => b.map((e) => [d, e].flat())));
32
32
  class FontDict {
33
33
  constructor() {
34
34
  this.fonts = new Map();
package/dist/Defaults.js CHANGED
@@ -108,7 +108,7 @@ exports.WorkLayout = new LayoutSchema_1.LayoutSchema("Work Experience", "Work Ex
108
108
  item: "Work Experience",
109
109
  width: Width.percent(100),
110
110
  alignment: "Center",
111
- font: exports.SectionTitleFont
111
+ font: exports.SectionTitleFont,
112
112
  }), Stack.from({
113
113
  elements: [
114
114
  Elem.from({
@@ -185,7 +185,7 @@ exports.VolunteerLayout = new LayoutSchema_1.LayoutSchema("Volunteer Experience"
185
185
  item: "Volunteer Experience",
186
186
  width: Width.percent(100),
187
187
  alignment: "Center",
188
- font: exports.SectionTitleFont
188
+ font: exports.SectionTitleFont,
189
189
  }), Stack.from({
190
190
  elements: [
191
191
  Elem.from({
@@ -264,7 +264,7 @@ exports.EducationLayout = new LayoutSchema_1.LayoutSchema("Education", "Educatio
264
264
  item: "Education",
265
265
  width: Width.percent(100),
266
266
  alignment: "Center",
267
- font: exports.SectionTitleFont
267
+ font: exports.SectionTitleFont,
268
268
  }), Stack.from({
269
269
  elements: [
270
270
  Elem.from({
@@ -341,7 +341,7 @@ exports.AwardsLayout = new LayoutSchema_1.LayoutSchema("Awards", "Awards", Elem.
341
341
  item: "Awards",
342
342
  width: Width.percent(100),
343
343
  alignment: "Center",
344
- font: exports.SectionTitleFont
344
+ font: exports.SectionTitleFont,
345
345
  }), Stack.from({
346
346
  elements: [
347
347
  Elem.from({
@@ -390,7 +390,7 @@ exports.CertificatesLayout = new LayoutSchema_1.LayoutSchema("Certificates", "Ce
390
390
  item: "Certificates",
391
391
  width: Width.percent(100),
392
392
  alignment: "Center",
393
- font: exports.SectionTitleFont
393
+ font: exports.SectionTitleFont,
394
394
  }), Stack.from({
395
395
  elements: [
396
396
  Elem.from({
@@ -435,7 +435,7 @@ exports.PublicationsLayout = new LayoutSchema_1.LayoutSchema("Publications", "Pu
435
435
  item: "Publications",
436
436
  width: Width.percent(100),
437
437
  alignment: "Center",
438
- font: exports.SectionTitleFont
438
+ font: exports.SectionTitleFont,
439
439
  }), Stack.from({
440
440
  elements: [
441
441
  Elem.from({
@@ -482,7 +482,7 @@ exports.SkillsLayout = new LayoutSchema_1.LayoutSchema("Skills", "Skills", Elem.
482
482
  item: "Skills",
483
483
  width: Width.percent(100),
484
484
  alignment: "Center",
485
- font: exports.SectionTitleFont
485
+ font: exports.SectionTitleFont,
486
486
  }), Stack.from({
487
487
  elements: [
488
488
  Elem.from({
@@ -515,7 +515,7 @@ exports.LanguagesLayout = new LayoutSchema_1.LayoutSchema("Languages", "Language
515
515
  item: "Languages",
516
516
  width: Width.percent(100),
517
517
  alignment: "Center",
518
- font: exports.SectionTitleFont
518
+ font: exports.SectionTitleFont,
519
519
  }), Stack.from({
520
520
  elements: [
521
521
  Elem.from({
@@ -542,7 +542,7 @@ exports.InterestsLayout = new LayoutSchema_1.LayoutSchema("Interests", "Interest
542
542
  item: "Interests",
543
543
  width: Width.percent(100),
544
544
  alignment: "Center",
545
- font: exports.SectionTitleFont
545
+ font: exports.SectionTitleFont,
546
546
  }), Stack.from({
547
547
  elements: [
548
548
  Elem.from({
@@ -569,7 +569,7 @@ exports.ReferencesLayout = new LayoutSchema_1.LayoutSchema("References", "Refere
569
569
  item: "References",
570
570
  width: Width.percent(100),
571
571
  alignment: "Center",
572
- font: exports.SectionTitleFont
572
+ font: exports.SectionTitleFont,
573
573
  }), Stack.from({
574
574
  elements: [
575
575
  Elem.from({
@@ -608,7 +608,7 @@ exports.ProjectsLayout = new LayoutSchema_1.LayoutSchema("Projects", "Projects",
608
608
  item: "Projects",
609
609
  width: Width.percent(100),
610
610
  alignment: "Center",
611
- font: exports.SectionTitleFont
611
+ font: exports.SectionTitleFont,
612
612
  }), Stack.from({
613
613
  elements: [
614
614
  Elem.from({
@@ -683,287 +683,423 @@ exports.DefaultSections = [
683
683
  Resume_1.ResumeSection.resumeSection("Basics", "Basics", "Basics", {
684
684
  id: Utils.randomString(),
685
685
  fields: {
686
- "name": { tag: "String", value: "John Doe" },
687
- "email": { tag: "String", value: "john@doe.com" },
688
- "phone": { tag: "String", value: "555-555-5555" },
689
- }
686
+ name: { tag: "String", value: "John Doe" },
687
+ email: { tag: "String", value: "john@doe.com" },
688
+ phone: { tag: "String", value: "555-555-5555" },
689
+ },
690
690
  }, []),
691
691
  Resume_1.ResumeSection.resumeSection("Work Experience", "Work Experience", "Work Experience", {
692
692
  id: Utils.randomString(),
693
- fields: {}
693
+ fields: {},
694
694
  }, [
695
695
  {
696
696
  id: Utils.randomString(),
697
697
  fields: {
698
- "name": { tag: "Url", value: { text: "Company", url: "http://company.com" } },
699
- "position": { tag: "String", value: "President" },
700
- "startDate": { tag: "String", value: "2013-01-01" },
701
- "endDate": { tag: "String", value: "2014-01-01" },
702
- "summary": { tag: "String", value: "Description..." },
703
- "highlights": { tag: "List", value: [{ "tag": "String", "value": "Started the company" }] },
704
- }
698
+ name: {
699
+ tag: "Url",
700
+ value: { text: "Company", url: "http://company.com" },
701
+ },
702
+ position: { tag: "String", value: "President" },
703
+ startDate: { tag: "String", value: "2013-01-01" },
704
+ endDate: { tag: "String", value: "2014-01-01" },
705
+ summary: { tag: "String", value: "Description..." },
706
+ highlights: {
707
+ tag: "List",
708
+ value: [{ tag: "String", value: "Started the company" }],
709
+ },
710
+ },
705
711
  },
706
712
  {
707
713
  id: Utils.randomString(),
708
714
  fields: {
709
- "name": { tag: "Url", value: { text: "Company", url: "http://company.com" } },
710
- "position": { tag: "String", value: "President" },
711
- "url": { tag: "String", value: "http://company.com" },
712
- "startDate": { tag: "String", value: "2013-01-01" },
713
- "endDate": { tag: "String", value: "2014-01-01" },
714
- "summary": { tag: "String", value: "Description..." },
715
- "highlights": { tag: "List", value: [{ "tag": "String", "value": "Started the company" }] },
716
- }
715
+ name: {
716
+ tag: "Url",
717
+ value: { text: "Company", url: "http://company.com" },
718
+ },
719
+ position: { tag: "String", value: "President" },
720
+ url: { tag: "String", value: "http://company.com" },
721
+ startDate: { tag: "String", value: "2013-01-01" },
722
+ endDate: { tag: "String", value: "2014-01-01" },
723
+ summary: { tag: "String", value: "Description..." },
724
+ highlights: {
725
+ tag: "List",
726
+ value: [{ tag: "String", value: "Started the company" }],
727
+ },
728
+ },
717
729
  },
718
730
  {
719
731
  id: Utils.randomString(),
720
732
  fields: {
721
- "name": { tag: "Url", value: { text: "Company", url: "http://company.com" } },
722
- "position": { tag: "String", value: "President" },
723
- "url": { tag: "String", value: "http://company.com" },
724
- "startDate": { tag: "String", value: "2013-01-01" },
725
- "endDate": { tag: "String", value: "2014-01-01" },
726
- "summary": { tag: "String", value: "Description..." },
727
- "highlights": { tag: "List", value: [{ "tag": "String", "value": "Started the company" }] },
728
- }
733
+ name: {
734
+ tag: "Url",
735
+ value: { text: "Company", url: "http://company.com" },
736
+ },
737
+ position: { tag: "String", value: "President" },
738
+ url: { tag: "String", value: "http://company.com" },
739
+ startDate: { tag: "String", value: "2013-01-01" },
740
+ endDate: { tag: "String", value: "2014-01-01" },
741
+ summary: { tag: "String", value: "Description..." },
742
+ highlights: {
743
+ tag: "List",
744
+ value: [{ tag: "String", value: "Started the company" }],
745
+ },
746
+ },
729
747
  },
730
748
  {
731
749
  id: Utils.randomString(),
732
750
  fields: {
733
- "name": { tag: "Url", value: { text: "Company", url: "http://company.com" } },
734
- "position": { tag: "String", value: "President" },
735
- "url": { tag: "String", value: "http://company.com" },
736
- "startDate": { tag: "String", value: "2013-01-01" },
737
- "endDate": { tag: "String", value: "2014-01-01" },
738
- "summary": { tag: "String", value: "Description..." },
739
- "highlights": { tag: "List", value: [{ "tag": "String", "value": "Started the company" }] },
740
- }
741
- }
751
+ name: {
752
+ tag: "Url",
753
+ value: { text: "Company", url: "http://company.com" },
754
+ },
755
+ position: { tag: "String", value: "President" },
756
+ url: { tag: "String", value: "http://company.com" },
757
+ startDate: { tag: "String", value: "2013-01-01" },
758
+ endDate: { tag: "String", value: "2014-01-01" },
759
+ summary: { tag: "String", value: "Description..." },
760
+ highlights: {
761
+ tag: "List",
762
+ value: [{ tag: "String", value: "Started the company" }],
763
+ },
764
+ },
765
+ },
742
766
  ]),
743
767
  Resume_1.ResumeSection.resumeSection("Volunteer Experience", "Volunteer Experience", "Volunteer Experience", {
744
768
  id: Utils.randomString(),
745
- fields: {}
769
+ fields: {},
746
770
  }, [
747
771
  {
748
772
  id: Utils.randomString(),
749
773
  fields: {
750
- "organization": { tag: "Url", value: { text: "Organization", url: "http://organization.com" } },
751
- "position": { tag: "String", value: "Volunteer" },
752
- "startDate": { tag: "String", value: "2012-01-01" },
753
- "endDate": { tag: "String", value: "2013-01-01" },
754
- "summary": { tag: "String", value: "Description..." },
755
- "highlights": { tag: "List", value: [{ "tag": "String", "value": "Awarded 'Volunteer of the Month'" }] },
756
- }
774
+ organization: {
775
+ tag: "Url",
776
+ value: { text: "Organization", url: "http://organization.com" },
777
+ },
778
+ position: { tag: "String", value: "Volunteer" },
779
+ startDate: { tag: "String", value: "2012-01-01" },
780
+ endDate: { tag: "String", value: "2013-01-01" },
781
+ summary: { tag: "String", value: "Description..." },
782
+ highlights: {
783
+ tag: "List",
784
+ value: [
785
+ { tag: "String", value: "Awarded 'Volunteer of the Month'" },
786
+ ],
787
+ },
788
+ },
757
789
  },
758
790
  {
759
791
  id: Utils.randomString(),
760
792
  fields: {
761
- "organization": { tag: "Url", value: { text: "Organization", url: "http://organization.com" } },
762
- "position": { tag: "String", value: "Volunteer" },
763
- "startDate": { tag: "String", value: "2012-01-01" },
764
- "endDate": { tag: "String", value: "2013-01-01" },
765
- "summary": { tag: "String", value: "Description..." },
766
- "highlights": { tag: "List", value: [{ "tag": "String", "value": "Awarded 'Volunteer of the Month'" }] },
767
- }
793
+ organization: {
794
+ tag: "Url",
795
+ value: { text: "Organization", url: "http://organization.com" },
796
+ },
797
+ position: { tag: "String", value: "Volunteer" },
798
+ startDate: { tag: "String", value: "2012-01-01" },
799
+ endDate: { tag: "String", value: "2013-01-01" },
800
+ summary: { tag: "String", value: "Description..." },
801
+ highlights: {
802
+ tag: "List",
803
+ value: [
804
+ { tag: "String", value: "Awarded 'Volunteer of the Month'" },
805
+ ],
806
+ },
807
+ },
768
808
  },
769
809
  ]),
770
810
  Resume_1.ResumeSection.resumeSection("Education", "Education", "Education", {
771
811
  id: Utils.randomString(),
772
- fields: {}
812
+ fields: {},
773
813
  }, [
774
814
  {
775
815
  id: Utils.randomString(),
776
816
  fields: {
777
- "institution": { tag: "Url", value: { text: "University", url: "http://university.com" } },
778
- "area": { tag: "String", value: "Software Development" },
779
- "studyType": { tag: "String", value: "Bachelor" },
780
- "startDate": { tag: "String", value: "2011-01-01" },
781
- "endDate": { tag: "String", value: "2013-01-01" },
782
- "score": { tag: "String", value: "4.0" },
783
- "courses": { tag: "List", value: [{ "tag": "String", "value": "DB1101 - Basic SQL" }] },
784
- }
817
+ institution: {
818
+ tag: "Url",
819
+ value: { text: "University", url: "http://university.com" },
820
+ },
821
+ area: { tag: "String", value: "Software Development" },
822
+ studyType: { tag: "String", value: "Bachelor" },
823
+ startDate: { tag: "String", value: "2011-01-01" },
824
+ endDate: { tag: "String", value: "2013-01-01" },
825
+ score: { tag: "String", value: "4.0" },
826
+ courses: {
827
+ tag: "List",
828
+ value: [{ tag: "String", value: "DB1101 - Basic SQL" }],
829
+ },
830
+ },
785
831
  },
786
832
  {
787
833
  id: Utils.randomString(),
788
834
  fields: {
789
- "institution": { tag: "Url", value: { text: "University", url: "http://university.com" } },
790
- "area": { tag: "String", value: "Software Development" },
791
- "studyType": { tag: "String", value: "Bachelor" },
792
- "startDate": { tag: "String", value: "2011-01-01" },
793
- "endDate": { tag: "String", value: "2013-01-01" },
794
- "score": { tag: "String", value: "4.0" },
795
- "courses": { tag: "List", value: [{ "tag": "String", "value": "DB1101 - Basic SQL" }] },
796
- }
835
+ institution: {
836
+ tag: "Url",
837
+ value: { text: "University", url: "http://university.com" },
838
+ },
839
+ area: { tag: "String", value: "Software Development" },
840
+ studyType: { tag: "String", value: "Bachelor" },
841
+ startDate: { tag: "String", value: "2011-01-01" },
842
+ endDate: { tag: "String", value: "2013-01-01" },
843
+ score: { tag: "String", value: "4.0" },
844
+ courses: {
845
+ tag: "List",
846
+ value: [{ tag: "String", value: "DB1101 - Basic SQL" }],
847
+ },
848
+ },
797
849
  },
798
850
  ]),
799
851
  Resume_1.ResumeSection.resumeSection("Awards", "Awards", "Awards", {
800
852
  id: Utils.randomString(),
801
- fields: {}
853
+ fields: {},
802
854
  }, [
803
855
  {
804
856
  id: Utils.randomString(),
805
857
  fields: {
806
- "title": { tag: "String", value: "Greatest Software Developer" },
807
- "awarder": { tag: "String", value: "SoftwareAwards.inc" },
808
- "date": { tag: "String", value: "01-01-1970" },
809
- "summary": { tag: "String", value: "An award given only to the best of the best" },
810
- }
858
+ title: { tag: "String", value: "Greatest Software Developer" },
859
+ awarder: { tag: "String", value: "SoftwareAwards.inc" },
860
+ date: { tag: "String", value: "01-01-1970" },
861
+ summary: {
862
+ tag: "String",
863
+ value: "An award given only to the best of the best",
864
+ },
865
+ },
811
866
  },
812
867
  {
813
868
  id: Utils.randomString(),
814
869
  fields: {
815
- "title": { tag: "String", value: "Greatest Software Developer" },
816
- "awarder": { tag: "String", value: "SoftwareAwards.inc" },
817
- "date": { tag: "String", value: "01-01-1970" },
818
- "summary": { tag: "String", value: "An award given only to the best of the best" },
819
- }
870
+ title: { tag: "String", value: "Greatest Software Developer" },
871
+ awarder: { tag: "String", value: "SoftwareAwards.inc" },
872
+ date: { tag: "String", value: "01-01-1970" },
873
+ summary: {
874
+ tag: "String",
875
+ value: "An award given only to the best of the best",
876
+ },
877
+ },
820
878
  },
821
879
  ]),
822
880
  Resume_1.ResumeSection.resumeSection("Certificates", "Certificates", "Certificates", {
823
881
  id: Utils.randomString(),
824
- fields: {}
882
+ fields: {},
825
883
  }, [
826
884
  {
827
885
  id: Utils.randomString(),
828
886
  fields: {
829
- "name": { tag: "Url", value: { text: "Greatest Software Development Course", url: "www.google.com" } },
830
- "date": { tag: "String", value: "01-01-1970" },
831
- "issuer": { tag: "String", value: "An course that teaches only to the best of the best" },
832
- }
887
+ name: {
888
+ tag: "Url",
889
+ value: {
890
+ text: "Greatest Software Development Course",
891
+ url: "www.google.com",
892
+ },
893
+ },
894
+ date: { tag: "String", value: "01-01-1970" },
895
+ issuer: {
896
+ tag: "String",
897
+ value: "An course that teaches only to the best of the best",
898
+ },
899
+ },
833
900
  },
834
901
  {
835
902
  id: Utils.randomString(),
836
903
  fields: {
837
- "name": { tag: "Url", value: { text: "Greatest Software Development Course", url: "www.google.com" } },
838
- "date": { tag: "String", value: "01-01-1970" },
839
- "issuer": { tag: "String", value: "An course that teaches only to the best of the best" },
840
- }
904
+ name: {
905
+ tag: "Url",
906
+ value: {
907
+ text: "Greatest Software Development Course",
908
+ url: "www.google.com",
909
+ },
910
+ },
911
+ date: { tag: "String", value: "01-01-1970" },
912
+ issuer: {
913
+ tag: "String",
914
+ value: "An course that teaches only to the best of the best",
915
+ },
916
+ },
841
917
  },
842
918
  ]),
843
919
  Resume_1.ResumeSection.resumeSection("Publications", "Publications", "Publications", {
844
920
  id: Utils.randomString(),
845
- fields: {}
921
+ fields: {},
846
922
  }, [
847
923
  {
848
924
  id: Utils.randomString(),
849
925
  fields: {
850
- "name": { tag: "Url", value: { text: "How to develop good software", url: "www.google.com" } },
851
- "publisher": { tag: "String", value: "SoftwareAwards.inc" },
852
- "releaseDate": { tag: "String", value: "01-01-1970" },
853
- "summary": { tag: "String", value: "A publication worthy of the best of the best" },
854
- }
926
+ name: {
927
+ tag: "Url",
928
+ value: {
929
+ text: "How to develop good software",
930
+ url: "www.google.com",
931
+ },
932
+ },
933
+ publisher: { tag: "String", value: "SoftwareAwards.inc" },
934
+ releaseDate: { tag: "String", value: "01-01-1970" },
935
+ summary: {
936
+ tag: "String",
937
+ value: "A publication worthy of the best of the best",
938
+ },
939
+ },
855
940
  },
856
941
  {
857
942
  id: Utils.randomString(),
858
943
  fields: {
859
- "name": { tag: "Url", value: { text: "How to develop good software", url: "www.google.com" } },
860
- "publisher": { tag: "String", value: "SoftwareAwards.inc" },
861
- "releaseDate": { tag: "String", value: "01-01-1970" },
862
- "summary": { tag: "String", value: "A publication worthy of the best of the best" },
863
- }
944
+ name: {
945
+ tag: "Url",
946
+ value: {
947
+ text: "How to develop good software",
948
+ url: "www.google.com",
949
+ },
950
+ },
951
+ publisher: { tag: "String", value: "SoftwareAwards.inc" },
952
+ releaseDate: { tag: "String", value: "01-01-1970" },
953
+ summary: {
954
+ tag: "String",
955
+ value: "A publication worthy of the best of the best",
956
+ },
957
+ },
864
958
  },
865
959
  ]),
866
960
  Resume_1.ResumeSection.resumeSection("Skills", "Skills", "Skills", {
867
961
  id: Utils.randomString(),
868
- fields: {}
962
+ fields: {},
869
963
  }, [
870
964
  {
871
965
  id: Utils.randomString(),
872
966
  fields: {
873
- "name": { tag: "String", value: "Software Development" },
874
- "level": { tag: "String", value: "Senior" },
875
- "keywords": { tag: "List", value: [{ tag: "String", value: "Javascript" }, { tag: "String", value: "Typescript" }] },
876
- }
967
+ name: { tag: "String", value: "Software Development" },
968
+ level: { tag: "String", value: "Senior" },
969
+ keywords: {
970
+ tag: "List",
971
+ value: [
972
+ { tag: "String", value: "Javascript" },
973
+ { tag: "String", value: "Typescript" },
974
+ ],
975
+ },
976
+ },
877
977
  },
878
978
  {
879
979
  id: Utils.randomString(),
880
980
  fields: {
881
- "name": { tag: "String", value: "Software Development" },
882
- "level": { tag: "String", value: "Senior" },
883
- "keywords": { tag: "List", value: [{ tag: "String", value: "Javascript" }, { tag: "String", value: "Typescript" }] },
884
- }
981
+ name: { tag: "String", value: "Software Development" },
982
+ level: { tag: "String", value: "Senior" },
983
+ keywords: {
984
+ tag: "List",
985
+ value: [
986
+ { tag: "String", value: "Javascript" },
987
+ { tag: "String", value: "Typescript" },
988
+ ],
989
+ },
990
+ },
885
991
  },
886
992
  ]),
887
993
  Resume_1.ResumeSection.resumeSection("Languages", "Languages", "Languages", {
888
994
  id: Utils.randomString(),
889
- fields: {}
995
+ fields: {},
890
996
  }, [
891
997
  {
892
998
  id: Utils.randomString(),
893
999
  fields: {
894
- "language": { tag: "String", value: "Turkish" },
895
- "fluency": { tag: "String", value: "Native" },
896
- }
1000
+ language: { tag: "String", value: "Turkish" },
1001
+ fluency: { tag: "String", value: "Native" },
1002
+ },
897
1003
  },
898
1004
  {
899
1005
  id: Utils.randomString(),
900
1006
  fields: {
901
- "language": { tag: "String", value: "English" },
902
- "fluency": { tag: "String", value: "Proficient" },
903
- }
1007
+ language: { tag: "String", value: "English" },
1008
+ fluency: { tag: "String", value: "Proficient" },
1009
+ },
904
1010
  },
905
1011
  ]),
906
1012
  Resume_1.ResumeSection.resumeSection("Interests", "Interests", "Interests", {
907
1013
  id: Utils.randomString(),
908
- fields: {}
1014
+ fields: {},
909
1015
  }, [
910
1016
  {
911
1017
  id: Utils.randomString(),
912
1018
  fields: {
913
- "name": { tag: "String", value: "Software Development" },
914
- "keywords": { tag: "List", value: [{ tag: "String", value: "Javascript" }, { tag: "String", value: "Typescript" }] },
915
- }
1019
+ name: { tag: "String", value: "Software Development" },
1020
+ keywords: {
1021
+ tag: "List",
1022
+ value: [
1023
+ { tag: "String", value: "Javascript" },
1024
+ { tag: "String", value: "Typescript" },
1025
+ ],
1026
+ },
1027
+ },
916
1028
  },
917
1029
  {
918
1030
  id: Utils.randomString(),
919
1031
  fields: {
920
- "name": { tag: "String", value: "Software Development" },
921
- "keywords": { tag: "List", value: [{ tag: "String", value: "Javascript" }, { tag: "String", value: "Typescript" }] },
922
- }
1032
+ name: { tag: "String", value: "Software Development" },
1033
+ keywords: {
1034
+ tag: "List",
1035
+ value: [
1036
+ { tag: "String", value: "Javascript" },
1037
+ { tag: "String", value: "Typescript" },
1038
+ ],
1039
+ },
1040
+ },
923
1041
  },
924
1042
  ]),
925
1043
  Resume_1.ResumeSection.resumeSection("References", "References", "References", {
926
1044
  id: Utils.randomString(),
927
- fields: {}
1045
+ fields: {},
928
1046
  }, [
929
1047
  {
930
1048
  id: Utils.randomString(),
931
1049
  fields: {
932
- "name": { tag: "String", value: "Ken Thompson" },
933
- "reference": { tag: "String", value: "Legendary Programmer" },
934
- }
1050
+ name: { tag: "String", value: "Ken Thompson" },
1051
+ reference: { tag: "String", value: "Legendary Programmer" },
1052
+ },
935
1053
  },
936
1054
  {
937
1055
  id: Utils.randomString(),
938
1056
  fields: {
939
- "name": { tag: "String", value: "Alperen Keles" },
940
- "reference": { tag: "String", value: "Random fun guy" },
941
- }
1057
+ name: { tag: "String", value: "Alperen Keles" },
1058
+ reference: { tag: "String", value: "Random fun guy" },
1059
+ },
942
1060
  },
943
1061
  ]),
944
1062
  Resume_1.ResumeSection.resumeSection("Projects", "Projects", "Projects", {
945
1063
  id: Utils.randomString(),
946
- fields: {}
1064
+ fields: {},
947
1065
  }, [
948
1066
  {
949
1067
  id: Utils.randomString(),
950
1068
  fields: {
951
- "name": { tag: "Url", value: { text: "Tail", url: "http://tail.rocks" } },
952
- "startDate": { tag: "String", value: "2012-01-01" },
953
- "endDate": { tag: "String", value: "Never ends" },
954
- "description": { tag: "String", value: "Next generation document builder" },
955
- "highlights": { tag: "List", value: [{ "tag": "String", "value": "Looks pretty cool" }] },
956
- }
1069
+ name: {
1070
+ tag: "Url",
1071
+ value: { text: "Tail", url: "http://tail.rocks" },
1072
+ },
1073
+ startDate: { tag: "String", value: "2012-01-01" },
1074
+ endDate: { tag: "String", value: "Never ends" },
1075
+ description: {
1076
+ tag: "String",
1077
+ value: "Next generation document builder",
1078
+ },
1079
+ highlights: {
1080
+ tag: "List",
1081
+ value: [{ tag: "String", value: "Looks pretty cool" }],
1082
+ },
1083
+ },
957
1084
  },
958
1085
  {
959
1086
  id: Utils.randomString(),
960
1087
  fields: {
961
- "name": { tag: "Url", value: { text: "Tail", url: "http://tail.rocks" } },
962
- "startDate": { tag: "String", value: "2012-01-01" },
963
- "endDate": { tag: "String", value: "Never ends" },
964
- "description": { tag: "String", value: "Next generation document builder" },
965
- "highlights": { tag: "List", value: [{ "tag": "String", "value": "Looks pretty cool" }] },
966
- }
1088
+ name: {
1089
+ tag: "Url",
1090
+ value: { text: "Tail", url: "http://tail.rocks" },
1091
+ },
1092
+ startDate: { tag: "String", value: "2012-01-01" },
1093
+ endDate: { tag: "String", value: "Never ends" },
1094
+ description: {
1095
+ tag: "String",
1096
+ value: "Next generation document builder",
1097
+ },
1098
+ highlights: {
1099
+ tag: "List",
1100
+ value: [{ tag: "String", value: "Looks pretty cool" }],
1101
+ },
1102
+ },
967
1103
  },
968
1104
  ]),
969
1105
  ];
package/dist/Elem.d.ts CHANGED
@@ -12,6 +12,8 @@ export type Span = {
12
12
  is_italic: boolean;
13
13
  is_bold: boolean;
14
14
  is_code: boolean;
15
+ is_emoji?: boolean;
16
+ emoji_url?: string;
15
17
  text: string;
16
18
  link: string | null;
17
19
  font?: Font.t;
package/dist/Elem.js CHANGED
@@ -136,6 +136,64 @@ function withBackgroundColor(e, background_color) {
136
136
  function scaleWidth(e, scale) {
137
137
  return withWidth(e, Width.scale(e.width, scale));
138
138
  }
139
+ const EMOJI_MAP = {
140
+ smile: { type: "unicode", value: "😄" },
141
+ thumbsup: { type: "unicode", value: "👍" },
142
+ party: { type: "unicode", value: "🥳" },
143
+ // If you host custom images:
144
+ geyik: { type: "image", url: "geyik.png" },
145
+ };
146
+ function resolveEmoji(name) {
147
+ return EMOJI_MAP[name.toLowerCase()];
148
+ }
149
+ function escapeHtml(s) {
150
+ return s.replace(/[&<>"']/g, (ch) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }[ch]));
151
+ }
152
+ const emojiExtension = {
153
+ extensions: [
154
+ {
155
+ name: "emoji",
156
+ level: "inline", // inline tokenizer
157
+ start(src) {
158
+ // small perf hint for marked: where to start looking
159
+ const i = src.indexOf(":");
160
+ return i < 0 ? undefined : i;
161
+ },
162
+ tokenizer(src) {
163
+ // Match :emoji_name:
164
+ const match = /^:([a-z0-9_+\-]+):/i.exec(src);
165
+ if (!match)
166
+ return;
167
+ const name = match[1];
168
+ const resolved = resolveEmoji(name);
169
+ // If we don't know this emoji, return nothing so marked keeps parsing normally
170
+ console.log(`Found emoji syntax :${name}:, resolved: ${resolved ? "yes" : "no"}`);
171
+ if (!resolved)
172
+ return;
173
+ // Create a custom token
174
+ const token = {
175
+ type: "emoji",
176
+ raw: match[0],
177
+ name, // custom field
178
+ };
179
+ return token;
180
+ },
181
+ renderer(token) {
182
+ const res = resolveEmoji(token.name);
183
+ if (!res)
184
+ return token.raw; // fallback
185
+ if (res.type === "unicode") {
186
+ // Return the unicode directly—keeps copy/paste and accessibility nice
187
+ return res.value;
188
+ }
189
+ // Image fallback: accessible <img>, no extra styling assumptions
190
+ // alt uses :name: to mimic GitHub-style emoji labels
191
+ console.log(`Rendering custom emoji image for :${token.name}:`);
192
+ return `<img class="emoji" alt=":${escapeHtml(token.name)}:" draggable="false" loading="lazy" decoding="async" src="${res.url}">`;
193
+ },
194
+ },
195
+ ],
196
+ };
139
197
  function flatten(ts, sp) {
140
198
  const spans = [];
141
199
  for (const t of ts) {
@@ -174,6 +232,22 @@ function flattenToken(t, sp) {
174
232
  result.push({ ...sp, text: "\n", link: null });
175
233
  }
176
234
  return result;
235
+ })
236
+ .with({ type: "emoji", name: ts_pattern_1.P.select("name") }, ({ name }) => {
237
+ const res = resolveEmoji(name);
238
+ // Graceful fallback (shouldn't happen because tokenizer filters unknowns)
239
+ if (!res)
240
+ return [{ ...sp, text: `:${name}:`, link: null }];
241
+ if (res.type === "unicode") {
242
+ // simplest: just emit the unicode as plain text
243
+ return [{ ...sp, text: res.value, link: null }];
244
+ }
245
+ else {
246
+ // If you want image-based emojis, choose how your Span should represent images.
247
+ // extend your Span model (recommended) to support inline images/emojis.
248
+ // Example if you add fields: { is_emoji: true, emoji_url?: string }
249
+ return [{ ...sp, text: "WTF", link: null, is_emoji: true, emoji_url: res.url }];
250
+ }
177
251
  })
178
252
  .otherwise((e) => {
179
253
  // console.log(`Unknown token type: ${JSON.stringify(e)}`);
@@ -182,6 +256,7 @@ function flattenToken(t, sp) {
182
256
  }
183
257
  function parseMarkdownItem(item) {
184
258
  const spans = [];
259
+ marked.use(emojiExtension);
185
260
  for (const token of marked.lexer(item)) {
186
261
  spans.push(...flatten([token], defaultSpanProps()));
187
262
  }
@@ -193,6 +268,13 @@ function fillFonts(e, fonts) {
193
268
  : [{ ...defaultSpanProps(), text: e.text, font: e.font, link: null }];
194
269
  const spans = [];
195
270
  for (const span of simpleSpans) {
271
+ if (span.is_emoji) {
272
+ // For simplicity, we use a fixed width for emojis if we have an image URL.
273
+ const widthText = span.emoji_url ? "😀" : span.text;
274
+ const emojiWidth = Font.get_width(e.font, widthText, fonts);
275
+ spans.push({ ...span, font: e.font, width: emojiWidth });
276
+ continue;
277
+ }
196
278
  const font = e.is_markdown
197
279
  ? (0, Utils_1.with_)(e.font, {
198
280
  style: span.is_italic ? "Italic" : e.font.style,
@@ -211,6 +293,13 @@ function fillFonts(e, fonts) {
211
293
  }
212
294
  const words = span.text.split(/\s+/);
213
295
  words.forEach((word, index) => {
296
+ // Fix html escape characters
297
+ word = word.replace(/&amp;/g, "&");
298
+ word = word.replace(/&lt;/g, "<");
299
+ word = word.replace(/&gt;/g, ">");
300
+ word = word.replace(/&quot;/g, '"');
301
+ word = word.replace(/&apos;/g, "'");
302
+ word = word.replace(/&#39;/g, "'");
214
303
  const width = Font.get_width(font, word, fonts);
215
304
  spans.push({ ...span, text: word, font, width });
216
305
  if (index < words.length - 1) {
@@ -246,7 +335,9 @@ function boundWidth(e, width) {
246
335
  function bind(t, bindings) {
247
336
  const result = {};
248
337
  for (const [key, value] of Object.entries(t)) {
249
- if (value instanceof Object && "binding" in value && typeof value.binding === "string") {
338
+ if (value instanceof Object &&
339
+ "binding" in value &&
340
+ typeof value.binding === "string") {
250
341
  const bound = bindings.get(value.binding);
251
342
  if (bound === undefined) {
252
343
  throw new Error(`Binding ${value.binding} not found`);
package/dist/Font.js CHANGED
@@ -37,7 +37,4 @@ function get_height(f, fonts) {
37
37
  const font = fonts.get_font(full_name(f));
38
38
  return (font.bbox.height / font.unitsPerEm) * f.size;
39
39
  }
40
- exports.FontStyles = [
41
- "Normal",
42
- "Italic",
43
- ];
40
+ exports.FontStyles = ["Normal", "Italic"];
@@ -40,9 +40,9 @@ class LocalStorage {
40
40
  return Promise.resolve();
41
41
  }
42
42
  async initiate_storage() {
43
- if (localStorage.getItem("version") !== "0.1.2") {
43
+ if (localStorage.getItem("version") !== "0.1.3") {
44
44
  localStorage.clear();
45
- localStorage.setItem("version", "0.1.2");
45
+ localStorage.setItem("version", "0.1.3");
46
46
  }
47
47
  if (!localStorage.getItem("resumes")) {
48
48
  localStorage.setItem("resumes", JSON.stringify([Defaults.DefaultResume]));
package/dist/PdfLayout.js CHANGED
@@ -44,12 +44,10 @@ const render = async ({ resume_name, resume, data_schemas, layout_schemas, resum
44
44
  resume = await storage.load_resume(resume_name);
45
45
  }
46
46
  if (!data_schemas) {
47
- data_schemas = await Promise.all(Resume.dataSchemas(resume)
48
- .map((schema) => storage.load_data_schema(schema)));
47
+ data_schemas = await Promise.all(Resume.dataSchemas(resume).map((schema) => storage.load_data_schema(schema)));
49
48
  }
50
49
  if (!layout_schemas) {
51
- layout_schemas = await Promise.all(Resume.layoutSchemas(resume)
52
- .map((schema) => storage.load_layout_schema(schema)));
50
+ layout_schemas = await Promise.all(Resume.layoutSchemas(resume).map((schema) => storage.load_layout_schema(schema)));
53
51
  }
54
52
  if (!resume_layout) {
55
53
  resume_layout = await storage.load_resume_layout(resume.layout);
@@ -193,6 +191,13 @@ const renderSectionLayout = (layout, tracker) => {
193
191
  tracker.layout.margin.left +
194
192
  span.bbox.top_left.x;
195
193
  tracker.pageContainer = getPageContainer(page, tracker);
194
+ console.log(`Rendering span "${span.text}" at (${x}, ${y}) on page ${page}\nspan ${JSON.stringify(span)}`);
195
+ // If the span is an emoji and has an emoji_url, render the image instead of the text
196
+ if (span.is_emoji && span.emoji_url) {
197
+ const imgSize = span.font.size * 1.2;
198
+ tracker.pageContainer.image(span.emoji_url, x, y - span.font.size * 0.2, { width: imgSize, height: imgSize });
199
+ return;
200
+ }
196
201
  tracker.pageContainer
197
202
  .font(_1.Font.full_name(span.font))
198
203
  .fontSize(span.font.size)
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "cvdl-ts",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "Typescript Implementation of CVDL Compiler",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "files": ["/dist"],
7
+ "files": [
8
+ "/dist"
9
+ ],
8
10
  "dependencies": {
9
11
  "@types/blob-stream": "^0.1.32",
10
12
  "@types/fontkit": "^2.0.5",
@@ -24,4 +26,4 @@
24
26
  "start": "ts-node src/index.ts",
25
27
  "cli": "ts-node src/cli.ts"
26
28
  }
27
- }
29
+ }
@@ -1,21 +0,0 @@
1
- import * as Font from "./Font";
2
- import { LayoutSchema } from "./LayoutSchema";
3
- import { Resume } from "./Resume";
4
- import { ResumeLayout } from "./ResumeLayout";
5
- import { Storage } from "./Storage";
6
- export declare class IndexedDB implements Storage {
7
- initiate_storage(): Promise<void>;
8
- list_resumes(): Promise<string[]>;
9
- list_data_schemas(): Promise<string[]>;
10
- list_layout_schemas(): Promise<string[]>;
11
- list_resume_layouts(): Promise<string[]>;
12
- load_resume(resume_name: string): Promise<Resume>;
13
- load_data_schema(schema_name: string): Promise<DataSchema>;
14
- load_layout_schema(schema_name: string): Promise<LayoutSchema>;
15
- load_resume_layout(schema_name: string): Promise<ResumeLayout>;
16
- save_resume(resume_name: string, resume_data: Resume): Promise<void>;
17
- save_data_schema(data_schema: DataSchema): Promise<void>;
18
- save_layout_schema(layout_schema: LayoutSchema): Promise<void>;
19
- save_resume_layout(resume_layout: ResumeLayout): Promise<void>;
20
- load_font(font: Font.t): Promise<Buffer>;
21
- }
package/dist/IndexedDB.js DELETED
@@ -1,282 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.IndexedDB = void 0;
27
- const DataSchema_1 = require("./DataSchema");
28
- const Font = __importStar(require("./Font"));
29
- const LayoutSchema_1 = require("./LayoutSchema");
30
- const Resume_1 = require("./Resume");
31
- const ResumeLayout_1 = require("./ResumeLayout");
32
- class IndexedDB {
33
- async initiate_storage() {
34
- const resumes = indexedDB.open("resumes", 1);
35
- resumes.onupgradeneeded = () => {
36
- const db = resumes.result;
37
- db.createObjectStore("resumes", { keyPath: "name" });
38
- };
39
- resumes.onsuccess = () => {
40
- const db = resumes.result;
41
- const transaction = db.transaction("resumes", "readwrite");
42
- const store = transaction.objectStore("resumes");
43
- if (!store.get("Default")) {
44
- fetch("https://d2bnplhbawocbk.cloudfront.net/data/resumes/resume5.json").then((response) => {
45
- response.json().then((resume) => {
46
- store.add({ name: "Default", data: resume });
47
- });
48
- });
49
- }
50
- };
51
- const data_schemas = indexedDB.open("data_schemas", 1);
52
- data_schemas.onupgradeneeded = () => {
53
- const db = data_schemas.result;
54
- db.createObjectStore("data_schemas", { keyPath: "schema_name" });
55
- };
56
- data_schemas.onsuccess = () => {
57
- const db = data_schemas.result;
58
- const transaction = db.transaction("data_schemas", "readwrite");
59
- const store = transaction.objectStore("data_schemas");
60
- if (!store.get("Default")) {
61
- fetch("https://d2bnplhbawocbk.cloudfront.net/data/data-schemas.json").then((response) => {
62
- response.json().then((data_schemas) => {
63
- store.add(data_schemas);
64
- });
65
- });
66
- }
67
- };
68
- const section_layouts = indexedDB.open("section_layouts", 1);
69
- section_layouts.onupgradeneeded = () => {
70
- const db = section_layouts.result;
71
- db.createObjectStore("section_layouts", { keyPath: "schema_name" });
72
- };
73
- section_layouts.onsuccess = () => {
74
- const db = section_layouts.result;
75
- const transaction = db.transaction("section_layouts", "readwrite");
76
- const store = transaction.objectStore("section_layouts");
77
- if (!store.get("Default")) {
78
- fetch("https://d2bnplhbawocbk.cloudfront.net/data/layout-schemas3.json").then((response) => {
79
- response.json().then((section_layouts) => {
80
- store.add(section_layouts);
81
- });
82
- });
83
- }
84
- };
85
- const resume_layouts = indexedDB.open("resume_layouts", 1);
86
- resume_layouts.onupgradeneeded = () => {
87
- const db = resume_layouts.result;
88
- db.createObjectStore("resume_layouts", { keyPath: "schema_name" });
89
- };
90
- resume_layouts.onsuccess = () => {
91
- const db = resume_layouts.result;
92
- const transaction = db.transaction("resume_layouts", "readwrite");
93
- const store = transaction.objectStore("resume_layouts");
94
- if (!store.get("Default")) {
95
- fetch("https://d2bnplhbawocbk.cloudfront.net/data/resume-layouts.json").then((response) => {
96
- response.json().then((resume_layouts) => {
97
- store.add(resume_layouts);
98
- });
99
- });
100
- }
101
- };
102
- }
103
- list_resumes() {
104
- const resumes = indexedDB.open("resumes", 1);
105
- resumes.onsuccess = () => {
106
- const db = resumes.result;
107
- const transaction = db.transaction("resumes", "readwrite");
108
- const store = transaction.objectStore("resumes");
109
- const request = store.getAll();
110
- request.onsuccess = () => {
111
- return request.result.map((resume) => resume.name);
112
- };
113
- };
114
- return Promise.resolve([]);
115
- }
116
- list_data_schemas() {
117
- const data_schemas = indexedDB.open("data_schemas", 1);
118
- data_schemas.onsuccess = () => {
119
- const db = data_schemas.result;
120
- const transaction = db.transaction("data_schemas", "readwrite");
121
- const store = transaction.objectStore("data_schemas");
122
- const request = store.getAll();
123
- request.onsuccess = () => {
124
- return request.result.map((schema) => schema.schema_name);
125
- };
126
- };
127
- return Promise.resolve([]);
128
- }
129
- list_layout_schemas() {
130
- const section_layouts = indexedDB.open("section_layouts", 1);
131
- section_layouts.onsuccess = () => {
132
- const db = section_layouts.result;
133
- const transaction = db.transaction("section_layouts", "readwrite");
134
- const store = transaction.objectStore("section_layouts");
135
- const request = store.getAll();
136
- request.onsuccess = () => {
137
- return request.result.map((schema) => schema.schema_name);
138
- };
139
- };
140
- return Promise.resolve([]);
141
- }
142
- list_resume_layouts() {
143
- const resume_layouts = indexedDB.open("resume_layouts", 1);
144
- resume_layouts.onsuccess = () => {
145
- const db = resume_layouts.result;
146
- const transaction = db.transaction("resume_layouts", "readwrite");
147
- const store = transaction.objectStore("resume_layouts");
148
- const request = store.getAll();
149
- request.onsuccess = () => {
150
- return request.result.map((schema) => schema.schema_name);
151
- };
152
- };
153
- return Promise.resolve([]);
154
- }
155
- load_resume(resume_name) {
156
- const resumes = indexedDB.open("resumes", 1);
157
- resumes.onsuccess = () => {
158
- const db = resumes.result;
159
- const transaction = db.transaction("resumes", "readwrite");
160
- const store = transaction.objectStore("resumes");
161
- const request = store.get(resume_name);
162
- request.onsuccess = () => {
163
- return Resume_1.Resume.fromJson(request.result.data);
164
- };
165
- };
166
- return Promise.resolve(Resume_1.Resume.fromJson({}));
167
- }
168
- load_data_schema(schema_name) {
169
- const data_schemas = indexedDB.open("data_schemas", 1);
170
- data_schemas.onsuccess = () => {
171
- const db = data_schemas.result;
172
- const transaction = db.transaction("data_schemas", "readwrite");
173
- const store = transaction.objectStore("data_schemas");
174
- const request = store.get(schema_name);
175
- request.onsuccess = () => {
176
- return DataSchema_1.DataSchema.fromJson(request.result);
177
- };
178
- };
179
- return Promise.resolve(DataSchema_1.DataSchema.fromJson({}));
180
- }
181
- load_layout_schema(schema_name) {
182
- const section_layouts = indexedDB.open("section_layouts", 1);
183
- section_layouts.onsuccess = () => {
184
- const db = section_layouts.result;
185
- const transaction = db.transaction("section_layouts", "readwrite");
186
- const store = transaction.objectStore("section_layouts");
187
- const request = store.get(schema_name);
188
- request.onsuccess = () => {
189
- return LayoutSchema_1.LayoutSchema.fromJson(request.result);
190
- };
191
- };
192
- return Promise.resolve(LayoutSchema_1.LayoutSchema.fromJson({}));
193
- }
194
- load_resume_layout(schema_name) {
195
- const resume_layouts = indexedDB.open("resume_layouts", 1);
196
- resume_layouts.onsuccess = () => {
197
- const db = resume_layouts.result;
198
- const transaction = db.transaction("resume_layouts", "readwrite");
199
- const store = transaction.objectStore("resume_layouts");
200
- const request = store.get(schema_name);
201
- request.onsuccess = () => {
202
- return ResumeLayout_1.ResumeLayout.fromJson(request.result);
203
- };
204
- };
205
- return Promise.resolve(ResumeLayout_1.ResumeLayout.fromJson({}));
206
- }
207
- save_resume(resume_name, resume_data) {
208
- const resumes = indexedDB.open("resumes", 1);
209
- resumes.onsuccess = () => {
210
- const db = resumes.result;
211
- const transaction = db.transaction("resumes", "readwrite");
212
- const store = transaction.objectStore("resumes");
213
- const request = store.put({ name: resume_name, data: resume_data.toJson() });
214
- request.onsuccess = () => {
215
- return;
216
- };
217
- };
218
- return Promise.resolve();
219
- }
220
- save_data_schema(data_schema) {
221
- const data_schemas = indexedDB.open("data_schemas", 1);
222
- data_schemas.onsuccess = () => {
223
- const db = data_schemas.result;
224
- const transaction = db.transaction("data_schemas", "readwrite");
225
- const store = transaction.objectStore("data_schemas");
226
- const request = store.put(data_schema);
227
- request.onsuccess = () => {
228
- return;
229
- };
230
- };
231
- return Promise.resolve();
232
- }
233
- save_layout_schema(layout_schema) {
234
- const section_layouts = indexedDB.open("section_layouts", 1);
235
- section_layouts.onsuccess = () => {
236
- const db = section_layouts.result;
237
- const transaction = db.transaction("section_layouts", "readwrite");
238
- const store = transaction.objectStore("section_layouts");
239
- const request = store.put(layout_schema);
240
- request.onsuccess = () => {
241
- return;
242
- };
243
- };
244
- return Promise.resolve();
245
- }
246
- save_resume_layout(resume_layout) {
247
- const resume_layouts = indexedDB.open("resume_layouts", 1);
248
- resume_layouts.onsuccess = () => {
249
- const db = resume_layouts.result;
250
- const transaction = db.transaction("resume_layouts", "readwrite");
251
- const store = transaction.objectStore("resume_layouts");
252
- const request = store.put(resume_layout);
253
- request.onsuccess = () => {
254
- return;
255
- };
256
- };
257
- return Promise.resolve();
258
- }
259
- async load_font(font) {
260
- const path = `fonts/${Font.full_name(font)}.ttf`;
261
- const fonts = indexedDB.open("fonts", 1);
262
- fonts.onsuccess = () => {
263
- const db = fonts.result;
264
- const transaction = db.transaction("fonts", "readwrite");
265
- const store = transaction.objectStore("fonts");
266
- const request = store.get(path);
267
- request.onsuccess = () => {
268
- return Buffer.from(request.result);
269
- };
270
- request.onerror = () => {
271
- const response = fetch(`https://d2bnplhbawocbk.cloudfront.net/data/${path}`);
272
- response.then((response) => {
273
- response.arrayBuffer().then((font_data) => {
274
- store.add(font_data, path);
275
- });
276
- });
277
- };
278
- };
279
- return Promise.resolve(Buffer.from([]));
280
- }
281
- }
282
- exports.IndexedDB = IndexedDB;