@supernova-studio/client 1.3.1 → 1.3.2

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.d.mts CHANGED
@@ -1824,7 +1824,7 @@ type LocalDocsPageGroup = OmitStrict<ElementGroup, "id" | "brandPersistentId" |
1824
1824
  };
1825
1825
  type LocalApproval = OmitStrict<DocumentationPageApproval, "id" | "pageId" | "persistentId">;
1826
1826
  type NarrowedUnion<T, U extends T> = U;
1827
- type SupportedActionType = NarrowedUnion<DTOElementActionInput["type"], "DocumentationPageCreate" | "DocumentationPageUpdate" | "DocumentationPageDelete" | "DocumentationPageMove" | "DocumentationGroupCreate" | "DocumentationGroupUpdate" | "DocumentationGroupDelete" | "DocumentationGroupMove" | "DocumentationPageApprovalStateChange">;
1827
+ type SupportedActionType = NarrowedUnion<DTOElementActionInput["type"], "DocumentationPageCreate" | "DocumentationPageUpdate" | "DocumentationPageDelete" | "DocumentationPageMove" | "DocumentationGroupCreate" | "DocumentationGroupUpdate" | "DocumentationGroupDelete" | "DocumentationGroupMove" | "DocumentationPageApprovalStateChange" | "DocumentationTabCreate">;
1828
1828
 
1829
1829
  declare const DTOColorTokenInlineData: z.ZodObject<{
1830
1830
  value: z.ZodString;
@@ -103252,6 +103252,7 @@ declare class LocalDocsElementActionExecutor {
103252
103252
  private documentationGroupUpdate;
103253
103253
  private documentationGroupMove;
103254
103254
  private documentationGroupDelete;
103255
+ private documentationTabCreate;
103255
103256
  private documentationApprovalStateUpdate;
103256
103257
  private calculateSortOrder;
103257
103258
  }
package/dist/index.d.ts CHANGED
@@ -1824,7 +1824,7 @@ type LocalDocsPageGroup = OmitStrict<ElementGroup, "id" | "brandPersistentId" |
1824
1824
  };
1825
1825
  type LocalApproval = OmitStrict<DocumentationPageApproval, "id" | "pageId" | "persistentId">;
1826
1826
  type NarrowedUnion<T, U extends T> = U;
1827
- type SupportedActionType = NarrowedUnion<DTOElementActionInput["type"], "DocumentationPageCreate" | "DocumentationPageUpdate" | "DocumentationPageDelete" | "DocumentationPageMove" | "DocumentationGroupCreate" | "DocumentationGroupUpdate" | "DocumentationGroupDelete" | "DocumentationGroupMove" | "DocumentationPageApprovalStateChange">;
1827
+ type SupportedActionType = NarrowedUnion<DTOElementActionInput["type"], "DocumentationPageCreate" | "DocumentationPageUpdate" | "DocumentationPageDelete" | "DocumentationPageMove" | "DocumentationGroupCreate" | "DocumentationGroupUpdate" | "DocumentationGroupDelete" | "DocumentationGroupMove" | "DocumentationPageApprovalStateChange" | "DocumentationTabCreate">;
1828
1828
 
1829
1829
  declare const DTOColorTokenInlineData: z.ZodObject<{
1830
1830
  value: z.ZodString;
@@ -103252,6 +103252,7 @@ declare class LocalDocsElementActionExecutor {
103252
103252
  private documentationGroupUpdate;
103253
103253
  private documentationGroupMove;
103254
103254
  private documentationGroupDelete;
103255
+ private documentationTabCreate;
103255
103256
  private documentationApprovalStateUpdate;
103256
103257
  private calculateSortOrder;
103257
103258
  }
package/dist/index.js CHANGED
@@ -13633,6 +13633,7 @@ var LocalDocsElementActionExecutor = class {
13633
13633
  case "DocumentationPageRestore":
13634
13634
  throw new Error(`Transaction type ${trx.type} is not yet implemented`);
13635
13635
  case "DocumentationTabCreate":
13636
+ return this.documentationTabCreate(trx);
13636
13637
  case "DocumentationTabGroupDelete":
13637
13638
  throw new Error(`Transaction type ${trx.type} is not yet implemented`);
13638
13639
  case "FigmaNodeRender":
@@ -13787,6 +13788,40 @@ var LocalDocsElementActionExecutor = class {
13787
13788
  }
13788
13789
  }
13789
13790
  //
13791
+ // Tabs
13792
+ //
13793
+ documentationTabCreate(trx) {
13794
+ const { input } = trx;
13795
+ const page = this.pages.get(input.fromItemPersistentId);
13796
+ if (!page) {
13797
+ throw new Error(`Cannot create tab: page id ${input.fromItemPersistentId} was not found`);
13798
+ }
13799
+ const tabGroup = {
13800
+ parentPersistentId: page.parentPersistentId,
13801
+ persistentId: input.persistentId,
13802
+ shortPersistentId: generateShortPersistentId(),
13803
+ slug: page.slug,
13804
+ meta: page.meta,
13805
+ createdAt: /* @__PURE__ */ new Date(),
13806
+ updatedAt: /* @__PURE__ */ new Date(),
13807
+ data: {
13808
+ behavior: "Tabs",
13809
+ configuration: _optionalChain([page, 'optionalAccess', _90 => _90.data, 'access', _91 => _91.configuration])
13810
+ },
13811
+ sortOrder: page.sortOrder,
13812
+ designSystemVersionId: this.designSystemVersionId
13813
+ };
13814
+ this.groups.set(input.persistentId, tabGroup);
13815
+ const newLocalPage = {
13816
+ ...page,
13817
+ userSlug: void 0,
13818
+ sortOrder: 0,
13819
+ parentPersistentId: input.persistentId,
13820
+ meta: { name: input.tabName }
13821
+ };
13822
+ this.pages.set(newLocalPage.persistentId, newLocalPage);
13823
+ }
13824
+ //
13790
13825
  // Approval states
13791
13826
  //
13792
13827
  documentationApprovalStateUpdate(trx) {
@@ -13795,7 +13830,7 @@ var LocalDocsElementActionExecutor = class {
13795
13830
  if (input.approvalState) {
13796
13831
  this.approvalStates.set(input.persistentId, {
13797
13832
  approvalState: input.approvalState,
13798
- createdAt: _nullishCoalesce(_optionalChain([existingApproval, 'optionalAccess', _90 => _90.createdAt]), () => ( /* @__PURE__ */ new Date())),
13833
+ createdAt: _nullishCoalesce(_optionalChain([existingApproval, 'optionalAccess', _92 => _92.createdAt]), () => ( /* @__PURE__ */ new Date())),
13799
13834
  designSystemVersionId: this.designSystemVersionId,
13800
13835
  pagePersistentId: input.persistentId,
13801
13836
  updatedAt: /* @__PURE__ */ new Date(),
@@ -13826,7 +13861,7 @@ var LocalDocsElementActionExecutor = class {
13826
13861
  return neighbours[neighbours.length - 1].sortOrder + sortOrderStep;
13827
13862
  }
13828
13863
  const left = neighbours[index].sortOrder;
13829
- const right = _nullishCoalesce(_optionalChain([neighbours, 'access', _91 => _91[index + 1], 'optionalAccess', _92 => _92.sortOrder]), () => ( left + sortOrderStep * 2));
13864
+ const right = _nullishCoalesce(_optionalChain([neighbours, 'access', _93 => _93[index + 1], 'optionalAccess', _94 => _94.sortOrder]), () => ( left + sortOrderStep * 2));
13830
13865
  return (right + left) / 2;
13831
13866
  }
13832
13867
  };