@measured/puck 0.19.0-canary.af1dc891 → 0.19.0-canary.b22833ee

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.
@@ -89,6 +89,15 @@ init_react_import();
89
89
 
90
90
  // lib/data/map-slots.ts
91
91
  init_react_import();
92
+
93
+ // lib/data/default-slots.ts
94
+ init_react_import();
95
+ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
96
+ (acc, fieldName) => fields[fieldName].type === "slot" ? __spreadValues({ [fieldName]: [] }, acc) : acc,
97
+ value
98
+ );
99
+
100
+ // lib/data/map-slots.ts
92
101
  var isPromise = (v) => !!v && typeof v.then === "function";
93
102
  var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
94
103
  var containsPromise = (arr) => arr.some(isPromise);
@@ -113,7 +122,7 @@ var walkField = ({
113
122
  }
114
123
  const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
115
124
  return walkField({
116
- value: el,
125
+ value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
117
126
  fields: fields2,
118
127
  map,
119
128
  id: el.props.id,
@@ -199,14 +208,14 @@ var walkObject = ({
199
208
  return flatten(newProps);
200
209
  };
201
210
  function mapSlots(item, map, config, recurseSlots = false) {
202
- var _a, _b, _c, _d;
211
+ var _a, _b, _c, _d, _e;
203
212
  const itemType = "type" in item ? item.type : "root";
204
213
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
205
214
  const newProps = walkObject({
206
- value: (_b = item.props) != null ? _b : {},
207
- fields: (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {},
215
+ value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
216
+ fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
208
217
  map,
209
- id: item.props ? (_d = item.props.id) != null ? _d : "root" : "root",
218
+ id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
210
219
  getPropPath: (k) => k,
211
220
  config,
212
221
  recurseSlots
@@ -930,6 +939,7 @@ export {
930
939
  rootAreaId,
931
940
  rootZone,
932
941
  rootDroppableId,
942
+ defaultSlots,
933
943
  walkField,
934
944
  expandNode,
935
945
  walkAppState,
package/dist/index.css CHANGED
@@ -229,10 +229,10 @@
229
229
  }
230
230
 
231
231
  /* css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css/#css-module-data */
232
- ._InputWrapper_4xor1_1 + ._InputWrapper_4xor1_1 {
232
+ ._InputWrapper_py9hf_1 + ._InputWrapper_py9hf_1 {
233
233
  margin-top: 12px;
234
234
  }
235
- ._Input-label_4xor1_5 {
235
+ ._Input-label_py9hf_5 {
236
236
  align-items: center;
237
237
  color: var(--puck-color-grey-04);
238
238
  display: flex;
@@ -240,17 +240,17 @@
240
240
  font-size: var(--puck-font-size-xxs);
241
241
  font-weight: 600;
242
242
  }
243
- ._Input-labelIcon_4xor1_14 {
243
+ ._Input-labelIcon_py9hf_14 {
244
244
  color: var(--puck-color-grey-07);
245
245
  display: flex;
246
246
  margin-inline-end: 4px;
247
247
  padding-inline-start: 4px;
248
248
  }
249
- ._Input-disabledIcon_4xor1_21 {
249
+ ._Input-disabledIcon_py9hf_21 {
250
250
  color: var(--puck-color-grey-05);
251
251
  margin-inline-start: auto;
252
252
  }
253
- ._Input-input_4xor1_26 {
253
+ ._Input-input_py9hf_26 {
254
254
  background: var(--puck-color-white);
255
255
  border-width: 1px;
256
256
  border-style: solid;
@@ -262,8 +262,9 @@
262
262
  padding: 12px 15px;
263
263
  transition: border-color 50ms ease-in;
264
264
  width: 100%;
265
+ max-width: 100%;
265
266
  }
266
- select._Input-input_4xor1_26 {
267
+ select._Input-input_py9hf_26 {
267
268
  appearance: none;
268
269
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23c3c3c3'><polygon points='0,0 100,0 50,50'/></svg>") no-repeat;
269
270
  background-size: 12px;
@@ -272,29 +273,29 @@ select._Input-input_4xor1_26 {
272
273
  background-color: var(--puck-color-white);
273
274
  cursor: pointer;
274
275
  }
275
- select._Input-input_4xor1_26:dir(rtl) {
276
+ select._Input-input_py9hf_26:dir(rtl) {
276
277
  background-position: 12px calc(50% + 3px);
277
278
  }
278
279
  @media (hover: hover) and (pointer: fine) {
279
- ._Input_4xor1_1:has(> input):hover ._Input-input_4xor1_26:not([readonly]),
280
- ._Input_4xor1_1:has(> textarea):hover ._Input-input_4xor1_26:not([readonly]) {
280
+ ._Input_py9hf_1:has(> input):hover ._Input-input_py9hf_26:not([readonly]),
281
+ ._Input_py9hf_1:has(> textarea):hover ._Input-input_py9hf_26:not([readonly]) {
281
282
  border-color: var(--puck-color-grey-05);
282
283
  transition: none;
283
284
  }
284
- ._Input_4xor1_1:has(> select):hover ._Input-input_4xor1_26:not([disabled]) {
285
+ ._Input_py9hf_1:has(> select):hover ._Input-input_py9hf_26:not([disabled]) {
285
286
  background-color: var(--puck-color-azure-12);
286
287
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%235a5a5a'><polygon points='0,0 100,0 50,50'/></svg>");
287
288
  border-color: var(--puck-color-grey-05);
288
289
  transition: none;
289
290
  }
290
291
  }
291
- ._Input-input_4xor1_26:focus {
292
+ ._Input-input_py9hf_26:focus {
292
293
  border-color: var(--puck-color-grey-05);
293
294
  outline: 2px solid var(--puck-color-azure-05);
294
295
  transition: none;
295
296
  }
296
- ._Input--readOnly_4xor1_75 > ._Input-input_4xor1_26,
297
- ._Input--readOnly_4xor1_75 > select._Input-input_4xor1_26 {
297
+ ._Input--readOnly_py9hf_76 > ._Input-input_py9hf_26,
298
+ ._Input--readOnly_py9hf_76 > select._Input-input_py9hf_26 {
298
299
  background-color: var(--puck-color-grey-11);
299
300
  border-color: var(--puck-color-grey-09);
300
301
  color: var(--puck-color-grey-04);
@@ -303,34 +304,34 @@ select._Input-input_4xor1_26:dir(rtl) {
303
304
  outline: 0;
304
305
  transition: none;
305
306
  }
306
- ._Input-radioGroupItems_4xor1_86 {
307
+ ._Input-radioGroupItems_py9hf_87 {
307
308
  display: flex;
308
309
  border: 1px solid var(--puck-color-grey-09);
309
310
  border-radius: 4px;
310
311
  flex-wrap: wrap;
311
312
  }
312
- ._Input-radio_4xor1_86 {
313
+ ._Input-radio_py9hf_87 {
313
314
  border-inline-end: 1px solid var(--puck-color-grey-09);
314
315
  flex-grow: 1;
315
316
  }
316
- ._Input-radio_4xor1_86:first-of-type {
317
+ ._Input-radio_py9hf_87:first-of-type {
317
318
  border-bottom-left-radius: 4px;
318
319
  border-top-left-radius: 4px;
319
320
  }
320
- ._Input-radio_4xor1_86:first-of-type ._Input-radioInner_4xor1_103 {
321
+ ._Input-radio_py9hf_87:first-of-type ._Input-radioInner_py9hf_104 {
321
322
  border-bottom-left-radius: 3px;
322
323
  border-top-left-radius: 3px;
323
324
  }
324
- ._Input-radio_4xor1_86:last-of-type {
325
+ ._Input-radio_py9hf_87:last-of-type {
325
326
  border-bottom-right-radius: 4px;
326
327
  border-inline-end: 0;
327
328
  border-top-right-radius: 4px;
328
329
  }
329
- ._Input-radio_4xor1_86:last-of-type ._Input-radioInner_4xor1_103 {
330
+ ._Input-radio_py9hf_87:last-of-type ._Input-radioInner_py9hf_104 {
330
331
  border-bottom-right-radius: 3px;
331
332
  border-top-right-radius: 3px;
332
333
  }
333
- ._Input-radioInner_4xor1_103 {
334
+ ._Input-radioInner_py9hf_104 {
334
335
  background-color: var(--puck-color-white);
335
336
  color: var(--puck-color-grey-04);
336
337
  cursor: pointer;
@@ -339,32 +340,32 @@ select._Input-input_4xor1_26:dir(rtl) {
339
340
  text-align: center;
340
341
  transition: background-color 50ms ease-in;
341
342
  }
342
- ._Input-radio_4xor1_86:has(:focus-visible) {
343
+ ._Input-radio_py9hf_87:has(:focus-visible) {
343
344
  outline: 2px solid var(--puck-color-azure-05);
344
345
  outline-offset: 2px;
345
346
  position: relative;
346
347
  }
347
348
  @media (hover: hover) and (pointer: fine) {
348
- ._Input-radioInner_4xor1_103:hover {
349
+ ._Input-radioInner_py9hf_104:hover {
349
350
  background-color: var(--puck-color-azure-12);
350
351
  transition: none;
351
352
  }
352
353
  }
353
- ._Input--readOnly_4xor1_75 ._Input-radioInner_4xor1_103 {
354
+ ._Input--readOnly_py9hf_76 ._Input-radioInner_py9hf_104 {
354
355
  background-color: var(--puck-color-white);
355
356
  color: var(--puck-color-grey-04);
356
357
  cursor: default;
357
358
  }
358
- ._Input-radio_4xor1_86 ._Input-radioInput_4xor1_148:checked ~ ._Input-radioInner_4xor1_103 {
359
+ ._Input-radio_py9hf_87 ._Input-radioInput_py9hf_149:checked ~ ._Input-radioInner_py9hf_104 {
359
360
  background-color: var(--puck-color-azure-11);
360
361
  color: var(--puck-color-azure-04);
361
362
  font-weight: 500;
362
363
  }
363
- ._Input--readOnly_4xor1_75 ._Input-radioInput_4xor1_148:checked ~ ._Input-radioInner_4xor1_103 {
364
+ ._Input--readOnly_py9hf_76 ._Input-radioInput_py9hf_149:checked ~ ._Input-radioInner_py9hf_104 {
364
365
  background-color: var(--puck-color-grey-11);
365
366
  color: var(--puck-color-grey-04);
366
367
  }
367
- ._Input-radio_4xor1_86 ._Input-radioInput_4xor1_148 {
368
+ ._Input-radio_py9hf_87 ._Input-radioInput_py9hf_149 {
368
369
  clip: rect(0 0 0 0);
369
370
  clip-path: inset(100%);
370
371
  height: 1px;
@@ -373,7 +374,7 @@ select._Input-input_4xor1_26:dir(rtl) {
373
374
  white-space: nowrap;
374
375
  width: 1px;
375
376
  }
376
- textarea._Input-input_4xor1_26 {
377
+ textarea._Input-input_py9hf_26 {
377
378
  margin-bottom: -4px;
378
379
  }
379
380
 
package/dist/index.js CHANGED
@@ -303,7 +303,7 @@ init_react_import();
303
303
 
304
304
  // css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
305
305
  init_react_import();
306
- var styles_module_default2 = { "InputWrapper": "_InputWrapper_4xor1_1", "Input-label": "_Input-label_4xor1_5", "Input-labelIcon": "_Input-labelIcon_4xor1_14", "Input-disabledIcon": "_Input-disabledIcon_4xor1_21", "Input-input": "_Input-input_4xor1_26", "Input": "_Input_4xor1_1", "Input--readOnly": "_Input--readOnly_4xor1_75", "Input-radioGroupItems": "_Input-radioGroupItems_4xor1_86", "Input-radio": "_Input-radio_4xor1_86", "Input-radioInner": "_Input-radioInner_4xor1_103", "Input-radioInput": "_Input-radioInput_4xor1_148" };
306
+ var styles_module_default2 = { "InputWrapper": "_InputWrapper_py9hf_1", "Input-label": "_Input-label_py9hf_5", "Input-labelIcon": "_Input-labelIcon_py9hf_14", "Input-disabledIcon": "_Input-disabledIcon_py9hf_21", "Input-input": "_Input-input_py9hf_26", "Input": "_Input_py9hf_1", "Input--readOnly": "_Input--readOnly_py9hf_76", "Input-radioGroupItems": "_Input-radioGroupItems_py9hf_87", "Input-radio": "_Input-radio_py9hf_87", "Input-radioInner": "_Input-radioInner_py9hf_104", "Input-radioInput": "_Input-radioInput_py9hf_149" };
307
307
 
308
308
  // components/AutoField/index.tsx
309
309
  var import_react22 = require("react");
@@ -827,6 +827,15 @@ function forRelatedZones(item, data, cb, path = []) {
827
827
 
828
828
  // lib/data/map-slots.ts
829
829
  init_react_import();
830
+
831
+ // lib/data/default-slots.ts
832
+ init_react_import();
833
+ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
834
+ (acc, fieldName) => fields[fieldName].type === "slot" ? __spreadValues({ [fieldName]: [] }, acc) : acc,
835
+ value
836
+ );
837
+
838
+ // lib/data/map-slots.ts
830
839
  var isPromise = (v) => !!v && typeof v.then === "function";
831
840
  var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
832
841
  var containsPromise = (arr) => arr.some(isPromise);
@@ -851,7 +860,7 @@ var walkField = ({
851
860
  }
852
861
  const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
853
862
  return walkField({
854
- value: el,
863
+ value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
855
864
  fields: fields2,
856
865
  map,
857
866
  id: el.props.id,
@@ -937,14 +946,14 @@ var walkObject = ({
937
946
  return flatten(newProps);
938
947
  };
939
948
  function mapSlots(item, map, config, recurseSlots = false) {
940
- var _a, _b, _c, _d;
949
+ var _a, _b, _c, _d, _e;
941
950
  const itemType = "type" in item ? item.type : "root";
942
951
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
943
952
  const newProps = walkObject({
944
- value: (_b = item.props) != null ? _b : {},
945
- fields: (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {},
953
+ value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
954
+ fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
946
955
  map,
947
- id: item.props ? (_d = item.props.id) != null ? _d : "root" : "root",
956
+ id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
948
957
  getPropPath: (k) => k,
949
958
  config,
950
959
  recurseSlots
@@ -2470,13 +2479,18 @@ init_react_import();
2470
2479
  var import_react10 = require("react");
2471
2480
  var import_react11 = require("@dnd-kit/react");
2472
2481
  var import_utilities = require("@dnd-kit/dom/utilities");
2482
+ var touchDefault = { delay: { value: 200, tolerance: 10 } };
2483
+ var otherDefault = {
2484
+ delay: { value: 200, tolerance: 10 },
2485
+ distance: { value: 5 }
2486
+ };
2473
2487
  var useSensors = ({
2474
- other,
2488
+ other = otherDefault,
2475
2489
  mouse,
2476
- touch
2490
+ touch = touchDefault
2477
2491
  } = {
2478
- touch: { delay: { value: 200, tolerance: 10 } },
2479
- other: { delay: { value: 200, tolerance: 10 }, distance: { value: 5 } }
2492
+ touch: touchDefault,
2493
+ other: otherDefault
2480
2494
  }) => {
2481
2495
  const [sensors] = (0, import_react10.useState)(() => [
2482
2496
  import_react11.PointerSensor.configure({
@@ -3236,7 +3250,10 @@ var ArrayField = ({
3236
3250
  var _a;
3237
3251
  if (isDraggingAny) return;
3238
3252
  const existingValue = value || [];
3239
- const newItem = uniqifyItem((_a = field.defaultItemProps) != null ? _a : {});
3253
+ const newItem = defaultSlots(
3254
+ uniqifyItem((_a = field.defaultItemProps) != null ? _a : {}),
3255
+ field.arrayFields
3256
+ );
3240
3257
  const newValue = [...existingValue, newItem];
3241
3258
  const newArrayState = regenerateArrayState(newValue);
3242
3259
  setUi(mapArrayStateToUi(newArrayState), false);
@@ -4970,10 +4987,10 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
4970
4987
  preview
4971
4988
  );
4972
4989
  const updateContent = useRenderedCallback(
4973
- (contentIds2, preview2) => {
4974
- var _a;
4975
- const s = zoneStore.getState();
4976
- const draggedItemId = (_a = s.draggedItem) == null ? void 0 : _a.id;
4990
+ (contentIds2, preview2, isDragging2, draggedItemId, previewExists) => {
4991
+ if (isDragging2 && !previewExists) {
4992
+ return;
4993
+ }
4977
4994
  if (preview2) {
4978
4995
  if (preview2.type === "insert") {
4979
4996
  setContentIdsWithPreview(
@@ -4994,7 +5011,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
4994
5011
  }
4995
5012
  } else {
4996
5013
  setContentIdsWithPreview(
4997
- contentIds2.filter((id) => id !== draggedItemId)
5014
+ previewExists ? contentIds2.filter((id) => id !== draggedItemId) : contentIds2
4998
5015
  );
4999
5016
  }
5000
5017
  setLocalPreview(preview2);
@@ -5002,7 +5019,17 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
5002
5019
  []
5003
5020
  );
5004
5021
  (0, import_react30.useEffect)(() => {
5005
- updateContent(contentIds, preview, isDragging);
5022
+ var _a;
5023
+ const s = zoneStore.getState();
5024
+ const draggedItemId = (_a = s.draggedItem) == null ? void 0 : _a.id;
5025
+ const previewExists = Object.keys(s.previewIndex || {}).length > 0;
5026
+ updateContent(
5027
+ contentIds,
5028
+ preview,
5029
+ isDragging,
5030
+ draggedItemId,
5031
+ previewExists
5032
+ );
5006
5033
  }, [contentIds, preview, isDragging]);
5007
5034
  return [contentIdsWithPreview, localPreview];
5008
5035
  };
package/dist/index.mjs CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  __spreadValues,
9
9
  __toESM,
10
10
  defaultAppState,
11
+ defaultSlots,
11
12
  defaultViewports,
12
13
  expandNode,
13
14
  getChanged,
@@ -24,7 +25,7 @@ import {
24
25
  walkAppState,
25
26
  walkField,
26
27
  walkTree
27
- } from "./chunk-HGAPIQP5.mjs";
28
+ } from "./chunk-H4SMAS54.mjs";
28
29
 
29
30
  // ../../node_modules/classnames/index.js
30
31
  var require_classnames = __commonJS({
@@ -213,7 +214,7 @@ init_react_import();
213
214
 
214
215
  // css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
215
216
  init_react_import();
216
- var styles_module_default2 = { "InputWrapper": "_InputWrapper_4xor1_1", "Input-label": "_Input-label_4xor1_5", "Input-labelIcon": "_Input-labelIcon_4xor1_14", "Input-disabledIcon": "_Input-disabledIcon_4xor1_21", "Input-input": "_Input-input_4xor1_26", "Input": "_Input_4xor1_1", "Input--readOnly": "_Input--readOnly_4xor1_75", "Input-radioGroupItems": "_Input-radioGroupItems_4xor1_86", "Input-radio": "_Input-radio_4xor1_86", "Input-radioInner": "_Input-radioInner_4xor1_103", "Input-radioInput": "_Input-radioInput_4xor1_148" };
217
+ var styles_module_default2 = { "InputWrapper": "_InputWrapper_py9hf_1", "Input-label": "_Input-label_py9hf_5", "Input-labelIcon": "_Input-labelIcon_py9hf_14", "Input-disabledIcon": "_Input-disabledIcon_py9hf_21", "Input-input": "_Input-input_py9hf_26", "Input": "_Input_py9hf_1", "Input--readOnly": "_Input--readOnly_py9hf_76", "Input-radioGroupItems": "_Input-radioGroupItems_py9hf_87", "Input-radio": "_Input-radio_py9hf_87", "Input-radioInner": "_Input-radioInner_py9hf_104", "Input-radioInput": "_Input-radioInput_py9hf_149" };
217
218
 
218
219
  // components/AutoField/index.tsx
219
220
  import {
@@ -1903,13 +1904,18 @@ init_react_import();
1903
1904
  import { useState as useState2 } from "react";
1904
1905
  import { PointerSensor } from "@dnd-kit/react";
1905
1906
  import { isElement } from "@dnd-kit/dom/utilities";
1907
+ var touchDefault = { delay: { value: 200, tolerance: 10 } };
1908
+ var otherDefault = {
1909
+ delay: { value: 200, tolerance: 10 },
1910
+ distance: { value: 5 }
1911
+ };
1906
1912
  var useSensors = ({
1907
- other,
1913
+ other = otherDefault,
1908
1914
  mouse,
1909
- touch
1915
+ touch = touchDefault
1910
1916
  } = {
1911
- touch: { delay: { value: 200, tolerance: 10 } },
1912
- other: { delay: { value: 200, tolerance: 10 }, distance: { value: 5 } }
1917
+ touch: touchDefault,
1918
+ other: otherDefault
1913
1919
  }) => {
1914
1920
  const [sensors] = useState2(() => [
1915
1921
  PointerSensor.configure({
@@ -2672,7 +2678,10 @@ var ArrayField = ({
2672
2678
  var _a;
2673
2679
  if (isDraggingAny) return;
2674
2680
  const existingValue = value || [];
2675
- const newItem = uniqifyItem((_a = field.defaultItemProps) != null ? _a : {});
2681
+ const newItem = defaultSlots(
2682
+ uniqifyItem((_a = field.defaultItemProps) != null ? _a : {}),
2683
+ field.arrayFields
2684
+ );
2676
2685
  const newValue = [...existingValue, newItem];
2677
2686
  const newArrayState = regenerateArrayState(newValue);
2678
2687
  setUi(mapArrayStateToUi(newArrayState), false);
@@ -4440,10 +4449,10 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
4440
4449
  preview
4441
4450
  );
4442
4451
  const updateContent = useRenderedCallback(
4443
- (contentIds2, preview2) => {
4444
- var _a;
4445
- const s = zoneStore.getState();
4446
- const draggedItemId = (_a = s.draggedItem) == null ? void 0 : _a.id;
4452
+ (contentIds2, preview2, isDragging2, draggedItemId, previewExists) => {
4453
+ if (isDragging2 && !previewExists) {
4454
+ return;
4455
+ }
4447
4456
  if (preview2) {
4448
4457
  if (preview2.type === "insert") {
4449
4458
  setContentIdsWithPreview(
@@ -4464,7 +4473,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
4464
4473
  }
4465
4474
  } else {
4466
4475
  setContentIdsWithPreview(
4467
- contentIds2.filter((id) => id !== draggedItemId)
4476
+ previewExists ? contentIds2.filter((id) => id !== draggedItemId) : contentIds2
4468
4477
  );
4469
4478
  }
4470
4479
  setLocalPreview(preview2);
@@ -4472,7 +4481,17 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
4472
4481
  []
4473
4482
  );
4474
4483
  useEffect14(() => {
4475
- updateContent(contentIds, preview, isDragging);
4484
+ var _a;
4485
+ const s = zoneStore.getState();
4486
+ const draggedItemId = (_a = s.draggedItem) == null ? void 0 : _a.id;
4487
+ const previewExists = Object.keys(s.previewIndex || {}).length > 0;
4488
+ updateContent(
4489
+ contentIds,
4490
+ preview,
4491
+ isDragging,
4492
+ draggedItemId,
4493
+ previewExists
4494
+ );
4476
4495
  }, [contentIds, preview, isDragging]);
4477
4496
  return [contentIdsWithPreview, localPreview];
4478
4497
  };
package/dist/rsc.js CHANGED
@@ -98,6 +98,12 @@ var setupZone = (data, zoneKey) => {
98
98
  // lib/use-slots.tsx
99
99
  var import_react2 = require("react");
100
100
 
101
+ // lib/data/default-slots.ts
102
+ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
103
+ (acc, fieldName) => fields[fieldName].type === "slot" ? __spreadValues({ [fieldName]: [] }, acc) : acc,
104
+ value
105
+ );
106
+
101
107
  // lib/data/map-slots.ts
102
108
  var isPromise = (v) => !!v && typeof v.then === "function";
103
109
  var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
@@ -123,7 +129,7 @@ var walkField = ({
123
129
  }
124
130
  const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
125
131
  return walkField({
126
- value: el,
132
+ value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
127
133
  fields: fields2,
128
134
  map,
129
135
  id: el.props.id,
@@ -209,14 +215,14 @@ var walkObject = ({
209
215
  return flatten(newProps);
210
216
  };
211
217
  function mapSlots(item, map, config, recurseSlots = false) {
212
- var _a, _b, _c, _d;
218
+ var _a, _b, _c, _d, _e;
213
219
  const itemType = "type" in item ? item.type : "root";
214
220
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
215
221
  const newProps = walkObject({
216
- value: (_b = item.props) != null ? _b : {},
217
- fields: (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {},
222
+ value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
223
+ fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
218
224
  map,
219
- id: item.props ? (_d = item.props.id) != null ? _d : "root" : "root",
225
+ id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
220
226
  getPropPath: (k) => k,
221
227
  config,
222
228
  recurseSlots
package/dist/rsc.mjs CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  resolveAllData,
6
6
  transformProps,
7
7
  walkTree
8
- } from "./chunk-HGAPIQP5.mjs";
8
+ } from "./chunk-H4SMAS54.mjs";
9
9
 
10
10
  // rsc.tsx
11
11
  init_react_import();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.19.0-canary.af1dc891",
3
+ "version": "0.19.0-canary.b22833ee",
4
4
  "author": "Chris Villa <chris@puckeditor.com>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",
@@ -73,8 +73,8 @@
73
73
  "typescript": "^5.5.4"
74
74
  },
75
75
  "dependencies": {
76
- "@dnd-kit/helpers": "0.1.18-beta-20250525014052",
77
- "@dnd-kit/react": "0.1.18-beta-20250525014052",
76
+ "@dnd-kit/helpers": "0.1.18",
77
+ "@dnd-kit/react": "0.1.18",
78
78
  "deep-diff": "^1.0.2",
79
79
  "fast-deep-equal": "^3.1.3",
80
80
  "flat": "^5.0.2",