@puckeditor/plugin-pages 0.6.1-canary.4a204adc → 0.6.1-canary.7fc6a4c9

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.css CHANGED
@@ -1541,35 +1541,35 @@ button._Menu-item_1tu16_55:hover {
1541
1541
  }
1542
1542
 
1543
1543
  /* css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/PagePlugin/styles.module.css/#css-module-data */
1544
- ._Pages_ey49w_5 {
1544
+ ._Pages_jziur_5 {
1545
1545
  display: flex;
1546
1546
  flex-direction: column;
1547
1547
  height: 100%;
1548
1548
  padding: 16px;
1549
1549
  }
1550
- ._Pages-addPage_ey49w_12 {
1550
+ ._Pages-addPage_jziur_12 {
1551
1551
  margin-bottom: 16px;
1552
1552
  display: flex;
1553
1553
  gap: 8px;
1554
1554
  }
1555
- ._Pages-loader_ey49w_18 {
1555
+ ._Pages-loader_jziur_18 {
1556
1556
  align-items: center;
1557
1557
  background-color: white;
1558
1558
  display: flex;
1559
1559
  justify-content: center;
1560
1560
  padding: 16px;
1561
1561
  }
1562
- ._Pages-list_ey49w_26 {
1562
+ ._Pages-list_jziur_26 {
1563
1563
  display: flex;
1564
1564
  flex-direction: column;
1565
1565
  border-radius: 8px;
1566
1566
  overflow-y: auto;
1567
1567
  flex-grow: 1;
1568
1568
  }
1569
- ._Pages-search_ey49w_34 {
1569
+ ._Pages-search_jziur_34 {
1570
1570
  flex-grow: 1;
1571
1571
  }
1572
- ._Pages-searchInput_ey49w_38 {
1572
+ ._Pages-searchInput_jziur_38 {
1573
1573
  border: 1px solid var(--puck-color-grey-09);
1574
1574
  border-radius: 8px;
1575
1575
  background-color: var(--puck-color-white);
@@ -1580,11 +1580,11 @@ button._Menu-item_1tu16_55:hover {
1580
1580
  padding: 0 8px;
1581
1581
  width: 100%;
1582
1582
  }
1583
- ._Pages-searchInput_ey49w_38:focus {
1583
+ ._Pages-searchInput_jziur_38:focus {
1584
1584
  outline: 2px solid var(--puck-color-azure-04);
1585
1585
  outline-offset: -1px;
1586
1586
  }
1587
- ._PagesPage_ey49w_59 {
1587
+ ._PagesPage_jziur_59 {
1588
1588
  border-left: 1px solid var(--puck-color-grey-10);
1589
1589
  border-right: 1px solid var(--puck-color-grey-10);
1590
1590
  border-bottom: 1px solid var(--puck-color-grey-10);
@@ -1593,28 +1593,28 @@ button._Menu-item_1tu16_55:hover {
1593
1593
  flex-shrink: 0;
1594
1594
  overflow: hidden;
1595
1595
  }
1596
- ._PagesPage--expanded_ey49w_69 {
1596
+ ._PagesPage--expanded_jziur_69 {
1597
1597
  min-height: calc(34px + 1px + 55px);
1598
1598
  }
1599
- ._PagesPage--expanded_ey49w_69:has(._PagesPage-versions_ey49w_73 > :nth-child(2)) {
1599
+ ._PagesPage--expanded_jziur_69:has(._PagesPage-versions_jziur_73 > :nth-child(2)) {
1600
1600
  min-height: calc(34px + 1px + 55px + 1px + 55px);
1601
1601
  }
1602
- ._PagesPage--expanded_ey49w_69:has(._PagesPage-versions_ey49w_73 > :nth-child(3)) {
1602
+ ._PagesPage--expanded_jziur_69:has(._PagesPage-versions_jziur_73 > :nth-child(3)) {
1603
1603
  min-height: calc(34px + 1px + 55px + 1px + 55px + 1px + 55px);
1604
1604
  }
1605
- ._PagesPage--expanded_ey49w_69 {
1605
+ ._PagesPage--expanded_jziur_69 {
1606
1606
  flex-shrink: 1;
1607
1607
  }
1608
- ._PagesPage_ey49w_59:first-of-type {
1608
+ ._PagesPage_jziur_59:first-of-type {
1609
1609
  border-top: 1px solid var(--puck-color-grey-10);
1610
1610
  border-top-left-radius: 8px;
1611
1611
  border-top-right-radius: 8px;
1612
1612
  }
1613
- ._PagesPage_ey49w_59:last-of-type {
1613
+ ._PagesPage_jziur_59:last-of-type {
1614
1614
  border-bottom-left-radius: 8px;
1615
1615
  border-bottom-right-radius: 8px;
1616
1616
  }
1617
- ._PagesPage-header_ey49w_96 {
1617
+ ._PagesPage-header_jziur_96 {
1618
1618
  align-items: center;
1619
1619
  background-color: white;
1620
1620
  font-family: var(--puck-font-family-monospaced);
@@ -1625,39 +1625,40 @@ button._Menu-item_1tu16_55:hover {
1625
1625
  justify-content: space-between;
1626
1626
  padding: 8px 12px;
1627
1627
  width: 100%;
1628
+ text-align: left;
1628
1629
  }
1629
- ._PagesPage_ey49w_59:first-of-type ._PagesPage-header_ey49w_96 {
1630
+ ._PagesPage_jziur_59:first-of-type ._PagesPage-header_jziur_96 {
1630
1631
  border-top-left-radius: 8px;
1631
1632
  border-top-right-radius: 8px;
1632
1633
  }
1633
- ._PagesPage_ey49w_59:last-of-type:not(._PagesPage--expanded_ey49w_69) ._PagesPage-header_ey49w_96 {
1634
+ ._PagesPage_jziur_59:last-of-type:not(._PagesPage--expanded_jziur_69) ._PagesPage-header_jziur_96 {
1634
1635
  border-bottom-left-radius: 8px;
1635
1636
  border-bottom-right-radius: 8px;
1636
1637
  }
1637
- ._PagesPage-header_ey49w_96:focus-visible {
1638
+ ._PagesPage-header_jziur_96:focus-visible {
1638
1639
  outline: 2px solid var(--puck-color-azure-04);
1639
1640
  outline-offset: -2px;
1640
1641
  }
1641
- ._PagesPage--active_ey49w_124 ._PagesPage-header_ey49w_96 {
1642
+ ._PagesPage--active_jziur_125 ._PagesPage-header_jziur_96 {
1642
1643
  color: var(--puck-color-azure-04);
1643
1644
  }
1644
- ._PagesPage--expanded_ey49w_69 ._PagesPage-header_ey49w_96 {
1645
+ ._PagesPage--expanded_jziur_69 ._PagesPage-header_jziur_96 {
1645
1646
  border-bottom: 1px solid var(--puck-color-grey-10);
1646
1647
  }
1647
- ._PagesPage-header_ey49w_96:hover {
1648
+ ._PagesPage-header_jziur_96:hover {
1648
1649
  background: var(--puck-color-azure-11);
1649
1650
  color: var(--puck-color-azure-04);
1650
1651
  }
1651
- ._PagesPage-headerMain_ey49w_137 {
1652
+ ._PagesPage-headerMain_jziur_138 {
1652
1653
  display: flex;
1653
1654
  gap: 4px;
1654
1655
  justify-content: space-between;
1655
1656
  width: 100%;
1656
1657
  }
1657
- ._PagesPage-headerIcon_ey49w_144 {
1658
+ ._PagesPage-headerIcon_jziur_145 {
1658
1659
  color: var(--puck-color-grey-04);
1659
1660
  }
1660
- ._PagesPage-loader_ey49w_148 {
1661
+ ._PagesPage-loader_jziur_149 {
1661
1662
  align-items: center;
1662
1663
  background-color: white;
1663
1664
  display: none;
@@ -1665,17 +1666,17 @@ button._Menu-item_1tu16_55:hover {
1665
1666
  padding: 16px;
1666
1667
  height: 100%;
1667
1668
  }
1668
- ._PagesPage--expanded_ey49w_69 ._PagesPage-loader_ey49w_148 {
1669
+ ._PagesPage--expanded_jziur_69 ._PagesPage-loader_jziur_149 {
1669
1670
  display: flex;
1670
1671
  }
1671
- ._PagesPage-versions_ey49w_73 {
1672
+ ._PagesPage-versions_jziur_73 {
1672
1673
  display: none;
1673
1674
  overflow-y: auto;
1674
1675
  }
1675
- ._PagesPage--expanded_ey49w_69 ._PagesPage-versions_ey49w_73 {
1676
+ ._PagesPage--expanded_jziur_69 ._PagesPage-versions_jziur_73 {
1676
1677
  display: block;
1677
1678
  }
1678
- ._PagesVersion_ey49w_174 ._PagesVersion-inner_ey49w_174 {
1679
+ ._PagesVersion_jziur_175 ._PagesVersion-inner_jziur_175 {
1679
1680
  background-color: white;
1680
1681
  border-top: 1px solid var(--puck-color-grey-10);
1681
1682
  padding-bottom: 12px;
@@ -1685,32 +1686,32 @@ button._Menu-item_1tu16_55:hover {
1685
1686
  text-align: left;
1686
1687
  width: 100%;
1687
1688
  }
1688
- ._PagesVersion_ey49w_174:first-of-type ._PagesVersion-inner_ey49w_174 {
1689
+ ._PagesVersion_jziur_175:first-of-type ._PagesVersion-inner_jziur_175 {
1689
1690
  border-top: none;
1690
1691
  }
1691
- ._PagesVersion--current_ey49w_189 ._PagesVersion-inner_ey49w_174 {
1692
+ ._PagesVersion--current_jziur_190 ._PagesVersion-inner_jziur_175 {
1692
1693
  border-right: 3px solid var(--puck-color-azure-04);
1693
1694
  }
1694
- ._PagesVersion-inner_ey49w_174:hover {
1695
+ ._PagesVersion-inner_jziur_175:hover {
1695
1696
  background-color: var(--puck-color-azure-11);
1696
1697
  color: var(--puck-color-azure-04);
1697
1698
  cursor: pointer;
1698
1699
  }
1699
- ._PagesVersion-inner_ey49w_174:focus-visible {
1700
+ ._PagesVersion-inner_jziur_175:focus-visible {
1700
1701
  outline: 2px solid var(--puck-color-azure-04);
1701
1702
  outline-offset: -2px;
1702
1703
  }
1703
- ._PagesVersion-header_ey49w_204 {
1704
+ ._PagesVersion-header_jziur_205 {
1704
1705
  align-items: center;
1705
1706
  display: flex;
1706
1707
  gap: 4px;
1707
1708
  }
1708
- ._PagesVersion-version_ey49w_210 {
1709
+ ._PagesVersion-version_jziur_211 {
1709
1710
  font-family: var(--puck-font-family-monospaced);
1710
1711
  font-weight: 600;
1711
1712
  line-height: 1;
1712
1713
  }
1713
- ._PagesVersion-date_ey49w_216 {
1714
+ ._PagesVersion-date_jziur_217 {
1714
1715
  color: var(--puck-color-grey-06);
1715
1716
  font-size: var(--puck-font-size-xxxs);
1716
1717
  font-weight: 500;
@@ -1721,23 +1722,22 @@ button._Menu-item_1tu16_55:hover {
1721
1722
  }
1722
1723
 
1723
1724
  /* css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/CreateForm/styles.module.css/#css-module-data */
1724
- ._CreateForm_kkdt2_1 {
1725
- width: 100%;
1725
+ ._CreateForm_1tu67_1 {
1726
1726
  }
1727
- ._CreateForm-field_kkdt2_5 {
1727
+ ._CreateForm-field_1tu67_4 {
1728
1728
  display: flex;
1729
1729
  flex-direction: column;
1730
1730
  align-items: flex-start;
1731
1731
  gap: 0.25rem;
1732
1732
  width: 100%;
1733
1733
  }
1734
- ._CreateForm-label_kkdt2_13 {
1734
+ ._CreateForm-label_1tu67_12 {
1735
1735
  font-size: 0.875rem;
1736
1736
  line-height: 1.25rem;
1737
1737
  font-weight: 500;
1738
1738
  color: var(--puck-color-grey-02);
1739
1739
  }
1740
- ._CreateForm-input_kkdt2_20 {
1740
+ ._CreateForm-input_1tu67_19 {
1741
1741
  box-sizing: border-box;
1742
1742
  width: 100%;
1743
1743
  height: 2.5rem;
@@ -1750,14 +1750,14 @@ button._Menu-item_1tu16_55:hover {
1750
1750
  font-family: inherit;
1751
1751
  font-size: 1rem;
1752
1752
  }
1753
- ._CreateForm-input_kkdt2_20:focus {
1753
+ ._CreateForm-input_1tu67_19:focus {
1754
1754
  outline: 2px solid var(--puck-color-azure-04);
1755
1755
  outline-offset: -1px;
1756
1756
  }
1757
- ._CreateForm-input_kkdt2_20::placeholder {
1757
+ ._CreateForm-input_1tu67_19::placeholder {
1758
1758
  color: var(--puck-color-grey-06);
1759
1759
  }
1760
- ._CreateForm-error_kkdt2_43 {
1760
+ ._CreateForm-error_1tu67_42 {
1761
1761
  width: 100%;
1762
1762
  margin-top: 16px;
1763
1763
  color: var(--puck-color-red-05);
@@ -1836,6 +1836,52 @@ button._Menu-item_1tu16_55:hover {
1836
1836
  padding: 16px 24px;
1837
1837
  }
1838
1838
 
1839
+ /* css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/Header/styles.module.css/#css-module-data */
1840
+ ._Header_123cp_1 {
1841
+ height: 100%;
1842
+ width: 100%;
1843
+ }
1844
+ ._Header-tabs_123cp_6 {
1845
+ background-color: white;
1846
+ border-left: 1px solid var(--puck-color-grey-09);
1847
+ border-bottom: 1px solid var(--puck-color-grey-09);
1848
+ padding-left: var(--puck-user-left-side-bar-width);
1849
+ padding-right: var(--puck-user-right-side-bar-width);
1850
+ margin-left: 67px;
1851
+ }
1852
+ ._Header-tabsInner_123cp_15 {
1853
+ display: grid;
1854
+ grid-auto-flow: column;
1855
+ grid-auto-columns: minmax(0, 196px);
1856
+ width: 100%;
1857
+ padding-inline: 8px;
1858
+ white-space: nowrap;
1859
+ }
1860
+ ._HeaderTab_123cp_24 {
1861
+ min-width: 0;
1862
+ max-width: 196px;
1863
+ overflow: hidden;
1864
+ text-overflow: ellipsis;
1865
+ }
1866
+ ._HeaderTab-button_123cp_31 {
1867
+ display: block;
1868
+ border-bottom: 4px solid transparent;
1869
+ border-top: 4px solid transparent;
1870
+ font-size: var(--puck-font-size-xxxs);
1871
+ padding: 4px 8px;
1872
+ width: 100%;
1873
+ overflow: hidden;
1874
+ text-overflow: ellipsis;
1875
+ white-space: nowrap;
1876
+ }
1877
+ ._HeaderTab-button_123cp_31:hover {
1878
+ background-color: var(--puck-color-azure-11);
1879
+ cursor: pointer;
1880
+ }
1881
+ ._HeaderTab--active_123cp_48 ._HeaderTab-button_123cp_31 {
1882
+ border-bottom-color: var(--puck-color-azure-04);
1883
+ }
1884
+
1839
1885
  /* css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/HeaderActions/styles.module.css/#css-module-data */
1840
1886
  ._HeaderActions-publish_7nzbl_1 {
1841
1887
  position: relative;
@@ -1873,3 +1919,9 @@ button._Menu-item_1tu16_55:hover {
1873
1919
  margin-top: 2px;
1874
1920
  white-space: nowrap;
1875
1921
  }
1922
+
1923
+ /* css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/Preview/styles.module.css/#css-module-data */
1924
+ ._Preview_jituh_1 {
1925
+ height: 100%;
1926
+ width: 100%;
1927
+ }
package/dist/index.d.mts CHANGED
@@ -1,11 +1,29 @@
1
1
  import * as react from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { Data } from '@puckeditor/core';
4
+ import * as zustand from 'zustand';
3
5
 
4
6
  type PagePluginOptions = {
5
7
  host?: string;
6
8
  siteId?: string;
7
9
  parentOrigin?: string;
8
10
  };
11
+ type PageVersionStatus = "published" | "unpublished" | "error";
12
+ type PageVersion = {
13
+ id?: string;
14
+ data: Data;
15
+ status?: PageVersionStatus;
16
+ versionNumber?: number;
17
+ createdAt?: string;
18
+ updatedAt?: string;
19
+ isNew?: boolean;
20
+ };
21
+ type PageRecord = {
22
+ id?: string;
23
+ path: string;
24
+ status?: PageVersionStatus;
25
+ versions?: PageVersion[];
26
+ };
9
27
 
10
28
  declare function createPagesPlugin(opts?: PagePluginOptions): {
11
29
  label: string;
@@ -14,10 +32,35 @@ declare function createPagesPlugin(opts?: PagePluginOptions): {
14
32
  icon: react_jsx_runtime.JSX.Element;
15
33
  overrides: {
16
34
  headerActions: () => react_jsx_runtime.JSX.Element;
35
+ header: ({ children }: {
36
+ actions: react.ReactNode;
37
+ children: react.ReactNode;
38
+ }) => react_jsx_runtime.JSX.Element;
17
39
  preview: ({ children }: {
18
40
  children: react.ReactNode;
19
41
  }) => react_jsx_runtime.JSX.Element;
20
42
  };
21
43
  };
22
44
 
23
- export { createPagesPlugin };
45
+ type PagesStore = {
46
+ pagesData: PageRecord[];
47
+ setPages(data: PageRecord[]): void;
48
+ setPageVersions(pageId: string, versions: PageVersion[], path?: string): void;
49
+ createPage(path: string): void;
50
+ removePage(path: string): PageRecord | null;
51
+ activePage: string | null;
52
+ setActivePage(page: string | null): void;
53
+ activeVersion: string | null;
54
+ setActiveVersion(version: string | null): void;
55
+ buttonsDisabled: boolean;
56
+ setButtonsDisabled(value: boolean): void;
57
+ loading: boolean;
58
+ setLoading(value: boolean): void;
59
+ initialLoad: boolean;
60
+ setInitialLoad(value: boolean): void;
61
+ searchQuery: string;
62
+ setSearchQuery(query: string): void;
63
+ };
64
+ declare const usePagesStore: zustand.UseBoundStore<zustand.StoreApi<PagesStore>>;
65
+
66
+ export { createPagesPlugin, usePagesStore };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,29 @@
1
1
  import * as react from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { Data } from '@puckeditor/core';
4
+ import * as zustand from 'zustand';
3
5
 
4
6
  type PagePluginOptions = {
5
7
  host?: string;
6
8
  siteId?: string;
7
9
  parentOrigin?: string;
8
10
  };
11
+ type PageVersionStatus = "published" | "unpublished" | "error";
12
+ type PageVersion = {
13
+ id?: string;
14
+ data: Data;
15
+ status?: PageVersionStatus;
16
+ versionNumber?: number;
17
+ createdAt?: string;
18
+ updatedAt?: string;
19
+ isNew?: boolean;
20
+ };
21
+ type PageRecord = {
22
+ id?: string;
23
+ path: string;
24
+ status?: PageVersionStatus;
25
+ versions?: PageVersion[];
26
+ };
9
27
 
10
28
  declare function createPagesPlugin(opts?: PagePluginOptions): {
11
29
  label: string;
@@ -14,10 +32,35 @@ declare function createPagesPlugin(opts?: PagePluginOptions): {
14
32
  icon: react_jsx_runtime.JSX.Element;
15
33
  overrides: {
16
34
  headerActions: () => react_jsx_runtime.JSX.Element;
35
+ header: ({ children }: {
36
+ actions: react.ReactNode;
37
+ children: react.ReactNode;
38
+ }) => react_jsx_runtime.JSX.Element;
17
39
  preview: ({ children }: {
18
40
  children: react.ReactNode;
19
41
  }) => react_jsx_runtime.JSX.Element;
20
42
  };
21
43
  };
22
44
 
23
- export { createPagesPlugin };
45
+ type PagesStore = {
46
+ pagesData: PageRecord[];
47
+ setPages(data: PageRecord[]): void;
48
+ setPageVersions(pageId: string, versions: PageVersion[], path?: string): void;
49
+ createPage(path: string): void;
50
+ removePage(path: string): PageRecord | null;
51
+ activePage: string | null;
52
+ setActivePage(page: string | null): void;
53
+ activeVersion: string | null;
54
+ setActiveVersion(version: string | null): void;
55
+ buttonsDisabled: boolean;
56
+ setButtonsDisabled(value: boolean): void;
57
+ loading: boolean;
58
+ setLoading(value: boolean): void;
59
+ initialLoad: boolean;
60
+ setInitialLoad(value: boolean): void;
61
+ searchQuery: string;
62
+ setSearchQuery(query: string): void;
63
+ };
64
+ declare const usePagesStore: zustand.UseBoundStore<zustand.StoreApi<PagesStore>>;
65
+
66
+ export { createPagesPlugin, usePagesStore };
package/dist/index.js CHANGED
@@ -107,7 +107,8 @@ var require_classnames = __commonJS({
107
107
  // index.ts
108
108
  var index_exports = {};
109
109
  __export(index_exports, {
110
- createPagesPlugin: () => createPagesPlugin
110
+ createPagesPlugin: () => createPagesPlugin,
111
+ usePagesStore: () => usePagesStore
111
112
  });
112
113
  module.exports = __toCommonJS(index_exports);
113
114
  init_react_import();
@@ -12980,7 +12981,7 @@ var ctx = (0, import_react21.createContext)({});
12980
12981
 
12981
12982
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/PagePlugin/styles.module.css#css-module
12982
12983
  init_react_import();
12983
- var styles_module_default7 = { "Pages": "_Pages_ey49w_5", "Pages-addPage": "_Pages-addPage_ey49w_12", "Pages-loader": "_Pages-loader_ey49w_18", "Pages-list": "_Pages-list_ey49w_26", "Pages-search": "_Pages-search_ey49w_34", "Pages-searchInput": "_Pages-searchInput_ey49w_38", "PagesPage": "_PagesPage_ey49w_59", "PagesPage--expanded": "_PagesPage--expanded_ey49w_69", "PagesPage-versions": "_PagesPage-versions_ey49w_73", "PagesPage-header": "_PagesPage-header_ey49w_96", "PagesPage--active": "_PagesPage--active_ey49w_124", "PagesPage-headerMain": "_PagesPage-headerMain_ey49w_137", "PagesPage-headerIcon": "_PagesPage-headerIcon_ey49w_144", "PagesPage-loader": "_PagesPage-loader_ey49w_148", "PagesVersion": "_PagesVersion_ey49w_174", "PagesVersion-inner": "_PagesVersion-inner_ey49w_174", "PagesVersion--current": "_PagesVersion--current_ey49w_189", "PagesVersion-header": "_PagesVersion-header_ey49w_204", "PagesVersion-version": "_PagesVersion-version_ey49w_210", "PagesVersion-date": "_PagesVersion-date_ey49w_216" };
12984
+ var styles_module_default7 = { "Pages": "_Pages_jziur_5", "Pages-addPage": "_Pages-addPage_jziur_12", "Pages-loader": "_Pages-loader_jziur_18", "Pages-list": "_Pages-list_jziur_26", "Pages-search": "_Pages-search_jziur_34", "Pages-searchInput": "_Pages-searchInput_jziur_38", "PagesPage": "_PagesPage_jziur_59", "PagesPage--expanded": "_PagesPage--expanded_jziur_69", "PagesPage-versions": "_PagesPage-versions_jziur_73", "PagesPage-header": "_PagesPage-header_jziur_96", "PagesPage--active": "_PagesPage--active_jziur_125", "PagesPage-headerMain": "_PagesPage-headerMain_jziur_138", "PagesPage-headerIcon": "_PagesPage-headerIcon_jziur_145", "PagesPage-loader": "_PagesPage-loader_jziur_149", "PagesVersion": "_PagesVersion_jziur_175", "PagesVersion-inner": "_PagesVersion-inner_jziur_175", "PagesVersion--current": "_PagesVersion--current_jziur_190", "PagesVersion-header": "_PagesVersion-header_jziur_205", "PagesVersion-version": "_PagesVersion-version_jziur_211", "PagesVersion-date": "_PagesVersion-date_jziur_217" };
12984
12985
 
12985
12986
  // src/components/PagePlugin/index.tsx
12986
12987
  var import_react25 = require("react");
@@ -26909,9 +26910,7 @@ var usePagesStore = (0, import_zustand.create)((set3) => ({
26909
26910
  );
26910
26911
  return {
26911
26912
  ...state,
26912
- pagesData,
26913
- activePage: path,
26914
- activeVersion: null
26913
+ pagesData
26915
26914
  };
26916
26915
  }),
26917
26916
  removePage: (path) => {
@@ -26944,7 +26943,7 @@ var usePagesStore = (0, import_zustand.create)((set3) => ({
26944
26943
 
26945
26944
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/CreateForm/styles.module.css#css-module
26946
26945
  init_react_import();
26947
- var styles_module_default8 = { "CreateForm": "_CreateForm_kkdt2_1", "CreateForm-field": "_CreateForm-field_kkdt2_5", "CreateForm-label": "_CreateForm-label_kkdt2_13", "CreateForm-input": "_CreateForm-input_kkdt2_20", "CreateForm-error": "_CreateForm-error_kkdt2_43" };
26946
+ var styles_module_default8 = { "CreateForm": "_CreateForm_1tu67_1", "CreateForm-field": "_CreateForm-field_1tu67_4", "CreateForm-label": "_CreateForm-label_1tu67_12", "CreateForm-input": "_CreateForm-input_1tu67_19", "CreateForm-error": "_CreateForm-error_1tu67_42" };
26948
26947
 
26949
26948
  // src/components/CreateForm/index.tsx
26950
26949
  var import_jsx_runtime47 = require("react/jsx-runtime");
@@ -29617,19 +29616,73 @@ var PagePlugin = (opts) => {
29617
29616
  ] });
29618
29617
  };
29619
29618
 
29620
- // src/components/HeaderActions/index.tsx
29619
+ // src/components/Header/index.tsx
29621
29620
  init_react_import();
29622
- var import_core12 = require("@puckeditor/core");
29623
29621
  var import_react26 = require("react");
29624
29622
 
29623
+ // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/Header/styles.module.css#css-module
29624
+ init_react_import();
29625
+ var styles_module_default10 = { "Header": "_Header_123cp_1", "Header-tabs": "_Header-tabs_123cp_6", "Header-tabsInner": "_Header-tabsInner_123cp_15", "HeaderTab": "_HeaderTab_123cp_24", "HeaderTab-button": "_HeaderTab-button_123cp_31", "HeaderTab--active": "_HeaderTab--active_123cp_48" };
29626
+
29627
+ // src/components/Header/index.tsx
29628
+ var import_core12 = require("@puckeditor/core");
29629
+ var import_jsx_runtime51 = require("react/jsx-runtime");
29630
+ var cx10 = get_class_name_factory_default2("Header", styles_module_default10);
29631
+ var cxTab = get_class_name_factory_default2("HeaderTab", styles_module_default10);
29632
+ var Tab = ({ path }) => {
29633
+ const { setActivePage, activePage, pagesData } = usePagesStore();
29634
+ const getPuck = (0, import_core12.useGetPuck)();
29635
+ const page = (0, import_react26.useMemo)(
29636
+ () => pagesData.find((p2) => p2.path === path),
29637
+ [pagesData, path]
29638
+ );
29639
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("li", { className: cxTab({ active: activePage === path }), children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
29640
+ "button",
29641
+ {
29642
+ onClick: () => {
29643
+ setActivePage(path);
29644
+ const { dispatch, history, appState } = getPuck();
29645
+ const versionData = page?.versions?.[0].data;
29646
+ if (versionData) {
29647
+ history.setHistories([]);
29648
+ dispatch({
29649
+ type: "set",
29650
+ state: { ...appState, data: versionData }
29651
+ });
29652
+ }
29653
+ },
29654
+ className: cxTab("button"),
29655
+ children: path
29656
+ }
29657
+ ) }, path);
29658
+ };
29659
+ var Header = ({ children }) => {
29660
+ const { pagesData } = usePagesStore();
29661
+ const pagesWithVersions = (0, import_react26.useMemo)(
29662
+ () => pagesData.filter((p2) => p2.versions?.length),
29663
+ [pagesData]
29664
+ );
29665
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cx10(), children: [
29666
+ children,
29667
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cx10("tabs"), children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("ul", { className: cx10("tabsInner"), children: pagesWithVersions.map((page) => {
29668
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Tab, { path: page.path }, page.path);
29669
+ }) }) })
29670
+ ] });
29671
+ };
29672
+
29673
+ // src/components/HeaderActions/index.tsx
29674
+ init_react_import();
29675
+ var import_core13 = require("@puckeditor/core");
29676
+ var import_react27 = require("react");
29677
+
29625
29678
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/HeaderActions/styles.module.css#css-module
29626
29679
  init_react_import();
29627
- var styles_module_default10 = { "HeaderActions-publish": "_HeaderActions-publish_7nzbl_1", "HeaderActions-trigger": "_HeaderActions-trigger_7nzbl_7", "HeaderActions-versionHeader": "_HeaderActions-versionHeader_7nzbl_19", "HeaderActions-versionLabel": "_HeaderActions-versionLabel_7nzbl_26", "HeaderActions-versionDate": "_HeaderActions-versionDate_7nzbl_33" };
29680
+ var styles_module_default11 = { "HeaderActions-publish": "_HeaderActions-publish_7nzbl_1", "HeaderActions-trigger": "_HeaderActions-trigger_7nzbl_7", "HeaderActions-versionHeader": "_HeaderActions-versionHeader_7nzbl_19", "HeaderActions-versionLabel": "_HeaderActions-versionLabel_7nzbl_26", "HeaderActions-versionDate": "_HeaderActions-versionDate_7nzbl_33" };
29628
29681
 
29629
29682
  // src/components/HeaderActions/index.tsx
29630
- var import_jsx_runtime51 = require("react/jsx-runtime");
29631
- var usePuck = (0, import_core12.createUsePuck)();
29632
- var cx10 = getClassNameFactory2("HeaderActions", styles_module_default10);
29683
+ var import_jsx_runtime52 = require("react/jsx-runtime");
29684
+ var usePuck = (0, import_core13.createUsePuck)();
29685
+ var cx11 = getClassNameFactory2("HeaderActions", styles_module_default11);
29633
29686
  var TOAST_TIMEOUT = 5e3;
29634
29687
  var getDefaultPageVersion = (page) => page?.versions?.[0];
29635
29688
  var showPublishedToast = (path) => {
@@ -29679,12 +29732,12 @@ var showErrorToast = () => {
29679
29732
  });
29680
29733
  };
29681
29734
  var HeaderActions = (opts) => {
29682
- const getPuck = (0, import_core12.useGetPuck)();
29735
+ const getPuck = (0, import_core13.useGetPuck)();
29683
29736
  const parentOrigin = opts?.parentOrigin ?? "https://cloud.puckeditor.com";
29684
29737
  const siteIdHeader = useSiteId();
29685
29738
  const siteId = opts?.siteId ?? siteIdHeader;
29686
29739
  const host = opts?.host ?? "/api/puck/pages";
29687
- const [confirmAction, setConfirmAction] = (0, import_react26.useState)(null);
29740
+ const [confirmAction, setConfirmAction] = (0, import_react27.useState)(null);
29688
29741
  const {
29689
29742
  buttonsDisabled,
29690
29743
  setButtonsDisabled,
@@ -29698,7 +29751,7 @@ var HeaderActions = (opts) => {
29698
29751
  setActivePage,
29699
29752
  setActiveVersion
29700
29753
  } = usePagesStore();
29701
- const currentVersion = (0, import_react26.useMemo)(() => {
29754
+ const currentVersion = (0, import_react27.useMemo)(() => {
29702
29755
  if (activePage) {
29703
29756
  return getActiveVersion({
29704
29757
  pagesData,
@@ -29708,7 +29761,7 @@ var HeaderActions = (opts) => {
29708
29761
  }
29709
29762
  return void 0;
29710
29763
  }, [activePage, activeVersion, pagesData]);
29711
- const currentPage = (0, import_react26.useMemo)(
29764
+ const currentPage = (0, import_react27.useMemo)(
29712
29765
  () => pagesData.find((page) => page.path === activePage),
29713
29766
  [activePage, pagesData]
29714
29767
  );
@@ -29816,7 +29869,7 @@ var HeaderActions = (opts) => {
29816
29869
  const defaultVersion = getDefaultPageVersion(resolvedPage);
29817
29870
  replaceEditorState(defaultVersion?.data);
29818
29871
  };
29819
- const saving = (0, import_react26.useRef)(false);
29872
+ const saving = (0, import_react27.useRef)(false);
29820
29873
  const handleSaveDraft = async () => {
29821
29874
  if (saving.current) return;
29822
29875
  const path = activePage;
@@ -29853,7 +29906,7 @@ var HeaderActions = (opts) => {
29853
29906
  saving.current = false;
29854
29907
  }
29855
29908
  };
29856
- const publishing = (0, import_react26.useRef)(false);
29909
+ const publishing = (0, import_react27.useRef)(false);
29857
29910
  const handlePublish = async () => {
29858
29911
  if (publishing.current) return;
29859
29912
  const path = activePage;
@@ -29983,13 +30036,13 @@ var HeaderActions = (opts) => {
29983
30036
  onConfirm: handleUnpublish,
29984
30037
  title: "Unpublish page"
29985
30038
  };
29986
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
29987
- canvasIsDirty ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
29988
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cx10("version"), children: [
29989
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cx10("versionHeader"), children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cx10("versionLabel"), children: "Draft" }) }),
29990
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cx10("versionDate"), children: "Unsaved" })
30039
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
30040
+ canvasIsDirty ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
30041
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: cx11("version"), children: [
30042
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: cx11("versionHeader"), children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: cx11("versionLabel"), children: "Draft" }) }),
30043
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: cx11("versionDate"), children: "Unsaved" })
29991
30044
  ] }),
29992
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
30045
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
29993
30046
  Button,
29994
30047
  {
29995
30048
  variant: "secondary",
@@ -29998,32 +30051,32 @@ var HeaderActions = (opts) => {
29998
30051
  children: "Save"
29999
30052
  }
30000
30053
  )
30001
- ] }) : currentVersion ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cx10("version"), children: [
30002
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cx10("versionHeader"), children: [
30003
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cx10("versionLabel"), children: [
30054
+ ] }) : currentVersion ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: cx11("version"), children: [
30055
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: cx11("versionHeader"), children: [
30056
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: cx11("versionLabel"), children: [
30004
30057
  "v",
30005
30058
  currentVersion.versionNumber
30006
30059
  ] }),
30007
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
30060
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
30008
30061
  StatusTag,
30009
30062
  {
30010
30063
  status: currentVersion.status === "published" ? "live" : "draft"
30011
30064
  }
30012
30065
  ) })
30013
30066
  ] }),
30014
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cx10("versionDate"), children: currentVersion.createdAt ? format(currentVersion.createdAt, "MMM d yyy, HH:mm") : "" })
30067
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: cx11("versionDate"), children: currentVersion.createdAt ? format(currentVersion.createdAt, "MMM d yyy, HH:mm") : "" })
30015
30068
  ] }) }) : null,
30016
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cx10("publish"), children: [
30017
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
30069
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: cx11("publish"), children: [
30070
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
30018
30071
  Button,
30019
30072
  {
30020
30073
  disabled: publishDisabled,
30021
30074
  onClick: handlePublish,
30022
- icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Globe, { size: "12" }),
30075
+ icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Globe, { size: "12" }),
30023
30076
  children: canvasIsDirty ? "Save & publish" : "Publish"
30024
30077
  }
30025
30078
  ),
30026
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
30079
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
30027
30080
  Menu,
30028
30081
  {
30029
30082
  ariaLabel: "More publish actions",
@@ -30032,7 +30085,7 @@ var HeaderActions = (opts) => {
30032
30085
  [
30033
30086
  {
30034
30087
  disabled: unpublishDisabled,
30035
- icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(EyeOff, { size: 16 }),
30088
+ icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(EyeOff, { size: 16 }),
30036
30089
  label: "Unpublish",
30037
30090
  onClick: () => {
30038
30091
  setConfirmAction("unpublish");
@@ -30040,7 +30093,7 @@ var HeaderActions = (opts) => {
30040
30093
  },
30041
30094
  {
30042
30095
  disabled: deleteDisabled,
30043
- icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Trash, { size: 16 }),
30096
+ icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Trash, { size: 16 }),
30044
30097
  label: "Delete page",
30045
30098
  onClick: () => {
30046
30099
  setConfirmAction("delete");
@@ -30048,10 +30101,10 @@ var HeaderActions = (opts) => {
30048
30101
  }
30049
30102
  ]
30050
30103
  ],
30051
- children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: cx10("trigger"), children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ChevronDown, { size: 16 }) })
30104
+ children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: cx11("trigger"), children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ChevronDown, { size: 16 }) })
30052
30105
  }
30053
30106
  ),
30054
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
30107
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
30055
30108
  ConfirmModal,
30056
30109
  {
30057
30110
  visible: confirmAction !== null,
@@ -30068,41 +30121,41 @@ var HeaderActions = (opts) => {
30068
30121
 
30069
30122
  // src/components/Preview/index.tsx
30070
30123
  init_react_import();
30071
- var import_jsx_runtime52 = require("react/jsx-runtime");
30124
+
30125
+ // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/Preview/styles.module.css#css-module
30126
+ init_react_import();
30127
+ var styles_module_default12 = { "Preview": "_Preview_jituh_1" };
30128
+
30129
+ // src/components/Preview/index.tsx
30130
+ var import_jsx_runtime53 = require("react/jsx-runtime");
30131
+ var cx12 = get_class_name_factory_default2("Preview", styles_module_default12);
30072
30132
  var Preview = ({ children }) => {
30073
30133
  const { loading } = usePagesStore();
30074
30134
  if (loading) {
30075
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
30076
- "div",
30077
- {
30078
- style: {
30079
- height: "100%",
30080
- width: "100%"
30081
- },
30082
- children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Align, { horizontal: "center", vertical: "center", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Loader, {}) })
30083
- }
30084
- );
30135
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: cx12(), children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Align, { horizontal: "center", vertical: "center", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Loader, {}) }) });
30085
30136
  }
30086
- return children;
30137
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: cx12(), children });
30087
30138
  };
30088
30139
 
30089
30140
  // src/index.tsx
30090
- var import_jsx_runtime53 = require("react/jsx-runtime");
30141
+ var import_jsx_runtime54 = require("react/jsx-runtime");
30091
30142
  function createPagesPlugin(opts) {
30092
30143
  return {
30093
30144
  label: "Pages",
30094
30145
  name: "pages",
30095
- render: () => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PagePlugin, { ...opts }),
30096
- icon: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(FileText, {}),
30146
+ render: () => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PagePlugin, { ...opts }),
30147
+ icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FileText, {}),
30097
30148
  overrides: {
30098
- headerActions: () => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ToastWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(HeaderActions, { ...opts }) }),
30099
- preview: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Preview, { children })
30149
+ headerActions: () => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ToastWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(HeaderActions, { ...opts }) }),
30150
+ header: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Header, { children }),
30151
+ preview: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Preview, { children })
30100
30152
  }
30101
30153
  };
30102
30154
  }
30103
30155
  // Annotate the CommonJS export names for ESM import in node:
30104
30156
  0 && (module.exports = {
30105
- createPagesPlugin
30157
+ createPagesPlugin,
30158
+ usePagesStore
30106
30159
  });
30107
30160
  /*! Bundled license information:
30108
30161
 
package/dist/index.mjs CHANGED
@@ -5099,7 +5099,7 @@ init_react_import();
5099
5099
  // ../platform-client/components/AutoForm/AutoForm.tsx
5100
5100
  init_react_import();
5101
5101
  import { AutoField, FieldLabel } from "@puckeditor/core";
5102
- import { useEffect as useEffect11, useState as useState9 } from "react";
5102
+ import { useEffect as useEffect11, useRef as useRef9, useState as useState9 } from "react";
5103
5103
 
5104
5104
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/AutoForm/AutoForm.module.css#css-module
5105
5105
  init_react_import();
@@ -5185,7 +5185,7 @@ import { useEffect as useEffect12, useState as useState10 } from "react";
5185
5185
  import { jsx as jsx13 } from "react/jsx-runtime";
5186
5186
 
5187
5187
  // ../platform-client/components/Code/Code.tsx
5188
- import { useRef as useRef9, useState as useState11 } from "react";
5188
+ import { useRef as useRef10, useState as useState11 } from "react";
5189
5189
  import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
5190
5190
  var getClassName9 = get_class_name_factory_default2("Code", Code_module_default);
5191
5191
  var getClassNameTab = get_class_name_factory_default2("Tab", Code_module_default);
@@ -12925,7 +12925,7 @@ init_react_import();
12925
12925
 
12926
12926
  // ../platform-client/components/Table/Table.tsx
12927
12927
  init_react_import();
12928
- import { useEffect as useEffect28, useMemo as useMemo19, useRef as useRef20, useState as useState27 } from "react";
12928
+ import { useEffect as useEffect28, useMemo as useMemo19, useRef as useRef21, useState as useState27 } from "react";
12929
12929
 
12930
12930
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/Table/Table.module.css#css-module
12931
12931
  init_react_import();
@@ -12972,10 +12972,10 @@ var ctx = createContext9({});
12972
12972
 
12973
12973
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/PagePlugin/styles.module.css#css-module
12974
12974
  init_react_import();
12975
- var styles_module_default7 = { "Pages": "_Pages_ey49w_5", "Pages-addPage": "_Pages-addPage_ey49w_12", "Pages-loader": "_Pages-loader_ey49w_18", "Pages-list": "_Pages-list_ey49w_26", "Pages-search": "_Pages-search_ey49w_34", "Pages-searchInput": "_Pages-searchInput_ey49w_38", "PagesPage": "_PagesPage_ey49w_59", "PagesPage--expanded": "_PagesPage--expanded_ey49w_69", "PagesPage-versions": "_PagesPage-versions_ey49w_73", "PagesPage-header": "_PagesPage-header_ey49w_96", "PagesPage--active": "_PagesPage--active_ey49w_124", "PagesPage-headerMain": "_PagesPage-headerMain_ey49w_137", "PagesPage-headerIcon": "_PagesPage-headerIcon_ey49w_144", "PagesPage-loader": "_PagesPage-loader_ey49w_148", "PagesVersion": "_PagesVersion_ey49w_174", "PagesVersion-inner": "_PagesVersion-inner_ey49w_174", "PagesVersion--current": "_PagesVersion--current_ey49w_189", "PagesVersion-header": "_PagesVersion-header_ey49w_204", "PagesVersion-version": "_PagesVersion-version_ey49w_210", "PagesVersion-date": "_PagesVersion-date_ey49w_216" };
12975
+ var styles_module_default7 = { "Pages": "_Pages_jziur_5", "Pages-addPage": "_Pages-addPage_jziur_12", "Pages-loader": "_Pages-loader_jziur_18", "Pages-list": "_Pages-list_jziur_26", "Pages-search": "_Pages-search_jziur_34", "Pages-searchInput": "_Pages-searchInput_jziur_38", "PagesPage": "_PagesPage_jziur_59", "PagesPage--expanded": "_PagesPage--expanded_jziur_69", "PagesPage-versions": "_PagesPage-versions_jziur_73", "PagesPage-header": "_PagesPage-header_jziur_96", "PagesPage--active": "_PagesPage--active_jziur_125", "PagesPage-headerMain": "_PagesPage-headerMain_jziur_138", "PagesPage-headerIcon": "_PagesPage-headerIcon_jziur_145", "PagesPage-loader": "_PagesPage-loader_jziur_149", "PagesVersion": "_PagesVersion_jziur_175", "PagesVersion-inner": "_PagesVersion-inner_jziur_175", "PagesVersion--current": "_PagesVersion--current_jziur_190", "PagesVersion-header": "_PagesVersion-header_jziur_205", "PagesVersion-version": "_PagesVersion-version_jziur_211", "PagesVersion-date": "_PagesVersion-date_jziur_217" };
12976
12976
 
12977
12977
  // src/components/PagePlugin/index.tsx
12978
- import { useCallback as useCallback9, useEffect as useEffect29, useMemo as useMemo22, useRef as useRef21, useState as useState30 } from "react";
12978
+ import { useCallback as useCallback9, useEffect as useEffect29, useMemo as useMemo22, useRef as useRef22, useState as useState30 } from "react";
12979
12979
  import { resolveAllData as resolveAllData2, useGetPuck as useGetPuck2 } from "@puckeditor/core";
12980
12980
 
12981
12981
  // src/components/CreateForm/index.tsx
@@ -26901,9 +26901,7 @@ var usePagesStore = create((set3) => ({
26901
26901
  );
26902
26902
  return {
26903
26903
  ...state,
26904
- pagesData,
26905
- activePage: path,
26906
- activeVersion: null
26904
+ pagesData
26907
26905
  };
26908
26906
  }),
26909
26907
  removePage: (path) => {
@@ -26936,7 +26934,7 @@ var usePagesStore = create((set3) => ({
26936
26934
 
26937
26935
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/CreateForm/styles.module.css#css-module
26938
26936
  init_react_import();
26939
- var styles_module_default8 = { "CreateForm": "_CreateForm_kkdt2_1", "CreateForm-field": "_CreateForm-field_kkdt2_5", "CreateForm-label": "_CreateForm-label_kkdt2_13", "CreateForm-input": "_CreateForm-input_kkdt2_20", "CreateForm-error": "_CreateForm-error_kkdt2_43" };
26937
+ var styles_module_default8 = { "CreateForm": "_CreateForm_1tu67_1", "CreateForm-field": "_CreateForm-field_1tu67_4", "CreateForm-label": "_CreateForm-label_1tu67_12", "CreateForm-input": "_CreateForm-input_1tu67_19", "CreateForm-error": "_CreateForm-error_1tu67_42" };
26940
26938
 
26941
26939
  // src/components/CreateForm/index.tsx
26942
26940
  import { jsx as jsx40, jsxs as jsxs18 } from "react/jsx-runtime";
@@ -29282,7 +29280,7 @@ var PagePlugin = (opts) => {
29282
29280
  const getPuck = useGetPuck2();
29283
29281
  const [confirmModalOpen, setConfirmModalOpen] = useState30(false);
29284
29282
  const [pendingNavigation, setPendingNavigation] = useState30(null);
29285
- const lastRequestedPathRef = useRef21(void 0);
29283
+ const lastRequestedPathRef = useRef22(void 0);
29286
29284
  const parentOrigin = opts?.parentOrigin ?? "https://cloud.puckeditor.com";
29287
29285
  const siteIdHeader = useSiteId();
29288
29286
  const path = usePath();
@@ -29609,19 +29607,73 @@ var PagePlugin = (opts) => {
29609
29607
  ] });
29610
29608
  };
29611
29609
 
29610
+ // src/components/Header/index.tsx
29611
+ init_react_import();
29612
+ import { useMemo as useMemo23 } from "react";
29613
+
29614
+ // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/Header/styles.module.css#css-module
29615
+ init_react_import();
29616
+ var styles_module_default10 = { "Header": "_Header_123cp_1", "Header-tabs": "_Header-tabs_123cp_6", "Header-tabsInner": "_Header-tabsInner_123cp_15", "HeaderTab": "_HeaderTab_123cp_24", "HeaderTab-button": "_HeaderTab-button_123cp_31", "HeaderTab--active": "_HeaderTab--active_123cp_48" };
29617
+
29618
+ // src/components/Header/index.tsx
29619
+ import { useGetPuck as useGetPuck3 } from "@puckeditor/core";
29620
+ import { jsx as jsx44, jsxs as jsxs22 } from "react/jsx-runtime";
29621
+ var cx10 = get_class_name_factory_default2("Header", styles_module_default10);
29622
+ var cxTab = get_class_name_factory_default2("HeaderTab", styles_module_default10);
29623
+ var Tab = ({ path }) => {
29624
+ const { setActivePage, activePage, pagesData } = usePagesStore();
29625
+ const getPuck = useGetPuck3();
29626
+ const page = useMemo23(
29627
+ () => pagesData.find((p2) => p2.path === path),
29628
+ [pagesData, path]
29629
+ );
29630
+ return /* @__PURE__ */ jsx44("li", { className: cxTab({ active: activePage === path }), children: /* @__PURE__ */ jsx44(
29631
+ "button",
29632
+ {
29633
+ onClick: () => {
29634
+ setActivePage(path);
29635
+ const { dispatch, history, appState } = getPuck();
29636
+ const versionData = page?.versions?.[0].data;
29637
+ if (versionData) {
29638
+ history.setHistories([]);
29639
+ dispatch({
29640
+ type: "set",
29641
+ state: { ...appState, data: versionData }
29642
+ });
29643
+ }
29644
+ },
29645
+ className: cxTab("button"),
29646
+ children: path
29647
+ }
29648
+ ) }, path);
29649
+ };
29650
+ var Header = ({ children }) => {
29651
+ const { pagesData } = usePagesStore();
29652
+ const pagesWithVersions = useMemo23(
29653
+ () => pagesData.filter((p2) => p2.versions?.length),
29654
+ [pagesData]
29655
+ );
29656
+ return /* @__PURE__ */ jsxs22("div", { className: cx10(), children: [
29657
+ children,
29658
+ /* @__PURE__ */ jsx44("div", { className: cx10("tabs"), children: /* @__PURE__ */ jsx44("ul", { className: cx10("tabsInner"), children: pagesWithVersions.map((page) => {
29659
+ return /* @__PURE__ */ jsx44(Tab, { path: page.path }, page.path);
29660
+ }) }) })
29661
+ ] });
29662
+ };
29663
+
29612
29664
  // src/components/HeaderActions/index.tsx
29613
29665
  init_react_import();
29614
- import { createUsePuck, useGetPuck as useGetPuck3 } from "@puckeditor/core";
29615
- import { useMemo as useMemo23, useRef as useRef22, useState as useState31 } from "react";
29666
+ import { createUsePuck, useGetPuck as useGetPuck4 } from "@puckeditor/core";
29667
+ import { useMemo as useMemo24, useRef as useRef23, useState as useState31 } from "react";
29616
29668
 
29617
29669
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/HeaderActions/styles.module.css#css-module
29618
29670
  init_react_import();
29619
- var styles_module_default10 = { "HeaderActions-publish": "_HeaderActions-publish_7nzbl_1", "HeaderActions-trigger": "_HeaderActions-trigger_7nzbl_7", "HeaderActions-versionHeader": "_HeaderActions-versionHeader_7nzbl_19", "HeaderActions-versionLabel": "_HeaderActions-versionLabel_7nzbl_26", "HeaderActions-versionDate": "_HeaderActions-versionDate_7nzbl_33" };
29671
+ var styles_module_default11 = { "HeaderActions-publish": "_HeaderActions-publish_7nzbl_1", "HeaderActions-trigger": "_HeaderActions-trigger_7nzbl_7", "HeaderActions-versionHeader": "_HeaderActions-versionHeader_7nzbl_19", "HeaderActions-versionLabel": "_HeaderActions-versionLabel_7nzbl_26", "HeaderActions-versionDate": "_HeaderActions-versionDate_7nzbl_33" };
29620
29672
 
29621
29673
  // src/components/HeaderActions/index.tsx
29622
- import { Fragment as Fragment9, jsx as jsx44, jsxs as jsxs22 } from "react/jsx-runtime";
29674
+ import { Fragment as Fragment9, jsx as jsx45, jsxs as jsxs23 } from "react/jsx-runtime";
29623
29675
  var usePuck = createUsePuck();
29624
- var cx10 = getClassNameFactory2("HeaderActions", styles_module_default10);
29676
+ var cx11 = getClassNameFactory2("HeaderActions", styles_module_default11);
29625
29677
  var TOAST_TIMEOUT = 5e3;
29626
29678
  var getDefaultPageVersion = (page) => page?.versions?.[0];
29627
29679
  var showPublishedToast = (path) => {
@@ -29671,7 +29723,7 @@ var showErrorToast = () => {
29671
29723
  });
29672
29724
  };
29673
29725
  var HeaderActions = (opts) => {
29674
- const getPuck = useGetPuck3();
29726
+ const getPuck = useGetPuck4();
29675
29727
  const parentOrigin = opts?.parentOrigin ?? "https://cloud.puckeditor.com";
29676
29728
  const siteIdHeader = useSiteId();
29677
29729
  const siteId = opts?.siteId ?? siteIdHeader;
@@ -29690,7 +29742,7 @@ var HeaderActions = (opts) => {
29690
29742
  setActivePage,
29691
29743
  setActiveVersion
29692
29744
  } = usePagesStore();
29693
- const currentVersion = useMemo23(() => {
29745
+ const currentVersion = useMemo24(() => {
29694
29746
  if (activePage) {
29695
29747
  return getActiveVersion({
29696
29748
  pagesData,
@@ -29700,7 +29752,7 @@ var HeaderActions = (opts) => {
29700
29752
  }
29701
29753
  return void 0;
29702
29754
  }, [activePage, activeVersion, pagesData]);
29703
- const currentPage = useMemo23(
29755
+ const currentPage = useMemo24(
29704
29756
  () => pagesData.find((page) => page.path === activePage),
29705
29757
  [activePage, pagesData]
29706
29758
  );
@@ -29808,7 +29860,7 @@ var HeaderActions = (opts) => {
29808
29860
  const defaultVersion = getDefaultPageVersion(resolvedPage);
29809
29861
  replaceEditorState(defaultVersion?.data);
29810
29862
  };
29811
- const saving = useRef22(false);
29863
+ const saving = useRef23(false);
29812
29864
  const handleSaveDraft = async () => {
29813
29865
  if (saving.current) return;
29814
29866
  const path = activePage;
@@ -29845,7 +29897,7 @@ var HeaderActions = (opts) => {
29845
29897
  saving.current = false;
29846
29898
  }
29847
29899
  };
29848
- const publishing = useRef22(false);
29900
+ const publishing = useRef23(false);
29849
29901
  const handlePublish = async () => {
29850
29902
  if (publishing.current) return;
29851
29903
  const path = activePage;
@@ -29975,13 +30027,13 @@ var HeaderActions = (opts) => {
29975
30027
  onConfirm: handleUnpublish,
29976
30028
  title: "Unpublish page"
29977
30029
  };
29978
- return /* @__PURE__ */ jsxs22(Fragment9, { children: [
29979
- canvasIsDirty ? /* @__PURE__ */ jsxs22(Fragment9, { children: [
29980
- /* @__PURE__ */ jsxs22("div", { className: cx10("version"), children: [
29981
- /* @__PURE__ */ jsx44("div", { className: cx10("versionHeader"), children: /* @__PURE__ */ jsx44("div", { className: cx10("versionLabel"), children: "Draft" }) }),
29982
- /* @__PURE__ */ jsx44("div", { className: cx10("versionDate"), children: "Unsaved" })
30030
+ return /* @__PURE__ */ jsxs23(Fragment9, { children: [
30031
+ canvasIsDirty ? /* @__PURE__ */ jsxs23(Fragment9, { children: [
30032
+ /* @__PURE__ */ jsxs23("div", { className: cx11("version"), children: [
30033
+ /* @__PURE__ */ jsx45("div", { className: cx11("versionHeader"), children: /* @__PURE__ */ jsx45("div", { className: cx11("versionLabel"), children: "Draft" }) }),
30034
+ /* @__PURE__ */ jsx45("div", { className: cx11("versionDate"), children: "Unsaved" })
29983
30035
  ] }),
29984
- /* @__PURE__ */ jsx44(
30036
+ /* @__PURE__ */ jsx45(
29985
30037
  Button,
29986
30038
  {
29987
30039
  variant: "secondary",
@@ -29990,32 +30042,32 @@ var HeaderActions = (opts) => {
29990
30042
  children: "Save"
29991
30043
  }
29992
30044
  )
29993
- ] }) : currentVersion ? /* @__PURE__ */ jsx44(Fragment9, { children: /* @__PURE__ */ jsxs22("div", { className: cx10("version"), children: [
29994
- /* @__PURE__ */ jsxs22("div", { className: cx10("versionHeader"), children: [
29995
- /* @__PURE__ */ jsxs22("div", { className: cx10("versionLabel"), children: [
30045
+ ] }) : currentVersion ? /* @__PURE__ */ jsx45(Fragment9, { children: /* @__PURE__ */ jsxs23("div", { className: cx11("version"), children: [
30046
+ /* @__PURE__ */ jsxs23("div", { className: cx11("versionHeader"), children: [
30047
+ /* @__PURE__ */ jsxs23("div", { className: cx11("versionLabel"), children: [
29996
30048
  "v",
29997
30049
  currentVersion.versionNumber
29998
30050
  ] }),
29999
- /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(
30051
+ /* @__PURE__ */ jsx45("div", { children: /* @__PURE__ */ jsx45(
30000
30052
  StatusTag,
30001
30053
  {
30002
30054
  status: currentVersion.status === "published" ? "live" : "draft"
30003
30055
  }
30004
30056
  ) })
30005
30057
  ] }),
30006
- /* @__PURE__ */ jsx44("div", { className: cx10("versionDate"), children: currentVersion.createdAt ? format(currentVersion.createdAt, "MMM d yyy, HH:mm") : "" })
30058
+ /* @__PURE__ */ jsx45("div", { className: cx11("versionDate"), children: currentVersion.createdAt ? format(currentVersion.createdAt, "MMM d yyy, HH:mm") : "" })
30007
30059
  ] }) }) : null,
30008
- /* @__PURE__ */ jsxs22("div", { className: cx10("publish"), children: [
30009
- /* @__PURE__ */ jsx44(
30060
+ /* @__PURE__ */ jsxs23("div", { className: cx11("publish"), children: [
30061
+ /* @__PURE__ */ jsx45(
30010
30062
  Button,
30011
30063
  {
30012
30064
  disabled: publishDisabled,
30013
30065
  onClick: handlePublish,
30014
- icon: /* @__PURE__ */ jsx44(Globe, { size: "12" }),
30066
+ icon: /* @__PURE__ */ jsx45(Globe, { size: "12" }),
30015
30067
  children: canvasIsDirty ? "Save & publish" : "Publish"
30016
30068
  }
30017
30069
  ),
30018
- /* @__PURE__ */ jsx44(
30070
+ /* @__PURE__ */ jsx45(
30019
30071
  Menu,
30020
30072
  {
30021
30073
  ariaLabel: "More publish actions",
@@ -30024,7 +30076,7 @@ var HeaderActions = (opts) => {
30024
30076
  [
30025
30077
  {
30026
30078
  disabled: unpublishDisabled,
30027
- icon: /* @__PURE__ */ jsx44(EyeOff, { size: 16 }),
30079
+ icon: /* @__PURE__ */ jsx45(EyeOff, { size: 16 }),
30028
30080
  label: "Unpublish",
30029
30081
  onClick: () => {
30030
30082
  setConfirmAction("unpublish");
@@ -30032,7 +30084,7 @@ var HeaderActions = (opts) => {
30032
30084
  },
30033
30085
  {
30034
30086
  disabled: deleteDisabled,
30035
- icon: /* @__PURE__ */ jsx44(Trash, { size: 16 }),
30087
+ icon: /* @__PURE__ */ jsx45(Trash, { size: 16 }),
30036
30088
  label: "Delete page",
30037
30089
  onClick: () => {
30038
30090
  setConfirmAction("delete");
@@ -30040,10 +30092,10 @@ var HeaderActions = (opts) => {
30040
30092
  }
30041
30093
  ]
30042
30094
  ],
30043
- children: /* @__PURE__ */ jsx44("span", { className: cx10("trigger"), children: /* @__PURE__ */ jsx44(ChevronDown, { size: 16 }) })
30095
+ children: /* @__PURE__ */ jsx45("span", { className: cx11("trigger"), children: /* @__PURE__ */ jsx45(ChevronDown, { size: 16 }) })
30044
30096
  }
30045
30097
  ),
30046
- /* @__PURE__ */ jsx44(
30098
+ /* @__PURE__ */ jsx45(
30047
30099
  ConfirmModal,
30048
30100
  {
30049
30101
  visible: confirmAction !== null,
@@ -30060,40 +30112,40 @@ var HeaderActions = (opts) => {
30060
30112
 
30061
30113
  // src/components/Preview/index.tsx
30062
30114
  init_react_import();
30063
- import { jsx as jsx45 } from "react/jsx-runtime";
30115
+
30116
+ // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/Preview/styles.module.css#css-module
30117
+ init_react_import();
30118
+ var styles_module_default12 = { "Preview": "_Preview_jituh_1" };
30119
+
30120
+ // src/components/Preview/index.tsx
30121
+ import { jsx as jsx46 } from "react/jsx-runtime";
30122
+ var cx12 = get_class_name_factory_default2("Preview", styles_module_default12);
30064
30123
  var Preview = ({ children }) => {
30065
30124
  const { loading } = usePagesStore();
30066
30125
  if (loading) {
30067
- return /* @__PURE__ */ jsx45(
30068
- "div",
30069
- {
30070
- style: {
30071
- height: "100%",
30072
- width: "100%"
30073
- },
30074
- children: /* @__PURE__ */ jsx45(Align, { horizontal: "center", vertical: "center", children: /* @__PURE__ */ jsx45(Loader, {}) })
30075
- }
30076
- );
30126
+ return /* @__PURE__ */ jsx46("div", { className: cx12(), children: /* @__PURE__ */ jsx46(Align, { horizontal: "center", vertical: "center", children: /* @__PURE__ */ jsx46(Loader, {}) }) });
30077
30127
  }
30078
- return children;
30128
+ return /* @__PURE__ */ jsx46("div", { className: cx12(), children });
30079
30129
  };
30080
30130
 
30081
30131
  // src/index.tsx
30082
- import { jsx as jsx46 } from "react/jsx-runtime";
30132
+ import { jsx as jsx47 } from "react/jsx-runtime";
30083
30133
  function createPagesPlugin(opts) {
30084
30134
  return {
30085
30135
  label: "Pages",
30086
30136
  name: "pages",
30087
- render: () => /* @__PURE__ */ jsx46(PagePlugin, { ...opts }),
30088
- icon: /* @__PURE__ */ jsx46(FileText, {}),
30137
+ render: () => /* @__PURE__ */ jsx47(PagePlugin, { ...opts }),
30138
+ icon: /* @__PURE__ */ jsx47(FileText, {}),
30089
30139
  overrides: {
30090
- headerActions: () => /* @__PURE__ */ jsx46(ToastWrapper, { children: /* @__PURE__ */ jsx46(HeaderActions, { ...opts }) }),
30091
- preview: ({ children }) => /* @__PURE__ */ jsx46(Preview, { children })
30140
+ headerActions: () => /* @__PURE__ */ jsx47(ToastWrapper, { children: /* @__PURE__ */ jsx47(HeaderActions, { ...opts }) }),
30141
+ header: ({ children }) => /* @__PURE__ */ jsx47(Header, { children }),
30142
+ preview: ({ children }) => /* @__PURE__ */ jsx47(Preview, { children })
30092
30143
  }
30093
30144
  };
30094
30145
  }
30095
30146
  export {
30096
- createPagesPlugin
30147
+ createPagesPlugin,
30148
+ usePagesStore
30097
30149
  };
30098
30150
  /*! Bundled license information:
30099
30151
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puckeditor/plugin-pages",
3
- "version": "0.6.1-canary.4a204adc",
3
+ "version": "0.6.1-canary.7fc6a4c9",
4
4
  "author": "Chris Villa <chris@puckeditor.com>",
5
5
  "repository": "puckeditor/puck",
6
6
  "bugs": "https://github.com/puckeditor/puck/issues",