@gmb/bitmark-parser-generator 1.4.16 → 1.4.18

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.
Files changed (226) hide show
  1. package/dist/browser/bitmark-parser-generator.min.js +1 -1
  2. package/dist/browser/bundle-report.html +2 -2
  3. package/dist/cjs/BitmarkParserGenerator.js +2 -13
  4. package/dist/cjs/BitmarkParserGenerator.js.map +1 -1
  5. package/dist/cjs/ast/Builder.js +8 -8
  6. package/dist/cjs/ast/Builder.js.map +1 -1
  7. package/dist/cjs/ast/rules/NodeValidator.js +6 -23
  8. package/dist/cjs/ast/rules/NodeValidator.js.map +1 -1
  9. package/dist/cjs/config/Config.js +57 -86
  10. package/dist/cjs/config/Config.js.map +1 -1
  11. package/dist/cjs/config/raw/bits.js +388 -450
  12. package/dist/cjs/config/raw/bits.js.map +1 -1
  13. package/dist/cjs/config/raw/properties.js +37 -0
  14. package/dist/cjs/config/raw/properties.js.map +1 -1
  15. package/dist/cjs/generated/build-info.js +1 -1
  16. package/dist/cjs/generator/bitmark/BitmarkGenerator.js +9 -11
  17. package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +1 -1
  18. package/dist/cjs/generator/json/JsonGenerator.js +236 -208
  19. package/dist/cjs/generator/json/JsonGenerator.js.map +1 -1
  20. package/dist/cjs/index.js +2 -3
  21. package/dist/cjs/index.js.map +1 -1
  22. package/dist/cjs/info/InfoBuilder.js +10 -33
  23. package/dist/cjs/info/InfoBuilder.js.map +1 -1
  24. package/dist/cjs/model/ast/NodeType.js +16 -0
  25. package/dist/cjs/model/ast/NodeType.js.map +1 -1
  26. package/dist/cjs/model/config/BitConfig.js +8 -7
  27. package/dist/cjs/model/config/BitConfig.js.map +1 -1
  28. package/dist/cjs/model/config/enum/PropertyConfigKey.js +7 -0
  29. package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +1 -1
  30. package/dist/cjs/model/enum/BitType.js +86 -84
  31. package/dist/cjs/model/enum/BitType.js.map +1 -1
  32. package/dist/cjs/model/enum/PropertyAstKey.js +2 -0
  33. package/dist/cjs/model/enum/PropertyAstKey.js.map +1 -1
  34. package/dist/cjs/model/enum/PropertyTag.js +5 -0
  35. package/dist/cjs/model/enum/PropertyTag.js.map +1 -1
  36. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js +14 -14
  37. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
  38. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js +6 -6
  39. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
  40. package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
  41. package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +11 -10
  42. package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
  43. package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
  44. package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
  45. package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +52 -47
  46. package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
  47. package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
  48. package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
  49. package/dist/cjs/parser/bitmark/peg/contentProcessors/{CommentTagContentProcessor.js → InternalCommentTagContentProcessor.js} +5 -5
  50. package/dist/cjs/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +1 -0
  51. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
  52. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
  53. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
  54. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +1 -1
  55. package/dist/cjs/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.js.map +1 -1
  56. package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +2 -2
  57. package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
  58. package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
  59. package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
  60. package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +15 -17
  61. package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
  62. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +14 -11
  63. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
  64. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
  65. package/dist/cjs/parser/json/JsonParser.js +9 -9
  66. package/dist/cjs/parser/json/JsonParser.js.map +1 -1
  67. package/dist/cjs/utils/ObjectUtils.js +62 -0
  68. package/dist/cjs/utils/ObjectUtils.js.map +1 -1
  69. package/dist/esm/BitmarkParserGenerator.js +2 -13
  70. package/dist/esm/BitmarkParserGenerator.js.map +1 -1
  71. package/dist/esm/ast/Builder.js +9 -9
  72. package/dist/esm/ast/Builder.js.map +1 -1
  73. package/dist/esm/ast/rules/NodeValidator.js +6 -23
  74. package/dist/esm/ast/rules/NodeValidator.js.map +1 -1
  75. package/dist/esm/config/Config.js +57 -86
  76. package/dist/esm/config/Config.js.map +1 -1
  77. package/dist/esm/config/raw/bits.js +389 -451
  78. package/dist/esm/config/raw/bits.js.map +1 -1
  79. package/dist/esm/config/raw/properties.js +37 -0
  80. package/dist/esm/config/raw/properties.js.map +1 -1
  81. package/dist/esm/generated/build-info.js +1 -1
  82. package/dist/esm/generator/bitmark/BitmarkGenerator.js +10 -12
  83. package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +1 -1
  84. package/dist/esm/generator/json/JsonGenerator.js +237 -209
  85. package/dist/esm/generator/json/JsonGenerator.js.map +1 -1
  86. package/dist/esm/index.js +1 -1
  87. package/dist/esm/index.js.map +1 -1
  88. package/dist/esm/info/InfoBuilder.js +11 -34
  89. package/dist/esm/info/InfoBuilder.js.map +1 -1
  90. package/dist/esm/model/ast/NodeType.js +16 -0
  91. package/dist/esm/model/ast/NodeType.js.map +1 -1
  92. package/dist/esm/model/config/BitConfig.js +8 -7
  93. package/dist/esm/model/config/BitConfig.js.map +1 -1
  94. package/dist/esm/model/config/enum/PropertyConfigKey.js +7 -0
  95. package/dist/esm/model/config/enum/PropertyConfigKey.js.map +1 -1
  96. package/dist/esm/model/enum/BitType.js +85 -82
  97. package/dist/esm/model/enum/BitType.js.map +1 -1
  98. package/dist/esm/model/enum/PropertyAstKey.js +2 -0
  99. package/dist/esm/model/enum/PropertyAstKey.js.map +1 -1
  100. package/dist/esm/model/enum/PropertyTag.js +5 -0
  101. package/dist/esm/model/enum/PropertyTag.js.map +1 -1
  102. package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js +15 -15
  103. package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
  104. package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js +6 -6
  105. package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
  106. package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
  107. package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +12 -11
  108. package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
  109. package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
  110. package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
  111. package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +53 -48
  112. package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
  113. package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
  114. package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
  115. package/dist/esm/parser/bitmark/peg/contentProcessors/{CommentTagContentProcessor.js → InternalCommentTagContentProcessor.js} +5 -5
  116. package/dist/esm/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +1 -0
  117. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
  118. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
  119. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
  120. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +1 -1
  121. package/dist/esm/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.js.map +1 -1
  122. package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +2 -2
  123. package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
  124. package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
  125. package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
  126. package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +16 -18
  127. package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
  128. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +15 -12
  129. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
  130. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
  131. package/dist/esm/parser/json/JsonParser.js +10 -10
  132. package/dist/esm/parser/json/JsonParser.js.map +1 -1
  133. package/dist/esm/utils/ObjectUtils.js +59 -0
  134. package/dist/esm/utils/ObjectUtils.js.map +1 -1
  135. package/dist/types/BitmarkParserGenerator.d.ts.map +1 -1
  136. package/dist/types/ast/Builder.d.ts +9 -2
  137. package/dist/types/ast/Builder.d.ts.map +1 -1
  138. package/dist/types/ast/rules/NodeValidator.d.ts +0 -1
  139. package/dist/types/ast/rules/NodeValidator.d.ts.map +1 -1
  140. package/dist/types/config/Config.d.ts +16 -28
  141. package/dist/types/config/Config.d.ts.map +1 -1
  142. package/dist/types/config/raw/bits.d.ts.map +1 -1
  143. package/dist/types/config/raw/properties.d.ts.map +1 -1
  144. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts +4 -4
  145. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts.map +1 -1
  146. package/dist/types/generator/json/JsonGenerator.d.ts +22 -22
  147. package/dist/types/generator/json/JsonGenerator.d.ts.map +1 -1
  148. package/dist/types/generator/text/TextGenerator.d.ts +2 -2
  149. package/dist/types/generator/text/TextGenerator.d.ts.map +1 -1
  150. package/dist/types/index.d.ts +2 -2
  151. package/dist/types/index.d.ts.map +1 -1
  152. package/dist/types/info/InfoBuilder.d.ts +3 -4
  153. package/dist/types/info/InfoBuilder.d.ts.map +1 -1
  154. package/dist/types/model/ast/NodeType.d.ts +32 -0
  155. package/dist/types/model/ast/NodeType.d.ts.map +1 -1
  156. package/dist/types/model/ast/Nodes.d.ts +9 -2
  157. package/dist/types/model/ast/Nodes.d.ts.map +1 -1
  158. package/dist/types/model/config/BitConfig.d.ts +5 -4
  159. package/dist/types/model/config/BitConfig.d.ts.map +1 -1
  160. package/dist/types/model/config/_Config.d.ts +3 -5
  161. package/dist/types/model/config/_Config.d.ts.map +1 -1
  162. package/dist/types/model/config/enum/ConfigKey.d.ts +14 -0
  163. package/dist/types/model/config/enum/ConfigKey.d.ts.map +1 -1
  164. package/dist/types/model/config/enum/PropertyConfigKey.d.ts +21 -0
  165. package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +1 -1
  166. package/dist/types/model/enum/BitType.d.ts +171 -178
  167. package/dist/types/model/enum/BitType.d.ts.map +1 -1
  168. package/dist/types/model/enum/PropertyAstKey.d.ts +4 -0
  169. package/dist/types/model/enum/PropertyAstKey.d.ts.map +1 -1
  170. package/dist/types/model/enum/PropertyTag.d.ts +10 -0
  171. package/dist/types/model/enum/PropertyTag.d.ts.map +1 -1
  172. package/dist/types/model/json/BitJson.d.ts +5 -0
  173. package/dist/types/model/json/BitJson.d.ts.map +1 -1
  174. package/dist/types/model/json/ParserJson.d.ts +1 -1
  175. package/dist/types/model/json/ParserJson.d.ts.map +1 -1
  176. package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts.map +1 -1
  177. package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +6 -6
  178. package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts.map +1 -1
  179. package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts +6 -6
  180. package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts.map +1 -1
  181. package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts +2 -2
  182. package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts.map +1 -1
  183. package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts +2 -2
  184. package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts.map +1 -1
  185. package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts +2 -2
  186. package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts.map +1 -1
  187. package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts +2 -2
  188. package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts.map +1 -1
  189. package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts +2 -2
  190. package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts.map +1 -1
  191. package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts +2 -2
  192. package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts.map +1 -1
  193. package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts +2 -2
  194. package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts.map +1 -1
  195. package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts +5 -0
  196. package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts.map +1 -0
  197. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts +2 -2
  198. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts.map +1 -1
  199. package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts +2 -2
  200. package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts.map +1 -1
  201. package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts +2 -2
  202. package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts.map +1 -1
  203. package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts +2 -2
  204. package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts.map +1 -1
  205. package/dist/types/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.d.ts +2 -2
  206. package/dist/types/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.d.ts.map +1 -1
  207. package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts +2 -2
  208. package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts.map +1 -1
  209. package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts +2 -2
  210. package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts.map +1 -1
  211. package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts +3 -3
  212. package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts.map +1 -1
  213. package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts +3 -3
  214. package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts.map +1 -1
  215. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts +2 -2
  216. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts.map +1 -1
  217. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts +2 -2
  218. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts.map +1 -1
  219. package/dist/types/parser/json/JsonParser.d.ts.map +1 -1
  220. package/dist/types/utils/ObjectUtils.d.ts +9 -0
  221. package/dist/types/utils/ObjectUtils.d.ts.map +1 -1
  222. package/package.json +3 -1
  223. package/dist/cjs/parser/bitmark/peg/contentProcessors/CommentTagContentProcessor.js.map +0 -1
  224. package/dist/esm/parser/bitmark/peg/contentProcessors/CommentTagContentProcessor.js.map +0 -1
  225. package/dist/types/parser/bitmark/peg/contentProcessors/CommentTagContentProcessor.d.ts +0 -5
  226. package/dist/types/parser/bitmark/peg/contentProcessors/CommentTagContentProcessor.d.ts.map +0 -1
@@ -221,7 +221,7 @@ class JsonGenerator {
221
221
  if (isBoolean) {
222
222
  // Boolean example
223
223
  defaultExample = true;
224
- if (bit.bitType.root === BitType_1.RootBitType.trueFalse1) {
224
+ if (Config_1.Config.isOfBitType(bit.bitType, BitType_1.BitType.trueFalse1)) {
225
225
  if (((_b = (_a = bit.cardNode) === null || _a === void 0 ? void 0 : _a.statement) === null || _b === void 0 ? void 0 : _b.isCorrect) !== undefined) {
226
226
  defaultExample = bit.cardNode.statement.isCorrect;
227
227
  }
@@ -339,7 +339,7 @@ class JsonGenerator {
339
339
  return;
340
340
  // Create the listItems / sections if not already created
341
341
  let listItems;
342
- if (bitType.alias === BitType_1.AliasBitType.pageFooter) {
342
+ if (bitType === BitType_1.BitType.pageFooter) {
343
343
  if (!this.bitJson.sections)
344
344
  this.bitJson.sections = [];
345
345
  listItems = this.bitJson.sections;
@@ -946,13 +946,13 @@ class JsonGenerator {
946
946
  excessResources.push(rJson);
947
947
  }
948
948
  }
949
- // Extract comments from the AST and add to the parser
950
- const comments = Breakscape_1.Breakscape.unbreakscape(this.getInternalComments(route));
949
+ // Extract internal comments from the AST and add to the parser
950
+ const internalComments = Breakscape_1.Breakscape.unbreakscape(this.getInternalComments(route));
951
951
  if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType_1.NodeType.bitsValue) {
952
952
  // Bit level parser information
953
953
  this.bitWrapperJson.parser = Object.assign(Object.assign({ version,
954
954
  bitmarkVersion,
955
- comments }, parserRest), { warnings,
955
+ internalComments }, parserRest), { warnings,
956
956
  errors,
957
957
  excessResources });
958
958
  if (!this.options.enableWarnings) {
@@ -1689,9 +1689,9 @@ class JsonGenerator {
1689
1689
  return zoomDisabled;
1690
1690
  // The default value in the JSON is hardcoded, because there is currently no good way to set a different
1691
1691
  // default per bit in the BitConfig.
1692
- switch (bitType.alias) {
1693
- case BitType_1.AliasBitType.imageSeparator:
1694
- case BitType_1.AliasBitType.pageBanner:
1692
+ switch (bitType) {
1693
+ case BitType_1.BitType.imageSeparator:
1694
+ case BitType_1.BitType.pageBanner:
1695
1695
  return true;
1696
1696
  }
1697
1697
  return false;
@@ -1854,7 +1854,7 @@ class JsonGenerator {
1854
1854
  */
1855
1855
  createBitJson(bit) {
1856
1856
  const bitJson = {
1857
- type: bit.bitType.alias,
1857
+ type: bit.bitType,
1858
1858
  format: bit.textFormat,
1859
1859
  // Properties
1860
1860
  id: undefined,
@@ -1892,6 +1892,8 @@ class JsonGenerator {
1892
1892
  thumbImage: undefined,
1893
1893
  focusX: undefined,
1894
1894
  focusY: undefined,
1895
+ pointerLeft: undefined,
1896
+ pointerTop: undefined,
1895
1897
  deeplink: undefined,
1896
1898
  externalLink: undefined,
1897
1899
  externalLinkText: undefined,
@@ -1910,6 +1912,9 @@ class JsonGenerator {
1910
1912
  resolvedDate: undefined,
1911
1913
  resolvedBy: undefined,
1912
1914
  maxCreatedBits: undefined,
1915
+ product: undefined,
1916
+ productVideo: undefined,
1917
+ productFolder: undefined,
1913
1918
  // Book data
1914
1919
  title: undefined,
1915
1920
  subtitle: undefined,
@@ -1988,207 +1993,224 @@ class JsonGenerator {
1988
1993
  // NOTE: Not all bits have the same default properties.
1989
1994
  // The properties used are a bit random sometimes?
1990
1995
  // It would be better if this functionality was generated from the bit config
1991
- switch (bitType.root) {
1992
- case BitType_1.RootBitType._error:
1993
- case BitType_1.RootBitType._comment:
1994
- delete bitJson.format;
1995
- break;
1996
- case BitType_1.RootBitType.article:
1997
- case BitType_1.RootBitType.sampleSolution:
1998
- case BitType_1.RootBitType.page:
1999
- if (bitJson.body == null)
2000
- bitJson.body = this.bodyDefault;
2001
- break;
2002
- default: // Most bits have these defaults, but there are special cases (not sure if that is by error or design)
2003
- if (bitJson.item == null)
2004
- bitJson.item = this.textDefault;
2005
- if (bitJson.hint == null)
2006
- bitJson.hint = this.textDefault;
2007
- if (bitJson.isExample == null)
2008
- bitJson.isExample = false;
2009
- if (bitJson.example == null)
2010
- bitJson.example = null;
2011
- if (bitJson.body == null)
2012
- bitJson.body = this.bodyDefault;
2013
- // Special case for 'ai' bits
2014
- if (bitType.alias === BitType_1.AliasBitType.articleAi ||
2015
- bitType.alias === BitType_1.AliasBitType.noteAi ||
2016
- bitType.alias === BitType_1.AliasBitType.summaryAi) {
2017
- if (bitJson.AIGenerated == null)
2018
- bitJson.AIGenerated = true;
2019
- }
2020
- // Special case for 'review-...' bits
2021
- if (bitType.root === BitType_1.RootBitType.reviewNote) {
2022
- if (bitJson.resolved == null)
2023
- bitJson.resolved = false;
2024
- if (bitJson.resolvedDate == null)
2025
- bitJson.resolvedDate = '';
2026
- if (bitJson.resolvedBy == null)
2027
- bitJson.resolvedBy = '';
2028
- }
2029
- break;
1996
+ if (Config_1.Config.isOfBitType(bitType, [BitType_1.BitType._error, BitType_1.BitType._comment])) {
1997
+ //
1998
+ delete bitJson.format;
1999
+ //
2000
+ }
2001
+ else if (Config_1.Config.isOfBitType(bitType, [BitType_1.BitType.article, BitType_1.BitType.sampleSolution, BitType_1.BitType.page])) {
2002
+ //
2003
+ if (bitJson.body == null)
2004
+ bitJson.body = this.bodyDefault;
2005
+ //
2006
+ }
2007
+ else if (Config_1.Config.isOfBitType(bitType, [
2008
+ BitType_1.BitType.cloze,
2009
+ BitType_1.BitType.multipleChoice1,
2010
+ BitType_1.BitType.multipleResponse1,
2011
+ BitType_1.BitType.multipleChoiceText,
2012
+ BitType_1.BitType.highlightText,
2013
+ BitType_1.BitType.clozeAndMultipleChoiceText,
2014
+ BitType_1.BitType.sequence,
2015
+ BitType_1.BitType.mark,
2016
+ BitType_1.BitType.flashcard,
2017
+ ])) {
2030
2018
  // Default, but with no 'example' at the bit level.
2031
- case BitType_1.RootBitType.cloze:
2032
- case BitType_1.RootBitType.multipleChoice1:
2033
- case BitType_1.RootBitType.multipleResponse1:
2034
- case BitType_1.RootBitType.multipleChoiceText:
2035
- case BitType_1.RootBitType.highlightText:
2036
- case BitType_1.RootBitType.clozeAndMultipleChoiceText:
2037
- case BitType_1.RootBitType.sequence:
2038
- case BitType_1.RootBitType.mark:
2039
- case BitType_1.RootBitType.flashcard:
2040
- if (bitJson.item == null)
2041
- bitJson.item = this.textDefault;
2042
- if (bitJson.hint == null)
2043
- bitJson.hint = this.textDefault;
2044
- if (bitJson.instruction == null)
2045
- bitJson.instruction = this.textDefault;
2046
- if (bitJson.isExample == null)
2047
- bitJson.isExample = false;
2048
- if (bitJson.body == null)
2049
- bitJson.body = this.bodyDefault;
2050
- break;
2019
+ if (bitJson.item == null)
2020
+ bitJson.item = this.textDefault;
2021
+ if (bitJson.hint == null)
2022
+ bitJson.hint = this.textDefault;
2023
+ if (bitJson.instruction == null)
2024
+ bitJson.instruction = this.textDefault;
2025
+ if (bitJson.isExample == null)
2026
+ bitJson.isExample = false;
2027
+ if (bitJson.body == null)
2028
+ bitJson.body = this.bodyDefault;
2029
+ //
2030
+ }
2031
+ else if (Config_1.Config.isOfBitType(bitType, [BitType_1.BitType.multipleChoice, BitType_1.BitType.multipleResponse])) {
2051
2032
  // Default with a card (and hence a footer possibility)
2052
- case BitType_1.RootBitType.multipleChoice:
2053
- case BitType_1.RootBitType.multipleResponse:
2054
- if (bitJson.item == null)
2055
- bitJson.item = this.textDefault;
2056
- if (bitJson.hint == null)
2057
- bitJson.hint = this.textDefault;
2058
- if (bitJson.instruction == null)
2059
- bitJson.instruction = this.textDefault;
2060
- if (bitJson.isExample == null)
2061
- bitJson.isExample = false;
2062
- if (bitJson.body == null)
2063
- bitJson.body = this.bodyDefault;
2064
- if (bitJson.footer == null)
2065
- bitJson.footer = this.textDefault;
2066
- break;
2067
- case BitType_1.RootBitType.essay:
2068
- if (bitJson.item == null)
2069
- bitJson.item = this.textDefault;
2070
- if (bitJson.hint == null)
2071
- bitJson.hint = this.textDefault;
2072
- if (bitJson.instruction == null)
2073
- bitJson.instruction = this.textDefault;
2074
- if (bitJson.isExample == null)
2075
- bitJson.isExample = false;
2076
- if (bitJson.example == null)
2077
- bitJson.example = null;
2078
- if (bitJson.body == null)
2079
- bitJson.body = this.bodyDefault;
2080
- if (bitJson.partialAnswer == null)
2081
- bitJson.partialAnswer = '';
2082
- // if (bitJson.sampleSolution == null) bitJson.sampleSolution = '';
2083
- break;
2084
- case BitType_1.RootBitType.trueFalse1:
2085
- if (bitJson.item == null)
2086
- bitJson.item = this.textDefault;
2087
- if (bitJson.lead == null)
2088
- bitJson.lead = this.textDefault;
2089
- if (bitJson.hint == null)
2090
- bitJson.hint = this.textDefault;
2091
- if (bitJson.instruction == null)
2092
- bitJson.instruction = this.textDefault;
2093
- if (bitJson.isExample == null)
2094
- bitJson.isExample = false;
2095
- if (bitJson.example == null)
2096
- bitJson.example = null;
2097
- if (bitJson.isCorrect == null)
2098
- bitJson.isCorrect = false;
2099
- if (bitJson.body == null)
2100
- bitJson.body = this.bodyDefault;
2101
- break;
2102
- case BitType_1.RootBitType.trueFalse:
2103
- if (bitJson.item == null)
2104
- bitJson.item = this.textDefault;
2105
- if (bitJson.lead == null)
2106
- bitJson.lead = this.textDefault;
2107
- if (bitJson.hint == null)
2108
- bitJson.hint = this.textDefault;
2109
- if (bitJson.instruction == null)
2110
- bitJson.instruction = this.textDefault;
2111
- if (bitJson.isExample == null)
2112
- bitJson.isExample = false;
2113
- if (bitJson.labelFalse == null)
2114
- bitJson.labelFalse = '';
2115
- if (bitJson.labelTrue == null)
2116
- bitJson.labelTrue = '';
2117
- if (bitJson.body == null)
2118
- bitJson.body = this.bodyDefault;
2119
- break;
2120
- case BitType_1.RootBitType.chapter:
2121
- if (bitJson.item == null)
2122
- bitJson.item = this.textDefault;
2123
- if (bitJson.hint == null)
2124
- bitJson.hint = this.textDefault;
2125
- if (bitJson.isExample == null)
2126
- bitJson.isExample = false;
2127
- if (bitJson.example == null)
2128
- bitJson.example = null;
2129
- if (bitJson.toc == null)
2130
- bitJson.toc = true; // Always set on chapter bits?
2131
- if (bitJson.progress == null)
2132
- bitJson.progress = true; // Always set on chapter bits
2133
- if (bitJson.level == null)
2134
- bitJson.level = 1; // Set level 1 if none set (makes no sense, but in ANTLR parser)
2135
- if (bitJson.body == null)
2136
- bitJson.body = this.bodyDefault;
2137
- break;
2138
- case BitType_1.RootBitType.interview:
2139
- if (bitJson.item == null)
2140
- bitJson.item = this.textDefault;
2141
- if (bitJson.hint == null)
2142
- bitJson.hint = this.textDefault;
2143
- if (bitJson.instruction == null)
2144
- bitJson.instruction = this.textDefault;
2145
- if (bitJson.isExample == null)
2146
- bitJson.isExample = false;
2147
- if (bitJson.body == null)
2148
- bitJson.body = this.bodyDefault;
2149
- if (bitJson.footer == null)
2150
- bitJson.footer = this.textDefault;
2151
- if (bitJson.questions == null)
2152
- bitJson.questions = [];
2153
- break;
2154
- case BitType_1.RootBitType.match:
2155
- if (bitJson.item == null)
2156
- bitJson.item = this.textDefault;
2157
- if (bitJson.heading == null)
2158
- bitJson.heading = {};
2159
- if (bitJson.body == null)
2160
- bitJson.body = this.bodyDefault;
2161
- break;
2162
- case BitType_1.RootBitType.matchMatrix:
2163
- if (bitJson.item == null)
2164
- bitJson.item = this.textDefault;
2165
- if (bitJson.body == null)
2166
- bitJson.body = this.bodyDefault;
2167
- break;
2168
- case BitType_1.RootBitType.learningPathBook:
2169
- case BitType_1.RootBitType.learningPathExternalLink:
2170
- case BitType_1.RootBitType.learningPathVideoCall:
2171
- if (bitJson.item == null)
2172
- bitJson.item = this.textDefault;
2173
- if (bitJson.hint == null)
2174
- bitJson.hint = this.textDefault;
2175
- if (bitJson.isExample == null)
2176
- bitJson.isExample = false;
2177
- if (bitJson.example == null)
2178
- bitJson.example = null;
2179
- if (bitJson.isTracked == null)
2180
- bitJson.isTracked = true;
2181
- if (bitJson.isInfoOnly == null)
2182
- bitJson.isInfoOnly = false;
2183
- if (bitJson.body == null)
2184
- bitJson.body = this.bodyDefault;
2185
- break;
2186
- case BitType_1.RootBitType.pageBuyButton:
2187
- if (bitJson.content2Buy == null)
2188
- bitJson.content2Buy = '';
2189
- if (bitJson.body == null)
2190
- bitJson.body = this.bodyDefault;
2191
- break;
2033
+ if (bitJson.item == null)
2034
+ bitJson.item = this.textDefault;
2035
+ if (bitJson.hint == null)
2036
+ bitJson.hint = this.textDefault;
2037
+ if (bitJson.instruction == null)
2038
+ bitJson.instruction = this.textDefault;
2039
+ if (bitJson.isExample == null)
2040
+ bitJson.isExample = false;
2041
+ if (bitJson.body == null)
2042
+ bitJson.body = this.bodyDefault;
2043
+ if (bitJson.footer == null)
2044
+ bitJson.footer = this.textDefault;
2045
+ //
2046
+ }
2047
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.essay)) {
2048
+ //
2049
+ if (bitJson.item == null)
2050
+ bitJson.item = this.textDefault;
2051
+ if (bitJson.hint == null)
2052
+ bitJson.hint = this.textDefault;
2053
+ if (bitJson.instruction == null)
2054
+ bitJson.instruction = this.textDefault;
2055
+ if (bitJson.isExample == null)
2056
+ bitJson.isExample = false;
2057
+ if (bitJson.example == null)
2058
+ bitJson.example = null;
2059
+ if (bitJson.body == null)
2060
+ bitJson.body = this.bodyDefault;
2061
+ if (bitJson.partialAnswer == null)
2062
+ bitJson.partialAnswer = '';
2063
+ // if (bitJson.sampleSolution == null) bitJson.sampleSolution = '';
2064
+ //
2065
+ }
2066
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.trueFalse1)) {
2067
+ //
2068
+ if (bitJson.item == null)
2069
+ bitJson.item = this.textDefault;
2070
+ if (bitJson.lead == null)
2071
+ bitJson.lead = this.textDefault;
2072
+ if (bitJson.hint == null)
2073
+ bitJson.hint = this.textDefault;
2074
+ if (bitJson.instruction == null)
2075
+ bitJson.instruction = this.textDefault;
2076
+ if (bitJson.isExample == null)
2077
+ bitJson.isExample = false;
2078
+ if (bitJson.example == null)
2079
+ bitJson.example = null;
2080
+ if (bitJson.isCorrect == null)
2081
+ bitJson.isCorrect = false;
2082
+ if (bitJson.body == null)
2083
+ bitJson.body = this.bodyDefault;
2084
+ //
2085
+ }
2086
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.trueFalse)) {
2087
+ //
2088
+ if (bitJson.item == null)
2089
+ bitJson.item = this.textDefault;
2090
+ if (bitJson.lead == null)
2091
+ bitJson.lead = this.textDefault;
2092
+ if (bitJson.hint == null)
2093
+ bitJson.hint = this.textDefault;
2094
+ if (bitJson.instruction == null)
2095
+ bitJson.instruction = this.textDefault;
2096
+ if (bitJson.isExample == null)
2097
+ bitJson.isExample = false;
2098
+ if (bitJson.labelFalse == null)
2099
+ bitJson.labelFalse = '';
2100
+ if (bitJson.labelTrue == null)
2101
+ bitJson.labelTrue = '';
2102
+ if (bitJson.body == null)
2103
+ bitJson.body = this.bodyDefault;
2104
+ //
2105
+ }
2106
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.chapter)) {
2107
+ //
2108
+ if (bitJson.item == null)
2109
+ bitJson.item = this.textDefault;
2110
+ if (bitJson.hint == null)
2111
+ bitJson.hint = this.textDefault;
2112
+ if (bitJson.isExample == null)
2113
+ bitJson.isExample = false;
2114
+ if (bitJson.example == null)
2115
+ bitJson.example = null;
2116
+ if (bitJson.toc == null)
2117
+ bitJson.toc = true; // Always set on chapter bits?
2118
+ if (bitJson.progress == null)
2119
+ bitJson.progress = true; // Always set on chapter bits
2120
+ if (bitJson.level == null)
2121
+ bitJson.level = 1; // Set level 1 if none set (makes no sense, but in ANTLR parser)
2122
+ if (bitJson.body == null)
2123
+ bitJson.body = this.bodyDefault;
2124
+ //
2125
+ }
2126
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.interview)) {
2127
+ //
2128
+ if (bitJson.item == null)
2129
+ bitJson.item = this.textDefault;
2130
+ if (bitJson.hint == null)
2131
+ bitJson.hint = this.textDefault;
2132
+ if (bitJson.instruction == null)
2133
+ bitJson.instruction = this.textDefault;
2134
+ if (bitJson.isExample == null)
2135
+ bitJson.isExample = false;
2136
+ if (bitJson.body == null)
2137
+ bitJson.body = this.bodyDefault;
2138
+ if (bitJson.footer == null)
2139
+ bitJson.footer = this.textDefault;
2140
+ if (bitJson.questions == null)
2141
+ bitJson.questions = [];
2142
+ //
2143
+ }
2144
+ else if (bitType === BitType_1.BitType.matchMatrix) {
2145
+ //
2146
+ if (bitJson.item == null)
2147
+ bitJson.item = this.textDefault;
2148
+ if (bitJson.body == null)
2149
+ bitJson.body = this.bodyDefault;
2150
+ //
2151
+ }
2152
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.match)) {
2153
+ //
2154
+ if (bitJson.item == null)
2155
+ bitJson.item = this.textDefault;
2156
+ if (bitJson.heading == null)
2157
+ bitJson.heading = {};
2158
+ if (bitJson.body == null)
2159
+ bitJson.body = this.bodyDefault;
2160
+ //
2161
+ }
2162
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.learningPathBook)) {
2163
+ //
2164
+ if (bitJson.item == null)
2165
+ bitJson.item = this.textDefault;
2166
+ if (bitJson.hint == null)
2167
+ bitJson.hint = this.textDefault;
2168
+ if (bitJson.isExample == null)
2169
+ bitJson.isExample = false;
2170
+ if (bitJson.example == null)
2171
+ bitJson.example = null;
2172
+ if (bitJson.isTracked == null)
2173
+ bitJson.isTracked = true;
2174
+ if (bitJson.isInfoOnly == null)
2175
+ bitJson.isInfoOnly = false;
2176
+ if (bitJson.body == null)
2177
+ bitJson.body = this.bodyDefault;
2178
+ //
2179
+ }
2180
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.pageBuyButton)) {
2181
+ //
2182
+ if (bitJson.content2Buy == null)
2183
+ bitJson.content2Buy = '';
2184
+ if (bitJson.body == null)
2185
+ bitJson.body = this.bodyDefault;
2186
+ //
2187
+ }
2188
+ else {
2189
+ // Most bits have these defaults, but there are special cases (not sure if that is by error or design)
2190
+ if (bitJson.item == null)
2191
+ bitJson.item = this.textDefault;
2192
+ if (bitJson.hint == null)
2193
+ bitJson.hint = this.textDefault;
2194
+ if (bitJson.isExample == null)
2195
+ bitJson.isExample = false;
2196
+ if (bitJson.example == null)
2197
+ bitJson.example = null;
2198
+ if (bitJson.body == null)
2199
+ bitJson.body = this.bodyDefault;
2200
+ // Special case for 'ai' bits
2201
+ if (bitType === BitType_1.BitType.articleAi || bitType === BitType_1.BitType.noteAi || bitType === BitType_1.BitType.summaryAi) {
2202
+ if (bitJson.AIGenerated == null)
2203
+ bitJson.AIGenerated = true;
2204
+ }
2205
+ // Special case for 'review-...' bits
2206
+ if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.reviewNote)) {
2207
+ if (bitJson.resolved == null)
2208
+ bitJson.resolved = false;
2209
+ if (bitJson.resolvedDate == null)
2210
+ bitJson.resolvedDate = '';
2211
+ if (bitJson.resolvedBy == null)
2212
+ bitJson.resolvedBy = '';
2213
+ }
2192
2214
  }
2193
2215
  // Remove unwanted properties
2194
2216
  // Properties
@@ -2292,6 +2314,12 @@ class JsonGenerator {
2292
2314
  delete bitJson.resolvedBy;
2293
2315
  if (bitJson.maxCreatedBits == null)
2294
2316
  delete bitJson.maxCreatedBits;
2317
+ if (bitJson.product == null)
2318
+ delete bitJson.product;
2319
+ if (bitJson.productVideo == null)
2320
+ delete bitJson.productVideo;
2321
+ if (bitJson.productFolder == null)
2322
+ delete bitJson.productFolder;
2295
2323
  // Book data
2296
2324
  if (bitJson.title == null)
2297
2325
  delete bitJson.title;