@measured/puck 0.18.2-canary.3a69ad4 → 0.18.2-canary.5db6f4d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +45 -3
- package/dist/index.d.ts +45 -3
- package/dist/index.js +32 -59
- package/dist/index.mjs +30 -59
- package/dist/{resolve-all-data-C-cc7ftj.d.mts → resolve-all-data-DzJEE28m.d.mts} +2 -2
- package/dist/{resolve-all-data-C-cc7ftj.d.ts → resolve-all-data-DzJEE28m.d.ts} +2 -2
- package/dist/rsc.d.mts +4 -4
- package/dist/rsc.d.ts +4 -4
- package/dist/rsc.js +5 -3
- package/dist/rsc.mjs +5 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
import { F as FieldProps, a as Field,
|
2
|
-
export {
|
1
|
+
import { F as FieldProps, a as Field, C as Config, D as Data, I as ItemSelector, b as DropZoneProps, U as UserGenerics, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, g as IframeConfig, h as InitialHistory, i as DefaultComponentProps, j as DefaultRootFieldProps, H as History, A as AppState, E as ExtractPropsFromConfig, k as ExtractRootPropsFromConfig, l as ComponentDataMap } from './resolve-all-data-DzJEE28m.mjs';
|
2
|
+
export { W as Adaptor, L as ArrayField, t as ArrayState, a4 as AsFieldProps, B as BaseData, G as BaseField, v as ComponentConfig, y as ComponentData, z as Content, Z as CustomField, a1 as DefaultRootProps, a0 as DefaultRootRenderProps, m as Direction, n as DragAxis, Y as ExternalField, X as ExternalFieldWithAdaptor, r as FieldRenderFunctions, _ as Fields, s as ItemWithId, M as MappedItem, N as NumberField, Q as ObjectField, q as OverrideKey, u as PuckComponent, $ as PuckContext, K as RadioField, x as RootData, R as RootDataWithProps, w as RootDataWithoutProps, S as SelectField, T as TextField, J as TextareaField, o as Viewport, a5 as WithChildren, a2 as WithId, a3 as WithPuckProps, p as overrideKeys, a6 as resolveAllData } from './resolve-all-data-DzJEE28m.mjs';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import * as react from 'react';
|
5
5
|
import { ReactNode, SyntheticEvent, ReactElement } from 'react';
|
6
|
+
import { UniqueIdentifier } from '@dnd-kit/abstract';
|
6
7
|
|
7
8
|
declare const ActionBar: {
|
8
9
|
({ label, children, }: {
|
@@ -78,6 +79,47 @@ declare const Drawer: {
|
|
78
79
|
}) => react_jsx_runtime.JSX.Element;
|
79
80
|
};
|
80
81
|
|
82
|
+
type PathData = Record<string, {
|
83
|
+
path: string[];
|
84
|
+
label: string;
|
85
|
+
}>;
|
86
|
+
type DropZoneContext<UserConfig extends Config = Config> = {
|
87
|
+
data: Data;
|
88
|
+
config: UserConfig;
|
89
|
+
componentState?: Record<string, any>;
|
90
|
+
itemSelector?: ItemSelector | null;
|
91
|
+
setItemSelector?: (newIndex: ItemSelector | null) => void;
|
92
|
+
areaId?: string;
|
93
|
+
zoneCompound?: string;
|
94
|
+
index?: number;
|
95
|
+
hoveringComponent?: string | null;
|
96
|
+
setHoveringComponent?: (id: string | null) => void;
|
97
|
+
registerZoneArea?: (areaId: string) => void;
|
98
|
+
areasWithZones?: Record<string, boolean>;
|
99
|
+
registerZone?: (zoneCompound: string) => void;
|
100
|
+
unregisterZone?: (zoneCompound: string) => void;
|
101
|
+
activeZones?: Record<string, boolean>;
|
102
|
+
pathData?: PathData;
|
103
|
+
registerPath?: (id: string, selector: ItemSelector, label: string) => void;
|
104
|
+
unregisterPath?: (id: string) => void;
|
105
|
+
mode?: "edit" | "render";
|
106
|
+
depth: number;
|
107
|
+
registerLocalZone?: (zone: string, active: boolean) => void;
|
108
|
+
unregisterLocalZone?: (zone: string) => void;
|
109
|
+
path: string[];
|
110
|
+
} | null;
|
111
|
+
declare const dropZoneContext: react.Context<DropZoneContext<Config>>;
|
112
|
+
declare const DropZoneProvider: ({ children, value, }: {
|
113
|
+
children: ReactNode;
|
114
|
+
value: DropZoneContext;
|
115
|
+
}) => react_jsx_runtime.JSX.Element;
|
116
|
+
|
117
|
+
type DropZoneDndData = {
|
118
|
+
areaId?: string;
|
119
|
+
depth: number;
|
120
|
+
path: UniqueIdentifier[];
|
121
|
+
isDroppableTarget: boolean;
|
122
|
+
};
|
81
123
|
declare const DropZone: react.ForwardRefExoticComponent<DropZoneProps & react.RefAttributes<HTMLDivElement>>;
|
82
124
|
|
83
125
|
declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
|
@@ -194,4 +236,4 @@ declare const usePuck: <UserConfig extends Config = Config>() => {
|
|
194
236
|
selectedItem: ComponentDataMap<ExtractPropsFromConfig<UserConfig>> | null;
|
195
237
|
};
|
196
238
|
|
197
|
-
export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, Label, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, migrate, transformProps, usePuck };
|
239
|
+
export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, type DropZoneDndData, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, Label, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, dropZoneContext, migrate, transformProps, usePuck };
|
package/dist/index.d.ts
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
import { F as FieldProps, a as Field,
|
2
|
-
export {
|
1
|
+
import { F as FieldProps, a as Field, C as Config, D as Data, I as ItemSelector, b as DropZoneProps, U as UserGenerics, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, g as IframeConfig, h as InitialHistory, i as DefaultComponentProps, j as DefaultRootFieldProps, H as History, A as AppState, E as ExtractPropsFromConfig, k as ExtractRootPropsFromConfig, l as ComponentDataMap } from './resolve-all-data-DzJEE28m.js';
|
2
|
+
export { W as Adaptor, L as ArrayField, t as ArrayState, a4 as AsFieldProps, B as BaseData, G as BaseField, v as ComponentConfig, y as ComponentData, z as Content, Z as CustomField, a1 as DefaultRootProps, a0 as DefaultRootRenderProps, m as Direction, n as DragAxis, Y as ExternalField, X as ExternalFieldWithAdaptor, r as FieldRenderFunctions, _ as Fields, s as ItemWithId, M as MappedItem, N as NumberField, Q as ObjectField, q as OverrideKey, u as PuckComponent, $ as PuckContext, K as RadioField, x as RootData, R as RootDataWithProps, w as RootDataWithoutProps, S as SelectField, T as TextField, J as TextareaField, o as Viewport, a5 as WithChildren, a2 as WithId, a3 as WithPuckProps, p as overrideKeys, a6 as resolveAllData } from './resolve-all-data-DzJEE28m.js';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import * as react from 'react';
|
5
5
|
import { ReactNode, SyntheticEvent, ReactElement } from 'react';
|
6
|
+
import { UniqueIdentifier } from '@dnd-kit/abstract';
|
6
7
|
|
7
8
|
declare const ActionBar: {
|
8
9
|
({ label, children, }: {
|
@@ -78,6 +79,47 @@ declare const Drawer: {
|
|
78
79
|
}) => react_jsx_runtime.JSX.Element;
|
79
80
|
};
|
80
81
|
|
82
|
+
type PathData = Record<string, {
|
83
|
+
path: string[];
|
84
|
+
label: string;
|
85
|
+
}>;
|
86
|
+
type DropZoneContext<UserConfig extends Config = Config> = {
|
87
|
+
data: Data;
|
88
|
+
config: UserConfig;
|
89
|
+
componentState?: Record<string, any>;
|
90
|
+
itemSelector?: ItemSelector | null;
|
91
|
+
setItemSelector?: (newIndex: ItemSelector | null) => void;
|
92
|
+
areaId?: string;
|
93
|
+
zoneCompound?: string;
|
94
|
+
index?: number;
|
95
|
+
hoveringComponent?: string | null;
|
96
|
+
setHoveringComponent?: (id: string | null) => void;
|
97
|
+
registerZoneArea?: (areaId: string) => void;
|
98
|
+
areasWithZones?: Record<string, boolean>;
|
99
|
+
registerZone?: (zoneCompound: string) => void;
|
100
|
+
unregisterZone?: (zoneCompound: string) => void;
|
101
|
+
activeZones?: Record<string, boolean>;
|
102
|
+
pathData?: PathData;
|
103
|
+
registerPath?: (id: string, selector: ItemSelector, label: string) => void;
|
104
|
+
unregisterPath?: (id: string) => void;
|
105
|
+
mode?: "edit" | "render";
|
106
|
+
depth: number;
|
107
|
+
registerLocalZone?: (zone: string, active: boolean) => void;
|
108
|
+
unregisterLocalZone?: (zone: string) => void;
|
109
|
+
path: string[];
|
110
|
+
} | null;
|
111
|
+
declare const dropZoneContext: react.Context<DropZoneContext<Config>>;
|
112
|
+
declare const DropZoneProvider: ({ children, value, }: {
|
113
|
+
children: ReactNode;
|
114
|
+
value: DropZoneContext;
|
115
|
+
}) => react_jsx_runtime.JSX.Element;
|
116
|
+
|
117
|
+
type DropZoneDndData = {
|
118
|
+
areaId?: string;
|
119
|
+
depth: number;
|
120
|
+
path: UniqueIdentifier[];
|
121
|
+
isDroppableTarget: boolean;
|
122
|
+
};
|
81
123
|
declare const DropZone: react.ForwardRefExoticComponent<DropZoneProps & react.RefAttributes<HTMLDivElement>>;
|
82
124
|
|
83
125
|
declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
|
@@ -194,4 +236,4 @@ declare const usePuck: <UserConfig extends Config = Config>() => {
|
|
194
236
|
selectedItem: ComponentDataMap<ExtractPropsFromConfig<UserConfig>> | null;
|
195
237
|
};
|
196
238
|
|
197
|
-
export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, Label, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, migrate, transformProps, usePuck };
|
239
|
+
export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, type DropZoneDndData, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, Label, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, dropZoneContext, migrate, transformProps, usePuck };
|
package/dist/index.js
CHANGED
@@ -169,12 +169,14 @@ __export(core_exports, {
|
|
169
169
|
Button: () => Button,
|
170
170
|
Drawer: () => Drawer,
|
171
171
|
DropZone: () => DropZone,
|
172
|
+
DropZoneProvider: () => DropZoneProvider,
|
172
173
|
FieldLabel: () => FieldLabel,
|
173
174
|
Group: () => Group,
|
174
175
|
IconButton: () => IconButton,
|
175
176
|
Label: () => Label,
|
176
177
|
Puck: () => Puck,
|
177
178
|
Render: () => Render,
|
179
|
+
dropZoneContext: () => dropZoneContext,
|
178
180
|
migrate: () => migrate,
|
179
181
|
overrideKeys: () => overrideKeys,
|
180
182
|
resolveAllData: () => resolveAllData,
|
@@ -3959,7 +3961,6 @@ var DropZoneRender = (0, import_react29.forwardRef)(
|
|
3959
3961
|
}) });
|
3960
3962
|
}
|
3961
3963
|
);
|
3962
|
-
var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZone, __spreadValues({}, props));
|
3963
3964
|
var DropZone = (0, import_react29.forwardRef)(
|
3964
3965
|
function DropZone2(props, ref) {
|
3965
3966
|
const ctx = (0, import_react29.useContext)(dropZoneContext);
|
@@ -4066,25 +4067,6 @@ var GlobalPosition = class {
|
|
4066
4067
|
}
|
4067
4068
|
};
|
4068
4069
|
|
4069
|
-
// lib/bubble-pointer-event.ts
|
4070
|
-
init_react_import();
|
4071
|
-
var BaseEvent = typeof PointerEvent !== "undefined" ? PointerEvent : Event;
|
4072
|
-
var BubbledPointerEvent = class extends BaseEvent {
|
4073
|
-
constructor(type, data) {
|
4074
|
-
super(type, data);
|
4075
|
-
this._originalTarget = null;
|
4076
|
-
this.originalTarget = data.originalTarget;
|
4077
|
-
}
|
4078
|
-
// Necessary for Firefox
|
4079
|
-
set originalTarget(target) {
|
4080
|
-
this._originalTarget = target;
|
4081
|
-
}
|
4082
|
-
// Necessary for Firefox
|
4083
|
-
get originalTarget() {
|
4084
|
-
return this._originalTarget;
|
4085
|
-
}
|
4086
|
-
};
|
4087
|
-
|
4088
4070
|
// lib/dnd/NestedDroppablePlugin.ts
|
4089
4071
|
var depthSort = (candidates) => {
|
4090
4072
|
return candidates.sort((a, b) => {
|
@@ -4209,7 +4191,7 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
|
|
4209
4191
|
}
|
4210
4192
|
const cleanupEffect = (0, import_state.effects)(() => {
|
4211
4193
|
const handleMove = (event) => {
|
4212
|
-
const target = event
|
4194
|
+
const target = event.originalTarget || event.target;
|
4213
4195
|
const position = new GlobalPosition(target, {
|
4214
4196
|
x: event.clientX,
|
4215
4197
|
y: event.clientY
|
@@ -5707,10 +5689,7 @@ var selectorIs = (a, b) => (a == null ? void 0 : a.zone) === (b == null ? void 0
|
|
5707
5689
|
var defaultPageFields = {
|
5708
5690
|
title: { type: "text" }
|
5709
5691
|
};
|
5710
|
-
var useResolvedFields = ({
|
5711
|
-
_skipValueCheck,
|
5712
|
-
_skipIdCheck
|
5713
|
-
} = {}) => {
|
5692
|
+
var useResolvedFields = () => {
|
5714
5693
|
var _a, _b;
|
5715
5694
|
const { selectedItem, state, config } = useAppContext();
|
5716
5695
|
const parent = useParent();
|
@@ -5723,17 +5702,11 @@ var useResolvedFields = ({
|
|
5723
5702
|
);
|
5724
5703
|
const rootProps = data.root.props || data.root;
|
5725
5704
|
const [lastSelectedData, setLastSelectedData] = (0, import_react36.useState)({});
|
5726
|
-
const [resolvedFields, setResolvedFields] = (0, import_react36.useState)(
|
5727
|
-
fields: defaultFields,
|
5728
|
-
id: selectedItem == null ? void 0 : selectedItem.props.id
|
5729
|
-
});
|
5705
|
+
const [resolvedFields, setResolvedFields] = (0, import_react36.useState)(defaultFields);
|
5730
5706
|
const [fieldsLoading, setFieldsLoading] = (0, import_react36.useState)(false);
|
5731
5707
|
const lastFields = (0, import_react36.useRef)(defaultFields);
|
5732
5708
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
5733
|
-
const componentData =
|
5734
|
-
() => selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly || {} },
|
5735
|
-
[selectedItem, rootProps, data.root.readOnly]
|
5736
|
-
);
|
5709
|
+
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
5737
5710
|
const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
|
5738
5711
|
const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
|
5739
5712
|
const hasResolver = hasComponentResolver || hasRootResolver;
|
@@ -5781,25 +5754,15 @@ var useResolvedFields = ({
|
|
5781
5754
|
if (hasResolver) {
|
5782
5755
|
setFieldsLoading(true);
|
5783
5756
|
resolveFields(defaultFields).then((fields) => {
|
5784
|
-
setResolvedFields({
|
5785
|
-
fields: fields || {},
|
5786
|
-
id: selectedItem == null ? void 0 : selectedItem.props.id
|
5787
|
-
});
|
5757
|
+
setResolvedFields(fields || {});
|
5788
5758
|
lastFields.current = fields;
|
5789
5759
|
setFieldsLoading(false);
|
5790
5760
|
});
|
5791
5761
|
return;
|
5792
5762
|
}
|
5793
5763
|
}
|
5794
|
-
setResolvedFields(
|
5795
|
-
}, [
|
5796
|
-
defaultFields,
|
5797
|
-
state.ui.itemSelector,
|
5798
|
-
selectedItem,
|
5799
|
-
hasResolver,
|
5800
|
-
parent,
|
5801
|
-
resolveFields
|
5802
|
-
]);
|
5764
|
+
setResolvedFields(defaultFields);
|
5765
|
+
}, [defaultFields, state.ui.itemSelector, hasResolver, parent]);
|
5803
5766
|
useOnValueChange(
|
5804
5767
|
state.ui.itemSelector,
|
5805
5768
|
() => {
|
@@ -5810,7 +5773,6 @@ var useResolvedFields = ({
|
|
5810
5773
|
useOnValueChange(
|
5811
5774
|
{ data, parent, itemSelector: state.ui.itemSelector },
|
5812
5775
|
() => {
|
5813
|
-
if (_skipValueCheck) return;
|
5814
5776
|
triggerResolver();
|
5815
5777
|
},
|
5816
5778
|
(a, b) => JSON.stringify(a) === JSON.stringify(b)
|
@@ -5818,10 +5780,7 @@ var useResolvedFields = ({
|
|
5818
5780
|
(0, import_react36.useEffect)(() => {
|
5819
5781
|
triggerResolver();
|
5820
5782
|
}, []);
|
5821
|
-
|
5822
|
-
return [defaultFields, fieldsLoading];
|
5823
|
-
}
|
5824
|
-
return [resolvedFields.fields, fieldsLoading];
|
5783
|
+
return [resolvedFields, fieldsLoading];
|
5825
5784
|
};
|
5826
5785
|
|
5827
5786
|
// components/Puck/components/Fields/index.tsx
|
@@ -6411,14 +6370,13 @@ function Render({
|
|
6411
6370
|
config.root.render,
|
6412
6371
|
__spreadProps(__spreadValues({}, rootProps), {
|
6413
6372
|
puck: {
|
6414
|
-
renderDropZone:
|
6415
|
-
isEditing: false
|
6416
|
-
dragRef: null
|
6373
|
+
renderDropZone: DropZone,
|
6374
|
+
isEditing: false
|
6417
6375
|
},
|
6418
6376
|
title,
|
6419
6377
|
editMode: false,
|
6420
6378
|
id: "puck-root",
|
6421
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
6379
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZone, { zone: rootDroppableId })
|
6422
6380
|
})
|
6423
6381
|
)
|
6424
6382
|
}
|
@@ -6434,7 +6392,7 @@ function Render({
|
|
6434
6392
|
depth: 0,
|
6435
6393
|
path: []
|
6436
6394
|
},
|
6437
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
6395
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZone, { zone: rootDroppableId })
|
6438
6396
|
}
|
6439
6397
|
);
|
6440
6398
|
}
|
@@ -6448,8 +6406,21 @@ var useBubbleIframeEvents = (ref) => {
|
|
6448
6406
|
var _a;
|
6449
6407
|
if (ref.current && status === "READY") {
|
6450
6408
|
const iframe = ref.current;
|
6409
|
+
class BubbledPointerEventClass extends PointerEvent {
|
6410
|
+
constructor(type, data) {
|
6411
|
+
super(type, data);
|
6412
|
+
this._originalTarget = null;
|
6413
|
+
this.originalTarget = data.originalTarget;
|
6414
|
+
}
|
6415
|
+
set originalTarget(target) {
|
6416
|
+
this._originalTarget = target;
|
6417
|
+
}
|
6418
|
+
get originalTarget() {
|
6419
|
+
return this._originalTarget;
|
6420
|
+
}
|
6421
|
+
}
|
6451
6422
|
const handlePointerMove = (event) => {
|
6452
|
-
const evt = new
|
6423
|
+
const evt = new BubbledPointerEventClass("pointermove", __spreadProps(__spreadValues({}, event), {
|
6453
6424
|
bubbles: true,
|
6454
6425
|
cancelable: false,
|
6455
6426
|
clientX: event.clientX,
|
@@ -6494,12 +6465,12 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
6494
6465
|
Page,
|
6495
6466
|
__spreadProps(__spreadValues({}, rootProps), {
|
6496
6467
|
puck: {
|
6497
|
-
renderDropZone:
|
6468
|
+
renderDropZone: DropZone,
|
6498
6469
|
isEditing: true,
|
6499
6470
|
dragRef: null
|
6500
6471
|
},
|
6501
6472
|
editMode: true,
|
6502
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
6473
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId })
|
6503
6474
|
})
|
6504
6475
|
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Render, { data: state.data, config });
|
6505
6476
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
@@ -7982,12 +7953,14 @@ var usePuck = () => {
|
|
7982
7953
|
Button,
|
7983
7954
|
Drawer,
|
7984
7955
|
DropZone,
|
7956
|
+
DropZoneProvider,
|
7985
7957
|
FieldLabel,
|
7986
7958
|
Group,
|
7987
7959
|
IconButton,
|
7988
7960
|
Label,
|
7989
7961
|
Puck,
|
7990
7962
|
Render,
|
7963
|
+
dropZoneContext,
|
7991
7964
|
migrate,
|
7992
7965
|
overrideKeys,
|
7993
7966
|
resolveAllData,
|
package/dist/index.mjs
CHANGED
@@ -3804,7 +3804,6 @@ var DropZoneRender = forwardRef3(
|
|
3804
3804
|
}) });
|
3805
3805
|
}
|
3806
3806
|
);
|
3807
|
-
var DropZonePure = (props) => /* @__PURE__ */ jsx22(DropZone, __spreadValues({}, props));
|
3808
3807
|
var DropZone = forwardRef3(
|
3809
3808
|
function DropZone2(props, ref) {
|
3810
3809
|
const ctx = useContext6(dropZoneContext);
|
@@ -3911,25 +3910,6 @@ var GlobalPosition = class {
|
|
3911
3910
|
}
|
3912
3911
|
};
|
3913
3912
|
|
3914
|
-
// lib/bubble-pointer-event.ts
|
3915
|
-
init_react_import();
|
3916
|
-
var BaseEvent = typeof PointerEvent !== "undefined" ? PointerEvent : Event;
|
3917
|
-
var BubbledPointerEvent = class extends BaseEvent {
|
3918
|
-
constructor(type, data) {
|
3919
|
-
super(type, data);
|
3920
|
-
this._originalTarget = null;
|
3921
|
-
this.originalTarget = data.originalTarget;
|
3922
|
-
}
|
3923
|
-
// Necessary for Firefox
|
3924
|
-
set originalTarget(target) {
|
3925
|
-
this._originalTarget = target;
|
3926
|
-
}
|
3927
|
-
// Necessary for Firefox
|
3928
|
-
get originalTarget() {
|
3929
|
-
return this._originalTarget;
|
3930
|
-
}
|
3931
|
-
};
|
3932
|
-
|
3933
3913
|
// lib/dnd/NestedDroppablePlugin.ts
|
3934
3914
|
var depthSort = (candidates) => {
|
3935
3915
|
return candidates.sort((a, b) => {
|
@@ -4054,7 +4034,7 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
|
|
4054
4034
|
}
|
4055
4035
|
const cleanupEffect = effects(() => {
|
4056
4036
|
const handleMove = (event) => {
|
4057
|
-
const target = event
|
4037
|
+
const target = event.originalTarget || event.target;
|
4058
4038
|
const position = new GlobalPosition(target, {
|
4059
4039
|
x: event.clientX,
|
4060
4040
|
y: event.clientY
|
@@ -5567,10 +5547,7 @@ var selectorIs = (a, b) => (a == null ? void 0 : a.zone) === (b == null ? void 0
|
|
5567
5547
|
var defaultPageFields = {
|
5568
5548
|
title: { type: "text" }
|
5569
5549
|
};
|
5570
|
-
var useResolvedFields = ({
|
5571
|
-
_skipValueCheck,
|
5572
|
-
_skipIdCheck
|
5573
|
-
} = {}) => {
|
5550
|
+
var useResolvedFields = () => {
|
5574
5551
|
var _a, _b;
|
5575
5552
|
const { selectedItem, state, config } = useAppContext();
|
5576
5553
|
const parent = useParent();
|
@@ -5583,17 +5560,11 @@ var useResolvedFields = ({
|
|
5583
5560
|
);
|
5584
5561
|
const rootProps = data.root.props || data.root;
|
5585
5562
|
const [lastSelectedData, setLastSelectedData] = useState19({});
|
5586
|
-
const [resolvedFields, setResolvedFields] = useState19(
|
5587
|
-
fields: defaultFields,
|
5588
|
-
id: selectedItem == null ? void 0 : selectedItem.props.id
|
5589
|
-
});
|
5563
|
+
const [resolvedFields, setResolvedFields] = useState19(defaultFields);
|
5590
5564
|
const [fieldsLoading, setFieldsLoading] = useState19(false);
|
5591
5565
|
const lastFields = useRef5(defaultFields);
|
5592
5566
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
5593
|
-
const componentData =
|
5594
|
-
() => selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly || {} },
|
5595
|
-
[selectedItem, rootProps, data.root.readOnly]
|
5596
|
-
);
|
5567
|
+
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
5597
5568
|
const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
|
5598
5569
|
const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
|
5599
5570
|
const hasResolver = hasComponentResolver || hasRootResolver;
|
@@ -5641,25 +5612,15 @@ var useResolvedFields = ({
|
|
5641
5612
|
if (hasResolver) {
|
5642
5613
|
setFieldsLoading(true);
|
5643
5614
|
resolveFields(defaultFields).then((fields) => {
|
5644
|
-
setResolvedFields({
|
5645
|
-
fields: fields || {},
|
5646
|
-
id: selectedItem == null ? void 0 : selectedItem.props.id
|
5647
|
-
});
|
5615
|
+
setResolvedFields(fields || {});
|
5648
5616
|
lastFields.current = fields;
|
5649
5617
|
setFieldsLoading(false);
|
5650
5618
|
});
|
5651
5619
|
return;
|
5652
5620
|
}
|
5653
5621
|
}
|
5654
|
-
setResolvedFields(
|
5655
|
-
}, [
|
5656
|
-
defaultFields,
|
5657
|
-
state.ui.itemSelector,
|
5658
|
-
selectedItem,
|
5659
|
-
hasResolver,
|
5660
|
-
parent,
|
5661
|
-
resolveFields
|
5662
|
-
]);
|
5622
|
+
setResolvedFields(defaultFields);
|
5623
|
+
}, [defaultFields, state.ui.itemSelector, hasResolver, parent]);
|
5663
5624
|
useOnValueChange(
|
5664
5625
|
state.ui.itemSelector,
|
5665
5626
|
() => {
|
@@ -5670,7 +5631,6 @@ var useResolvedFields = ({
|
|
5670
5631
|
useOnValueChange(
|
5671
5632
|
{ data, parent, itemSelector: state.ui.itemSelector },
|
5672
5633
|
() => {
|
5673
|
-
if (_skipValueCheck) return;
|
5674
5634
|
triggerResolver();
|
5675
5635
|
},
|
5676
5636
|
(a, b) => JSON.stringify(a) === JSON.stringify(b)
|
@@ -5678,10 +5638,7 @@ var useResolvedFields = ({
|
|
5678
5638
|
useEffect17(() => {
|
5679
5639
|
triggerResolver();
|
5680
5640
|
}, []);
|
5681
|
-
|
5682
|
-
return [defaultFields, fieldsLoading];
|
5683
|
-
}
|
5684
|
-
return [resolvedFields.fields, fieldsLoading];
|
5641
|
+
return [resolvedFields, fieldsLoading];
|
5685
5642
|
};
|
5686
5643
|
|
5687
5644
|
// components/Puck/components/Fields/index.tsx
|
@@ -6276,14 +6233,13 @@ function Render({
|
|
6276
6233
|
config.root.render,
|
6277
6234
|
__spreadProps(__spreadValues({}, rootProps), {
|
6278
6235
|
puck: {
|
6279
|
-
renderDropZone:
|
6280
|
-
isEditing: false
|
6281
|
-
dragRef: null
|
6236
|
+
renderDropZone: DropZone,
|
6237
|
+
isEditing: false
|
6282
6238
|
},
|
6283
6239
|
title,
|
6284
6240
|
editMode: false,
|
6285
6241
|
id: "puck-root",
|
6286
|
-
children: /* @__PURE__ */ jsx32(
|
6242
|
+
children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
|
6287
6243
|
})
|
6288
6244
|
)
|
6289
6245
|
}
|
@@ -6299,7 +6255,7 @@ function Render({
|
|
6299
6255
|
depth: 0,
|
6300
6256
|
path: []
|
6301
6257
|
},
|
6302
|
-
children: /* @__PURE__ */ jsx32(
|
6258
|
+
children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
|
6303
6259
|
}
|
6304
6260
|
);
|
6305
6261
|
}
|
@@ -6313,8 +6269,21 @@ var useBubbleIframeEvents = (ref) => {
|
|
6313
6269
|
var _a;
|
6314
6270
|
if (ref.current && status === "READY") {
|
6315
6271
|
const iframe = ref.current;
|
6272
|
+
class BubbledPointerEventClass extends PointerEvent {
|
6273
|
+
constructor(type, data) {
|
6274
|
+
super(type, data);
|
6275
|
+
this._originalTarget = null;
|
6276
|
+
this.originalTarget = data.originalTarget;
|
6277
|
+
}
|
6278
|
+
set originalTarget(target) {
|
6279
|
+
this._originalTarget = target;
|
6280
|
+
}
|
6281
|
+
get originalTarget() {
|
6282
|
+
return this._originalTarget;
|
6283
|
+
}
|
6284
|
+
}
|
6316
6285
|
const handlePointerMove = (event) => {
|
6317
|
-
const evt = new
|
6286
|
+
const evt = new BubbledPointerEventClass("pointermove", __spreadProps(__spreadValues({}, event), {
|
6318
6287
|
bubbles: true,
|
6319
6288
|
cancelable: false,
|
6320
6289
|
clientX: event.clientX,
|
@@ -6359,12 +6328,12 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
6359
6328
|
Page,
|
6360
6329
|
__spreadProps(__spreadValues({}, rootProps), {
|
6361
6330
|
puck: {
|
6362
|
-
renderDropZone:
|
6331
|
+
renderDropZone: DropZone,
|
6363
6332
|
isEditing: true,
|
6364
6333
|
dragRef: null
|
6365
6334
|
},
|
6366
6335
|
editMode: true,
|
6367
|
-
children: /* @__PURE__ */ jsx33(
|
6336
|
+
children: /* @__PURE__ */ jsx33(DropZone, { zone: rootDroppableId })
|
6368
6337
|
})
|
6369
6338
|
) : /* @__PURE__ */ jsx33(Render, { data: state.data, config });
|
6370
6339
|
return /* @__PURE__ */ jsx33(
|
@@ -7812,12 +7781,14 @@ export {
|
|
7812
7781
|
Button,
|
7813
7782
|
Drawer,
|
7814
7783
|
DropZone,
|
7784
|
+
DropZoneProvider,
|
7815
7785
|
FieldLabel,
|
7816
7786
|
Group,
|
7817
7787
|
IconButton,
|
7818
7788
|
Label,
|
7819
7789
|
Puck,
|
7820
7790
|
Render,
|
7791
|
+
dropZoneContext,
|
7821
7792
|
migrate,
|
7822
7793
|
overrideKeys,
|
7823
7794
|
resolveAllData,
|
@@ -182,7 +182,7 @@ type Config<Props extends DefaultComponentProps = DefaultComponentProps, RootPro
|
|
182
182
|
components: {
|
183
183
|
[ComponentName in keyof Props]: Omit<ComponentConfig<Props[ComponentName], Props[ComponentName]>, "type">;
|
184
184
|
};
|
185
|
-
root?: Partial<ComponentConfig<
|
185
|
+
root?: Partial<ComponentConfig<DefaultRootRenderProps<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
|
186
186
|
};
|
187
187
|
|
188
188
|
type WithId<Props> = Props & {
|
@@ -459,4 +459,4 @@ type PuckAction = {
|
|
459
459
|
|
460
460
|
declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
|
461
461
|
|
462
|
-
export { type
|
462
|
+
export { type PuckContext as $, type AppState as A, type BaseData as B, type Config as C, type Data as D, type ExtractPropsFromConfig as E, type FieldProps as F, type BaseField as G, type History as H, type ItemSelector as I, type TextareaField as J, type RadioField as K, type ArrayField as L, type MappedItem as M, type NumberField as N, type OnAction as O, type Permissions as P, type ObjectField as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type Adaptor as W, type ExternalFieldWithAdaptor as X, type ExternalField as Y, type CustomField as Z, type Fields as _, type Field as a, type DefaultRootRenderProps as a0, type DefaultRootProps as a1, type WithId as a2, type WithPuckProps as a3, type AsFieldProps as a4, type WithChildren as a5, resolveAllData as a6, type DropZoneProps as b, type UiState as c, type Plugin as d, type Overrides as e, type PuckAction as f, type IframeConfig as g, type InitialHistory as h, type DefaultComponentProps as i, type DefaultRootFieldProps as j, type ExtractRootPropsFromConfig as k, type ComponentDataMap as l, type Direction as m, type DragAxis as n, type Viewport as o, overrideKeys as p, type OverrideKey as q, type FieldRenderFunctions as r, type ItemWithId as s, type ArrayState as t, type PuckComponent as u, type ComponentConfig as v, type RootDataWithoutProps as w, type RootData as x, type ComponentData as y, type Content as z };
|
@@ -182,7 +182,7 @@ type Config<Props extends DefaultComponentProps = DefaultComponentProps, RootPro
|
|
182
182
|
components: {
|
183
183
|
[ComponentName in keyof Props]: Omit<ComponentConfig<Props[ComponentName], Props[ComponentName]>, "type">;
|
184
184
|
};
|
185
|
-
root?: Partial<ComponentConfig<
|
185
|
+
root?: Partial<ComponentConfig<DefaultRootRenderProps<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
|
186
186
|
};
|
187
187
|
|
188
188
|
type WithId<Props> = Props & {
|
@@ -459,4 +459,4 @@ type PuckAction = {
|
|
459
459
|
|
460
460
|
declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
|
461
461
|
|
462
|
-
export { type
|
462
|
+
export { type PuckContext as $, type AppState as A, type BaseData as B, type Config as C, type Data as D, type ExtractPropsFromConfig as E, type FieldProps as F, type BaseField as G, type History as H, type ItemSelector as I, type TextareaField as J, type RadioField as K, type ArrayField as L, type MappedItem as M, type NumberField as N, type OnAction as O, type Permissions as P, type ObjectField as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type Adaptor as W, type ExternalFieldWithAdaptor as X, type ExternalField as Y, type CustomField as Z, type Fields as _, type Field as a, type DefaultRootRenderProps as a0, type DefaultRootProps as a1, type WithId as a2, type WithPuckProps as a3, type AsFieldProps as a4, type WithChildren as a5, resolveAllData as a6, type DropZoneProps as b, type UiState as c, type Plugin as d, type Overrides as e, type PuckAction as f, type IframeConfig as g, type InitialHistory as h, type DefaultComponentProps as i, type DefaultRootFieldProps as j, type ExtractRootPropsFromConfig as k, type ComponentDataMap as l, type Direction as m, type DragAxis as n, type Viewport as o, overrideKeys as p, type OverrideKey as q, type FieldRenderFunctions as r, type ItemWithId as s, type ArrayState as t, type PuckComponent as u, type ComponentConfig as v, type RootDataWithoutProps as w, type RootData as x, type ComponentData as y, type Content as z };
|
package/dist/rsc.d.mts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { C as Config,
|
3
|
-
export {
|
2
|
+
import { C as Config, D as Data } from './resolve-all-data-DzJEE28m.mjs';
|
3
|
+
export { a6 as resolveAllData } from './resolve-all-data-DzJEE28m.mjs';
|
4
4
|
import 'react';
|
5
5
|
|
6
|
-
declare function Render<UserConfig extends Config = Config
|
6
|
+
declare function Render<UserConfig extends Config = Config>({ config, data, }: {
|
7
7
|
config: UserConfig;
|
8
|
-
data:
|
8
|
+
data: Data;
|
9
9
|
}): react_jsx_runtime.JSX.Element;
|
10
10
|
|
11
11
|
export { Render };
|
package/dist/rsc.d.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { C as Config,
|
3
|
-
export {
|
2
|
+
import { C as Config, D as Data } from './resolve-all-data-DzJEE28m.js';
|
3
|
+
export { a6 as resolveAllData } from './resolve-all-data-DzJEE28m.js';
|
4
4
|
import 'react';
|
5
5
|
|
6
|
-
declare function Render<UserConfig extends Config = Config
|
6
|
+
declare function Render<UserConfig extends Config = Config>({ config, data, }: {
|
7
7
|
config: UserConfig;
|
8
|
-
data:
|
8
|
+
data: Data;
|
9
9
|
}): react_jsx_runtime.JSX.Element;
|
10
10
|
|
11
11
|
export { Render };
|
package/dist/rsc.js
CHANGED
@@ -131,7 +131,10 @@ function DropZoneRender({
|
|
131
131
|
return null;
|
132
132
|
}) });
|
133
133
|
}
|
134
|
-
function Render({
|
134
|
+
function Render({
|
135
|
+
config,
|
136
|
+
data
|
137
|
+
}) {
|
135
138
|
var _a;
|
136
139
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
137
140
|
const rootProps = data.root.props || data.root;
|
@@ -141,8 +144,7 @@ function Render({ config, data }) {
|
|
141
144
|
__spreadProps(__spreadValues({}, rootProps), {
|
142
145
|
puck: {
|
143
146
|
renderDropZone: ({ zone }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropZoneRender, { zone, data, config }),
|
144
|
-
isEditing: false
|
145
|
-
dragRef: null
|
147
|
+
isEditing: false
|
146
148
|
},
|
147
149
|
title,
|
148
150
|
editMode: false,
|
package/dist/rsc.mjs
CHANGED
@@ -52,7 +52,10 @@ function DropZoneRender({
|
|
52
52
|
return null;
|
53
53
|
}) });
|
54
54
|
}
|
55
|
-
function Render({
|
55
|
+
function Render({
|
56
|
+
config,
|
57
|
+
data
|
58
|
+
}) {
|
56
59
|
var _a;
|
57
60
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
58
61
|
const rootProps = data.root.props || data.root;
|
@@ -62,8 +65,7 @@ function Render({ config, data }) {
|
|
62
65
|
__spreadProps(__spreadValues({}, rootProps), {
|
63
66
|
puck: {
|
64
67
|
renderDropZone: ({ zone }) => /* @__PURE__ */ jsx(DropZoneRender, { zone, data, config }),
|
65
|
-
isEditing: false
|
66
|
-
dragRef: null
|
68
|
+
isEditing: false
|
67
69
|
},
|
68
70
|
title,
|
69
71
|
editMode: false,
|
package/package.json
CHANGED