@measured/puck 0.18.2-canary.b9ce5b7 → 0.18.2-canary.bdef789

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 CHANGED
@@ -1,8 +1,9 @@
1
- import { F as FieldProps, a as Field, D as DropZoneProps, C as Config, U as UserGenerics, b as Data, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, I as IframeConfig, g as InitialHistory, h as DefaultComponentProps, i as DefaultRootFieldProps, H as History, A as AppState, E as ExtractPropsFromConfig, j as ExtractRootPropsFromConfig, k as ComponentDataMap } from './resolve-all-data-C-cc7ftj.mjs';
2
- export { Q as Adaptor, K as ArrayField, s as ArrayState, a3 as AsFieldProps, B as BaseData, z as BaseField, u as ComponentConfig, x as ComponentData, y as Content, Y as CustomField, a0 as DefaultRootProps, $ as DefaultRootRenderProps, l as Direction, m as DragAxis, X as ExternalField, W as ExternalFieldWithAdaptor, q as FieldRenderFunctions, Z as Fields, r as ItemWithId, M as MappedItem, N as NumberField, L as ObjectField, p as OverrideKey, t as PuckComponent, _ as PuckContext, J as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, G as TextareaField, n as Viewport, a4 as WithChildren, a1 as WithId, a2 as WithPuckProps, o as overrideKeys, a5 as resolveAllData } from './resolve-all-data-C-cc7ftj.mjs';
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, D as DropZoneProps, C as Config, U as UserGenerics, b as Data, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, I as IframeConfig, g as InitialHistory, h as DefaultComponentProps, i as DefaultRootFieldProps, H as History, A as AppState, E as ExtractPropsFromConfig, j as ExtractRootPropsFromConfig, k as ComponentDataMap } from './resolve-all-data-C-cc7ftj.js';
2
- export { Q as Adaptor, K as ArrayField, s as ArrayState, a3 as AsFieldProps, B as BaseData, z as BaseField, u as ComponentConfig, x as ComponentData, y as Content, Y as CustomField, a0 as DefaultRootProps, $ as DefaultRootRenderProps, l as Direction, m as DragAxis, X as ExternalField, W as ExternalFieldWithAdaptor, q as FieldRenderFunctions, Z as Fields, r as ItemWithId, M as MappedItem, N as NumberField, L as ObjectField, p as OverrideKey, t as PuckComponent, _ as PuckContext, J as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, G as TextareaField, n as Viewport, a4 as WithChildren, a1 as WithId, a2 as WithPuckProps, o as overrideKeys, a5 as resolveAllData } from './resolve-all-data-C-cc7ftj.js';
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 instanceof BubbledPointerEvent ? event.originalTarget || event.target : event.target;
4194
+ const target = event.originalTarget || event.target;
4213
4195
  const position = new GlobalPosition(target, {
4214
4196
  x: event.clientX,
4215
4197
  y: event.clientY
@@ -5724,10 +5706,7 @@ var useResolvedFields = () => {
5724
5706
  const [fieldsLoading, setFieldsLoading] = (0, import_react36.useState)(false);
5725
5707
  const lastFields = (0, import_react36.useRef)(defaultFields);
5726
5708
  const defaultResolveFields = (_componentData, _params) => defaultFields;
5727
- const componentData = (0, import_react36.useMemo)(
5728
- () => selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly || {} },
5729
- [selectedItem, rootProps, data.root.readOnly]
5730
- );
5709
+ const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
5731
5710
  const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
5732
5711
  const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
5733
5712
  const hasResolver = hasComponentResolver || hasRootResolver;
@@ -5783,13 +5762,7 @@ var useResolvedFields = () => {
5783
5762
  }
5784
5763
  }
5785
5764
  setResolvedFields(defaultFields);
5786
- }, [
5787
- defaultFields,
5788
- state.ui.itemSelector,
5789
- hasResolver,
5790
- parent,
5791
- resolveFields
5792
- ]);
5765
+ }, [defaultFields, state.ui.itemSelector, hasResolver, parent]);
5793
5766
  useOnValueChange(
5794
5767
  state.ui.itemSelector,
5795
5768
  () => {
@@ -6397,14 +6370,13 @@ function Render({
6397
6370
  config.root.render,
6398
6371
  __spreadProps(__spreadValues({}, rootProps), {
6399
6372
  puck: {
6400
- renderDropZone: DropZonePure,
6401
- isEditing: false,
6402
- dragRef: null
6373
+ renderDropZone: DropZone,
6374
+ isEditing: false
6403
6375
  },
6404
6376
  title,
6405
6377
  editMode: false,
6406
6378
  id: "puck-root",
6407
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZonePure, { zone: rootDroppableId })
6379
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZone, { zone: rootDroppableId })
6408
6380
  })
6409
6381
  )
6410
6382
  }
@@ -6420,7 +6392,7 @@ function Render({
6420
6392
  depth: 0,
6421
6393
  path: []
6422
6394
  },
6423
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZonePure, { zone: rootDroppableId })
6395
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZone, { zone: rootDroppableId })
6424
6396
  }
6425
6397
  );
6426
6398
  }
@@ -6434,8 +6406,21 @@ var useBubbleIframeEvents = (ref) => {
6434
6406
  var _a;
6435
6407
  if (ref.current && status === "READY") {
6436
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
+ }
6437
6422
  const handlePointerMove = (event) => {
6438
- const evt = new BubbledPointerEvent("pointermove", __spreadProps(__spreadValues({}, event), {
6423
+ const evt = new BubbledPointerEventClass("pointermove", __spreadProps(__spreadValues({}, event), {
6439
6424
  bubbles: true,
6440
6425
  cancelable: false,
6441
6426
  clientX: event.clientX,
@@ -6480,12 +6465,12 @@ var Preview2 = ({ id = "puck-preview" }) => {
6480
6465
  Page,
6481
6466
  __spreadProps(__spreadValues({}, rootProps), {
6482
6467
  puck: {
6483
- renderDropZone: DropZonePure,
6468
+ renderDropZone: DropZone,
6484
6469
  isEditing: true,
6485
6470
  dragRef: null
6486
6471
  },
6487
6472
  editMode: true,
6488
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZonePure, { zone: rootDroppableId })
6473
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId })
6489
6474
  })
6490
6475
  ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Render, { data: state.data, config });
6491
6476
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
@@ -7448,11 +7433,6 @@ var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
7448
7433
  preventDefault: true,
7449
7434
  document: resolvedFrame
7450
7435
  });
7451
- (0, import_react_hotkeys_hook2.useHotkeys)("ctrl+i", toggleInteractive, { preventDefault: true });
7452
- (0, import_react_hotkeys_hook2.useHotkeys)("ctrl+i", toggleInteractiveIframe, {
7453
- preventDefault: true,
7454
- document: resolvedFrame
7455
- });
7456
7436
  };
7457
7437
 
7458
7438
  // components/Puck/index.tsx
@@ -7968,12 +7948,14 @@ var usePuck = () => {
7968
7948
  Button,
7969
7949
  Drawer,
7970
7950
  DropZone,
7951
+ DropZoneProvider,
7971
7952
  FieldLabel,
7972
7953
  Group,
7973
7954
  IconButton,
7974
7955
  Label,
7975
7956
  Puck,
7976
7957
  Render,
7958
+ dropZoneContext,
7977
7959
  migrate,
7978
7960
  overrideKeys,
7979
7961
  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 instanceof BubbledPointerEvent ? event.originalTarget || event.target : event.target;
4037
+ const target = event.originalTarget || event.target;
4058
4038
  const position = new GlobalPosition(target, {
4059
4039
  x: event.clientX,
4060
4040
  y: event.clientY
@@ -5584,10 +5564,7 @@ var useResolvedFields = () => {
5584
5564
  const [fieldsLoading, setFieldsLoading] = useState19(false);
5585
5565
  const lastFields = useRef5(defaultFields);
5586
5566
  const defaultResolveFields = (_componentData, _params) => defaultFields;
5587
- const componentData = useMemo11(
5588
- () => selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly || {} },
5589
- [selectedItem, rootProps, data.root.readOnly]
5590
- );
5567
+ const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
5591
5568
  const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
5592
5569
  const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
5593
5570
  const hasResolver = hasComponentResolver || hasRootResolver;
@@ -5643,13 +5620,7 @@ var useResolvedFields = () => {
5643
5620
  }
5644
5621
  }
5645
5622
  setResolvedFields(defaultFields);
5646
- }, [
5647
- defaultFields,
5648
- state.ui.itemSelector,
5649
- hasResolver,
5650
- parent,
5651
- resolveFields
5652
- ]);
5623
+ }, [defaultFields, state.ui.itemSelector, hasResolver, parent]);
5653
5624
  useOnValueChange(
5654
5625
  state.ui.itemSelector,
5655
5626
  () => {
@@ -6262,14 +6233,13 @@ function Render({
6262
6233
  config.root.render,
6263
6234
  __spreadProps(__spreadValues({}, rootProps), {
6264
6235
  puck: {
6265
- renderDropZone: DropZonePure,
6266
- isEditing: false,
6267
- dragRef: null
6236
+ renderDropZone: DropZone,
6237
+ isEditing: false
6268
6238
  },
6269
6239
  title,
6270
6240
  editMode: false,
6271
6241
  id: "puck-root",
6272
- children: /* @__PURE__ */ jsx32(DropZonePure, { zone: rootDroppableId })
6242
+ children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
6273
6243
  })
6274
6244
  )
6275
6245
  }
@@ -6285,7 +6255,7 @@ function Render({
6285
6255
  depth: 0,
6286
6256
  path: []
6287
6257
  },
6288
- children: /* @__PURE__ */ jsx32(DropZonePure, { zone: rootDroppableId })
6258
+ children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
6289
6259
  }
6290
6260
  );
6291
6261
  }
@@ -6299,8 +6269,21 @@ var useBubbleIframeEvents = (ref) => {
6299
6269
  var _a;
6300
6270
  if (ref.current && status === "READY") {
6301
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
+ }
6302
6285
  const handlePointerMove = (event) => {
6303
- const evt = new BubbledPointerEvent("pointermove", __spreadProps(__spreadValues({}, event), {
6286
+ const evt = new BubbledPointerEventClass("pointermove", __spreadProps(__spreadValues({}, event), {
6304
6287
  bubbles: true,
6305
6288
  cancelable: false,
6306
6289
  clientX: event.clientX,
@@ -6345,12 +6328,12 @@ var Preview2 = ({ id = "puck-preview" }) => {
6345
6328
  Page,
6346
6329
  __spreadProps(__spreadValues({}, rootProps), {
6347
6330
  puck: {
6348
- renderDropZone: DropZonePure,
6331
+ renderDropZone: DropZone,
6349
6332
  isEditing: true,
6350
6333
  dragRef: null
6351
6334
  },
6352
6335
  editMode: true,
6353
- children: /* @__PURE__ */ jsx33(DropZonePure, { zone: rootDroppableId })
6336
+ children: /* @__PURE__ */ jsx33(DropZone, { zone: rootDroppableId })
6354
6337
  })
6355
6338
  ) : /* @__PURE__ */ jsx33(Render, { data: state.data, config });
6356
6339
  return /* @__PURE__ */ jsx33(
@@ -7319,11 +7302,6 @@ var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
7319
7302
  preventDefault: true,
7320
7303
  document: resolvedFrame
7321
7304
  });
7322
- useHotkeys2("ctrl+i", toggleInteractive, { preventDefault: true });
7323
- useHotkeys2("ctrl+i", toggleInteractiveIframe, {
7324
- preventDefault: true,
7325
- document: resolvedFrame
7326
- });
7327
7305
  };
7328
7306
 
7329
7307
  // components/Puck/index.tsx
@@ -7798,12 +7776,14 @@ export {
7798
7776
  Button,
7799
7777
  Drawer,
7800
7778
  DropZone,
7779
+ DropZoneProvider,
7801
7780
  FieldLabel,
7802
7781
  Group,
7803
7782
  IconButton,
7804
7783
  Label,
7805
7784
  Puck,
7806
7785
  Render,
7786
+ dropZoneContext,
7807
7787
  migrate,
7808
7788
  overrideKeys,
7809
7789
  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<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
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 DefaultRootRenderProps as $, type AppState as A, type BaseData as B, type Config as C, type DropZoneProps as D, type ExtractPropsFromConfig as E, type FieldProps as F, type TextareaField as G, type History as H, type IframeConfig as I, type RadioField as J, type ArrayField as K, type ObjectField as L, type MappedItem as M, type NumberField as N, type OnAction as O, type Permissions as P, type Adaptor as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type ExternalFieldWithAdaptor as W, type ExternalField as X, type CustomField as Y, type Fields as Z, type PuckContext as _, type Field as a, type DefaultRootProps as a0, type WithId as a1, type WithPuckProps as a2, type AsFieldProps as a3, type WithChildren as a4, resolveAllData as a5, type Data as b, type UiState as c, type Plugin as d, type Overrides as e, type PuckAction as f, type InitialHistory as g, type DefaultComponentProps as h, type DefaultRootFieldProps as i, type ExtractRootPropsFromConfig as j, type ComponentDataMap as k, type Direction as l, type DragAxis as m, type Viewport as n, overrideKeys as o, type OverrideKey as p, type FieldRenderFunctions as q, type ItemWithId as r, type ArrayState as s, type PuckComponent as t, type ComponentConfig as u, type RootDataWithoutProps as v, type RootData as w, type ComponentData as x, type Content as y, type BaseField as z };
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<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
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 DefaultRootRenderProps as $, type AppState as A, type BaseData as B, type Config as C, type DropZoneProps as D, type ExtractPropsFromConfig as E, type FieldProps as F, type TextareaField as G, type History as H, type IframeConfig as I, type RadioField as J, type ArrayField as K, type ObjectField as L, type MappedItem as M, type NumberField as N, type OnAction as O, type Permissions as P, type Adaptor as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type ExternalFieldWithAdaptor as W, type ExternalField as X, type CustomField as Y, type Fields as Z, type PuckContext as _, type Field as a, type DefaultRootProps as a0, type WithId as a1, type WithPuckProps as a2, type AsFieldProps as a3, type WithChildren as a4, resolveAllData as a5, type Data as b, type UiState as c, type Plugin as d, type Overrides as e, type PuckAction as f, type InitialHistory as g, type DefaultComponentProps as h, type DefaultRootFieldProps as i, type ExtractRootPropsFromConfig as j, type ComponentDataMap as k, type Direction as l, type DragAxis as m, type Viewport as n, overrideKeys as o, type OverrideKey as p, type FieldRenderFunctions as q, type ItemWithId as r, type ArrayState as s, type PuckComponent as t, type ComponentConfig as u, type RootDataWithoutProps as v, type RootData as w, type ComponentData as x, type Content as y, type BaseField as z };
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, U as UserGenerics } from './resolve-all-data-C-cc7ftj.mjs';
3
- export { a5 as resolveAllData } from './resolve-all-data-C-cc7ftj.mjs';
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, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data }: {
6
+ declare function Render<UserConfig extends Config = Config>({ config, data, }: {
7
7
  config: UserConfig;
8
- data: G["UserData"];
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, U as UserGenerics } from './resolve-all-data-C-cc7ftj.js';
3
- export { a5 as resolveAllData } from './resolve-all-data-C-cc7ftj.js';
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, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data }: {
6
+ declare function Render<UserConfig extends Config = Config>({ config, data, }: {
7
7
  config: UserConfig;
8
- data: G["UserData"];
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({ config, data }) {
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({ config, data }) {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.18.2-canary.b9ce5b7",
3
+ "version": "0.18.2-canary.bdef789",
4
4
  "author": "Measured Corporation Ltd <hello@measured.co>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",