@supernova-studio/client 0.10.1 → 0.11.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.
@@ -107,11 +107,6 @@ export function prosemirrorNodeToBlock(
107
107
  return parseAsMultiRichText(prosemirrorNode, definition, multiRichTextProperty);
108
108
  }
109
109
 
110
- const embedProperty = BlockDefinitionUtils.firstEmbedProperty(definition);
111
- if (prosemirrorNode.type === "embed" && embedProperty) {
112
- return parseAsEmbed(prosemirrorNode, definition, embedProperty);
113
- }
114
-
115
110
  const tableProperty = BlockDefinitionUtils.firstTableProperty(definition);
116
111
  if (tableProperty) {
117
112
  return parseAsTable(prosemirrorNode, definition, tableProperty);
@@ -170,14 +165,16 @@ function parseCalloutType(prosemirrorCalloutType: unknown): PageBlockCalloutType
170
165
  if (!prosemirrorCalloutType) return undefined;
171
166
 
172
167
  switch (prosemirrorCalloutType) {
173
- case "error":
168
+ case "critical":
174
169
  return "Error";
175
170
  case "neutral":
176
171
  return "Info";
177
- case "success":
172
+ case "positive":
178
173
  return "Success";
179
174
  case "warning":
180
175
  return "Warning";
176
+ case "primary":
177
+ return "Primary";
181
178
  }
182
179
  }
183
180
 
@@ -212,7 +209,7 @@ function parseAsMultiRichText(
212
209
  // Required
213
210
  value: (prosemirrorNode.content ?? [])
214
211
  .map(listItem => {
215
- if (listItem.type !== "listitem") return null;
212
+ if (listItem.type !== "listItem") return null;
216
213
  if (!listItem.content?.length) return parseRichText([]);
217
214
 
218
215
  const paragraph = listItem.content[0];
@@ -325,6 +322,7 @@ function parseAsTable(
325
322
  data: {
326
323
  packageId: "io.supernova.block.table",
327
324
  indentLevel: 0,
325
+ variantId: "default",
328
326
 
329
327
  ...(variantId && { variantId: variantId }),
330
328
 
@@ -452,48 +450,6 @@ function emptyTableCellContent(): PageBlockItemTableNode[] {
452
450
  ];
453
451
  }
454
452
 
455
- //
456
- // Embed
457
- //
458
-
459
- function parseAsEmbed(
460
- prosemirrorNode: ProsemirrorNode,
461
- definition: PageBlockDefinition,
462
- property: PageBlockDefinitionProperty
463
- ): PageBlockEditorModel | null {
464
- const id = getProsemirrorBlockId(prosemirrorNode);
465
- if (!id) return null;
466
-
467
- const variantId = getProsemirrorBlockVariantId(prosemirrorNode);
468
-
469
- const url = getProsemirrorAttribute(prosemirrorNode, "url", z.string().optional());
470
- const caption = getProsemirrorAttribute(prosemirrorNode, "caption", z.string().optional());
471
- const height = getProsemirrorAttribute(prosemirrorNode, "height", z.number().optional());
472
-
473
- return {
474
- id: id,
475
- data: {
476
- packageId: definition.id,
477
- indentLevel: 0,
478
-
479
- ...(variantId && { variantId: variantId }),
480
-
481
- items: [
482
- {
483
- id: id,
484
- props: {
485
- [property.id]: {
486
- value: url,
487
- caption: caption,
488
- height: height ?? 200,
489
- } as PageBlockItemEmbedValue,
490
- },
491
- },
492
- ],
493
- },
494
- };
495
- }
496
-
497
453
  //
498
454
  // Divider
499
455
  //
@@ -611,7 +567,7 @@ function parseItem(rawItem: unknown, definition: PageBlockDefinition): PageBlock
611
567
 
612
568
  return {
613
569
  id: parsedItem.data.id,
614
- linksTo: parsedItem.data.linksTo,
570
+ ...(parsedItem.data.linksTo && { linksTo: parsedItem.data.linksTo }),
615
571
  props: sanitizedProps,
616
572
  };
617
573
  }