@measured/puck 0.21.0-canary.ace4c8b3 → 0.21.0-canary.b6ca72f9

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.
@@ -914,8 +914,9 @@ var Item = ({
914
914
  );
915
915
  };
916
916
  var SlotRender = forwardRef(
917
- function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
918
- return /* @__PURE__ */ jsx("div", { className, style, ref, children: content.map((item) => {
917
+ function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
918
+ const El = as != null ? as : "div";
919
+ return /* @__PURE__ */ jsx(El, { className, style, ref, children: content.map((item) => {
919
920
  if (!config.components[item.type]) {
920
921
  return null;
921
922
  }
@@ -25,7 +25,7 @@ import {
25
25
  walkAppState,
26
26
  walkField,
27
27
  walkTree
28
- } from "./chunk-TC25DCTQ.mjs";
28
+ } from "./chunk-JA7SEUEH.mjs";
29
29
 
30
30
  // ../../node_modules/classnames/index.js
31
31
  var require_classnames = __commonJS({
@@ -6087,7 +6087,8 @@ var DropZoneEdit = forwardRef3(
6087
6087
  style,
6088
6088
  className,
6089
6089
  minEmptyHeight: userMinEmptyHeight = 128,
6090
- collisionAxis
6090
+ collisionAxis,
6091
+ as
6091
6092
  }, userRef) {
6092
6093
  const ctx = useContext8(dropZoneContext);
6093
6094
  const appStoreApi = useAppStoreApi();
@@ -6230,8 +6231,9 @@ var DropZoneEdit = forwardRef3(
6230
6231
  userMinEmptyHeight,
6231
6232
  ref
6232
6233
  });
6234
+ const El = as != null ? as : "div";
6233
6235
  return /* @__PURE__ */ jsx26(
6234
- "div",
6236
+ El,
6235
6237
  {
6236
6238
  className: `${getClassName19({
6237
6239
  isRootZone,
@@ -6294,7 +6296,7 @@ var DropZoneRenderItem = ({
6294
6296
  };
6295
6297
  var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx26(DropZoneRender, __spreadValues({}, props));
6296
6298
  var DropZoneRender = forwardRef3(
6297
- function DropZoneRenderInternal({ className, style, zone }, ref) {
6299
+ function DropZoneRenderInternal({ className, style, zone, as }, ref) {
6298
6300
  const ctx = useContext8(dropZoneContext);
6299
6301
  const { areaId = "root" } = ctx || {};
6300
6302
  const { config, data, metadata } = useContext8(renderContext);
@@ -6307,13 +6309,14 @@ var DropZoneRender = forwardRef3(
6307
6309
  }
6308
6310
  }
6309
6311
  }, [content]);
6312
+ const El = as != null ? as : "div";
6310
6313
  if (!data || !config) {
6311
6314
  return null;
6312
6315
  }
6313
6316
  if (zoneCompound !== rootDroppableId) {
6314
6317
  content = setupZone(data, zoneCompound).zones[zoneCompound];
6315
6318
  }
6316
- return /* @__PURE__ */ jsx26("div", { className, style, ref, children: content.map((item) => {
6319
+ return /* @__PURE__ */ jsx26(El, { className, style, ref, children: content.map((item) => {
6317
6320
  const Component = config.components[item.type];
6318
6321
  if (Component) {
6319
6322
  return /* @__PURE__ */ jsx26(
@@ -8650,7 +8653,12 @@ function PuckProvider({ children }) {
8650
8653
  });
8651
8654
  })
8652
8655
  );
8653
- const initialHistoryIndex = (_initialHistory == null ? void 0 : _initialHistory.index) || blendedHistories.length - 1;
8656
+ const initialHistoryIndex = useMemo20(() => {
8657
+ if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
8658
+ return _initialHistory == null ? void 0 : _initialHistory.index;
8659
+ }
8660
+ return blendedHistories.length - 1;
8661
+ }, []);
8654
8662
  const initialAppState = blendedHistories[initialHistoryIndex].state;
8655
8663
  const loadedOverrides = useLoadedOverrides({
8656
8664
  overrides,
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
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 } from './walk-tree-CkSoNBF7.mjs';
2
- export { ad as Adaptor, ab as ArrayField, B as ArrayState, ar as AsFieldProps, X as BaseData, a5 as BaseField, af as CacheOpts, J as ComponentConfigExtensions, T as ComponentConfigParams, a0 as ComponentDataMap, _ as ComponentDataOptionalId, a3 as ComponentMetadata, Q as ConfigParams, a1 as Content, ai as CustomField, ah as CustomFieldRender, ao as DefaultComponentProps, L as DefaultComponents, al as DefaultRootFieldProps, an as DefaultRootProps, am as DefaultRootRenderProps, o as Direction, p as DragAxis, ag as ExternalField, ae as ExternalFieldWithAdaptor, N as ExtractConfigParams, at as ExtractField, a4 as FieldMetadata, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, z as ItemWithId, $ as MappedItem, a7 as NumberField, ac as ObjectField, x as OverrideKey, G as PuckComponent, ak as PuckContext, a2 as PuckMetadata, aa as RadioField, K as RootConfig, Z as RootData, Y as RootDataWithoutProps, a9 as SelectField, S as Slot, E as SlotComponent, aj as SlotField, a6 as TextField, a8 as TextareaField, q as Viewport, as as WithChildren, ap as WithId, aq as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CkSoNBF7.mjs';
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 } from './walk-tree-BqwnaCVe.mjs';
2
+ export { ad as Adaptor, ab as ArrayField, B as ArrayState, ar as AsFieldProps, X as BaseData, a5 as BaseField, af as CacheOpts, J as ComponentConfigExtensions, T as ComponentConfigParams, a0 as ComponentDataMap, _ as ComponentDataOptionalId, a3 as ComponentMetadata, Q as ConfigParams, a1 as Content, ai as CustomField, ah as CustomFieldRender, ao as DefaultComponentProps, L as DefaultComponents, al as DefaultRootFieldProps, an as DefaultRootProps, am as DefaultRootRenderProps, o as Direction, p as DragAxis, ag as ExternalField, ae as ExternalFieldWithAdaptor, N as ExtractConfigParams, at as ExtractField, a4 as FieldMetadata, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, z as ItemWithId, $ as MappedItem, a7 as NumberField, ac as ObjectField, x as OverrideKey, G as PuckComponent, ak as PuckContext, a2 as PuckMetadata, aa as RadioField, K as RootConfig, Z as RootData, Y as RootDataWithoutProps, a9 as SelectField, S as Slot, E as SlotComponent, aj as SlotField, a6 as TextField, a8 as TextareaField, q as Viewport, as as WithChildren, ap as WithId, aq as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-BqwnaCVe.mjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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 } from './walk-tree-CkSoNBF7.js';
2
- export { ad as Adaptor, ab as ArrayField, B as ArrayState, ar as AsFieldProps, X as BaseData, a5 as BaseField, af as CacheOpts, J as ComponentConfigExtensions, T as ComponentConfigParams, a0 as ComponentDataMap, _ as ComponentDataOptionalId, a3 as ComponentMetadata, Q as ConfigParams, a1 as Content, ai as CustomField, ah as CustomFieldRender, ao as DefaultComponentProps, L as DefaultComponents, al as DefaultRootFieldProps, an as DefaultRootProps, am as DefaultRootRenderProps, o as Direction, p as DragAxis, ag as ExternalField, ae as ExternalFieldWithAdaptor, N as ExtractConfigParams, at as ExtractField, a4 as FieldMetadata, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, z as ItemWithId, $ as MappedItem, a7 as NumberField, ac as ObjectField, x as OverrideKey, G as PuckComponent, ak as PuckContext, a2 as PuckMetadata, aa as RadioField, K as RootConfig, Z as RootData, Y as RootDataWithoutProps, a9 as SelectField, S as Slot, E as SlotComponent, aj as SlotField, a6 as TextField, a8 as TextareaField, q as Viewport, as as WithChildren, ap as WithId, aq as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CkSoNBF7.js';
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 } from './walk-tree-BqwnaCVe.js';
2
+ export { ad as Adaptor, ab as ArrayField, B as ArrayState, ar as AsFieldProps, X as BaseData, a5 as BaseField, af as CacheOpts, J as ComponentConfigExtensions, T as ComponentConfigParams, a0 as ComponentDataMap, _ as ComponentDataOptionalId, a3 as ComponentMetadata, Q as ConfigParams, a1 as Content, ai as CustomField, ah as CustomFieldRender, ao as DefaultComponentProps, L as DefaultComponents, al as DefaultRootFieldProps, an as DefaultRootProps, am as DefaultRootRenderProps, o as Direction, p as DragAxis, ag as ExternalField, ae as ExternalFieldWithAdaptor, N as ExtractConfigParams, at as ExtractField, a4 as FieldMetadata, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, z as ItemWithId, $ as MappedItem, a7 as NumberField, ac as ObjectField, x as OverrideKey, G as PuckComponent, ak as PuckContext, a2 as PuckMetadata, aa as RadioField, K as RootConfig, Z as RootData, Y as RootDataWithoutProps, a9 as SelectField, S as Slot, E as SlotComponent, aj as SlotField, a6 as TextField, a8 as TextareaField, q as Viewport, as as WithChildren, ap as WithId, aq as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-BqwnaCVe.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
package/dist/index.js CHANGED
@@ -5467,8 +5467,9 @@ var Item = ({
5467
5467
  );
5468
5468
  };
5469
5469
  var SlotRender = (0, import_react31.forwardRef)(
5470
- function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
5471
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className, style, ref, children: content.map((item) => {
5470
+ function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
5471
+ const El = as != null ? as : "div";
5472
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(El, { className, style, ref, children: content.map((item) => {
5472
5473
  if (!config.components[item.type]) {
5473
5474
  return null;
5474
5475
  }
@@ -5983,7 +5984,8 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
5983
5984
  style,
5984
5985
  className,
5985
5986
  minEmptyHeight: userMinEmptyHeight = 128,
5986
- collisionAxis
5987
+ collisionAxis,
5988
+ as
5987
5989
  }, userRef) {
5988
5990
  const ctx = (0, import_react34.useContext)(dropZoneContext);
5989
5991
  const appStoreApi = useAppStoreApi();
@@ -6126,8 +6128,9 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
6126
6128
  userMinEmptyHeight,
6127
6129
  ref
6128
6130
  });
6131
+ const El = as != null ? as : "div";
6129
6132
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6130
- "div",
6133
+ El,
6131
6134
  {
6132
6135
  className: `${getClassName18({
6133
6136
  isRootZone,
@@ -6190,7 +6193,7 @@ var DropZoneRenderItem = ({
6190
6193
  };
6191
6194
  var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZoneRender, __spreadValues({}, props));
6192
6195
  var DropZoneRender = (0, import_react34.forwardRef)(
6193
- function DropZoneRenderInternal({ className, style, zone }, ref) {
6196
+ function DropZoneRenderInternal({ className, style, zone, as }, ref) {
6194
6197
  const ctx = (0, import_react34.useContext)(dropZoneContext);
6195
6198
  const { areaId = "root" } = ctx || {};
6196
6199
  const { config, data, metadata } = (0, import_react34.useContext)(renderContext);
@@ -6203,13 +6206,14 @@ var DropZoneRender = (0, import_react34.forwardRef)(
6203
6206
  }
6204
6207
  }
6205
6208
  }, [content]);
6209
+ const El = as != null ? as : "div";
6206
6210
  if (!data || !config) {
6207
6211
  return null;
6208
6212
  }
6209
6213
  if (zoneCompound !== rootDroppableId) {
6210
6214
  content = setupZone(data, zoneCompound).zones[zoneCompound];
6211
6215
  }
6212
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className, style, ref, children: content.map((item) => {
6216
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(El, { className, style, ref, children: content.map((item) => {
6213
6217
  const Component = config.components[item.type];
6214
6218
  if (Component) {
6215
6219
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
@@ -9350,7 +9354,12 @@ function PuckProvider({ children }) {
9350
9354
  });
9351
9355
  })
9352
9356
  );
9353
- const initialHistoryIndex = (_initialHistory == null ? void 0 : _initialHistory.index) || blendedHistories.length - 1;
9357
+ const initialHistoryIndex = (0, import_react60.useMemo)(() => {
9358
+ if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
9359
+ return _initialHistory == null ? void 0 : _initialHistory.index;
9360
+ }
9361
+ return blendedHistories.length - 1;
9362
+ }, []);
9354
9363
  const initialAppState = blendedHistories[initialHistoryIndex].state;
9355
9364
  const loadedOverrides = useLoadedOverrides({
9356
9365
  overrides,
package/dist/index.mjs CHANGED
@@ -18,14 +18,14 @@ import {
18
18
  setDeep,
19
19
  useGetPuck,
20
20
  usePuck
21
- } from "./chunk-AIFI2M23.mjs";
21
+ } from "./chunk-VL643U2B.mjs";
22
22
  import {
23
23
  init_react_import,
24
24
  migrate,
25
25
  resolveAllData,
26
26
  transformProps,
27
27
  walkTree
28
- } from "./chunk-TC25DCTQ.mjs";
28
+ } from "./chunk-JA7SEUEH.mjs";
29
29
 
30
30
  // bundle/index.ts
31
31
  init_react_import();
@@ -1,4 +1,4 @@
1
- export { ad as Adaptor, A as AppState, ab as ArrayField, B as ArrayState, ar as AsFieldProps, X as BaseData, a5 as BaseField, af as CacheOpts, f as ComponentConfig, J as ComponentConfigExtensions, T as ComponentConfigParams, a as ComponentData, a0 as ComponentDataMap, _ as ComponentDataOptionalId, a3 as ComponentMetadata, C as Config, Q as ConfigParams, a1 as Content, ai as CustomField, ah as CustomFieldRender, j as Data, ao as DefaultComponentProps, L as DefaultComponents, al as DefaultRootFieldProps, an as DefaultRootProps, am as DefaultRootRenderProps, o as Direction, p as DragAxis, ag as ExternalField, ae as ExternalFieldWithAdaptor, N as ExtractConfigParams, at as ExtractField, h as Field, a4 as FieldMetadata, i as FieldProps, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, g as FieldTransforms, F as Fields, H as History, I as IframeConfig, l as InitialHistory, z as ItemWithId, $ as MappedItem, M as Metadata, a7 as NumberField, ac as ObjectField, k as OnAction, x as OverrideKey, O as Overrides, P as Permissions, d as Plugin, b as PuckAction, G as PuckComponent, ak as PuckContext, a2 as PuckMetadata, aa as RadioField, c as ResolveDataTrigger, K as RootConfig, Z as RootData, R as RootDataWithProps, Y as RootDataWithoutProps, a9 as SelectField, S as Slot, E as SlotComponent, aj as SlotField, a6 as TextField, a8 as TextareaField, e as UiState, U as UserGenerics, q as Viewport, V as Viewports, as as WithChildren, ap as WithId, aq as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CkSoNBF7.mjs';
1
+ export { ad as Adaptor, A as AppState, ab as ArrayField, B as ArrayState, ar as AsFieldProps, X as BaseData, a5 as BaseField, af as CacheOpts, f as ComponentConfig, J as ComponentConfigExtensions, T as ComponentConfigParams, a as ComponentData, a0 as ComponentDataMap, _ as ComponentDataOptionalId, a3 as ComponentMetadata, C as Config, Q as ConfigParams, a1 as Content, ai as CustomField, ah as CustomFieldRender, j as Data, ao as DefaultComponentProps, L as DefaultComponents, al as DefaultRootFieldProps, an as DefaultRootProps, am as DefaultRootRenderProps, o as Direction, p as DragAxis, ag as ExternalField, ae as ExternalFieldWithAdaptor, N as ExtractConfigParams, at as ExtractField, h as Field, a4 as FieldMetadata, i as FieldProps, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, g as FieldTransforms, F as Fields, H as History, I as IframeConfig, l as InitialHistory, z as ItemWithId, $ as MappedItem, M as Metadata, a7 as NumberField, ac as ObjectField, k as OnAction, x as OverrideKey, O as Overrides, P as Permissions, d as Plugin, b as PuckAction, G as PuckComponent, ak as PuckContext, a2 as PuckMetadata, aa as RadioField, c as ResolveDataTrigger, K as RootConfig, Z as RootData, R as RootDataWithProps, Y as RootDataWithoutProps, a9 as SelectField, S as Slot, E as SlotComponent, aj as SlotField, a6 as TextField, a8 as TextareaField, e as UiState, U as UserGenerics, q as Viewport, V as Viewports, as as WithChildren, ap as WithId, aq as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-BqwnaCVe.mjs';
2
2
  export { Action, ActionBar, AutoField, Button, Drawer, DropZone, FieldLabel, Group, IconButton, Label, Puck, PuckApi, Render, UsePuckData, createUsePuck, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck } from './index.mjs';
3
3
  import 'react';
4
4
  import 'react/jsx-runtime';
@@ -1,4 +1,4 @@
1
- export { ad as Adaptor, A as AppState, ab as ArrayField, B as ArrayState, ar as AsFieldProps, X as BaseData, a5 as BaseField, af as CacheOpts, f as ComponentConfig, J as ComponentConfigExtensions, T as ComponentConfigParams, a as ComponentData, a0 as ComponentDataMap, _ as ComponentDataOptionalId, a3 as ComponentMetadata, C as Config, Q as ConfigParams, a1 as Content, ai as CustomField, ah as CustomFieldRender, j as Data, ao as DefaultComponentProps, L as DefaultComponents, al as DefaultRootFieldProps, an as DefaultRootProps, am as DefaultRootRenderProps, o as Direction, p as DragAxis, ag as ExternalField, ae as ExternalFieldWithAdaptor, N as ExtractConfigParams, at as ExtractField, h as Field, a4 as FieldMetadata, i as FieldProps, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, g as FieldTransforms, F as Fields, H as History, I as IframeConfig, l as InitialHistory, z as ItemWithId, $ as MappedItem, M as Metadata, a7 as NumberField, ac as ObjectField, k as OnAction, x as OverrideKey, O as Overrides, P as Permissions, d as Plugin, b as PuckAction, G as PuckComponent, ak as PuckContext, a2 as PuckMetadata, aa as RadioField, c as ResolveDataTrigger, K as RootConfig, Z as RootData, R as RootDataWithProps, Y as RootDataWithoutProps, a9 as SelectField, S as Slot, E as SlotComponent, aj as SlotField, a6 as TextField, a8 as TextareaField, e as UiState, U as UserGenerics, q as Viewport, V as Viewports, as as WithChildren, ap as WithId, aq as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CkSoNBF7.js';
1
+ export { ad as Adaptor, A as AppState, ab as ArrayField, B as ArrayState, ar as AsFieldProps, X as BaseData, a5 as BaseField, af as CacheOpts, f as ComponentConfig, J as ComponentConfigExtensions, T as ComponentConfigParams, a as ComponentData, a0 as ComponentDataMap, _ as ComponentDataOptionalId, a3 as ComponentMetadata, C as Config, Q as ConfigParams, a1 as Content, ai as CustomField, ah as CustomFieldRender, j as Data, ao as DefaultComponentProps, L as DefaultComponents, al as DefaultRootFieldProps, an as DefaultRootProps, am as DefaultRootRenderProps, o as Direction, p as DragAxis, ag as ExternalField, ae as ExternalFieldWithAdaptor, N as ExtractConfigParams, at as ExtractField, h as Field, a4 as FieldMetadata, i as FieldProps, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, g as FieldTransforms, F as Fields, H as History, I as IframeConfig, l as InitialHistory, z as ItemWithId, $ as MappedItem, M as Metadata, a7 as NumberField, ac as ObjectField, k as OnAction, x as OverrideKey, O as Overrides, P as Permissions, d as Plugin, b as PuckAction, G as PuckComponent, ak as PuckContext, a2 as PuckMetadata, aa as RadioField, c as ResolveDataTrigger, K as RootConfig, Z as RootData, R as RootDataWithProps, Y as RootDataWithoutProps, a9 as SelectField, S as Slot, E as SlotComponent, aj as SlotField, a6 as TextField, a8 as TextareaField, e as UiState, U as UserGenerics, q as Viewport, V as Viewports, as as WithChildren, ap as WithId, aq as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-BqwnaCVe.js';
2
2
  export { Action, ActionBar, AutoField, Button, Drawer, DropZone, FieldLabel, Group, IconButton, Label, Puck, PuckApi, Render, UsePuckData, createUsePuck, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck } from './index.js';
3
3
  import 'react';
4
4
  import 'react/jsx-runtime';
@@ -5467,8 +5467,9 @@ var Item = ({
5467
5467
  );
5468
5468
  };
5469
5469
  var SlotRender = (0, import_react31.forwardRef)(
5470
- function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
5471
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className, style, ref, children: content.map((item) => {
5470
+ function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
5471
+ const El = as != null ? as : "div";
5472
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(El, { className, style, ref, children: content.map((item) => {
5472
5473
  if (!config.components[item.type]) {
5473
5474
  return null;
5474
5475
  }
@@ -5983,7 +5984,8 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
5983
5984
  style,
5984
5985
  className,
5985
5986
  minEmptyHeight: userMinEmptyHeight = 128,
5986
- collisionAxis
5987
+ collisionAxis,
5988
+ as
5987
5989
  }, userRef) {
5988
5990
  const ctx = (0, import_react34.useContext)(dropZoneContext);
5989
5991
  const appStoreApi = useAppStoreApi();
@@ -6126,8 +6128,9 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
6126
6128
  userMinEmptyHeight,
6127
6129
  ref
6128
6130
  });
6131
+ const El = as != null ? as : "div";
6129
6132
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6130
- "div",
6133
+ El,
6131
6134
  {
6132
6135
  className: `${getClassName18({
6133
6136
  isRootZone,
@@ -6190,7 +6193,7 @@ var DropZoneRenderItem = ({
6190
6193
  };
6191
6194
  var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZoneRender, __spreadValues({}, props));
6192
6195
  var DropZoneRender = (0, import_react34.forwardRef)(
6193
- function DropZoneRenderInternal({ className, style, zone }, ref) {
6196
+ function DropZoneRenderInternal({ className, style, zone, as }, ref) {
6194
6197
  const ctx = (0, import_react34.useContext)(dropZoneContext);
6195
6198
  const { areaId = "root" } = ctx || {};
6196
6199
  const { config, data, metadata } = (0, import_react34.useContext)(renderContext);
@@ -6203,13 +6206,14 @@ var DropZoneRender = (0, import_react34.forwardRef)(
6203
6206
  }
6204
6207
  }
6205
6208
  }, [content]);
6209
+ const El = as != null ? as : "div";
6206
6210
  if (!data || !config) {
6207
6211
  return null;
6208
6212
  }
6209
6213
  if (zoneCompound !== rootDroppableId) {
6210
6214
  content = setupZone(data, zoneCompound).zones[zoneCompound];
6211
6215
  }
6212
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className, style, ref, children: content.map((item) => {
6216
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(El, { className, style, ref, children: content.map((item) => {
6213
6217
  const Component = config.components[item.type];
6214
6218
  if (Component) {
6215
6219
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
@@ -9350,7 +9354,12 @@ function PuckProvider({ children }) {
9350
9354
  });
9351
9355
  })
9352
9356
  );
9353
- const initialHistoryIndex = (_initialHistory == null ? void 0 : _initialHistory.index) || blendedHistories.length - 1;
9357
+ const initialHistoryIndex = (0, import_react60.useMemo)(() => {
9358
+ if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
9359
+ return _initialHistory == null ? void 0 : _initialHistory.index;
9360
+ }
9361
+ return blendedHistories.length - 1;
9362
+ }, []);
9354
9363
  const initialAppState = blendedHistories[initialHistoryIndex].state;
9355
9364
  const loadedOverrides = useLoadedOverrides({
9356
9365
  overrides,
@@ -18,14 +18,14 @@ import {
18
18
  setDeep,
19
19
  useGetPuck,
20
20
  usePuck
21
- } from "./chunk-AIFI2M23.mjs";
21
+ } from "./chunk-VL643U2B.mjs";
22
22
  import {
23
23
  init_react_import,
24
24
  migrate,
25
25
  resolveAllData,
26
26
  transformProps,
27
27
  walkTree
28
- } from "./chunk-TC25DCTQ.mjs";
28
+ } from "./chunk-JA7SEUEH.mjs";
29
29
 
30
30
  // bundle/no-external.ts
31
31
  init_react_import();
package/dist/rsc.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-CkSoNBF7.mjs';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CkSoNBF7.mjs';
2
+ import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-BqwnaCVe.mjs';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-BqwnaCVe.mjs';
4
4
  import 'react';
5
5
 
6
6
  declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
package/dist/rsc.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-CkSoNBF7.js';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CkSoNBF7.js';
2
+ import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-BqwnaCVe.js';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-BqwnaCVe.js';
4
4
  import 'react';
5
5
 
6
6
  declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
package/dist/rsc.js CHANGED
@@ -346,8 +346,9 @@ var Item = ({
346
346
  );
347
347
  };
348
348
  var SlotRender = (0, import_react3.forwardRef)(
349
- function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
350
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className, style, ref, children: content.map((item) => {
349
+ function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
350
+ const El = as != null ? as : "div";
351
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(El, { className, style, ref, children: content.map((item) => {
351
352
  if (!config.components[item.type]) {
352
353
  return null;
353
354
  }
package/dist/rsc.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  transformProps,
13
13
  useSlots,
14
14
  walkTree
15
- } from "./chunk-TC25DCTQ.mjs";
15
+ } from "./chunk-JA7SEUEH.mjs";
16
16
 
17
17
  // bundle/rsc.tsx
18
18
  init_react_import();
@@ -1,4 +1,4 @@
1
- import { ReactElement, CSSProperties, ReactNode, JSX } from 'react';
1
+ import { ReactElement, CSSProperties, ElementType, ReactNode, JSX } from 'react';
2
2
 
3
3
  type ItemSelector = {
4
4
  index: number;
@@ -149,6 +149,7 @@ type DropZoneProps = {
149
149
  minEmptyHeight?: number;
150
150
  className?: string;
151
151
  collisionAxis?: DragAxis;
152
+ as?: ElementType;
152
153
  };
153
154
 
154
155
  type PuckContext = {
@@ -1,4 +1,4 @@
1
- import { ReactElement, CSSProperties, ReactNode, JSX } from 'react';
1
+ import { ReactElement, CSSProperties, ElementType, ReactNode, JSX } from 'react';
2
2
 
3
3
  type ItemSelector = {
4
4
  index: number;
@@ -149,6 +149,7 @@ type DropZoneProps = {
149
149
  minEmptyHeight?: number;
150
150
  className?: string;
151
151
  collisionAxis?: DragAxis;
152
+ as?: ElementType;
152
153
  };
153
154
 
154
155
  type PuckContext = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.21.0-canary.ace4c8b3",
3
+ "version": "0.21.0-canary.b6ca72f9",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Chris Villa <chris@puckeditor.com>",
6
6
  "repository": "measuredco/puck",