@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/index.cjs CHANGED
@@ -108,6 +108,8 @@ var BitType = {
108
108
  appFlashcardsQuiz: "app-flashcards-quiz",
109
109
  appGetScreenshot: "app-get-screenshot",
110
110
  appLink: "app-link",
111
+ appRag: "app-rag",
112
+ appSearch: "app-search",
111
113
  article: "article",
112
114
  articleAi: "article-ai",
113
115
  articleAlt: "article-alt",
@@ -1270,6 +1272,7 @@ var propertyKeys = {
1270
1272
  property_availableClassifications: "@availableClassifications",
1271
1273
  property_brandColor: "@brandColor",
1272
1274
  property_brandColorName: "@brandColorName",
1275
+ property_backgroundImage: "@backgroundImage",
1273
1276
  property_blockId: "@blockId",
1274
1277
  property_book: "@book",
1275
1278
  property_bookAlias: "@bookAlias",
@@ -1566,7 +1569,8 @@ var resourceKeys = {
1566
1569
  resource_imagePlaceholder: "&imagePlaceholder",
1567
1570
  resource_previewImage: "&previewImage",
1568
1571
  resource_previewVideo: "&previewVideo",
1569
- resource_coverImage: "&coverImage"
1572
+ resource_coverImage: "&coverImage",
1573
+ resource_backgroundImage: "&backgroundImage"
1570
1574
  };
1571
1575
 
1572
1576
  // src/model/enum/ResourceType.ts
@@ -1796,7 +1800,8 @@ var ResourceType = {
1796
1800
  platformBackgroundImage: "platformBackgroundImage",
1797
1801
  previewImage: "previewImage",
1798
1802
  previewVideo: "previewVideo",
1799
- coverImage: "coverImage"
1803
+ coverImage: "coverImage",
1804
+ backgroundImage: "backgroundImage"
1800
1805
  };
1801
1806
  function resourceTypeToConfigKey(type) {
1802
1807
  return `&${stringUtils.kebabToCamel(type)}`;
@@ -3838,6 +3843,22 @@ var GROUPS = {
3838
3843
  }
3839
3844
  ]
3840
3845
  },
3846
+ {
3847
+ key: ConfigKey.property_backgroundImage,
3848
+ description: "The background image(s) of the book",
3849
+ format: TagFormat.plainText,
3850
+ maxCount: Count.infinity
3851
+ },
3852
+ {
3853
+ key: ConfigKey.resource_backgroundImage,
3854
+ description: "The background image of the book",
3855
+ chain: [
3856
+ {
3857
+ key: ConfigKey.group_resourceImageCommon,
3858
+ description: "Common image properties for the background image resource"
3859
+ }
3860
+ ]
3861
+ },
3841
3862
  {
3842
3863
  key: ConfigKey.property_coverColor,
3843
3864
  description: "The cover color of the book",
@@ -5059,6 +5080,16 @@ var BITS = {
5059
5080
  ],
5060
5081
  resourceAttachmentAllowed: false
5061
5082
  },
5083
+ [BitType.appRag]: {
5084
+ since: "5.14.0",
5085
+ baseBitType: BitType.article,
5086
+ description: "App RAG (Retrieval-Augmented Generation) bit, equal to article"
5087
+ },
5088
+ [BitType.appSearch]: {
5089
+ since: "5.14.0",
5090
+ baseBitType: BitType.article,
5091
+ description: "App search bit, equal to article"
5092
+ },
5062
5093
  [BitType.author]: {
5063
5094
  since: "4.2.0",
5064
5095
  baseBitType: BitType._standard,
@@ -10950,7 +10981,7 @@ var instance2 = new Config();
10950
10981
  // src/generated/package_info.ts
10951
10982
  var PACKAGE_INFO = {
10952
10983
  "name": "@gmb/bitmark-parser-generator",
10953
- "version": "5.13.0",
10984
+ "version": "5.15.0",
10954
10985
  "author": "Get More Brain Ltd",
10955
10986
  "license": "ISC",
10956
10987
  "description": "A bitmark parser and generator using Peggy.js"
@@ -11340,6 +11371,8 @@ var NodeType = {
11340
11371
  avatarImage: "avatarImage",
11341
11372
  backgroundWallpaper: "backgroundWallpaper",
11342
11373
  backgroundWallpaperValue: "backgroundWallpaperValue",
11374
+ backgroundImage: "backgroundImage",
11375
+ backgroundImageValue: "backgroundImageValue",
11343
11376
  bitLevel: "bitLevel",
11344
11377
  // bit level
11345
11378
  bitmarkAst: "bitmarkAst",
@@ -23644,6 +23677,7 @@ var ResourceBuilder = class extends BaseBuilder {
23644
23677
  case ResourceType.platformBackgroundImage:
23645
23678
  case ResourceType.previewImage:
23646
23679
  case ResourceType.coverImage:
23680
+ case ResourceType.backgroundImage:
23647
23681
  node = this.imageResource(context, finalData, type);
23648
23682
  break;
23649
23683
  // case ResourceType.imageResponsive: {
@@ -24923,6 +24957,12 @@ var Builder = class extends BaseBuilder {
24923
24957
  data.coverColor,
24924
24958
  options
24925
24959
  ),
24960
+ backgroundImage: typeof data.backgroundImage === "string" || Array.isArray(data.backgroundImage) ? this.toAstProperty(
24961
+ bitType,
24962
+ ConfigKey.property_backgroundImage,
24963
+ instance4.asArray(data.backgroundImage),
24964
+ options
24965
+ ) : this.toImageResource(context, data.backgroundImage),
24926
24966
  publications: this.toAstProperty(
24927
24967
  bitType,
24928
24968
  ConfigKey.property_publications,
@@ -28996,6 +29036,62 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28996
29036
  ignoreTrue: propertyConfig.defaultValue === "true"
28997
29037
  });
28998
29038
  }
29039
+ // bitmarkAst -> bits -> bitsValue -> backgroundImage (when it's a resource object or property array)
29040
+ enter_backgroundImage(node, route) {
29041
+ const value = node.value;
29042
+ if (value && typeof value === "object" && !Array.isArray(value) && "type" in value) {
29043
+ const resource = value;
29044
+ this.writeNL();
29045
+ this.writePropertyStyleResource(node.key, resource);
29046
+ return true;
29047
+ }
29048
+ if (Array.isArray(value)) {
29049
+ if (value == null) return true;
29050
+ const parent = this.getParentNode(route);
29051
+ if (parent?.key !== NodeType.bitsValue) return true;
29052
+ const bitType = this.getBitType(route);
29053
+ if (!bitType) return true;
29054
+ const config = instance2.getBitConfig(bitType);
29055
+ const propertyConfig = instance2.getTagConfigForTag(
29056
+ config.tags,
29057
+ ConfigKey.property_backgroundImage
29058
+ );
29059
+ if (!propertyConfig) return true;
29060
+ this.writeNL_IfNotChain(route);
29061
+ this.writeProperty(propertyConfig.tag, value, route, {
29062
+ format: propertyConfig.format ?? TagFormat.plainText,
29063
+ array: propertyConfig.array ?? false,
29064
+ writeEmpty: true,
29065
+ ignoreFalse: propertyConfig.defaultValue === "false",
29066
+ ignoreTrue: propertyConfig.defaultValue === "true"
29067
+ });
29068
+ }
29069
+ return true;
29070
+ }
29071
+ // bitmarkAst -> bits -> bitsValue -> backgroundImage (when it's a property string)
29072
+ // This is called when backgroundImage is a simple string value
29073
+ leaf_backgroundImage(node, route) {
29074
+ const value = node.value;
29075
+ if (value == null) return;
29076
+ const parent = this.getParentNode(route);
29077
+ if (parent?.key !== NodeType.bitsValue) return;
29078
+ const bitType = this.getBitType(route);
29079
+ if (!bitType) return;
29080
+ const config = instance2.getBitConfig(bitType);
29081
+ const propertyConfig = instance2.getTagConfigForTag(
29082
+ config.tags,
29083
+ ConfigKey.property_backgroundImage
29084
+ );
29085
+ if (!propertyConfig) return;
29086
+ this.writeNL_IfNotChain(route);
29087
+ this.writeProperty(propertyConfig.tag, node.value, route, {
29088
+ format: propertyConfig.format ?? TagFormat.plainText,
29089
+ array: propertyConfig.array ?? false,
29090
+ writeEmpty: true,
29091
+ ignoreFalse: propertyConfig.defaultValue === "false",
29092
+ ignoreTrue: propertyConfig.defaultValue === "true"
29093
+ });
29094
+ }
28999
29095
  exit_imagePlaceholder(_node, _route) {
29000
29096
  }
29001
29097
  // bitmarkAst -> bits -> bitsValue -> posterImage
@@ -30609,6 +30705,12 @@ var JsonGenerator = class extends AstWalkerGenerator {
30609
30705
  array: Array.isArray(node.value)
30610
30706
  });
30611
30707
  }
30708
+ // bitmarkAst -> bits -> bitsValue -> backgroundImage
30709
+ enter_backgroundImage(node, route) {
30710
+ return this.standardHandler(node, route, NodeType.bitsValue, {
30711
+ array: Array.isArray(node.value)
30712
+ });
30713
+ }
30612
30714
  // bitmarkAst -> bits -> bitsValue -> resources
30613
30715
  enter_resources(node, route) {
30614
30716
  const resources = node.value;
@@ -35077,7 +35179,7 @@ function resourceContentProcessor(context, _contentDepth, tagsConfig, content, t
35077
35179
  ...tags2
35078
35180
  });
35079
35181
  if (resource) {
35080
- 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) {
35182
+ 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) {
35081
35183
  if (target.propertyStyleResources) {
35082
35184
  if (target.propertyStyleResources[resourceType]) {
35083
35185
  if (!Array.isArray(target.propertyStyleResources[resourceType])) {