@supernova-studio/client 0.28.0 → 0.28.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.js CHANGED
@@ -5352,18 +5352,26 @@ function serializeTextSpanAttribute(spanAttribute) {
5352
5352
  case "Code":
5353
5353
  return { type: "code", attrs: {} };
5354
5354
  case "Link":
5355
- return {
5356
- type: "link",
5357
- attrs: {
5358
- itemId: spanAttribute.documentationItemId,
5359
- href: spanAttribute.link,
5360
- target: spanAttribute.openInNewWindow ? "_blank" : "_self",
5361
- rel: "noopener noreferrer nofollow",
5362
- class: null
5363
- }
5364
- };
5355
+ if (spanAttribute.link) {
5356
+ return serializeLinkMark(spanAttribute.link, _nullishCoalesce(spanAttribute.openInNewWindow, () => ( false)));
5357
+ } else if (spanAttribute.documentationItemId) {
5358
+ return serializeLinkMark(`@page:${spanAttribute.documentationItemId}`, _nullishCoalesce(spanAttribute.openInNewWindow, () => ( false)));
5359
+ } else {
5360
+ return serializeLinkMark("about:blank", _nullishCoalesce(spanAttribute.openInNewWindow, () => ( false)));
5361
+ }
5365
5362
  }
5366
5363
  }
5364
+ function serializeLinkMark(href, openInNewWindow) {
5365
+ return {
5366
+ type: "link",
5367
+ attrs: {
5368
+ href,
5369
+ target: openInNewWindow ? "_blank" : "_self",
5370
+ rel: "noopener noreferrer nofollow",
5371
+ class: "tiptap-link"
5372
+ }
5373
+ };
5374
+ }
5367
5375
  function serializeAsCustomBlock(block, definition) {
5368
5376
  const items = block.data.items.map((i) => {
5369
5377
  return {
@@ -5407,6 +5415,7 @@ var blocks = [
5407
5415
  name: "Text",
5408
5416
  description: "Plain text",
5409
5417
  category: "Text",
5418
+ icon: "https://cdn-assets.supernova.io/blocks/icons/text.svg",
5410
5419
  searchKeywords: ["paragraph", "rich text"],
5411
5420
  item: {
5412
5421
  properties: [
@@ -5468,6 +5477,7 @@ var blocks = [
5468
5477
  name: "Title 1",
5469
5478
  description: "Main sections within the page",
5470
5479
  category: "Text",
5480
+ icon: "https://cdn-assets.supernova.io/blocks/icons/title-1.svg",
5471
5481
  searchKeywords: ["heading", "h1"],
5472
5482
  item: {
5473
5483
  properties: [
@@ -5530,6 +5540,7 @@ var blocks = [
5530
5540
  name: "Title 2",
5531
5541
  description: "Section subheadings",
5532
5542
  category: "Text",
5543
+ icon: "https://cdn-assets.supernova.io/blocks/icons/title-2.svg",
5533
5544
  searchKeywords: ["heading", "h2"],
5534
5545
  item: {
5535
5546
  properties: [
@@ -5592,6 +5603,7 @@ var blocks = [
5592
5603
  name: "Title 3",
5593
5604
  description: "Further subsections",
5594
5605
  category: "Text",
5606
+ icon: "https://cdn-assets.supernova.io/blocks/icons/title-3.svg",
5595
5607
  searchKeywords: ["heading", "h3"],
5596
5608
  item: {
5597
5609
  properties: [
@@ -5654,6 +5666,7 @@ var blocks = [
5654
5666
  name: "Title 4",
5655
5667
  description: "Details in subsections",
5656
5668
  category: "Text",
5669
+ icon: "https://cdn-assets.supernova.io/blocks/icons/title-4.svg",
5657
5670
  searchKeywords: ["heading", "h4"],
5658
5671
  item: {
5659
5672
  properties: [
@@ -5716,6 +5729,7 @@ var blocks = [
5716
5729
  name: "Title 5",
5717
5730
  description: "Nuanced details or sub-points",
5718
5731
  category: "Text",
5732
+ icon: "https://cdn-assets.supernova.io/blocks/icons/title-5.svg",
5719
5733
  searchKeywords: ["heading", "h5"],
5720
5734
  item: {
5721
5735
  properties: [
@@ -5778,6 +5792,7 @@ var blocks = [
5778
5792
  name: "Ordered list",
5779
5793
  description: "A list with numbers",
5780
5794
  category: "Text",
5795
+ icon: "https://cdn-assets.supernova.io/blocks/icons/list-ordered.svg",
5781
5796
  searchKeywords: ["ol"],
5782
5797
  item: {
5783
5798
  properties: [
@@ -5839,6 +5854,7 @@ var blocks = [
5839
5854
  name: "Unordered list",
5840
5855
  description: "A list with bullet points",
5841
5856
  category: "Text",
5857
+ icon: "https://cdn-assets.supernova.io/blocks/icons/list-unordered.svg",
5842
5858
  searchKeywords: ["ul", "bullet points"],
5843
5859
  item: {
5844
5860
  properties: [
@@ -5900,6 +5916,7 @@ var blocks = [
5900
5916
  name: "Divider",
5901
5917
  description: "A section divider",
5902
5918
  category: "Layout",
5919
+ icon: "https://cdn-assets.supernova.io/blocks/icons/divider.svg",
5903
5920
  searchKeywords: ["hr", "line", "rule", "separator"],
5904
5921
  item: {
5905
5922
  properties: [
@@ -5959,6 +5976,7 @@ var blocks = [
5959
5976
  name: "Blockquote",
5960
5977
  description: "Display a quotation",
5961
5978
  category: "Text",
5979
+ icon: "https://cdn-assets.supernova.io/blocks/icons/blockquote.svg",
5962
5980
  searchKeywords: ["cite"],
5963
5981
  item: {
5964
5982
  properties: [
@@ -6021,6 +6039,7 @@ var blocks = [
6021
6039
  name: "Callout",
6022
6040
  description: "Highlight a section of text",
6023
6041
  category: "Text",
6042
+ icon: "https://cdn-assets.supernova.io/blocks/icons/callout.svg",
6024
6043
  searchKeywords: ["banner", "alert", "note", "tip", "warning"],
6025
6044
  item: {
6026
6045
  properties: [
@@ -6083,6 +6102,7 @@ var blocks = [
6083
6102
  name: "Image",
6084
6103
  description: "Display an image or Figma frame",
6085
6104
  category: "Media",
6105
+ icon: "https://cdn-assets.supernova.io/blocks/icons/image.svg",
6086
6106
  searchKeywords: ["image", "figma", "frame", "picture", "photo"],
6087
6107
  item: {
6088
6108
  properties: [
@@ -6144,6 +6164,7 @@ var blocks = [
6144
6164
  name: "Shortcut links",
6145
6165
  description: "Link to a page or external URL",
6146
6166
  category: "Media",
6167
+ icon: "https://cdn-assets.supernova.io/blocks/icons/shortcuts.svg",
6147
6168
  searchKeywords: [],
6148
6169
  item: {
6149
6170
  properties: [
@@ -6160,6 +6181,9 @@ var blocks = [
6160
6181
  width: "Icon",
6161
6182
  aspectRatio: "Square"
6162
6183
  },
6184
+ imageOnLeft: {
6185
+ width: "Medium"
6186
+ },
6163
6187
  iconOnLeft: {
6164
6188
  width: "Icon",
6165
6189
  aspectRatio: "Square"
@@ -6323,6 +6347,7 @@ var blocks = [
6323
6347
  name: "Accessibility Color Grid",
6324
6348
  description: "Visualize accessibility of your color tokens.",
6325
6349
  category: "Tokens",
6350
+ icon: "https://cdn-assets.supernova.io/blocks/icons/token-a11y-contrast-grid.svg",
6326
6351
  searchKeywords: ["color", "accessibility", "grid", "contrast", "blind", "impairment"],
6327
6352
  item: {
6328
6353
  properties: [
@@ -6386,6 +6411,7 @@ var blocks = [
6386
6411
  name: "Embed",
6387
6412
  description: "Embed a generic URL",
6388
6413
  category: "Media",
6414
+ icon: "https://cdn-assets.supernova.io/blocks/icons/embed.svg",
6389
6415
  searchKeywords: ["embed", "url", "iframe", "site", "import"],
6390
6416
  item: {
6391
6417
  properties: [
@@ -6450,6 +6476,7 @@ var blocks = [
6450
6476
  name: "YouTube",
6451
6477
  description: "Embed a Youtube video",
6452
6478
  category: "Media",
6479
+ icon: "https://cdn-assets.supernova.io/blocks/icons/embed-youtube.svg",
6453
6480
  searchKeywords: ["embed", "video", "player", "upload"],
6454
6481
  item: {
6455
6482
  properties: [
@@ -6514,6 +6541,7 @@ var blocks = [
6514
6541
  name: "Lottie animation",
6515
6542
  description: "Preview a Lottie animation",
6516
6543
  category: "Media",
6544
+ icon: "https://cdn-assets.supernova.io/blocks/icons/lottie.svg",
6517
6545
  searchKeywords: ["embed", "lottie", "animation", "rive", "json"],
6518
6546
  item: {
6519
6547
  properties: [
@@ -6616,6 +6644,7 @@ var blocks = [
6616
6644
  name: "Storybook",
6617
6645
  description: "Embed Storybook canvas",
6618
6646
  category: "Media",
6647
+ icon: "https://cdn-assets.supernova.io/blocks/icons/storybook.svg",
6619
6648
  searchKeywords: ["storybook", "story", "stories", "example", "preview", "code", "react"],
6620
6649
  item: {
6621
6650
  properties: [
@@ -6679,6 +6708,7 @@ var blocks = [
6679
6708
  name: "Figma embed",
6680
6709
  description: "Embed a Figma canvas or prototype",
6681
6710
  category: "Media",
6711
+ icon: "https://cdn-assets.supernova.io/blocks/icons/embed-figma.svg",
6682
6712
  searchKeywords: ["embed", "figma", "design", "prototype", "canvas"],
6683
6713
  item: {
6684
6714
  properties: [
@@ -6743,6 +6773,7 @@ var blocks = [
6743
6773
  name: "Markdown",
6744
6774
  description: "Render Markdown URL",
6745
6775
  category: "Other",
6776
+ icon: "https://cdn-assets.supernova.io/blocks/icons/markdown.svg",
6746
6777
  searchKeywords: ["md", "embed", "api", "table", "mdx"],
6747
6778
  item: {
6748
6779
  properties: [
@@ -6843,6 +6874,7 @@ var blocks = [
6843
6874
  name: "Table",
6844
6875
  description: "Display a simple table",
6845
6876
  category: "Layout",
6877
+ icon: "https://cdn-assets.supernova.io/blocks/icons/table.svg",
6846
6878
  searchKeywords: ["grid", "data", "spreadsheet", "api"],
6847
6879
  item: {
6848
6880
  properties: [
@@ -6902,6 +6934,7 @@ var blocks = [
6902
6934
  name: "Token detail",
6903
6935
  description: "Show a single design tokens",
6904
6936
  category: "Tokens",
6937
+ icon: "https://cdn-assets.supernova.io/blocks/icons/token-detail.svg",
6905
6938
  searchKeywords: ["color", "typography", "spacing", "grid", "material", "theme"],
6906
6939
  item: {
6907
6940
  properties: [
@@ -7004,6 +7037,7 @@ var blocks = [
7004
7037
  name: "Token list",
7005
7038
  description: "Show a list of design tokens",
7006
7039
  category: "Tokens",
7040
+ icon: "https://cdn-assets.supernova.io/blocks/icons/token-list.svg",
7007
7041
  searchKeywords: ["color", "typography", "spacing", "grid", "material", "theme"],
7008
7042
  item: {
7009
7043
  properties: [
@@ -7111,6 +7145,7 @@ var blocks = [
7111
7145
  name: "Token group",
7112
7146
  description: "Show a group of design tokens",
7113
7147
  category: "Tokens",
7148
+ icon: "https://cdn-assets.supernova.io/blocks/icons/token-list.svg",
7114
7149
  searchKeywords: ["color", "typography", "spacing", "grid", "material", "theme"],
7115
7150
  item: {
7116
7151
  properties: [
@@ -7218,6 +7253,7 @@ var blocks = [
7218
7253
  name: "Code",
7219
7254
  description: "Code description",
7220
7255
  category: "Code",
7256
+ icon: "https://cdn-assets.supernova.io/blocks/icons/code.svg",
7221
7257
  searchKeywords: ["code"],
7222
7258
  item: {
7223
7259
  properties: [
@@ -7276,6 +7312,7 @@ var blocks = [
7276
7312
  name: "React code",
7277
7313
  description: "Render React code",
7278
7314
  category: "Code",
7315
+ icon: "https://cdn-assets.supernova.io/blocks/icons/code-react.svg",
7279
7316
  searchKeywords: ["code", "react", "snippet", "storybook", "editor", "example"],
7280
7317
  item: {
7281
7318
  properties: [
@@ -7410,6 +7447,7 @@ var blocks = [
7410
7447
  name: "Link",
7411
7448
  description: "Preview of a link",
7412
7449
  category: "Media",
7450
+ icon: "https://cdn-assets.supernova.io/blocks/icons/shortcut-link.svg",
7413
7451
  searchKeywords: [],
7414
7452
  item: {
7415
7453
  properties: [
@@ -7467,6 +7505,7 @@ var blocks = [
7467
7505
  name: "Assets",
7468
7506
  description: "Display icons or illustrations",
7469
7507
  category: "Assets",
7508
+ icon: "https://cdn-assets.supernova.io/blocks/icons/assets.svg",
7470
7509
  searchKeywords: ["icons", "illustrations", "grid", "svg", "logos", "theme"],
7471
7510
  item: {
7472
7511
  properties: [
@@ -7568,6 +7607,7 @@ var blocks = [
7568
7607
  name: "Figma frames",
7569
7608
  description: "Display Figma frames as images",
7570
7609
  category: "Figma",
7610
+ icon: "https://cdn-assets.supernova.io/blocks/icons/figma-frames.svg",
7571
7611
  searchKeywords: ["figma", "frames", "image"],
7572
7612
  item: {
7573
7613
  properties: [
@@ -7649,6 +7689,7 @@ var blocks = [
7649
7689
  name: "Release notes",
7650
7690
  description: "Show version release notes",
7651
7691
  category: "Other",
7692
+ icon: "https://cdn-assets.supernova.io/blocks/icons/release-notes.svg",
7652
7693
  searchKeywords: ["version", "changelog", "history"],
7653
7694
  item: {
7654
7695
  properties: [],
@@ -7701,6 +7742,7 @@ var blocks = [
7701
7742
  name: "Component checklist",
7702
7743
  description: "Highlight specific features of your components",
7703
7744
  category: "Components",
7745
+ icon: "https://cdn-assets.supernova.io/blocks/icons/component-checklist.svg",
7704
7746
  searchKeywords: ["components", "health", "properties", "overview", "status"],
7705
7747
  item: {
7706
7748
  properties: [
@@ -7779,6 +7821,7 @@ var blocks = [
7779
7821
  name: "Component overview table",
7780
7822
  description: "Show the overview of all your components",
7781
7823
  category: "Components",
7824
+ icon: "https://cdn-assets.supernova.io/blocks/icons/component-overview-table.svg",
7782
7825
  searchKeywords: ["components", "health", "properties", "overview", "status"],
7783
7826
  item: {
7784
7827
  properties: [
@@ -7849,6 +7892,7 @@ var blocks = [
7849
7892
  name: "Component health",
7850
7893
  description: "Show component health and additional attributes",
7851
7894
  category: "Components",
7895
+ icon: "https://cdn-assets.supernova.io/blocks/icons/component-health.svg",
7852
7896
  searchKeywords: ["components", "health", "properties", "overview", "status"],
7853
7897
  item: {
7854
7898
  properties: [
@@ -8122,34 +8166,47 @@ function parseRichTextAttribute(mark) {
8122
8166
  case "code":
8123
8167
  return { type: "Code" };
8124
8168
  case "link":
8125
- const itemId = getProsemirrorAttribute(mark, "itemId", _zod.z.string().optional());
8126
- const href = getProsemirrorAttribute(mark, "href", _zod.z.string().optional());
8127
- return {
8128
- type: "Link",
8129
- openInNewWindow: _optionalChain([mark, 'access', _19 => _19.attrs, 'optionalAccess', _20 => _20.target]) !== "_self",
8130
- documentationItemId: itemId,
8131
- link: href
8132
- };
8169
+ return parseProsemirrorLink(mark);
8133
8170
  }
8134
8171
  return null;
8135
8172
  }
8173
+ function parseProsemirrorLink(mark) {
8174
+ const href = getProsemirrorAttribute(mark, "href", _zod.z.string().optional());
8175
+ if (!href)
8176
+ return null;
8177
+ const target = getProsemirrorAttribute(mark, "target", _zod.z.string().optional());
8178
+ const openInNewWindow = target === "_blank";
8179
+ if (href.startsWith("@")) {
8180
+ return {
8181
+ type: "Link",
8182
+ openInNewWindow,
8183
+ documentationItemId: href.split(":")[1]
8184
+ };
8185
+ } else {
8186
+ return {
8187
+ type: "Link",
8188
+ openInNewWindow,
8189
+ link: href
8190
+ };
8191
+ }
8192
+ }
8136
8193
  function parseAsTable(prosemirrorNode, definition, property) {
8137
8194
  const id = getProsemirrorBlockId(prosemirrorNode);
8138
8195
  if (!id)
8139
8196
  return null;
8140
8197
  const variantId = getProsemirrorBlockVariantId(prosemirrorNode);
8141
8198
  const hasBorder = getProsemirrorAttribute(prosemirrorNode, "hasBorder", _zod.z.boolean().optional()) !== false;
8142
- const tableChild = _optionalChain([prosemirrorNode, 'access', _21 => _21.content, 'optionalAccess', _22 => _22.find, 'call', _23 => _23((c) => c.type === "table")]);
8199
+ const tableChild = _optionalChain([prosemirrorNode, 'access', _19 => _19.content, 'optionalAccess', _20 => _20.find, 'call', _21 => _21((c) => c.type === "table")]);
8143
8200
  if (!tableChild) {
8144
8201
  return emptyTable(id, variantId, 0);
8145
8202
  }
8146
- const rows = _nullishCoalesce(_optionalChain([tableChild, 'access', _24 => _24.content, 'optionalAccess', _25 => _25.filter, 'call', _26 => _26((c) => c.type === "tableRow" && !!_optionalChain([c, 'access', _27 => _27.content, 'optionalAccess', _28 => _28.length]))]), () => ( []));
8203
+ const rows = _nullishCoalesce(_optionalChain([tableChild, 'access', _22 => _22.content, 'optionalAccess', _23 => _23.filter, 'call', _24 => _24((c) => c.type === "tableRow" && !!_optionalChain([c, 'access', _25 => _25.content, 'optionalAccess', _26 => _26.length]))]), () => ( []));
8147
8204
  if (!rows.length) {
8148
8205
  return emptyTable(id, variantId, 0);
8149
8206
  }
8150
- const rowHeaderCells = _nullishCoalesce(_optionalChain([rows, 'access', _29 => _29[0], 'access', _30 => _30.content, 'optionalAccess', _31 => _31.filter, 'call', _32 => _32((c) => c.type === "tableHeader"), 'access', _33 => _33.length]), () => ( 0));
8151
- const columnHeaderCells = rows.filter((r) => _optionalChain([r, 'access', _34 => _34.content, 'optionalAccess', _35 => _35[0], 'optionalAccess', _36 => _36.type]) === "tableHeader").length;
8152
- const hasHeaderRow = _optionalChain([rows, 'access', _37 => _37[0], 'access', _38 => _38.content, 'optionalAccess', _39 => _39.length]) === rowHeaderCells;
8207
+ const rowHeaderCells = _nullishCoalesce(_optionalChain([rows, 'access', _27 => _27[0], 'access', _28 => _28.content, 'optionalAccess', _29 => _29.filter, 'call', _30 => _30((c) => c.type === "tableHeader"), 'access', _31 => _31.length]), () => ( 0));
8208
+ const columnHeaderCells = rows.filter((r) => _optionalChain([r, 'access', _32 => _32.content, 'optionalAccess', _33 => _33[0], 'optionalAccess', _34 => _34.type]) === "tableHeader").length;
8209
+ const hasHeaderRow = _optionalChain([rows, 'access', _35 => _35[0], 'access', _36 => _36.content, 'optionalAccess', _37 => _37.length]) === rowHeaderCells;
8153
8210
  const hasHeaderColumn = rows.length === columnHeaderCells;
8154
8211
  const tableValue = {
8155
8212
  showBorder: hasBorder,
@@ -8231,7 +8288,7 @@ function parseAsTableNode(prosemirrorNode) {
8231
8288
  const parsedItems = PageBlockItemV2.array().safeParse(JSON.parse(items));
8232
8289
  if (!parsedItems.success)
8233
8290
  return null;
8234
- const rawImagePropertyValue = _optionalChain([parsedItems, 'access', _40 => _40.data, 'access', _41 => _41[0], 'optionalAccess', _42 => _42.props, 'access', _43 => _43.image]);
8291
+ const rawImagePropertyValue = _optionalChain([parsedItems, 'access', _38 => _38.data, 'access', _39 => _39[0], 'optionalAccess', _40 => _40.props, 'access', _41 => _41.image]);
8235
8292
  if (!rawImagePropertyValue)
8236
8293
  return null;
8237
8294
  const imagePropertyValueParseResult = PageBlockItemImageValue.safeParse(rawImagePropertyValue);
@@ -8453,7 +8510,7 @@ function getProsemirrorBlockVariantId(prosemirrorNode) {
8453
8510
  return getProsemirrorAttribute(prosemirrorNode, "variantId", nullishToOptional(_zod.z.string()));
8454
8511
  }
8455
8512
  function getProsemirrorAttribute(prosemirrorNode, attributeName, validationSchema) {
8456
- const parsedAttr = validationSchema.safeParse(_optionalChain([prosemirrorNode, 'access', _44 => _44.attrs, 'optionalAccess', _45 => _45[attributeName]]));
8513
+ const parsedAttr = validationSchema.safeParse(_optionalChain([prosemirrorNode, 'access', _42 => _42.attrs, 'optionalAccess', _43 => _43[attributeName]]));
8457
8514
  if (parsedAttr.success) {
8458
8515
  return parsedAttr.data;
8459
8516
  } else {