@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.
package/dist/index.cjs CHANGED
@@ -2524,27 +2524,6 @@ var CARDSETS = {
2524
2524
  ]
2525
2525
  },
2526
2526
  [CardSetConfigKey.table]: {
2527
- variants: [
2528
- // Side 1
2529
- [
2530
- // Variant 1..N
2531
- {
2532
- tags: [
2533
- {
2534
- key: ConfigKey.group_standardItemLeadInstructionHint,
2535
- description: "Standard tags for lead, instruction, and hint."
2536
- },
2537
- {
2538
- key: ConfigKey.tag_title,
2539
- description: "Title of the table."
2540
- }
2541
- ],
2542
- repeatCount: Count.infinity
2543
- }
2544
- ]
2545
- ]
2546
- },
2547
- [CardSetConfigKey.tableExtended]: {
2548
2527
  variants: [
2549
2528
  // Side 1
2550
2529
  [
@@ -7910,15 +7889,35 @@ var BITS = {
7910
7889
  },
7911
7890
  [BitType.tableImage]: {
7912
7891
  since: "1.5.15",
7913
- baseBitType: BitType.image,
7892
+ baseBitType: BitType.table,
7914
7893
  description: "Table image bit, used to create images in tables in articles or books",
7915
7894
  tags: [
7916
7895
  {
7917
7896
  key: ConfigKey.property_caption,
7918
7897
  description: "Caption for the table image, used to provide a description for the image",
7919
7898
  format: TagFormat.bitmarkText
7899
+ },
7900
+ {
7901
+ key: ConfigKey.resource_backgroundWallpaper,
7902
+ description: "Background wallpaper for the image, used to set a background for the image",
7903
+ chain: [
7904
+ {
7905
+ key: ConfigKey.group_resourceImageCommon,
7906
+ description: "Common resource image tags for images"
7907
+ }
7908
+ ]
7909
+ },
7910
+ {
7911
+ key: ConfigKey.group_resourceBitTags,
7912
+ description: "Resource bit tags for images, used to define additional properties for images"
7913
+ },
7914
+ {
7915
+ key: ConfigKey.group_resourceImage,
7916
+ description: "Resource image tags for images, used to attach images to the bit",
7917
+ minCount: 1
7920
7918
  }
7921
- ]
7919
+ ],
7920
+ resourceAttachmentAllowed: false
7922
7921
  },
7923
7922
  [BitType.tableImageAlt]: {
7924
7923
  since: "1.16.0",
@@ -9438,8 +9437,7 @@ var BITS = {
9438
9437
  [BitType.tableExtended]: {
9439
9438
  since: "4.14.0",
9440
9439
  baseBitType: BitType.table,
9441
- description: "Extended table bit, used to create complex tables with all HTML table features",
9442
- cardSet: CardSetConfigKey.tableExtended
9440
+ description: "Extended table bit, used to create complex tables with all HTML table features"
9443
9441
  },
9444
9442
  [BitType.tableAlt]: {
9445
9443
  since: "1.16.0",
@@ -10463,7 +10461,7 @@ var instance2 = new Config();
10463
10461
  // src/generated/package_info.ts
10464
10462
  var PACKAGE_INFO = {
10465
10463
  "name": "@gmb/bitmark-parser-generator",
10466
- "version": "5.9.0",
10464
+ "version": "5.9.1",
10467
10465
  "author": "Get More Brain Ltd",
10468
10466
  "license": "ISC",
10469
10467
  "description": "A bitmark parser and generator using Peggy.js"
@@ -12062,7 +12060,7 @@ function normalizeTableFormat(bitType, table) {
12062
12060
  delete t.columns;
12063
12061
  delete t.data;
12064
12062
  }
12065
- const isExtended = instance2.isOfBitType(bitType, BitType.tableExtended);
12063
+ const isExtended = instance2.isOfBitType(bitType, BitType.tableExtended) || instance2.isOfBitType(bitType, BitType.tableImage);
12066
12064
  if (isExtended && isTableBasicFormat(table)) {
12067
12065
  return convertBasicToExtendedTableFormat(table);
12068
12066
  }
@@ -30679,7 +30677,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
30679
30677
  if (bitJson.isTracked == null) bitJson.isTracked = true;
30680
30678
  if (bitJson.isInfoOnly == null) bitJson.isInfoOnly = false;
30681
30679
  }
30682
- if (instance2.isOfBitType(bitType, BitType.table)) {
30680
+ if (instance2.isOfBitType(bitType, BitType.table) && !instance2.isOfBitType(bitType, BitType.tableImage)) {
30683
30681
  if (bitJson.tableFixedHeader == null) bitJson.tableFixedHeader = false;
30684
30682
  if (bitJson.tableHeaderWhitespaceNoWrap == null) {
30685
30683
  bitJson.tableHeaderWhitespaceNoWrap = false;
@@ -30694,6 +30692,11 @@ var JsonGenerator = class extends AstWalkerGenerator {
30694
30692
  if (bitJson.tableResizableColumns == null) bitJson.tableResizableColumns = false;
30695
30693
  if (bitJson.tableColumnMinWidth == null) bitJson.tableColumnMinWidth = 0;
30696
30694
  }
30695
+ if (instance2.isOfBitType(bitType, BitType.tableImage)) {
30696
+ if (this.tableIsEmpty(bitJson.table)) {
30697
+ delete bitJson.table;
30698
+ }
30699
+ }
30697
30700
  if (instance2.isOfBitType(bitType, BitType.bookReference)) {
30698
30701
  if (bitJson.refAuthor == null) bitJson.refAuthor = [];
30699
30702
  if (bitJson.refBookTitle == null) bitJson.refBookTitle = "";
@@ -30834,6 +30837,19 @@ var JsonGenerator = class extends AstWalkerGenerator {
30834
30837
  }
30835
30838
  return bitJson;
30836
30839
  }
30840
+ tableIsEmpty(table) {
30841
+ if (!table) return true;
30842
+ if (Object.keys(table).length === 0) return true;
30843
+ const tableStandard = table;
30844
+ if (tableStandard.columns?.length === 0 && tableStandard.data?.length) {
30845
+ return true;
30846
+ }
30847
+ const tableExtended = table;
30848
+ if (tableExtended.header?.rows.length === 0 && tableExtended.body?.rows.length === 0 && tableExtended.footer?.rows.length === 0) {
30849
+ return true;
30850
+ }
30851
+ return false;
30852
+ }
30837
30853
  /**
30838
30854
  * Convert any bitmark texts to strings.
30839
30855
  */