@webflow/designer-extension-typings 2.0.27 → 2.0.30

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/elements.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference path="./styles.d.ts" />
2
2
  /// <reference path="./elements-generated.d.ts" />
3
+ /// <reference path="./slots.d.ts" />
3
4
 
4
5
  type ElementId = string;
5
6
  type FullElementId = {component: ComponentId; element: ElementId};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webflow/designer-extension-typings",
3
- "version": "2.0.27",
3
+ "version": "2.0.30",
4
4
  "license": "MIT",
5
5
  "description": "Typings for the Webflow Designer Extension API",
6
6
  "main": "",
package/pages.d.ts CHANGED
@@ -459,6 +459,53 @@ interface Page {
459
459
  | 'utility'
460
460
  | 'staticTemplate'
461
461
  >;
462
+ /**
463
+ * Get the branch ID of this page, if it exists on a branch.
464
+ * Returns null if the page is not on a branch.
465
+ * @returns The branch ID string, or null.
466
+ * @example
467
+ * ```ts
468
+ * const branchId = await myPage.getBranchId();
469
+ * if (branchId) {
470
+ * console.log("Page is on branch:", branchId);
471
+ * }
472
+ * ```
473
+ */
474
+ getBranchId(): Promise<string | null>;
475
+ /**
476
+ * Get the ID of this page's parent. For branch pages, this returns the ID
477
+ * of the original page that was branched — use it with `switchPage()` to
478
+ * navigate back to main. For pages inside folders, returns the folder ID.
479
+ * Returns null for root-level non-branch pages.
480
+ * @returns The parent page or folder ID, or null.
481
+ * @example
482
+ * ```ts
483
+ * // Navigate back to main from a branch
484
+ * const parentId = await myPage.getParentPageId();
485
+ * if (parentId) {
486
+ * const mainPage = await webflow.getPage(parentId);
487
+ * await webflow.switchPage(mainPage);
488
+ * }
489
+ * ```
490
+ */
491
+ getParentPageId(): Promise<string | null>;
492
+
493
+ /**
494
+ * List all branch pages that exist for this page.
495
+ * Returns an array of objects with `pageId` and `branchId` for each branch.
496
+ * Use `pageId` with `webflow.getPage()` and `webflow.switchPage()` to navigate.
497
+ * Returns an empty array if the page has no branches.
498
+ * @returns Array of branch objects with pageId and branchId.
499
+ * @example
500
+ * ```ts
501
+ * const branches = await myPage.listBranches();
502
+ * if (branches.length > 0) {
503
+ * const branchPage = await webflow.getPage(branches[0].pageId);
504
+ * await webflow.switchPage(branchPage);
505
+ * }
506
+ * ```
507
+ */
508
+ listBranches(): Promise<Array<{pageId: string; branchId: string}>>;
462
509
  }
463
510
 
464
511
  type FolderId = string;
package/slots.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ /// <reference path="./elements.d.ts" />
2
+ /// <reference path="./components.d.ts" />
3
+
4
+ interface FullSlotId {
5
+ readonly component: string;
6
+ readonly element: string;
7
+ readonly slot: string;
8
+ }
9
+
10
+ interface SlotInstanceElement {
11
+ readonly id: FullSlotId;
12
+ getDisplayName(): Promise<string | null>;
13
+ getChildren(): Promise<AnyElement[]>;
14
+ append(child: Component): Promise<null>;
15
+ prepend(child: Component): Promise<null>;
16
+ }