@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/cli/main.js CHANGED
@@ -2419,27 +2419,6 @@ var CARDSETS = {
2419
2419
  ]
2420
2420
  },
2421
2421
  [CardSetConfigKey.table]: {
2422
- variants: [
2423
- // Side 1
2424
- [
2425
- // Variant 1..N
2426
- {
2427
- tags: [
2428
- {
2429
- key: ConfigKey.group_standardItemLeadInstructionHint,
2430
- description: "Standard tags for lead, instruction, and hint."
2431
- },
2432
- {
2433
- key: ConfigKey.tag_title,
2434
- description: "Title of the table."
2435
- }
2436
- ],
2437
- repeatCount: Count.infinity
2438
- }
2439
- ]
2440
- ]
2441
- },
2442
- [CardSetConfigKey.tableExtended]: {
2443
2422
  variants: [
2444
2423
  // Side 1
2445
2424
  [
@@ -7805,15 +7784,35 @@ var BITS = {
7805
7784
  },
7806
7785
  [BitType.tableImage]: {
7807
7786
  since: "1.5.15",
7808
- baseBitType: BitType.image,
7787
+ baseBitType: BitType.table,
7809
7788
  description: "Table image bit, used to create images in tables in articles or books",
7810
7789
  tags: [
7811
7790
  {
7812
7791
  key: ConfigKey.property_caption,
7813
7792
  description: "Caption for the table image, used to provide a description for the image",
7814
7793
  format: TagFormat.bitmarkText
7794
+ },
7795
+ {
7796
+ key: ConfigKey.resource_backgroundWallpaper,
7797
+ description: "Background wallpaper for the image, used to set a background for the image",
7798
+ chain: [
7799
+ {
7800
+ key: ConfigKey.group_resourceImageCommon,
7801
+ description: "Common resource image tags for images"
7802
+ }
7803
+ ]
7804
+ },
7805
+ {
7806
+ key: ConfigKey.group_resourceBitTags,
7807
+ description: "Resource bit tags for images, used to define additional properties for images"
7808
+ },
7809
+ {
7810
+ key: ConfigKey.group_resourceImage,
7811
+ description: "Resource image tags for images, used to attach images to the bit",
7812
+ minCount: 1
7815
7813
  }
7816
- ]
7814
+ ],
7815
+ resourceAttachmentAllowed: false
7817
7816
  },
7818
7817
  [BitType.tableImageAlt]: {
7819
7818
  since: "1.16.0",
@@ -9333,8 +9332,7 @@ var BITS = {
9333
9332
  [BitType.tableExtended]: {
9334
9333
  since: "4.14.0",
9335
9334
  baseBitType: BitType.table,
9336
- description: "Extended table bit, used to create complex tables with all HTML table features",
9337
- cardSet: CardSetConfigKey.tableExtended
9335
+ description: "Extended table bit, used to create complex tables with all HTML table features"
9338
9336
  },
9339
9337
  [BitType.tableAlt]: {
9340
9338
  since: "1.16.0",
@@ -10358,7 +10356,7 @@ var instance2 = new Config();
10358
10356
  // src/generated/package_info.ts
10359
10357
  var PACKAGE_INFO = {
10360
10358
  "name": "@gmb/bitmark-parser-generator",
10361
- "version": "5.9.0",
10359
+ "version": "5.9.1",
10362
10360
  "license": "ISC"};
10363
10361
  var Environment = {
10364
10362
  unknown: "",
@@ -11909,7 +11907,7 @@ function normalizeTableFormat(bitType, table) {
11909
11907
  delete t.columns;
11910
11908
  delete t.data;
11911
11909
  }
11912
- const isExtended = instance2.isOfBitType(bitType, BitType.tableExtended);
11910
+ const isExtended = instance2.isOfBitType(bitType, BitType.tableExtended) || instance2.isOfBitType(bitType, BitType.tableImage);
11913
11911
  if (isExtended && isTableBasicFormat(table)) {
11914
11912
  return convertBasicToExtendedTableFormat(table);
11915
11913
  }
@@ -30333,7 +30331,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
30333
30331
  if (bitJson.isTracked == null) bitJson.isTracked = true;
30334
30332
  if (bitJson.isInfoOnly == null) bitJson.isInfoOnly = false;
30335
30333
  }
30336
- if (instance2.isOfBitType(bitType, BitType.table)) {
30334
+ if (instance2.isOfBitType(bitType, BitType.table) && !instance2.isOfBitType(bitType, BitType.tableImage)) {
30337
30335
  if (bitJson.tableFixedHeader == null) bitJson.tableFixedHeader = false;
30338
30336
  if (bitJson.tableHeaderWhitespaceNoWrap == null) {
30339
30337
  bitJson.tableHeaderWhitespaceNoWrap = false;
@@ -30348,6 +30346,11 @@ var JsonGenerator = class extends AstWalkerGenerator {
30348
30346
  if (bitJson.tableResizableColumns == null) bitJson.tableResizableColumns = false;
30349
30347
  if (bitJson.tableColumnMinWidth == null) bitJson.tableColumnMinWidth = 0;
30350
30348
  }
30349
+ if (instance2.isOfBitType(bitType, BitType.tableImage)) {
30350
+ if (this.tableIsEmpty(bitJson.table)) {
30351
+ delete bitJson.table;
30352
+ }
30353
+ }
30351
30354
  if (instance2.isOfBitType(bitType, BitType.bookReference)) {
30352
30355
  if (bitJson.refAuthor == null) bitJson.refAuthor = [];
30353
30356
  if (bitJson.refBookTitle == null) bitJson.refBookTitle = "";
@@ -30488,6 +30491,19 @@ var JsonGenerator = class extends AstWalkerGenerator {
30488
30491
  }
30489
30492
  return bitJson;
30490
30493
  }
30494
+ tableIsEmpty(table) {
30495
+ if (!table) return true;
30496
+ if (Object.keys(table).length === 0) return true;
30497
+ const tableStandard = table;
30498
+ if (tableStandard.columns?.length === 0 && tableStandard.data?.length) {
30499
+ return true;
30500
+ }
30501
+ const tableExtended = table;
30502
+ if (tableExtended.header?.rows.length === 0 && tableExtended.body?.rows.length === 0 && tableExtended.footer?.rows.length === 0) {
30503
+ return true;
30504
+ }
30505
+ return false;
30506
+ }
30491
30507
  /**
30492
30508
  * Convert any bitmark texts to strings.
30493
30509
  */