@measured/puck 0.21.0-canary.bd7b613d → 0.21.0-canary.c0db75c1

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.
@@ -0,0 +1,109 @@
1
+ import { H as History, g as Permissions, c as ComponentData, C as Config, U as UserGenerics, F as Fields, a as PuckAction, h as RootDataWithProps, i as ResolveDataTrigger, j as Plugin, k as Overrides, V as Viewports, I as IframeConfig, l as UiState, m as ComponentConfig, A as AppState, M as Metadata, n as FieldTransforms } from './actions-CaYAKtsG.mjs';
2
+
3
+ type HistorySlice<D = any> = {
4
+ index: number;
5
+ hasPast: () => boolean;
6
+ hasFuture: () => boolean;
7
+ histories: History<D>[];
8
+ record: (data: D) => void;
9
+ back: VoidFunction;
10
+ forward: VoidFunction;
11
+ currentHistory: () => History;
12
+ nextHistory: () => History<D> | null;
13
+ prevHistory: () => History<D> | null;
14
+ setHistories: (histories: History[]) => void;
15
+ setHistoryIndex: (index: number) => void;
16
+ initialAppState: D;
17
+ };
18
+
19
+ type NodeMethods = {
20
+ sync: () => void;
21
+ hideOverlay: () => void;
22
+ showOverlay: () => void;
23
+ };
24
+ type PuckNodeInstance = {
25
+ id: string;
26
+ methods: NodeMethods;
27
+ element: HTMLElement | null;
28
+ };
29
+ type NodesSlice = {
30
+ nodes: Record<string, PuckNodeInstance | undefined>;
31
+ registerNode: (id: string, node: Partial<PuckNodeInstance>) => void;
32
+ unregisterNode: (id: string, node?: Partial<PuckNodeInstance>) => void;
33
+ };
34
+
35
+ type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
36
+ item?: G["UserComponentData"] | null;
37
+ type?: keyof G["UserProps"];
38
+ root?: boolean;
39
+ };
40
+ type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
41
+ type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
42
+ type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
43
+ type Cache = Record<string, {
44
+ lastPermissions: Partial<Permissions>;
45
+ lastData: ComponentData | null;
46
+ lastParentId: string | null;
47
+ }>;
48
+ type PermissionsSlice = {
49
+ cache: Cache;
50
+ globalPermissions: Permissions;
51
+ resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
52
+ getPermissions: GetPermissions<Config>;
53
+ resolvePermissions: ResolvePermissions<Config>;
54
+ refreshPermissions: RefreshPermissions<Config>;
55
+ };
56
+
57
+ type ComponentOrRootData = Omit<ComponentData<any>, "type">;
58
+ type FieldsSlice = {
59
+ fields: Fields | Partial<Fields>;
60
+ loading: boolean;
61
+ lastResolvedData: Partial<ComponentOrRootData>;
62
+ id: string | undefined;
63
+ };
64
+
65
+ type Status = "LOADING" | "MOUNTED" | "READY";
66
+ type ZoomConfig = {
67
+ autoZoom: number;
68
+ rootHeight: number;
69
+ zoom: number;
70
+ };
71
+ type ComponentState = Record<string, {
72
+ loadingCount: number;
73
+ }>;
74
+ type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
75
+ instanceId: string;
76
+ state: G["UserAppState"];
77
+ dispatch: (action: PuckAction) => void;
78
+ config: UserConfig;
79
+ componentState: ComponentState;
80
+ setComponentState: (componentState: ComponentState) => void;
81
+ setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
82
+ unsetComponentLoading: (id: string) => void;
83
+ pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
84
+ resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
85
+ node: T;
86
+ didChange: boolean;
87
+ }>;
88
+ resolveAndCommitData: () => void;
89
+ plugins: Plugin[];
90
+ overrides: Partial<Overrides>;
91
+ viewports: Viewports;
92
+ zoomConfig: ZoomConfig;
93
+ setZoomConfig: (zoomConfig: ZoomConfig) => void;
94
+ status: Status;
95
+ setStatus: (status: Status) => void;
96
+ iframe: IframeConfig;
97
+ selectedItem?: G["UserData"]["content"][0] | null;
98
+ setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
99
+ getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
100
+ onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
101
+ metadata: Metadata;
102
+ fields: FieldsSlice;
103
+ history: HistorySlice;
104
+ nodes: NodesSlice;
105
+ permissions: PermissionsSlice;
106
+ fieldTransforms: FieldTransforms;
107
+ };
108
+
109
+ export type { AppStore as A, GetPermissions as G, HistorySlice as H, RefreshPermissions as R };
package/dist/index.css CHANGED
@@ -1331,16 +1331,17 @@ body:has(._DropZone--isAnimating_1i2sv_68:empty) [data-puck-overlay] {
1331
1331
  }
1332
1332
 
1333
1333
  /* css-module:/home/runner/work/puck/puck/packages/core/components/InlineTextField/styles.module.css/#css-module-data */
1334
- ._InlineTextField_1xph6_1 {
1334
+ ._InlineTextField_104qp_1 {
1335
1335
  cursor: text;
1336
1336
  display: inline-block;
1337
1337
  white-space: pre-wrap;
1338
+ text-decoration: inherit;
1338
1339
  }
1339
- [data-dnd-dragging] ._InlineTextField_1xph6_1 {
1340
+ [data-dnd-dragging] ._InlineTextField_104qp_1 {
1340
1341
  cursor: none;
1341
1342
  caret-color: transparent;
1342
1343
  }
1343
- [data-dnd-dragging] ._InlineTextField_1xph6_1::selection {
1344
+ [data-dnd-dragging] ._InlineTextField_104qp_1::selection {
1344
1345
  display: none;
1345
1346
  }
1346
1347
 
@@ -1566,24 +1567,25 @@ body:has(._DropZone--isAnimating_1i2sv_68:empty) [data-puck-overlay] {
1566
1567
  }
1567
1568
 
1568
1569
  /* css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Layout/styles.module.css/#css-module-data */
1569
- ._Puck_hv23j_19 {
1570
+ ._Puck_lqzmv_19 {
1570
1571
  --puck-space-px: 16px;
1571
1572
  font-family: var(--puck-font-family);
1573
+ height: 100%;
1572
1574
  overflow-x: hidden;
1573
1575
  }
1574
1576
  @media (min-width: 766px) {
1575
- ._Puck_hv23j_19 {
1577
+ ._Puck_lqzmv_19 {
1576
1578
  overflow-x: auto;
1577
1579
  }
1578
1580
  }
1579
- ._Puck-portal_hv23j_31 {
1581
+ ._Puck-portal_lqzmv_32 {
1580
1582
  position: relative;
1581
1583
  z-index: 2;
1582
1584
  }
1583
- ._PuckLayout_hv23j_36 {
1584
- height: 100%;
1585
+ ._PuckLayout_lqzmv_37 {
1586
+ height: 100dvh;
1585
1587
  }
1586
- ._PuckLayout-inner_hv23j_40 {
1588
+ ._PuckLayout-inner_lqzmv_41 {
1587
1589
  --puck-frame-width: auto;
1588
1590
  --puck-side-nav-width: min-content;
1589
1591
  --puck-side-bar-width: 0px;
@@ -1601,87 +1603,87 @@ body:has(._DropZone--isAnimating_1i2sv_68:empty) [data-puck-overlay] {
1601
1603
  overflow: hidden;
1602
1604
  }
1603
1605
  @media (min-width: 638px) {
1604
- ._PuckLayout-inner_hv23j_40 {
1606
+ ._PuckLayout-inner_lqzmv_41 {
1605
1607
  --puck-side-nav-width: 68px;
1606
1608
  grid-template-areas: "header header header header" "sidenav left editor right";
1607
1609
  grid-template-columns: var(--puck-side-nav-width) 0 var(--puck-frame-width) 0;
1608
1610
  grid-template-rows: min-content auto;
1609
1611
  }
1610
1612
  }
1611
- ._PuckLayout--mounted_hv23j_73 ._PuckLayout-inner_hv23j_40 {
1613
+ ._PuckLayout--mounted_lqzmv_74 ._PuckLayout-inner_lqzmv_41 {
1612
1614
  --puck-side-bar-width: 186px;
1613
1615
  }
1614
- ._PuckLayout--mobilePanelHeightToggle_hv23j_77._PuckLayout--leftSideBarVisible_hv23j_77 ._PuckLayout-inner_hv23j_40 {
1616
+ ._PuckLayout--mobilePanelHeightToggle_lqzmv_78._PuckLayout--leftSideBarVisible_lqzmv_78 ._PuckLayout-inner_lqzmv_41 {
1615
1617
  grid-template-rows: 0 auto 30% 0 var(--puck-side-nav-width);
1616
1618
  }
1617
- ._PuckLayout--mobilePanelHeightToggle_hv23j_77._PuckLayout--leftSideBarVisible_hv23j_77._PuckLayout--isExpanded_hv23j_83 ._PuckLayout-inner_hv23j_40 {
1619
+ ._PuckLayout--mobilePanelHeightToggle_lqzmv_78._PuckLayout--leftSideBarVisible_lqzmv_78._PuckLayout--isExpanded_lqzmv_84 ._PuckLayout-inner_lqzmv_41 {
1618
1620
  grid-template-rows: 0 auto 55% 0 var(--puck-side-nav-width);
1619
1621
  }
1620
1622
  @media (min-width: 638px) {
1621
- ._PuckLayout--mobilePanelHeightToggle_hv23j_77._PuckLayout--leftSideBarVisible_hv23j_77 ._PuckLayout-inner_hv23j_40 {
1623
+ ._PuckLayout--mobilePanelHeightToggle_lqzmv_78._PuckLayout--leftSideBarVisible_lqzmv_78 ._PuckLayout-inner_lqzmv_41 {
1622
1624
  grid-template-columns: var(--puck-side-nav-width) var(--puck-left-side-bar-width) var( --puck-frame-width ) 0;
1623
1625
  grid-template-rows: min-content auto;
1624
1626
  }
1625
1627
  }
1626
- ._PuckLayout--mobilePanelHeightMinContent_hv23j_101._PuckLayout--leftSideBarVisible_hv23j_77 ._PuckLayout-inner_hv23j_40,
1627
- ._PuckLayout--mobilePanelHeightMinContent_hv23j_101._PuckLayout--leftSideBarVisible_hv23j_77._PuckLayout--isExpanded_hv23j_83 ._PuckLayout-inner_hv23j_40 {
1628
+ ._PuckLayout--mobilePanelHeightMinContent_lqzmv_102._PuckLayout--leftSideBarVisible_lqzmv_78 ._PuckLayout-inner_lqzmv_41,
1629
+ ._PuckLayout--mobilePanelHeightMinContent_lqzmv_102._PuckLayout--leftSideBarVisible_lqzmv_78._PuckLayout--isExpanded_lqzmv_84 ._PuckLayout-inner_lqzmv_41 {
1628
1630
  grid-template-rows: 0 auto min-content 0 var(--puck-side-nav-width);
1629
1631
  }
1630
1632
  @media (min-width: 638px) {
1631
- ._PuckLayout--mobilePanelHeightToggle_hv23j_77._PuckLayout--leftSideBarVisible_hv23j_77 ._PuckLayout-inner_hv23j_40,
1632
- ._PuckLayout--mobilePanelHeightToggle_hv23j_77._PuckLayout--leftSideBarVisible_hv23j_77._PuckLayout--isExpanded_hv23j_83 ._PuckLayout-inner_hv23j_40,
1633
- ._PuckLayout--mobilePanelHeightMinContent_hv23j_101._PuckLayout--leftSideBarVisible_hv23j_77 ._PuckLayout-inner_hv23j_40,
1634
- ._PuckLayout--mobilePanelHeightMinContent_hv23j_101._PuckLayout--leftSideBarVisible_hv23j_77._PuckLayout--isExpanded_hv23j_83 ._PuckLayout-inner_hv23j_40 {
1633
+ ._PuckLayout--mobilePanelHeightToggle_lqzmv_78._PuckLayout--leftSideBarVisible_lqzmv_78 ._PuckLayout-inner_lqzmv_41,
1634
+ ._PuckLayout--mobilePanelHeightToggle_lqzmv_78._PuckLayout--leftSideBarVisible_lqzmv_78._PuckLayout--isExpanded_lqzmv_84 ._PuckLayout-inner_lqzmv_41,
1635
+ ._PuckLayout--mobilePanelHeightMinContent_lqzmv_102._PuckLayout--leftSideBarVisible_lqzmv_78 ._PuckLayout-inner_lqzmv_41,
1636
+ ._PuckLayout--mobilePanelHeightMinContent_lqzmv_102._PuckLayout--leftSideBarVisible_lqzmv_78._PuckLayout--isExpanded_lqzmv_84 ._PuckLayout-inner_lqzmv_41 {
1635
1637
  grid-template-columns: var(--puck-side-nav-width) var(--puck-left-side-bar-width) var( --puck-frame-width ) 0;
1636
1638
  grid-template-rows: min-content auto;
1637
1639
  }
1638
1640
  }
1639
1641
  @media (min-width: 638px) {
1640
- ._PuckLayout--rightSideBarVisible_hv23j_128 ._PuckLayout-inner_hv23j_40 {
1642
+ ._PuckLayout--rightSideBarVisible_lqzmv_129 ._PuckLayout-inner_lqzmv_41 {
1641
1643
  grid-template-columns: var(--puck-side-nav-width) 0 var(--puck-frame-width) var(--puck-right-side-bar-width);
1642
1644
  }
1643
1645
  }
1644
1646
  @media (min-width: 638px) {
1645
- ._PuckLayout--leftSideBarVisible_hv23j_77._PuckLayout--rightSideBarVisible_hv23j_128 ._PuckLayout-inner_hv23j_40 {
1647
+ ._PuckLayout--leftSideBarVisible_lqzmv_78._PuckLayout--rightSideBarVisible_lqzmv_129 ._PuckLayout-inner_lqzmv_41 {
1646
1648
  grid-template-columns: var(--puck-side-nav-width) var(--puck-left-side-bar-width) var( --puck-frame-width ) var(--puck-right-side-bar-width);
1647
1649
  }
1648
1650
  }
1649
1651
  @media (min-width: 458px) {
1650
- ._PuckLayout-mounted_hv23j_147 ._PuckLayout-inner_hv23j_40 {
1652
+ ._PuckLayout-mounted_lqzmv_148 ._PuckLayout-inner_lqzmv_41 {
1651
1653
  --puck-frame-width: minmax(266px, auto);
1652
1654
  }
1653
1655
  }
1654
1656
  @media (min-width: 638px) {
1655
- ._PuckLayout_hv23j_36 ._PuckLayout-inner_hv23j_40 {
1657
+ ._PuckLayout_lqzmv_37 ._PuckLayout-inner_lqzmv_41 {
1656
1658
  --puck-side-bar-width: minmax(186px, 250px);
1657
1659
  }
1658
1660
  }
1659
1661
  @media (min-width: 766px) {
1660
- ._PuckLayout_hv23j_36 ._PuckLayout-inner_hv23j_40 {
1662
+ ._PuckLayout_lqzmv_37 ._PuckLayout-inner_lqzmv_41 {
1661
1663
  --puck-frame-width: auto;
1662
1664
  }
1663
1665
  }
1664
1666
  @media (min-width: 990px) {
1665
- ._PuckLayout_hv23j_36 ._PuckLayout-inner_hv23j_40 {
1667
+ ._PuckLayout_lqzmv_37 ._PuckLayout-inner_lqzmv_41 {
1666
1668
  --puck-side-bar-width: 256px;
1667
1669
  }
1668
1670
  }
1669
1671
  @media (min-width: 1198px) {
1670
- ._PuckLayout_hv23j_36 ._PuckLayout-inner_hv23j_40 {
1672
+ ._PuckLayout_lqzmv_37 ._PuckLayout-inner_lqzmv_41 {
1671
1673
  --puck-side-bar-width: 274px;
1672
1674
  }
1673
1675
  }
1674
1676
  @media (min-width: 1398px) {
1675
- ._PuckLayout_hv23j_36 ._PuckLayout-inner_hv23j_40 {
1677
+ ._PuckLayout_lqzmv_37 ._PuckLayout-inner_lqzmv_41 {
1676
1678
  --puck-side-bar-width: 290px;
1677
1679
  }
1678
1680
  }
1679
1681
  @media (min-width: 1598px) {
1680
- ._PuckLayout_hv23j_36 ._PuckLayout-inner_hv23j_40 {
1682
+ ._PuckLayout_lqzmv_37 ._PuckLayout-inner_lqzmv_41 {
1681
1683
  --puck-side-bar-width: 320px;
1682
1684
  }
1683
1685
  }
1684
- ._PuckLayout-nav_hv23j_188 {
1686
+ ._PuckLayout-nav_lqzmv_189 {
1685
1687
  border-top: 1px solid var(--puck-color-grey-09);
1686
1688
  background-color: var(--puck-color-grey-12);
1687
1689
  grid-area: sidenav;
@@ -1689,33 +1691,33 @@ body:has(._DropZone--isAnimating_1i2sv_68:empty) [data-puck-overlay] {
1689
1691
  width: 100%;
1690
1692
  }
1691
1693
  @media (min-width: 638px) {
1692
- ._PuckLayout-nav_hv23j_188 {
1694
+ ._PuckLayout-nav_lqzmv_189 {
1693
1695
  border-top: 0;
1694
1696
  border-right: 1px solid var(--puck-color-grey-09);
1695
1697
  box-sizing: border-box;
1696
1698
  }
1697
1699
  }
1698
- ._PuckLayout-header_hv23j_204 {
1700
+ ._PuckLayout-header_lqzmv_205 {
1699
1701
  grid-area: header;
1700
1702
  }
1701
- ._PuckLayout--leftSideBarVisible_hv23j_77 ._PuckLayout-header_hv23j_204 {
1703
+ ._PuckLayout--leftSideBarVisible_lqzmv_78 ._PuckLayout-header_lqzmv_205 {
1702
1704
  overflow: hidden;
1703
1705
  }
1704
1706
  @media (min-width: 638px) {
1705
- ._PuckLayout--leftSideBarVisible_hv23j_77 ._PuckLayout-header_hv23j_204 {
1707
+ ._PuckLayout--leftSideBarVisible_lqzmv_78 ._PuckLayout-header_lqzmv_205 {
1706
1708
  overflow: auto;
1707
1709
  }
1708
1710
  }
1709
- ._PuckPluginTab_hv23j_218 {
1711
+ ._PuckPluginTab_lqzmv_219 {
1710
1712
  display: none;
1711
1713
  flex-grow: 1;
1712
1714
  overflow: hidden;
1713
1715
  }
1714
- ._PuckPluginTab--visible_hv23j_224 {
1716
+ ._PuckPluginTab--visible_lqzmv_225 {
1715
1717
  display: flex;
1716
1718
  flex-direction: column;
1717
1719
  }
1718
- ._PuckPluginTab-body_hv23j_229 {
1720
+ ._PuckPluginTab-body_lqzmv_230 {
1719
1721
  flex-grow: 1;
1720
1722
  overflow: hidden;
1721
1723
  }
package/dist/index.d.mts CHANGED
@@ -1,113 +1,10 @@
1
- import { H as History, P as Permissions, a as ComponentData, C as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector, o as PluginInternal } from './walk-tree-Cvtjzg9C.mjs';
2
- export { a8 as Adaptor, a6 as ArrayField, E as ArrayState, al as AsFieldProps, Q as BaseData, a0 as BaseField, _ as ComponentDataMap, Y as ComponentDataOptionalId, $ as Content, ac as CustomField, ab as CustomFieldRender, ai as DefaultComponentProps, L as DefaultComponents, af as DefaultRootFieldProps, ah as DefaultRootProps, ag as DefaultRootRenderProps, p as Direction, q as DragAxis, aa as ExternalField, a9 as ExternalFieldWithAdaptor, N as ExtractConfigParams, an as ExtractField, z as FieldRenderFunctions, v as FieldTransformFn, u as FieldTransformFnParams, B as ItemWithId, Z as MappedItem, a2 as NumberField, a7 as ObjectField, y as OverrideKey, J as PuckComponent, ae as PuckContext, a5 as RadioField, K as RootConfig, X as RootData, T as RootDataWithoutProps, a4 as SelectField, S as Slot, G as SlotComponent, ad as SlotField, a1 as TextField, a3 as TextareaField, s as Viewport, am as WithChildren, aj as WithId, ak as WithPuckProps, W as WithSlotProps, m as migrate, x as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-Cvtjzg9C.mjs';
1
+ import { o as Field, p as FieldProps, q as DropZoneProps, C as Config, U as UserGenerics, D as Data, l as UiState, O as OnAction, g as Permissions, j as Plugin, k as Overrides, n as FieldTransforms, a as PuckAction, V as Viewports, I as IframeConfig, r as InitialHistory, M as Metadata, s as ItemSelector, c as ComponentData, t as PluginInternal } from './actions-CaYAKtsG.mjs';
2
+ export { ae as Adaptor, A as AppState, ac as ArrayField, K as ArrayState, ap as AsFieldProps, _ as BaseData, a6 as BaseField, ag as CacheOpts, m as ComponentConfig, Q as ComponentConfigExtensions, Z as ComponentConfigParams, a2 as ComponentDataMap, a0 as ComponentDataOptionalId, a4 as ComponentMetadata, Y as ConfigParams, b as Content, aj as CustomField, ai as CustomFieldRender, e as DefaultComponentProps, d as DefaultComponents, f as DefaultRootFieldProps, an as DefaultRootProps, am as DefaultRootRenderProps, v as Direction, w as DragAxis, ah as ExternalField, af as ExternalFieldWithAdaptor, X as ExtractConfigParams, ar as ExtractField, a5 as FieldMetadata, G as FieldRenderFunctions, z as FieldTransformFn, y as FieldTransformFnParams, F as Fields, H as History, J as ItemWithId, a1 as MappedItem, a8 as NumberField, ad as ObjectField, E as OverrideKey, N as PuckComponent, al as PuckContext, a3 as PuckMetadata, ab as RadioField, i as ResolveDataTrigger, T as RootConfig, R as RootData, h as RootDataWithProps, $ as RootDataWithoutProps, aa as SelectField, S as Slot, L as SlotComponent, ak as SlotField, a7 as TextField, a9 as TextareaField, x as Viewport, aq as WithChildren, W as WithId, ao as WithPuckProps, u as WithSlotProps, B as overrideKeys } from './actions-CaYAKtsG.mjs';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-B-Q2gpMX.mjs';
3
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
5
  import * as react from 'react';
5
6
  import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
6
-
7
- type HistorySlice<D = any> = {
8
- index: number;
9
- hasPast: () => boolean;
10
- hasFuture: () => boolean;
11
- histories: History<D>[];
12
- record: (data: D) => void;
13
- back: VoidFunction;
14
- forward: VoidFunction;
15
- currentHistory: () => History;
16
- nextHistory: () => History<D> | null;
17
- prevHistory: () => History<D> | null;
18
- setHistories: (histories: History[]) => void;
19
- setHistoryIndex: (index: number) => void;
20
- initialAppState: D;
21
- };
22
-
23
- type NodeMethods = {
24
- sync: () => void;
25
- hideOverlay: () => void;
26
- showOverlay: () => void;
27
- };
28
- type PuckNodeInstance = {
29
- id: string;
30
- methods: NodeMethods;
31
- element: HTMLElement | null;
32
- };
33
- type NodesSlice = {
34
- nodes: Record<string, PuckNodeInstance | undefined>;
35
- registerNode: (id: string, node: Partial<PuckNodeInstance>) => void;
36
- unregisterNode: (id: string, node?: Partial<PuckNodeInstance>) => void;
37
- };
38
-
39
- type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
40
- item?: G["UserComponentData"] | null;
41
- type?: keyof G["UserProps"];
42
- root?: boolean;
43
- };
44
- type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
45
- type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
46
- type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
47
- type Cache = Record<string, {
48
- lastPermissions: Partial<Permissions>;
49
- lastData: ComponentData | null;
50
- }>;
51
- type PermissionsSlice = {
52
- cache: Cache;
53
- globalPermissions: Permissions;
54
- resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
55
- getPermissions: GetPermissions<Config>;
56
- resolvePermissions: ResolvePermissions<Config>;
57
- refreshPermissions: RefreshPermissions<Config>;
58
- };
59
-
60
- type ComponentOrRootData = Omit<ComponentData<any>, "type">;
61
- type FieldsSlice = {
62
- fields: Fields | Partial<Fields>;
63
- loading: boolean;
64
- lastResolvedData: Partial<ComponentOrRootData>;
65
- id: string | undefined;
66
- };
67
-
68
- type Status = "LOADING" | "MOUNTED" | "READY";
69
- type ZoomConfig = {
70
- autoZoom: number;
71
- rootHeight: number;
72
- zoom: number;
73
- };
74
- type ComponentState = Record<string, {
75
- loadingCount: number;
76
- }>;
77
- type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
78
- instanceId: string;
79
- state: G["UserAppState"];
80
- dispatch: (action: PuckAction) => void;
81
- config: UserConfig;
82
- componentState: ComponentState;
83
- setComponentState: (componentState: ComponentState) => void;
84
- setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
85
- unsetComponentLoading: (id: string) => void;
86
- pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
87
- resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
88
- node: T;
89
- didChange: boolean;
90
- }>;
91
- resolveAndCommitData: () => void;
92
- plugins: Plugin[];
93
- overrides: Partial<Overrides>;
94
- viewports: Viewports;
95
- zoomConfig: ZoomConfig;
96
- setZoomConfig: (zoomConfig: ZoomConfig) => void;
97
- status: Status;
98
- setStatus: (status: Status) => void;
99
- iframe: IframeConfig;
100
- selectedItem?: G["UserData"]["content"][0] | null;
101
- setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
102
- getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
103
- onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
104
- metadata: Metadata;
105
- fields: FieldsSlice;
106
- history: HistorySlice;
107
- nodes: NodesSlice;
108
- permissions: PermissionsSlice;
109
- fieldTransforms: FieldTransforms;
110
- };
7
+ import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-IMRjDHZk.mjs';
111
8
 
112
9
  declare const ActionBar: {
113
10
  ({ label, children, }: {
@@ -185,7 +82,7 @@ declare const Drawer: {
185
82
 
186
83
  declare const DropZone: react.ForwardRefExoticComponent<DropZoneProps & react.RefAttributes<HTMLDivElement>>;
187
84
 
188
- declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
85
+ declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, suppressHydrationWarning, }: {
189
86
  children: ReactNode;
190
87
  href?: string;
191
88
  onClick?: (e: SyntheticEvent) => void | Promise<void>;
@@ -196,6 +93,7 @@ declare const IconButton: ({ children, href, onClick, variant, type, disabled, t
196
93
  newTab?: boolean;
197
94
  fullWidth?: boolean;
198
95
  title: string;
96
+ suppressHydrationWarning?: boolean;
199
97
  }) => react_jsx_runtime.JSX.Element;
200
98
 
201
99
  type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
@@ -274,6 +172,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
274
172
  getItemBySelector: (selector: ItemSelector) => G["UserComponentData"] | undefined;
275
173
  getItemById: (id: string) => G["UserComponentData"] | undefined;
276
174
  getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
175
+ getParentById: (id: string) => ComponentData | undefined;
277
176
  history: {
278
177
  back: HistorySlice["back"];
279
178
  forward: HistorySlice["forward"];
@@ -313,4 +212,4 @@ declare const fieldsPlugin: (params?: {
313
212
 
314
213
  declare const outlinePlugin: () => Plugin;
315
214
 
316
- export { Action, ActionBar, AppState, AutoField, Button, ComponentConfig, ComponentData, Config, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, FieldTransforms, Fields, Group, History, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, ResolveDataTrigger, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, blocksPlugin, createUsePuck, fieldsPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };
215
+ export { Action, ActionBar, AutoField, Button, ComponentData, Config, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, FieldTransforms, Group, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, UiState, type UsePuckData, UserGenerics, Viewports, blocksPlugin, createUsePuck, fieldsPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };
package/dist/index.d.ts CHANGED
@@ -1,113 +1,10 @@
1
- import { H as History, P as Permissions, a as ComponentData, C as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector, o as PluginInternal } from './walk-tree-Cvtjzg9C.js';
2
- export { a8 as Adaptor, a6 as ArrayField, E as ArrayState, al as AsFieldProps, Q as BaseData, a0 as BaseField, _ as ComponentDataMap, Y as ComponentDataOptionalId, $ as Content, ac as CustomField, ab as CustomFieldRender, ai as DefaultComponentProps, L as DefaultComponents, af as DefaultRootFieldProps, ah as DefaultRootProps, ag as DefaultRootRenderProps, p as Direction, q as DragAxis, aa as ExternalField, a9 as ExternalFieldWithAdaptor, N as ExtractConfigParams, an as ExtractField, z as FieldRenderFunctions, v as FieldTransformFn, u as FieldTransformFnParams, B as ItemWithId, Z as MappedItem, a2 as NumberField, a7 as ObjectField, y as OverrideKey, J as PuckComponent, ae as PuckContext, a5 as RadioField, K as RootConfig, X as RootData, T as RootDataWithoutProps, a4 as SelectField, S as Slot, G as SlotComponent, ad as SlotField, a1 as TextField, a3 as TextareaField, s as Viewport, am as WithChildren, aj as WithId, ak as WithPuckProps, W as WithSlotProps, m as migrate, x as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-Cvtjzg9C.js';
1
+ import { o as Field, p as FieldProps, q as DropZoneProps, C as Config, U as UserGenerics, D as Data, l as UiState, O as OnAction, g as Permissions, j as Plugin, k as Overrides, n as FieldTransforms, a as PuckAction, V as Viewports, I as IframeConfig, r as InitialHistory, M as Metadata, s as ItemSelector, c as ComponentData, t as PluginInternal } from './actions-CaYAKtsG.js';
2
+ export { ae as Adaptor, A as AppState, ac as ArrayField, K as ArrayState, ap as AsFieldProps, _ as BaseData, a6 as BaseField, ag as CacheOpts, m as ComponentConfig, Q as ComponentConfigExtensions, Z as ComponentConfigParams, a2 as ComponentDataMap, a0 as ComponentDataOptionalId, a4 as ComponentMetadata, Y as ConfigParams, b as Content, aj as CustomField, ai as CustomFieldRender, e as DefaultComponentProps, d as DefaultComponents, f as DefaultRootFieldProps, an as DefaultRootProps, am as DefaultRootRenderProps, v as Direction, w as DragAxis, ah as ExternalField, af as ExternalFieldWithAdaptor, X as ExtractConfigParams, ar as ExtractField, a5 as FieldMetadata, G as FieldRenderFunctions, z as FieldTransformFn, y as FieldTransformFnParams, F as Fields, H as History, J as ItemWithId, a1 as MappedItem, a8 as NumberField, ad as ObjectField, E as OverrideKey, N as PuckComponent, al as PuckContext, a3 as PuckMetadata, ab as RadioField, i as ResolveDataTrigger, T as RootConfig, R as RootData, h as RootDataWithProps, $ as RootDataWithoutProps, aa as SelectField, S as Slot, L as SlotComponent, ak as SlotField, a7 as TextField, a9 as TextareaField, x as Viewport, aq as WithChildren, W as WithId, ao as WithPuckProps, u as WithSlotProps, B as overrideKeys } from './actions-CaYAKtsG.js';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-ksvZ7C4q.js';
3
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
5
  import * as react from 'react';
5
6
  import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
6
-
7
- type HistorySlice<D = any> = {
8
- index: number;
9
- hasPast: () => boolean;
10
- hasFuture: () => boolean;
11
- histories: History<D>[];
12
- record: (data: D) => void;
13
- back: VoidFunction;
14
- forward: VoidFunction;
15
- currentHistory: () => History;
16
- nextHistory: () => History<D> | null;
17
- prevHistory: () => History<D> | null;
18
- setHistories: (histories: History[]) => void;
19
- setHistoryIndex: (index: number) => void;
20
- initialAppState: D;
21
- };
22
-
23
- type NodeMethods = {
24
- sync: () => void;
25
- hideOverlay: () => void;
26
- showOverlay: () => void;
27
- };
28
- type PuckNodeInstance = {
29
- id: string;
30
- methods: NodeMethods;
31
- element: HTMLElement | null;
32
- };
33
- type NodesSlice = {
34
- nodes: Record<string, PuckNodeInstance | undefined>;
35
- registerNode: (id: string, node: Partial<PuckNodeInstance>) => void;
36
- unregisterNode: (id: string, node?: Partial<PuckNodeInstance>) => void;
37
- };
38
-
39
- type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
40
- item?: G["UserComponentData"] | null;
41
- type?: keyof G["UserProps"];
42
- root?: boolean;
43
- };
44
- type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
45
- type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
46
- type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
47
- type Cache = Record<string, {
48
- lastPermissions: Partial<Permissions>;
49
- lastData: ComponentData | null;
50
- }>;
51
- type PermissionsSlice = {
52
- cache: Cache;
53
- globalPermissions: Permissions;
54
- resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
55
- getPermissions: GetPermissions<Config>;
56
- resolvePermissions: ResolvePermissions<Config>;
57
- refreshPermissions: RefreshPermissions<Config>;
58
- };
59
-
60
- type ComponentOrRootData = Omit<ComponentData<any>, "type">;
61
- type FieldsSlice = {
62
- fields: Fields | Partial<Fields>;
63
- loading: boolean;
64
- lastResolvedData: Partial<ComponentOrRootData>;
65
- id: string | undefined;
66
- };
67
-
68
- type Status = "LOADING" | "MOUNTED" | "READY";
69
- type ZoomConfig = {
70
- autoZoom: number;
71
- rootHeight: number;
72
- zoom: number;
73
- };
74
- type ComponentState = Record<string, {
75
- loadingCount: number;
76
- }>;
77
- type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
78
- instanceId: string;
79
- state: G["UserAppState"];
80
- dispatch: (action: PuckAction) => void;
81
- config: UserConfig;
82
- componentState: ComponentState;
83
- setComponentState: (componentState: ComponentState) => void;
84
- setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
85
- unsetComponentLoading: (id: string) => void;
86
- pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
87
- resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
88
- node: T;
89
- didChange: boolean;
90
- }>;
91
- resolveAndCommitData: () => void;
92
- plugins: Plugin[];
93
- overrides: Partial<Overrides>;
94
- viewports: Viewports;
95
- zoomConfig: ZoomConfig;
96
- setZoomConfig: (zoomConfig: ZoomConfig) => void;
97
- status: Status;
98
- setStatus: (status: Status) => void;
99
- iframe: IframeConfig;
100
- selectedItem?: G["UserData"]["content"][0] | null;
101
- setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
102
- getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
103
- onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
104
- metadata: Metadata;
105
- fields: FieldsSlice;
106
- history: HistorySlice;
107
- nodes: NodesSlice;
108
- permissions: PermissionsSlice;
109
- fieldTransforms: FieldTransforms;
110
- };
7
+ import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-C6QwyW4B.js';
111
8
 
112
9
  declare const ActionBar: {
113
10
  ({ label, children, }: {
@@ -185,7 +82,7 @@ declare const Drawer: {
185
82
 
186
83
  declare const DropZone: react.ForwardRefExoticComponent<DropZoneProps & react.RefAttributes<HTMLDivElement>>;
187
84
 
188
- declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
85
+ declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, suppressHydrationWarning, }: {
189
86
  children: ReactNode;
190
87
  href?: string;
191
88
  onClick?: (e: SyntheticEvent) => void | Promise<void>;
@@ -196,6 +93,7 @@ declare const IconButton: ({ children, href, onClick, variant, type, disabled, t
196
93
  newTab?: boolean;
197
94
  fullWidth?: boolean;
198
95
  title: string;
96
+ suppressHydrationWarning?: boolean;
199
97
  }) => react_jsx_runtime.JSX.Element;
200
98
 
201
99
  type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
@@ -274,6 +172,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
274
172
  getItemBySelector: (selector: ItemSelector) => G["UserComponentData"] | undefined;
275
173
  getItemById: (id: string) => G["UserComponentData"] | undefined;
276
174
  getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
175
+ getParentById: (id: string) => ComponentData | undefined;
277
176
  history: {
278
177
  back: HistorySlice["back"];
279
178
  forward: HistorySlice["forward"];
@@ -313,4 +212,4 @@ declare const fieldsPlugin: (params?: {
313
212
 
314
213
  declare const outlinePlugin: () => Plugin;
315
214
 
316
- export { Action, ActionBar, AppState, AutoField, Button, ComponentConfig, ComponentData, Config, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, FieldTransforms, Fields, Group, History, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, ResolveDataTrigger, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, blocksPlugin, createUsePuck, fieldsPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };
215
+ export { Action, ActionBar, AutoField, Button, ComponentData, Config, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, FieldTransforms, Group, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, UiState, type UsePuckData, UserGenerics, Viewports, blocksPlugin, createUsePuck, fieldsPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };