@gmb/bitmark-parser-generator 5.9.0 → 5.9.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.
@@ -6059,6 +6059,7 @@ declare class JsonGenerator extends AstWalkerGenerator<BitmarkAst, void> {
6059
6059
  * @returns
6060
6060
  */
6061
6061
  protected cleanBitJson(bitJson: Partial<BitJson>): Partial<BitJson>;
6062
+ protected tableIsEmpty(table: TableJson | TableExtendedJson | undefined): boolean;
6062
6063
  /**
6063
6064
  * Convert any bitmark texts to strings.
6064
6065
  */
@@ -6059,6 +6059,7 @@ declare class JsonGenerator extends AstWalkerGenerator<BitmarkAst, void> {
6059
6059
  * @returns
6060
6060
  */
6061
6061
  protected cleanBitJson(bitJson: Partial<BitJson>): Partial<BitJson>;
6062
+ protected tableIsEmpty(table: TableJson | TableExtendedJson | undefined): boolean;
6062
6063
  /**
6063
6064
  * Convert any bitmark texts to strings.
6064
6065
  */
@@ -2463,27 +2463,6 @@ var CARDSETS = {
2463
2463
  ]
2464
2464
  },
2465
2465
  [CardSetConfigKey.table]: {
2466
- variants: [
2467
- // Side 1
2468
- [
2469
- // Variant 1..N
2470
- {
2471
- tags: [
2472
- {
2473
- key: ConfigKey.group_standardItemLeadInstructionHint,
2474
- description: "Standard tags for lead, instruction, and hint."
2475
- },
2476
- {
2477
- key: ConfigKey.tag_title,
2478
- description: "Title of the table."
2479
- }
2480
- ],
2481
- repeatCount: Count.infinity
2482
- }
2483
- ]
2484
- ]
2485
- },
2486
- [CardSetConfigKey.tableExtended]: {
2487
2466
  variants: [
2488
2467
  // Side 1
2489
2468
  [
@@ -7849,15 +7828,35 @@ var BITS = {
7849
7828
  },
7850
7829
  [BitType.tableImage]: {
7851
7830
  since: "1.5.15",
7852
- baseBitType: BitType.image,
7831
+ baseBitType: BitType.table,
7853
7832
  description: "Table image bit, used to create images in tables in articles or books",
7854
7833
  tags: [
7855
7834
  {
7856
7835
  key: ConfigKey.property_caption,
7857
7836
  description: "Caption for the table image, used to provide a description for the image",
7858
7837
  format: TagFormat.bitmarkText
7838
+ },
7839
+ {
7840
+ key: ConfigKey.resource_backgroundWallpaper,
7841
+ description: "Background wallpaper for the image, used to set a background for the image",
7842
+ chain: [
7843
+ {
7844
+ key: ConfigKey.group_resourceImageCommon,
7845
+ description: "Common resource image tags for images"
7846
+ }
7847
+ ]
7848
+ },
7849
+ {
7850
+ key: ConfigKey.group_resourceBitTags,
7851
+ description: "Resource bit tags for images, used to define additional properties for images"
7852
+ },
7853
+ {
7854
+ key: ConfigKey.group_resourceImage,
7855
+ description: "Resource image tags for images, used to attach images to the bit",
7856
+ minCount: 1
7859
7857
  }
7860
- ]
7858
+ ],
7859
+ resourceAttachmentAllowed: false
7861
7860
  },
7862
7861
  [BitType.tableImageAlt]: {
7863
7862
  since: "1.16.0",
@@ -9377,8 +9376,7 @@ var BITS = {
9377
9376
  [BitType.tableExtended]: {
9378
9377
  since: "4.14.0",
9379
9378
  baseBitType: BitType.table,
9380
- description: "Extended table bit, used to create complex tables with all HTML table features",
9381
- cardSet: CardSetConfigKey.tableExtended
9379
+ description: "Extended table bit, used to create complex tables with all HTML table features"
9382
9380
  },
9383
9381
  [BitType.tableAlt]: {
9384
9382
  since: "1.16.0",
@@ -10402,7 +10400,7 @@ var instance2 = new Config();
10402
10400
  // src/generated/package_info.ts
10403
10401
  var PACKAGE_INFO = {
10404
10402
  "name": "@gmb/bitmark-parser-generator",
10405
- "version": "5.9.0",
10403
+ "version": "5.9.1",
10406
10404
  "author": "Get More Brain Ltd",
10407
10405
  "license": "ISC",
10408
10406
  "description": "A bitmark parser and generator using Peggy.js"
@@ -12001,7 +11999,7 @@ function normalizeTableFormat(bitType, table) {
12001
11999
  delete t.columns;
12002
12000
  delete t.data;
12003
12001
  }
12004
- const isExtended = instance2.isOfBitType(bitType, BitType.tableExtended);
12002
+ const isExtended = instance2.isOfBitType(bitType, BitType.tableExtended) || instance2.isOfBitType(bitType, BitType.tableImage);
12005
12003
  if (isExtended && isTableBasicFormat(table)) {
12006
12004
  return convertBasicToExtendedTableFormat(table);
12007
12005
  }
@@ -30618,7 +30616,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
30618
30616
  if (bitJson.isTracked == null) bitJson.isTracked = true;
30619
30617
  if (bitJson.isInfoOnly == null) bitJson.isInfoOnly = false;
30620
30618
  }
30621
- if (instance2.isOfBitType(bitType, BitType.table)) {
30619
+ if (instance2.isOfBitType(bitType, BitType.table) && !instance2.isOfBitType(bitType, BitType.tableImage)) {
30622
30620
  if (bitJson.tableFixedHeader == null) bitJson.tableFixedHeader = false;
30623
30621
  if (bitJson.tableHeaderWhitespaceNoWrap == null) {
30624
30622
  bitJson.tableHeaderWhitespaceNoWrap = false;
@@ -30633,6 +30631,11 @@ var JsonGenerator = class extends AstWalkerGenerator {
30633
30631
  if (bitJson.tableResizableColumns == null) bitJson.tableResizableColumns = false;
30634
30632
  if (bitJson.tableColumnMinWidth == null) bitJson.tableColumnMinWidth = 0;
30635
30633
  }
30634
+ if (instance2.isOfBitType(bitType, BitType.tableImage)) {
30635
+ if (this.tableIsEmpty(bitJson.table)) {
30636
+ delete bitJson.table;
30637
+ }
30638
+ }
30636
30639
  if (instance2.isOfBitType(bitType, BitType.bookReference)) {
30637
30640
  if (bitJson.refAuthor == null) bitJson.refAuthor = [];
30638
30641
  if (bitJson.refBookTitle == null) bitJson.refBookTitle = "";
@@ -30773,6 +30776,19 @@ var JsonGenerator = class extends AstWalkerGenerator {
30773
30776
  }
30774
30777
  return bitJson;
30775
30778
  }
30779
+ tableIsEmpty(table) {
30780
+ if (!table) return true;
30781
+ if (Object.keys(table).length === 0) return true;
30782
+ const tableStandard = table;
30783
+ if (tableStandard.columns?.length === 0 && tableStandard.data?.length) {
30784
+ return true;
30785
+ }
30786
+ const tableExtended = table;
30787
+ if (tableExtended.header?.rows.length === 0 && tableExtended.body?.rows.length === 0 && tableExtended.footer?.rows.length === 0) {
30788
+ return true;
30789
+ }
30790
+ return false;
30791
+ }
30776
30792
  /**
30777
30793
  * Convert any bitmark texts to strings.
30778
30794
  */