@gmb/bitmark-parser-generator 1.4.15 → 1.4.16

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 (62) 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/ast/ResourceBuilder.js +10 -4
  4. package/dist/cjs/ast/ResourceBuilder.js.map +1 -1
  5. package/dist/cjs/config/raw/groups.js +4 -0
  6. package/dist/cjs/config/raw/groups.js.map +1 -1
  7. package/dist/cjs/config/raw/properties.js +5 -0
  8. package/dist/cjs/config/raw/properties.js.map +1 -1
  9. package/dist/cjs/generated/build-info.js +1 -1
  10. package/dist/cjs/generator/bitmark/BitmarkGenerator.js +5 -2
  11. package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +1 -1
  12. package/dist/cjs/generator/json/JsonGenerator.js +98 -74
  13. package/dist/cjs/generator/json/JsonGenerator.js.map +1 -1
  14. package/dist/cjs/model/ast/NodeType.js +1 -0
  15. package/dist/cjs/model/ast/NodeType.js.map +1 -1
  16. package/dist/cjs/model/config/enum/PropertyConfigKey.js +1 -0
  17. package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +1 -1
  18. package/dist/cjs/model/enum/PropertyTag.js +1 -0
  19. package/dist/cjs/model/enum/PropertyTag.js.map +1 -1
  20. package/dist/cjs/parser/json/JsonParser.js +1 -0
  21. package/dist/cjs/parser/json/JsonParser.js.map +1 -1
  22. package/dist/esm/ast/ResourceBuilder.js +10 -4
  23. package/dist/esm/ast/ResourceBuilder.js.map +1 -1
  24. package/dist/esm/config/raw/groups.js +4 -0
  25. package/dist/esm/config/raw/groups.js.map +1 -1
  26. package/dist/esm/config/raw/properties.js +5 -0
  27. package/dist/esm/config/raw/properties.js.map +1 -1
  28. package/dist/esm/generated/build-info.js +1 -1
  29. package/dist/esm/generator/bitmark/BitmarkGenerator.js +5 -2
  30. package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +1 -1
  31. package/dist/esm/generator/json/JsonGenerator.js +98 -74
  32. package/dist/esm/generator/json/JsonGenerator.js.map +1 -1
  33. package/dist/esm/model/ast/NodeType.js +1 -0
  34. package/dist/esm/model/ast/NodeType.js.map +1 -1
  35. package/dist/esm/model/config/enum/PropertyConfigKey.js +1 -0
  36. package/dist/esm/model/config/enum/PropertyConfigKey.js.map +1 -1
  37. package/dist/esm/model/enum/PropertyTag.js +1 -0
  38. package/dist/esm/model/enum/PropertyTag.js.map +1 -1
  39. package/dist/esm/parser/json/JsonParser.js +1 -0
  40. package/dist/esm/parser/json/JsonParser.js.map +1 -1
  41. package/dist/types/ast/ResourceBuilder.d.ts +3 -0
  42. package/dist/types/ast/ResourceBuilder.d.ts.map +1 -1
  43. package/dist/types/config/raw/groups.d.ts.map +1 -1
  44. package/dist/types/config/raw/properties.d.ts.map +1 -1
  45. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts +1 -0
  46. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts.map +1 -1
  47. package/dist/types/generator/json/JsonGenerator.d.ts +29 -21
  48. package/dist/types/generator/json/JsonGenerator.d.ts.map +1 -1
  49. package/dist/types/model/ast/NodeType.d.ts +2 -0
  50. package/dist/types/model/ast/NodeType.d.ts.map +1 -1
  51. package/dist/types/model/ast/Nodes.d.ts +2 -0
  52. package/dist/types/model/ast/Nodes.d.ts.map +1 -1
  53. package/dist/types/model/config/enum/ConfigKey.d.ts +2 -0
  54. package/dist/types/model/config/enum/ConfigKey.d.ts.map +1 -1
  55. package/dist/types/model/config/enum/PropertyConfigKey.d.ts +3 -0
  56. package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +1 -1
  57. package/dist/types/model/enum/PropertyTag.d.ts +2 -0
  58. package/dist/types/model/enum/PropertyTag.d.ts.map +1 -1
  59. package/dist/types/model/json/ResourceJson.d.ts +2 -0
  60. package/dist/types/model/json/ResourceJson.d.ts.map +1 -1
  61. package/dist/types/parser/json/JsonParser.d.ts.map +1 -1
  62. package/package.json +1 -1
@@ -262,16 +262,17 @@ class JsonGenerator {
262
262
  this.bitJson.imageSource = imageSourceJson;
263
263
  }
264
264
  // bitmarkAst -> bits -> bitsValue -> partner
265
- enter_partner(node, parent, _route) {
265
+ enter_partner(node, parent, route) {
266
266
  const partner = node.value;
267
+ const bitType = this.getBitType(route);
267
268
  // Ignore values that are not at the bit level as they might be handled elsewhere
268
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
269
+ if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue || !bitType)
269
270
  return;
270
271
  const { name, avatarImage } = partner;
271
272
  const partnerJson = {};
272
273
  this.addProperty(partnerJson, 'name', name !== null && name !== void 0 ? name : '', true);
273
274
  if (avatarImage) {
274
- const res = this.parseResourceToJson(avatarImage);
275
+ const res = this.parseResourceToJson(bitType, avatarImage);
275
276
  if (res && res.type === ResourceTag_1.ResourceTag.image) {
276
277
  partnerJson.avatarImage = res.image;
277
278
  }
@@ -685,16 +686,17 @@ class JsonGenerator {
685
686
  this.bitJson.heading = headingJson;
686
687
  }
687
688
  // bitmarkAst -> bits -> bitsValue -> cardNode -> pairs
688
- enter_pairs(node, _parent, _route) {
689
+ enter_pairs(node, _parent, route) {
689
690
  var _a, _b, _c, _d;
690
691
  const pairs = node.value;
691
692
  const pairsJson = [];
692
- if (pairs) {
693
+ const bitType = this.getBitType(route);
694
+ if (pairs && bitType) {
693
695
  for (const p of pairs) {
694
696
  // Get default example
695
697
  const defaultExample = Array.isArray(p.values) && p.values.length > 0 && p.values[0];
696
698
  // Create the question
697
- const pairJson = Object.assign(Object.assign(Object.assign({ key: (_a = Breakscape_1.Breakscape.unbreakscape(p.key)) !== null && _a !== void 0 ? _a : '', keyAudio: p.keyAudio ? this.addAudioResource(p.keyAudio) : undefined, keyImage: p.keyImage ? this.addImageResource(p.keyImage) : undefined, values: (_b = Breakscape_1.Breakscape.unbreakscape(p.values)) !== null && _b !== void 0 ? _b : [] }, this.toItemLeadHintInstruction(p)), { isCaseSensitive: (_c = p.isCaseSensitive) !== null && _c !== void 0 ? _c : true }), this.toExample(p, {
699
+ const pairJson = Object.assign(Object.assign(Object.assign({ key: (_a = Breakscape_1.Breakscape.unbreakscape(p.key)) !== null && _a !== void 0 ? _a : '', keyAudio: p.keyAudio ? this.addAudioResource(bitType, p.keyAudio) : undefined, keyImage: p.keyImage ? this.addImageResource(bitType, p.keyImage) : undefined, values: (_b = Breakscape_1.Breakscape.unbreakscape(p.values)) !== null && _b !== void 0 ? _b : [] }, this.toItemLeadHintInstruction(p)), { isCaseSensitive: (_c = p.isCaseSensitive) !== null && _c !== void 0 ? _c : true }), this.toExample(p, {
698
700
  defaultExample,
699
701
  isBoolean: false,
700
702
  }));
@@ -839,7 +841,7 @@ class JsonGenerator {
839
841
  if (r) {
840
842
  const tagConfig = Config_1.Config.getTagConfigForTag(bitConfig.tags, r.typeAlias);
841
843
  const key = (_a = tagConfig === null || tagConfig === void 0 ? void 0 : tagConfig.jsonKey) !== null && _a !== void 0 ? _a : r.typeAlias;
842
- const json = this.parseResourceToJson(r);
844
+ const json = this.parseResourceToJson(bitType, r);
843
845
  if (json) {
844
846
  for (const [k, v] of Object.entries(json)) {
845
847
  if (k !== 'type') {
@@ -857,7 +859,7 @@ class JsonGenerator {
857
859
  // This is a standard resource. If there is more than one resource, use the first one.
858
860
  // There should not be more than one because of validation
859
861
  if (resources.length >= 1) {
860
- resourceJson = this.parseResourceToJson(resources[0]);
862
+ resourceJson = this.parseResourceToJson(bitType, resources[0]);
861
863
  }
862
864
  }
863
865
  this.bitJson.resource = resourceJson;
@@ -930,7 +932,8 @@ class JsonGenerator {
930
932
  // bitmarkAst -> bits -> bitsValue -> * -> internalComment
931
933
  enter_parser(node, parent, route) {
932
934
  const parser = node.value;
933
- if (parser) {
935
+ const bitType = this.getBitType(route);
936
+ if (parser && bitType) {
934
937
  const { version, excessResources: parserExcessResources, warnings, errors } = parser, parserRest = __rest(parser, ["version", "excessResources", "warnings", "errors"]);
935
938
  const bitmarkVersion = `${this.bitmarkVersion}`;
936
939
  // Parse resources to JSON from AST
@@ -938,7 +941,7 @@ class JsonGenerator {
938
941
  if (Array.isArray(parserExcessResources) && parserExcessResources.length > 0) {
939
942
  excessResources = [];
940
943
  for (const r of parserExcessResources) {
941
- const rJson = this.parseResourceToJson(r);
944
+ const rJson = this.parseResourceToJson(bitType, r);
942
945
  if (rJson)
943
946
  excessResources.push(rJson);
944
947
  }
@@ -1103,7 +1106,7 @@ class JsonGenerator {
1103
1106
  delete highlightJson.lead;
1104
1107
  return highlightJson;
1105
1108
  }
1106
- parseResourceToJson(resource) {
1109
+ parseResourceToJson(bitType, resource) {
1107
1110
  if (!resource)
1108
1111
  return undefined;
1109
1112
  // All resources should now be valid as they are validated in the AST
@@ -1121,111 +1124,111 @@ class JsonGenerator {
1121
1124
  case ResourceTag_1.ResourceTag.image:
1122
1125
  resourceJson = {
1123
1126
  type: ResourceTag_1.ResourceTag.image,
1124
- image: this.addImageResource(resource),
1127
+ image: this.addImageResource(bitType, resource),
1125
1128
  };
1126
1129
  break;
1127
1130
  case ResourceTag_1.ResourceTag.imageLink:
1128
1131
  resourceJson = {
1129
1132
  type: ResourceTag_1.ResourceTag.imageLink,
1130
- imageLink: this.addImageLinkResource(resource),
1133
+ imageLink: this.addImageLinkResource(bitType, resource),
1131
1134
  };
1132
1135
  break;
1133
1136
  case ResourceTag_1.ResourceTag.audio:
1134
1137
  resourceJson = {
1135
1138
  type: ResourceTag_1.ResourceTag.audio,
1136
- audio: this.addAudioResource(resource),
1139
+ audio: this.addAudioResource(bitType, resource),
1137
1140
  };
1138
1141
  break;
1139
1142
  case ResourceTag_1.ResourceTag.audioEmbed:
1140
1143
  resourceJson = {
1141
1144
  type: ResourceTag_1.ResourceTag.audioEmbed,
1142
- audioEmbed: this.addAudioEmbedResource(resource),
1145
+ audioEmbed: this.addAudioEmbedResource(bitType, resource),
1143
1146
  };
1144
1147
  break;
1145
1148
  case ResourceTag_1.ResourceTag.audioLink:
1146
1149
  resourceJson = {
1147
1150
  type: ResourceTag_1.ResourceTag.audioLink,
1148
- audioLink: this.addAudioLinkResource(resource),
1151
+ audioLink: this.addAudioLinkResource(bitType, resource),
1149
1152
  };
1150
1153
  break;
1151
1154
  case ResourceTag_1.ResourceTag.video:
1152
1155
  resourceJson = {
1153
1156
  type: ResourceTag_1.ResourceTag.video,
1154
- video: this.addVideoResource(resource),
1157
+ video: this.addVideoResource(bitType, resource),
1155
1158
  };
1156
1159
  break;
1157
1160
  case ResourceTag_1.ResourceTag.videoEmbed:
1158
1161
  resourceJson = {
1159
1162
  type: ResourceTag_1.ResourceTag.videoEmbed,
1160
- videoEmbed: this.addVideoEmbedResource(resource),
1163
+ videoEmbed: this.addVideoEmbedResource(bitType, resource),
1161
1164
  };
1162
- resourceJson.videoEmbed = this.addVideoLinkResource(resource);
1165
+ resourceJson.videoEmbed = this.addVideoLinkResource(bitType, resource);
1163
1166
  break;
1164
1167
  case ResourceTag_1.ResourceTag.videoLink:
1165
1168
  resourceJson = {
1166
1169
  type: ResourceTag_1.ResourceTag.videoLink,
1167
- videoLink: this.addVideoLinkResource(resource),
1170
+ videoLink: this.addVideoLinkResource(bitType, resource),
1168
1171
  };
1169
1172
  break;
1170
1173
  case ResourceTag_1.ResourceTag.stillImageFilmEmbed:
1171
1174
  resourceJson = {
1172
1175
  type: ResourceTag_1.ResourceTag.stillImageFilmEmbed,
1173
- stillImageFilmEmbed: this.addStillImageFilmEmbedResource(resource),
1176
+ stillImageFilmEmbed: this.addStillImageFilmEmbedResource(bitType, resource),
1174
1177
  };
1175
1178
  break;
1176
1179
  case ResourceTag_1.ResourceTag.stillImageFilmLink:
1177
1180
  resourceJson = {
1178
1181
  type: ResourceTag_1.ResourceTag.stillImageFilmLink,
1179
- stillImageFilmLink: this.addStillImageFilmLinkResource(resource),
1182
+ stillImageFilmLink: this.addStillImageFilmLinkResource(bitType, resource),
1180
1183
  };
1181
1184
  break;
1182
1185
  case ResourceTag_1.ResourceTag.article:
1183
1186
  resourceJson = {
1184
1187
  type: ResourceTag_1.ResourceTag.article,
1185
- article: this.addArticleResource(resource),
1188
+ article: this.addArticleResource(bitType, resource),
1186
1189
  };
1187
1190
  break;
1188
1191
  case ResourceTag_1.ResourceTag.document:
1189
1192
  resourceJson = {
1190
1193
  type: ResourceTag_1.ResourceTag.document,
1191
- document: this.addDocumentResource(resource),
1194
+ document: this.addDocumentResource(bitType, resource),
1192
1195
  };
1193
1196
  break;
1194
1197
  case ResourceTag_1.ResourceTag.documentEmbed:
1195
1198
  resourceJson = {
1196
1199
  type: ResourceTag_1.ResourceTag.documentEmbed,
1197
- documentEmbed: this.addDocumentEmbedResource(resource),
1200
+ documentEmbed: this.addDocumentEmbedResource(bitType, resource),
1198
1201
  };
1199
1202
  break;
1200
1203
  case ResourceTag_1.ResourceTag.documentLink:
1201
1204
  resourceJson = {
1202
1205
  type: ResourceTag_1.ResourceTag.documentLink,
1203
- documentLink: this.addDocumentLinkResource(resource),
1206
+ documentLink: this.addDocumentLinkResource(bitType, resource),
1204
1207
  };
1205
1208
  break;
1206
1209
  case ResourceTag_1.ResourceTag.documentDownload:
1207
1210
  resourceJson = {
1208
1211
  type: ResourceTag_1.ResourceTag.documentDownload,
1209
- documentDownload: this.addDocumentDownloadResource(resource),
1212
+ documentDownload: this.addDocumentDownloadResource(bitType, resource),
1210
1213
  };
1211
1214
  break;
1212
1215
  case ResourceTag_1.ResourceTag.appLink:
1213
1216
  resourceJson = {
1214
1217
  type: ResourceTag_1.ResourceTag.appLink,
1215
- appLink: this.addAppLinkResource(resource),
1218
+ appLink: this.addAppLinkResource(bitType, resource),
1216
1219
  };
1217
1220
  break;
1218
1221
  case ResourceTag_1.ResourceTag.websiteLink:
1219
1222
  resourceJson = {
1220
1223
  type: ResourceTag_1.ResourceTag.websiteLink,
1221
- websiteLink: this.addWebsiteLinkResource(resource),
1224
+ websiteLink: this.addWebsiteLinkResource(bitType, resource),
1222
1225
  };
1223
1226
  break;
1224
1227
  default:
1225
1228
  }
1226
1229
  return resourceJson;
1227
1230
  }
1228
- addImageResource(resource) {
1231
+ addImageResource(bitType, resource) {
1229
1232
  var _a, _b, _c;
1230
1233
  const resourceJson = {};
1231
1234
  if (StringUtils_1.StringUtils.isString(resource)) {
@@ -1256,10 +1259,11 @@ class JsonGenerator {
1256
1259
  resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
1257
1260
  resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
1258
1261
  resourceJson.alt = (_c = Breakscape_1.Breakscape.unbreakscape(resource.alt)) !== null && _c !== void 0 ? _c : '';
1259
- this.addGenericResourceProperties(resource, resourceJson);
1262
+ resourceJson.zoomDisabled = this.getZoomDisabled(bitType, resource.zoomDisabled);
1263
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1260
1264
  return resourceJson;
1261
1265
  }
1262
- addImageLinkResource(resource) {
1266
+ addImageLinkResource(bitType, resource) {
1263
1267
  var _a, _b, _c;
1264
1268
  const resourceJson = {};
1265
1269
  if (StringUtils_1.StringUtils.isString(resource)) {
@@ -1290,10 +1294,11 @@ class JsonGenerator {
1290
1294
  resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
1291
1295
  resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
1292
1296
  resourceJson.alt = (_c = Breakscape_1.Breakscape.unbreakscape(resource.alt)) !== null && _c !== void 0 ? _c : '';
1293
- this.addGenericResourceProperties(resource, resourceJson);
1297
+ resourceJson.zoomDisabled = this.getZoomDisabled(bitType, resource.zoomDisabled);
1298
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1294
1299
  return resourceJson;
1295
1300
  }
1296
- addAudioResource(resource) {
1301
+ addAudioResource(bitType, resource) {
1297
1302
  const resourceJson = {};
1298
1303
  if (resource.format != null)
1299
1304
  resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
@@ -1307,10 +1312,10 @@ class JsonGenerator {
1307
1312
  resourceJson.mute = resource.mute;
1308
1313
  if (resource.autoplay != null)
1309
1314
  resourceJson.autoplay = resource.autoplay;
1310
- this.addGenericResourceProperties(resource, resourceJson);
1315
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1311
1316
  return resourceJson;
1312
1317
  }
1313
- addAudioEmbedResource(resource) {
1318
+ addAudioEmbedResource(bitType, resource) {
1314
1319
  const resourceJson = {};
1315
1320
  if (resource.format != null)
1316
1321
  resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
@@ -1324,10 +1329,10 @@ class JsonGenerator {
1324
1329
  resourceJson.mute = resource.mute;
1325
1330
  if (resource.autoplay != null)
1326
1331
  resourceJson.autoplay = resource.autoplay;
1327
- this.addGenericResourceProperties(resource, resourceJson);
1332
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1328
1333
  return resourceJson;
1329
1334
  }
1330
- addAudioLinkResource(resource) {
1335
+ addAudioLinkResource(bitType, resource) {
1331
1336
  const resourceJson = {};
1332
1337
  if (resource.format != null)
1333
1338
  resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
@@ -1341,10 +1346,10 @@ class JsonGenerator {
1341
1346
  resourceJson.mute = resource.mute;
1342
1347
  if (resource.autoplay != null)
1343
1348
  resourceJson.autoplay = resource.autoplay;
1344
- this.addGenericResourceProperties(resource, resourceJson, true);
1349
+ this.addGenericResourceProperties(bitType, resource, resourceJson, true);
1345
1350
  return resourceJson;
1346
1351
  }
1347
- addVideoResource(resource) {
1352
+ addVideoResource(bitType, resource) {
1348
1353
  var _a, _b;
1349
1354
  const resourceJson = {};
1350
1355
  if (resource.format != null)
@@ -1368,17 +1373,17 @@ class JsonGenerator {
1368
1373
  if (resource.alt != null)
1369
1374
  resourceJson.alt = Breakscape_1.Breakscape.unbreakscape(resource.alt);
1370
1375
  if (resource.posterImage != null)
1371
- resourceJson.posterImage = this.addImageResource(resource.posterImage);
1376
+ resourceJson.posterImage = this.addImageResource(bitType, resource.posterImage);
1372
1377
  if (resource.thumbnails != null && resource.thumbnails.length > 0) {
1373
1378
  resourceJson.thumbnails = [];
1374
1379
  for (const thumbnail of resource.thumbnails) {
1375
- resourceJson.thumbnails.push(this.addImageResource(thumbnail));
1380
+ resourceJson.thumbnails.push(this.addImageResource(bitType, thumbnail));
1376
1381
  }
1377
1382
  }
1378
- this.addGenericResourceProperties(resource, resourceJson);
1383
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1379
1384
  return resourceJson;
1380
1385
  }
1381
- addVideoEmbedResource(resource) {
1386
+ addVideoEmbedResource(bitType, resource) {
1382
1387
  var _a, _b;
1383
1388
  const resourceJson = {};
1384
1389
  if (resource.format != null)
@@ -1402,17 +1407,17 @@ class JsonGenerator {
1402
1407
  if (resource.alt != null)
1403
1408
  resourceJson.alt = Breakscape_1.Breakscape.unbreakscape(resource.alt);
1404
1409
  if (resource.posterImage != null)
1405
- resourceJson.posterImage = this.addImageResource(resource.posterImage);
1410
+ resourceJson.posterImage = this.addImageResource(bitType, resource.posterImage);
1406
1411
  if (resource.thumbnails != null && resource.thumbnails.length > 0) {
1407
1412
  resourceJson.thumbnails = [];
1408
1413
  for (const thumbnail of resource.thumbnails) {
1409
- resourceJson.thumbnails.push(this.addImageResource(thumbnail));
1414
+ resourceJson.thumbnails.push(this.addImageResource(bitType, thumbnail));
1410
1415
  }
1411
1416
  }
1412
- this.addGenericResourceProperties(resource, resourceJson);
1417
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1413
1418
  return resourceJson;
1414
1419
  }
1415
- addVideoLinkResource(resource) {
1420
+ addVideoLinkResource(bitType, resource) {
1416
1421
  var _a, _b;
1417
1422
  const resourceJson = {};
1418
1423
  if (resource.format != null)
@@ -1436,17 +1441,17 @@ class JsonGenerator {
1436
1441
  if (resource.alt != null)
1437
1442
  resourceJson.alt = Breakscape_1.Breakscape.unbreakscape(resource.alt);
1438
1443
  if (resource.posterImage != null)
1439
- resourceJson.posterImage = this.addImageResource(resource.posterImage);
1444
+ resourceJson.posterImage = this.addImageResource(bitType, resource.posterImage);
1440
1445
  if (resource.thumbnails != null && resource.thumbnails.length > 0) {
1441
1446
  resourceJson.thumbnails = [];
1442
1447
  for (const thumbnail of resource.thumbnails) {
1443
- resourceJson.thumbnails.push(this.addImageResource(thumbnail));
1448
+ resourceJson.thumbnails.push(this.addImageResource(bitType, thumbnail));
1444
1449
  }
1445
1450
  }
1446
- this.addGenericResourceProperties(resource, resourceJson);
1451
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1447
1452
  return resourceJson;
1448
1453
  }
1449
- addStillImageFilmEmbedResource(resource) {
1454
+ addStillImageFilmEmbedResource(bitType, resource) {
1450
1455
  var _a, _b;
1451
1456
  const resourceJson = {};
1452
1457
  if (resource.format != null)
@@ -1470,17 +1475,17 @@ class JsonGenerator {
1470
1475
  if (resource.alt != null)
1471
1476
  resourceJson.alt = Breakscape_1.Breakscape.unbreakscape(resource.alt);
1472
1477
  if (resource.posterImage != null)
1473
- resourceJson.posterImage = this.addImageResource(resource.posterImage);
1478
+ resourceJson.posterImage = this.addImageResource(bitType, resource.posterImage);
1474
1479
  if (resource.thumbnails != null && resource.thumbnails.length > 0) {
1475
1480
  resourceJson.thumbnails = [];
1476
1481
  for (const thumbnail of resource.thumbnails) {
1477
- resourceJson.thumbnails.push(this.addImageResource(thumbnail));
1482
+ resourceJson.thumbnails.push(this.addImageResource(bitType, thumbnail));
1478
1483
  }
1479
1484
  }
1480
- this.addGenericResourceProperties(resource, resourceJson);
1485
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1481
1486
  return resourceJson;
1482
1487
  }
1483
- addStillImageFilmLinkResource(resource) {
1488
+ addStillImageFilmLinkResource(bitType, resource) {
1484
1489
  var _a, _b;
1485
1490
  const resourceJson = {};
1486
1491
  if (resource.format != null)
@@ -1504,17 +1509,17 @@ class JsonGenerator {
1504
1509
  if (resource.alt != null)
1505
1510
  resourceJson.alt = Breakscape_1.Breakscape.unbreakscape(resource.alt);
1506
1511
  if (resource.posterImage != null)
1507
- resourceJson.posterImage = this.addImageResource(resource.posterImage);
1512
+ resourceJson.posterImage = this.addImageResource(bitType, resource.posterImage);
1508
1513
  if (resource.thumbnails != null && resource.thumbnails.length > 0) {
1509
1514
  resourceJson.thumbnails = [];
1510
1515
  for (const thumbnail of resource.thumbnails) {
1511
- resourceJson.thumbnails.push(this.addImageResource(thumbnail));
1516
+ resourceJson.thumbnails.push(this.addImageResource(bitType, thumbnail));
1512
1517
  }
1513
1518
  }
1514
- this.addGenericResourceProperties(resource, resourceJson);
1519
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1515
1520
  return resourceJson;
1516
1521
  }
1517
- addArticleResource(resource) {
1522
+ addArticleResource(bitType, resource) {
1518
1523
  const resourceJson = {};
1519
1524
  if (resource.format != null)
1520
1525
  resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
@@ -1523,10 +1528,10 @@ class JsonGenerator {
1523
1528
  if (resource.value != null)
1524
1529
  resourceJson.body = Breakscape_1.Breakscape.unbreakscape(resource.value);
1525
1530
  // if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
1526
- this.addGenericResourceProperties(resource, resourceJson);
1531
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1527
1532
  return resourceJson;
1528
1533
  }
1529
- addDocumentResource(resource) {
1534
+ addDocumentResource(bitType, resource) {
1530
1535
  const resourceJson = {};
1531
1536
  if (resource.format != null)
1532
1537
  resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
@@ -1535,10 +1540,10 @@ class JsonGenerator {
1535
1540
  if (resource.value != null)
1536
1541
  resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1537
1542
  // if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
1538
- this.addGenericResourceProperties(resource, resourceJson);
1543
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1539
1544
  return resourceJson;
1540
1545
  }
1541
- addDocumentEmbedResource(resource) {
1546
+ addDocumentEmbedResource(bitType, resource) {
1542
1547
  const resourceJson = {};
1543
1548
  if (resource.format != null)
1544
1549
  resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
@@ -1547,10 +1552,10 @@ class JsonGenerator {
1547
1552
  if (resource.value != null)
1548
1553
  resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1549
1554
  // if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
1550
- this.addGenericResourceProperties(resource, resourceJson);
1555
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1551
1556
  return resourceJson;
1552
1557
  }
1553
- addDocumentLinkResource(resource) {
1558
+ addDocumentLinkResource(bitType, resource) {
1554
1559
  const resourceJson = {};
1555
1560
  if (resource.format != null)
1556
1561
  resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
@@ -1559,10 +1564,10 @@ class JsonGenerator {
1559
1564
  if (resource.value != null)
1560
1565
  resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1561
1566
  // if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
1562
- this.addGenericResourceProperties(resource, resourceJson);
1567
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1563
1568
  return resourceJson;
1564
1569
  }
1565
- addDocumentDownloadResource(resource) {
1570
+ addDocumentDownloadResource(bitType, resource) {
1566
1571
  const resourceJson = {};
1567
1572
  if (resource.format != null)
1568
1573
  resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
@@ -1571,28 +1576,28 @@ class JsonGenerator {
1571
1576
  if (resource.value != null)
1572
1577
  resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1573
1578
  // if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
1574
- this.addGenericResourceProperties(resource, resourceJson);
1579
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1575
1580
  return resourceJson;
1576
1581
  }
1577
- addAppLinkResource(resource) {
1582
+ addAppLinkResource(bitType, resource) {
1578
1583
  const resourceJson = {};
1579
1584
  // if (resource.format != null) resourceJson.format = BreakscapeUtils.unbreakscape(resource.format);
1580
1585
  if (resource.value != null)
1581
1586
  resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1582
- this.addGenericResourceProperties(resource, resourceJson);
1587
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1583
1588
  return resourceJson;
1584
1589
  }
1585
- addWebsiteLinkResource(resource) {
1590
+ addWebsiteLinkResource(bitType, resource) {
1586
1591
  const resourceJson = {};
1587
1592
  // if (resource.format != null) resourceJson.format = BreakscapeUtils.unbreakscape(resource.format);
1588
1593
  if (resource.value != null)
1589
1594
  resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1590
1595
  if (resource.siteName != null)
1591
1596
  resourceJson.siteName = Breakscape_1.Breakscape.unbreakscape(resource.siteName);
1592
- this.addGenericResourceProperties(resource, resourceJson);
1597
+ this.addGenericResourceProperties(bitType, resource, resourceJson);
1593
1598
  return resourceJson;
1594
1599
  }
1595
- addGenericResourceProperties(resource, resourceJson, noDefaults) {
1600
+ addGenericResourceProperties(_bitType, resource, resourceJson, noDefaults) {
1596
1601
  var _a, _b, _c, _d, _e, _f, _g, _h;
1597
1602
  if (noDefaults) {
1598
1603
  if (resource.license != null)
@@ -1672,6 +1677,25 @@ class JsonGenerator {
1672
1677
  // }
1673
1678
  }
1674
1679
  }
1680
+ /**
1681
+ * Get the value for the zoomDisabled property, setting the appropriate default value if no value is set.
1682
+ *
1683
+ * @param bitType
1684
+ * @param zoomDisabled
1685
+ * @returns
1686
+ */
1687
+ getZoomDisabled(bitType, zoomDisabled) {
1688
+ if (zoomDisabled != null)
1689
+ return zoomDisabled;
1690
+ // The default value in the JSON is hardcoded, because there is currently no good way to set a different
1691
+ // default per bit in the BitConfig.
1692
+ switch (bitType.alias) {
1693
+ case BitType_1.AliasBitType.imageSeparator:
1694
+ case BitType_1.AliasBitType.pageBanner:
1695
+ return true;
1696
+ }
1697
+ return false;
1698
+ }
1675
1699
  /**
1676
1700
  * Get the bit type from any node
1677
1701
  *