@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.
@@ -38,6 +38,8 @@ declare const BitType: {
38
38
  readonly appFlashcardsQuiz: "app-flashcards-quiz";
39
39
  readonly appGetScreenshot: "app-get-screenshot";
40
40
  readonly appLink: "app-link";
41
+ readonly appRag: "app-rag";
42
+ readonly appSearch: "app-search";
41
43
  readonly article: "article";
42
44
  readonly articleAi: "article-ai";
43
45
  readonly articleAlt: "article-alt";
@@ -735,6 +737,7 @@ declare const ConfigKey: {
735
737
  readonly property_availableClassifications: "@availableClassifications";
736
738
  readonly property_brandColor: "@brandColor";
737
739
  readonly property_brandColorName: "@brandColorName";
740
+ readonly property_backgroundImage: "@backgroundImage";
738
741
  readonly property_blockId: "@blockId";
739
742
  readonly property_book: "@book";
740
743
  readonly property_bookAlias: "@bookAlias";
@@ -1025,6 +1028,7 @@ declare const ConfigKey: {
1025
1028
  readonly resource_previewImage: "&previewImage";
1026
1029
  readonly resource_previewVideo: "&previewVideo";
1027
1030
  readonly resource_coverImage: "&coverImage";
1031
+ readonly resource_backgroundImage: "&backgroundImage";
1028
1032
  readonly tag_title: "#";
1029
1033
  readonly tag_anchor: "▼";
1030
1034
  readonly tag_reference: "►";
@@ -1077,6 +1081,7 @@ declare const ResourceType: {
1077
1081
  readonly previewImage: "previewImage";
1078
1082
  readonly previewVideo: "previewVideo";
1079
1083
  readonly coverImage: "coverImage";
1084
+ readonly backgroundImage: "backgroundImage";
1080
1085
  };
1081
1086
  type ResourceTypeType = EnumType<typeof ResourceType>;
1082
1087
 
@@ -1686,6 +1691,7 @@ interface BitJson {
1686
1691
  bookDiff: string;
1687
1692
  coverImage: string | string[];
1688
1693
  coverColor: string;
1694
+ backgroundImage: string | string[];
1689
1695
  publisher: string | string[];
1690
1696
  publisherName: string;
1691
1697
  publications: string | string[];
@@ -2298,6 +2304,7 @@ interface Bit {
2298
2304
  bookDiff?: Property;
2299
2305
  coverImage?: Property | ImageResourceWrapperJson;
2300
2306
  coverColor?: Property;
2307
+ backgroundImage?: Property | ImageResourceWrapperJson;
2301
2308
  publications?: Property;
2302
2309
  relatedBook?: Property;
2303
2310
  translationOfBook?: Property;
@@ -2617,6 +2624,8 @@ declare const NodeType: {
2617
2624
  readonly avatarImage: "avatarImage";
2618
2625
  readonly backgroundWallpaper: "backgroundWallpaper";
2619
2626
  readonly backgroundWallpaperValue: "backgroundWallpaperValue";
2627
+ readonly backgroundImage: "backgroundImage";
2628
+ readonly backgroundImageValue: "backgroundImageValue";
2620
2629
  readonly bitLevel: "bitLevel";
2621
2630
  readonly bitmarkAst: "bitmarkAst";
2622
2631
  readonly bitmarkVersion: "bitmarkVersion";
@@ -4163,6 +4172,7 @@ declare class Builder extends BaseBuilder {
4163
4172
  bookDiff?: string;
4164
4173
  coverImage?: string | string[] | Partial<ImageResourceWrapperJson>;
4165
4174
  coverColor?: string;
4175
+ backgroundImage?: string | string[] | Partial<ImageResourceWrapperJson>;
4166
4176
  publications?: string | string[];
4167
4177
  relatedBook?: string | string[];
4168
4178
  translationOfBook?: string;
@@ -5589,6 +5599,8 @@ declare class BitmarkGenerator extends AstWalkerGenerator<BitmarkAst, void> {
5589
5599
  protected enter_platformBackgroundImage(node: NodeInfo, _route: NodeInfo[]): boolean;
5590
5600
  protected enter_coverImage(node: NodeInfo, route: NodeInfo[]): boolean;
5591
5601
  protected leaf_coverImage(node: NodeInfo, route: NodeInfo[]): void;
5602
+ protected enter_backgroundImage(node: NodeInfo, route: NodeInfo[]): boolean;
5603
+ protected leaf_backgroundImage(node: NodeInfo, route: NodeInfo[]): void;
5592
5604
  protected exit_imagePlaceholder(_node: NodeInfo, _route: NodeInfo[]): void;
5593
5605
  protected enter_posterImage(node: NodeInfo, route: NodeInfo[]): boolean;
5594
5606
  protected enter_thumbnails(node: NodeInfo, route: NodeInfo[]): boolean;
@@ -5971,6 +5983,7 @@ declare class JsonGenerator extends AstWalkerGenerator<BitmarkAst, void> {
5971
5983
  protected enter_platformLogo(node: NodeInfo, route: NodeInfo[]): boolean;
5972
5984
  protected enter_platformBackgroundImage(node: NodeInfo, route: NodeInfo[]): boolean;
5973
5985
  protected enter_coverImage(node: NodeInfo, route: NodeInfo[]): boolean;
5986
+ protected enter_backgroundImage(node: NodeInfo, route: NodeInfo[]): boolean;
5974
5987
  protected enter_resources(node: NodeInfo, route: NodeInfo[]): boolean;
5975
5988
  protected leaf_level(node: NodeInfo, route: NodeInfo[]): boolean;
5976
5989
  protected enter_book(node: NodeInfo, route: NodeInfo[]): boolean;
@@ -38,6 +38,8 @@ declare const BitType: {
38
38
  readonly appFlashcardsQuiz: "app-flashcards-quiz";
39
39
  readonly appGetScreenshot: "app-get-screenshot";
40
40
  readonly appLink: "app-link";
41
+ readonly appRag: "app-rag";
42
+ readonly appSearch: "app-search";
41
43
  readonly article: "article";
42
44
  readonly articleAi: "article-ai";
43
45
  readonly articleAlt: "article-alt";
@@ -735,6 +737,7 @@ declare const ConfigKey: {
735
737
  readonly property_availableClassifications: "@availableClassifications";
736
738
  readonly property_brandColor: "@brandColor";
737
739
  readonly property_brandColorName: "@brandColorName";
740
+ readonly property_backgroundImage: "@backgroundImage";
738
741
  readonly property_blockId: "@blockId";
739
742
  readonly property_book: "@book";
740
743
  readonly property_bookAlias: "@bookAlias";
@@ -1025,6 +1028,7 @@ declare const ConfigKey: {
1025
1028
  readonly resource_previewImage: "&previewImage";
1026
1029
  readonly resource_previewVideo: "&previewVideo";
1027
1030
  readonly resource_coverImage: "&coverImage";
1031
+ readonly resource_backgroundImage: "&backgroundImage";
1028
1032
  readonly tag_title: "#";
1029
1033
  readonly tag_anchor: "▼";
1030
1034
  readonly tag_reference: "►";
@@ -1077,6 +1081,7 @@ declare const ResourceType: {
1077
1081
  readonly previewImage: "previewImage";
1078
1082
  readonly previewVideo: "previewVideo";
1079
1083
  readonly coverImage: "coverImage";
1084
+ readonly backgroundImage: "backgroundImage";
1080
1085
  };
1081
1086
  type ResourceTypeType = EnumType<typeof ResourceType>;
1082
1087
 
@@ -1686,6 +1691,7 @@ interface BitJson {
1686
1691
  bookDiff: string;
1687
1692
  coverImage: string | string[];
1688
1693
  coverColor: string;
1694
+ backgroundImage: string | string[];
1689
1695
  publisher: string | string[];
1690
1696
  publisherName: string;
1691
1697
  publications: string | string[];
@@ -2298,6 +2304,7 @@ interface Bit {
2298
2304
  bookDiff?: Property;
2299
2305
  coverImage?: Property | ImageResourceWrapperJson;
2300
2306
  coverColor?: Property;
2307
+ backgroundImage?: Property | ImageResourceWrapperJson;
2301
2308
  publications?: Property;
2302
2309
  relatedBook?: Property;
2303
2310
  translationOfBook?: Property;
@@ -2617,6 +2624,8 @@ declare const NodeType: {
2617
2624
  readonly avatarImage: "avatarImage";
2618
2625
  readonly backgroundWallpaper: "backgroundWallpaper";
2619
2626
  readonly backgroundWallpaperValue: "backgroundWallpaperValue";
2627
+ readonly backgroundImage: "backgroundImage";
2628
+ readonly backgroundImageValue: "backgroundImageValue";
2620
2629
  readonly bitLevel: "bitLevel";
2621
2630
  readonly bitmarkAst: "bitmarkAst";
2622
2631
  readonly bitmarkVersion: "bitmarkVersion";
@@ -4163,6 +4172,7 @@ declare class Builder extends BaseBuilder {
4163
4172
  bookDiff?: string;
4164
4173
  coverImage?: string | string[] | Partial<ImageResourceWrapperJson>;
4165
4174
  coverColor?: string;
4175
+ backgroundImage?: string | string[] | Partial<ImageResourceWrapperJson>;
4166
4176
  publications?: string | string[];
4167
4177
  relatedBook?: string | string[];
4168
4178
  translationOfBook?: string;
@@ -5589,6 +5599,8 @@ declare class BitmarkGenerator extends AstWalkerGenerator<BitmarkAst, void> {
5589
5599
  protected enter_platformBackgroundImage(node: NodeInfo, _route: NodeInfo[]): boolean;
5590
5600
  protected enter_coverImage(node: NodeInfo, route: NodeInfo[]): boolean;
5591
5601
  protected leaf_coverImage(node: NodeInfo, route: NodeInfo[]): void;
5602
+ protected enter_backgroundImage(node: NodeInfo, route: NodeInfo[]): boolean;
5603
+ protected leaf_backgroundImage(node: NodeInfo, route: NodeInfo[]): void;
5592
5604
  protected exit_imagePlaceholder(_node: NodeInfo, _route: NodeInfo[]): void;
5593
5605
  protected enter_posterImage(node: NodeInfo, route: NodeInfo[]): boolean;
5594
5606
  protected enter_thumbnails(node: NodeInfo, route: NodeInfo[]): boolean;
@@ -5971,6 +5983,7 @@ declare class JsonGenerator extends AstWalkerGenerator<BitmarkAst, void> {
5971
5983
  protected enter_platformLogo(node: NodeInfo, route: NodeInfo[]): boolean;
5972
5984
  protected enter_platformBackgroundImage(node: NodeInfo, route: NodeInfo[]): boolean;
5973
5985
  protected enter_coverImage(node: NodeInfo, route: NodeInfo[]): boolean;
5986
+ protected enter_backgroundImage(node: NodeInfo, route: NodeInfo[]): boolean;
5974
5987
  protected enter_resources(node: NodeInfo, route: NodeInfo[]): boolean;
5975
5988
  protected leaf_level(node: NodeInfo, route: NodeInfo[]): boolean;
5976
5989
  protected enter_book(node: NodeInfo, route: NodeInfo[]): boolean;
@@ -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",
@@ -1209,6 +1211,7 @@ var propertyKeys = {
1209
1211
  property_availableClassifications: "@availableClassifications",
1210
1212
  property_brandColor: "@brandColor",
1211
1213
  property_brandColorName: "@brandColorName",
1214
+ property_backgroundImage: "@backgroundImage",
1212
1215
  property_blockId: "@blockId",
1213
1216
  property_book: "@book",
1214
1217
  property_bookAlias: "@bookAlias",
@@ -1505,7 +1508,8 @@ var resourceKeys = {
1505
1508
  resource_imagePlaceholder: "&imagePlaceholder",
1506
1509
  resource_previewImage: "&previewImage",
1507
1510
  resource_previewVideo: "&previewVideo",
1508
- resource_coverImage: "&coverImage"
1511
+ resource_coverImage: "&coverImage",
1512
+ resource_backgroundImage: "&backgroundImage"
1509
1513
  };
1510
1514
 
1511
1515
  // src/model/enum/ResourceType.ts
@@ -1735,7 +1739,8 @@ var ResourceType = {
1735
1739
  platformBackgroundImage: "platformBackgroundImage",
1736
1740
  previewImage: "previewImage",
1737
1741
  previewVideo: "previewVideo",
1738
- coverImage: "coverImage"
1742
+ coverImage: "coverImage",
1743
+ backgroundImage: "backgroundImage"
1739
1744
  };
1740
1745
  function resourceTypeToConfigKey(type) {
1741
1746
  return `&${stringUtils.kebabToCamel(type)}`;
@@ -3777,6 +3782,22 @@ var GROUPS = {
3777
3782
  }
3778
3783
  ]
3779
3784
  },
3785
+ {
3786
+ key: ConfigKey.property_backgroundImage,
3787
+ description: "The background image(s) of the book",
3788
+ format: TagFormat.plainText,
3789
+ maxCount: Count.infinity
3790
+ },
3791
+ {
3792
+ key: ConfigKey.resource_backgroundImage,
3793
+ description: "The background image of the book",
3794
+ chain: [
3795
+ {
3796
+ key: ConfigKey.group_resourceImageCommon,
3797
+ description: "Common image properties for the background image resource"
3798
+ }
3799
+ ]
3800
+ },
3780
3801
  {
3781
3802
  key: ConfigKey.property_coverColor,
3782
3803
  description: "The cover color of the book",
@@ -4998,6 +5019,16 @@ var BITS = {
4998
5019
  ],
4999
5020
  resourceAttachmentAllowed: false
5000
5021
  },
5022
+ [BitType.appRag]: {
5023
+ since: "5.14.0",
5024
+ baseBitType: BitType.article,
5025
+ description: "App RAG (Retrieval-Augmented Generation) bit, equal to article"
5026
+ },
5027
+ [BitType.appSearch]: {
5028
+ since: "5.14.0",
5029
+ baseBitType: BitType.article,
5030
+ description: "App search bit, equal to article"
5031
+ },
5001
5032
  [BitType.author]: {
5002
5033
  since: "4.2.0",
5003
5034
  baseBitType: BitType._standard,
@@ -10889,7 +10920,7 @@ var instance2 = new Config();
10889
10920
  // src/generated/package_info.ts
10890
10921
  var PACKAGE_INFO = {
10891
10922
  "name": "@gmb/bitmark-parser-generator",
10892
- "version": "5.13.0",
10923
+ "version": "5.15.0",
10893
10924
  "author": "Get More Brain Ltd",
10894
10925
  "license": "ISC",
10895
10926
  "description": "A bitmark parser and generator using Peggy.js"
@@ -11279,6 +11310,8 @@ var NodeType = {
11279
11310
  avatarImage: "avatarImage",
11280
11311
  backgroundWallpaper: "backgroundWallpaper",
11281
11312
  backgroundWallpaperValue: "backgroundWallpaperValue",
11313
+ backgroundImage: "backgroundImage",
11314
+ backgroundImageValue: "backgroundImageValue",
11282
11315
  bitLevel: "bitLevel",
11283
11316
  // bit level
11284
11317
  bitmarkAst: "bitmarkAst",
@@ -23583,6 +23616,7 @@ var ResourceBuilder = class extends BaseBuilder {
23583
23616
  case ResourceType.platformBackgroundImage:
23584
23617
  case ResourceType.previewImage:
23585
23618
  case ResourceType.coverImage:
23619
+ case ResourceType.backgroundImage:
23586
23620
  node = this.imageResource(context, finalData, type);
23587
23621
  break;
23588
23622
  // case ResourceType.imageResponsive: {
@@ -24862,6 +24896,12 @@ var Builder = class extends BaseBuilder {
24862
24896
  data.coverColor,
24863
24897
  options
24864
24898
  ),
24899
+ backgroundImage: typeof data.backgroundImage === "string" || Array.isArray(data.backgroundImage) ? this.toAstProperty(
24900
+ bitType,
24901
+ ConfigKey.property_backgroundImage,
24902
+ instance4.asArray(data.backgroundImage),
24903
+ options
24904
+ ) : this.toImageResource(context, data.backgroundImage),
24865
24905
  publications: this.toAstProperty(
24866
24906
  bitType,
24867
24907
  ConfigKey.property_publications,
@@ -28935,6 +28975,62 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28935
28975
  ignoreTrue: propertyConfig.defaultValue === "true"
28936
28976
  });
28937
28977
  }
28978
+ // bitmarkAst -> bits -> bitsValue -> backgroundImage (when it's a resource object or property array)
28979
+ enter_backgroundImage(node, route) {
28980
+ const value = node.value;
28981
+ if (value && typeof value === "object" && !Array.isArray(value) && "type" in value) {
28982
+ const resource = value;
28983
+ this.writeNL();
28984
+ this.writePropertyStyleResource(node.key, resource);
28985
+ return true;
28986
+ }
28987
+ if (Array.isArray(value)) {
28988
+ if (value == null) return true;
28989
+ const parent = this.getParentNode(route);
28990
+ if (parent?.key !== NodeType.bitsValue) return true;
28991
+ const bitType = this.getBitType(route);
28992
+ if (!bitType) return true;
28993
+ const config = instance2.getBitConfig(bitType);
28994
+ const propertyConfig = instance2.getTagConfigForTag(
28995
+ config.tags,
28996
+ ConfigKey.property_backgroundImage
28997
+ );
28998
+ if (!propertyConfig) return true;
28999
+ this.writeNL_IfNotChain(route);
29000
+ this.writeProperty(propertyConfig.tag, value, route, {
29001
+ format: propertyConfig.format ?? TagFormat.plainText,
29002
+ array: propertyConfig.array ?? false,
29003
+ writeEmpty: true,
29004
+ ignoreFalse: propertyConfig.defaultValue === "false",
29005
+ ignoreTrue: propertyConfig.defaultValue === "true"
29006
+ });
29007
+ }
29008
+ return true;
29009
+ }
29010
+ // bitmarkAst -> bits -> bitsValue -> backgroundImage (when it's a property string)
29011
+ // This is called when backgroundImage is a simple string value
29012
+ leaf_backgroundImage(node, route) {
29013
+ const value = node.value;
29014
+ if (value == null) return;
29015
+ const parent = this.getParentNode(route);
29016
+ if (parent?.key !== NodeType.bitsValue) return;
29017
+ const bitType = this.getBitType(route);
29018
+ if (!bitType) return;
29019
+ const config = instance2.getBitConfig(bitType);
29020
+ const propertyConfig = instance2.getTagConfigForTag(
29021
+ config.tags,
29022
+ ConfigKey.property_backgroundImage
29023
+ );
29024
+ if (!propertyConfig) return;
29025
+ this.writeNL_IfNotChain(route);
29026
+ this.writeProperty(propertyConfig.tag, node.value, route, {
29027
+ format: propertyConfig.format ?? TagFormat.plainText,
29028
+ array: propertyConfig.array ?? false,
29029
+ writeEmpty: true,
29030
+ ignoreFalse: propertyConfig.defaultValue === "false",
29031
+ ignoreTrue: propertyConfig.defaultValue === "true"
29032
+ });
29033
+ }
28938
29034
  exit_imagePlaceholder(_node, _route) {
28939
29035
  }
28940
29036
  // bitmarkAst -> bits -> bitsValue -> posterImage
@@ -30548,6 +30644,12 @@ var JsonGenerator = class extends AstWalkerGenerator {
30548
30644
  array: Array.isArray(node.value)
30549
30645
  });
30550
30646
  }
30647
+ // bitmarkAst -> bits -> bitsValue -> backgroundImage
30648
+ enter_backgroundImage(node, route) {
30649
+ return this.standardHandler(node, route, NodeType.bitsValue, {
30650
+ array: Array.isArray(node.value)
30651
+ });
30652
+ }
30551
30653
  // bitmarkAst -> bits -> bitsValue -> resources
30552
30654
  enter_resources(node, route) {
30553
30655
  const resources = node.value;
@@ -34998,7 +35100,7 @@ function resourceContentProcessor(context, _contentDepth, tagsConfig, content, t
34998
35100
  ...tags2
34999
35101
  });
35000
35102
  if (resource) {
35001
- 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) {
35103
+ 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) {
35002
35104
  if (target.propertyStyleResources) {
35003
35105
  if (target.propertyStyleResources[resourceType]) {
35004
35106
  if (!Array.isArray(target.propertyStyleResources[resourceType])) {