@gmb/bitmark-parser-generator 4.6.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/bitmark-parser-generator.min.js +1 -1
- package/dist/browser/bundle-report.html +2 -2
- package/dist/browser/cjs/index.cjs +125 -11
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +44 -0
- package/dist/browser/esm/index.d.ts +44 -0
- package/dist/browser/esm/index.js +125 -11
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/index.cjs +383 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +383 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1110,6 +1110,7 @@ var propertyKeys = {
|
|
|
1110
1110
|
property_bookDiff: "@bookDiff",
|
|
1111
1111
|
property_bot: "@bot",
|
|
1112
1112
|
property_bubbleTag: "@bubbleTag",
|
|
1113
|
+
property_extractorTag: "@extractorTag",
|
|
1113
1114
|
property_buttonCaption: "@buttonCaption",
|
|
1114
1115
|
property_callToActionUrl: "@callToActionUrl",
|
|
1115
1116
|
property_caption: "@caption",
|
|
@@ -1237,6 +1238,7 @@ var propertyKeys = {
|
|
|
1237
1238
|
property_reference: "@reference",
|
|
1238
1239
|
property_refPublicationYear: "@refPublicationYear",
|
|
1239
1240
|
property_refPublisher: "@refPublisher",
|
|
1241
|
+
property_relatedBook: "@relatedBook",
|
|
1240
1242
|
property_releaseDate: "@releaseDate",
|
|
1241
1243
|
property_releaseKind: "@releaseKind",
|
|
1242
1244
|
property_releaseVersion: "@releaseVersion",
|
|
@@ -1260,6 +1262,7 @@ var propertyKeys = {
|
|
|
1260
1262
|
property_src2x: "@src2x",
|
|
1261
1263
|
property_src3x: "@src3x",
|
|
1262
1264
|
property_src4x: "@src4x",
|
|
1265
|
+
property_srcAlt: "@srcAlt",
|
|
1263
1266
|
property_stripePricingTableId: "@stripePricingTableId",
|
|
1264
1267
|
property_stripePublishableKey: "@stripePublishableKey",
|
|
1265
1268
|
property_subject: "@subject",
|
|
@@ -1511,6 +1514,16 @@ var StringUtils = class {
|
|
|
1511
1514
|
if (!str) return str;
|
|
1512
1515
|
return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
1513
1516
|
}
|
|
1517
|
+
/**
|
|
1518
|
+
* Convert a camelCase string to kebab-case.
|
|
1519
|
+
*
|
|
1520
|
+
* @param str the string to convert
|
|
1521
|
+
* @returns the kebab-case version of the string
|
|
1522
|
+
*/
|
|
1523
|
+
camelToKebab(str) {
|
|
1524
|
+
if (!str) return str;
|
|
1525
|
+
return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
1526
|
+
}
|
|
1514
1527
|
};
|
|
1515
1528
|
var stringUtils = new StringUtils();
|
|
1516
1529
|
|
|
@@ -2722,6 +2735,12 @@ var GROUPS = {
|
|
|
2722
2735
|
format: TagFormat.plainText,
|
|
2723
2736
|
maxCount: Count.infinity
|
|
2724
2737
|
},
|
|
2738
|
+
{
|
|
2739
|
+
key: ConfigKey.property_extractorTag,
|
|
2740
|
+
description: "The extractor tag(s) for the bit",
|
|
2741
|
+
format: TagFormat.plainText,
|
|
2742
|
+
maxCount: Count.infinity
|
|
2743
|
+
},
|
|
2725
2744
|
{
|
|
2726
2745
|
key: ConfigKey.property_levelCEFRp,
|
|
2727
2746
|
description: "The CEFRp level for the bit",
|
|
@@ -3179,6 +3198,12 @@ var GROUPS = {
|
|
|
3179
3198
|
format: TagFormat.plainText,
|
|
3180
3199
|
maxCount: Count.infinity
|
|
3181
3200
|
},
|
|
3201
|
+
{
|
|
3202
|
+
key: ConfigKey.property_relatedBook,
|
|
3203
|
+
description: "Books related to this book",
|
|
3204
|
+
format: TagFormat.plainText,
|
|
3205
|
+
maxCount: Count.infinity
|
|
3206
|
+
},
|
|
3182
3207
|
{
|
|
3183
3208
|
key: ConfigKey.property_duration,
|
|
3184
3209
|
description: "The duration of the book",
|
|
@@ -3336,6 +3361,12 @@ var GROUPS = {
|
|
|
3336
3361
|
key: ConfigKey.property_search,
|
|
3337
3362
|
description: "The search text for the resource",
|
|
3338
3363
|
format: TagFormat.plainText
|
|
3364
|
+
},
|
|
3365
|
+
{
|
|
3366
|
+
key: ConfigKey.property_srcAlt,
|
|
3367
|
+
description: "An alternative source for the resource",
|
|
3368
|
+
format: TagFormat.plainText,
|
|
3369
|
+
maxCount: Count.infinity
|
|
3339
3370
|
}
|
|
3340
3371
|
]
|
|
3341
3372
|
},
|
|
@@ -9057,7 +9088,7 @@ var instance2 = new Config();
|
|
|
9057
9088
|
// src/generated/package_info.ts
|
|
9058
9089
|
var PACKAGE_INFO = {
|
|
9059
9090
|
"name": "@gmb/bitmark-parser-generator",
|
|
9060
|
-
"version": "4.
|
|
9091
|
+
"version": "4.8.0",
|
|
9061
9092
|
"author": "Get More Brain Ltd",
|
|
9062
9093
|
"license": "ISC",
|
|
9063
9094
|
"description": "A bitmark parser and generator using Peggy.js"
|
|
@@ -9465,6 +9496,8 @@ var NodeType = superenum20({
|
|
|
9465
9496
|
botValue: "botValue",
|
|
9466
9497
|
bubbleTag: "bubbleTag",
|
|
9467
9498
|
bubbleTagValue: "bubbleTagValue",
|
|
9499
|
+
extractorTag: "extractorTag",
|
|
9500
|
+
extractorTagValue: "extractorTagValue",
|
|
9468
9501
|
buttonCaption: "buttonCaption",
|
|
9469
9502
|
buttonCaptionValue: "buttonCaptionValue",
|
|
9470
9503
|
callToActionUrl: "callToActionUrl",
|
|
@@ -9799,6 +9832,8 @@ var NodeType = superenum20({
|
|
|
9799
9832
|
referencePropertyValue: "referencePropertyValue",
|
|
9800
9833
|
refPublicationYear: "refPublicationYear",
|
|
9801
9834
|
refPublisher: "refPublisher",
|
|
9835
|
+
relatedBook: "relatedBook",
|
|
9836
|
+
relatedBookValue: "relatedBookValue",
|
|
9802
9837
|
releaseDate: "releaseDate",
|
|
9803
9838
|
releaseDateValue: "releaseDateValue",
|
|
9804
9839
|
releaseKind: "releaseKind",
|
|
@@ -9845,6 +9880,8 @@ var NodeType = superenum20({
|
|
|
9845
9880
|
spaceId: "spaceId",
|
|
9846
9881
|
spaceIdValue: "spaceIdValue",
|
|
9847
9882
|
src: "src",
|
|
9883
|
+
srcAlt: "srcAlt",
|
|
9884
|
+
srcAltValue: "srcAltValue",
|
|
9848
9885
|
src1x: "src1x",
|
|
9849
9886
|
src2x: "src2x",
|
|
9850
9887
|
src3x: "src3x",
|
|
@@ -21027,6 +21064,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21027
21064
|
type,
|
|
21028
21065
|
// Generic (except Article / Document)
|
|
21029
21066
|
value: url,
|
|
21067
|
+
// Alternative source
|
|
21068
|
+
srcAlt: data.srcAlt,
|
|
21030
21069
|
// ImageLikeResource / AudioLikeResource / VideoLikeResource / Article / Document
|
|
21031
21070
|
format: data.format,
|
|
21032
21071
|
// ImageLikeResource
|
|
@@ -21201,6 +21240,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21201
21240
|
imageResource(context, data, __typeAlias) {
|
|
21202
21241
|
const {
|
|
21203
21242
|
value,
|
|
21243
|
+
srcAlt,
|
|
21204
21244
|
src1x,
|
|
21205
21245
|
src2x,
|
|
21206
21246
|
src3x,
|
|
@@ -21233,6 +21273,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21233
21273
|
format: instance8.fileExtensionFromUrl(value) ?? void 0,
|
|
21234
21274
|
provider: instance8.domainFromUrl(value) ?? void 0,
|
|
21235
21275
|
src: value ?? "",
|
|
21276
|
+
srcAlt: srcAlt ?? void 0,
|
|
21236
21277
|
src1x: src1x ?? void 0,
|
|
21237
21278
|
src2x: src2x ?? void 0,
|
|
21238
21279
|
src3x: src3x ?? void 0,
|
|
@@ -21265,6 +21306,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21265
21306
|
imageLinkResource(context, data) {
|
|
21266
21307
|
const {
|
|
21267
21308
|
value,
|
|
21309
|
+
srcAlt,
|
|
21268
21310
|
src1x,
|
|
21269
21311
|
src2x,
|
|
21270
21312
|
src3x,
|
|
@@ -21288,6 +21330,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21288
21330
|
provider: instance8.domainFromUrl(value) ?? void 0,
|
|
21289
21331
|
// src: value ?? '',
|
|
21290
21332
|
url: value ?? "",
|
|
21333
|
+
srcAlt: srcAlt ?? void 0,
|
|
21291
21334
|
src1x: src1x ?? void 0,
|
|
21292
21335
|
src2x: src2x ?? void 0,
|
|
21293
21336
|
src3x: src3x ?? void 0,
|
|
@@ -21319,7 +21362,18 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21319
21362
|
* @returns
|
|
21320
21363
|
*/
|
|
21321
21364
|
audioResource(context, data) {
|
|
21322
|
-
const {
|
|
21365
|
+
const {
|
|
21366
|
+
value,
|
|
21367
|
+
srcAlt,
|
|
21368
|
+
duration,
|
|
21369
|
+
mute,
|
|
21370
|
+
autoplay,
|
|
21371
|
+
license,
|
|
21372
|
+
copyright,
|
|
21373
|
+
showInIndex,
|
|
21374
|
+
caption,
|
|
21375
|
+
search
|
|
21376
|
+
} = data;
|
|
21323
21377
|
const node = {
|
|
21324
21378
|
type: ResourceType.audio,
|
|
21325
21379
|
__typeAlias: ResourceType.audio,
|
|
@@ -21328,6 +21382,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21328
21382
|
format: instance8.fileExtensionFromUrl(value) ?? void 0,
|
|
21329
21383
|
provider: instance8.domainFromUrl(value) ?? void 0,
|
|
21330
21384
|
src: value ?? "",
|
|
21385
|
+
srcAlt: srcAlt ?? void 0,
|
|
21331
21386
|
duration: duration ?? void 0,
|
|
21332
21387
|
mute: mute ?? void 0,
|
|
21333
21388
|
autoplay: autoplay ?? void 0,
|
|
@@ -21352,7 +21407,18 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21352
21407
|
* @returns
|
|
21353
21408
|
*/
|
|
21354
21409
|
audioEmbedResource(context, data) {
|
|
21355
|
-
const {
|
|
21410
|
+
const {
|
|
21411
|
+
value,
|
|
21412
|
+
srcAlt,
|
|
21413
|
+
duration,
|
|
21414
|
+
mute,
|
|
21415
|
+
autoplay,
|
|
21416
|
+
license,
|
|
21417
|
+
copyright,
|
|
21418
|
+
showInIndex,
|
|
21419
|
+
caption,
|
|
21420
|
+
search
|
|
21421
|
+
} = data;
|
|
21356
21422
|
const node = {
|
|
21357
21423
|
type: ResourceType.audioEmbed,
|
|
21358
21424
|
__typeAlias: ResourceType.audioEmbed,
|
|
@@ -21361,6 +21427,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21361
21427
|
format: instance8.fileExtensionFromUrl(value) ?? void 0,
|
|
21362
21428
|
provider: instance8.domainFromUrl(value) ?? void 0,
|
|
21363
21429
|
src: value ?? "",
|
|
21430
|
+
srcAlt: srcAlt ?? void 0,
|
|
21364
21431
|
duration: duration ?? void 0,
|
|
21365
21432
|
mute: mute ?? void 0,
|
|
21366
21433
|
autoplay: autoplay ?? void 0,
|
|
@@ -21390,7 +21457,18 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21390
21457
|
* @returns
|
|
21391
21458
|
*/
|
|
21392
21459
|
audioLinkResource(context, data) {
|
|
21393
|
-
const {
|
|
21460
|
+
const {
|
|
21461
|
+
value,
|
|
21462
|
+
srcAlt,
|
|
21463
|
+
duration,
|
|
21464
|
+
mute,
|
|
21465
|
+
autoplay,
|
|
21466
|
+
license,
|
|
21467
|
+
copyright,
|
|
21468
|
+
showInIndex,
|
|
21469
|
+
caption,
|
|
21470
|
+
search
|
|
21471
|
+
} = data;
|
|
21394
21472
|
const node = {
|
|
21395
21473
|
type: ResourceType.audioLink,
|
|
21396
21474
|
__typeAlias: ResourceType.audioLink,
|
|
@@ -21400,6 +21478,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21400
21478
|
provider: instance8.domainFromUrl(value) ?? void 0,
|
|
21401
21479
|
// src: value ?? '',
|
|
21402
21480
|
url: value ?? "",
|
|
21481
|
+
srcAlt: srcAlt ?? void 0,
|
|
21403
21482
|
duration: duration ?? void 0,
|
|
21404
21483
|
mute: mute ?? void 0,
|
|
21405
21484
|
autoplay: autoplay ?? void 0,
|
|
@@ -21428,6 +21507,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21428
21507
|
videoResource(context, data) {
|
|
21429
21508
|
const {
|
|
21430
21509
|
value,
|
|
21510
|
+
srcAlt,
|
|
21431
21511
|
width,
|
|
21432
21512
|
height,
|
|
21433
21513
|
duration,
|
|
@@ -21452,6 +21532,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21452
21532
|
format: instance8.fileExtensionFromUrl(value) ?? void 0,
|
|
21453
21533
|
provider: instance8.domainFromUrl(value) ?? void 0,
|
|
21454
21534
|
src: value ?? "",
|
|
21535
|
+
srcAlt: srcAlt ?? void 0,
|
|
21455
21536
|
width: width ?? null,
|
|
21456
21537
|
height: height ?? null,
|
|
21457
21538
|
duration: duration ?? void 0,
|
|
@@ -21492,6 +21573,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21492
21573
|
videoEmbedResource(context, data) {
|
|
21493
21574
|
const {
|
|
21494
21575
|
value,
|
|
21576
|
+
srcAlt,
|
|
21495
21577
|
width,
|
|
21496
21578
|
height,
|
|
21497
21579
|
duration,
|
|
@@ -21517,6 +21599,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21517
21599
|
provider: instance8.domainFromUrl(value) ?? void 0,
|
|
21518
21600
|
// src: value ?? '',
|
|
21519
21601
|
url: value ?? "",
|
|
21602
|
+
srcAlt: srcAlt ?? void 0,
|
|
21520
21603
|
width: width ?? null,
|
|
21521
21604
|
height: height ?? null,
|
|
21522
21605
|
duration: duration ?? void 0,
|
|
@@ -21556,6 +21639,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21556
21639
|
videoLinkResource(context, data) {
|
|
21557
21640
|
const {
|
|
21558
21641
|
value,
|
|
21642
|
+
srcAlt,
|
|
21559
21643
|
width,
|
|
21560
21644
|
height,
|
|
21561
21645
|
duration,
|
|
@@ -21581,6 +21665,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21581
21665
|
provider: instance8.domainFromUrl(value) ?? void 0,
|
|
21582
21666
|
// src: value ?? '',
|
|
21583
21667
|
url: value ?? "",
|
|
21668
|
+
srcAlt: srcAlt ?? void 0,
|
|
21584
21669
|
width: width ?? null,
|
|
21585
21670
|
height: height ?? null,
|
|
21586
21671
|
duration: duration ?? void 0,
|
|
@@ -21640,6 +21725,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21640
21725
|
stillImageFilmEmbedResource(context, data) {
|
|
21641
21726
|
const {
|
|
21642
21727
|
value,
|
|
21728
|
+
srcAlt,
|
|
21643
21729
|
width,
|
|
21644
21730
|
height,
|
|
21645
21731
|
duration,
|
|
@@ -21665,6 +21751,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21665
21751
|
provider: instance8.domainFromUrl(value) ?? void 0,
|
|
21666
21752
|
// src: value ?? '',
|
|
21667
21753
|
url: value ?? "",
|
|
21754
|
+
srcAlt: srcAlt ?? void 0,
|
|
21668
21755
|
width: width ?? null,
|
|
21669
21756
|
height: height ?? null,
|
|
21670
21757
|
duration: duration ?? void 0,
|
|
@@ -21704,6 +21791,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21704
21791
|
stillImageFilmLinkResource(context, data) {
|
|
21705
21792
|
const {
|
|
21706
21793
|
value,
|
|
21794
|
+
srcAlt,
|
|
21707
21795
|
width,
|
|
21708
21796
|
height,
|
|
21709
21797
|
duration,
|
|
@@ -21729,6 +21817,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21729
21817
|
provider: instance8.domainFromUrl(value) ?? void 0,
|
|
21730
21818
|
// src: value ?? '',
|
|
21731
21819
|
url: value ?? "",
|
|
21820
|
+
srcAlt: srcAlt ?? void 0,
|
|
21732
21821
|
width: width ?? null,
|
|
21733
21822
|
height: height ?? null,
|
|
21734
21823
|
duration: duration ?? void 0,
|
|
@@ -21766,7 +21855,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21766
21855
|
* @returns
|
|
21767
21856
|
*/
|
|
21768
21857
|
articleResource(context, data) {
|
|
21769
|
-
const { value, license, copyright, showInIndex, caption, search } = data;
|
|
21858
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
21770
21859
|
const node = {
|
|
21771
21860
|
type: ResourceType.article,
|
|
21772
21861
|
__typeAlias: ResourceType.article,
|
|
@@ -21775,6 +21864,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21775
21864
|
format: instance8.fileExtensionFromUrl(value) ?? void 0,
|
|
21776
21865
|
provider: instance8.domainFromUrl(value) ?? void 0,
|
|
21777
21866
|
body: value ?? "",
|
|
21867
|
+
srcAlt: srcAlt ?? void 0,
|
|
21778
21868
|
license: license ?? "",
|
|
21779
21869
|
copyright: copyright ?? "",
|
|
21780
21870
|
showInIndex: showInIndex ?? false,
|
|
@@ -21795,7 +21885,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21795
21885
|
* @returns
|
|
21796
21886
|
*/
|
|
21797
21887
|
documentResource(context, data) {
|
|
21798
|
-
const { value, license, copyright, showInIndex, caption, search } = data;
|
|
21888
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
21799
21889
|
const node = {
|
|
21800
21890
|
type: ResourceType.document,
|
|
21801
21891
|
__typeAlias: ResourceType.document,
|
|
@@ -21804,6 +21894,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21804
21894
|
format: instance8.fileExtensionFromUrl(value) ?? void 0,
|
|
21805
21895
|
provider: instance8.domainFromUrl(value) ?? void 0,
|
|
21806
21896
|
url: value ?? "",
|
|
21897
|
+
srcAlt: srcAlt ?? void 0,
|
|
21807
21898
|
license: license ?? "",
|
|
21808
21899
|
copyright: copyright ?? "",
|
|
21809
21900
|
showInIndex: showInIndex ?? false,
|
|
@@ -21825,7 +21916,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21825
21916
|
* @returns
|
|
21826
21917
|
*/
|
|
21827
21918
|
documentEmbedResource(context, data) {
|
|
21828
|
-
const { value, license, copyright, showInIndex, caption, search } = data;
|
|
21919
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
21829
21920
|
const node = {
|
|
21830
21921
|
type: ResourceType.documentEmbed,
|
|
21831
21922
|
__typeAlias: ResourceType.documentEmbed,
|
|
@@ -21834,6 +21925,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21834
21925
|
format: instance8.fileExtensionFromUrl(value) ?? void 0,
|
|
21835
21926
|
provider: instance8.domainFromUrl(value) ?? void 0,
|
|
21836
21927
|
url: value ?? "",
|
|
21928
|
+
srcAlt: srcAlt ?? void 0,
|
|
21837
21929
|
license: license ?? "",
|
|
21838
21930
|
copyright: copyright ?? "",
|
|
21839
21931
|
showInIndex: showInIndex ?? false,
|
|
@@ -21855,7 +21947,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21855
21947
|
* @returns
|
|
21856
21948
|
*/
|
|
21857
21949
|
documentLinkResource(context, data) {
|
|
21858
|
-
const { value, license, copyright, showInIndex, caption, search } = data;
|
|
21950
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
21859
21951
|
const node = {
|
|
21860
21952
|
type: ResourceType.documentLink,
|
|
21861
21953
|
__typeAlias: ResourceType.documentLink,
|
|
@@ -21864,6 +21956,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21864
21956
|
format: instance8.fileExtensionFromUrl(value) ?? void 0,
|
|
21865
21957
|
provider: instance8.domainFromUrl(value) ?? void 0,
|
|
21866
21958
|
url: value ?? "",
|
|
21959
|
+
srcAlt: srcAlt ?? void 0,
|
|
21867
21960
|
license: license ?? "",
|
|
21868
21961
|
copyright: copyright ?? "",
|
|
21869
21962
|
showInIndex: showInIndex ?? false,
|
|
@@ -21885,7 +21978,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21885
21978
|
* @returns
|
|
21886
21979
|
*/
|
|
21887
21980
|
documentDownloadResource(context, data) {
|
|
21888
|
-
const { value, license, copyright, showInIndex, caption, search } = data;
|
|
21981
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
21889
21982
|
const node = {
|
|
21890
21983
|
type: ResourceType.documentDownload,
|
|
21891
21984
|
__typeAlias: ResourceType.documentDownload,
|
|
@@ -21894,6 +21987,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21894
21987
|
format: instance8.fileExtensionFromUrl(value) ?? void 0,
|
|
21895
21988
|
provider: instance8.domainFromUrl(value) ?? void 0,
|
|
21896
21989
|
url: value ?? "",
|
|
21990
|
+
srcAlt: srcAlt ?? void 0,
|
|
21897
21991
|
license: license ?? "",
|
|
21898
21992
|
copyright: copyright ?? "",
|
|
21899
21993
|
showInIndex: showInIndex ?? false,
|
|
@@ -21915,7 +22009,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21915
22009
|
* @returns
|
|
21916
22010
|
*/
|
|
21917
22011
|
appLinkResource(context, data) {
|
|
21918
|
-
const { value, license, copyright, showInIndex, caption, search } = data;
|
|
22012
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
21919
22013
|
const node = {
|
|
21920
22014
|
type: ResourceType.appLink,
|
|
21921
22015
|
__typeAlias: ResourceType.appLink,
|
|
@@ -21925,6 +22019,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21925
22019
|
// provider: (UrlUtils.domainFromUrl(value) ?? undefined) as string,
|
|
21926
22020
|
provider: void 0,
|
|
21927
22021
|
url: value ?? "",
|
|
22022
|
+
srcAlt: srcAlt ?? void 0,
|
|
21928
22023
|
license: license ?? "",
|
|
21929
22024
|
copyright: copyright ?? "",
|
|
21930
22025
|
showInIndex: showInIndex ?? false,
|
|
@@ -21953,6 +22048,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21953
22048
|
websiteLinkResource(context, data) {
|
|
21954
22049
|
const {
|
|
21955
22050
|
value,
|
|
22051
|
+
srcAlt,
|
|
21956
22052
|
/*siteName,*/
|
|
21957
22053
|
license,
|
|
21958
22054
|
copyright,
|
|
@@ -21968,6 +22064,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
21968
22064
|
// provider: (UrlUtils.domainFromUrl(value) ?? undefined) as string,
|
|
21969
22065
|
provider: void 0,
|
|
21970
22066
|
url: value ?? "",
|
|
22067
|
+
srcAlt: srcAlt ?? void 0,
|
|
21971
22068
|
// siteName,
|
|
21972
22069
|
license: license ?? "",
|
|
21973
22070
|
copyright: copyright ?? "",
|
|
@@ -22215,6 +22312,12 @@ var Builder = class extends BaseBuilder {
|
|
|
22215
22312
|
options
|
|
22216
22313
|
),
|
|
22217
22314
|
bubbleTag: this.toAstProperty(bitType, ConfigKey.property_bubbleTag, data.bubbleTag, options),
|
|
22315
|
+
extractorTag: this.toAstProperty(
|
|
22316
|
+
bitType,
|
|
22317
|
+
ConfigKey.property_extractorTag,
|
|
22318
|
+
data.extractorTag,
|
|
22319
|
+
options
|
|
22320
|
+
),
|
|
22218
22321
|
levelCEFRp: this.toAstProperty(
|
|
22219
22322
|
bitType,
|
|
22220
22323
|
ConfigKey.property_levelCEFRp,
|
|
@@ -22259,6 +22362,12 @@ var Builder = class extends BaseBuilder {
|
|
|
22259
22362
|
data.publications,
|
|
22260
22363
|
options
|
|
22261
22364
|
),
|
|
22365
|
+
relatedBook: this.toAstProperty(
|
|
22366
|
+
bitType,
|
|
22367
|
+
ConfigKey.property_relatedBook,
|
|
22368
|
+
data.relatedBook,
|
|
22369
|
+
options
|
|
22370
|
+
),
|
|
22262
22371
|
author: this.toAstProperty(bitType, ConfigKey.property_author, data.author, options),
|
|
22263
22372
|
subject: this.toAstProperty(bitType, ConfigKey.property_subject, data.subject, options),
|
|
22264
22373
|
date: this.toAstProperty(bitType, ConfigKey.property_date, data.date, options),
|
|
@@ -26126,7 +26235,12 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
26126
26235
|
// bitmarkAst -> bits -> bitsValue -> resource -> ...
|
|
26127
26236
|
// bitmarkAst -> bits -> bitsValue -> resource -> posterImage -> ...
|
|
26128
26237
|
// bitmarkAst -> bits -> bitsValue -> resource -> thumbnails -> thumbnailsValue -> ...
|
|
26129
|
-
// [src1x,src2x,src3x,src4x,width,height,alt,zoomDisabled,caption]
|
|
26238
|
+
// [srcAlt,src1x,src2x,src3x,src4x,width,height,alt,zoomDisabled,caption]
|
|
26239
|
+
leaf_srcAltValue(node, route) {
|
|
26240
|
+
this.writeProperty("srcAlt", node.value, route, {
|
|
26241
|
+
format: TagFormat.plainText
|
|
26242
|
+
});
|
|
26243
|
+
}
|
|
26130
26244
|
leaf_src1x(node, route) {
|
|
26131
26245
|
this.writeProperty("src1x", node.value, route, {
|
|
26132
26246
|
format: TagFormat.plainText
|
|
@@ -35664,6 +35778,264 @@ var ConfigBuilder = class {
|
|
|
35664
35778
|
build(options) {
|
|
35665
35779
|
const opts = Object.assign({}, options);
|
|
35666
35780
|
this.buildFlat(opts);
|
|
35781
|
+
const bitConfigs = [];
|
|
35782
|
+
const groupConfigs = [];
|
|
35783
|
+
for (const bt of BitType.values()) {
|
|
35784
|
+
const bitType = instance2.getBitType(bt);
|
|
35785
|
+
const _bitConfig = BITS[bitType];
|
|
35786
|
+
if (_bitConfig) {
|
|
35787
|
+
_bitConfig.bitType = bitType;
|
|
35788
|
+
bitConfigs.push(_bitConfig);
|
|
35789
|
+
}
|
|
35790
|
+
}
|
|
35791
|
+
for (const [k, g] of Object.entries(GROUPS)) {
|
|
35792
|
+
const g2 = g;
|
|
35793
|
+
let k2 = k;
|
|
35794
|
+
if (k.startsWith("group_")) k2 = k2.substring(6);
|
|
35795
|
+
k2 = /*'_' +*/
|
|
35796
|
+
stringUtils.camelToKebab(k2);
|
|
35797
|
+
g2.key = k2;
|
|
35798
|
+
groupConfigs.push(g2);
|
|
35799
|
+
}
|
|
35800
|
+
const outputFolder = opts.outputDir ?? "assets/config";
|
|
35801
|
+
const outputFolderBits = path3.join(outputFolder, "bits");
|
|
35802
|
+
const outputFolderGroups = path3.join(outputFolder, "partials");
|
|
35803
|
+
fs3.ensureDirSync(outputFolderBits);
|
|
35804
|
+
fs3.ensureDirSync(outputFolderGroups);
|
|
35805
|
+
const fileWrites = [];
|
|
35806
|
+
for (const b of bitConfigs) {
|
|
35807
|
+
const inherits = [];
|
|
35808
|
+
const tags2 = [];
|
|
35809
|
+
const tagEntriesTypeOrder = [
|
|
35810
|
+
BitTagConfigKeyType.tag,
|
|
35811
|
+
BitTagConfigKeyType.property,
|
|
35812
|
+
BitTagConfigKeyType.resource,
|
|
35813
|
+
BitTagConfigKeyType.group,
|
|
35814
|
+
BitTagConfigKeyType.unknown
|
|
35815
|
+
];
|
|
35816
|
+
const tagEntries = Object.entries(b.tags ?? []).sort((a, b2) => {
|
|
35817
|
+
const tagA = a[1];
|
|
35818
|
+
const tagB = b2[1];
|
|
35819
|
+
const typeA = typeFromConfigKey(tagA.key);
|
|
35820
|
+
const typeB = typeFromConfigKey(tagB.key);
|
|
35821
|
+
const typeOrder = tagEntriesTypeOrder.indexOf(typeA) - tagEntriesTypeOrder.indexOf(typeB);
|
|
35822
|
+
return typeOrder;
|
|
35823
|
+
});
|
|
35824
|
+
if (b.baseBitType) inherits.push(b.baseBitType);
|
|
35825
|
+
for (const [_tagKey, tag] of tagEntries) {
|
|
35826
|
+
const tagName = tag.key;
|
|
35827
|
+
let format = "";
|
|
35828
|
+
let chain = void 0;
|
|
35829
|
+
const tagType = typeFromConfigKey(tag.key);
|
|
35830
|
+
if (tagType === BitTagConfigKeyType.tag) {
|
|
35831
|
+
if (tagName === "%") {
|
|
35832
|
+
chain = {
|
|
35833
|
+
key: "%",
|
|
35834
|
+
format,
|
|
35835
|
+
min: tag.minCount,
|
|
35836
|
+
max: tag.maxCount,
|
|
35837
|
+
description: "Lead",
|
|
35838
|
+
chain: {
|
|
35839
|
+
key: "%",
|
|
35840
|
+
format,
|
|
35841
|
+
min: tag.minCount,
|
|
35842
|
+
max: tag.maxCount,
|
|
35843
|
+
description: "Page number",
|
|
35844
|
+
chain: {
|
|
35845
|
+
key: "%",
|
|
35846
|
+
format,
|
|
35847
|
+
min: tag.minCount,
|
|
35848
|
+
max: tag.maxCount,
|
|
35849
|
+
description: "Margin number"
|
|
35850
|
+
}
|
|
35851
|
+
}
|
|
35852
|
+
};
|
|
35853
|
+
}
|
|
35854
|
+
format = "bitmark--";
|
|
35855
|
+
} else if (tagType === BitTagConfigKeyType.property) {
|
|
35856
|
+
if (tag.format === TagFormat.plainText) {
|
|
35857
|
+
format = "string";
|
|
35858
|
+
} else if (tag.format === TagFormat.boolean) {
|
|
35859
|
+
format = "bool";
|
|
35860
|
+
} else if (tag.format === TagFormat.bitmarkText) {
|
|
35861
|
+
format = "bitmark";
|
|
35862
|
+
} else if (tag.format === TagFormat.number) {
|
|
35863
|
+
format = "number";
|
|
35864
|
+
}
|
|
35865
|
+
} else if (tagType === BitTagConfigKeyType.resource) {
|
|
35866
|
+
} else if (tagType === BitTagConfigKeyType.group) {
|
|
35867
|
+
let k = tag.key;
|
|
35868
|
+
if (k.startsWith("group_")) k = k.substring(6);
|
|
35869
|
+
k = "_" + k;
|
|
35870
|
+
inherits.push(k);
|
|
35871
|
+
continue;
|
|
35872
|
+
}
|
|
35873
|
+
const t = {
|
|
35874
|
+
key: tagName,
|
|
35875
|
+
format,
|
|
35876
|
+
default: null,
|
|
35877
|
+
alwaysInclude: false,
|
|
35878
|
+
min: tag.minCount == null ? 0 : tag.minCount,
|
|
35879
|
+
max: tag.maxCount == null ? 1 : tag.maxCount,
|
|
35880
|
+
description: tag.description ?? "",
|
|
35881
|
+
chain
|
|
35882
|
+
// raw: {
|
|
35883
|
+
// ...tag,
|
|
35884
|
+
// },
|
|
35885
|
+
};
|
|
35886
|
+
tags2.push(t);
|
|
35887
|
+
}
|
|
35888
|
+
const bitJson = {
|
|
35889
|
+
name: b.bitType,
|
|
35890
|
+
description: b.description ?? "",
|
|
35891
|
+
since: b.since,
|
|
35892
|
+
deprecated: b.deprecated,
|
|
35893
|
+
history: [
|
|
35894
|
+
{
|
|
35895
|
+
version: b.since,
|
|
35896
|
+
changes: ["Initial version"]
|
|
35897
|
+
}
|
|
35898
|
+
],
|
|
35899
|
+
format: b.textFormatDefault ?? "bitmark--",
|
|
35900
|
+
bodyAllowed: b.bodyAllowed ?? true,
|
|
35901
|
+
bodyRequired: b.bodyRequired ?? false,
|
|
35902
|
+
footerAllowed: b.footerAllowed ?? true,
|
|
35903
|
+
footerRequired: b.footerRequired ?? false,
|
|
35904
|
+
resourceAttachmentAllowed: b.resourceAttachmentAllowed ?? true,
|
|
35905
|
+
inherits,
|
|
35906
|
+
tags: tags2
|
|
35907
|
+
};
|
|
35908
|
+
const output = path3.join(outputFolderBits, `${b.bitType}.jsonc`);
|
|
35909
|
+
const str = JSON.stringify(bitJson, null, 2);
|
|
35910
|
+
fileWrites.push(fs3.writeFile(output, str));
|
|
35911
|
+
}
|
|
35912
|
+
const writeGroupConfigs = (groupConfigs2) => {
|
|
35913
|
+
for (const g of groupConfigs2) {
|
|
35914
|
+
const inherits = [];
|
|
35915
|
+
const tags2 = [];
|
|
35916
|
+
const groupKey = stringUtils.camelToKebab(g.key);
|
|
35917
|
+
const tagEntriesTypeOrder = [
|
|
35918
|
+
BitTagConfigKeyType.tag,
|
|
35919
|
+
BitTagConfigKeyType.property,
|
|
35920
|
+
BitTagConfigKeyType.resource,
|
|
35921
|
+
BitTagConfigKeyType.group
|
|
35922
|
+
];
|
|
35923
|
+
const tagEntries = Object.entries(g.tags ?? []).sort((a, b) => {
|
|
35924
|
+
const tagA = a[1];
|
|
35925
|
+
const tagB = b[1];
|
|
35926
|
+
const typeOrder = tagEntriesTypeOrder.indexOf(tagA.type) - tagEntriesTypeOrder.indexOf(tagB.type);
|
|
35927
|
+
return typeOrder;
|
|
35928
|
+
});
|
|
35929
|
+
for (const [_tagKey, tag] of tagEntries) {
|
|
35930
|
+
let tagName = tag.key;
|
|
35931
|
+
const tagType = typeFromConfigKey(tag.key);
|
|
35932
|
+
let format = "";
|
|
35933
|
+
let chain = void 0;
|
|
35934
|
+
if (tagType === BitTagConfigKeyType.tag) {
|
|
35935
|
+
tagName = tag.name;
|
|
35936
|
+
if (tagName === "%") {
|
|
35937
|
+
chain = {
|
|
35938
|
+
key: "%",
|
|
35939
|
+
format,
|
|
35940
|
+
min: tag.minCount,
|
|
35941
|
+
max: tag.maxCount,
|
|
35942
|
+
description: "Lead",
|
|
35943
|
+
chain: {
|
|
35944
|
+
key: "%",
|
|
35945
|
+
format,
|
|
35946
|
+
min: tag.minCount,
|
|
35947
|
+
max: tag.maxCount,
|
|
35948
|
+
description: "Page number",
|
|
35949
|
+
chain: {
|
|
35950
|
+
key: "%",
|
|
35951
|
+
format,
|
|
35952
|
+
min: tag.minCount,
|
|
35953
|
+
max: tag.maxCount,
|
|
35954
|
+
description: "Margin number"
|
|
35955
|
+
}
|
|
35956
|
+
}
|
|
35957
|
+
};
|
|
35958
|
+
}
|
|
35959
|
+
format = "bitmark--";
|
|
35960
|
+
} else if (tagType === BitTagConfigKeyType.property) {
|
|
35961
|
+
tagName = tag.key;
|
|
35962
|
+
if (tag.format === TagFormat.plainText) {
|
|
35963
|
+
format = "string";
|
|
35964
|
+
} else if (tag.format === TagFormat.boolean) {
|
|
35965
|
+
format = "bool";
|
|
35966
|
+
} else if (tag.format === TagFormat.bitmarkText) {
|
|
35967
|
+
format = "bitmark";
|
|
35968
|
+
} else if (tag.format === TagFormat.number) {
|
|
35969
|
+
format = "number";
|
|
35970
|
+
}
|
|
35971
|
+
} else if (tagType === BitTagConfigKeyType.resource) {
|
|
35972
|
+
format = "string";
|
|
35973
|
+
} else if (tagType === BitTagConfigKeyType.group) {
|
|
35974
|
+
let k = tag.key;
|
|
35975
|
+
if (k.startsWith("group_")) k = k.substring(6);
|
|
35976
|
+
k = /*'_' +*/
|
|
35977
|
+
stringUtils.camelToKebab(k);
|
|
35978
|
+
inherits.push(k);
|
|
35979
|
+
continue;
|
|
35980
|
+
}
|
|
35981
|
+
const t = {
|
|
35982
|
+
key: tagName,
|
|
35983
|
+
format,
|
|
35984
|
+
default: null,
|
|
35985
|
+
alwaysInclude: false,
|
|
35986
|
+
min: tag.minCount == null ? 0 : tag.minCount,
|
|
35987
|
+
max: tag.maxCount == null ? 1 : tag.maxCount,
|
|
35988
|
+
description: tag.description ?? "",
|
|
35989
|
+
chain
|
|
35990
|
+
// raw: {
|
|
35991
|
+
// ...tag,
|
|
35992
|
+
// },
|
|
35993
|
+
};
|
|
35994
|
+
tags2.push(t);
|
|
35995
|
+
}
|
|
35996
|
+
const bitJson = {
|
|
35997
|
+
name: groupKey,
|
|
35998
|
+
description: g.description ?? "",
|
|
35999
|
+
since: "UNKNOWN",
|
|
36000
|
+
deprecated: g.deprecated,
|
|
36001
|
+
history: [
|
|
36002
|
+
{
|
|
36003
|
+
version: "UNKNOWN",
|
|
36004
|
+
changes: ["Initial version"]
|
|
36005
|
+
}
|
|
36006
|
+
],
|
|
36007
|
+
inherits,
|
|
36008
|
+
tags: tags2
|
|
36009
|
+
// cards: [
|
|
36010
|
+
// {
|
|
36011
|
+
// card: null,
|
|
36012
|
+
// side: 1,
|
|
36013
|
+
// variant: null,
|
|
36014
|
+
// description: '',
|
|
36015
|
+
// tags: [],
|
|
36016
|
+
// },
|
|
36017
|
+
// {
|
|
36018
|
+
// card: null,
|
|
36019
|
+
// side: 2,
|
|
36020
|
+
// variant: 1,
|
|
36021
|
+
// description: '',
|
|
36022
|
+
// tags: [],
|
|
36023
|
+
// },
|
|
36024
|
+
// {
|
|
36025
|
+
// card: null,
|
|
36026
|
+
// side: 2,
|
|
36027
|
+
// variant: null,
|
|
36028
|
+
// description: '',
|
|
36029
|
+
// tags: [],
|
|
36030
|
+
// },
|
|
36031
|
+
// ],
|
|
36032
|
+
};
|
|
36033
|
+
const output = path3.join(outputFolderGroups, `${groupKey}.jsonc`);
|
|
36034
|
+
const str = JSON.stringify(bitJson, null, 2);
|
|
36035
|
+
fs3.writeFileSync(output, str);
|
|
36036
|
+
}
|
|
36037
|
+
};
|
|
36038
|
+
writeGroupConfigs(groupConfigs);
|
|
35667
36039
|
}
|
|
35668
36040
|
buildFlat(options) {
|
|
35669
36041
|
const opts = Object.assign({}, options);
|