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