@puckeditor/plugin-pages 0.6.1-canary.433ca837 → 0.6.1-canary.45a1a2e4

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_jziur_5 {
1544
+ ._Pages_ey49w_5 {
1545
1545
  display: flex;
1546
1546
  flex-direction: column;
1547
1547
  height: 100%;
1548
1548
  padding: 16px;
1549
1549
  }
1550
- ._Pages-addPage_jziur_12 {
1550
+ ._Pages-addPage_ey49w_12 {
1551
1551
  margin-bottom: 16px;
1552
1552
  display: flex;
1553
1553
  gap: 8px;
1554
1554
  }
1555
- ._Pages-loader_jziur_18 {
1555
+ ._Pages-loader_ey49w_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_jziur_26 {
1562
+ ._Pages-list_ey49w_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_jziur_34 {
1569
+ ._Pages-search_ey49w_34 {
1570
1570
  flex-grow: 1;
1571
1571
  }
1572
- ._Pages-searchInput_jziur_38 {
1572
+ ._Pages-searchInput_ey49w_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_jziur_38:focus {
1583
+ ._Pages-searchInput_ey49w_38:focus {
1584
1584
  outline: 2px solid var(--puck-color-azure-04);
1585
1585
  outline-offset: -1px;
1586
1586
  }
1587
- ._PagesPage_jziur_59 {
1587
+ ._PagesPage_ey49w_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_jziur_69 {
1596
+ ._PagesPage--expanded_ey49w_69 {
1597
1597
  min-height: calc(34px + 1px + 55px);
1598
1598
  }
1599
- ._PagesPage--expanded_jziur_69:has(._PagesPage-versions_jziur_73 > :nth-child(2)) {
1599
+ ._PagesPage--expanded_ey49w_69:has(._PagesPage-versions_ey49w_73 > :nth-child(2)) {
1600
1600
  min-height: calc(34px + 1px + 55px + 1px + 55px);
1601
1601
  }
1602
- ._PagesPage--expanded_jziur_69:has(._PagesPage-versions_jziur_73 > :nth-child(3)) {
1602
+ ._PagesPage--expanded_ey49w_69:has(._PagesPage-versions_ey49w_73 > :nth-child(3)) {
1603
1603
  min-height: calc(34px + 1px + 55px + 1px + 55px + 1px + 55px);
1604
1604
  }
1605
- ._PagesPage--expanded_jziur_69 {
1605
+ ._PagesPage--expanded_ey49w_69 {
1606
1606
  flex-shrink: 1;
1607
1607
  }
1608
- ._PagesPage_jziur_59:first-of-type {
1608
+ ._PagesPage_ey49w_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_jziur_59:last-of-type {
1613
+ ._PagesPage_ey49w_59:last-of-type {
1614
1614
  border-bottom-left-radius: 8px;
1615
1615
  border-bottom-right-radius: 8px;
1616
1616
  }
1617
- ._PagesPage-header_jziur_96 {
1617
+ ._PagesPage-header_ey49w_96 {
1618
1618
  align-items: center;
1619
1619
  background-color: white;
1620
1620
  font-family: var(--puck-font-family-monospaced);
@@ -1625,40 +1625,39 @@ 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;
1629
1628
  }
1630
- ._PagesPage_jziur_59:first-of-type ._PagesPage-header_jziur_96 {
1629
+ ._PagesPage_ey49w_59:first-of-type ._PagesPage-header_ey49w_96 {
1631
1630
  border-top-left-radius: 8px;
1632
1631
  border-top-right-radius: 8px;
1633
1632
  }
1634
- ._PagesPage_jziur_59:last-of-type:not(._PagesPage--expanded_jziur_69) ._PagesPage-header_jziur_96 {
1633
+ ._PagesPage_ey49w_59:last-of-type:not(._PagesPage--expanded_ey49w_69) ._PagesPage-header_ey49w_96 {
1635
1634
  border-bottom-left-radius: 8px;
1636
1635
  border-bottom-right-radius: 8px;
1637
1636
  }
1638
- ._PagesPage-header_jziur_96:focus-visible {
1637
+ ._PagesPage-header_ey49w_96:focus-visible {
1639
1638
  outline: 2px solid var(--puck-color-azure-04);
1640
1639
  outline-offset: -2px;
1641
1640
  }
1642
- ._PagesPage--active_jziur_125 ._PagesPage-header_jziur_96 {
1641
+ ._PagesPage--active_ey49w_124 ._PagesPage-header_ey49w_96 {
1643
1642
  color: var(--puck-color-azure-04);
1644
1643
  }
1645
- ._PagesPage--expanded_jziur_69 ._PagesPage-header_jziur_96 {
1644
+ ._PagesPage--expanded_ey49w_69 ._PagesPage-header_ey49w_96 {
1646
1645
  border-bottom: 1px solid var(--puck-color-grey-10);
1647
1646
  }
1648
- ._PagesPage-header_jziur_96:hover {
1647
+ ._PagesPage-header_ey49w_96:hover {
1649
1648
  background: var(--puck-color-azure-11);
1650
1649
  color: var(--puck-color-azure-04);
1651
1650
  }
1652
- ._PagesPage-headerMain_jziur_138 {
1651
+ ._PagesPage-headerMain_ey49w_137 {
1653
1652
  display: flex;
1654
1653
  gap: 4px;
1655
1654
  justify-content: space-between;
1656
1655
  width: 100%;
1657
1656
  }
1658
- ._PagesPage-headerIcon_jziur_145 {
1657
+ ._PagesPage-headerIcon_ey49w_144 {
1659
1658
  color: var(--puck-color-grey-04);
1660
1659
  }
1661
- ._PagesPage-loader_jziur_149 {
1660
+ ._PagesPage-loader_ey49w_148 {
1662
1661
  align-items: center;
1663
1662
  background-color: white;
1664
1663
  display: none;
@@ -1666,17 +1665,17 @@ button._Menu-item_1tu16_55:hover {
1666
1665
  padding: 16px;
1667
1666
  height: 100%;
1668
1667
  }
1669
- ._PagesPage--expanded_jziur_69 ._PagesPage-loader_jziur_149 {
1668
+ ._PagesPage--expanded_ey49w_69 ._PagesPage-loader_ey49w_148 {
1670
1669
  display: flex;
1671
1670
  }
1672
- ._PagesPage-versions_jziur_73 {
1671
+ ._PagesPage-versions_ey49w_73 {
1673
1672
  display: none;
1674
1673
  overflow-y: auto;
1675
1674
  }
1676
- ._PagesPage--expanded_jziur_69 ._PagesPage-versions_jziur_73 {
1675
+ ._PagesPage--expanded_ey49w_69 ._PagesPage-versions_ey49w_73 {
1677
1676
  display: block;
1678
1677
  }
1679
- ._PagesVersion_jziur_175 ._PagesVersion-inner_jziur_175 {
1678
+ ._PagesVersion_ey49w_174 ._PagesVersion-inner_ey49w_174 {
1680
1679
  background-color: white;
1681
1680
  border-top: 1px solid var(--puck-color-grey-10);
1682
1681
  padding-bottom: 12px;
@@ -1686,32 +1685,32 @@ button._Menu-item_1tu16_55:hover {
1686
1685
  text-align: left;
1687
1686
  width: 100%;
1688
1687
  }
1689
- ._PagesVersion_jziur_175:first-of-type ._PagesVersion-inner_jziur_175 {
1688
+ ._PagesVersion_ey49w_174:first-of-type ._PagesVersion-inner_ey49w_174 {
1690
1689
  border-top: none;
1691
1690
  }
1692
- ._PagesVersion--current_jziur_190 ._PagesVersion-inner_jziur_175 {
1691
+ ._PagesVersion--current_ey49w_189 ._PagesVersion-inner_ey49w_174 {
1693
1692
  border-right: 3px solid var(--puck-color-azure-04);
1694
1693
  }
1695
- ._PagesVersion-inner_jziur_175:hover {
1694
+ ._PagesVersion-inner_ey49w_174:hover {
1696
1695
  background-color: var(--puck-color-azure-11);
1697
1696
  color: var(--puck-color-azure-04);
1698
1697
  cursor: pointer;
1699
1698
  }
1700
- ._PagesVersion-inner_jziur_175:focus-visible {
1699
+ ._PagesVersion-inner_ey49w_174:focus-visible {
1701
1700
  outline: 2px solid var(--puck-color-azure-04);
1702
1701
  outline-offset: -2px;
1703
1702
  }
1704
- ._PagesVersion-header_jziur_205 {
1703
+ ._PagesVersion-header_ey49w_204 {
1705
1704
  align-items: center;
1706
1705
  display: flex;
1707
1706
  gap: 4px;
1708
1707
  }
1709
- ._PagesVersion-version_jziur_211 {
1708
+ ._PagesVersion-version_ey49w_210 {
1710
1709
  font-family: var(--puck-font-family-monospaced);
1711
1710
  font-weight: 600;
1712
1711
  line-height: 1;
1713
1712
  }
1714
- ._PagesVersion-date_jziur_217 {
1713
+ ._PagesVersion-date_ey49w_216 {
1715
1714
  color: var(--puck-color-grey-06);
1716
1715
  font-size: var(--puck-font-size-xxxs);
1717
1716
  font-weight: 500;
@@ -1722,22 +1721,23 @@ button._Menu-item_1tu16_55:hover {
1722
1721
  }
1723
1722
 
1724
1723
  /* css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/CreateForm/styles.module.css/#css-module-data */
1725
- ._CreateForm_1tu67_1 {
1724
+ ._CreateForm_kkdt2_1 {
1725
+ width: 100%;
1726
1726
  }
1727
- ._CreateForm-field_1tu67_4 {
1727
+ ._CreateForm-field_kkdt2_5 {
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_1tu67_12 {
1734
+ ._CreateForm-label_kkdt2_13 {
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_1tu67_19 {
1740
+ ._CreateForm-input_kkdt2_20 {
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_1tu67_19:focus {
1753
+ ._CreateForm-input_kkdt2_20:focus {
1754
1754
  outline: 2px solid var(--puck-color-azure-04);
1755
1755
  outline-offset: -1px;
1756
1756
  }
1757
- ._CreateForm-input_1tu67_19::placeholder {
1757
+ ._CreateForm-input_kkdt2_20::placeholder {
1758
1758
  color: var(--puck-color-grey-06);
1759
1759
  }
1760
- ._CreateForm-error_1tu67_42 {
1760
+ ._CreateForm-error_kkdt2_43 {
1761
1761
  width: 100%;
1762
1762
  margin-top: 16px;
1763
1763
  color: var(--puck-color-red-05);
@@ -1836,52 +1836,6 @@ 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
-
1885
1839
  /* css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/HeaderActions/styles.module.css/#css-module-data */
1886
1840
  ._HeaderActions-publish_7nzbl_1 {
1887
1841
  position: relative;
@@ -1919,9 +1873,3 @@ button._Menu-item_1tu16_55:hover {
1919
1873
  margin-top: 2px;
1920
1874
  white-space: nowrap;
1921
1875
  }
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,29 +1,11 @@
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';
5
3
 
6
4
  type PagePluginOptions = {
7
5
  host?: string;
8
6
  siteId?: string;
9
7
  parentOrigin?: string;
10
8
  };
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
- };
27
9
 
28
10
  declare function createPagesPlugin(opts?: PagePluginOptions): {
29
11
  label: string;
@@ -32,35 +14,10 @@ declare function createPagesPlugin(opts?: PagePluginOptions): {
32
14
  icon: react_jsx_runtime.JSX.Element;
33
15
  overrides: {
34
16
  headerActions: () => react_jsx_runtime.JSX.Element;
35
- header: ({ children }: {
36
- actions: react.ReactNode;
37
- children: react.ReactNode;
38
- }) => react_jsx_runtime.JSX.Element;
39
17
  preview: ({ children }: {
40
18
  children: react.ReactNode;
41
19
  }) => react_jsx_runtime.JSX.Element;
42
20
  };
43
21
  };
44
22
 
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 };
23
+ export { createPagesPlugin };
package/dist/index.d.ts CHANGED
@@ -1,29 +1,11 @@
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';
5
3
 
6
4
  type PagePluginOptions = {
7
5
  host?: string;
8
6
  siteId?: string;
9
7
  parentOrigin?: string;
10
8
  };
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
- };
27
9
 
28
10
  declare function createPagesPlugin(opts?: PagePluginOptions): {
29
11
  label: string;
@@ -32,35 +14,10 @@ declare function createPagesPlugin(opts?: PagePluginOptions): {
32
14
  icon: react_jsx_runtime.JSX.Element;
33
15
  overrides: {
34
16
  headerActions: () => react_jsx_runtime.JSX.Element;
35
- header: ({ children }: {
36
- actions: react.ReactNode;
37
- children: react.ReactNode;
38
- }) => react_jsx_runtime.JSX.Element;
39
17
  preview: ({ children }: {
40
18
  children: react.ReactNode;
41
19
  }) => react_jsx_runtime.JSX.Element;
42
20
  };
43
21
  };
44
22
 
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 };
23
+ export { createPagesPlugin };
package/dist/index.js CHANGED
@@ -107,8 +107,7 @@ var require_classnames = __commonJS({
107
107
  // index.ts
108
108
  var index_exports = {};
109
109
  __export(index_exports, {
110
- createPagesPlugin: () => createPagesPlugin,
111
- usePagesStore: () => usePagesStore
110
+ createPagesPlugin: () => createPagesPlugin
112
111
  });
113
112
  module.exports = __toCommonJS(index_exports);
114
113
  init_react_import();
@@ -12981,7 +12980,7 @@ var ctx = (0, import_react21.createContext)({});
12981
12980
 
12982
12981
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/PagePlugin/styles.module.css#css-module
12983
12982
  init_react_import();
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" };
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" };
12985
12984
 
12986
12985
  // src/components/PagePlugin/index.tsx
12987
12986
  var import_react25 = require("react");
@@ -26910,7 +26909,9 @@ var usePagesStore = (0, import_zustand.create)((set3) => ({
26910
26909
  );
26911
26910
  return {
26912
26911
  ...state,
26913
- pagesData
26912
+ pagesData,
26913
+ activePage: path,
26914
+ activeVersion: null
26914
26915
  };
26915
26916
  }),
26916
26917
  removePage: (path) => {
@@ -26943,7 +26944,7 @@ var usePagesStore = (0, import_zustand.create)((set3) => ({
26943
26944
 
26944
26945
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/CreateForm/styles.module.css#css-module
26945
26946
  init_react_import();
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" };
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" };
26947
26948
 
26948
26949
  // src/components/CreateForm/index.tsx
26949
26950
  var import_jsx_runtime47 = require("react/jsx-runtime");
@@ -29616,73 +29617,19 @@ var PagePlugin = (opts) => {
29616
29617
  ] });
29617
29618
  };
29618
29619
 
29619
- // src/components/Header/index.tsx
29620
- init_react_import();
29621
- var import_react26 = require("react");
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
29620
  // src/components/HeaderActions/index.tsx
29674
29621
  init_react_import();
29675
- var import_core13 = require("@puckeditor/core");
29676
- var import_react27 = require("react");
29622
+ var import_core12 = require("@puckeditor/core");
29623
+ var import_react26 = require("react");
29677
29624
 
29678
29625
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/HeaderActions/styles.module.css#css-module
29679
29626
  init_react_import();
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" };
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" };
29681
29628
 
29682
29629
  // src/components/HeaderActions/index.tsx
29683
- var import_jsx_runtime52 = require("react/jsx-runtime");
29684
- var usePuck = (0, import_core13.createUsePuck)();
29685
- var cx11 = getClassNameFactory2("HeaderActions", styles_module_default11);
29630
+ var import_jsx_runtime51 = require("react/jsx-runtime");
29631
+ var usePuck = (0, import_core12.createUsePuck)();
29632
+ var cx10 = getClassNameFactory2("HeaderActions", styles_module_default10);
29686
29633
  var TOAST_TIMEOUT = 5e3;
29687
29634
  var getDefaultPageVersion = (page) => page?.versions?.[0];
29688
29635
  var showPublishedToast = (path) => {
@@ -29732,12 +29679,12 @@ var showErrorToast = () => {
29732
29679
  });
29733
29680
  };
29734
29681
  var HeaderActions = (opts) => {
29735
- const getPuck = (0, import_core13.useGetPuck)();
29682
+ const getPuck = (0, import_core12.useGetPuck)();
29736
29683
  const parentOrigin = opts?.parentOrigin ?? "https://cloud.puckeditor.com";
29737
29684
  const siteIdHeader = useSiteId();
29738
29685
  const siteId = opts?.siteId ?? siteIdHeader;
29739
29686
  const host = opts?.host ?? "/api/puck/pages";
29740
- const [confirmAction, setConfirmAction] = (0, import_react27.useState)(null);
29687
+ const [confirmAction, setConfirmAction] = (0, import_react26.useState)(null);
29741
29688
  const {
29742
29689
  buttonsDisabled,
29743
29690
  setButtonsDisabled,
@@ -29751,7 +29698,7 @@ var HeaderActions = (opts) => {
29751
29698
  setActivePage,
29752
29699
  setActiveVersion
29753
29700
  } = usePagesStore();
29754
- const currentVersion = (0, import_react27.useMemo)(() => {
29701
+ const currentVersion = (0, import_react26.useMemo)(() => {
29755
29702
  if (activePage) {
29756
29703
  return getActiveVersion({
29757
29704
  pagesData,
@@ -29761,7 +29708,7 @@ var HeaderActions = (opts) => {
29761
29708
  }
29762
29709
  return void 0;
29763
29710
  }, [activePage, activeVersion, pagesData]);
29764
- const currentPage = (0, import_react27.useMemo)(
29711
+ const currentPage = (0, import_react26.useMemo)(
29765
29712
  () => pagesData.find((page) => page.path === activePage),
29766
29713
  [activePage, pagesData]
29767
29714
  );
@@ -29869,7 +29816,7 @@ var HeaderActions = (opts) => {
29869
29816
  const defaultVersion = getDefaultPageVersion(resolvedPage);
29870
29817
  replaceEditorState(defaultVersion?.data);
29871
29818
  };
29872
- const saving = (0, import_react27.useRef)(false);
29819
+ const saving = (0, import_react26.useRef)(false);
29873
29820
  const handleSaveDraft = async () => {
29874
29821
  if (saving.current) return;
29875
29822
  const path = activePage;
@@ -29906,7 +29853,7 @@ var HeaderActions = (opts) => {
29906
29853
  saving.current = false;
29907
29854
  }
29908
29855
  };
29909
- const publishing = (0, import_react27.useRef)(false);
29856
+ const publishing = (0, import_react26.useRef)(false);
29910
29857
  const handlePublish = async () => {
29911
29858
  if (publishing.current) return;
29912
29859
  const path = activePage;
@@ -30036,13 +29983,13 @@ var HeaderActions = (opts) => {
30036
29983
  onConfirm: handleUnpublish,
30037
29984
  title: "Unpublish page"
30038
29985
  };
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" })
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" })
30044
29991
  ] }),
30045
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
29992
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
30046
29993
  Button,
30047
29994
  {
30048
29995
  variant: "secondary",
@@ -30051,32 +29998,32 @@ var HeaderActions = (opts) => {
30051
29998
  children: "Save"
30052
29999
  }
30053
30000
  )
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: [
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: [
30057
30004
  "v",
30058
30005
  currentVersion.versionNumber
30059
30006
  ] }),
30060
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
30007
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
30061
30008
  StatusTag,
30062
30009
  {
30063
30010
  status: currentVersion.status === "published" ? "live" : "draft"
30064
30011
  }
30065
30012
  ) })
30066
30013
  ] }),
30067
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: cx11("versionDate"), children: currentVersion.createdAt ? format(currentVersion.createdAt, "MMM d yyy, HH:mm") : "" })
30014
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cx10("versionDate"), children: currentVersion.createdAt ? format(currentVersion.createdAt, "MMM d yyy, HH:mm") : "" })
30068
30015
  ] }) }) : null,
30069
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: cx11("publish"), children: [
30070
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
30016
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cx10("publish"), children: [
30017
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
30071
30018
  Button,
30072
30019
  {
30073
30020
  disabled: publishDisabled,
30074
30021
  onClick: handlePublish,
30075
- icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Globe, { size: "12" }),
30022
+ icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Globe, { size: "12" }),
30076
30023
  children: canvasIsDirty ? "Save & publish" : "Publish"
30077
30024
  }
30078
30025
  ),
30079
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
30026
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
30080
30027
  Menu,
30081
30028
  {
30082
30029
  ariaLabel: "More publish actions",
@@ -30085,7 +30032,7 @@ var HeaderActions = (opts) => {
30085
30032
  [
30086
30033
  {
30087
30034
  disabled: unpublishDisabled,
30088
- icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(EyeOff, { size: 16 }),
30035
+ icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(EyeOff, { size: 16 }),
30089
30036
  label: "Unpublish",
30090
30037
  onClick: () => {
30091
30038
  setConfirmAction("unpublish");
@@ -30093,7 +30040,7 @@ var HeaderActions = (opts) => {
30093
30040
  },
30094
30041
  {
30095
30042
  disabled: deleteDisabled,
30096
- icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Trash, { size: 16 }),
30043
+ icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Trash, { size: 16 }),
30097
30044
  label: "Delete page",
30098
30045
  onClick: () => {
30099
30046
  setConfirmAction("delete");
@@ -30101,10 +30048,10 @@ var HeaderActions = (opts) => {
30101
30048
  }
30102
30049
  ]
30103
30050
  ],
30104
- children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: cx11("trigger"), children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ChevronDown, { size: 16 }) })
30051
+ children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: cx10("trigger"), children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ChevronDown, { size: 16 }) })
30105
30052
  }
30106
30053
  ),
30107
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
30054
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
30108
30055
  ConfirmModal,
30109
30056
  {
30110
30057
  visible: confirmAction !== null,
@@ -30121,41 +30068,41 @@ var HeaderActions = (opts) => {
30121
30068
 
30122
30069
  // src/components/Preview/index.tsx
30123
30070
  init_react_import();
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);
30071
+ var import_jsx_runtime52 = require("react/jsx-runtime");
30132
30072
  var Preview = ({ children }) => {
30133
30073
  const { loading } = usePagesStore();
30134
30074
  if (loading) {
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, {}) }) });
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
+ );
30136
30085
  }
30137
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: cx12(), children });
30086
+ return children;
30138
30087
  };
30139
30088
 
30140
30089
  // src/index.tsx
30141
- var import_jsx_runtime54 = require("react/jsx-runtime");
30090
+ var import_jsx_runtime53 = require("react/jsx-runtime");
30142
30091
  function createPagesPlugin(opts) {
30143
30092
  return {
30144
30093
  label: "Pages",
30145
30094
  name: "pages",
30146
- render: () => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PagePlugin, { ...opts }),
30147
- icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FileText, {}),
30095
+ render: () => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PagePlugin, { ...opts }),
30096
+ icon: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(FileText, {}),
30148
30097
  overrides: {
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 })
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 })
30152
30100
  }
30153
30101
  };
30154
30102
  }
30155
30103
  // Annotate the CommonJS export names for ESM import in node:
30156
30104
  0 && (module.exports = {
30157
- createPagesPlugin,
30158
- usePagesStore
30105
+ createPagesPlugin
30159
30106
  });
30160
30107
  /*! Bundled license information:
30161
30108
 
package/dist/index.mjs CHANGED
@@ -12972,7 +12972,7 @@ 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_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" };
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" };
12976
12976
 
12977
12977
  // src/components/PagePlugin/index.tsx
12978
12978
  import { useCallback as useCallback9, useEffect as useEffect29, useMemo as useMemo22, useRef as useRef22, useState as useState30 } from "react";
@@ -26901,7 +26901,9 @@ var usePagesStore = create((set3) => ({
26901
26901
  );
26902
26902
  return {
26903
26903
  ...state,
26904
- pagesData
26904
+ pagesData,
26905
+ activePage: path,
26906
+ activeVersion: null
26905
26907
  };
26906
26908
  }),
26907
26909
  removePage: (path) => {
@@ -26934,7 +26936,7 @@ var usePagesStore = create((set3) => ({
26934
26936
 
26935
26937
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/CreateForm/styles.module.css#css-module
26936
26938
  init_react_import();
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" };
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" };
26938
26940
 
26939
26941
  // src/components/CreateForm/index.tsx
26940
26942
  import { jsx as jsx40, jsxs as jsxs18 } from "react/jsx-runtime";
@@ -29607,73 +29609,19 @@ var PagePlugin = (opts) => {
29607
29609
  ] });
29608
29610
  };
29609
29611
 
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
-
29664
29612
  // src/components/HeaderActions/index.tsx
29665
29613
  init_react_import();
29666
- import { createUsePuck, useGetPuck as useGetPuck4 } from "@puckeditor/core";
29667
- import { useMemo as useMemo24, useRef as useRef23, useState as useState31 } from "react";
29614
+ import { createUsePuck, useGetPuck as useGetPuck3 } from "@puckeditor/core";
29615
+ import { useMemo as useMemo23, useRef as useRef23, useState as useState31 } from "react";
29668
29616
 
29669
29617
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-pages/src/components/HeaderActions/styles.module.css#css-module
29670
29618
  init_react_import();
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" };
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" };
29672
29620
 
29673
29621
  // src/components/HeaderActions/index.tsx
29674
- import { Fragment as Fragment9, jsx as jsx45, jsxs as jsxs23 } from "react/jsx-runtime";
29622
+ import { Fragment as Fragment9, jsx as jsx44, jsxs as jsxs22 } from "react/jsx-runtime";
29675
29623
  var usePuck = createUsePuck();
29676
- var cx11 = getClassNameFactory2("HeaderActions", styles_module_default11);
29624
+ var cx10 = getClassNameFactory2("HeaderActions", styles_module_default10);
29677
29625
  var TOAST_TIMEOUT = 5e3;
29678
29626
  var getDefaultPageVersion = (page) => page?.versions?.[0];
29679
29627
  var showPublishedToast = (path) => {
@@ -29723,7 +29671,7 @@ var showErrorToast = () => {
29723
29671
  });
29724
29672
  };
29725
29673
  var HeaderActions = (opts) => {
29726
- const getPuck = useGetPuck4();
29674
+ const getPuck = useGetPuck3();
29727
29675
  const parentOrigin = opts?.parentOrigin ?? "https://cloud.puckeditor.com";
29728
29676
  const siteIdHeader = useSiteId();
29729
29677
  const siteId = opts?.siteId ?? siteIdHeader;
@@ -29742,7 +29690,7 @@ var HeaderActions = (opts) => {
29742
29690
  setActivePage,
29743
29691
  setActiveVersion
29744
29692
  } = usePagesStore();
29745
- const currentVersion = useMemo24(() => {
29693
+ const currentVersion = useMemo23(() => {
29746
29694
  if (activePage) {
29747
29695
  return getActiveVersion({
29748
29696
  pagesData,
@@ -29752,7 +29700,7 @@ var HeaderActions = (opts) => {
29752
29700
  }
29753
29701
  return void 0;
29754
29702
  }, [activePage, activeVersion, pagesData]);
29755
- const currentPage = useMemo24(
29703
+ const currentPage = useMemo23(
29756
29704
  () => pagesData.find((page) => page.path === activePage),
29757
29705
  [activePage, pagesData]
29758
29706
  );
@@ -30027,13 +29975,13 @@ var HeaderActions = (opts) => {
30027
29975
  onConfirm: handleUnpublish,
30028
29976
  title: "Unpublish page"
30029
29977
  };
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" })
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" })
30035
29983
  ] }),
30036
- /* @__PURE__ */ jsx45(
29984
+ /* @__PURE__ */ jsx44(
30037
29985
  Button,
30038
29986
  {
30039
29987
  variant: "secondary",
@@ -30042,32 +29990,32 @@ var HeaderActions = (opts) => {
30042
29990
  children: "Save"
30043
29991
  }
30044
29992
  )
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: [
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: [
30048
29996
  "v",
30049
29997
  currentVersion.versionNumber
30050
29998
  ] }),
30051
- /* @__PURE__ */ jsx45("div", { children: /* @__PURE__ */ jsx45(
29999
+ /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(
30052
30000
  StatusTag,
30053
30001
  {
30054
30002
  status: currentVersion.status === "published" ? "live" : "draft"
30055
30003
  }
30056
30004
  ) })
30057
30005
  ] }),
30058
- /* @__PURE__ */ jsx45("div", { className: cx11("versionDate"), children: currentVersion.createdAt ? format(currentVersion.createdAt, "MMM d yyy, HH:mm") : "" })
30006
+ /* @__PURE__ */ jsx44("div", { className: cx10("versionDate"), children: currentVersion.createdAt ? format(currentVersion.createdAt, "MMM d yyy, HH:mm") : "" })
30059
30007
  ] }) }) : null,
30060
- /* @__PURE__ */ jsxs23("div", { className: cx11("publish"), children: [
30061
- /* @__PURE__ */ jsx45(
30008
+ /* @__PURE__ */ jsxs22("div", { className: cx10("publish"), children: [
30009
+ /* @__PURE__ */ jsx44(
30062
30010
  Button,
30063
30011
  {
30064
30012
  disabled: publishDisabled,
30065
30013
  onClick: handlePublish,
30066
- icon: /* @__PURE__ */ jsx45(Globe, { size: "12" }),
30014
+ icon: /* @__PURE__ */ jsx44(Globe, { size: "12" }),
30067
30015
  children: canvasIsDirty ? "Save & publish" : "Publish"
30068
30016
  }
30069
30017
  ),
30070
- /* @__PURE__ */ jsx45(
30018
+ /* @__PURE__ */ jsx44(
30071
30019
  Menu,
30072
30020
  {
30073
30021
  ariaLabel: "More publish actions",
@@ -30076,7 +30024,7 @@ var HeaderActions = (opts) => {
30076
30024
  [
30077
30025
  {
30078
30026
  disabled: unpublishDisabled,
30079
- icon: /* @__PURE__ */ jsx45(EyeOff, { size: 16 }),
30027
+ icon: /* @__PURE__ */ jsx44(EyeOff, { size: 16 }),
30080
30028
  label: "Unpublish",
30081
30029
  onClick: () => {
30082
30030
  setConfirmAction("unpublish");
@@ -30084,7 +30032,7 @@ var HeaderActions = (opts) => {
30084
30032
  },
30085
30033
  {
30086
30034
  disabled: deleteDisabled,
30087
- icon: /* @__PURE__ */ jsx45(Trash, { size: 16 }),
30035
+ icon: /* @__PURE__ */ jsx44(Trash, { size: 16 }),
30088
30036
  label: "Delete page",
30089
30037
  onClick: () => {
30090
30038
  setConfirmAction("delete");
@@ -30092,10 +30040,10 @@ var HeaderActions = (opts) => {
30092
30040
  }
30093
30041
  ]
30094
30042
  ],
30095
- children: /* @__PURE__ */ jsx45("span", { className: cx11("trigger"), children: /* @__PURE__ */ jsx45(ChevronDown, { size: 16 }) })
30043
+ children: /* @__PURE__ */ jsx44("span", { className: cx10("trigger"), children: /* @__PURE__ */ jsx44(ChevronDown, { size: 16 }) })
30096
30044
  }
30097
30045
  ),
30098
- /* @__PURE__ */ jsx45(
30046
+ /* @__PURE__ */ jsx44(
30099
30047
  ConfirmModal,
30100
30048
  {
30101
30049
  visible: confirmAction !== null,
@@ -30112,40 +30060,40 @@ var HeaderActions = (opts) => {
30112
30060
 
30113
30061
  // src/components/Preview/index.tsx
30114
30062
  init_react_import();
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);
30063
+ import { jsx as jsx45 } from "react/jsx-runtime";
30123
30064
  var Preview = ({ children }) => {
30124
30065
  const { loading } = usePagesStore();
30125
30066
  if (loading) {
30126
- return /* @__PURE__ */ jsx46("div", { className: cx12(), children: /* @__PURE__ */ jsx46(Align, { horizontal: "center", vertical: "center", children: /* @__PURE__ */ jsx46(Loader, {}) }) });
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
+ );
30127
30077
  }
30128
- return /* @__PURE__ */ jsx46("div", { className: cx12(), children });
30078
+ return children;
30129
30079
  };
30130
30080
 
30131
30081
  // src/index.tsx
30132
- import { jsx as jsx47 } from "react/jsx-runtime";
30082
+ import { jsx as jsx46 } from "react/jsx-runtime";
30133
30083
  function createPagesPlugin(opts) {
30134
30084
  return {
30135
30085
  label: "Pages",
30136
30086
  name: "pages",
30137
- render: () => /* @__PURE__ */ jsx47(PagePlugin, { ...opts }),
30138
- icon: /* @__PURE__ */ jsx47(FileText, {}),
30087
+ render: () => /* @__PURE__ */ jsx46(PagePlugin, { ...opts }),
30088
+ icon: /* @__PURE__ */ jsx46(FileText, {}),
30139
30089
  overrides: {
30140
- headerActions: () => /* @__PURE__ */ jsx47(ToastWrapper, { children: /* @__PURE__ */ jsx47(HeaderActions, { ...opts }) }),
30141
- header: ({ children }) => /* @__PURE__ */ jsx47(Header, { children }),
30142
- preview: ({ children }) => /* @__PURE__ */ jsx47(Preview, { children })
30090
+ headerActions: () => /* @__PURE__ */ jsx46(ToastWrapper, { children: /* @__PURE__ */ jsx46(HeaderActions, { ...opts }) }),
30091
+ preview: ({ children }) => /* @__PURE__ */ jsx46(Preview, { children })
30143
30092
  }
30144
30093
  };
30145
30094
  }
30146
30095
  export {
30147
- createPagesPlugin,
30148
- usePagesStore
30096
+ createPagesPlugin
30149
30097
  };
30150
30098
  /*! Bundled license information:
30151
30099
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puckeditor/plugin-pages",
3
- "version": "0.6.1-canary.433ca837",
3
+ "version": "0.6.1-canary.45a1a2e4",
4
4
  "author": "Chris Villa <chris@puckeditor.com>",
5
5
  "repository": "puckeditor/puck",
6
6
  "bugs": "https://github.com/puckeditor/puck/issues",