@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.js
CHANGED
|
@@ -246,8 +246,8 @@ var BitType = superenum({
|
|
|
246
246
|
extractorAiChat: "extractor-ai-chat",
|
|
247
247
|
extractorBlock: "extractor-block",
|
|
248
248
|
extractorConfiguration: "extractor-configuration",
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
extractorImage: "extractor-image",
|
|
250
|
+
extractorImageCollapsible: "extractor-image-collapsible",
|
|
251
251
|
extractorInformation: "extractor-information",
|
|
252
252
|
extractorPage: "extractor-page",
|
|
253
253
|
extractorPageCollapsible: "extractor-page-collapsible",
|
|
@@ -1323,6 +1323,7 @@ var propertyKeys = {
|
|
|
1323
1323
|
property_scormSource: "@scormSource",
|
|
1324
1324
|
property_search: "@search",
|
|
1325
1325
|
property_searchIndex: "@searchIndex",
|
|
1326
|
+
property_selected: "@selected",
|
|
1326
1327
|
property_servings: "@servings",
|
|
1327
1328
|
property_showInIndex: "@showInIndex",
|
|
1328
1329
|
property_showSubtitles: "@showSubtitles",
|
|
@@ -3601,6 +3602,12 @@ var GROUPS = {
|
|
|
3601
3602
|
description: "The search text for the resource",
|
|
3602
3603
|
format: TagFormat.plainText
|
|
3603
3604
|
},
|
|
3605
|
+
{
|
|
3606
|
+
key: ConfigKey.property_selected,
|
|
3607
|
+
description: "If true, the resource is selected",
|
|
3608
|
+
format: TagFormat.boolean,
|
|
3609
|
+
defaultValue: "false"
|
|
3610
|
+
},
|
|
3604
3611
|
{
|
|
3605
3612
|
key: ConfigKey.property_srcAlt,
|
|
3606
3613
|
description: "An alternative source for the resource",
|
|
@@ -7103,7 +7110,7 @@ var BITS = {
|
|
|
7103
7110
|
description: "Extractor configuration bit, used to configure extractors in articles or books",
|
|
7104
7111
|
textFormatDefault: TextFormat.plainText
|
|
7105
7112
|
},
|
|
7106
|
-
[BitType.
|
|
7113
|
+
[BitType.extractorImage]: {
|
|
7107
7114
|
since: "4.3.0",
|
|
7108
7115
|
baseBitType: BitType._standard,
|
|
7109
7116
|
description: "Extractor images bit, used for images extracted from PDFs",
|
|
@@ -7123,9 +7130,9 @@ var BITS = {
|
|
|
7123
7130
|
resourceAttachmentAllowed: false,
|
|
7124
7131
|
textFormatDefault: TextFormat.plainText
|
|
7125
7132
|
},
|
|
7126
|
-
[BitType.
|
|
7133
|
+
[BitType.extractorImageCollapsible]: {
|
|
7127
7134
|
since: "4.3.0",
|
|
7128
|
-
baseBitType: BitType.
|
|
7135
|
+
baseBitType: BitType.extractorImage,
|
|
7129
7136
|
description: "Collapsible extractor images bit, used for images extracted from PDFs"
|
|
7130
7137
|
},
|
|
7131
7138
|
[BitType.extractorInformation]: {
|
|
@@ -10130,7 +10137,7 @@ var instance2 = new Config();
|
|
|
10130
10137
|
// src/generated/package_info.ts
|
|
10131
10138
|
var PACKAGE_INFO = {
|
|
10132
10139
|
"name": "@gmb/bitmark-parser-generator",
|
|
10133
|
-
"version": "4.16.
|
|
10140
|
+
"version": "4.16.1",
|
|
10134
10141
|
"author": "Get More Brain Ltd",
|
|
10135
10142
|
"license": "ISC",
|
|
10136
10143
|
"description": "A bitmark parser and generator using Peggy.js"
|
|
@@ -11001,6 +11008,7 @@ var NodeType = superenum20({
|
|
|
11001
11008
|
searchValue: "searchValue",
|
|
11002
11009
|
section: "section",
|
|
11003
11010
|
select: "select",
|
|
11011
|
+
selected: "selected",
|
|
11004
11012
|
servings: "servings",
|
|
11005
11013
|
servingsValue: "servingsValue",
|
|
11006
11014
|
showInIndex: "showInIndex",
|
|
@@ -22463,7 +22471,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22463
22471
|
license: data.license,
|
|
22464
22472
|
copyright: data.copyright,
|
|
22465
22473
|
showInIndex: data.showInIndex,
|
|
22466
|
-
search: data.search
|
|
22474
|
+
search: data.search,
|
|
22475
|
+
selected: data.selected
|
|
22467
22476
|
});
|
|
22468
22477
|
return node;
|
|
22469
22478
|
}
|
|
@@ -22628,7 +22637,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22628
22637
|
copyright,
|
|
22629
22638
|
showInIndex,
|
|
22630
22639
|
caption,
|
|
22631
|
-
search
|
|
22640
|
+
search,
|
|
22641
|
+
selected
|
|
22632
22642
|
} = data;
|
|
22633
22643
|
const { bitType } = context;
|
|
22634
22644
|
let zoomDisabledDefault = false;
|
|
@@ -22637,7 +22647,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22637
22647
|
BitType.pageBanner,
|
|
22638
22648
|
BitType.imagesLogoGrave,
|
|
22639
22649
|
BitType.prototypeImages,
|
|
22640
|
-
BitType.
|
|
22650
|
+
BitType.extractorImage
|
|
22641
22651
|
])) {
|
|
22642
22652
|
zoomDisabledDefault = true;
|
|
22643
22653
|
}
|
|
@@ -22662,11 +22672,12 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22662
22672
|
copyright: copyright ?? "",
|
|
22663
22673
|
showInIndex: showInIndex ?? false,
|
|
22664
22674
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
22665
|
-
search: search ?? void 0
|
|
22675
|
+
search: search ?? void 0,
|
|
22676
|
+
selected: selected ?? false
|
|
22666
22677
|
}
|
|
22667
22678
|
};
|
|
22668
22679
|
objectUtils.removeUnwantedProperties(node.image, {
|
|
22669
|
-
ignoreFalse: ["zoomDisabled", "showInIndex"],
|
|
22680
|
+
ignoreFalse: ["zoomDisabled", "showInIndex", "selected"],
|
|
22670
22681
|
ignoreEmptyArrays: ["caption"],
|
|
22671
22682
|
ignoreUndefined: ["width", "height"],
|
|
22672
22683
|
ignoreEmptyString: ["src", "alt", "license", "copyright"]
|
|
@@ -22695,7 +22706,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22695
22706
|
copyright,
|
|
22696
22707
|
showInIndex,
|
|
22697
22708
|
caption,
|
|
22698
|
-
search
|
|
22709
|
+
search,
|
|
22710
|
+
selected
|
|
22699
22711
|
} = data;
|
|
22700
22712
|
const node = {
|
|
22701
22713
|
type: ResourceType.imageLink,
|
|
@@ -22720,11 +22732,12 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22720
22732
|
copyright: copyright ?? "",
|
|
22721
22733
|
showInIndex: showInIndex ?? false,
|
|
22722
22734
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
22723
|
-
search: search ?? void 0
|
|
22735
|
+
search: search ?? void 0,
|
|
22736
|
+
selected: selected ?? false
|
|
22724
22737
|
}
|
|
22725
22738
|
};
|
|
22726
22739
|
objectUtils.removeUnwantedProperties(node.imageLink, {
|
|
22727
|
-
ignoreFalse: ["zoomDisabled", "showInIndex"],
|
|
22740
|
+
ignoreFalse: ["zoomDisabled", "showInIndex", "selected"],
|
|
22728
22741
|
ignoreEmptyArrays: ["caption"],
|
|
22729
22742
|
ignoreUndefined: ["width", "height"],
|
|
22730
22743
|
ignoreEmptyString: ["url", "alt", "license", "copyright"]
|
|
@@ -22748,7 +22761,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22748
22761
|
copyright,
|
|
22749
22762
|
showInIndex,
|
|
22750
22763
|
caption,
|
|
22751
|
-
search
|
|
22764
|
+
search,
|
|
22765
|
+
selected
|
|
22752
22766
|
} = data;
|
|
22753
22767
|
const node = {
|
|
22754
22768
|
type: ResourceType.audio,
|
|
@@ -22766,13 +22780,14 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22766
22780
|
copyright: copyright ?? "",
|
|
22767
22781
|
showInIndex: showInIndex ?? false,
|
|
22768
22782
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
22769
|
-
search: search ?? void 0
|
|
22783
|
+
search: search ?? void 0,
|
|
22784
|
+
selected: selected ?? false
|
|
22770
22785
|
}
|
|
22771
22786
|
};
|
|
22772
22787
|
objectUtils.removeUnwantedProperties(node.audio, {
|
|
22773
22788
|
ignoreEmptyArrays: ["caption"],
|
|
22774
22789
|
ignoreEmptyString: ["src", "alt", "license", "copyright"],
|
|
22775
|
-
ignoreFalse: ["showInIndex"]
|
|
22790
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
22776
22791
|
});
|
|
22777
22792
|
return nodeValidator.validateResource(node);
|
|
22778
22793
|
}
|
|
@@ -22793,7 +22808,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22793
22808
|
copyright,
|
|
22794
22809
|
showInIndex,
|
|
22795
22810
|
caption,
|
|
22796
|
-
search
|
|
22811
|
+
search,
|
|
22812
|
+
selected
|
|
22797
22813
|
} = data;
|
|
22798
22814
|
const node = {
|
|
22799
22815
|
type: ResourceType.audioEmbed,
|
|
@@ -22811,7 +22827,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22811
22827
|
copyright: copyright ?? "",
|
|
22812
22828
|
showInIndex: showInIndex ?? false,
|
|
22813
22829
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
22814
|
-
search: search ?? void 0
|
|
22830
|
+
search: search ?? void 0,
|
|
22831
|
+
selected: selected ?? false
|
|
22815
22832
|
}
|
|
22816
22833
|
};
|
|
22817
22834
|
objectUtils.removeUnwantedProperties(node.audioEmbed, {
|
|
@@ -22822,7 +22839,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22822
22839
|
"license",
|
|
22823
22840
|
"copyright"
|
|
22824
22841
|
],
|
|
22825
|
-
ignoreFalse: ["showInIndex"]
|
|
22842
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
22826
22843
|
});
|
|
22827
22844
|
return nodeValidator.validateResource(node);
|
|
22828
22845
|
}
|
|
@@ -22843,7 +22860,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22843
22860
|
copyright,
|
|
22844
22861
|
showInIndex,
|
|
22845
22862
|
caption,
|
|
22846
|
-
search
|
|
22863
|
+
search,
|
|
22864
|
+
selected
|
|
22847
22865
|
} = data;
|
|
22848
22866
|
const node = {
|
|
22849
22867
|
type: ResourceType.audioLink,
|
|
@@ -22862,7 +22880,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22862
22880
|
copyright: copyright ?? "",
|
|
22863
22881
|
showInIndex: showInIndex ?? false,
|
|
22864
22882
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
22865
|
-
search: search ?? void 0
|
|
22883
|
+
search: search ?? void 0,
|
|
22884
|
+
selected: selected ?? false
|
|
22866
22885
|
}
|
|
22867
22886
|
};
|
|
22868
22887
|
objectUtils.removeUnwantedProperties(node.audioLink, {
|
|
@@ -22870,7 +22889,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22870
22889
|
ignoreEmptyString: [
|
|
22871
22890
|
"url"
|
|
22872
22891
|
/*'alt', 'license', 'copyright'*/
|
|
22873
|
-
]
|
|
22892
|
+
],
|
|
22893
|
+
ignoreFalse: ["selected"]
|
|
22874
22894
|
});
|
|
22875
22895
|
return nodeValidator.validateResource(node);
|
|
22876
22896
|
}
|
|
@@ -22898,7 +22918,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22898
22918
|
copyright,
|
|
22899
22919
|
showInIndex,
|
|
22900
22920
|
caption,
|
|
22901
|
-
search
|
|
22921
|
+
search,
|
|
22922
|
+
selected
|
|
22902
22923
|
} = data;
|
|
22903
22924
|
const node = {
|
|
22904
22925
|
type: ResourceType.video,
|
|
@@ -22922,6 +22943,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22922
22943
|
showInIndex: showInIndex ?? false,
|
|
22923
22944
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
22924
22945
|
search: search ?? void 0,
|
|
22946
|
+
selected: selected ?? false,
|
|
22925
22947
|
// Have sub-chains so must be at end of chain
|
|
22926
22948
|
posterImage: posterImage ?? void 0,
|
|
22927
22949
|
thumbnails: thumbnails ?? void 0
|
|
@@ -22936,7 +22958,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22936
22958
|
"license",
|
|
22937
22959
|
"copyright"
|
|
22938
22960
|
],
|
|
22939
|
-
ignoreFalse: ["showInIndex"]
|
|
22961
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
22940
22962
|
});
|
|
22941
22963
|
return nodeValidator.validateResource(node);
|
|
22942
22964
|
}
|
|
@@ -22964,7 +22986,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22964
22986
|
copyright,
|
|
22965
22987
|
showInIndex,
|
|
22966
22988
|
caption,
|
|
22967
|
-
search
|
|
22989
|
+
search,
|
|
22990
|
+
selected
|
|
22968
22991
|
} = data;
|
|
22969
22992
|
const node = {
|
|
22970
22993
|
type: ResourceType.videoEmbed,
|
|
@@ -22990,7 +23013,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22990
23013
|
copyright: copyright ?? "",
|
|
22991
23014
|
showInIndex: showInIndex ?? false,
|
|
22992
23015
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
22993
|
-
search: search ?? void 0
|
|
23016
|
+
search: search ?? void 0,
|
|
23017
|
+
selected: selected ?? false
|
|
22994
23018
|
}
|
|
22995
23019
|
};
|
|
22996
23020
|
objectUtils.removeUnwantedProperties(node.videoEmbed, {
|
|
@@ -23002,7 +23026,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23002
23026
|
"license",
|
|
23003
23027
|
"copyright"
|
|
23004
23028
|
],
|
|
23005
|
-
ignoreFalse: ["showInIndex"]
|
|
23029
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23006
23030
|
});
|
|
23007
23031
|
return nodeValidator.validateResource(node);
|
|
23008
23032
|
}
|
|
@@ -23030,7 +23054,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23030
23054
|
copyright,
|
|
23031
23055
|
showInIndex,
|
|
23032
23056
|
caption,
|
|
23033
|
-
search
|
|
23057
|
+
search,
|
|
23058
|
+
selected
|
|
23034
23059
|
} = data;
|
|
23035
23060
|
const node = {
|
|
23036
23061
|
type: ResourceType.videoLink,
|
|
@@ -23056,7 +23081,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23056
23081
|
copyright: copyright ?? "",
|
|
23057
23082
|
showInIndex: showInIndex ?? false,
|
|
23058
23083
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23059
|
-
search: search ?? void 0
|
|
23084
|
+
search: search ?? void 0,
|
|
23085
|
+
selected: selected ?? false
|
|
23060
23086
|
}
|
|
23061
23087
|
};
|
|
23062
23088
|
objectUtils.removeUnwantedProperties(node.videoLink, {
|
|
@@ -23068,7 +23094,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23068
23094
|
"license",
|
|
23069
23095
|
"copyright"
|
|
23070
23096
|
],
|
|
23071
|
-
ignoreFalse: ["showInIndex"]
|
|
23097
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23072
23098
|
});
|
|
23073
23099
|
return nodeValidator.validateResource(node);
|
|
23074
23100
|
}
|
|
@@ -23116,7 +23142,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23116
23142
|
copyright,
|
|
23117
23143
|
showInIndex,
|
|
23118
23144
|
caption,
|
|
23119
|
-
search
|
|
23145
|
+
search,
|
|
23146
|
+
selected
|
|
23120
23147
|
} = data;
|
|
23121
23148
|
const node = {
|
|
23122
23149
|
type: ResourceType.stillImageFilmEmbed,
|
|
@@ -23142,7 +23169,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23142
23169
|
copyright: copyright ?? "",
|
|
23143
23170
|
showInIndex: showInIndex ?? false,
|
|
23144
23171
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23145
|
-
search: search ?? void 0
|
|
23172
|
+
search: search ?? void 0,
|
|
23173
|
+
selected: selected ?? false
|
|
23146
23174
|
}
|
|
23147
23175
|
};
|
|
23148
23176
|
objectUtils.removeUnwantedProperties(node.stillImageFilmEmbed, {
|
|
@@ -23154,7 +23182,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23154
23182
|
"license",
|
|
23155
23183
|
"copyright"
|
|
23156
23184
|
],
|
|
23157
|
-
ignoreFalse: ["showInIndex"]
|
|
23185
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23158
23186
|
});
|
|
23159
23187
|
return nodeValidator.validateResource(node);
|
|
23160
23188
|
}
|
|
@@ -23182,7 +23210,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23182
23210
|
copyright,
|
|
23183
23211
|
showInIndex,
|
|
23184
23212
|
caption,
|
|
23185
|
-
search
|
|
23213
|
+
search,
|
|
23214
|
+
selected
|
|
23186
23215
|
} = data;
|
|
23187
23216
|
const node = {
|
|
23188
23217
|
type: ResourceType.stillImageFilmLink,
|
|
@@ -23208,7 +23237,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23208
23237
|
copyright: copyright ?? "",
|
|
23209
23238
|
showInIndex: showInIndex ?? false,
|
|
23210
23239
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23211
|
-
search: search ?? void 0
|
|
23240
|
+
search: search ?? void 0,
|
|
23241
|
+
selected: selected ?? false
|
|
23212
23242
|
}
|
|
23213
23243
|
};
|
|
23214
23244
|
objectUtils.removeUnwantedProperties(node.stillImageFilmLink, {
|
|
@@ -23220,7 +23250,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23220
23250
|
"license",
|
|
23221
23251
|
"copyright"
|
|
23222
23252
|
],
|
|
23223
|
-
ignoreFalse: ["showInIndex"]
|
|
23253
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23224
23254
|
});
|
|
23225
23255
|
return nodeValidator.validateResource(node);
|
|
23226
23256
|
}
|
|
@@ -23231,7 +23261,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23231
23261
|
* @returns
|
|
23232
23262
|
*/
|
|
23233
23263
|
articleResource(context, data) {
|
|
23234
|
-
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
23264
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search, selected } = data;
|
|
23235
23265
|
const node = {
|
|
23236
23266
|
type: ResourceType.article,
|
|
23237
23267
|
__typeAlias: ResourceType.article,
|
|
@@ -23245,12 +23275,14 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23245
23275
|
copyright: copyright ?? "",
|
|
23246
23276
|
showInIndex: showInIndex ?? false,
|
|
23247
23277
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23248
|
-
search: search ?? void 0
|
|
23278
|
+
search: search ?? void 0,
|
|
23279
|
+
selected: selected ?? false
|
|
23249
23280
|
}
|
|
23250
23281
|
};
|
|
23251
23282
|
objectUtils.removeUnwantedProperties(node.article, {
|
|
23252
23283
|
ignoreEmptyArrays: ["caption"],
|
|
23253
|
-
ignoreEmptyString: ["body", "alt", "license", "copyright"]
|
|
23284
|
+
ignoreEmptyString: ["body", "alt", "license", "copyright"],
|
|
23285
|
+
ignoreFalse: ["selected"]
|
|
23254
23286
|
});
|
|
23255
23287
|
return nodeValidator.validateResource(node);
|
|
23256
23288
|
}
|
|
@@ -23261,7 +23293,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23261
23293
|
* @returns
|
|
23262
23294
|
*/
|
|
23263
23295
|
documentResource(context, data) {
|
|
23264
|
-
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
23296
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search, selected } = data;
|
|
23265
23297
|
const node = {
|
|
23266
23298
|
type: ResourceType.document,
|
|
23267
23299
|
__typeAlias: ResourceType.document,
|
|
@@ -23275,13 +23307,14 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23275
23307
|
copyright: copyright ?? "",
|
|
23276
23308
|
showInIndex: showInIndex ?? false,
|
|
23277
23309
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23278
|
-
search: search ?? void 0
|
|
23310
|
+
search: search ?? void 0,
|
|
23311
|
+
selected: selected ?? false
|
|
23279
23312
|
}
|
|
23280
23313
|
};
|
|
23281
23314
|
objectUtils.removeUnwantedProperties(node.document, {
|
|
23282
23315
|
ignoreEmptyArrays: ["caption"],
|
|
23283
23316
|
ignoreEmptyString: ["url", "alt", "license", "copyright"],
|
|
23284
|
-
ignoreFalse: ["showInIndex"]
|
|
23317
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23285
23318
|
});
|
|
23286
23319
|
return nodeValidator.validateResource(node);
|
|
23287
23320
|
}
|
|
@@ -23292,7 +23325,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23292
23325
|
* @returns
|
|
23293
23326
|
*/
|
|
23294
23327
|
documentEmbedResource(context, data) {
|
|
23295
|
-
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
23328
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search, selected } = data;
|
|
23296
23329
|
const node = {
|
|
23297
23330
|
type: ResourceType.documentEmbed,
|
|
23298
23331
|
__typeAlias: ResourceType.documentEmbed,
|
|
@@ -23306,13 +23339,14 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23306
23339
|
copyright: copyright ?? "",
|
|
23307
23340
|
showInIndex: showInIndex ?? false,
|
|
23308
23341
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23309
|
-
search: search ?? void 0
|
|
23342
|
+
search: search ?? void 0,
|
|
23343
|
+
selected: selected ?? false
|
|
23310
23344
|
}
|
|
23311
23345
|
};
|
|
23312
23346
|
objectUtils.removeUnwantedProperties(node.documentEmbed, {
|
|
23313
23347
|
ignoreEmptyArrays: ["caption"],
|
|
23314
23348
|
ignoreEmptyString: ["url", "alt", "license", "copyright"],
|
|
23315
|
-
ignoreFalse: ["showInIndex"]
|
|
23349
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23316
23350
|
});
|
|
23317
23351
|
return nodeValidator.validateResource(node);
|
|
23318
23352
|
}
|
|
@@ -23323,7 +23357,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23323
23357
|
* @returns
|
|
23324
23358
|
*/
|
|
23325
23359
|
documentLinkResource(context, data) {
|
|
23326
|
-
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
23360
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search, selected } = data;
|
|
23327
23361
|
const node = {
|
|
23328
23362
|
type: ResourceType.documentLink,
|
|
23329
23363
|
__typeAlias: ResourceType.documentLink,
|
|
@@ -23337,13 +23371,14 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23337
23371
|
copyright: copyright ?? "",
|
|
23338
23372
|
showInIndex: showInIndex ?? false,
|
|
23339
23373
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23340
|
-
search: search ?? void 0
|
|
23374
|
+
search: search ?? void 0,
|
|
23375
|
+
selected: selected ?? false
|
|
23341
23376
|
}
|
|
23342
23377
|
};
|
|
23343
23378
|
objectUtils.removeUnwantedProperties(node.documentLink, {
|
|
23344
23379
|
ignoreEmptyArrays: ["caption"],
|
|
23345
23380
|
ignoreEmptyString: ["url", "alt", "license", "copyright"],
|
|
23346
|
-
ignoreFalse: ["showInIndex"]
|
|
23381
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23347
23382
|
});
|
|
23348
23383
|
return nodeValidator.validateResource(node);
|
|
23349
23384
|
}
|
|
@@ -23354,7 +23389,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23354
23389
|
* @returns
|
|
23355
23390
|
*/
|
|
23356
23391
|
documentDownloadResource(context, data) {
|
|
23357
|
-
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
23392
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search, selected } = data;
|
|
23358
23393
|
const node = {
|
|
23359
23394
|
type: ResourceType.documentDownload,
|
|
23360
23395
|
__typeAlias: ResourceType.documentDownload,
|
|
@@ -23368,13 +23403,14 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23368
23403
|
copyright: copyright ?? "",
|
|
23369
23404
|
showInIndex: showInIndex ?? false,
|
|
23370
23405
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23371
|
-
search: search ?? void 0
|
|
23406
|
+
search: search ?? void 0,
|
|
23407
|
+
selected: selected ?? false
|
|
23372
23408
|
}
|
|
23373
23409
|
};
|
|
23374
23410
|
objectUtils.removeUnwantedProperties(node.documentDownload, {
|
|
23375
23411
|
ignoreEmptyArrays: ["caption"],
|
|
23376
23412
|
ignoreEmptyString: ["url", "alt", "license", "copyright"],
|
|
23377
|
-
ignoreFalse: ["showInIndex"]
|
|
23413
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23378
23414
|
});
|
|
23379
23415
|
return nodeValidator.validateResource(node);
|
|
23380
23416
|
}
|
|
@@ -23385,7 +23421,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23385
23421
|
* @returns
|
|
23386
23422
|
*/
|
|
23387
23423
|
appLinkResource(context, data) {
|
|
23388
|
-
const { value, srcAlt, license, copyright, showInIndex, caption, search } = data;
|
|
23424
|
+
const { value, srcAlt, license, copyright, showInIndex, caption, search, selected } = data;
|
|
23389
23425
|
const node = {
|
|
23390
23426
|
type: ResourceType.appLink,
|
|
23391
23427
|
__typeAlias: ResourceType.appLink,
|
|
@@ -23400,7 +23436,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23400
23436
|
copyright: copyright ?? "",
|
|
23401
23437
|
showInIndex: showInIndex ?? false,
|
|
23402
23438
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23403
|
-
search: search ?? void 0
|
|
23439
|
+
search: search ?? void 0,
|
|
23440
|
+
selected: selected ?? false
|
|
23404
23441
|
}
|
|
23405
23442
|
};
|
|
23406
23443
|
objectUtils.removeUnwantedProperties(node.appLink, {
|
|
@@ -23411,7 +23448,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23411
23448
|
"license",
|
|
23412
23449
|
"copyright"
|
|
23413
23450
|
],
|
|
23414
|
-
ignoreFalse: ["showInIndex"]
|
|
23451
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23415
23452
|
});
|
|
23416
23453
|
return nodeValidator.validateResource(node);
|
|
23417
23454
|
}
|
|
@@ -23430,7 +23467,8 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23430
23467
|
copyright,
|
|
23431
23468
|
showInIndex,
|
|
23432
23469
|
caption,
|
|
23433
|
-
search
|
|
23470
|
+
search,
|
|
23471
|
+
selected
|
|
23434
23472
|
} = data;
|
|
23435
23473
|
const node = {
|
|
23436
23474
|
type: ResourceType.websiteLink,
|
|
@@ -23446,13 +23484,14 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
23446
23484
|
copyright: copyright ?? "",
|
|
23447
23485
|
showInIndex: showInIndex ?? false,
|
|
23448
23486
|
caption: this.handleJsonText(context, TextLocation.tag, caption),
|
|
23449
|
-
search: search ?? void 0
|
|
23487
|
+
search: search ?? void 0,
|
|
23488
|
+
selected: selected ?? false
|
|
23450
23489
|
}
|
|
23451
23490
|
};
|
|
23452
23491
|
objectUtils.removeUnwantedProperties(node.websiteLink, {
|
|
23453
23492
|
ignoreEmptyArrays: ["caption"],
|
|
23454
23493
|
ignoreEmptyString: ["url", "alt", "license", "copyright"],
|
|
23455
|
-
ignoreFalse: ["showInIndex"]
|
|
23494
|
+
ignoreFalse: ["showInIndex", "selected"]
|
|
23456
23495
|
});
|
|
23457
23496
|
return nodeValidator.validateResource(node);
|
|
23458
23497
|
}
|
|
@@ -28146,7 +28185,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28146
28185
|
BitType.pageBanner,
|
|
28147
28186
|
BitType.imagesLogoGrave,
|
|
28148
28187
|
BitType.prototypeImages,
|
|
28149
|
-
BitType.
|
|
28188
|
+
BitType.extractorImage
|
|
28150
28189
|
])) {
|
|
28151
28190
|
this.writeProperty("zoomDisabled", node.value, route, {
|
|
28152
28191
|
format: TagFormat.boolean,
|
|
@@ -28199,6 +28238,14 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28199
28238
|
format: TagFormat.plainText
|
|
28200
28239
|
});
|
|
28201
28240
|
}
|
|
28241
|
+
leaf_selected(node, route) {
|
|
28242
|
+
if (node.value == null) return;
|
|
28243
|
+
this.writeNL_IfNotChain(route);
|
|
28244
|
+
this.writeProperty("selected", node.value, route, {
|
|
28245
|
+
format: TagFormat.boolean,
|
|
28246
|
+
ignoreFalse: true
|
|
28247
|
+
});
|
|
28248
|
+
}
|
|
28202
28249
|
// bitmarkAst -> bits -> bitsValue -> resource -> ...
|
|
28203
28250
|
// bitmarkAst -> bits -> bitsValue -> resource -> posterImage -> ...
|
|
28204
28251
|
// bitmarkAst -> bits -> bitsValue -> resource -> thumbnails -> thumbnailsValue -> ...
|
|
@@ -29371,7 +29418,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29371
29418
|
} else if (instance2.isOfBitType(bitType, [
|
|
29372
29419
|
BitType.imagesLogoGrave,
|
|
29373
29420
|
BitType.prototypeImages,
|
|
29374
|
-
BitType.
|
|
29421
|
+
BitType.extractorImage
|
|
29375
29422
|
])) {
|
|
29376
29423
|
const images = [];
|
|
29377
29424
|
for (const r of resources) {
|
|
@@ -29952,7 +29999,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29952
29999
|
if (instance2.isOfBitType(bitType, [
|
|
29953
30000
|
BitType.imagesLogoGrave,
|
|
29954
30001
|
BitType.prototypeImages,
|
|
29955
|
-
BitType.
|
|
30002
|
+
BitType.extractorImage
|
|
29956
30003
|
])) {
|
|
29957
30004
|
if (bitType === BitType.imagesLogoGrave) {
|
|
29958
30005
|
if (bitJson.logos == null) {
|
|
@@ -30384,7 +30431,7 @@ var JsonParser = class {
|
|
|
30384
30431
|
processResources(bitType, resource, images, logos) {
|
|
30385
30432
|
const nodes = [];
|
|
30386
30433
|
if (resource) nodes.push(resource);
|
|
30387
|
-
if (instance2.isOfBitType(bitType, [BitType.prototypeImages, BitType.
|
|
30434
|
+
if (instance2.isOfBitType(bitType, [BitType.prototypeImages, BitType.extractorImage])) {
|
|
30388
30435
|
if (Array.isArray(images)) {
|
|
30389
30436
|
for (const image of images) {
|
|
30390
30437
|
if (image) nodes.push(image);
|
|
@@ -38354,6 +38401,8 @@ var ConfigBuilder = class {
|
|
|
38354
38401
|
this.buildFlat(opts);
|
|
38355
38402
|
const bitConfigs = [];
|
|
38356
38403
|
const groupConfigs = [];
|
|
38404
|
+
const bitGroupConfigKeys = [];
|
|
38405
|
+
const bitGroupConfigs = [];
|
|
38357
38406
|
for (const bt of BitType.values()) {
|
|
38358
38407
|
const bitType = instance2.getBitType(bt);
|
|
38359
38408
|
const _bitConfig = BITS[bitType];
|
|
@@ -38377,8 +38426,101 @@ var ConfigBuilder = class {
|
|
|
38377
38426
|
fs3.ensureDirSync(outputFolderBits);
|
|
38378
38427
|
fs3.ensureDirSync(outputFolderGroups);
|
|
38379
38428
|
const fileWrites = [];
|
|
38429
|
+
const keyToJsonKey = (key, tagNameChain) => {
|
|
38430
|
+
let jsonKey = key;
|
|
38431
|
+
if (key === "%") {
|
|
38432
|
+
jsonKey = "item_todo";
|
|
38433
|
+
} else if (key === "!") {
|
|
38434
|
+
jsonKey = "instruction";
|
|
38435
|
+
} else if (key === "?") {
|
|
38436
|
+
jsonKey = "hint";
|
|
38437
|
+
} else if (key === "#") {
|
|
38438
|
+
jsonKey = "title";
|
|
38439
|
+
} else if (key === "##") {
|
|
38440
|
+
jsonKey = "subTitle";
|
|
38441
|
+
} else if (key === "\u25BC") {
|
|
38442
|
+
jsonKey = "anchor";
|
|
38443
|
+
} else if (key === "\u25BA") {
|
|
38444
|
+
jsonKey = "reference";
|
|
38445
|
+
} else if (key === "$") {
|
|
38446
|
+
jsonKey = "sampleSolution";
|
|
38447
|
+
} else if (key === "+") {
|
|
38448
|
+
jsonKey = "true_todo";
|
|
38449
|
+
} else if (key === "-") {
|
|
38450
|
+
jsonKey = "false_todo";
|
|
38451
|
+
} else if (key === "_") {
|
|
38452
|
+
jsonKey = "gap_todo";
|
|
38453
|
+
} else if (key === "=") {
|
|
38454
|
+
jsonKey = "mark_todo";
|
|
38455
|
+
} else if (key.startsWith("@")) {
|
|
38456
|
+
jsonKey = key.substring(1);
|
|
38457
|
+
} else if (key.startsWith("&")) {
|
|
38458
|
+
jsonKey = key.substring(1);
|
|
38459
|
+
}
|
|
38460
|
+
const thisChain = [...tagNameChain, jsonKey];
|
|
38461
|
+
jsonKey = thisChain.join(".");
|
|
38462
|
+
return jsonKey;
|
|
38463
|
+
};
|
|
38464
|
+
const processTagEntries = (tag, tagNameChain) => {
|
|
38465
|
+
const tags2 = [];
|
|
38466
|
+
let tagName = tag.key;
|
|
38467
|
+
const jsonKey = keyToJsonKey(tagName, tagNameChain);
|
|
38468
|
+
const tagType = typeFromConfigKey(tag.key);
|
|
38469
|
+
let format = "";
|
|
38470
|
+
let chain = void 0;
|
|
38471
|
+
if (tagType === BitTagConfigKeyType.tag) {
|
|
38472
|
+
tagName = tag.key;
|
|
38473
|
+
format = "bitmark--";
|
|
38474
|
+
} else if (tagType === BitTagConfigKeyType.property) {
|
|
38475
|
+
tagName = tag.key;
|
|
38476
|
+
if (tag.format === TagFormat.plainText) {
|
|
38477
|
+
format = "string";
|
|
38478
|
+
} else if (tag.format === TagFormat.boolean) {
|
|
38479
|
+
format = "bool";
|
|
38480
|
+
} else if (tag.format === TagFormat.bitmarkText) {
|
|
38481
|
+
format = "bitmark";
|
|
38482
|
+
} else if (tag.format === TagFormat.number) {
|
|
38483
|
+
format = "number";
|
|
38484
|
+
}
|
|
38485
|
+
} else if (tagType === BitTagConfigKeyType.resource) {
|
|
38486
|
+
format = "string";
|
|
38487
|
+
} else if (tagType === BitTagConfigKeyType.group) {
|
|
38488
|
+
let k = tag.key;
|
|
38489
|
+
if (k.startsWith("group_")) k = k.substring(6);
|
|
38490
|
+
k = /*'_' +*/
|
|
38491
|
+
stringUtils.camelToKebab(k);
|
|
38492
|
+
tags2.push({
|
|
38493
|
+
type: "group",
|
|
38494
|
+
key: k
|
|
38495
|
+
});
|
|
38496
|
+
return tags2;
|
|
38497
|
+
}
|
|
38498
|
+
if (Array.isArray(tag.chain) && tag.chain.length > 0) {
|
|
38499
|
+
const chainTags = [];
|
|
38500
|
+
for (const [_tagKey, chainTag] of tag.chain.entries()) {
|
|
38501
|
+
chainTags.push(...processTagEntries(chainTag, [...tagNameChain, jsonKey]));
|
|
38502
|
+
}
|
|
38503
|
+
chain = chainTags;
|
|
38504
|
+
}
|
|
38505
|
+
const t = {
|
|
38506
|
+
type: "tag",
|
|
38507
|
+
key: tagName,
|
|
38508
|
+
jsonKey,
|
|
38509
|
+
format,
|
|
38510
|
+
default: null,
|
|
38511
|
+
alwaysInclude: false,
|
|
38512
|
+
min: tag.minCount == null ? 0 : tag.minCount,
|
|
38513
|
+
max: tag.maxCount == null ? 1 : tag.maxCount,
|
|
38514
|
+
description: tag.description ?? "",
|
|
38515
|
+
tags: chain
|
|
38516
|
+
// raw: {
|
|
38517
|
+
// ...tag,
|
|
38518
|
+
// },
|
|
38519
|
+
};
|
|
38520
|
+
tags2.push(t);
|
|
38521
|
+
return tags2;
|
|
38522
|
+
};
|
|
38380
38523
|
for (const b of bitConfigs) {
|
|
38381
|
-
const inherits = [];
|
|
38382
38524
|
const tags2 = [];
|
|
38383
38525
|
const tagEntriesTypeOrder = [
|
|
38384
38526
|
BitTagConfigKeyType.tag,
|
|
@@ -38395,77 +38537,15 @@ var ConfigBuilder = class {
|
|
|
38395
38537
|
const typeOrder = tagEntriesTypeOrder.indexOf(typeA) - tagEntriesTypeOrder.indexOf(typeB);
|
|
38396
38538
|
return typeOrder;
|
|
38397
38539
|
});
|
|
38398
|
-
if (b.baseBitType)
|
|
38399
|
-
|
|
38400
|
-
type: "
|
|
38401
|
-
|
|
38540
|
+
if (b.baseBitType) {
|
|
38541
|
+
tags2.push({
|
|
38542
|
+
type: "group",
|
|
38543
|
+
key: `group-${b.baseBitType}`
|
|
38402
38544
|
});
|
|
38545
|
+
bitGroupConfigKeys.push(b.baseBitType);
|
|
38546
|
+
}
|
|
38403
38547
|
for (const [_tagKey, tag] of tagEntries) {
|
|
38404
|
-
|
|
38405
|
-
let format = "";
|
|
38406
|
-
let chain = void 0;
|
|
38407
|
-
const tagType = typeFromConfigKey(tag.key);
|
|
38408
|
-
if (tagType === BitTagConfigKeyType.tag) {
|
|
38409
|
-
if (tagName === "%") {
|
|
38410
|
-
chain = {
|
|
38411
|
-
key: "%",
|
|
38412
|
-
format,
|
|
38413
|
-
min: tag.minCount,
|
|
38414
|
-
max: tag.maxCount,
|
|
38415
|
-
description: "Lead",
|
|
38416
|
-
chain: {
|
|
38417
|
-
key: "%",
|
|
38418
|
-
format,
|
|
38419
|
-
min: tag.minCount,
|
|
38420
|
-
max: tag.maxCount,
|
|
38421
|
-
description: "Page number",
|
|
38422
|
-
chain: {
|
|
38423
|
-
key: "%",
|
|
38424
|
-
format,
|
|
38425
|
-
min: tag.minCount,
|
|
38426
|
-
max: tag.maxCount,
|
|
38427
|
-
description: "Margin number"
|
|
38428
|
-
}
|
|
38429
|
-
}
|
|
38430
|
-
};
|
|
38431
|
-
}
|
|
38432
|
-
format = "bitmark--";
|
|
38433
|
-
} else if (tagType === BitTagConfigKeyType.property) {
|
|
38434
|
-
if (tag.format === TagFormat.plainText) {
|
|
38435
|
-
format = "string";
|
|
38436
|
-
} else if (tag.format === TagFormat.boolean) {
|
|
38437
|
-
format = "bool";
|
|
38438
|
-
} else if (tag.format === TagFormat.bitmarkText) {
|
|
38439
|
-
format = "bitmark";
|
|
38440
|
-
} else if (tag.format === TagFormat.number) {
|
|
38441
|
-
format = "number";
|
|
38442
|
-
}
|
|
38443
|
-
} else if (tagType === BitTagConfigKeyType.resource) {
|
|
38444
|
-
} else if (tagType === BitTagConfigKeyType.group) {
|
|
38445
|
-
let k = tag.key;
|
|
38446
|
-
if (k.startsWith("group_")) k = k.substring(6);
|
|
38447
|
-
k = /*'_' +*/
|
|
38448
|
-
stringUtils.camelToKebab(k);
|
|
38449
|
-
inherits.push({
|
|
38450
|
-
type: "group",
|
|
38451
|
-
name: k
|
|
38452
|
-
});
|
|
38453
|
-
continue;
|
|
38454
|
-
}
|
|
38455
|
-
const t = {
|
|
38456
|
-
key: tagName,
|
|
38457
|
-
format,
|
|
38458
|
-
default: null,
|
|
38459
|
-
alwaysInclude: false,
|
|
38460
|
-
min: tag.minCount == null ? 0 : tag.minCount,
|
|
38461
|
-
max: tag.maxCount == null ? 1 : tag.maxCount,
|
|
38462
|
-
description: tag.description ?? "",
|
|
38463
|
-
chain
|
|
38464
|
-
// raw: {
|
|
38465
|
-
// ...tag,
|
|
38466
|
-
// },
|
|
38467
|
-
};
|
|
38468
|
-
tags2.push(t);
|
|
38548
|
+
tags2.push(...processTagEntries(tag, []));
|
|
38469
38549
|
}
|
|
38470
38550
|
const bitJson = {
|
|
38471
38551
|
name: b.bitType,
|
|
@@ -38484,16 +38564,22 @@ var ConfigBuilder = class {
|
|
|
38484
38564
|
footerAllowed: b.footerAllowed ?? true,
|
|
38485
38565
|
footerRequired: b.footerRequired ?? false,
|
|
38486
38566
|
resourceAttachmentAllowed: b.resourceAttachmentAllowed ?? true,
|
|
38487
|
-
inherits,
|
|
38488
38567
|
tags: tags2
|
|
38489
38568
|
};
|
|
38490
38569
|
const output = path3.join(outputFolderBits, `${b.bitType}.jsonc`);
|
|
38491
38570
|
const str = JSON.stringify(bitJson, null, 2);
|
|
38492
38571
|
fileWrites.push(fs3.writeFile(output, str));
|
|
38493
38572
|
}
|
|
38573
|
+
for (const bt of bitGroupConfigKeys) {
|
|
38574
|
+
const bitType = instance2.getBitType(bt);
|
|
38575
|
+
const _bitConfig = BITS[bitType];
|
|
38576
|
+
if (_bitConfig) {
|
|
38577
|
+
_bitConfig.bitType = bitType;
|
|
38578
|
+
bitGroupConfigs.push(_bitConfig);
|
|
38579
|
+
}
|
|
38580
|
+
}
|
|
38494
38581
|
const writeGroupConfigs = (groupConfigs2) => {
|
|
38495
38582
|
for (const g of groupConfigs2) {
|
|
38496
|
-
const inherits = [];
|
|
38497
38583
|
const tags2 = [];
|
|
38498
38584
|
const groupKey = stringUtils.camelToKebab(g.key);
|
|
38499
38585
|
const tagEntriesTypeOrder = [
|
|
@@ -38509,74 +38595,7 @@ var ConfigBuilder = class {
|
|
|
38509
38595
|
return typeOrder;
|
|
38510
38596
|
});
|
|
38511
38597
|
for (const [_tagKey, tag] of tagEntries) {
|
|
38512
|
-
|
|
38513
|
-
const tagType = typeFromConfigKey(tag.key);
|
|
38514
|
-
let format = "";
|
|
38515
|
-
let chain = void 0;
|
|
38516
|
-
if (tagType === BitTagConfigKeyType.tag) {
|
|
38517
|
-
tagName = tag.name;
|
|
38518
|
-
if (tagName === "%") {
|
|
38519
|
-
chain = {
|
|
38520
|
-
key: "%",
|
|
38521
|
-
format,
|
|
38522
|
-
min: tag.minCount,
|
|
38523
|
-
max: tag.maxCount,
|
|
38524
|
-
description: "Lead",
|
|
38525
|
-
chain: {
|
|
38526
|
-
key: "%",
|
|
38527
|
-
format,
|
|
38528
|
-
min: tag.minCount,
|
|
38529
|
-
max: tag.maxCount,
|
|
38530
|
-
description: "Page number",
|
|
38531
|
-
chain: {
|
|
38532
|
-
key: "%",
|
|
38533
|
-
format,
|
|
38534
|
-
min: tag.minCount,
|
|
38535
|
-
max: tag.maxCount,
|
|
38536
|
-
description: "Margin number"
|
|
38537
|
-
}
|
|
38538
|
-
}
|
|
38539
|
-
};
|
|
38540
|
-
}
|
|
38541
|
-
format = "bitmark--";
|
|
38542
|
-
} else if (tagType === BitTagConfigKeyType.property) {
|
|
38543
|
-
tagName = tag.key;
|
|
38544
|
-
if (tag.format === TagFormat.plainText) {
|
|
38545
|
-
format = "string";
|
|
38546
|
-
} else if (tag.format === TagFormat.boolean) {
|
|
38547
|
-
format = "bool";
|
|
38548
|
-
} else if (tag.format === TagFormat.bitmarkText) {
|
|
38549
|
-
format = "bitmark";
|
|
38550
|
-
} else if (tag.format === TagFormat.number) {
|
|
38551
|
-
format = "number";
|
|
38552
|
-
}
|
|
38553
|
-
} else if (tagType === BitTagConfigKeyType.resource) {
|
|
38554
|
-
format = "string";
|
|
38555
|
-
} else if (tagType === BitTagConfigKeyType.group) {
|
|
38556
|
-
let k = tag.key;
|
|
38557
|
-
if (k.startsWith("group_")) k = k.substring(6);
|
|
38558
|
-
k = /*'_' +*/
|
|
38559
|
-
stringUtils.camelToKebab(k);
|
|
38560
|
-
inherits.push({
|
|
38561
|
-
type: "group",
|
|
38562
|
-
name: k
|
|
38563
|
-
});
|
|
38564
|
-
continue;
|
|
38565
|
-
}
|
|
38566
|
-
const t = {
|
|
38567
|
-
key: tagName,
|
|
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
|
-
chain
|
|
38575
|
-
// raw: {
|
|
38576
|
-
// ...tag,
|
|
38577
|
-
// },
|
|
38578
|
-
};
|
|
38579
|
-
tags2.push(t);
|
|
38598
|
+
tags2.push(...processTagEntries(tag, []));
|
|
38580
38599
|
}
|
|
38581
38600
|
const bitJson = {
|
|
38582
38601
|
name: groupKey,
|
|
@@ -38589,7 +38608,6 @@ var ConfigBuilder = class {
|
|
|
38589
38608
|
changes: ["Initial version"]
|
|
38590
38609
|
}
|
|
38591
38610
|
],
|
|
38592
|
-
inherits,
|
|
38593
38611
|
tags: tags2
|
|
38594
38612
|
// cards: [
|
|
38595
38613
|
// {
|
|
@@ -38621,7 +38639,49 @@ var ConfigBuilder = class {
|
|
|
38621
38639
|
}
|
|
38622
38640
|
};
|
|
38623
38641
|
writeGroupConfigs(groupConfigs);
|
|
38642
|
+
const writeBitsAsGroupConfigs = (bitsAsGroupConfigs) => {
|
|
38643
|
+
for (const b of bitsAsGroupConfigs) {
|
|
38644
|
+
const groupKey = `group-${b.bitType}`;
|
|
38645
|
+
const tags2 = [];
|
|
38646
|
+
const tagEntriesTypeOrder = [
|
|
38647
|
+
BitTagConfigKeyType.tag,
|
|
38648
|
+
BitTagConfigKeyType.property,
|
|
38649
|
+
BitTagConfigKeyType.resource,
|
|
38650
|
+
BitTagConfigKeyType.group,
|
|
38651
|
+
BitTagConfigKeyType.unknown
|
|
38652
|
+
];
|
|
38653
|
+
const tagEntries = Object.entries(b.tags ?? []).sort((a, b2) => {
|
|
38654
|
+
const tagA = a[1];
|
|
38655
|
+
const tagB = b2[1];
|
|
38656
|
+
const typeA = typeFromConfigKey(tagA.key);
|
|
38657
|
+
const typeB = typeFromConfigKey(tagB.key);
|
|
38658
|
+
const typeOrder = tagEntriesTypeOrder.indexOf(typeA) - tagEntriesTypeOrder.indexOf(typeB);
|
|
38659
|
+
return typeOrder;
|
|
38660
|
+
});
|
|
38661
|
+
for (const [_tagKey, tag] of tagEntries) {
|
|
38662
|
+
tags2.push(...processTagEntries(tag, []));
|
|
38663
|
+
}
|
|
38664
|
+
const bitJson = {
|
|
38665
|
+
name: groupKey,
|
|
38666
|
+
description: b.description ?? "",
|
|
38667
|
+
since: "UNKNOWN",
|
|
38668
|
+
deprecated: b.deprecated,
|
|
38669
|
+
history: [
|
|
38670
|
+
{
|
|
38671
|
+
version: "UNKNOWN",
|
|
38672
|
+
changes: ["Initial version"]
|
|
38673
|
+
}
|
|
38674
|
+
],
|
|
38675
|
+
tags: tags2
|
|
38676
|
+
};
|
|
38677
|
+
const output = path3.join(outputFolderGroups, `${groupKey}.jsonc`);
|
|
38678
|
+
const str = JSON.stringify(bitJson, null, 2);
|
|
38679
|
+
fs3.writeFileSync(output, str);
|
|
38680
|
+
}
|
|
38681
|
+
};
|
|
38682
|
+
writeBitsAsGroupConfigs(bitGroupConfigs);
|
|
38624
38683
|
}
|
|
38684
|
+
// Build flat bit configs
|
|
38625
38685
|
buildFlat(options) {
|
|
38626
38686
|
const opts = Object.assign({}, options);
|
|
38627
38687
|
const bitConfigs = [];
|
|
@@ -38633,8 +38693,63 @@ var ConfigBuilder = class {
|
|
|
38633
38693
|
const outputFolder = opts.outputDir ?? "assets/config";
|
|
38634
38694
|
const outputFolderBits = path3.join(outputFolder, "bits_flat");
|
|
38635
38695
|
fs3.ensureDirSync(outputFolderBits);
|
|
38696
|
+
const processTagEntries = (tag) => {
|
|
38697
|
+
const tags2 = [];
|
|
38698
|
+
let tagName = tag.key;
|
|
38699
|
+
const tagType = typeFromConfigKey(tag.key);
|
|
38700
|
+
let format = "";
|
|
38701
|
+
let chain = void 0;
|
|
38702
|
+
if (tagType === BitTagConfigKeyType.tag) {
|
|
38703
|
+
tagName = tag.name;
|
|
38704
|
+
format = "bitmark--";
|
|
38705
|
+
} else if (tagType === BitTagConfigKeyType.property) {
|
|
38706
|
+
tagName = tag.key;
|
|
38707
|
+
if (tag.format === TagFormat.plainText) {
|
|
38708
|
+
format = "string";
|
|
38709
|
+
} else if (tag.format === TagFormat.boolean) {
|
|
38710
|
+
format = "bool";
|
|
38711
|
+
} else if (tag.format === TagFormat.bitmarkText) {
|
|
38712
|
+
format = "bitmark";
|
|
38713
|
+
} else if (tag.format === TagFormat.number) {
|
|
38714
|
+
format = "number";
|
|
38715
|
+
}
|
|
38716
|
+
} else if (tagType === BitTagConfigKeyType.resource) {
|
|
38717
|
+
format = "string";
|
|
38718
|
+
} else if (tagType === BitTagConfigKeyType.group) {
|
|
38719
|
+
let k = tag.key;
|
|
38720
|
+
if (k.startsWith("group_")) k = k.substring(6);
|
|
38721
|
+
k = /*'_' +*/
|
|
38722
|
+
stringUtils.camelToKebab(k);
|
|
38723
|
+
tags2.push({
|
|
38724
|
+
type: "group",
|
|
38725
|
+
key: k
|
|
38726
|
+
});
|
|
38727
|
+
return tags2;
|
|
38728
|
+
}
|
|
38729
|
+
if (Array.isArray(tag.chain) && tag.chain.length > 0) {
|
|
38730
|
+
const chainTags = [];
|
|
38731
|
+
for (const [_tagKey, chainTag] of tag.chain.entries()) {
|
|
38732
|
+
chainTags.push(...processTagEntries(chainTag));
|
|
38733
|
+
}
|
|
38734
|
+
chain = chainTags;
|
|
38735
|
+
}
|
|
38736
|
+
const t = {
|
|
38737
|
+
key: tagName,
|
|
38738
|
+
format,
|
|
38739
|
+
default: null,
|
|
38740
|
+
alwaysInclude: false,
|
|
38741
|
+
min: tag.minCount == null ? 0 : tag.minCount,
|
|
38742
|
+
max: tag.maxCount == null ? 1 : tag.maxCount,
|
|
38743
|
+
description: tag.description ?? "",
|
|
38744
|
+
chain
|
|
38745
|
+
// raw: {
|
|
38746
|
+
// ...tag,
|
|
38747
|
+
// },
|
|
38748
|
+
};
|
|
38749
|
+
tags2.push(t);
|
|
38750
|
+
return tags2;
|
|
38751
|
+
};
|
|
38636
38752
|
for (const b of bitConfigs) {
|
|
38637
|
-
const inherits = [];
|
|
38638
38753
|
const tags2 = [];
|
|
38639
38754
|
const tagEntriesTypeOrder = [
|
|
38640
38755
|
BitTagConfigKeyType.tag,
|
|
@@ -38651,103 +38766,8 @@ var ConfigBuilder = class {
|
|
|
38651
38766
|
const typeOrder = tagEntriesTypeOrder.indexOf(typeA) - tagEntriesTypeOrder.indexOf(typeB);
|
|
38652
38767
|
return typeOrder;
|
|
38653
38768
|
});
|
|
38654
|
-
for (const [
|
|
38655
|
-
|
|
38656
|
-
let tagKeyPrefix = "";
|
|
38657
|
-
let format = "";
|
|
38658
|
-
let description = "";
|
|
38659
|
-
let chain = void 0;
|
|
38660
|
-
if (tag.type === BitTagConfigKeyType.tag) {
|
|
38661
|
-
tagName = tag.tag;
|
|
38662
|
-
if (tagName === "%") {
|
|
38663
|
-
description = "Item";
|
|
38664
|
-
chain = {
|
|
38665
|
-
key: "%",
|
|
38666
|
-
format,
|
|
38667
|
-
min: tag.minCount,
|
|
38668
|
-
max: tag.maxCount,
|
|
38669
|
-
description: "Lead",
|
|
38670
|
-
chain: {
|
|
38671
|
-
key: "%",
|
|
38672
|
-
format,
|
|
38673
|
-
min: tag.minCount,
|
|
38674
|
-
max: tag.maxCount,
|
|
38675
|
-
description: "Page number",
|
|
38676
|
-
chain: {
|
|
38677
|
-
key: "%",
|
|
38678
|
-
format,
|
|
38679
|
-
min: tag.minCount,
|
|
38680
|
-
max: tag.maxCount,
|
|
38681
|
-
description: "Margin number"
|
|
38682
|
-
}
|
|
38683
|
-
}
|
|
38684
|
-
};
|
|
38685
|
-
} else if (tagName === "!") {
|
|
38686
|
-
description = "Instruction";
|
|
38687
|
-
} else if (tagName === "?") {
|
|
38688
|
-
description = "Hint";
|
|
38689
|
-
} else if (tagName === "#") {
|
|
38690
|
-
description = "Title";
|
|
38691
|
-
} else if (tagName === "##") {
|
|
38692
|
-
description = "Sub-title";
|
|
38693
|
-
} else if (tagName === "\u25BC") {
|
|
38694
|
-
description = "Anchor";
|
|
38695
|
-
} else if (tagName === "\u25BA") {
|
|
38696
|
-
description = "Reference";
|
|
38697
|
-
} else if (tagName === "$") {
|
|
38698
|
-
description = "Sample solution";
|
|
38699
|
-
} else if (tagName === "&") {
|
|
38700
|
-
description = "Resource";
|
|
38701
|
-
} else if (tagName === "+") {
|
|
38702
|
-
description = "True statement";
|
|
38703
|
-
} else if (tagName === "-") {
|
|
38704
|
-
description = "False statement";
|
|
38705
|
-
} else if (tagName === "_") {
|
|
38706
|
-
description = "Gap";
|
|
38707
|
-
} else if (tagName === "=") {
|
|
38708
|
-
description = "Mark";
|
|
38709
|
-
}
|
|
38710
|
-
format = "bitmark--";
|
|
38711
|
-
} else if (tag.type === BitTagConfigKeyType.property) {
|
|
38712
|
-
tagName = tag.tag;
|
|
38713
|
-
tagKeyPrefix = "@";
|
|
38714
|
-
const property = tag;
|
|
38715
|
-
if (property.format === TagFormat.plainText) {
|
|
38716
|
-
format = "string";
|
|
38717
|
-
} else if (property.format === TagFormat.boolean) {
|
|
38718
|
-
format = "bool";
|
|
38719
|
-
} else if (property.format === TagFormat.bitmarkText) {
|
|
38720
|
-
format = "bitmark";
|
|
38721
|
-
} else if (property.format === TagFormat.number) {
|
|
38722
|
-
format = "number";
|
|
38723
|
-
}
|
|
38724
|
-
} else if (tag.type === BitTagConfigKeyType.resource) {
|
|
38725
|
-
tagKeyPrefix = "&";
|
|
38726
|
-
} else if (tag.type === BitTagConfigKeyType.group) {
|
|
38727
|
-
tagKeyPrefix = "@";
|
|
38728
|
-
let k = tag.configKey;
|
|
38729
|
-
if (k.startsWith("group_")) k = k.substring(6);
|
|
38730
|
-
k = "_" + k;
|
|
38731
|
-
inherits.push({
|
|
38732
|
-
type: "group",
|
|
38733
|
-
name: k
|
|
38734
|
-
});
|
|
38735
|
-
continue;
|
|
38736
|
-
}
|
|
38737
|
-
const t = {
|
|
38738
|
-
key: tagKeyPrefix + tagName,
|
|
38739
|
-
format,
|
|
38740
|
-
default: null,
|
|
38741
|
-
alwaysInclude: false,
|
|
38742
|
-
min: tag.minCount == null ? 0 : tag.minCount,
|
|
38743
|
-
max: tag.maxCount == null ? 1 : tag.maxCount,
|
|
38744
|
-
description,
|
|
38745
|
-
chain
|
|
38746
|
-
// raw: {
|
|
38747
|
-
// ...tag,
|
|
38748
|
-
// },
|
|
38749
|
-
};
|
|
38750
|
-
tags2.push(t);
|
|
38769
|
+
for (const [_tagKey, tag] of tagEntries) {
|
|
38770
|
+
tags2.push(...processTagEntries(tag));
|
|
38751
38771
|
}
|
|
38752
38772
|
const bitJson = {
|
|
38753
38773
|
name: b.bitType,
|