@supernova-studio/client 0.7.0 → 0.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supernova-studio/client",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Supernova Data Models",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -553,6 +553,8 @@ export function serializeAsCustomBlock(block: PageBlockEditorModel, definition:
553
553
  };
554
554
  });
555
555
 
556
+ const columns = block.data.appearance?.numberOfColumns;
557
+
556
558
  return {
557
559
  type: "blockNode",
558
560
  attrs: {
@@ -560,7 +562,8 @@ export function serializeAsCustomBlock(block: PageBlockEditorModel, definition:
560
562
  definitionId: block.data.packageId,
561
563
  variantId: block.data.variantId,
562
564
  items: JSON.stringify(items),
563
- appearance: JSON.stringify(block.data.appearance),
565
+
566
+ ...(columns && { columns: columns }),
564
567
  },
565
568
  };
566
569
  }
@@ -544,8 +544,7 @@ function parseAsCustomBlock(
544
544
  indentLevel: 0,
545
545
 
546
546
  ...(variantId && { variantId: variantId }),
547
-
548
- appearance: appearance,
547
+ ...(appearance && { appearance: appearance }),
549
548
 
550
549
  items: parsedItems,
551
550
  },
@@ -565,7 +564,7 @@ function parseBlockItems(prosemirrorNode: ProsemirrorNode, definition: PageBlock
565
564
  return itemsJson.map(i => parseItem(i, definition)).filter(nonNullFilter);
566
565
  }
567
566
 
568
- function parseAppearance(prosemirrorNode: ProsemirrorNode): PageBlockAppearanceV2 {
567
+ function parseAppearance(prosemirrorNode: ProsemirrorNode): PageBlockAppearanceV2 | undefined {
569
568
  const appearance: PageBlockAppearanceV2 = {};
570
569
 
571
570
  const columns: unknown = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "columns");
@@ -581,6 +580,8 @@ function parseAppearance(prosemirrorNode: ProsemirrorNode): PageBlockAppearanceV
581
580
  }
582
581
  }
583
582
 
583
+ if (!Object.keys(appearance).length) return undefined;
584
+
584
585
  return appearance;
585
586
  }
586
587