@gmb/bitmark-parser-generator 5.13.0 → 5.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/main.js CHANGED
@@ -47,6 +47,8 @@ var BitType = {
47
47
  appFlashcardsQuiz: "app-flashcards-quiz",
48
48
  appGetScreenshot: "app-get-screenshot",
49
49
  appLink: "app-link",
50
+ appRag: "app-rag",
51
+ appSearch: "app-search",
50
52
  article: "article",
51
53
  articleAi: "article-ai",
52
54
  articleAlt: "article-alt",
@@ -1174,6 +1176,7 @@ var propertyKeys = {
1174
1176
  property_availableClassifications: "@availableClassifications",
1175
1177
  property_brandColor: "@brandColor",
1176
1178
  property_brandColorName: "@brandColorName",
1179
+ property_backgroundImage: "@backgroundImage",
1177
1180
  property_blockId: "@blockId",
1178
1181
  property_book: "@book",
1179
1182
  property_bookAlias: "@bookAlias",
@@ -1467,7 +1470,8 @@ var resourceKeys = {
1467
1470
  resource_imagePlaceholder: "&imagePlaceholder",
1468
1471
  resource_previewImage: "&previewImage",
1469
1472
  resource_previewVideo: "&previewVideo",
1470
- resource_coverImage: "&coverImage"
1473
+ resource_coverImage: "&coverImage",
1474
+ resource_backgroundImage: "&backgroundImage"
1471
1475
  };
1472
1476
 
1473
1477
  // src/utils/StringUtils.ts
@@ -1694,7 +1698,8 @@ var ResourceType = {
1694
1698
  platformBackgroundImage: "platformBackgroundImage",
1695
1699
  previewImage: "previewImage",
1696
1700
  previewVideo: "previewVideo",
1697
- coverImage: "coverImage"
1701
+ coverImage: "coverImage",
1702
+ backgroundImage: "backgroundImage"
1698
1703
  };
1699
1704
  function resourceTypeToConfigKey(type) {
1700
1705
  return `&${stringUtils.kebabToCamel(type)}`;
@@ -3733,6 +3738,22 @@ var GROUPS = {
3733
3738
  }
3734
3739
  ]
3735
3740
  },
3741
+ {
3742
+ key: ConfigKey.property_backgroundImage,
3743
+ description: "The background image(s) of the book",
3744
+ format: TagFormat.plainText,
3745
+ maxCount: Count.infinity
3746
+ },
3747
+ {
3748
+ key: ConfigKey.resource_backgroundImage,
3749
+ description: "The background image of the book",
3750
+ chain: [
3751
+ {
3752
+ key: ConfigKey.group_resourceImageCommon,
3753
+ description: "Common image properties for the background image resource"
3754
+ }
3755
+ ]
3756
+ },
3736
3757
  {
3737
3758
  key: ConfigKey.property_coverColor,
3738
3759
  description: "The cover color of the book",
@@ -4954,6 +4975,16 @@ var BITS = {
4954
4975
  ],
4955
4976
  resourceAttachmentAllowed: false
4956
4977
  },
4978
+ [BitType.appRag]: {
4979
+ since: "5.14.0",
4980
+ baseBitType: BitType.article,
4981
+ description: "App RAG (Retrieval-Augmented Generation) bit, equal to article"
4982
+ },
4983
+ [BitType.appSearch]: {
4984
+ since: "5.14.0",
4985
+ baseBitType: BitType.article,
4986
+ description: "App search bit, equal to article"
4987
+ },
4957
4988
  [BitType.author]: {
4958
4989
  since: "4.2.0",
4959
4990
  baseBitType: BitType._standard,
@@ -10845,7 +10876,7 @@ var instance2 = new Config();
10845
10876
  // src/generated/package_info.ts
10846
10877
  var PACKAGE_INFO = {
10847
10878
  "name": "@gmb/bitmark-parser-generator",
10848
- "version": "5.13.0",
10879
+ "version": "5.15.0",
10849
10880
  "license": "ISC"};
10850
10881
  var Environment = {
10851
10882
  unknown: "",
@@ -11203,6 +11234,8 @@ var NodeType = {
11203
11234
  avatarImage: "avatarImage",
11204
11235
  backgroundWallpaper: "backgroundWallpaper",
11205
11236
  backgroundWallpaperValue: "backgroundWallpaperValue",
11237
+ backgroundImage: "backgroundImage",
11238
+ backgroundImageValue: "backgroundImageValue",
11206
11239
  bitLevel: "bitLevel",
11207
11240
  // bit level
11208
11241
  bitmarkAst: "bitmarkAst",
@@ -23327,6 +23360,7 @@ var ResourceBuilder = class extends BaseBuilder {
23327
23360
  case ResourceType.platformBackgroundImage:
23328
23361
  case ResourceType.previewImage:
23329
23362
  case ResourceType.coverImage:
23363
+ case ResourceType.backgroundImage:
23330
23364
  node = this.imageResource(context, finalData, type);
23331
23365
  break;
23332
23366
  // case ResourceType.imageResponsive: {
@@ -24602,6 +24636,12 @@ var Builder = class extends BaseBuilder {
24602
24636
  data.coverColor,
24603
24637
  options
24604
24638
  ),
24639
+ backgroundImage: typeof data.backgroundImage === "string" || Array.isArray(data.backgroundImage) ? this.toAstProperty(
24640
+ bitType,
24641
+ ConfigKey.property_backgroundImage,
24642
+ instance4.asArray(data.backgroundImage),
24643
+ options
24644
+ ) : this.toImageResource(context, data.backgroundImage),
24605
24645
  publications: this.toAstProperty(
24606
24646
  bitType,
24607
24647
  ConfigKey.property_publications,
@@ -28659,6 +28699,62 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28659
28699
  ignoreTrue: propertyConfig.defaultValue === "true"
28660
28700
  });
28661
28701
  }
28702
+ // bitmarkAst -> bits -> bitsValue -> backgroundImage (when it's a resource object or property array)
28703
+ enter_backgroundImage(node, route) {
28704
+ const value = node.value;
28705
+ if (value && typeof value === "object" && !Array.isArray(value) && "type" in value) {
28706
+ const resource = value;
28707
+ this.writeNL();
28708
+ this.writePropertyStyleResource(node.key, resource);
28709
+ return true;
28710
+ }
28711
+ if (Array.isArray(value)) {
28712
+ if (value == null) return true;
28713
+ const parent = this.getParentNode(route);
28714
+ if (parent?.key !== NodeType.bitsValue) return true;
28715
+ const bitType = this.getBitType(route);
28716
+ if (!bitType) return true;
28717
+ const config = instance2.getBitConfig(bitType);
28718
+ const propertyConfig = instance2.getTagConfigForTag(
28719
+ config.tags,
28720
+ ConfigKey.property_backgroundImage
28721
+ );
28722
+ if (!propertyConfig) return true;
28723
+ this.writeNL_IfNotChain(route);
28724
+ this.writeProperty(propertyConfig.tag, value, route, {
28725
+ format: propertyConfig.format ?? TagFormat.plainText,
28726
+ array: propertyConfig.array ?? false,
28727
+ writeEmpty: true,
28728
+ ignoreFalse: propertyConfig.defaultValue === "false",
28729
+ ignoreTrue: propertyConfig.defaultValue === "true"
28730
+ });
28731
+ }
28732
+ return true;
28733
+ }
28734
+ // bitmarkAst -> bits -> bitsValue -> backgroundImage (when it's a property string)
28735
+ // This is called when backgroundImage is a simple string value
28736
+ leaf_backgroundImage(node, route) {
28737
+ const value = node.value;
28738
+ if (value == null) return;
28739
+ const parent = this.getParentNode(route);
28740
+ if (parent?.key !== NodeType.bitsValue) return;
28741
+ const bitType = this.getBitType(route);
28742
+ if (!bitType) return;
28743
+ const config = instance2.getBitConfig(bitType);
28744
+ const propertyConfig = instance2.getTagConfigForTag(
28745
+ config.tags,
28746
+ ConfigKey.property_backgroundImage
28747
+ );
28748
+ if (!propertyConfig) return;
28749
+ this.writeNL_IfNotChain(route);
28750
+ this.writeProperty(propertyConfig.tag, node.value, route, {
28751
+ format: propertyConfig.format ?? TagFormat.plainText,
28752
+ array: propertyConfig.array ?? false,
28753
+ writeEmpty: true,
28754
+ ignoreFalse: propertyConfig.defaultValue === "false",
28755
+ ignoreTrue: propertyConfig.defaultValue === "true"
28756
+ });
28757
+ }
28662
28758
  exit_imagePlaceholder(_node, _route) {
28663
28759
  }
28664
28760
  // bitmarkAst -> bits -> bitsValue -> posterImage
@@ -30265,6 +30361,12 @@ var JsonGenerator = class extends AstWalkerGenerator {
30265
30361
  array: Array.isArray(node.value)
30266
30362
  });
30267
30363
  }
30364
+ // bitmarkAst -> bits -> bitsValue -> backgroundImage
30365
+ enter_backgroundImage(node, route) {
30366
+ return this.standardHandler(node, route, NodeType.bitsValue, {
30367
+ array: Array.isArray(node.value)
30368
+ });
30369
+ }
30268
30370
  // bitmarkAst -> bits -> bitsValue -> resources
30269
30371
  enter_resources(node, route) {
30270
30372
  const resources = node.value;
@@ -34633,7 +34735,7 @@ function resourceContentProcessor(context, _contentDepth, tagsConfig, content, t
34633
34735
  ...tags2
34634
34736
  });
34635
34737
  if (resource) {
34636
- if (configKey === ConfigKey.resource_backgroundWallpaper || configKey === ConfigKey.resource_imagePlaceholder || configKey === ConfigKey.resource_platformIcon || configKey === ConfigKey.resource_platformLogo || configKey === ConfigKey.resource_platformBackgroundImage || configKey === ConfigKey.resource_previewImage || configKey === ConfigKey.resource_previewVideo || configKey === ConfigKey.resource_coverImage) {
34738
+ if (configKey === ConfigKey.resource_backgroundWallpaper || configKey === ConfigKey.resource_imagePlaceholder || configKey === ConfigKey.resource_platformIcon || configKey === ConfigKey.resource_platformLogo || configKey === ConfigKey.resource_platformBackgroundImage || configKey === ConfigKey.resource_previewImage || configKey === ConfigKey.resource_previewVideo || configKey === ConfigKey.resource_coverImage || configKey === ConfigKey.resource_backgroundImage) {
34637
34739
  if (target.propertyStyleResources) {
34638
34740
  if (target.propertyStyleResources[resourceType]) {
34639
34741
  if (!Array.isArray(target.propertyStyleResources[resourceType])) {