@gmb/bitmark-parser-generator 4.16.0 → 4.16.1
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 +109 -62
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +28 -4
- package/dist/browser/esm/index.d.ts +28 -4
- package/dist/browser/esm/index.js +109 -62
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/index.cjs +321 -301
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -4
- package/dist/index.d.ts +28 -4
- package/dist/index.js +321 -301
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -305,8 +305,8 @@ var BitType = (0, import_superenum.superenum)({
|
|
|
305
305
|
extractorAiChat: "extractor-ai-chat",
|
|
306
306
|
extractorBlock: "extractor-block",
|
|
307
307
|
extractorConfiguration: "extractor-configuration",
|
|
308
|
-
|
|
309
|
-
|
|
308
|
+
extractorImage: "extractor-image",
|
|
309
|
+
extractorImageCollapsible: "extractor-image-collapsible",
|
|
310
310
|
extractorInformation: "extractor-information",
|
|
311
311
|
extractorPage: "extractor-page",
|
|
312
312
|
extractorPageCollapsible: "extractor-page-collapsible",
|
|
@@ -1382,6 +1382,7 @@ var propertyKeys = {
|
|
|
1382
1382
|
property_scormSource: "@scormSource",
|
|
1383
1383
|
property_search: "@search",
|
|
1384
1384
|
property_searchIndex: "@searchIndex",
|
|
1385
|
+
property_selected: "@selected",
|
|
1385
1386
|
property_servings: "@servings",
|
|
1386
1387
|
property_showInIndex: "@showInIndex",
|
|
1387
1388
|
property_showSubtitles: "@showSubtitles",
|
|
@@ -3660,6 +3661,12 @@ var GROUPS = {
|
|
|
3660
3661
|
description: "The search text for the resource",
|
|
3661
3662
|
format: TagFormat.plainText
|
|
3662
3663
|
},
|
|
3664
|
+
{
|
|
3665
|
+
key: ConfigKey.property_selected,
|
|
3666
|
+
description: "If true, the resource is selected",
|
|
3667
|
+
format: TagFormat.boolean,
|
|
3668
|
+
defaultValue: "false"
|
|
3669
|
+
},
|
|
3663
3670
|
{
|
|
3664
3671
|
key: ConfigKey.property_srcAlt,
|
|
3665
3672
|
description: "An alternative source for the resource",
|
|
@@ -7162,7 +7169,7 @@ var BITS = {
|
|
|
7162
7169
|
description: "Extractor configuration bit, used to configure extractors in articles or books",
|
|
7163
7170
|
textFormatDefault: TextFormat.plainText
|
|
7164
7171
|
},
|
|
7165
|
-
[BitType.
|
|
7172
|
+
[BitType.extractorImage]: {
|
|
7166
7173
|
since: "4.3.0",
|
|
7167
7174
|
baseBitType: BitType._standard,
|
|
7168
7175
|
description: "Extractor images bit, used for images extracted from PDFs",
|
|
@@ -7182,9 +7189,9 @@ var BITS = {
|
|
|
7182
7189
|
resourceAttachmentAllowed: false,
|
|
7183
7190
|
textFormatDefault: TextFormat.plainText
|
|
7184
7191
|
},
|
|
7185
|
-
[BitType.
|
|
7192
|
+
[BitType.extractorImageCollapsible]: {
|
|
7186
7193
|
since: "4.3.0",
|
|
7187
|
-
baseBitType: BitType.
|
|
7194
|
+
baseBitType: BitType.extractorImage,
|
|
7188
7195
|
description: "Collapsible extractor images bit, used for images extracted from PDFs"
|
|
7189
7196
|
},
|
|
7190
7197
|
[BitType.extractorInformation]: {
|
|
@@ -10189,7 +10196,7 @@ var instance2 = new Config();
|
|
|
10189
10196
|
// src/generated/package_info.ts
|
|
10190
10197
|
var PACKAGE_INFO = {
|
|
10191
10198
|
"name": "@gmb/bitmark-parser-generator",
|
|
10192
|
-
"version": "4.16.
|
|
10199
|
+
"version": "4.16.1",
|
|
10193
10200
|
"author": "Get More Brain Ltd",
|
|
10194
10201
|
"license": "ISC",
|
|
10195
10202
|
"description": "A bitmark parser and generator using Peggy.js"
|
|
@@ -11060,6 +11067,7 @@ var NodeType = (0, import_superenum20.superenum)({
|
|
|
11060
11067
|
searchValue: "searchValue",
|
|
11061
11068
|
section: "section",
|
|
11062
11069
|
select: "select",
|
|
11070
|
+
selected: "selected",
|
|
11063
11071
|
servings: "servings",
|
|
11064
11072
|
servingsValue: "servingsValue",
|
|
11065
11073
|
showInIndex: "showInIndex",
|
|
@@ -22522,7 +22530,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22522
22530
|
license: data.license,
|
|
22523
22531
|
copyright: data.copyright,
|
|
22524
22532
|
showInIndex: data.showInIndex,
|
|
22525
|
-
search: data.search
|
|
22533
|
+
search: data.search,
|
|
22534
|
+
selected: data.selected
|
|
22526
22535
|
});
|
|
22527
22536
|
return node;
|
|
22528
22537
|
}
|
|
@@ -22687,7 +22696,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22687
22696
|
copyright,
|
|
22688
22697
|
showInIndex,
|
|
22689
22698
|
caption,
|
|
22690
|
-
search
|
|
22699
|
+
search,
|
|
22700
|
+
selected
|
|
22691
22701
|
} = data;
|
|
22692
22702
|
const { bitType } = context;
|
|
22693
22703
|
let zoomDisabledDefault = false;
|
|
@@ -22696,7 +22706,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22696
22706
|
BitType.pageBanner,
|
|
22697
22707
|
BitType.imagesLogoGrave,
|
|
22698
22708
|
BitType.prototypeImages,
|
|
22699
|
-
BitType.
|
|
22709
|
+
BitType.extractorImage
|
|
22700
22710
|
])) {
|
|
22701
22711
|
zoomDisabledDefault = true;
|
|
22702
22712
|
}
|
|
@@ -22721,11 +22731,12 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22721
22731
|
copyright: copyright ?? "",
|
|
22722
22732
|
showInIndex: showInIndex ?? false,
|
|
22723
22733
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
22724
|
-
search: search ?? void 0
|
|
22734
|
+
search: search ?? void 0,
|
|
22735
|
+
selected: selected ?? false
|
|
22725
22736
|
}
|
|
22726
22737
|
};
|
|
22727
22738
|
objectUtils.removeUnwantedProperties(node.image, {
|
|
22728
|
-
ignoreFalse: ["zoomDisabled", "showInIndex"],
|
|
22739
|
+
ignoreFalse: ["zoomDisabled", "showInIndex", "selected"],
|
|
22729
22740
|
ignoreEmptyArrays: ["caption"],
|
|
22730
22741
|
ignoreUndefined: ["width", "height"],
|
|
22731
22742
|
ignoreEmptyString: ["src", "alt", "license", "copyright"]
|
|
@@ -22754,7 +22765,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22754
22765
|
copyright,
|
|
22755
22766
|
showInIndex,
|
|
22756
22767
|
caption,
|
|
22757
|
-
search
|
|
22768
|
+
search,
|
|
22769
|
+
selected
|
|
22758
22770
|
} = data;
|
|
22759
22771
|
const node = {
|
|
22760
22772
|
type: ResourceType.imageLink,
|
|
@@ -22779,11 +22791,12 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22779
22791
|
copyright: copyright ?? "",
|
|
22780
22792
|
showInIndex: showInIndex ?? false,
|
|
22781
22793
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
22782
|
-
search: search ?? void 0
|
|
22794
|
+
search: search ?? void 0,
|
|
22795
|
+
selected: selected ?? false
|
|
22783
22796
|
}
|
|
22784
22797
|
};
|
|
22785
22798
|
objectUtils.removeUnwantedProperties(node.imageLink, {
|
|
22786
|
-
ignoreFalse: ["zoomDisabled", "showInIndex"],
|
|
22799
|
+
ignoreFalse: ["zoomDisabled", "showInIndex", "selected"],
|
|
22787
22800
|
ignoreEmptyArrays: ["caption"],
|
|
22788
22801
|
ignoreUndefined: ["width", "height"],
|
|
22789
22802
|
ignoreEmptyString: ["url", "alt", "license", "copyright"]
|
|
@@ -22807,7 +22820,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22807
22820
|
copyright,
|
|
22808
22821
|
showInIndex,
|
|
22809
22822
|
caption,
|
|
22810
|
-
search
|
|
22823
|
+
search,
|
|
22824
|
+
selected
|
|
22811
22825
|
} = data;
|
|
22812
22826
|
const node = {
|
|
22813
22827
|
type: ResourceType.audio,
|
|
@@ -22825,13 +22839,14 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22825
22839
|
copyright: copyright ?? "",
|
|
22826
22840
|
showInIndex: showInIndex ?? false,
|
|
22827
22841
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
22828
|
-
search: search ?? void 0
|
|
22842
|
+
search: search ?? void 0,
|
|
22843
|
+
selected: selected ?? false
|
|
22829
22844
|
}
|
|
22830
22845
|
};
|
|
22831
22846
|
objectUtils.removeUnwantedProperties(node.audio, {
|
|
22832
22847
|
ignoreEmptyArrays: ["caption"],
|
|
22833
22848
|
ignoreEmptyString: ["src", "alt", "license", "copyright"],
|
|
22834
|
-
ignoreFalse: ["showInIndex"]
|
|
22849
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
22835
22850
|
});
|
|
22836
22851
|
return nodeValidator.validateResource(node);
|
|
22837
22852
|
}
|
|
@@ -22852,7 +22867,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22852
22867
|
copyright,
|
|
22853
22868
|
showInIndex,
|
|
22854
22869
|
caption,
|
|
22855
|
-
search
|
|
22870
|
+
search,
|
|
22871
|
+
selected
|
|
22856
22872
|
} = data;
|
|
22857
22873
|
const node = {
|
|
22858
22874
|
type: ResourceType.audioEmbed,
|
|
@@ -22870,7 +22886,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22870
22886
|
copyright: copyright ?? "",
|
|
22871
22887
|
showInIndex: showInIndex ?? false,
|
|
22872
22888
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
22873
|
-
search: search ?? void 0
|
|
22889
|
+
search: search ?? void 0,
|
|
22890
|
+
selected: selected ?? false
|
|
22874
22891
|
}
|
|
22875
22892
|
};
|
|
22876
22893
|
objectUtils.removeUnwantedProperties(node.audioEmbed, {
|
|
@@ -22881,7 +22898,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22881
22898
|
"license",
|
|
22882
22899
|
"copyright"
|
|
22883
22900
|
],
|
|
22884
|
-
ignoreFalse: ["showInIndex"]
|
|
22901
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
22885
22902
|
});
|
|
22886
22903
|
return nodeValidator.validateResource(node);
|
|
22887
22904
|
}
|
|
@@ -22902,7 +22919,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22902
22919
|
copyright,
|
|
22903
22920
|
showInIndex,
|
|
22904
22921
|
caption,
|
|
22905
|
-
search
|
|
22922
|
+
search,
|
|
22923
|
+
selected
|
|
22906
22924
|
} = data;
|
|
22907
22925
|
const node = {
|
|
22908
22926
|
type: ResourceType.audioLink,
|
|
@@ -22921,7 +22939,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22921
22939
|
copyright: copyright ?? "",
|
|
22922
22940
|
showInIndex: showInIndex ?? false,
|
|
22923
22941
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
22924
|
-
search: search ?? void 0
|
|
22942
|
+
search: search ?? void 0,
|
|
22943
|
+
selected: selected ?? false
|
|
22925
22944
|
}
|
|
22926
22945
|
};
|
|
22927
22946
|
objectUtils.removeUnwantedProperties(node.audioLink, {
|
|
@@ -22929,7 +22948,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22929
22948
|
ignoreEmptyString: [
|
|
22930
22949
|
"url"
|
|
22931
22950
|
/*'alt', 'license', 'copyright'*/
|
|
22932
|
-
]
|
|
22951
|
+
],
|
|
22952
|
+
ignoreFalse: ["selected"]
|
|
22933
22953
|
});
|
|
22934
22954
|
return nodeValidator.validateResource(node);
|
|
22935
22955
|
}
|
|
@@ -22957,7 +22977,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22957
22977
|
copyright,
|
|
22958
22978
|
showInIndex,
|
|
22959
22979
|
caption,
|
|
22960
|
-
search
|
|
22980
|
+
search,
|
|
22981
|
+
selected
|
|
22961
22982
|
} = data;
|
|
22962
22983
|
const node = {
|
|
22963
22984
|
type: ResourceType.video,
|
|
@@ -22981,6 +23002,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22981
23002
|
showInIndex: showInIndex ?? false,
|
|
22982
23003
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
22983
23004
|
search: search ?? void 0,
|
|
23005
|
+
selected: selected ?? false,
|
|
22984
23006
|
// Have sub-chains so must be at end of chain
|
|
22985
23007
|
posterImage: posterImage ?? void 0,
|
|
22986
23008
|
thumbnails: thumbnails ?? void 0
|
|
@@ -22995,7 +23017,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22995
23017
|
"license",
|
|
22996
23018
|
"copyright"
|
|
22997
23019
|
],
|
|
22998
|
-
ignoreFalse: ["showInIndex"]
|
|
23020
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
22999
23021
|
});
|
|
23000
23022
|
return nodeValidator.validateResource(node);
|
|
23001
23023
|
}
|
|
@@ -23023,7 +23045,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23023
23045
|
copyright,
|
|
23024
23046
|
showInIndex,
|
|
23025
23047
|
caption,
|
|
23026
|
-
search
|
|
23048
|
+
search,
|
|
23049
|
+
selected
|
|
23027
23050
|
} = data;
|
|
23028
23051
|
const node = {
|
|
23029
23052
|
type: ResourceType.videoEmbed,
|
|
@@ -23049,7 +23072,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23049
23072
|
copyright: copyright ?? "",
|
|
23050
23073
|
showInIndex: showInIndex ?? false,
|
|
23051
23074
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23052
|
-
search: search ?? void 0
|
|
23075
|
+
search: search ?? void 0,
|
|
23076
|
+
selected: selected ?? false
|
|
23053
23077
|
}
|
|
23054
23078
|
};
|
|
23055
23079
|
objectUtils.removeUnwantedProperties(node.videoEmbed, {
|
|
@@ -23061,7 +23085,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23061
23085
|
"license",
|
|
23062
23086
|
"copyright"
|
|
23063
23087
|
],
|
|
23064
|
-
ignoreFalse: ["showInIndex"]
|
|
23088
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23065
23089
|
});
|
|
23066
23090
|
return nodeValidator.validateResource(node);
|
|
23067
23091
|
}
|
|
@@ -23089,7 +23113,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23089
23113
|
copyright,
|
|
23090
23114
|
showInIndex,
|
|
23091
23115
|
caption,
|
|
23092
|
-
search
|
|
23116
|
+
search,
|
|
23117
|
+
selected
|
|
23093
23118
|
} = data;
|
|
23094
23119
|
const node = {
|
|
23095
23120
|
type: ResourceType.videoLink,
|
|
@@ -23115,7 +23140,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23115
23140
|
copyright: copyright ?? "",
|
|
23116
23141
|
showInIndex: showInIndex ?? false,
|
|
23117
23142
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23118
|
-
search: search ?? void 0
|
|
23143
|
+
search: search ?? void 0,
|
|
23144
|
+
selected: selected ?? false
|
|
23119
23145
|
}
|
|
23120
23146
|
};
|
|
23121
23147
|
objectUtils.removeUnwantedProperties(node.videoLink, {
|
|
@@ -23127,7 +23153,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23127
23153
|
"license",
|
|
23128
23154
|
"copyright"
|
|
23129
23155
|
],
|
|
23130
|
-
ignoreFalse: ["showInIndex"]
|
|
23156
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23131
23157
|
});
|
|
23132
23158
|
return nodeValidator.validateResource(node);
|
|
23133
23159
|
}
|
|
@@ -23175,7 +23201,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23175
23201
|
copyright,
|
|
23176
23202
|
showInIndex,
|
|
23177
23203
|
caption,
|
|
23178
|
-
search
|
|
23204
|
+
search,
|
|
23205
|
+
selected
|
|
23179
23206
|
} = data;
|
|
23180
23207
|
const node = {
|
|
23181
23208
|
type: ResourceType.stillImageFilmEmbed,
|
|
@@ -23201,7 +23228,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23201
23228
|
copyright: copyright ?? "",
|
|
23202
23229
|
showInIndex: showInIndex ?? false,
|
|
23203
23230
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23204
|
-
search: search ?? void 0
|
|
23231
|
+
search: search ?? void 0,
|
|
23232
|
+
selected: selected ?? false
|
|
23205
23233
|
}
|
|
23206
23234
|
};
|
|
23207
23235
|
objectUtils.removeUnwantedProperties(node.stillImageFilmEmbed, {
|
|
@@ -23213,7 +23241,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23213
23241
|
"license",
|
|
23214
23242
|
"copyright"
|
|
23215
23243
|
],
|
|
23216
|
-
ignoreFalse: ["showInIndex"]
|
|
23244
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23217
23245
|
});
|
|
23218
23246
|
return nodeValidator.validateResource(node);
|
|
23219
23247
|
}
|
|
@@ -23241,7 +23269,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23241
23269
|
copyright,
|
|
23242
23270
|
showInIndex,
|
|
23243
23271
|
caption,
|
|
23244
|
-
search
|
|
23272
|
+
search,
|
|
23273
|
+
selected
|
|
23245
23274
|
} = data;
|
|
23246
23275
|
const node = {
|
|
23247
23276
|
type: ResourceType.stillImageFilmLink,
|
|
@@ -23267,7 +23296,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23267
23296
|
copyright: copyright ?? "",
|
|
23268
23297
|
showInIndex: showInIndex ?? false,
|
|
23269
23298
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23270
|
-
search: search ?? void 0
|
|
23299
|
+
search: search ?? void 0,
|
|
23300
|
+
selected: selected ?? false
|
|
23271
23301
|
}
|
|
23272
23302
|
};
|
|
23273
23303
|
objectUtils.removeUnwantedProperties(node.stillImageFilmLink, {
|
|
@@ -23279,7 +23309,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23279
23309
|
"license",
|
|
23280
23310
|
"copyright"
|
|
23281
23311
|
],
|
|
23282
|
-
ignoreFalse: ["showInIndex"]
|
|
23312
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23283
23313
|
});
|
|
23284
23314
|
return nodeValidator.validateResource(node);
|
|
23285
23315
|
}
|
|
@@ -23290,7 +23320,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23290
23320
|
* @returns
|
|
23291
23321
|
*/
|
|
23292
23322
|
articleResource(context, data) {
|
|
23293
|
-
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
23323
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search, selected } = data;
|
|
23294
23324
|
const node = {
|
|
23295
23325
|
type: ResourceType.article,
|
|
23296
23326
|
__typeAlias: ResourceType.article,
|
|
@@ -23304,12 +23334,14 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23304
23334
|
copyright: copyright ?? "",
|
|
23305
23335
|
showInIndex: showInIndex ?? false,
|
|
23306
23336
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23307
|
-
search: search ?? void 0
|
|
23337
|
+
search: search ?? void 0,
|
|
23338
|
+
selected: selected ?? false
|
|
23308
23339
|
}
|
|
23309
23340
|
};
|
|
23310
23341
|
objectUtils.removeUnwantedProperties(node.article, {
|
|
23311
23342
|
ignoreEmptyArrays: ["caption"],
|
|
23312
|
-
ignoreEmptyString: ["body", "alt", "license", "copyright"]
|
|
23343
|
+
ignoreEmptyString: ["body", "alt", "license", "copyright"],
|
|
23344
|
+
ignoreFalse: ["selected"]
|
|
23313
23345
|
});
|
|
23314
23346
|
return nodeValidator.validateResource(node);
|
|
23315
23347
|
}
|
|
@@ -23320,7 +23352,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23320
23352
|
* @returns
|
|
23321
23353
|
*/
|
|
23322
23354
|
documentResource(context, data) {
|
|
23323
|
-
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
23355
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search, selected } = data;
|
|
23324
23356
|
const node = {
|
|
23325
23357
|
type: ResourceType.document,
|
|
23326
23358
|
__typeAlias: ResourceType.document,
|
|
@@ -23334,13 +23366,14 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23334
23366
|
copyright: copyright ?? "",
|
|
23335
23367
|
showInIndex: showInIndex ?? false,
|
|
23336
23368
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23337
|
-
search: search ?? void 0
|
|
23369
|
+
search: search ?? void 0,
|
|
23370
|
+
selected: selected ?? false
|
|
23338
23371
|
}
|
|
23339
23372
|
};
|
|
23340
23373
|
objectUtils.removeUnwantedProperties(node.document, {
|
|
23341
23374
|
ignoreEmptyArrays: ["caption"],
|
|
23342
23375
|
ignoreEmptyString: ["url", "alt", "license", "copyright"],
|
|
23343
|
-
ignoreFalse: ["showInIndex"]
|
|
23376
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23344
23377
|
});
|
|
23345
23378
|
return nodeValidator.validateResource(node);
|
|
23346
23379
|
}
|
|
@@ -23351,7 +23384,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23351
23384
|
* @returns
|
|
23352
23385
|
*/
|
|
23353
23386
|
documentEmbedResource(context, data) {
|
|
23354
|
-
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
23387
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search, selected } = data;
|
|
23355
23388
|
const node = {
|
|
23356
23389
|
type: ResourceType.documentEmbed,
|
|
23357
23390
|
__typeAlias: ResourceType.documentEmbed,
|
|
@@ -23365,13 +23398,14 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23365
23398
|
copyright: copyright ?? "",
|
|
23366
23399
|
showInIndex: showInIndex ?? false,
|
|
23367
23400
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23368
|
-
search: search ?? void 0
|
|
23401
|
+
search: search ?? void 0,
|
|
23402
|
+
selected: selected ?? false
|
|
23369
23403
|
}
|
|
23370
23404
|
};
|
|
23371
23405
|
objectUtils.removeUnwantedProperties(node.documentEmbed, {
|
|
23372
23406
|
ignoreEmptyArrays: ["caption"],
|
|
23373
23407
|
ignoreEmptyString: ["url", "alt", "license", "copyright"],
|
|
23374
|
-
ignoreFalse: ["showInIndex"]
|
|
23408
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23375
23409
|
});
|
|
23376
23410
|
return nodeValidator.validateResource(node);
|
|
23377
23411
|
}
|
|
@@ -23382,7 +23416,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23382
23416
|
* @returns
|
|
23383
23417
|
*/
|
|
23384
23418
|
documentLinkResource(context, data) {
|
|
23385
|
-
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
23419
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search, selected } = data;
|
|
23386
23420
|
const node = {
|
|
23387
23421
|
type: ResourceType.documentLink,
|
|
23388
23422
|
__typeAlias: ResourceType.documentLink,
|
|
@@ -23396,13 +23430,14 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23396
23430
|
copyright: copyright ?? "",
|
|
23397
23431
|
showInIndex: showInIndex ?? false,
|
|
23398
23432
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23399
|
-
search: search ?? void 0
|
|
23433
|
+
search: search ?? void 0,
|
|
23434
|
+
selected: selected ?? false
|
|
23400
23435
|
}
|
|
23401
23436
|
};
|
|
23402
23437
|
objectUtils.removeUnwantedProperties(node.documentLink, {
|
|
23403
23438
|
ignoreEmptyArrays: ["caption"],
|
|
23404
23439
|
ignoreEmptyString: ["url", "alt", "license", "copyright"],
|
|
23405
|
-
ignoreFalse: ["showInIndex"]
|
|
23440
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23406
23441
|
});
|
|
23407
23442
|
return nodeValidator.validateResource(node);
|
|
23408
23443
|
}
|
|
@@ -23413,7 +23448,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23413
23448
|
* @returns
|
|
23414
23449
|
*/
|
|
23415
23450
|
documentDownloadResource(context, data) {
|
|
23416
|
-
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
23451
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search, selected } = data;
|
|
23417
23452
|
const node = {
|
|
23418
23453
|
type: ResourceType.documentDownload,
|
|
23419
23454
|
__typeAlias: ResourceType.documentDownload,
|
|
@@ -23427,13 +23462,14 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23427
23462
|
copyright: copyright ?? "",
|
|
23428
23463
|
showInIndex: showInIndex ?? false,
|
|
23429
23464
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23430
|
-
search: search ?? void 0
|
|
23465
|
+
search: search ?? void 0,
|
|
23466
|
+
selected: selected ?? false
|
|
23431
23467
|
}
|
|
23432
23468
|
};
|
|
23433
23469
|
objectUtils.removeUnwantedProperties(node.documentDownload, {
|
|
23434
23470
|
ignoreEmptyArrays: ["caption"],
|
|
23435
23471
|
ignoreEmptyString: ["url", "alt", "license", "copyright"],
|
|
23436
|
-
ignoreFalse: ["showInIndex"]
|
|
23472
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23437
23473
|
});
|
|
23438
23474
|
return nodeValidator.validateResource(node);
|
|
23439
23475
|
}
|
|
@@ -23444,7 +23480,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23444
23480
|
* @returns
|
|
23445
23481
|
*/
|
|
23446
23482
|
appLinkResource(context, data) {
|
|
23447
|
-
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
23483
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search, selected } = data;
|
|
23448
23484
|
const node = {
|
|
23449
23485
|
type: ResourceType.appLink,
|
|
23450
23486
|
__typeAlias: ResourceType.appLink,
|
|
@@ -23459,7 +23495,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23459
23495
|
copyright: copyright ?? "",
|
|
23460
23496
|
showInIndex: showInIndex ?? false,
|
|
23461
23497
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23462
|
-
search: search ?? void 0
|
|
23498
|
+
search: search ?? void 0,
|
|
23499
|
+
selected: selected ?? false
|
|
23463
23500
|
}
|
|
23464
23501
|
};
|
|
23465
23502
|
objectUtils.removeUnwantedProperties(node.appLink, {
|
|
@@ -23470,7 +23507,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23470
23507
|
"license",
|
|
23471
23508
|
"copyright"
|
|
23472
23509
|
],
|
|
23473
|
-
ignoreFalse: ["showInIndex"]
|
|
23510
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23474
23511
|
});
|
|
23475
23512
|
return nodeValidator.validateResource(node);
|
|
23476
23513
|
}
|
|
@@ -23489,7 +23526,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23489
23526
|
copyright,
|
|
23490
23527
|
showInIndex,
|
|
23491
23528
|
caption,
|
|
23492
|
-
search
|
|
23529
|
+
search,
|
|
23530
|
+
selected
|
|
23493
23531
|
} = data;
|
|
23494
23532
|
const node = {
|
|
23495
23533
|
type: ResourceType.websiteLink,
|
|
@@ -23505,13 +23543,14 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23505
23543
|
copyright: copyright ?? "",
|
|
23506
23544
|
showInIndex: showInIndex ?? false,
|
|
23507
23545
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23508
|
-
search: search ?? void 0
|
|
23546
|
+
search: search ?? void 0,
|
|
23547
|
+
selected: selected ?? false
|
|
23509
23548
|
}
|
|
23510
23549
|
};
|
|
23511
23550
|
objectUtils.removeUnwantedProperties(node.websiteLink, {
|
|
23512
23551
|
ignoreEmptyArrays: ["caption"],
|
|
23513
23552
|
ignoreEmptyString: ["url", "alt", "license", "copyright"],
|
|
23514
|
-
ignoreFalse: ["showInIndex"]
|
|
23553
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23515
23554
|
});
|
|
23516
23555
|
return nodeValidator.validateResource(node);
|
|
23517
23556
|
}
|
|
@@ -28205,7 +28244,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28205
28244
|
BitType.pageBanner,
|
|
28206
28245
|
BitType.imagesLogoGrave,
|
|
28207
28246
|
BitType.prototypeImages,
|
|
28208
|
-
BitType.
|
|
28247
|
+
BitType.extractorImage
|
|
28209
28248
|
])) {
|
|
28210
28249
|
this.writeProperty("zoomDisabled", node.value, route, {
|
|
28211
28250
|
format: TagFormat.boolean,
|
|
@@ -28258,6 +28297,14 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28258
28297
|
format: TagFormat.plainText
|
|
28259
28298
|
});
|
|
28260
28299
|
}
|
|
28300
|
+
leaf_selected(node, route) {
|
|
28301
|
+
if (node.value == null) return;
|
|
28302
|
+
this.writeNL_IfNotChain(route);
|
|
28303
|
+
this.writeProperty("selected", node.value, route, {
|
|
28304
|
+
format: TagFormat.boolean,
|
|
28305
|
+
ignoreFalse: true
|
|
28306
|
+
});
|
|
28307
|
+
}
|
|
28261
28308
|
// bitmarkAst -> bits -> bitsValue -> resource -> ...
|
|
28262
28309
|
// bitmarkAst -> bits -> bitsValue -> resource -> posterImage -> ...
|
|
28263
28310
|
// bitmarkAst -> bits -> bitsValue -> resource -> thumbnails -> thumbnailsValue -> ...
|
|
@@ -29430,7 +29477,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29430
29477
|
} else if (instance2.isOfBitType(bitType, [
|
|
29431
29478
|
BitType.imagesLogoGrave,
|
|
29432
29479
|
BitType.prototypeImages,
|
|
29433
|
-
BitType.
|
|
29480
|
+
BitType.extractorImage
|
|
29434
29481
|
])) {
|
|
29435
29482
|
const images = [];
|
|
29436
29483
|
for (const r of resources) {
|
|
@@ -30011,7 +30058,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
30011
30058
|
if (instance2.isOfBitType(bitType, [
|
|
30012
30059
|
BitType.imagesLogoGrave,
|
|
30013
30060
|
BitType.prototypeImages,
|
|
30014
|
-
BitType.
|
|
30061
|
+
BitType.extractorImage
|
|
30015
30062
|
])) {
|
|
30016
30063
|
if (bitType === BitType.imagesLogoGrave) {
|
|
30017
30064
|
if (bitJson.logos == null) {
|
|
@@ -30443,7 +30490,7 @@ var JsonParser = class {
|
|
|
30443
30490
|
processResources(bitType, resource, images, logos) {
|
|
30444
30491
|
const nodes = [];
|
|
30445
30492
|
if (resource) nodes.push(resource);
|
|
30446
|
-
if (instance2.isOfBitType(bitType, [BitType.prototypeImages, BitType.
|
|
30493
|
+
if (instance2.isOfBitType(bitType, [BitType.prototypeImages, BitType.extractorImage])) {
|
|
30447
30494
|
if (Array.isArray(images)) {
|
|
30448
30495
|
for (const image of images) {
|
|
30449
30496
|
if (image) nodes.push(image);
|
|
@@ -38413,6 +38460,8 @@ var ConfigBuilder = class {
|
|
|
38413
38460
|
this.buildFlat(opts);
|
|
38414
38461
|
const bitConfigs = [];
|
|
38415
38462
|
const groupConfigs = [];
|
|
38463
|
+
const bitGroupConfigKeys = [];
|
|
38464
|
+
const bitGroupConfigs = [];
|
|
38416
38465
|
for (const bt of BitType.values()) {
|
|
38417
38466
|
const bitType = instance2.getBitType(bt);
|
|
38418
38467
|
const _bitConfig = BITS[bitType];
|
|
@@ -38436,8 +38485,101 @@ var ConfigBuilder = class {
|
|
|
38436
38485
|
import_fs_extra3.default.ensureDirSync(outputFolderBits);
|
|
38437
38486
|
import_fs_extra3.default.ensureDirSync(outputFolderGroups);
|
|
38438
38487
|
const fileWrites = [];
|
|
38488
|
+
const keyToJsonKey = (key, tagNameChain) => {
|
|
38489
|
+
let jsonKey = key;
|
|
38490
|
+
if (key === "%") {
|
|
38491
|
+
jsonKey = "item_todo";
|
|
38492
|
+
} else if (key === "!") {
|
|
38493
|
+
jsonKey = "instruction";
|
|
38494
|
+
} else if (key === "?") {
|
|
38495
|
+
jsonKey = "hint";
|
|
38496
|
+
} else if (key === "#") {
|
|
38497
|
+
jsonKey = "title";
|
|
38498
|
+
} else if (key === "##") {
|
|
38499
|
+
jsonKey = "subTitle";
|
|
38500
|
+
} else if (key === "\u25BC") {
|
|
38501
|
+
jsonKey = "anchor";
|
|
38502
|
+
} else if (key === "\u25BA") {
|
|
38503
|
+
jsonKey = "reference";
|
|
38504
|
+
} else if (key === "$") {
|
|
38505
|
+
jsonKey = "sampleSolution";
|
|
38506
|
+
} else if (key === "+") {
|
|
38507
|
+
jsonKey = "true_todo";
|
|
38508
|
+
} else if (key === "-") {
|
|
38509
|
+
jsonKey = "false_todo";
|
|
38510
|
+
} else if (key === "_") {
|
|
38511
|
+
jsonKey = "gap_todo";
|
|
38512
|
+
} else if (key === "=") {
|
|
38513
|
+
jsonKey = "mark_todo";
|
|
38514
|
+
} else if (key.startsWith("@")) {
|
|
38515
|
+
jsonKey = key.substring(1);
|
|
38516
|
+
} else if (key.startsWith("&")) {
|
|
38517
|
+
jsonKey = key.substring(1);
|
|
38518
|
+
}
|
|
38519
|
+
const thisChain = [...tagNameChain, jsonKey];
|
|
38520
|
+
jsonKey = thisChain.join(".");
|
|
38521
|
+
return jsonKey;
|
|
38522
|
+
};
|
|
38523
|
+
const processTagEntries = (tag, tagNameChain) => {
|
|
38524
|
+
const tags2 = [];
|
|
38525
|
+
let tagName = tag.key;
|
|
38526
|
+
const jsonKey = keyToJsonKey(tagName, tagNameChain);
|
|
38527
|
+
const tagType = typeFromConfigKey(tag.key);
|
|
38528
|
+
let format = "";
|
|
38529
|
+
let chain = void 0;
|
|
38530
|
+
if (tagType === BitTagConfigKeyType.tag) {
|
|
38531
|
+
tagName = tag.key;
|
|
38532
|
+
format = "bitmark--";
|
|
38533
|
+
} else if (tagType === BitTagConfigKeyType.property) {
|
|
38534
|
+
tagName = tag.key;
|
|
38535
|
+
if (tag.format === TagFormat.plainText) {
|
|
38536
|
+
format = "string";
|
|
38537
|
+
} else if (tag.format === TagFormat.boolean) {
|
|
38538
|
+
format = "bool";
|
|
38539
|
+
} else if (tag.format === TagFormat.bitmarkText) {
|
|
38540
|
+
format = "bitmark";
|
|
38541
|
+
} else if (tag.format === TagFormat.number) {
|
|
38542
|
+
format = "number";
|
|
38543
|
+
}
|
|
38544
|
+
} else if (tagType === BitTagConfigKeyType.resource) {
|
|
38545
|
+
format = "string";
|
|
38546
|
+
} else if (tagType === BitTagConfigKeyType.group) {
|
|
38547
|
+
let k = tag.key;
|
|
38548
|
+
if (k.startsWith("group_")) k = k.substring(6);
|
|
38549
|
+
k = /*'_' +*/
|
|
38550
|
+
stringUtils.camelToKebab(k);
|
|
38551
|
+
tags2.push({
|
|
38552
|
+
type: "group",
|
|
38553
|
+
key: k
|
|
38554
|
+
});
|
|
38555
|
+
return tags2;
|
|
38556
|
+
}
|
|
38557
|
+
if (Array.isArray(tag.chain) && tag.chain.length > 0) {
|
|
38558
|
+
const chainTags = [];
|
|
38559
|
+
for (const [_tagKey, chainTag] of tag.chain.entries()) {
|
|
38560
|
+
chainTags.push(...processTagEntries(chainTag, [...tagNameChain, jsonKey]));
|
|
38561
|
+
}
|
|
38562
|
+
chain = chainTags;
|
|
38563
|
+
}
|
|
38564
|
+
const t = {
|
|
38565
|
+
type: "tag",
|
|
38566
|
+
key: tagName,
|
|
38567
|
+
jsonKey,
|
|
38568
|
+
format,
|
|
38569
|
+
default: null,
|
|
38570
|
+
alwaysInclude: false,
|
|
38571
|
+
min: tag.minCount == null ? 0 : tag.minCount,
|
|
38572
|
+
max: tag.maxCount == null ? 1 : tag.maxCount,
|
|
38573
|
+
description: tag.description ?? "",
|
|
38574
|
+
tags: chain
|
|
38575
|
+
// raw: {
|
|
38576
|
+
// ...tag,
|
|
38577
|
+
// },
|
|
38578
|
+
};
|
|
38579
|
+
tags2.push(t);
|
|
38580
|
+
return tags2;
|
|
38581
|
+
};
|
|
38439
38582
|
for (const b of bitConfigs) {
|
|
38440
|
-
const inherits = [];
|
|
38441
38583
|
const tags2 = [];
|
|
38442
38584
|
const tagEntriesTypeOrder = [
|
|
38443
38585
|
BitTagConfigKeyType.tag,
|
|
@@ -38454,77 +38596,15 @@ var ConfigBuilder = class {
|
|
|
38454
38596
|
const typeOrder = tagEntriesTypeOrder.indexOf(typeA) - tagEntriesTypeOrder.indexOf(typeB);
|
|
38455
38597
|
return typeOrder;
|
|
38456
38598
|
});
|
|
38457
|
-
if (b.baseBitType)
|
|
38458
|
-
|
|
38459
|
-
type: "
|
|
38460
|
-
|
|
38599
|
+
if (b.baseBitType) {
|
|
38600
|
+
tags2.push({
|
|
38601
|
+
type: "group",
|
|
38602
|
+
key: `group-${b.baseBitType}`
|
|
38461
38603
|
});
|
|
38604
|
+
bitGroupConfigKeys.push(b.baseBitType);
|
|
38605
|
+
}
|
|
38462
38606
|
for (const [_tagKey, tag] of tagEntries) {
|
|
38463
|
-
|
|
38464
|
-
let format = "";
|
|
38465
|
-
let chain = void 0;
|
|
38466
|
-
const tagType = typeFromConfigKey(tag.key);
|
|
38467
|
-
if (tagType === BitTagConfigKeyType.tag) {
|
|
38468
|
-
if (tagName === "%") {
|
|
38469
|
-
chain = {
|
|
38470
|
-
key: "%",
|
|
38471
|
-
format,
|
|
38472
|
-
min: tag.minCount,
|
|
38473
|
-
max: tag.maxCount,
|
|
38474
|
-
description: "Lead",
|
|
38475
|
-
chain: {
|
|
38476
|
-
key: "%",
|
|
38477
|
-
format,
|
|
38478
|
-
min: tag.minCount,
|
|
38479
|
-
max: tag.maxCount,
|
|
38480
|
-
description: "Page number",
|
|
38481
|
-
chain: {
|
|
38482
|
-
key: "%",
|
|
38483
|
-
format,
|
|
38484
|
-
min: tag.minCount,
|
|
38485
|
-
max: tag.maxCount,
|
|
38486
|
-
description: "Margin number"
|
|
38487
|
-
}
|
|
38488
|
-
}
|
|
38489
|
-
};
|
|
38490
|
-
}
|
|
38491
|
-
format = "bitmark--";
|
|
38492
|
-
} else if (tagType === BitTagConfigKeyType.property) {
|
|
38493
|
-
if (tag.format === TagFormat.plainText) {
|
|
38494
|
-
format = "string";
|
|
38495
|
-
} else if (tag.format === TagFormat.boolean) {
|
|
38496
|
-
format = "bool";
|
|
38497
|
-
} else if (tag.format === TagFormat.bitmarkText) {
|
|
38498
|
-
format = "bitmark";
|
|
38499
|
-
} else if (tag.format === TagFormat.number) {
|
|
38500
|
-
format = "number";
|
|
38501
|
-
}
|
|
38502
|
-
} else if (tagType === BitTagConfigKeyType.resource) {
|
|
38503
|
-
} else if (tagType === BitTagConfigKeyType.group) {
|
|
38504
|
-
let k = tag.key;
|
|
38505
|
-
if (k.startsWith("group_")) k = k.substring(6);
|
|
38506
|
-
k = /*'_' +*/
|
|
38507
|
-
stringUtils.camelToKebab(k);
|
|
38508
|
-
inherits.push({
|
|
38509
|
-
type: "group",
|
|
38510
|
-
name: k
|
|
38511
|
-
});
|
|
38512
|
-
continue;
|
|
38513
|
-
}
|
|
38514
|
-
const t = {
|
|
38515
|
-
key: tagName,
|
|
38516
|
-
format,
|
|
38517
|
-
default: null,
|
|
38518
|
-
alwaysInclude: false,
|
|
38519
|
-
min: tag.minCount == null ? 0 : tag.minCount,
|
|
38520
|
-
max: tag.maxCount == null ? 1 : tag.maxCount,
|
|
38521
|
-
description: tag.description ?? "",
|
|
38522
|
-
chain
|
|
38523
|
-
// raw: {
|
|
38524
|
-
// ...tag,
|
|
38525
|
-
// },
|
|
38526
|
-
};
|
|
38527
|
-
tags2.push(t);
|
|
38607
|
+
tags2.push(...processTagEntries(tag, []));
|
|
38528
38608
|
}
|
|
38529
38609
|
const bitJson = {
|
|
38530
38610
|
name: b.bitType,
|
|
@@ -38543,16 +38623,22 @@ var ConfigBuilder = class {
|
|
|
38543
38623
|
footerAllowed: b.footerAllowed ?? true,
|
|
38544
38624
|
footerRequired: b.footerRequired ?? false,
|
|
38545
38625
|
resourceAttachmentAllowed: b.resourceAttachmentAllowed ?? true,
|
|
38546
|
-
inherits,
|
|
38547
38626
|
tags: tags2
|
|
38548
38627
|
};
|
|
38549
38628
|
const output = import_node_path3.default.join(outputFolderBits, `${b.bitType}.jsonc`);
|
|
38550
38629
|
const str = JSON.stringify(bitJson, null, 2);
|
|
38551
38630
|
fileWrites.push(import_fs_extra3.default.writeFile(output, str));
|
|
38552
38631
|
}
|
|
38632
|
+
for (const bt of bitGroupConfigKeys) {
|
|
38633
|
+
const bitType = instance2.getBitType(bt);
|
|
38634
|
+
const _bitConfig = BITS[bitType];
|
|
38635
|
+
if (_bitConfig) {
|
|
38636
|
+
_bitConfig.bitType = bitType;
|
|
38637
|
+
bitGroupConfigs.push(_bitConfig);
|
|
38638
|
+
}
|
|
38639
|
+
}
|
|
38553
38640
|
const writeGroupConfigs = (groupConfigs2) => {
|
|
38554
38641
|
for (const g of groupConfigs2) {
|
|
38555
|
-
const inherits = [];
|
|
38556
38642
|
const tags2 = [];
|
|
38557
38643
|
const groupKey = stringUtils.camelToKebab(g.key);
|
|
38558
38644
|
const tagEntriesTypeOrder = [
|
|
@@ -38568,74 +38654,7 @@ var ConfigBuilder = class {
|
|
|
38568
38654
|
return typeOrder;
|
|
38569
38655
|
});
|
|
38570
38656
|
for (const [_tagKey, tag] of tagEntries) {
|
|
38571
|
-
|
|
38572
|
-
const tagType = typeFromConfigKey(tag.key);
|
|
38573
|
-
let format = "";
|
|
38574
|
-
let chain = void 0;
|
|
38575
|
-
if (tagType === BitTagConfigKeyType.tag) {
|
|
38576
|
-
tagName = tag.name;
|
|
38577
|
-
if (tagName === "%") {
|
|
38578
|
-
chain = {
|
|
38579
|
-
key: "%",
|
|
38580
|
-
format,
|
|
38581
|
-
min: tag.minCount,
|
|
38582
|
-
max: tag.maxCount,
|
|
38583
|
-
description: "Lead",
|
|
38584
|
-
chain: {
|
|
38585
|
-
key: "%",
|
|
38586
|
-
format,
|
|
38587
|
-
min: tag.minCount,
|
|
38588
|
-
max: tag.maxCount,
|
|
38589
|
-
description: "Page number",
|
|
38590
|
-
chain: {
|
|
38591
|
-
key: "%",
|
|
38592
|
-
format,
|
|
38593
|
-
min: tag.minCount,
|
|
38594
|
-
max: tag.maxCount,
|
|
38595
|
-
description: "Margin number"
|
|
38596
|
-
}
|
|
38597
|
-
}
|
|
38598
|
-
};
|
|
38599
|
-
}
|
|
38600
|
-
format = "bitmark--";
|
|
38601
|
-
} else if (tagType === BitTagConfigKeyType.property) {
|
|
38602
|
-
tagName = tag.key;
|
|
38603
|
-
if (tag.format === TagFormat.plainText) {
|
|
38604
|
-
format = "string";
|
|
38605
|
-
} else if (tag.format === TagFormat.boolean) {
|
|
38606
|
-
format = "bool";
|
|
38607
|
-
} else if (tag.format === TagFormat.bitmarkText) {
|
|
38608
|
-
format = "bitmark";
|
|
38609
|
-
} else if (tag.format === TagFormat.number) {
|
|
38610
|
-
format = "number";
|
|
38611
|
-
}
|
|
38612
|
-
} else if (tagType === BitTagConfigKeyType.resource) {
|
|
38613
|
-
format = "string";
|
|
38614
|
-
} else if (tagType === BitTagConfigKeyType.group) {
|
|
38615
|
-
let k = tag.key;
|
|
38616
|
-
if (k.startsWith("group_")) k = k.substring(6);
|
|
38617
|
-
k = /*'_' +*/
|
|
38618
|
-
stringUtils.camelToKebab(k);
|
|
38619
|
-
inherits.push({
|
|
38620
|
-
type: "group",
|
|
38621
|
-
name: k
|
|
38622
|
-
});
|
|
38623
|
-
continue;
|
|
38624
|
-
}
|
|
38625
|
-
const t = {
|
|
38626
|
-
key: tagName,
|
|
38627
|
-
format,
|
|
38628
|
-
default: null,
|
|
38629
|
-
alwaysInclude: false,
|
|
38630
|
-
min: tag.minCount == null ? 0 : tag.minCount,
|
|
38631
|
-
max: tag.maxCount == null ? 1 : tag.maxCount,
|
|
38632
|
-
description: tag.description ?? "",
|
|
38633
|
-
chain
|
|
38634
|
-
// raw: {
|
|
38635
|
-
// ...tag,
|
|
38636
|
-
// },
|
|
38637
|
-
};
|
|
38638
|
-
tags2.push(t);
|
|
38657
|
+
tags2.push(...processTagEntries(tag, []));
|
|
38639
38658
|
}
|
|
38640
38659
|
const bitJson = {
|
|
38641
38660
|
name: groupKey,
|
|
@@ -38648,7 +38667,6 @@ var ConfigBuilder = class {
|
|
|
38648
38667
|
changes: ["Initial version"]
|
|
38649
38668
|
}
|
|
38650
38669
|
],
|
|
38651
|
-
inherits,
|
|
38652
38670
|
tags: tags2
|
|
38653
38671
|
// cards: [
|
|
38654
38672
|
// {
|
|
@@ -38680,7 +38698,49 @@ var ConfigBuilder = class {
|
|
|
38680
38698
|
}
|
|
38681
38699
|
};
|
|
38682
38700
|
writeGroupConfigs(groupConfigs);
|
|
38701
|
+
const writeBitsAsGroupConfigs = (bitsAsGroupConfigs) => {
|
|
38702
|
+
for (const b of bitsAsGroupConfigs) {
|
|
38703
|
+
const groupKey = `group-${b.bitType}`;
|
|
38704
|
+
const tags2 = [];
|
|
38705
|
+
const tagEntriesTypeOrder = [
|
|
38706
|
+
BitTagConfigKeyType.tag,
|
|
38707
|
+
BitTagConfigKeyType.property,
|
|
38708
|
+
BitTagConfigKeyType.resource,
|
|
38709
|
+
BitTagConfigKeyType.group,
|
|
38710
|
+
BitTagConfigKeyType.unknown
|
|
38711
|
+
];
|
|
38712
|
+
const tagEntries = Object.entries(b.tags ?? []).sort((a, b2) => {
|
|
38713
|
+
const tagA = a[1];
|
|
38714
|
+
const tagB = b2[1];
|
|
38715
|
+
const typeA = typeFromConfigKey(tagA.key);
|
|
38716
|
+
const typeB = typeFromConfigKey(tagB.key);
|
|
38717
|
+
const typeOrder = tagEntriesTypeOrder.indexOf(typeA) - tagEntriesTypeOrder.indexOf(typeB);
|
|
38718
|
+
return typeOrder;
|
|
38719
|
+
});
|
|
38720
|
+
for (const [_tagKey, tag] of tagEntries) {
|
|
38721
|
+
tags2.push(...processTagEntries(tag, []));
|
|
38722
|
+
}
|
|
38723
|
+
const bitJson = {
|
|
38724
|
+
name: groupKey,
|
|
38725
|
+
description: b.description ?? "",
|
|
38726
|
+
since: "UNKNOWN",
|
|
38727
|
+
deprecated: b.deprecated,
|
|
38728
|
+
history: [
|
|
38729
|
+
{
|
|
38730
|
+
version: "UNKNOWN",
|
|
38731
|
+
changes: ["Initial version"]
|
|
38732
|
+
}
|
|
38733
|
+
],
|
|
38734
|
+
tags: tags2
|
|
38735
|
+
};
|
|
38736
|
+
const output = import_node_path3.default.join(outputFolderGroups, `${groupKey}.jsonc`);
|
|
38737
|
+
const str = JSON.stringify(bitJson, null, 2);
|
|
38738
|
+
import_fs_extra3.default.writeFileSync(output, str);
|
|
38739
|
+
}
|
|
38740
|
+
};
|
|
38741
|
+
writeBitsAsGroupConfigs(bitGroupConfigs);
|
|
38683
38742
|
}
|
|
38743
|
+
// Build flat bit configs
|
|
38684
38744
|
buildFlat(options) {
|
|
38685
38745
|
const opts = Object.assign({}, options);
|
|
38686
38746
|
const bitConfigs = [];
|
|
@@ -38692,8 +38752,63 @@ var ConfigBuilder = class {
|
|
|
38692
38752
|
const outputFolder = opts.outputDir ?? "assets/config";
|
|
38693
38753
|
const outputFolderBits = import_node_path3.default.join(outputFolder, "bits_flat");
|
|
38694
38754
|
import_fs_extra3.default.ensureDirSync(outputFolderBits);
|
|
38755
|
+
const processTagEntries = (tag) => {
|
|
38756
|
+
const tags2 = [];
|
|
38757
|
+
let tagName = tag.key;
|
|
38758
|
+
const tagType = typeFromConfigKey(tag.key);
|
|
38759
|
+
let format = "";
|
|
38760
|
+
let chain = void 0;
|
|
38761
|
+
if (tagType === BitTagConfigKeyType.tag) {
|
|
38762
|
+
tagName = tag.name;
|
|
38763
|
+
format = "bitmark--";
|
|
38764
|
+
} else if (tagType === BitTagConfigKeyType.property) {
|
|
38765
|
+
tagName = tag.key;
|
|
38766
|
+
if (tag.format === TagFormat.plainText) {
|
|
38767
|
+
format = "string";
|
|
38768
|
+
} else if (tag.format === TagFormat.boolean) {
|
|
38769
|
+
format = "bool";
|
|
38770
|
+
} else if (tag.format === TagFormat.bitmarkText) {
|
|
38771
|
+
format = "bitmark";
|
|
38772
|
+
} else if (tag.format === TagFormat.number) {
|
|
38773
|
+
format = "number";
|
|
38774
|
+
}
|
|
38775
|
+
} else if (tagType === BitTagConfigKeyType.resource) {
|
|
38776
|
+
format = "string";
|
|
38777
|
+
} else if (tagType === BitTagConfigKeyType.group) {
|
|
38778
|
+
let k = tag.key;
|
|
38779
|
+
if (k.startsWith("group_")) k = k.substring(6);
|
|
38780
|
+
k = /*'_' +*/
|
|
38781
|
+
stringUtils.camelToKebab(k);
|
|
38782
|
+
tags2.push({
|
|
38783
|
+
type: "group",
|
|
38784
|
+
key: k
|
|
38785
|
+
});
|
|
38786
|
+
return tags2;
|
|
38787
|
+
}
|
|
38788
|
+
if (Array.isArray(tag.chain) && tag.chain.length > 0) {
|
|
38789
|
+
const chainTags = [];
|
|
38790
|
+
for (const [_tagKey, chainTag] of tag.chain.entries()) {
|
|
38791
|
+
chainTags.push(...processTagEntries(chainTag));
|
|
38792
|
+
}
|
|
38793
|
+
chain = chainTags;
|
|
38794
|
+
}
|
|
38795
|
+
const t = {
|
|
38796
|
+
key: tagName,
|
|
38797
|
+
format,
|
|
38798
|
+
default: null,
|
|
38799
|
+
alwaysInclude: false,
|
|
38800
|
+
min: tag.minCount == null ? 0 : tag.minCount,
|
|
38801
|
+
max: tag.maxCount == null ? 1 : tag.maxCount,
|
|
38802
|
+
description: tag.description ?? "",
|
|
38803
|
+
chain
|
|
38804
|
+
// raw: {
|
|
38805
|
+
// ...tag,
|
|
38806
|
+
// },
|
|
38807
|
+
};
|
|
38808
|
+
tags2.push(t);
|
|
38809
|
+
return tags2;
|
|
38810
|
+
};
|
|
38695
38811
|
for (const b of bitConfigs) {
|
|
38696
|
-
const inherits = [];
|
|
38697
38812
|
const tags2 = [];
|
|
38698
38813
|
const tagEntriesTypeOrder = [
|
|
38699
38814
|
BitTagConfigKeyType.tag,
|
|
@@ -38710,103 +38825,8 @@ var ConfigBuilder = class {
|
|
|
38710
38825
|
const typeOrder = tagEntriesTypeOrder.indexOf(typeA) - tagEntriesTypeOrder.indexOf(typeB);
|
|
38711
38826
|
return typeOrder;
|
|
38712
38827
|
});
|
|
38713
|
-
for (const [
|
|
38714
|
-
|
|
38715
|
-
let tagKeyPrefix = "";
|
|
38716
|
-
let format = "";
|
|
38717
|
-
let description = "";
|
|
38718
|
-
let chain = void 0;
|
|
38719
|
-
if (tag.type === BitTagConfigKeyType.tag) {
|
|
38720
|
-
tagName = tag.tag;
|
|
38721
|
-
if (tagName === "%") {
|
|
38722
|
-
description = "Item";
|
|
38723
|
-
chain = {
|
|
38724
|
-
key: "%",
|
|
38725
|
-
format,
|
|
38726
|
-
min: tag.minCount,
|
|
38727
|
-
max: tag.maxCount,
|
|
38728
|
-
description: "Lead",
|
|
38729
|
-
chain: {
|
|
38730
|
-
key: "%",
|
|
38731
|
-
format,
|
|
38732
|
-
min: tag.minCount,
|
|
38733
|
-
max: tag.maxCount,
|
|
38734
|
-
description: "Page number",
|
|
38735
|
-
chain: {
|
|
38736
|
-
key: "%",
|
|
38737
|
-
format,
|
|
38738
|
-
min: tag.minCount,
|
|
38739
|
-
max: tag.maxCount,
|
|
38740
|
-
description: "Margin number"
|
|
38741
|
-
}
|
|
38742
|
-
}
|
|
38743
|
-
};
|
|
38744
|
-
} else if (tagName === "!") {
|
|
38745
|
-
description = "Instruction";
|
|
38746
|
-
} else if (tagName === "?") {
|
|
38747
|
-
description = "Hint";
|
|
38748
|
-
} else if (tagName === "#") {
|
|
38749
|
-
description = "Title";
|
|
38750
|
-
} else if (tagName === "##") {
|
|
38751
|
-
description = "Sub-title";
|
|
38752
|
-
} else if (tagName === "\u25BC") {
|
|
38753
|
-
description = "Anchor";
|
|
38754
|
-
} else if (tagName === "\u25BA") {
|
|
38755
|
-
description = "Reference";
|
|
38756
|
-
} else if (tagName === "$") {
|
|
38757
|
-
description = "Sample solution";
|
|
38758
|
-
} else if (tagName === "&") {
|
|
38759
|
-
description = "Resource";
|
|
38760
|
-
} else if (tagName === "+") {
|
|
38761
|
-
description = "True statement";
|
|
38762
|
-
} else if (tagName === "-") {
|
|
38763
|
-
description = "False statement";
|
|
38764
|
-
} else if (tagName === "_") {
|
|
38765
|
-
description = "Gap";
|
|
38766
|
-
} else if (tagName === "=") {
|
|
38767
|
-
description = "Mark";
|
|
38768
|
-
}
|
|
38769
|
-
format = "bitmark--";
|
|
38770
|
-
} else if (tag.type === BitTagConfigKeyType.property) {
|
|
38771
|
-
tagName = tag.tag;
|
|
38772
|
-
tagKeyPrefix = "@";
|
|
38773
|
-
const property = tag;
|
|
38774
|
-
if (property.format === TagFormat.plainText) {
|
|
38775
|
-
format = "string";
|
|
38776
|
-
} else if (property.format === TagFormat.boolean) {
|
|
38777
|
-
format = "bool";
|
|
38778
|
-
} else if (property.format === TagFormat.bitmarkText) {
|
|
38779
|
-
format = "bitmark";
|
|
38780
|
-
} else if (property.format === TagFormat.number) {
|
|
38781
|
-
format = "number";
|
|
38782
|
-
}
|
|
38783
|
-
} else if (tag.type === BitTagConfigKeyType.resource) {
|
|
38784
|
-
tagKeyPrefix = "&";
|
|
38785
|
-
} else if (tag.type === BitTagConfigKeyType.group) {
|
|
38786
|
-
tagKeyPrefix = "@";
|
|
38787
|
-
let k = tag.configKey;
|
|
38788
|
-
if (k.startsWith("group_")) k = k.substring(6);
|
|
38789
|
-
k = "_" + k;
|
|
38790
|
-
inherits.push({
|
|
38791
|
-
type: "group",
|
|
38792
|
-
name: k
|
|
38793
|
-
});
|
|
38794
|
-
continue;
|
|
38795
|
-
}
|
|
38796
|
-
const t = {
|
|
38797
|
-
key: tagKeyPrefix + tagName,
|
|
38798
|
-
format,
|
|
38799
|
-
default: null,
|
|
38800
|
-
alwaysInclude: false,
|
|
38801
|
-
min: tag.minCount == null ? 0 : tag.minCount,
|
|
38802
|
-
max: tag.maxCount == null ? 1 : tag.maxCount,
|
|
38803
|
-
description,
|
|
38804
|
-
chain
|
|
38805
|
-
// raw: {
|
|
38806
|
-
// ...tag,
|
|
38807
|
-
// },
|
|
38808
|
-
};
|
|
38809
|
-
tags2.push(t);
|
|
38828
|
+
for (const [_tagKey, tag] of tagEntries) {
|
|
38829
|
+
tags2.push(...processTagEntries(tag));
|
|
38810
38830
|
}
|
|
38811
38831
|
const bitJson = {
|
|
38812
38832
|
name: b.bitType,
|