@measured/puck 0.14.0-canary.b365418 → 0.14.0-canary.bf4f527

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -93,7 +93,8 @@ var init_react_import = __esm({
93
93
 
94
94
  // ../../node_modules/classnames/index.js
95
95
  var require_classnames = __commonJS({
96
- "../../node_modules/classnames/index.js"(exports, module2) {
96
+ "../../node_modules/classnames/index.js"(exports2, module2) {
97
+ "use strict";
97
98
  init_react_import();
98
99
  (function() {
99
100
  "use strict";
@@ -145,7 +146,7 @@ var require_classnames = __commonJS({
145
146
 
146
147
  // ../../node_modules/scheduler/cjs/scheduler.production.min.js
147
148
  var require_scheduler_production_min = __commonJS({
148
- "../../node_modules/scheduler/cjs/scheduler.production.min.js"(exports) {
149
+ "../../node_modules/scheduler/cjs/scheduler.production.min.js"(exports2) {
149
150
  "use strict";
150
151
  init_react_import();
151
152
  function f(a, b) {
@@ -188,12 +189,12 @@ var require_scheduler_production_min = __commonJS({
188
189
  }
189
190
  if ("object" === typeof performance && "function" === typeof performance.now) {
190
191
  l = performance;
191
- exports.unstable_now = function() {
192
+ exports2.unstable_now = function() {
192
193
  return l.now();
193
194
  };
194
195
  } else {
195
196
  p = Date, q = p.now();
196
- exports.unstable_now = function() {
197
+ exports2.unstable_now = function() {
197
198
  return p.now() - q;
198
199
  };
199
200
  }
@@ -247,7 +248,7 @@ var require_scheduler_production_min = __commonJS({
247
248
  v.callback = null;
248
249
  y = v.priorityLevel;
249
250
  var e = d(v.expirationTime <= b);
250
- b = exports.unstable_now();
251
+ b = exports2.unstable_now();
251
252
  "function" === typeof e ? v.callback = e : v === h(r) && k(r);
252
253
  G(b);
253
254
  } else
@@ -272,11 +273,11 @@ var require_scheduler_production_min = __commonJS({
272
273
  var P = 5;
273
274
  var Q = -1;
274
275
  function M() {
275
- return exports.unstable_now() - Q < P ? false : true;
276
+ return exports2.unstable_now() - Q < P ? false : true;
276
277
  }
277
278
  function R() {
278
279
  if (null !== O) {
279
- var a = exports.unstable_now();
280
+ var a = exports2.unstable_now();
280
281
  Q = a;
281
282
  var b = true;
282
283
  try {
@@ -310,31 +311,31 @@ var require_scheduler_production_min = __commonJS({
310
311
  }
311
312
  function K(a, b) {
312
313
  L = D(function() {
313
- a(exports.unstable_now());
314
+ a(exports2.unstable_now());
314
315
  }, b);
315
316
  }
316
- exports.unstable_IdlePriority = 5;
317
- exports.unstable_ImmediatePriority = 1;
318
- exports.unstable_LowPriority = 4;
319
- exports.unstable_NormalPriority = 3;
320
- exports.unstable_Profiling = null;
321
- exports.unstable_UserBlockingPriority = 2;
322
- exports.unstable_cancelCallback = function(a) {
317
+ exports2.unstable_IdlePriority = 5;
318
+ exports2.unstable_ImmediatePriority = 1;
319
+ exports2.unstable_LowPriority = 4;
320
+ exports2.unstable_NormalPriority = 3;
321
+ exports2.unstable_Profiling = null;
322
+ exports2.unstable_UserBlockingPriority = 2;
323
+ exports2.unstable_cancelCallback = function(a) {
323
324
  a.callback = null;
324
325
  };
325
- exports.unstable_continueExecution = function() {
326
+ exports2.unstable_continueExecution = function() {
326
327
  A || z || (A = true, I(J));
327
328
  };
328
- exports.unstable_forceFrameRate = function(a) {
329
+ exports2.unstable_forceFrameRate = function(a) {
329
330
  0 > a || 125 < a ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : P = 0 < a ? Math.floor(1e3 / a) : 5;
330
331
  };
331
- exports.unstable_getCurrentPriorityLevel = function() {
332
+ exports2.unstable_getCurrentPriorityLevel = function() {
332
333
  return y;
333
334
  };
334
- exports.unstable_getFirstCallbackNode = function() {
335
+ exports2.unstable_getFirstCallbackNode = function() {
335
336
  return h(r);
336
337
  };
337
- exports.unstable_next = function(a) {
338
+ exports2.unstable_next = function(a) {
338
339
  switch (y) {
339
340
  case 1:
340
341
  case 2:
@@ -352,11 +353,11 @@ var require_scheduler_production_min = __commonJS({
352
353
  y = c;
353
354
  }
354
355
  };
355
- exports.unstable_pauseExecution = function() {
356
+ exports2.unstable_pauseExecution = function() {
356
357
  };
357
- exports.unstable_requestPaint = function() {
358
+ exports2.unstable_requestPaint = function() {
358
359
  };
359
- exports.unstable_runWithPriority = function(a, b) {
360
+ exports2.unstable_runWithPriority = function(a, b) {
360
361
  switch (a) {
361
362
  case 1:
362
363
  case 2:
@@ -375,8 +376,8 @@ var require_scheduler_production_min = __commonJS({
375
376
  y = c;
376
377
  }
377
378
  };
378
- exports.unstable_scheduleCallback = function(a, b, c) {
379
- var d = exports.unstable_now();
379
+ exports2.unstable_scheduleCallback = function(a, b, c) {
380
+ var d = exports2.unstable_now();
380
381
  "object" === typeof c && null !== c ? (c = c.delay, c = "number" === typeof c && 0 < c ? d + c : d) : c = d;
381
382
  switch (a) {
382
383
  case 1:
@@ -399,8 +400,8 @@ var require_scheduler_production_min = __commonJS({
399
400
  c > d ? (a.sortIndex = c, f(t, a), null === h(r) && a === h(t) && (B ? (E(L), L = -1) : B = true, K(H, c - d))) : (a.sortIndex = e, f(r, a), A || z || (A = true, I(J)));
400
401
  return a;
401
402
  };
402
- exports.unstable_shouldYield = M;
403
- exports.unstable_wrapCallback = function(a) {
403
+ exports2.unstable_shouldYield = M;
404
+ exports2.unstable_wrapCallback = function(a) {
404
405
  var b = y;
405
406
  return function() {
406
407
  var c = y;
@@ -417,7 +418,7 @@ var require_scheduler_production_min = __commonJS({
417
418
 
418
419
  // ../../node_modules/scheduler/cjs/scheduler.development.js
419
420
  var require_scheduler_development = __commonJS({
420
- "../../node_modules/scheduler/cjs/scheduler.development.js"(exports) {
421
+ "../../node_modules/scheduler/cjs/scheduler.development.js"(exports2) {
421
422
  "use strict";
422
423
  init_react_import();
423
424
  if (process.env.NODE_ENV !== "production") {
@@ -505,13 +506,13 @@ var require_scheduler_development = __commonJS({
505
506
  var hasPerformanceNow = typeof performance === "object" && typeof performance.now === "function";
506
507
  if (hasPerformanceNow) {
507
508
  var localPerformance = performance;
508
- exports.unstable_now = function() {
509
+ exports2.unstable_now = function() {
509
510
  return localPerformance.now();
510
511
  };
511
512
  } else {
512
513
  var localDate = Date;
513
514
  var initialTime = localDate.now();
514
- exports.unstable_now = function() {
515
+ exports2.unstable_now = function() {
515
516
  return localDate.now() - initialTime;
516
517
  };
517
518
  }
@@ -577,7 +578,7 @@ var require_scheduler_development = __commonJS({
577
578
  return workLoop(hasTimeRemaining, initialTime2);
578
579
  } catch (error) {
579
580
  if (currentTask !== null) {
580
- var currentTime = exports.unstable_now();
581
+ var currentTime = exports2.unstable_now();
581
582
  markTaskErrored(currentTask, currentTime);
582
583
  currentTask.isQueued = false;
583
584
  }
@@ -606,7 +607,7 @@ var require_scheduler_development = __commonJS({
606
607
  currentPriorityLevel = currentTask.priorityLevel;
607
608
  var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
608
609
  var continuationCallback = callback(didUserCallbackTimeout);
609
- currentTime = exports.unstable_now();
610
+ currentTime = exports2.unstable_now();
610
611
  if (typeof continuationCallback === "function") {
611
612
  currentTask.callback = continuationCallback;
612
613
  } else {
@@ -682,7 +683,7 @@ var require_scheduler_development = __commonJS({
682
683
  };
683
684
  }
684
685
  function unstable_scheduleCallback(priorityLevel, callback, options) {
685
- var currentTime = exports.unstable_now();
686
+ var currentTime = exports2.unstable_now();
686
687
  var startTime2;
687
688
  if (typeof options === "object" && options !== null) {
688
689
  var delay = options.delay;
@@ -766,7 +767,7 @@ var require_scheduler_development = __commonJS({
766
767
  var frameInterval = frameYieldMs;
767
768
  var startTime = -1;
768
769
  function shouldYieldToHost() {
769
- var timeElapsed = exports.unstable_now() - startTime;
770
+ var timeElapsed = exports2.unstable_now() - startTime;
770
771
  if (timeElapsed < frameInterval) {
771
772
  return false;
772
773
  }
@@ -787,7 +788,7 @@ var require_scheduler_development = __commonJS({
787
788
  }
788
789
  var performWorkUntilDeadline = function() {
789
790
  if (scheduledHostCallback !== null) {
790
- var currentTime = exports.unstable_now();
791
+ var currentTime = exports2.unstable_now();
791
792
  startTime = currentTime;
792
793
  var hasTimeRemaining = true;
793
794
  var hasMoreWork = true;
@@ -831,7 +832,7 @@ var require_scheduler_development = __commonJS({
831
832
  }
832
833
  function requestHostTimeout(callback, ms) {
833
834
  taskTimeoutID = localSetTimeout(function() {
834
- callback(exports.unstable_now());
835
+ callback(exports2.unstable_now());
835
836
  }, ms);
836
837
  }
837
838
  function cancelHostTimeout() {
@@ -840,24 +841,24 @@ var require_scheduler_development = __commonJS({
840
841
  }
841
842
  var unstable_requestPaint = requestPaint;
842
843
  var unstable_Profiling = null;
843
- exports.unstable_IdlePriority = IdlePriority;
844
- exports.unstable_ImmediatePriority = ImmediatePriority;
845
- exports.unstable_LowPriority = LowPriority;
846
- exports.unstable_NormalPriority = NormalPriority;
847
- exports.unstable_Profiling = unstable_Profiling;
848
- exports.unstable_UserBlockingPriority = UserBlockingPriority;
849
- exports.unstable_cancelCallback = unstable_cancelCallback;
850
- exports.unstable_continueExecution = unstable_continueExecution;
851
- exports.unstable_forceFrameRate = forceFrameRate;
852
- exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
853
- exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
854
- exports.unstable_next = unstable_next;
855
- exports.unstable_pauseExecution = unstable_pauseExecution;
856
- exports.unstable_requestPaint = unstable_requestPaint;
857
- exports.unstable_runWithPriority = unstable_runWithPriority;
858
- exports.unstable_scheduleCallback = unstable_scheduleCallback;
859
- exports.unstable_shouldYield = shouldYieldToHost;
860
- exports.unstable_wrapCallback = unstable_wrapCallback;
844
+ exports2.unstable_IdlePriority = IdlePriority;
845
+ exports2.unstable_ImmediatePriority = ImmediatePriority;
846
+ exports2.unstable_LowPriority = LowPriority;
847
+ exports2.unstable_NormalPriority = NormalPriority;
848
+ exports2.unstable_Profiling = unstable_Profiling;
849
+ exports2.unstable_UserBlockingPriority = UserBlockingPriority;
850
+ exports2.unstable_cancelCallback = unstable_cancelCallback;
851
+ exports2.unstable_continueExecution = unstable_continueExecution;
852
+ exports2.unstable_forceFrameRate = forceFrameRate;
853
+ exports2.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
854
+ exports2.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
855
+ exports2.unstable_next = unstable_next;
856
+ exports2.unstable_pauseExecution = unstable_pauseExecution;
857
+ exports2.unstable_requestPaint = unstable_requestPaint;
858
+ exports2.unstable_runWithPriority = unstable_runWithPriority;
859
+ exports2.unstable_scheduleCallback = unstable_scheduleCallback;
860
+ exports2.unstable_shouldYield = shouldYieldToHost;
861
+ exports2.unstable_wrapCallback = unstable_wrapCallback;
861
862
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
862
863
  __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
863
864
  }
@@ -868,7 +869,7 @@ var require_scheduler_development = __commonJS({
868
869
 
869
870
  // ../../node_modules/scheduler/index.js
870
871
  var require_scheduler = __commonJS({
871
- "../../node_modules/scheduler/index.js"(exports, module2) {
872
+ "../../node_modules/scheduler/index.js"(exports2, module2) {
872
873
  "use strict";
873
874
  init_react_import();
874
875
  if (process.env.NODE_ENV === "production") {
@@ -881,7 +882,7 @@ var require_scheduler = __commonJS({
881
882
 
882
883
  // ../../node_modules/react-dom/cjs/react-dom.production.min.js
883
884
  var require_react_dom_production_min = __commonJS({
884
- "../../node_modules/react-dom/cjs/react-dom.production.min.js"(exports) {
885
+ "../../node_modules/react-dom/cjs/react-dom.production.min.js"(exports2) {
885
886
  "use strict";
886
887
  init_react_import();
887
888
  var aa = require("react");
@@ -7938,14 +7939,14 @@ var require_react_dom_production_min = __commonJS({
7938
7939
  }
7939
7940
  }
7940
7941
  var wl;
7941
- exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = tl;
7942
- exports.createPortal = function(a, b) {
7942
+ exports2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = tl;
7943
+ exports2.createPortal = function(a, b) {
7943
7944
  var c = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
7944
7945
  if (!ol(b))
7945
7946
  throw Error(p(200));
7946
7947
  return dl(a, b, null, c);
7947
7948
  };
7948
- exports.createRoot = function(a, b) {
7949
+ exports2.createRoot = function(a, b) {
7949
7950
  if (!ol(a))
7950
7951
  throw Error(p(299));
7951
7952
  var c = false, d = "", e = ll;
@@ -7955,7 +7956,7 @@ var require_react_dom_production_min = __commonJS({
7955
7956
  sf(8 === a.nodeType ? a.parentNode : a);
7956
7957
  return new ml(b);
7957
7958
  };
7958
- exports.findDOMNode = function(a) {
7959
+ exports2.findDOMNode = function(a) {
7959
7960
  if (null == a)
7960
7961
  return null;
7961
7962
  if (1 === a.nodeType)
@@ -7971,15 +7972,15 @@ var require_react_dom_production_min = __commonJS({
7971
7972
  a = null === a ? null : a.stateNode;
7972
7973
  return a;
7973
7974
  };
7974
- exports.flushSync = function(a) {
7975
+ exports2.flushSync = function(a) {
7975
7976
  return Sk(a);
7976
7977
  };
7977
- exports.hydrate = function(a, b, c) {
7978
+ exports2.hydrate = function(a, b, c) {
7978
7979
  if (!pl(b))
7979
7980
  throw Error(p(200));
7980
7981
  return sl(null, a, b, true, c);
7981
7982
  };
7982
- exports.hydrateRoot = function(a, b, c) {
7983
+ exports2.hydrateRoot = function(a, b, c) {
7983
7984
  if (!ol(a))
7984
7985
  throw Error(p(405));
7985
7986
  var d = null != c && c.hydratedSources || null, e = false, f = "", g = ll;
@@ -7995,12 +7996,12 @@ var require_react_dom_production_min = __commonJS({
7995
7996
  );
7996
7997
  return new nl(b);
7997
7998
  };
7998
- exports.render = function(a, b, c) {
7999
+ exports2.render = function(a, b, c) {
7999
8000
  if (!pl(b))
8000
8001
  throw Error(p(200));
8001
8002
  return sl(null, a, b, false, c);
8002
8003
  };
8003
- exports.unmountComponentAtNode = function(a) {
8004
+ exports2.unmountComponentAtNode = function(a) {
8004
8005
  if (!pl(a))
8005
8006
  throw Error(p(40));
8006
8007
  return a._reactRootContainer ? (Sk(function() {
@@ -8010,21 +8011,21 @@ var require_react_dom_production_min = __commonJS({
8010
8011
  });
8011
8012
  }), true) : false;
8012
8013
  };
8013
- exports.unstable_batchedUpdates = Rk;
8014
- exports.unstable_renderSubtreeIntoContainer = function(a, b, c, d) {
8014
+ exports2.unstable_batchedUpdates = Rk;
8015
+ exports2.unstable_renderSubtreeIntoContainer = function(a, b, c, d) {
8015
8016
  if (!pl(c))
8016
8017
  throw Error(p(200));
8017
8018
  if (null == a || void 0 === a._reactInternals)
8018
8019
  throw Error(p(38));
8019
8020
  return sl(a, b, c, false, d);
8020
8021
  };
8021
- exports.version = "18.2.0-next-9e3b772b8-20220608";
8022
+ exports2.version = "18.2.0-next-9e3b772b8-20220608";
8022
8023
  }
8023
8024
  });
8024
8025
 
8025
8026
  // ../../node_modules/react-dom/cjs/react-dom.development.js
8026
8027
  var require_react_dom_development = __commonJS({
8027
- "../../node_modules/react-dom/cjs/react-dom.development.js"(exports) {
8028
+ "../../node_modules/react-dom/cjs/react-dom.development.js"(exports2) {
8028
8029
  "use strict";
8029
8030
  init_react_import();
8030
8031
  if (process.env.NODE_ENV !== "production") {
@@ -8084,7 +8085,7 @@ var require_react_dom_development = __commonJS({
8084
8085
  var HostPortal = 4;
8085
8086
  var HostComponent = 5;
8086
8087
  var HostText = 6;
8087
- var Fragment13 = 7;
8088
+ var Fragment16 = 7;
8088
8089
  var Mode = 8;
8089
8090
  var ContextConsumer = 9;
8090
8091
  var ContextProvider = 10;
@@ -8264,8 +8265,8 @@ var require_react_dom_development = __commonJS({
8264
8265
  if (propertyInfo !== null) {
8265
8266
  return !propertyInfo.acceptsBooleans;
8266
8267
  } else {
8267
- var prefix2 = name.toLowerCase().slice(0, 5);
8268
- return prefix2 !== "data-" && prefix2 !== "aria-";
8268
+ var prefix3 = name.toLowerCase().slice(0, 5);
8269
+ return prefix3 !== "data-" && prefix3 !== "aria-";
8269
8270
  }
8270
8271
  }
8271
8272
  default:
@@ -8937,18 +8938,18 @@ var require_react_dom_development = __commonJS({
8937
8938
  }
8938
8939
  }
8939
8940
  var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
8940
- var prefix;
8941
+ var prefix2;
8941
8942
  function describeBuiltInComponentFrame(name, source, ownerFn) {
8942
8943
  {
8943
- if (prefix === void 0) {
8944
+ if (prefix2 === void 0) {
8944
8945
  try {
8945
8946
  throw Error();
8946
8947
  } catch (x) {
8947
8948
  var match = x.stack.trim().match(/\n( *(at )?)/);
8948
- prefix = match && match[1] || "";
8949
+ prefix2 = match && match[1] || "";
8949
8950
  }
8950
8951
  }
8951
- return "\n" + prefix + name;
8952
+ return "\n" + prefix2 + name;
8952
8953
  }
8953
8954
  }
8954
8955
  var reentry = false;
@@ -9240,7 +9241,7 @@ var require_react_dom_development = __commonJS({
9240
9241
  return "DehydratedFragment";
9241
9242
  case ForwardRef:
9242
9243
  return getWrappedName$1(type, type.render, "ForwardRef");
9243
- case Fragment13:
9244
+ case Fragment16:
9244
9245
  return "Fragment";
9245
9246
  case HostComponent:
9246
9247
  return type;
@@ -10033,13 +10034,13 @@ var require_react_dom_development = __commonJS({
10033
10034
  strokeOpacity: true,
10034
10035
  strokeWidth: true
10035
10036
  };
10036
- function prefixKey(prefix2, key) {
10037
- return prefix2 + key.charAt(0).toUpperCase() + key.substring(1);
10037
+ function prefixKey(prefix3, key) {
10038
+ return prefix3 + key.charAt(0).toUpperCase() + key.substring(1);
10038
10039
  }
10039
10040
  var prefixes = ["Webkit", "ms", "Moz", "O"];
10040
10041
  Object.keys(isUnitlessNumber).forEach(function(prop) {
10041
- prefixes.forEach(function(prefix2) {
10042
- isUnitlessNumber[prefixKey(prefix2, prop)] = isUnitlessNumber[prop];
10042
+ prefixes.forEach(function(prefix3) {
10043
+ isUnitlessNumber[prefixKey(prefix3, prop)] = isUnitlessNumber[prop];
10043
10044
  });
10044
10045
  });
10045
10046
  function dangerousStyleValue(name, value, isCustomProperty) {
@@ -18911,7 +18912,7 @@ var require_react_dom_development = __commonJS({
18911
18912
  }
18912
18913
  }
18913
18914
  function updateFragment2(returnFiber, current2, fragment, lanes, key) {
18914
- if (current2 === null || current2.tag !== Fragment13) {
18915
+ if (current2 === null || current2.tag !== Fragment16) {
18915
18916
  var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
18916
18917
  created.return = returnFiber;
18917
18918
  return created;
@@ -19314,7 +19315,7 @@ var require_react_dom_development = __commonJS({
19314
19315
  if (child.key === key) {
19315
19316
  var elementType = element.type;
19316
19317
  if (elementType === REACT_FRAGMENT_TYPE) {
19317
- if (child.tag === Fragment13) {
19318
+ if (child.tag === Fragment16) {
19318
19319
  deleteRemainingChildren(returnFiber, child.sibling);
19319
19320
  var existing = useFiber(child, element.props.children);
19320
19321
  existing.return = returnFiber;
@@ -23489,7 +23490,7 @@ var require_react_dom_development = __commonJS({
23489
23490
  var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
23490
23491
  return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
23491
23492
  }
23492
- case Fragment13:
23493
+ case Fragment16:
23493
23494
  return updateFragment(current2, workInProgress2, renderLanes2);
23494
23495
  case Mode:
23495
23496
  return updateMode(current2, workInProgress2, renderLanes2);
@@ -23762,7 +23763,7 @@ var require_react_dom_development = __commonJS({
23762
23763
  case SimpleMemoComponent:
23763
23764
  case FunctionComponent:
23764
23765
  case ForwardRef:
23765
- case Fragment13:
23766
+ case Fragment16:
23766
23767
  case Mode:
23767
23768
  case Profiler:
23768
23769
  case ContextConsumer:
@@ -28021,7 +28022,7 @@ var require_react_dom_development = __commonJS({
28021
28022
  return fiber;
28022
28023
  }
28023
28024
  function createFiberFromFragment(elements, mode, lanes, key) {
28024
- var fiber = createFiber(Fragment13, elements, key, mode);
28025
+ var fiber = createFiber(Fragment16, elements, key, mode);
28025
28026
  fiber.lanes = lanes;
28026
28027
  return fiber;
28027
28028
  }
@@ -29094,18 +29095,18 @@ var require_react_dom_development = __commonJS({
29094
29095
  }
29095
29096
  }
29096
29097
  }
29097
- exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
29098
- exports.createPortal = createPortal$1;
29099
- exports.createRoot = createRoot$1;
29100
- exports.findDOMNode = findDOMNode;
29101
- exports.flushSync = flushSync$1;
29102
- exports.hydrate = hydrate;
29103
- exports.hydrateRoot = hydrateRoot$1;
29104
- exports.render = render;
29105
- exports.unmountComponentAtNode = unmountComponentAtNode;
29106
- exports.unstable_batchedUpdates = batchedUpdates$1;
29107
- exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer;
29108
- exports.version = ReactVersion;
29098
+ exports2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
29099
+ exports2.createPortal = createPortal$1;
29100
+ exports2.createRoot = createRoot$1;
29101
+ exports2.findDOMNode = findDOMNode;
29102
+ exports2.flushSync = flushSync$1;
29103
+ exports2.hydrate = hydrate;
29104
+ exports2.hydrateRoot = hydrateRoot$1;
29105
+ exports2.render = render;
29106
+ exports2.unmountComponentAtNode = unmountComponentAtNode;
29107
+ exports2.unstable_batchedUpdates = batchedUpdates$1;
29108
+ exports2.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer;
29109
+ exports2.version = ReactVersion;
29109
29110
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
29110
29111
  __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
29111
29112
  }
@@ -29116,7 +29117,7 @@ var require_react_dom_development = __commonJS({
29116
29117
 
29117
29118
  // ../../node_modules/react-dom/index.js
29118
29119
  var require_react_dom = __commonJS({
29119
- "../../node_modules/react-dom/index.js"(exports, module2) {
29120
+ "../../node_modules/react-dom/index.js"(exports2, module2) {
29120
29121
  "use strict";
29121
29122
  init_react_import();
29122
29123
  function checkDCE() {
@@ -29171,9 +29172,19 @@ init_react_import();
29171
29172
  init_react_import();
29172
29173
  var import_react2 = require("react");
29173
29174
 
29174
- // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
29175
- init_react_import();
29176
- var Button_module_default = { "Button": "_Button_8fn3a_1", "Button--medium": "_Button--medium_8fn3a_29", "Button--large": "_Button--large_8fn3a_37", "Button-icon": "_Button-icon_8fn3a_44", "Button--primary": "_Button--primary_8fn3a_48", "Button--secondary": "_Button--secondary_8fn3a_67", "Button--flush": "_Button--flush_8fn3a_82", "Button--disabled": "_Button--disabled_8fn3a_86", "Button--fullWidth": "_Button--fullWidth_8fn3a_93", "Button-spinner": "_Button-spinner_8fn3a_98" };
29175
+ // components/Button/Button.module.css
29176
+ var Button_default = {
29177
+ Button: "Button_Button",
29178
+ "Button--medium": "Button_Button--medium",
29179
+ "Button--large": "Button_Button--large",
29180
+ "Button-icon": "Button_Button-icon",
29181
+ "Button--primary": "Button_Button--primary",
29182
+ "Button--secondary": "Button_Button--secondary",
29183
+ "Button--flush": "Button_Button--flush",
29184
+ "Button--disabled": "Button_Button--disabled",
29185
+ "Button--fullWidth": "Button_Button--fullWidth",
29186
+ "Button-spinner": "Button_Button-spinner"
29187
+ };
29177
29188
 
29178
29189
  // lib/get-class-name-factory.ts
29179
29190
  init_react_import();
@@ -29210,7 +29221,7 @@ var get_class_name_factory_default = getClassNameFactory;
29210
29221
  // components/Button/Button.tsx
29211
29222
  var import_react_spinners = require("react-spinners");
29212
29223
  var import_jsx_runtime = require("react/jsx-runtime");
29213
- var getClassName = get_class_name_factory_default("Button", Button_module_default);
29224
+ var getClassName = get_class_name_factory_default("Button", Button_default);
29214
29225
  var Button = ({
29215
29226
  children,
29216
29227
  href,
@@ -29264,16 +29275,190 @@ var Button = ({
29264
29275
 
29265
29276
  // components/Drawer/index.tsx
29266
29277
  init_react_import();
29267
- var import_dnd2 = require("@hello-pangea/dnd");
29268
29278
 
29269
- // css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
29279
+ // components/Droppable/index.tsx
29270
29280
  init_react_import();
29271
- var styles_module_default = { "Drawer": "_Drawer_6zh0b_1", "DrawerItem-default": "_DrawerItem-default_6zh0b_5", "DrawerItem-draggableWrapper": "_DrawerItem-draggableWrapper_6zh0b_5", "DrawerItem": "_DrawerItem_6zh0b_5", "DrawerItem-draggable": "_DrawerItem-draggable_6zh0b_5", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_6zh0b_31", "DrawerItem-name": "_DrawerItem-name_6zh0b_47" };
29281
+ var import_dnd = require("@measured/dnd");
29272
29282
 
29273
- // components/Draggable/index.tsx
29283
+ // components/Puck/context.tsx
29284
+ init_react_import();
29285
+ var import_react3 = require("react");
29286
+
29287
+ // lib/get-item.ts
29288
+ init_react_import();
29289
+
29290
+ // lib/root-droppable-id.ts
29291
+ init_react_import();
29292
+ var rootDroppableId = "default-zone";
29293
+
29294
+ // lib/setup-zone.ts
29295
+ init_react_import();
29296
+ var setupZone = (data, zoneKey) => {
29297
+ if (zoneKey === rootDroppableId) {
29298
+ return data;
29299
+ }
29300
+ const newData = __spreadValues({}, data);
29301
+ newData.zones = data.zones || {};
29302
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
29303
+ return newData;
29304
+ };
29305
+
29306
+ // lib/get-item.ts
29307
+ var getItem = (selector, data, dynamicProps = {}) => {
29308
+ if (!selector.zone || selector.zone === rootDroppableId) {
29309
+ const item2 = data.content[selector.index];
29310
+ return __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props });
29311
+ }
29312
+ const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
29313
+ return __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props });
29314
+ };
29315
+
29316
+ // components/ViewportControls/default-viewports.ts
29274
29317
  init_react_import();
29275
- var import_dnd = require("@hello-pangea/dnd");
29318
+ var defaultViewports = [
29319
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
29320
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
29321
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
29322
+ ];
29323
+
29324
+ // components/Puck/context.tsx
29276
29325
  var import_jsx_runtime2 = require("react/jsx-runtime");
29326
+ var defaultAppState = {
29327
+ data: { content: [], root: { props: { title: "" } } },
29328
+ ui: {
29329
+ leftSideBarVisible: true,
29330
+ rightSideBarVisible: true,
29331
+ arrayState: {},
29332
+ itemSelector: null,
29333
+ componentList: {},
29334
+ isDragging: false,
29335
+ viewports: {
29336
+ current: {
29337
+ width: defaultViewports[0].width,
29338
+ height: defaultViewports[0].height || "auto"
29339
+ },
29340
+ options: [],
29341
+ controlsVisible: true
29342
+ }
29343
+ }
29344
+ };
29345
+ var defaultContext = {
29346
+ state: defaultAppState,
29347
+ dispatch: () => null,
29348
+ config: { components: {} },
29349
+ componentState: {},
29350
+ resolveData: () => {
29351
+ },
29352
+ plugins: [],
29353
+ overrides: {},
29354
+ history: {},
29355
+ viewports: defaultViewports,
29356
+ zoomConfig: {
29357
+ autoZoom: 1,
29358
+ rootHeight: 0,
29359
+ zoom: 1
29360
+ },
29361
+ setZoomConfig: () => null,
29362
+ status: "LOADING",
29363
+ setStatus: () => null,
29364
+ iframe: {}
29365
+ };
29366
+ var appContext = (0, import_react3.createContext)(defaultContext);
29367
+ var AppProvider = ({
29368
+ children,
29369
+ value
29370
+ }) => {
29371
+ const [zoomConfig, setZoomConfig] = (0, import_react3.useState)(defaultContext.zoomConfig);
29372
+ const [status, setStatus] = (0, import_react3.useState)("LOADING");
29373
+ (0, import_react3.useEffect)(() => {
29374
+ setStatus("MOUNTED");
29375
+ }, []);
29376
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
29377
+ appContext.Provider,
29378
+ {
29379
+ value: __spreadProps(__spreadValues({}, value), { zoomConfig, setZoomConfig, status, setStatus }),
29380
+ children
29381
+ }
29382
+ );
29383
+ };
29384
+ function useAppContext() {
29385
+ const mainContext = (0, import_react3.useContext)(appContext);
29386
+ const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
29387
+ return __spreadProps(__spreadValues({}, mainContext), {
29388
+ // Helpers
29389
+ selectedItem,
29390
+ setUi: (ui, recordHistory) => {
29391
+ return mainContext.dispatch({
29392
+ type: "setUi",
29393
+ ui,
29394
+ recordHistory
29395
+ });
29396
+ }
29397
+ });
29398
+ }
29399
+
29400
+ // components/Droppable/index.tsx
29401
+ var import_jsx_runtime3 = require("react/jsx-runtime");
29402
+ var defaultProvided = {
29403
+ droppableProps: {
29404
+ "data-rfd-droppable-context-id": "",
29405
+ "data-rfd-droppable-id": ""
29406
+ },
29407
+ placeholder: null,
29408
+ innerRef: () => null
29409
+ };
29410
+ var defaultSnapshot = {
29411
+ isDraggingOver: false,
29412
+ draggingOverWith: null,
29413
+ draggingFromThisWith: null,
29414
+ isUsingPlaceholder: false
29415
+ };
29416
+ var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: children(defaultProvided, defaultSnapshot) });
29417
+ var Droppable = (props) => {
29418
+ const { status } = useAppContext();
29419
+ const El = status !== "LOADING" ? import_dnd.Droppable : DefaultDroppable;
29420
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(El, __spreadValues({}, props));
29421
+ };
29422
+
29423
+ // components/Drawer/styles.module.css
29424
+ var styles_default = {
29425
+ Drawer: "styles_Drawer",
29426
+ "DrawerItem-default": "styles_DrawerItem-default",
29427
+ "DrawerItem-draggableWrapper": "styles_DrawerItem-draggableWrapper",
29428
+ DrawerItem: "styles_DrawerItem",
29429
+ "DrawerItem-draggable": "styles_DrawerItem-draggable",
29430
+ "Drawer--isDraggingFrom": "styles_Drawer--isDraggingFrom",
29431
+ "DrawerItem-name": "styles_DrawerItem-name"
29432
+ };
29433
+
29434
+ // components/Draggable/index.tsx
29435
+ init_react_import();
29436
+ var import_dnd2 = require("@measured/dnd");
29437
+ var import_jsx_runtime4 = require("react/jsx-runtime");
29438
+ var defaultProvided2 = {
29439
+ draggableProps: {
29440
+ "data-rfd-draggable-context-id": "",
29441
+ "data-rfd-draggable-id": ""
29442
+ },
29443
+ dragHandleProps: null,
29444
+ innerRef: () => null
29445
+ };
29446
+ var defaultSnapshot2 = {
29447
+ isDragging: false,
29448
+ isDropAnimating: false,
29449
+ isClone: false,
29450
+ dropAnimation: null,
29451
+ draggingOver: null,
29452
+ combineWith: null,
29453
+ combineTargetFor: null,
29454
+ mode: null
29455
+ };
29456
+ var defaultRubric = {
29457
+ draggableId: "",
29458
+ type: "",
29459
+ source: { droppableId: "", index: 0 }
29460
+ };
29461
+ var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: children(defaultProvided2, defaultSnapshot2, defaultRubric) });
29277
29462
  var Draggable = ({
29278
29463
  className,
29279
29464
  children,
@@ -29283,39 +29468,33 @@ var Draggable = ({
29283
29468
  disableAnimations = false,
29284
29469
  isDragDisabled = false
29285
29470
  }) => {
29286
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
29287
- import_dnd.Draggable,
29288
- {
29289
- draggableId: id,
29290
- index,
29291
- isDragDisabled,
29292
- children: (provided, snapshot) => {
29293
- var _a;
29294
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
29295
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
29296
- "div",
29297
- __spreadProps(__spreadValues(__spreadValues({
29298
- className: className && className(provided, snapshot),
29299
- ref: provided.innerRef
29300
- }, provided.draggableProps), provided.dragHandleProps), {
29301
- style: __spreadProps(__spreadValues({}, provided.draggableProps.style), {
29302
- transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
29303
- }),
29304
- children: children(provided, snapshot)
29305
- })
29306
- ),
29307
- showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
29308
- "div",
29309
- {
29310
- className: className && className(provided, snapshot),
29311
- style: { transform: "none !important" },
29312
- children: children(provided, snapshot)
29313
- }
29314
- )
29315
- ] });
29316
- }
29317
- }
29318
- );
29471
+ const { status } = useAppContext();
29472
+ const El = status !== "LOADING" ? import_dnd2.Draggable : DefaultDraggable;
29473
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => {
29474
+ var _a;
29475
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
29476
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
29477
+ "div",
29478
+ __spreadProps(__spreadValues(__spreadValues({
29479
+ className: className && className(provided, snapshot),
29480
+ ref: provided.innerRef
29481
+ }, provided.draggableProps), provided.dragHandleProps), {
29482
+ style: __spreadProps(__spreadValues({}, provided.draggableProps.style), {
29483
+ transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
29484
+ }),
29485
+ children: children(provided, snapshot)
29486
+ })
29487
+ ),
29488
+ showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
29489
+ "div",
29490
+ {
29491
+ className: className && className(provided, snapshot),
29492
+ style: { transform: "none !important" },
29493
+ children: children(provided, snapshot)
29494
+ }
29495
+ )
29496
+ ] });
29497
+ } });
29319
29498
  };
29320
29499
 
29321
29500
  // components/DragIcon/index.tsx
@@ -29345,28 +29524,29 @@ var replace = (list, index, newItem) => {
29345
29524
  return result;
29346
29525
  };
29347
29526
 
29348
- // css-module:/home/runner/work/puck/puck/packages/core/components/DragIcon/styles.module.css#css-module
29349
- init_react_import();
29350
- var styles_module_default2 = { "DragIcon": "_DragIcon_1p5wn_1" };
29527
+ // components/DragIcon/styles.module.css
29528
+ var styles_default2 = {
29529
+ DragIcon: "styles_DragIcon"
29530
+ };
29351
29531
 
29352
29532
  // components/DragIcon/index.tsx
29353
- var import_jsx_runtime3 = require("react/jsx-runtime");
29354
- var getClassName2 = get_class_name_factory_default("DragIcon", styles_module_default2);
29355
- var DragIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName2(), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
29533
+ var import_jsx_runtime5 = require("react/jsx-runtime");
29534
+ var getClassName2 = get_class_name_factory_default("DragIcon", styles_default2);
29535
+ var DragIcon = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName2(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
29356
29536
 
29357
29537
  // components/Drawer/index.tsx
29358
- var import_react3 = require("react");
29359
- var import_jsx_runtime4 = require("react/jsx-runtime");
29360
- var getClassName3 = get_class_name_factory_default("Drawer", styles_module_default);
29361
- var getClassNameItem = get_class_name_factory_default("DrawerItem", styles_module_default);
29362
- var drawerContext = (0, import_react3.createContext)({
29538
+ var import_react4 = require("react");
29539
+ var import_jsx_runtime6 = require("react/jsx-runtime");
29540
+ var getClassName3 = get_class_name_factory_default("Drawer", styles_default);
29541
+ var getClassNameItem = get_class_name_factory_default("DrawerItem", styles_default);
29542
+ var drawerContext = (0, import_react4.createContext)({
29363
29543
  droppableId: ""
29364
29544
  });
29365
29545
  var DrawerDraggable = ({
29366
29546
  children,
29367
29547
  id,
29368
29548
  index
29369
- }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
29549
+ }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
29370
29550
  Draggable,
29371
29551
  {
29372
29552
  id,
@@ -29382,17 +29562,18 @@ var DrawerItem = ({
29382
29562
  name,
29383
29563
  children,
29384
29564
  id,
29565
+ label,
29385
29566
  index
29386
29567
  }) => {
29387
- const ctx = (0, import_react3.useContext)(drawerContext);
29568
+ const ctx = (0, import_react4.useContext)(drawerContext);
29388
29569
  const resolvedId = `${ctx.droppableId}::${id || name}`;
29389
- const CustomInner = (0, import_react3.useMemo)(
29390
- () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("default"), children: children2 })),
29570
+ const CustomInner = (0, import_react4.useMemo)(
29571
+ () => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("default"), children: children2 })),
29391
29572
  [children]
29392
29573
  );
29393
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DrawerDraggable, { id: resolvedId, index, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CustomInner, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: getClassNameItem("draggable"), children: [
29394
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("name"), children: name }),
29395
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DragIcon, {}) })
29574
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DrawerDraggable, { id: resolvedId, index, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: getClassNameItem("draggable"), children: [
29575
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("name"), children: label != null ? label : name }),
29576
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DragIcon, {}) })
29396
29577
  ] }) }) }) });
29397
29578
  };
29398
29579
  var Drawer = ({
@@ -29400,7 +29581,7 @@ var Drawer = ({
29400
29581
  droppableId = "component-list",
29401
29582
  direction = "vertical"
29402
29583
  }) => {
29403
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dnd2.Droppable, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
29584
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Droppable, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
29404
29585
  "div",
29405
29586
  __spreadProps(__spreadValues({}, provided.droppableProps), {
29406
29587
  ref: provided.innerRef,
@@ -29409,7 +29590,7 @@ var Drawer = ({
29409
29590
  }),
29410
29591
  children: [
29411
29592
  children,
29412
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
29593
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
29413
29594
  ]
29414
29595
  })
29415
29596
  ) }) });
@@ -29422,19 +29603,32 @@ var import_react9 = require("react");
29422
29603
 
29423
29604
  // components/DraggableComponent/index.tsx
29424
29605
  init_react_import();
29425
- var import_react6 = require("react");
29426
- var import_dnd3 = require("@hello-pangea/dnd");
29606
+ var import_react7 = require("react");
29607
+ var import_dnd3 = require("@measured/dnd");
29427
29608
 
29428
- // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
29429
- init_react_import();
29430
- var styles_module_default3 = { "DraggableComponent": "_DraggableComponent_1vpvt_1", "DraggableComponent--isDragging": "_DraggableComponent--isDragging_1vpvt_10", "DraggableComponent-contents": "_DraggableComponent-contents_1vpvt_16", "DraggableComponent-overlay": "_DraggableComponent-overlay_1vpvt_29", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_1vpvt_42", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_1vpvt_58", "DraggableComponent--forceHover": "_DraggableComponent--forceHover_1vpvt_64", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_1vpvt_69", "DraggableComponent--indicativeHover": "_DraggableComponent--indicativeHover_1vpvt_74", "DraggableComponent-actions": "_DraggableComponent-actions_1vpvt_100", "DraggableComponent-actionsLabel": "_DraggableComponent-actionsLabel_1vpvt_125", "DraggableComponent-action": "_DraggableComponent-action_1vpvt_100" };
29609
+ // components/DraggableComponent/styles.module.css
29610
+ var styles_default3 = {
29611
+ DraggableComponent: "styles_DraggableComponent",
29612
+ "DraggableComponent--isDragging": "styles_DraggableComponent--isDragging",
29613
+ "DraggableComponent-contents": "styles_DraggableComponent-contents",
29614
+ "DraggableComponent-overlay": "styles_DraggableComponent-overlay",
29615
+ "DraggableComponent-loadingOverlay": "styles_DraggableComponent-loadingOverlay",
29616
+ "DraggableComponent--isLocked": "styles_DraggableComponent--isLocked",
29617
+ "DraggableComponent--forceHover": "styles_DraggableComponent--forceHover",
29618
+ "DraggableComponent--isSelected": "styles_DraggableComponent--isSelected",
29619
+ "DraggableComponent--indicativeHover": "styles_DraggableComponent--indicativeHover",
29620
+ "DraggableComponent-actionsOverlay": "styles_DraggableComponent-actionsOverlay",
29621
+ "DraggableComponent-actions": "styles_DraggableComponent-actions",
29622
+ "DraggableComponent-actionsLabel": "styles_DraggableComponent-actionsLabel",
29623
+ "DraggableComponent-action": "styles_DraggableComponent-action"
29624
+ };
29431
29625
 
29432
29626
  // ../../node_modules/lucide-react/dist/esm/lucide-react.js
29433
29627
  init_react_import();
29434
29628
 
29435
29629
  // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
29436
29630
  init_react_import();
29437
- var import_react4 = require("react");
29631
+ var import_react5 = require("react");
29438
29632
 
29439
29633
  // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
29440
29634
  init_react_import();
@@ -29453,10 +29647,10 @@ var defaultAttributes = {
29453
29647
  // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
29454
29648
  var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim();
29455
29649
  var createLucideIcon = (iconName, iconNode) => {
29456
- const Component = (0, import_react4.forwardRef)(
29650
+ const Component = (0, import_react5.forwardRef)(
29457
29651
  (_a, ref) => {
29458
29652
  var _b = _a, { color = "currentColor", size = 24, strokeWidth = 2, absoluteStrokeWidth, className = "", children } = _b, rest = __objRest(_b, ["color", "size", "strokeWidth", "absoluteStrokeWidth", "className", "children"]);
29459
- return (0, import_react4.createElement)(
29653
+ return (0, import_react5.createElement)(
29460
29654
  "svg",
29461
29655
  __spreadValues(__spreadProps(__spreadValues({
29462
29656
  ref
@@ -29468,7 +29662,7 @@ var createLucideIcon = (iconName, iconNode) => {
29468
29662
  className: ["lucide", `lucide-${toKebabCase(iconName)}`, className].join(" ")
29469
29663
  }), rest),
29470
29664
  [
29471
- ...iconNode.map(([tag, attrs]) => (0, import_react4.createElement)(tag, attrs)),
29665
+ ...iconNode.map(([tag, attrs]) => (0, import_react5.createElement)(tag, attrs)),
29472
29666
  ...Array.isArray(children) ? children : [children]
29473
29667
  ]
29474
29668
  );
@@ -29579,6 +29773,14 @@ var Lock = createLucideIcon("Lock", [
29579
29773
  ["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
29580
29774
  ]);
29581
29775
 
29776
+ // ../../node_modules/lucide-react/dist/esm/icons/monitor.js
29777
+ init_react_import();
29778
+ var Monitor = createLucideIcon("Monitor", [
29779
+ ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
29780
+ ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
29781
+ ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
29782
+ ]);
29783
+
29582
29784
  // ../../node_modules/lucide-react/dist/esm/icons/more-vertical.js
29583
29785
  init_react_import();
29584
29786
  var MoreVertical = createLucideIcon("MoreVertical", [
@@ -29629,6 +29831,20 @@ var SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
29629
29831
  ["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
29630
29832
  ]);
29631
29833
 
29834
+ // ../../node_modules/lucide-react/dist/esm/icons/smartphone.js
29835
+ init_react_import();
29836
+ var Smartphone = createLucideIcon("Smartphone", [
29837
+ ["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
29838
+ ["path", { d: "M12 18h.01", key: "mhygvu" }]
29839
+ ]);
29840
+
29841
+ // ../../node_modules/lucide-react/dist/esm/icons/tablet.js
29842
+ init_react_import();
29843
+ var Tablet = createLucideIcon("Tablet", [
29844
+ ["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
29845
+ ["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
29846
+ ]);
29847
+
29632
29848
  // ../../node_modules/lucide-react/dist/esm/icons/trash.js
29633
29849
  init_react_import();
29634
29850
  var Trash = createLucideIcon("Trash", [
@@ -29652,12 +29868,29 @@ var Unlock = createLucideIcon("Unlock", [
29652
29868
  ["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
29653
29869
  ]);
29654
29870
 
29871
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-in.js
29872
+ init_react_import();
29873
+ var ZoomIn = createLucideIcon("ZoomIn", [
29874
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
29875
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
29876
+ ["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
29877
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
29878
+ ]);
29879
+
29880
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-out.js
29881
+ init_react_import();
29882
+ var ZoomOut = createLucideIcon("ZoomOut", [
29883
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
29884
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
29885
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
29886
+ ]);
29887
+
29655
29888
  // lib/use-modifier-held.ts
29656
29889
  init_react_import();
29657
- var import_react5 = require("react");
29890
+ var import_react6 = require("react");
29658
29891
  var useModifierHeld = (modifier) => {
29659
- const [modifierHeld, setModifierHeld] = (0, import_react5.useState)(false);
29660
- (0, import_react5.useEffect)(() => {
29892
+ const [modifierHeld, setModifierHeld] = (0, import_react6.useState)(false);
29893
+ (0, import_react6.useEffect)(() => {
29661
29894
  function downHandler({ key }) {
29662
29895
  if (key === modifier) {
29663
29896
  setModifierHeld(true);
@@ -29680,8 +29913,12 @@ var useModifierHeld = (modifier) => {
29680
29913
 
29681
29914
  // components/DraggableComponent/index.tsx
29682
29915
  var import_react_spinners2 = require("react-spinners");
29683
- var import_jsx_runtime5 = require("react/jsx-runtime");
29684
- var getClassName4 = get_class_name_factory_default("DraggableComponent", styles_module_default3);
29916
+ var import_jsx_runtime7 = require("react/jsx-runtime");
29917
+ var getClassName4 = get_class_name_factory_default("DraggableComponent", styles_default3);
29918
+ var space = 8;
29919
+ var actionsOverlayTop = space * 6.5;
29920
+ var actionsTop = -(actionsOverlayTop - 8);
29921
+ var actionsRight = space;
29685
29922
  var DraggableComponent = ({
29686
29923
  children,
29687
29924
  id,
@@ -29704,91 +29941,87 @@ var DraggableComponent = ({
29704
29941
  indicativeHover = false,
29705
29942
  style
29706
29943
  }) => {
29944
+ const { zoomConfig } = useAppContext();
29707
29945
  const isModifierHeld = useModifierHeld("Alt");
29708
- (0, import_react6.useEffect)(onMount, []);
29709
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
29710
- import_dnd3.Draggable,
29711
- {
29712
- draggableId: id,
29713
- index,
29714
- isDragDisabled,
29715
- children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
29716
- "div",
29717
- __spreadProps(__spreadValues(__spreadValues({
29718
- ref: provided.innerRef
29719
- }, provided.draggableProps), provided.dragHandleProps), {
29720
- className: getClassName4({
29721
- isSelected,
29722
- isModifierHeld,
29723
- isDragging: snapshot.isDragging,
29724
- isLocked,
29725
- forceHover,
29726
- indicativeHover
29727
- }),
29728
- style: __spreadProps(__spreadValues(__spreadValues({}, style), provided.draggableProps.style), {
29729
- cursor: isModifierHeld ? "initial" : "grab"
29730
- }),
29731
- onMouseOver,
29732
- onMouseOut,
29733
- onMouseDown,
29734
- onMouseUp,
29735
- onClick,
29736
- children: [
29737
- debug,
29738
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName4("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_spinners2.ClipLoader, { "aria-label": "loading", size: 16, color: "inherit" }) }),
29739
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName4("overlay"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName4("actions"), children: [
29740
- label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName4("actionsLabel"), children: label }),
29741
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: getClassName4("action"), onClick: onDuplicate, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Copy, { size: 16 }) }),
29742
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: getClassName4("action"), onClick: onDelete, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Trash, { size: 16 }) })
29743
- ] }) }),
29744
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName4("contents"), children })
29745
- ]
29746
- })
29747
- )
29748
- },
29749
- id
29750
- );
29751
- };
29752
-
29753
- // components/DropZone/index.tsx
29754
- var import_dnd4 = require("@hello-pangea/dnd");
29755
-
29756
- // lib/get-item.ts
29757
- init_react_import();
29758
-
29759
- // lib/root-droppable-id.ts
29760
- init_react_import();
29761
- var rootDroppableId = "default-zone";
29762
-
29763
- // lib/setup-zone.ts
29764
- init_react_import();
29765
- var setupZone = (data, zoneKey) => {
29766
- if (zoneKey === rootDroppableId) {
29767
- return data;
29768
- }
29769
- const newData = __spreadValues({}, data);
29770
- newData.zones = data.zones || {};
29771
- newData.zones[zoneKey] = newData.zones[zoneKey] || [];
29772
- return newData;
29946
+ const { status } = useAppContext();
29947
+ const El = status !== "LOADING" ? import_dnd3.Draggable : DefaultDraggable;
29948
+ (0, import_react7.useEffect)(onMount, []);
29949
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
29950
+ "div",
29951
+ __spreadProps(__spreadValues(__spreadValues({
29952
+ ref: provided.innerRef
29953
+ }, provided.draggableProps), provided.dragHandleProps), {
29954
+ className: getClassName4({
29955
+ isSelected,
29956
+ isModifierHeld,
29957
+ isDragging: snapshot.isDragging,
29958
+ isLocked,
29959
+ forceHover,
29960
+ indicativeHover
29961
+ }),
29962
+ style: __spreadProps(__spreadValues(__spreadValues({}, style), provided.draggableProps.style), {
29963
+ cursor: isModifierHeld ? "initial" : "grab"
29964
+ }),
29965
+ onMouseOver,
29966
+ onMouseOut,
29967
+ onMouseDown,
29968
+ onMouseUp,
29969
+ onClick,
29970
+ children: [
29971
+ debug,
29972
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_spinners2.ClipLoader, { "aria-label": "loading", size: 16, color: "inherit" }) }),
29973
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
29974
+ "div",
29975
+ {
29976
+ className: getClassName4("actionsOverlay"),
29977
+ style: {
29978
+ top: actionsOverlayTop / zoomConfig.zoom
29979
+ },
29980
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
29981
+ "div",
29982
+ {
29983
+ className: getClassName4("actions"),
29984
+ style: {
29985
+ transform: `scale(${1 / zoomConfig.zoom}`,
29986
+ top: actionsTop / zoomConfig.zoom,
29987
+ right: actionsRight / zoomConfig.zoom
29988
+ },
29989
+ children: [
29990
+ label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("actionsLabel"), children: label }),
29991
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDuplicate, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Copy, { size: 16 }) }),
29992
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDelete, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Trash, { size: 16 }) })
29993
+ ]
29994
+ }
29995
+ )
29996
+ }
29997
+ ),
29998
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("overlay") }),
29999
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("contents"), children })
30000
+ ]
30001
+ })
30002
+ ) }, id);
29773
30003
  };
29774
30004
 
29775
- // lib/get-item.ts
29776
- var getItem = (selector, data, dynamicProps = {}) => {
29777
- if (!selector.zone || selector.zone === rootDroppableId) {
29778
- const item2 = data.content[selector.index];
29779
- return __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props });
29780
- }
29781
- const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
29782
- return __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props });
30005
+ // components/DropZone/styles.module.css
30006
+ var styles_default4 = {
30007
+ DropZone: "styles_DropZone",
30008
+ "DropZone-content": "styles_DropZone-content",
30009
+ "DropZone--userIsDragging": "styles_DropZone--userIsDragging",
30010
+ "DropZone--draggingOverArea": "styles_DropZone--draggingOverArea",
30011
+ "DropZone--draggingNewComponent": "styles_DropZone--draggingNewComponent",
30012
+ "DropZone--isAreaSelected": "styles_DropZone--isAreaSelected",
30013
+ "DropZone--hoveringOverArea": "styles_DropZone--hoveringOverArea",
30014
+ "DropZone--isDisabled": "styles_DropZone--isDisabled",
30015
+ "DropZone--isRootZone": "styles_DropZone--isRootZone",
30016
+ "DropZone--hasChildren": "styles_DropZone--hasChildren",
30017
+ "DropZone--isDestination": "styles_DropZone--isDestination",
30018
+ "DropZone-item": "styles_DropZone-item",
30019
+ "DropZone-hitbox": "styles_DropZone-hitbox"
29783
30020
  };
29784
30021
 
29785
- // css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
29786
- init_react_import();
29787
- var styles_module_default4 = { "DropZone": "_DropZone_utidm_1", "DropZone--zoomEnabled": "_DropZone--zoomEnabled_utidm_10", "DropZone-renderWrapper": "_DropZone-renderWrapper_utidm_14", "DropZone-content": "_DropZone-content_utidm_18", "DropZone--userIsDragging": "_DropZone--userIsDragging_utidm_23", "DropZone--draggingOverArea": "_DropZone--draggingOverArea_utidm_27", "DropZone--draggingNewComponent": "_DropZone--draggingNewComponent_utidm_28", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_utidm_34", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_utidm_35", "DropZone--isDisabled": "_DropZone--isDisabled_utidm_36", "DropZone--isRootZone": "_DropZone--isRootZone_utidm_37", "DropZone--hasChildren": "_DropZone--hasChildren_utidm_43", "DropZone--isDestination": "_DropZone--isDestination_utidm_48", "DropZone-item": "_DropZone-item_utidm_56", "DropZone-hitbox": "_DropZone-hitbox_utidm_60" };
29788
-
29789
30022
  // components/DropZone/context.tsx
29790
30023
  init_react_import();
29791
- var import_react7 = require("react");
30024
+ var import_react8 = require("react");
29792
30025
  var import_use_debounce = require("use-debounce");
29793
30026
 
29794
30027
  // lib/get-zone-id.ts
@@ -29804,30 +30037,30 @@ var getZoneId = (zoneCompound) => {
29804
30037
  };
29805
30038
 
29806
30039
  // components/DropZone/context.tsx
29807
- var import_jsx_runtime6 = require("react/jsx-runtime");
29808
- var dropZoneContext = (0, import_react7.createContext)(null);
30040
+ var import_jsx_runtime8 = require("react/jsx-runtime");
30041
+ var dropZoneContext = (0, import_react8.createContext)(null);
29809
30042
  var DropZoneProvider = ({
29810
30043
  children,
29811
30044
  value
29812
30045
  }) => {
29813
- const [hoveringArea, setHoveringArea] = (0, import_react7.useState)(null);
29814
- const [hoveringZone, setHoveringZone] = (0, import_react7.useState)(
30046
+ const [hoveringArea, setHoveringArea] = (0, import_react8.useState)(null);
30047
+ const [hoveringZone, setHoveringZone] = (0, import_react8.useState)(
29815
30048
  rootDroppableId
29816
30049
  );
29817
- const [hoveringComponent, setHoveringComponent] = (0, import_react7.useState)();
30050
+ const [hoveringComponent, setHoveringComponent] = (0, import_react8.useState)();
29818
30051
  const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
29819
- const [areasWithZones, setAreasWithZones] = (0, import_react7.useState)(
30052
+ const [areasWithZones, setAreasWithZones] = (0, import_react8.useState)(
29820
30053
  {}
29821
30054
  );
29822
- const [activeZones, setActiveZones] = (0, import_react7.useState)({});
30055
+ const [activeZones, setActiveZones] = (0, import_react8.useState)({});
29823
30056
  const { dispatch = null } = value ? value : {};
29824
- const registerZoneArea = (0, import_react7.useCallback)(
30057
+ const registerZoneArea = (0, import_react8.useCallback)(
29825
30058
  (area) => {
29826
30059
  setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
29827
30060
  },
29828
30061
  [setAreasWithZones]
29829
30062
  );
29830
- const registerZone = (0, import_react7.useCallback)(
30063
+ const registerZone = (0, import_react8.useCallback)(
29831
30064
  (zoneCompound) => {
29832
30065
  if (!dispatch) {
29833
30066
  return;
@@ -29840,7 +30073,7 @@ var DropZoneProvider = ({
29840
30073
  },
29841
30074
  [setActiveZones, dispatch]
29842
30075
  );
29843
- const unregisterZone = (0, import_react7.useCallback)(
30076
+ const unregisterZone = (0, import_react8.useCallback)(
29844
30077
  (zoneCompound) => {
29845
30078
  if (!dispatch) {
29846
30079
  return;
@@ -29855,8 +30088,8 @@ var DropZoneProvider = ({
29855
30088
  },
29856
30089
  [setActiveZones, dispatch]
29857
30090
  );
29858
- const [pathData, setPathData] = (0, import_react7.useState)();
29859
- const registerPath = (0, import_react7.useCallback)(
30091
+ const [pathData, setPathData] = (0, import_react8.useState)();
30092
+ const registerPath = (0, import_react8.useCallback)(
29860
30093
  (selector) => {
29861
30094
  if (!(value == null ? void 0 : value.data)) {
29862
30095
  return;
@@ -29881,7 +30114,8 @@ var DropZoneProvider = ({
29881
30114
  },
29882
30115
  [value, setPathData]
29883
30116
  );
29884
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
30117
+ const [zoneWillDrag, setZoneWillDrag] = (0, import_react8.useState)("");
30118
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
29885
30119
  dropZoneContext.Provider,
29886
30120
  {
29887
30121
  value: __spreadValues({
@@ -29897,58 +30131,18 @@ var DropZoneProvider = ({
29897
30131
  unregisterZone,
29898
30132
  activeZones,
29899
30133
  registerPath,
29900
- pathData
30134
+ pathData,
30135
+ zoneWillDrag,
30136
+ setZoneWillDrag
29901
30137
  }, value),
29902
30138
  children
29903
30139
  }
29904
30140
  ) });
29905
30141
  };
29906
30142
 
29907
- // components/Puck/context.tsx
29908
- init_react_import();
29909
- var import_react8 = require("react");
29910
- var defaultAppState = {
29911
- data: { content: [], root: { props: { title: "" } } },
29912
- ui: {
29913
- leftSideBarVisible: true,
29914
- rightSideBarVisible: true,
29915
- arrayState: {},
29916
- itemSelector: null,
29917
- componentList: {},
29918
- isDragging: false
29919
- }
29920
- };
29921
- var appContext = (0, import_react8.createContext)({
29922
- state: defaultAppState,
29923
- dispatch: () => null,
29924
- config: { components: {} },
29925
- componentState: {},
29926
- resolveData: () => {
29927
- },
29928
- plugins: [],
29929
- overrides: {},
29930
- history: {}
29931
- });
29932
- var AppProvider = appContext.Provider;
29933
- function useAppContext() {
29934
- const mainContext = (0, import_react8.useContext)(appContext);
29935
- const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
29936
- return __spreadProps(__spreadValues({}, mainContext), {
29937
- // Helpers
29938
- selectedItem,
29939
- setUi: (ui, recordHistory) => {
29940
- return mainContext.dispatch({
29941
- type: "setUi",
29942
- ui,
29943
- recordHistory
29944
- });
29945
- }
29946
- });
29947
- }
29948
-
29949
30143
  // components/DropZone/index.tsx
29950
- var import_jsx_runtime7 = require("react/jsx-runtime");
29951
- var getClassName5 = get_class_name_factory_default("DropZone", styles_module_default4);
30144
+ var import_jsx_runtime9 = require("react/jsx-runtime");
30145
+ var getClassName5 = get_class_name_factory_default("DropZone", styles_default4);
29952
30146
  function DropZoneEdit({ zone, allow, disallow, style }) {
29953
30147
  var _a;
29954
30148
  const appContext2 = useAppContext();
@@ -29966,7 +30160,8 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
29966
30160
  registerZoneArea,
29967
30161
  areasWithZones,
29968
30162
  hoveringComponent,
29969
- disableZoom = false
30163
+ zoneWillDrag,
30164
+ setZoneWillDrag = () => null
29970
30165
  } = ctx || {};
29971
30166
  let content = data.content || [];
29972
30167
  let zoneCompound = rootDroppableId;
@@ -29996,12 +30191,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
29996
30191
  const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
29997
30192
  const [zoneArea] = getZoneId(zoneCompound);
29998
30193
  const [draggedSourceArea] = getZoneId(draggedSourceId);
29999
- const [userWillDrag, setUserWillDrag] = (0, import_react9.useState)(false);
30194
+ const userWillDrag = zoneWillDrag === zone;
30000
30195
  const userIsDragging = !!draggedItem;
30001
30196
  const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
30002
30197
  const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
30003
30198
  if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
30004
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: "DropZone requires context to work." });
30199
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: "DropZone requires context to work." });
30005
30200
  }
30006
30201
  const {
30007
30202
  hoveringArea = "root",
@@ -30038,7 +30233,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30038
30233
  }
30039
30234
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
30040
30235
  const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
30041
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30236
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30042
30237
  "div",
30043
30238
  {
30044
30239
  className: getClassName5({
@@ -30050,17 +30245,19 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30050
30245
  isDestination: draggedDestinationId === zoneCompound,
30051
30246
  isDisabled: !isEnabled,
30052
30247
  isAreaSelected,
30053
- hasChildren: content.length > 0,
30054
- zoomEnabled: !disableZoom
30248
+ hasChildren: content.length > 0
30055
30249
  }),
30056
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30057
- import_dnd4.Droppable,
30250
+ onMouseUp: () => {
30251
+ setZoneWillDrag("");
30252
+ },
30253
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30254
+ Droppable,
30058
30255
  {
30059
30256
  droppableId: zoneCompound,
30060
30257
  direction: "vertical",
30061
30258
  isDropDisabled: !isEnabled,
30062
30259
  children: (provided, snapshot) => {
30063
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
30260
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
30064
30261
  "div",
30065
30262
  __spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
30066
30263
  className: getClassName5("content"),
@@ -30074,7 +30271,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30074
30271
  },
30075
30272
  children: [
30076
30273
  content.map((item, i) => {
30077
- var _a2, _b;
30274
+ var _a2, _b, _c;
30078
30275
  const componentId = item.props.id;
30079
30276
  const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a2 = config.components[item.type]) == null ? void 0 : _a2.defaultProps), item.props), {
30080
30277
  puck: { renderDropZone: DropZone },
@@ -30085,33 +30282,33 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30085
30282
  "draggable-"
30086
30283
  )[1] === componentId;
30087
30284
  const containsZone = areasWithZones ? areasWithZones[componentId] : false;
30088
- const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
30285
+ const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
30089
30286
  "No configuration for ",
30090
30287
  item.type
30091
30288
  ] });
30092
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
30289
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
30093
30290
  "div",
30094
30291
  {
30095
30292
  className: getClassName5("item"),
30096
30293
  style: { zIndex: isDragging ? 1 : void 0 },
30097
30294
  children: [
30098
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30295
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30099
30296
  DropZoneProvider,
30100
30297
  {
30101
30298
  value: __spreadProps(__spreadValues({}, ctx), {
30102
30299
  areaId: componentId
30103
30300
  }),
30104
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30301
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30105
30302
  DraggableComponent,
30106
30303
  {
30107
- label: item.type.toString(),
30304
+ label: (_b = config.components[item.type]["label"]) != null ? _b : item.type.toString(),
30108
30305
  id: `draggable-${componentId}`,
30109
30306
  index: i,
30110
30307
  isSelected,
30111
30308
  isLocked: userIsDragging,
30112
30309
  forceHover: hoveringComponent === componentId && !userIsDragging,
30113
30310
  indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
30114
- isLoading: (_b = appContext2.componentState[componentId]) == null ? void 0 : _b.loading,
30311
+ isLoading: (_c = appContext2.componentState[componentId]) == null ? void 0 : _c.loading,
30115
30312
  onMount: () => {
30116
30313
  ctx.registerPath({
30117
30314
  index: i,
@@ -30127,11 +30324,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30127
30324
  },
30128
30325
  onMouseDown: (e) => {
30129
30326
  e.stopPropagation();
30130
- setUserWillDrag(true);
30131
- },
30132
- onMouseUp: (e) => {
30133
- e.stopPropagation();
30134
- setUserWillDrag(false);
30327
+ setZoneWillDrag(zone);
30135
30328
  },
30136
30329
  onMouseOver: (e) => {
30137
30330
  e.stopPropagation();
@@ -30172,12 +30365,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30172
30365
  style: {
30173
30366
  pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
30174
30367
  },
30175
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Render2, __spreadValues({}, defaultedProps)) })
30368
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName5("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Render2, __spreadValues({}, defaultedProps)) })
30176
30369
  }
30177
30370
  )
30178
30371
  }
30179
30372
  ),
30180
- userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30373
+ userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30181
30374
  "div",
30182
30375
  {
30183
30376
  className: getClassName5("hitbox"),
@@ -30194,7 +30387,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30194
30387
  );
30195
30388
  }),
30196
30389
  provided == null ? void 0 : provided.placeholder,
30197
- (snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30390
+ (snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30198
30391
  "div",
30199
30392
  {
30200
30393
  "data-puck-placeholder": true,
@@ -30226,14 +30419,14 @@ function DropZoneRender({ zone }) {
30226
30419
  zoneCompound = `${areaId}:${zone}`;
30227
30420
  content = setupZone(data, zoneCompound).zones[zoneCompound];
30228
30421
  }
30229
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: content.map((item) => {
30422
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: content.map((item) => {
30230
30423
  const Component = config.components[item.type];
30231
30424
  if (Component) {
30232
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30425
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30233
30426
  DropZoneProvider,
30234
30427
  {
30235
30428
  value: { data, config, areaId: item.props.id },
30236
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30429
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30237
30430
  Component.render,
30238
30431
  __spreadProps(__spreadValues({}, item.props), {
30239
30432
  puck: { renderDropZone: DropZone }
@@ -30249,9 +30442,9 @@ function DropZoneRender({ zone }) {
30249
30442
  function DropZone(props) {
30250
30443
  const ctx = (0, import_react9.useContext)(dropZoneContext);
30251
30444
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
30252
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropZoneEdit, __spreadValues({}, props));
30445
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneEdit, __spreadValues({}, props));
30253
30446
  }
30254
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropZoneRender, __spreadValues({}, props));
30447
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneRender, __spreadValues({}, props));
30255
30448
  }
30256
30449
 
30257
30450
  // components/IconButton/index.ts
@@ -30261,14 +30454,17 @@ init_react_import();
30261
30454
  init_react_import();
30262
30455
  var import_react10 = require("react");
30263
30456
 
30264
- // css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
30265
- init_react_import();
30266
- var IconButton_module_default = { "IconButton": "_IconButton_1xqlg_1", "IconButton-title": "_IconButton-title_1xqlg_33" };
30457
+ // components/IconButton/IconButton.module.css
30458
+ var IconButton_default = {
30459
+ IconButton: "IconButton_IconButton",
30460
+ "IconButton--disabled": "IconButton_IconButton--disabled",
30461
+ "IconButton-title": "IconButton_IconButton-title"
30462
+ };
30267
30463
 
30268
30464
  // components/IconButton/IconButton.tsx
30269
30465
  var import_react_spinners3 = require("react-spinners");
30270
- var import_jsx_runtime8 = require("react/jsx-runtime");
30271
- var getClassName6 = get_class_name_factory_default("IconButton", IconButton_module_default);
30466
+ var import_jsx_runtime10 = require("react/jsx-runtime");
30467
+ var getClassName6 = get_class_name_factory_default("IconButton", IconButton_default);
30272
30468
  var IconButton = ({
30273
30469
  children,
30274
30470
  href,
@@ -30283,7 +30479,7 @@ var IconButton = ({
30283
30479
  }) => {
30284
30480
  const [loading, setLoading] = (0, import_react10.useState)(false);
30285
30481
  const ElementType = href ? "a" : "button";
30286
- const el = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
30482
+ const el = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
30287
30483
  ElementType,
30288
30484
  {
30289
30485
  className: getClassName6({
@@ -30308,11 +30504,11 @@ var IconButton = ({
30308
30504
  href,
30309
30505
  title,
30310
30506
  children: [
30311
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: getClassName6("title"), children: title }),
30507
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: getClassName6("title"), children: title }),
30312
30508
  children,
30313
- loading && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
30509
+ loading && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
30314
30510
  "\xA0\xA0",
30315
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
30511
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
30316
30512
  ] })
30317
30513
  ]
30318
30514
  }
@@ -30322,26 +30518,51 @@ var IconButton = ({
30322
30518
 
30323
30519
  // components/Puck/index.tsx
30324
30520
  init_react_import();
30325
- var import_react26 = require("react");
30326
- var import_dnd7 = require("@hello-pangea/dnd");
30521
+ var import_react29 = require("react");
30327
30522
 
30328
30523
  // lib/use-placeholder-style.ts
30329
30524
  init_react_import();
30525
+ var import_react12 = require("react");
30526
+
30527
+ // lib/use-frame.ts
30528
+ init_react_import();
30330
30529
  var import_react11 = require("react");
30530
+
30531
+ // lib/get-frame.ts
30532
+ init_react_import();
30533
+ var getFrame = () => {
30534
+ let frame = document.querySelector("#preview-frame");
30535
+ if ((frame == null ? void 0 : frame.tagName) === "IFRAME") {
30536
+ frame = frame.contentDocument.body;
30537
+ }
30538
+ return frame;
30539
+ };
30540
+
30541
+ // lib/use-frame.ts
30542
+ var useFrame = () => {
30543
+ const [el, setEl] = (0, import_react11.useState)();
30544
+ (0, import_react11.useEffect)(() => {
30545
+ setEl(getFrame());
30546
+ }, []);
30547
+ return el;
30548
+ };
30549
+
30550
+ // lib/use-placeholder-style.ts
30331
30551
  var usePlaceholderStyle = () => {
30332
30552
  const queryAttr = "data-rfd-drag-handle-draggable-id";
30333
- const [placeholderStyle, setPlaceholderStyle] = (0, import_react11.useState)();
30553
+ const [placeholderStyle, setPlaceholderStyle] = (0, import_react12.useState)();
30554
+ const frame = useFrame();
30334
30555
  const onDragStartOrUpdate = (draggedItem) => {
30335
30556
  var _a;
30336
30557
  const draggableId = draggedItem.draggableId;
30337
30558
  const destinationIndex = (draggedItem.destination || draggedItem.source).index;
30338
30559
  const droppableId = (draggedItem.destination || draggedItem.source).droppableId;
30339
30560
  const domQuery = `[${queryAttr}='${draggableId}']`;
30340
- const draggedDOM = document.querySelector(domQuery);
30561
+ const draggedDOM = frame == null ? void 0 : frame.ownerDocument.querySelector(domQuery);
30341
30562
  if (!draggedDOM) {
30342
30563
  return;
30343
30564
  }
30344
- const targetListElement = document.querySelector(
30565
+ const targetListElement = frame == null ? void 0 : frame.ownerDocument.querySelector(
30345
30566
  `[data-rfd-droppable-id='${droppableId}']`
30346
30567
  );
30347
30568
  const { clientHeight } = draggedDOM;
@@ -30376,23 +30597,42 @@ var usePlaceholderStyle = () => {
30376
30597
  // components/SidebarSection/index.tsx
30377
30598
  init_react_import();
30378
30599
 
30379
- // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
30380
- init_react_import();
30381
- var styles_module_default5 = { "SidebarSection": "_SidebarSection_125qe_1", "SidebarSection-title": "_SidebarSection-title_125qe_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_125qe_20", "SidebarSection-content": "_SidebarSection-content_125qe_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_125qe_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_125qe_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_125qe_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_125qe_41", "SidebarSection-heading": "_SidebarSection-heading_125qe_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_125qe_86" };
30600
+ // components/SidebarSection/styles.module.css
30601
+ var styles_default5 = {
30602
+ SidebarSection: "styles_SidebarSection",
30603
+ "SidebarSection-title": "styles_SidebarSection-title",
30604
+ "SidebarSection--noBorderTop": "styles_SidebarSection--noBorderTop",
30605
+ "SidebarSection-content": "styles_SidebarSection-content",
30606
+ "SidebarSection--noPadding": "styles_SidebarSection--noPadding",
30607
+ "SidebarSection-breadcrumbLabel": "styles_SidebarSection-breadcrumbLabel",
30608
+ "SidebarSection-breadcrumbs": "styles_SidebarSection-breadcrumbs",
30609
+ "SidebarSection-breadcrumb": "styles_SidebarSection-breadcrumb",
30610
+ "SidebarSection-heading": "styles_SidebarSection-heading",
30611
+ "SidebarSection-loadingOverlay": "styles_SidebarSection-loadingOverlay"
30612
+ };
30382
30613
 
30383
30614
  // components/Heading/index.tsx
30384
30615
  init_react_import();
30385
30616
 
30386
- // css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
30387
- init_react_import();
30388
- var styles_module_default6 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
30617
+ // components/Heading/styles.module.css
30618
+ var styles_default6 = {
30619
+ Heading: "styles_Heading",
30620
+ "Heading--xxxxl": "styles_Heading--xxxxl",
30621
+ "Heading--xxxl": "styles_Heading--xxxl",
30622
+ "Heading--xxl": "styles_Heading--xxl",
30623
+ "Heading--xl": "styles_Heading--xl",
30624
+ "Heading--l": "styles_Heading--l",
30625
+ "Heading--m": "styles_Heading--m",
30626
+ "Heading--s": "styles_Heading--s",
30627
+ "Heading--xs": "styles_Heading--xs"
30628
+ };
30389
30629
 
30390
30630
  // components/Heading/index.tsx
30391
- var import_jsx_runtime9 = require("react/jsx-runtime");
30392
- var getClassName7 = get_class_name_factory_default("Heading", styles_module_default6);
30631
+ var import_jsx_runtime11 = require("react/jsx-runtime");
30632
+ var getClassName7 = get_class_name_factory_default("Heading", styles_default6);
30393
30633
  var Heading = ({ children, rank, size = "m" }) => {
30394
30634
  const Tag = rank ? `h${rank}` : "span";
30395
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30635
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
30396
30636
  Tag,
30397
30637
  {
30398
30638
  className: getClassName7({
@@ -30405,7 +30645,7 @@ var Heading = ({ children, rank, size = "m" }) => {
30405
30645
 
30406
30646
  // lib/use-breadcrumbs.ts
30407
30647
  init_react_import();
30408
- var import_react12 = require("react");
30648
+ var import_react13 = require("react");
30409
30649
  var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
30410
30650
  const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
30411
30651
  const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
@@ -30455,8 +30695,8 @@ var useBreadcrumbs = (renderCount) => {
30455
30695
  state: { data },
30456
30696
  selectedItem
30457
30697
  } = useAppContext();
30458
- const dzContext = (0, import_react12.useContext)(dropZoneContext);
30459
- return (0, import_react12.useMemo)(() => {
30698
+ const dzContext = (0, import_react13.useContext)(dropZoneContext);
30699
+ return (0, import_react13.useMemo)(() => {
30460
30700
  const breadcrumbs = convertPathDataToBreadcrumbs(
30461
30701
  selectedItem,
30462
30702
  dzContext == null ? void 0 : dzContext.pathData,
@@ -30471,8 +30711,8 @@ var useBreadcrumbs = (renderCount) => {
30471
30711
 
30472
30712
  // components/SidebarSection/index.tsx
30473
30713
  var import_react_spinners4 = require("react-spinners");
30474
- var import_jsx_runtime10 = require("react/jsx-runtime");
30475
- var getClassName8 = get_class_name_factory_default("SidebarSection", styles_module_default5);
30714
+ var import_jsx_runtime12 = require("react/jsx-runtime");
30715
+ var getClassName8 = get_class_name_factory_default("SidebarSection", styles_default5);
30476
30716
  var SidebarSection = ({
30477
30717
  children,
30478
30718
  title,
@@ -30484,15 +30724,15 @@ var SidebarSection = ({
30484
30724
  }) => {
30485
30725
  const { setUi } = useAppContext();
30486
30726
  const breadcrumbs = useBreadcrumbs(1);
30487
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
30727
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
30488
30728
  "div",
30489
30729
  {
30490
30730
  className: getClassName8({ noBorderTop, noPadding }),
30491
30731
  style: { background },
30492
30732
  children: [
30493
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8("title"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName8("breadcrumbs"), children: [
30494
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName8("breadcrumb"), children: [
30495
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
30733
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("title"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName8("breadcrumbs"), children: [
30734
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName8("breadcrumb"), children: [
30735
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
30496
30736
  "button",
30497
30737
  {
30498
30738
  className: getClassName8("breadcrumbLabel"),
@@ -30500,12 +30740,12 @@ var SidebarSection = ({
30500
30740
  children: breadcrumb.label
30501
30741
  }
30502
30742
  ),
30503
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChevronRight, { size: 16 })
30743
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronRight, { size: 16 })
30504
30744
  ] }, i)) : null,
30505
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
30745
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
30506
30746
  ] }) }),
30507
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8("content"), children }),
30508
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_spinners4.ClipLoader, { "aria-label": "loading" }) })
30747
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("content"), children }),
30748
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_spinners4.ClipLoader, { "aria-label": "loading" }) })
30509
30749
  ]
30510
30750
  }
30511
30751
  );
@@ -30873,7 +31113,7 @@ var flushZones = (appState) => {
30873
31113
 
30874
31114
  // lib/use-resolved-data.ts
30875
31115
  init_react_import();
30876
- var import_react13 = require("react");
31116
+ var import_react14 = require("react");
30877
31117
 
30878
31118
  // lib/resolve-component-data.ts
30879
31119
  init_react_import();
@@ -30988,13 +31228,13 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
30988
31228
 
30989
31229
  // lib/use-resolved-data.ts
30990
31230
  var useResolvedData = (appState, config, dispatch) => {
30991
- const [{ resolverKey, newAppState }, setResolverState] = (0, import_react13.useState)({
31231
+ const [{ resolverKey, newAppState }, setResolverState] = (0, import_react14.useState)({
30992
31232
  resolverKey: 0,
30993
31233
  newAppState: appState
30994
31234
  });
30995
- const [componentState, setComponentState] = (0, import_react13.useState)({});
31235
+ const [componentState, setComponentState] = (0, import_react14.useState)({});
30996
31236
  const deferredSetStates = {};
30997
- const setComponentLoading = (0, import_react13.useCallback)(
31237
+ const setComponentLoading = (0, import_react14.useCallback)(
30998
31238
  (id, loading, defer = 0) => {
30999
31239
  if (deferredSetStates[id]) {
31000
31240
  clearTimeout(deferredSetStates[id]);
@@ -31011,7 +31251,10 @@ var useResolvedData = (appState, config, dispatch) => {
31011
31251
  );
31012
31252
  const runResolvers = () => __async(void 0, null, function* () {
31013
31253
  const newData = newAppState.data;
31014
- const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) => !!config.components[item.type].resolveData);
31254
+ const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) => {
31255
+ var _a;
31256
+ return !!((_a = config.components[item.type]) == null ? void 0 : _a.resolveData);
31257
+ });
31015
31258
  const applyIfChange = (dynamicDataMap, dynamicRoot) => {
31016
31259
  const processed = applyDynamicProps(
31017
31260
  appState.data,
@@ -31061,10 +31304,10 @@ var useResolvedData = (appState, config, dispatch) => {
31061
31304
  });
31062
31305
  yield Promise.all(promises);
31063
31306
  });
31064
- (0, import_react13.useEffect)(() => {
31307
+ (0, import_react14.useEffect)(() => {
31065
31308
  runResolvers();
31066
31309
  }, [resolverKey]);
31067
- const resolveData = (0, import_react13.useCallback)((newAppState2 = appState) => {
31310
+ const resolveData = (0, import_react14.useCallback)((newAppState2 = appState) => {
31068
31311
  setResolverState((curr) => ({
31069
31312
  resolverKey: curr.resolverKey + 1,
31070
31313
  newAppState: newAppState2
@@ -31079,13 +31322,17 @@ var useResolvedData = (appState, config, dispatch) => {
31079
31322
  // components/MenuBar/index.tsx
31080
31323
  init_react_import();
31081
31324
 
31082
- // css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
31083
- init_react_import();
31084
- var styles_module_default7 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
31325
+ // components/MenuBar/styles.module.css
31326
+ var styles_default7 = {
31327
+ MenuBar: "styles_MenuBar",
31328
+ "MenuBar--menuOpen": "styles_MenuBar--menuOpen",
31329
+ "MenuBar-inner": "styles_MenuBar-inner",
31330
+ "MenuBar-history": "styles_MenuBar-history"
31331
+ };
31085
31332
 
31086
31333
  // components/MenuBar/index.tsx
31087
- var import_jsx_runtime11 = require("react/jsx-runtime");
31088
- var getClassName9 = get_class_name_factory_default("MenuBar", styles_module_default7);
31334
+ var import_jsx_runtime13 = require("react/jsx-runtime");
31335
+ var getClassName9 = get_class_name_factory_default("MenuBar", styles_default7);
31089
31336
  var MenuBar = ({
31090
31337
  appState,
31091
31338
  data = { content: [], root: { props: { title: "" } } },
@@ -31099,7 +31346,7 @@ var MenuBar = ({
31099
31346
  history: { back, forward, historyStore }
31100
31347
  } = useAppContext();
31101
31348
  const { hasFuture = false, hasPast = false } = historyStore || {};
31102
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31349
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31103
31350
  "div",
31104
31351
  {
31105
31352
  className: getClassName9({ menuOpen }),
@@ -31113,16 +31360,16 @@ var MenuBar = ({
31113
31360
  setMenuOpen(false);
31114
31361
  }
31115
31362
  },
31116
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName9("inner"), children: [
31117
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName9("history"), children: [
31118
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31363
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName9("inner"), children: [
31364
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName9("history"), children: [
31365
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31119
31366
  ChevronLeft,
31120
31367
  {
31121
31368
  size: 21,
31122
31369
  stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
31123
31370
  }
31124
31371
  ) }),
31125
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31372
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31126
31373
  ChevronRight,
31127
31374
  {
31128
31375
  size: 21,
@@ -31130,17 +31377,17 @@ var MenuBar = ({
31130
31377
  }
31131
31378
  ) })
31132
31379
  ] }),
31133
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: renderHeaderActions && renderHeaderActions({
31380
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: renderHeaderActions && renderHeaderActions({
31134
31381
  state: appState,
31135
31382
  dispatch
31136
31383
  }) }),
31137
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31384
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31138
31385
  Button,
31139
31386
  {
31140
31387
  onClick: () => {
31141
31388
  onPublish && onPublish(data);
31142
31389
  },
31143
- icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Globe, { size: "14px" }),
31390
+ icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Globe, { size: "14px" }),
31144
31391
  children: "Publish"
31145
31392
  }
31146
31393
  ) })
@@ -31149,9 +31396,24 @@ var MenuBar = ({
31149
31396
  );
31150
31397
  };
31151
31398
 
31152
- // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
31153
- init_react_import();
31154
- var styles_module_default8 = { "Puck": "_Puck_1mnww_19", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_1mnww_36", "Puck--rightSideBarVisible": "_Puck--rightSideBarVisible_1mnww_42", "Puck-header": "_Puck-header_1mnww_96", "Puck-headerInner": "_Puck-headerInner_1mnww_105", "Puck-headerToggle": "_Puck-headerToggle_1mnww_115", "Puck-rightSideBarToggle": "_Puck-rightSideBarToggle_1mnww_122", "Puck-leftSideBarToggle": "_Puck-leftSideBarToggle_1mnww_123", "Puck-headerTitle": "_Puck-headerTitle_1mnww_127", "Puck-headerPath": "_Puck-headerPath_1mnww_131", "Puck-headerTools": "_Puck-headerTools_1mnww_138", "Puck-menuButton": "_Puck-menuButton_1mnww_144", "Puck--menuOpen": "_Puck--menuOpen_1mnww_149", "Puck-leftSideBar": "_Puck-leftSideBar_1mnww_123", "Puck-frame": "_Puck-frame_1mnww_168", "Puck-root": "_Puck-root_1mnww_176", "Puck-rightSideBar": "_Puck-rightSideBar_1mnww_122" };
31399
+ // components/Puck/styles.module.css
31400
+ var styles_default8 = {
31401
+ Puck: "styles_Puck",
31402
+ "Puck--leftSideBarVisible": "styles_Puck--leftSideBarVisible",
31403
+ "Puck--rightSideBarVisible": "styles_Puck--rightSideBarVisible",
31404
+ "Puck-header": "styles_Puck-header",
31405
+ "Puck-headerInner": "styles_Puck-headerInner",
31406
+ "Puck-headerToggle": "styles_Puck-headerToggle",
31407
+ "Puck-rightSideBarToggle": "styles_Puck-rightSideBarToggle",
31408
+ "Puck-leftSideBarToggle": "styles_Puck-leftSideBarToggle",
31409
+ "Puck-headerTitle": "styles_Puck-headerTitle",
31410
+ "Puck-headerPath": "styles_Puck-headerPath",
31411
+ "Puck-headerTools": "styles_Puck-headerTools",
31412
+ "Puck-menuButton": "styles_Puck-menuButton",
31413
+ "Puck--menuOpen": "styles_Puck--menuOpen",
31414
+ "Puck-leftSideBar": "styles_Puck-leftSideBar",
31415
+ "Puck-rightSideBar": "styles_Puck-rightSideBar"
31416
+ };
31155
31417
 
31156
31418
  // components/Puck/components/Fields/index.tsx
31157
31419
  init_react_import();
@@ -31160,12 +31422,22 @@ var import_react_spinners6 = require("react-spinners");
31160
31422
  // components/InputOrGroup/index.tsx
31161
31423
  init_react_import();
31162
31424
 
31163
- // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css#css-module
31164
- init_react_import();
31165
- var styles_module_default9 = { "Input": "_Input_1qi5b_1", "Input-label": "_Input-label_1qi5b_26", "Input-labelIcon": "_Input-labelIcon_1qi5b_34", "Input-disabledIcon": "_Input-disabledIcon_1qi5b_41", "Input-input": "_Input-input_1qi5b_46", "Input--readOnly": "_Input--readOnly_1qi5b_90", "Input-radioGroupItems": "_Input-radioGroupItems_1qi5b_101", "Input-radio": "_Input-radio_1qi5b_101", "Input-radioInner": "_Input-radioInner_1qi5b_118", "Input-radioInput": "_Input-radioInput_1qi5b_163" };
31425
+ // components/InputOrGroup/styles.module.css
31426
+ var styles_default9 = {
31427
+ Input: "styles_Input",
31428
+ "Input-label": "styles_Input-label",
31429
+ "Input-labelIcon": "styles_Input-labelIcon",
31430
+ "Input-disabledIcon": "styles_Input-disabledIcon",
31431
+ "Input-input": "styles_Input-input",
31432
+ "Input--readOnly": "styles_Input--readOnly",
31433
+ "Input-radioGroupItems": "styles_Input-radioGroupItems",
31434
+ "Input-radio": "styles_Input-radio",
31435
+ "Input-radioInner": "styles_Input-radioInner",
31436
+ "Input-radioInput": "styles_Input-radioInput"
31437
+ };
31166
31438
 
31167
31439
  // components/InputOrGroup/index.tsx
31168
- var import_react18 = require("react");
31440
+ var import_react19 = require("react");
31169
31441
 
31170
31442
  // components/InputOrGroup/fields/index.tsx
31171
31443
  init_react_import();
@@ -31173,17 +31445,41 @@ init_react_import();
31173
31445
  // components/InputOrGroup/fields/ArrayField/index.tsx
31174
31446
  init_react_import();
31175
31447
 
31176
- // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ArrayField/styles.module.css#css-module
31448
+ // components/InputOrGroup/fields/ArrayField/styles.module.css
31449
+ var styles_default10 = {
31450
+ ArrayField: "styles_ArrayField",
31451
+ "ArrayField--isDraggingFrom": "styles_ArrayField--isDraggingFrom",
31452
+ "ArrayField-addButton": "styles_ArrayField-addButton",
31453
+ "ArrayField--hasItems": "styles_ArrayField--hasItems",
31454
+ ArrayFieldItem: "styles_ArrayFieldItem",
31455
+ "ArrayFieldItem--isDragging": "styles_ArrayFieldItem--isDragging",
31456
+ "ArrayFieldItem--isExpanded": "styles_ArrayFieldItem--isExpanded",
31457
+ "ArrayFieldItem-summary": "styles_ArrayFieldItem-summary",
31458
+ "ArrayFieldItem--readOnly": "styles_ArrayFieldItem--readOnly",
31459
+ "ArrayFieldItem-body": "styles_ArrayFieldItem-body",
31460
+ "ArrayFieldItem-fieldset": "styles_ArrayFieldItem-fieldset",
31461
+ "ArrayFieldItem-rhs": "styles_ArrayFieldItem-rhs",
31462
+ "ArrayFieldItem-actions": "styles_ArrayFieldItem-actions"
31463
+ };
31464
+
31465
+ // components/InputOrGroup/fields/ArrayField/index.tsx
31466
+ var import_react15 = require("react");
31467
+
31468
+ // components/DragDropContext/index.tsx
31177
31469
  init_react_import();
31178
- var styles_module_default10 = { "ArrayField": "_ArrayField_1txra_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1txra_13", "ArrayField-addButton": "_ArrayField-addButton_1txra_17", "ArrayField--hasItems": "_ArrayField--hasItems_1txra_32", "ArrayFieldItem": "_ArrayFieldItem_1txra_61", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1txra_69", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1txra_74", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1txra_84", "ArrayFieldItem--readOnly": "_ArrayFieldItem--readOnly_1txra_108", "ArrayFieldItem-body": "_ArrayFieldItem-body_1txra_142", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1txra_150", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1txra_157", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1txra_163" };
31470
+ var import_dnd4 = require("@measured/dnd");
31471
+ var import_jsx_runtime14 = require("react/jsx-runtime");
31472
+ var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children });
31473
+ var DragDropContext = (props) => {
31474
+ const { status } = useAppContext();
31475
+ const El = status !== "LOADING" ? import_dnd4.DragDropContext : DefaultDragDropContext;
31476
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(El, __spreadValues({}, props));
31477
+ };
31179
31478
 
31180
31479
  // components/InputOrGroup/fields/ArrayField/index.tsx
31181
- var import_dnd5 = require("@hello-pangea/dnd");
31182
- var import_dnd6 = require("@hello-pangea/dnd");
31183
- var import_react14 = require("react");
31184
- var import_jsx_runtime12 = require("react/jsx-runtime");
31185
- var getClassName10 = get_class_name_factory_default("ArrayField", styles_module_default10);
31186
- var getClassNameItem2 = get_class_name_factory_default("ArrayFieldItem", styles_module_default10);
31480
+ var import_jsx_runtime15 = require("react/jsx-runtime");
31481
+ var getClassName10 = get_class_name_factory_default("ArrayField", styles_default10);
31482
+ var getClassNameItem2 = get_class_name_factory_default("ArrayFieldItem", styles_default10);
31187
31483
  var ArrayField = ({
31188
31484
  field,
31189
31485
  onChange,
@@ -31205,11 +31501,11 @@ var ArrayField = ({
31205
31501
  }),
31206
31502
  openId: ""
31207
31503
  };
31208
- const [localState, setLocalState] = (0, import_react14.useState)({ arrayState, value });
31209
- (0, import_react14.useEffect)(() => {
31504
+ const [localState, setLocalState] = (0, import_react15.useState)({ arrayState, value });
31505
+ (0, import_react15.useEffect)(() => {
31210
31506
  setLocalState({ arrayState, value });
31211
31507
  }, [value, state.ui.arrayState[id]]);
31212
- const mapArrayStateToUi = (0, import_react14.useCallback)(
31508
+ const mapArrayStateToUi = (0, import_react15.useCallback)(
31213
31509
  (partialArrayState) => {
31214
31510
  return {
31215
31511
  arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
@@ -31219,13 +31515,13 @@ var ArrayField = ({
31219
31515
  },
31220
31516
  [arrayState]
31221
31517
  );
31222
- const getHighestIndex = (0, import_react14.useCallback)(() => {
31518
+ const getHighestIndex = (0, import_react15.useCallback)(() => {
31223
31519
  return arrayState.items.reduce(
31224
31520
  (acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
31225
31521
  -1
31226
31522
  );
31227
31523
  }, [arrayState]);
31228
- const regenerateArrayState = (0, import_react14.useCallback)(
31524
+ const regenerateArrayState = (0, import_react15.useCallback)(
31229
31525
  (value2) => {
31230
31526
  let highestIndex = getHighestIndex();
31231
31527
  const newItems = Array.from(value2 || []).map((item, idx) => {
@@ -31244,22 +31540,22 @@ var ArrayField = ({
31244
31540
  },
31245
31541
  [arrayState]
31246
31542
  );
31247
- (0, import_react14.useEffect)(() => {
31543
+ (0, import_react15.useEffect)(() => {
31248
31544
  setUi(mapArrayStateToUi(arrayState));
31249
31545
  }, []);
31250
- const [hovering, setHovering] = (0, import_react14.useState)(false);
31546
+ const [hovering, setHovering] = (0, import_react15.useState)(false);
31251
31547
  if (field.type !== "array" || !field.arrayFields) {
31252
31548
  return null;
31253
31549
  }
31254
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31550
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31255
31551
  FieldLabelInternal,
31256
31552
  {
31257
31553
  label: label || name,
31258
- icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(List, { size: 16 }),
31554
+ icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(List, { size: 16 }),
31259
31555
  el: "div",
31260
31556
  readOnly,
31261
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31262
- import_dnd6.DragDropContext,
31557
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31558
+ DragDropContext,
31263
31559
  {
31264
31560
  onDragEnd: (event) => {
31265
31561
  var _a, _b;
@@ -31285,8 +31581,8 @@ var ArrayField = ({
31285
31581
  });
31286
31582
  }
31287
31583
  },
31288
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dnd5.Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
31289
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
31584
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
31585
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31290
31586
  "div",
31291
31587
  __spreadProps(__spreadValues({}, provided.droppableProps), {
31292
31588
  ref: provided.innerRef,
@@ -31306,7 +31602,7 @@ var ArrayField = ({
31306
31602
  localState.arrayState.items.map((item, i) => {
31307
31603
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
31308
31604
  const data = Array.from(localState.value || [])[i] || {};
31309
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31605
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31310
31606
  Draggable,
31311
31607
  {
31312
31608
  id: _arrayId,
@@ -31317,8 +31613,8 @@ var ArrayField = ({
31317
31613
  readOnly
31318
31614
  }),
31319
31615
  isDragDisabled: readOnly || !hovering,
31320
- children: () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
31321
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
31616
+ children: () => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
31617
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31322
31618
  "div",
31323
31619
  {
31324
31620
  onClick: () => {
@@ -31339,10 +31635,12 @@ var ArrayField = ({
31339
31635
  className: getClassNameItem2("summary"),
31340
31636
  children: [
31341
31637
  field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
31342
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameItem2("rhs"), children: [
31343
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameItem2("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameItem2("action"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31638
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameItem2("rhs"), children: [
31639
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("action"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31344
31640
  IconButton,
31345
31641
  {
31642
+ type: "button",
31643
+ disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
31346
31644
  onClick: (e) => {
31347
31645
  e.stopPropagation();
31348
31646
  const existingValue = [
@@ -31361,20 +31659,20 @@ var ArrayField = ({
31361
31659
  );
31362
31660
  },
31363
31661
  title: "Delete",
31364
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Trash, { size: 16 })
31662
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Trash, { size: 16 })
31365
31663
  }
31366
31664
  ) }) }),
31367
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DragIcon, {}) })
31665
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DragIcon, {}) })
31368
31666
  ] })
31369
31667
  ]
31370
31668
  }
31371
31669
  ),
31372
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameItem2("body"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("fieldset", { className: getClassNameItem2("fieldset"), children: Object.keys(field.arrayFields).map(
31670
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("body"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("fieldset", { className: getClassNameItem2("fieldset"), children: Object.keys(field.arrayFields).map(
31373
31671
  (fieldName) => {
31374
31672
  const subField = field.arrayFields[fieldName];
31375
31673
  const subFieldName = `${name}[${i}].${fieldName}`;
31376
31674
  const wildcardFieldName = `${name}[*].${fieldName}`;
31377
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31675
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31378
31676
  InputOrGroup,
31379
31677
  {
31380
31678
  name: subFieldName,
@@ -31403,10 +31701,12 @@ var ArrayField = ({
31403
31701
  );
31404
31702
  }),
31405
31703
  provided.placeholder,
31406
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31704
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31407
31705
  "button",
31408
31706
  {
31707
+ type: "button",
31409
31708
  className: getClassName10("addButton"),
31709
+ disabled: field.max !== void 0 && localState.arrayState.items.length >= field.max,
31410
31710
  onClick: () => {
31411
31711
  const existingValue = value || [];
31412
31712
  const newValue = [
@@ -31416,7 +31716,7 @@ var ArrayField = ({
31416
31716
  const newArrayState = regenerateArrayState(newValue);
31417
31717
  onChange(newValue, mapArrayStateToUi(newArrayState));
31418
31718
  },
31419
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Plus, { size: "21" })
31719
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Plus, { size: 21 })
31420
31720
  }
31421
31721
  )
31422
31722
  ]
@@ -31431,8 +31731,8 @@ var ArrayField = ({
31431
31731
 
31432
31732
  // components/InputOrGroup/fields/DefaultField/index.tsx
31433
31733
  init_react_import();
31434
- var import_jsx_runtime13 = require("react/jsx-runtime");
31435
- var getClassName11 = get_class_name_factory_default("Input", styles_module_default9);
31734
+ var import_jsx_runtime16 = require("react/jsx-runtime");
31735
+ var getClassName11 = get_class_name_factory_default("Input", styles_default9);
31436
31736
  var DefaultField = ({
31437
31737
  field,
31438
31738
  onChange,
@@ -31442,16 +31742,16 @@ var DefaultField = ({
31442
31742
  label,
31443
31743
  id
31444
31744
  }) => {
31445
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31745
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31446
31746
  FieldLabelInternal,
31447
31747
  {
31448
31748
  label: label || name,
31449
- icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
31450
- field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Type, { size: 16 }),
31451
- field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Hash, { size: 16 })
31749
+ icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
31750
+ field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Type, { size: 16 }),
31751
+ field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Hash, { size: 16 })
31452
31752
  ] }),
31453
31753
  readOnly,
31454
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31754
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31455
31755
  "input",
31456
31756
  {
31457
31757
  className: getClassName11("input"),
@@ -31479,42 +31779,72 @@ var DefaultField = ({
31479
31779
 
31480
31780
  // components/InputOrGroup/fields/ExternalField/index.tsx
31481
31781
  init_react_import();
31482
- var import_react17 = require("react");
31782
+ var import_react18 = require("react");
31483
31783
 
31484
31784
  // components/ExternalInput/index.tsx
31485
31785
  init_react_import();
31486
- var import_react16 = require("react");
31786
+ var import_react17 = require("react");
31487
31787
 
31488
- // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
31489
- init_react_import();
31490
- var styles_module_default11 = { "ExternalInput-actions": "_ExternalInput-actions_q3l5a_1", "ExternalInput-button": "_ExternalInput-button_q3l5a_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_q3l5a_25", "ExternalInput-detachButton": "_ExternalInput-detachButton_q3l5a_32", "ExternalInputModal": "_ExternalInputModal_q3l5a_74", "ExternalInputModal-grid": "_ExternalInputModal-grid_q3l5a_84", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_q3l5a_95", "ExternalInputModal-filters": "_ExternalInputModal-filters_q3l5a_100", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_q3l5a_119", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_q3l5a_128", "ExternalInputModal-table": "_ExternalInputModal-table_q3l5a_128", "ExternalInputModal-thead": "_ExternalInputModal-thead_q3l5a_144", "ExternalInputModal-th": "_ExternalInputModal-th_q3l5a_144", "ExternalInputModal-td": "_ExternalInputModal-td_q3l5a_159", "ExternalInputModal-tr": "_ExternalInputModal-tr_q3l5a_164", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_q3l5a_171", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_q3l5a_197", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_q3l5a_201", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_q3l5a_218", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_q3l5a_222", "ExternalInputModal-search": "_ExternalInputModal-search_q3l5a_222", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_q3l5a_259", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_q3l5a_284", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_q3l5a_294", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_q3l5a_308", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_q3l5a_321", "ExternalInputModal-footer": "_ExternalInputModal-footer_q3l5a_325" };
31788
+ // components/ExternalInput/styles.module.css
31789
+ var styles_default11 = {
31790
+ "ExternalInput-actions": "styles_ExternalInput-actions",
31791
+ "ExternalInput-button": "styles_ExternalInput-button",
31792
+ "ExternalInput--dataSelected": "styles_ExternalInput--dataSelected",
31793
+ "ExternalInput-detachButton": "styles_ExternalInput-detachButton",
31794
+ ExternalInputModal: "styles_ExternalInputModal",
31795
+ "ExternalInputModal-grid": "styles_ExternalInputModal-grid",
31796
+ "ExternalInputModal--filtersToggled": "styles_ExternalInputModal--filtersToggled",
31797
+ "ExternalInputModal-filters": "styles_ExternalInputModal-filters",
31798
+ "ExternalInputModal-masthead": "styles_ExternalInputModal-masthead",
31799
+ "ExternalInputModal-tableWrapper": "styles_ExternalInputModal-tableWrapper",
31800
+ "ExternalInputModal-table": "styles_ExternalInputModal-table",
31801
+ "ExternalInputModal-thead": "styles_ExternalInputModal-thead",
31802
+ "ExternalInputModal-th": "styles_ExternalInputModal-th",
31803
+ "ExternalInputModal-td": "styles_ExternalInputModal-td",
31804
+ "ExternalInputModal-tr": "styles_ExternalInputModal-tr",
31805
+ "ExternalInputModal-tbody": "styles_ExternalInputModal-tbody",
31806
+ "ExternalInputModal--hasData": "styles_ExternalInputModal--hasData",
31807
+ "ExternalInputModal-loadingBanner": "styles_ExternalInputModal-loadingBanner",
31808
+ "ExternalInputModal--isLoading": "styles_ExternalInputModal--isLoading",
31809
+ "ExternalInputModal-searchForm": "styles_ExternalInputModal-searchForm",
31810
+ "ExternalInputModal-search": "styles_ExternalInputModal-search",
31811
+ "ExternalInputModal-searchIcon": "styles_ExternalInputModal-searchIcon",
31812
+ "ExternalInputModal-searchIconText": "styles_ExternalInputModal-searchIconText",
31813
+ "ExternalInputModal-searchInput": "styles_ExternalInputModal-searchInput",
31814
+ "ExternalInputModal-searchActions": "styles_ExternalInputModal-searchActions",
31815
+ "ExternalInputModal-searchActionIcon": "styles_ExternalInputModal-searchActionIcon",
31816
+ "ExternalInputModal-footer": "styles_ExternalInputModal-footer"
31817
+ };
31491
31818
 
31492
31819
  // components/Modal/index.tsx
31493
31820
  init_react_import();
31494
- var import_react15 = require("react");
31821
+ var import_react16 = require("react");
31495
31822
 
31496
- // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
31497
- init_react_import();
31498
- var styles_module_default12 = { "Modal": "_Modal_zud0i_1", "Modal--isOpen": "_Modal--isOpen_zud0i_15", "Modal-inner": "_Modal-inner_zud0i_19" };
31823
+ // components/Modal/styles.module.css
31824
+ var styles_default12 = {
31825
+ Modal: "styles_Modal",
31826
+ "Modal--isOpen": "styles_Modal--isOpen",
31827
+ "Modal-inner": "styles_Modal-inner"
31828
+ };
31499
31829
 
31500
31830
  // components/Modal/index.tsx
31501
31831
  var import_react_dom = __toESM(require_react_dom());
31502
- var import_jsx_runtime14 = require("react/jsx-runtime");
31503
- var getClassName12 = get_class_name_factory_default("Modal", styles_module_default12);
31832
+ var import_jsx_runtime17 = require("react/jsx-runtime");
31833
+ var getClassName12 = get_class_name_factory_default("Modal", styles_default12);
31504
31834
  var Modal = ({
31505
31835
  children,
31506
31836
  onClose,
31507
31837
  isOpen
31508
31838
  }) => {
31509
- const [rootEl, setRootEl] = (0, import_react15.useState)(null);
31510
- (0, import_react15.useEffect)(() => {
31839
+ const [rootEl, setRootEl] = (0, import_react16.useState)(null);
31840
+ (0, import_react16.useEffect)(() => {
31511
31841
  setRootEl(document.getElementById("puck-portal-root"));
31512
31842
  }, []);
31513
31843
  if (!rootEl) {
31514
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", {});
31844
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", {});
31515
31845
  }
31516
31846
  return (0, import_react_dom.createPortal)(
31517
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
31847
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
31518
31848
  "div",
31519
31849
  {
31520
31850
  className: getClassName12("inner"),
@@ -31528,9 +31858,9 @@ var Modal = ({
31528
31858
 
31529
31859
  // components/ExternalInput/index.tsx
31530
31860
  var import_react_spinners5 = require("react-spinners");
31531
- var import_jsx_runtime15 = require("react/jsx-runtime");
31532
- var getClassName13 = get_class_name_factory_default("ExternalInput", styles_module_default11);
31533
- var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default11);
31861
+ var import_jsx_runtime18 = require("react/jsx-runtime");
31862
+ var getClassName13 = get_class_name_factory_default("ExternalInput", styles_default11);
31863
+ var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_default11);
31534
31864
  var dataCache = {};
31535
31865
  var ExternalInput = ({
31536
31866
  field,
@@ -31544,16 +31874,16 @@ var ExternalInput = ({
31544
31874
  mapRow = (val) => val,
31545
31875
  filterFields
31546
31876
  } = field || {};
31547
- const [data, setData] = (0, import_react16.useState)([]);
31548
- const [isOpen, setOpen] = (0, import_react16.useState)(false);
31549
- const [isLoading, setIsLoading] = (0, import_react16.useState)(true);
31877
+ const [data, setData] = (0, import_react17.useState)([]);
31878
+ const [isOpen, setOpen] = (0, import_react17.useState)(false);
31879
+ const [isLoading, setIsLoading] = (0, import_react17.useState)(true);
31550
31880
  const hasFilterFields = !!filterFields;
31551
- const [filters, setFilters] = (0, import_react16.useState)(field.initialFilters || {});
31552
- const [filtersToggled, setFiltersToggled] = (0, import_react16.useState)(hasFilterFields);
31553
- const mappedData = (0, import_react16.useMemo)(() => {
31881
+ const [filters, setFilters] = (0, import_react17.useState)(field.initialFilters || {});
31882
+ const [filtersToggled, setFiltersToggled] = (0, import_react17.useState)(hasFilterFields);
31883
+ const mappedData = (0, import_react17.useMemo)(() => {
31554
31884
  return data.map(mapRow);
31555
31885
  }, [data]);
31556
- const keys = (0, import_react16.useMemo)(() => {
31886
+ const keys = (0, import_react17.useMemo)(() => {
31557
31887
  const validKeys = /* @__PURE__ */ new Set();
31558
31888
  for (const item of mappedData) {
31559
31889
  for (const key of Object.keys(item)) {
@@ -31564,8 +31894,8 @@ var ExternalInput = ({
31564
31894
  }
31565
31895
  return Array.from(validKeys);
31566
31896
  }, [mappedData]);
31567
- const [searchQuery, setSearchQuery] = (0, import_react16.useState)(field.initialQuery || "");
31568
- const search = (0, import_react16.useCallback)(
31897
+ const [searchQuery, setSearchQuery] = (0, import_react17.useState)(field.initialQuery || "");
31898
+ const search = (0, import_react17.useCallback)(
31569
31899
  (query, filters2) => __async(void 0, null, function* () {
31570
31900
  setIsLoading(true);
31571
31901
  const cacheKey = `${id}-${name}-${query}-${JSON.stringify(filters2)}`;
@@ -31578,10 +31908,10 @@ var ExternalInput = ({
31578
31908
  }),
31579
31909
  [name, field]
31580
31910
  );
31581
- (0, import_react16.useEffect)(() => {
31911
+ (0, import_react17.useEffect)(() => {
31582
31912
  search(searchQuery, filters);
31583
31913
  }, []);
31584
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31914
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
31585
31915
  "div",
31586
31916
  {
31587
31917
  className: getClassName13({
@@ -31590,30 +31920,31 @@ var ExternalInput = ({
31590
31920
  }),
31591
31921
  id,
31592
31922
  children: [
31593
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassName13("actions"), children: [
31594
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31923
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName13("actions"), children: [
31924
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31595
31925
  "button",
31596
31926
  {
31927
+ type: "button",
31597
31928
  onClick: () => setOpen(true),
31598
31929
  className: getClassName13("button"),
31599
- children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
31600
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { size: "16" }),
31601
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: field.placeholder })
31930
+ children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
31931
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Link, { size: "16" }),
31932
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: field.placeholder })
31602
31933
  ] })
31603
31934
  }
31604
31935
  ),
31605
- value && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31936
+ value && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31606
31937
  "button",
31607
31938
  {
31608
31939
  className: getClassName13("detachButton"),
31609
31940
  onClick: () => {
31610
31941
  onChange(null);
31611
31942
  },
31612
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Unlock, { size: 16 })
31943
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Unlock, { size: 16 })
31613
31944
  }
31614
31945
  )
31615
31946
  ] }),
31616
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31947
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
31617
31948
  "form",
31618
31949
  {
31619
31950
  className: getClassNameModal({
@@ -31627,11 +31958,11 @@ var ExternalInput = ({
31627
31958
  search(searchQuery, filters);
31628
31959
  },
31629
31960
  children: [
31630
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
31631
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: getClassNameModal("search"), children: [
31632
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
31633
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Search, { size: "18" }) }),
31634
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31961
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
31962
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: getClassNameModal("search"), children: [
31963
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
31964
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Search, { size: "18" }) }),
31965
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31635
31966
  "input",
31636
31967
  {
31637
31968
  className: getClassNameModal("searchInput"),
@@ -31646,9 +31977,9 @@ var ExternalInput = ({
31646
31977
  }
31647
31978
  )
31648
31979
  ] }),
31649
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
31650
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
31651
- hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31980
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
31981
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
31982
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31652
31983
  IconButton,
31653
31984
  {
31654
31985
  title: "Toggle filters",
@@ -31657,15 +31988,15 @@ var ExternalInput = ({
31657
31988
  e.stopPropagation();
31658
31989
  setFiltersToggled(!filtersToggled);
31659
31990
  },
31660
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SlidersHorizontal, { size: 20 })
31991
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SlidersHorizontal, { size: 20 })
31661
31992
  }
31662
31993
  ) })
31663
31994
  ] })
31664
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
31665
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("grid"), children: [
31666
- hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
31995
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
31996
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("grid"), children: [
31997
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
31667
31998
  const filterField = filterFields[fieldName];
31668
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31999
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31669
32000
  InputOrGroup,
31670
32001
  {
31671
32002
  field: filterField,
@@ -31682,9 +32013,9 @@ var ExternalInput = ({
31682
32013
  fieldName
31683
32014
  );
31684
32015
  }) }),
31685
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
31686
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { className: getClassNameModal("table"), children: [
31687
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
32016
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
32017
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("table", { className: getClassNameModal("table"), children: [
32018
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31688
32019
  "th",
31689
32020
  {
31690
32021
  className: getClassNameModal("th"),
@@ -31693,8 +32024,8 @@ var ExternalInput = ({
31693
32024
  },
31694
32025
  key
31695
32026
  )) }) }),
31696
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
31697
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
32027
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
32028
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31698
32029
  "tr",
31699
32030
  {
31700
32031
  style: { whiteSpace: "nowrap" },
@@ -31703,16 +32034,16 @@ var ExternalInput = ({
31703
32034
  onChange(mapProp(data[i]));
31704
32035
  setOpen(false);
31705
32036
  },
31706
- children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
32037
+ children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
31707
32038
  },
31708
32039
  i
31709
32040
  );
31710
32041
  }) })
31711
32042
  ] }),
31712
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_spinners5.ClipLoader, { size: 24, "aria-label": "Loading" }) })
32043
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_spinners5.ClipLoader, { size: 24, "aria-label": "Loading" }) })
31713
32044
  ] })
31714
32045
  ] }),
31715
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("footer"), children: [
32046
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("footer"), children: [
31716
32047
  mappedData.length,
31717
32048
  " result",
31718
32049
  mappedData.length === 1 ? "" : "s"
@@ -31726,7 +32057,7 @@ var ExternalInput = ({
31726
32057
  };
31727
32058
 
31728
32059
  // components/InputOrGroup/fields/ExternalField/index.tsx
31729
- var import_jsx_runtime16 = require("react/jsx-runtime");
32060
+ var import_jsx_runtime19 = require("react/jsx-runtime");
31730
32061
  var ExternalField = ({
31731
32062
  field,
31732
32063
  onChange,
@@ -31738,7 +32069,7 @@ var ExternalField = ({
31738
32069
  var _a, _b, _c;
31739
32070
  const validField = field;
31740
32071
  const deprecatedField = field;
31741
- (0, import_react17.useEffect)(() => {
32072
+ (0, import_react18.useEffect)(() => {
31742
32073
  if (deprecatedField.adaptor) {
31743
32074
  console.error(
31744
32075
  "Warning: The `adaptor` API is deprecated. Please use updated APIs on the `external` field instead. This will be a breaking change in a future release."
@@ -31748,13 +32079,13 @@ var ExternalField = ({
31748
32079
  if (field.type !== "external") {
31749
32080
  return null;
31750
32081
  }
31751
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
32082
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
31752
32083
  FieldLabelInternal,
31753
32084
  {
31754
32085
  label: label || name,
31755
- icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Link, { size: 16 }),
32086
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Link, { size: 16 }),
31756
32087
  el: "div",
31757
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
32088
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
31758
32089
  ExternalInput,
31759
32090
  {
31760
32091
  name,
@@ -31780,8 +32111,8 @@ var ExternalField = ({
31780
32111
 
31781
32112
  // components/InputOrGroup/fields/RadioField/index.tsx
31782
32113
  init_react_import();
31783
- var import_jsx_runtime17 = require("react/jsx-runtime");
31784
- var getClassName14 = get_class_name_factory_default("Input", styles_module_default9);
32114
+ var import_jsx_runtime20 = require("react/jsx-runtime");
32115
+ var getClassName14 = get_class_name_factory_default("Input", styles_default9);
31785
32116
  var RadioField = ({
31786
32117
  field,
31787
32118
  onChange,
@@ -31794,19 +32125,19 @@ var RadioField = ({
31794
32125
  if (field.type !== "radio" || !field.options) {
31795
32126
  return null;
31796
32127
  }
31797
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
32128
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
31798
32129
  FieldLabelInternal,
31799
32130
  {
31800
- icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CheckCircle, { size: 16 }),
32131
+ icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CheckCircle, { size: 16 }),
31801
32132
  label: label || name,
31802
32133
  readOnly,
31803
32134
  el: "div",
31804
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
32135
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
31805
32136
  "label",
31806
32137
  {
31807
32138
  className: getClassName14("radio"),
31808
32139
  children: [
31809
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
32140
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
31810
32141
  "input",
31811
32142
  {
31812
32143
  type: "radio",
@@ -31824,7 +32155,7 @@ var RadioField = ({
31824
32155
  defaultChecked: value === option.value
31825
32156
  }
31826
32157
  ),
31827
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
32158
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
31828
32159
  ]
31829
32160
  },
31830
32161
  option.label + option.value
@@ -31835,8 +32166,8 @@ var RadioField = ({
31835
32166
 
31836
32167
  // components/InputOrGroup/fields/SelectField/index.tsx
31837
32168
  init_react_import();
31838
- var import_jsx_runtime18 = require("react/jsx-runtime");
31839
- var getClassName15 = get_class_name_factory_default("Input", styles_module_default9);
32169
+ var import_jsx_runtime21 = require("react/jsx-runtime");
32170
+ var getClassName15 = get_class_name_factory_default("Input", styles_default9);
31840
32171
  var SelectField = ({
31841
32172
  field,
31842
32173
  onChange,
@@ -31849,13 +32180,13 @@ var SelectField = ({
31849
32180
  if (field.type !== "select" || !field.options) {
31850
32181
  return null;
31851
32182
  }
31852
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
32183
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31853
32184
  FieldLabelInternal,
31854
32185
  {
31855
32186
  label: label || name,
31856
- icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDown, { size: 16 }),
32187
+ icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChevronDown, { size: 16 }),
31857
32188
  readOnly,
31858
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
32189
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31859
32190
  "select",
31860
32191
  {
31861
32192
  id,
@@ -31869,7 +32200,7 @@ var SelectField = ({
31869
32200
  onChange(e.currentTarget.value);
31870
32201
  },
31871
32202
  value,
31872
- children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
32203
+ children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31873
32204
  "option",
31874
32205
  {
31875
32206
  label: option.label,
@@ -31885,8 +32216,8 @@ var SelectField = ({
31885
32216
 
31886
32217
  // components/InputOrGroup/fields/TextareaField/index.tsx
31887
32218
  init_react_import();
31888
- var import_jsx_runtime19 = require("react/jsx-runtime");
31889
- var getClassName16 = get_class_name_factory_default("Input", styles_module_default9);
32219
+ var import_jsx_runtime22 = require("react/jsx-runtime");
32220
+ var getClassName16 = get_class_name_factory_default("Input", styles_default9);
31890
32221
  var TextareaField = ({
31891
32222
  onChange,
31892
32223
  readOnly,
@@ -31895,13 +32226,13 @@ var TextareaField = ({
31895
32226
  label,
31896
32227
  id
31897
32228
  }) => {
31898
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
32229
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
31899
32230
  FieldLabelInternal,
31900
32231
  {
31901
32232
  label: label || name,
31902
- icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Type, { size: 16 }),
32233
+ icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Type, { size: 16 }),
31903
32234
  readOnly,
31904
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
32235
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
31905
32236
  "textarea",
31906
32237
  {
31907
32238
  id,
@@ -31925,14 +32256,16 @@ var import_use_debounce2 = require("use-debounce");
31925
32256
  // components/InputOrGroup/fields/ObjectField/index.tsx
31926
32257
  init_react_import();
31927
32258
 
31928
- // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ObjectField/styles.module.css#css-module
31929
- init_react_import();
31930
- var styles_module_default13 = { "ObjectField": "_ObjectField_15j63_5", "ObjectField-fieldset": "_ObjectField-fieldset_15j63_13" };
32259
+ // components/InputOrGroup/fields/ObjectField/styles.module.css
32260
+ var styles_default13 = {
32261
+ ObjectField: "styles_ObjectField",
32262
+ "ObjectField-fieldset": "styles_ObjectField-fieldset"
32263
+ };
31931
32264
 
31932
32265
  // components/InputOrGroup/fields/ObjectField/index.tsx
31933
- var import_jsx_runtime20 = require("react/jsx-runtime");
31934
- var getClassName17 = get_class_name_factory_default("ObjectField", styles_module_default13);
31935
- var getClassNameItem3 = get_class_name_factory_default("ObjectFieldItem", styles_module_default13);
32266
+ var import_jsx_runtime23 = require("react/jsx-runtime");
32267
+ var getClassName17 = get_class_name_factory_default("ObjectField", styles_default13);
32268
+ var getClassNameItem3 = get_class_name_factory_default("ObjectFieldItem", styles_default13);
31936
32269
  var ObjectField = ({
31937
32270
  field,
31938
32271
  onChange,
@@ -31947,18 +32280,18 @@ var ObjectField = ({
31947
32280
  return null;
31948
32281
  }
31949
32282
  const data = value || {};
31950
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
32283
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
31951
32284
  FieldLabelInternal,
31952
32285
  {
31953
32286
  label: label || name,
31954
- icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MoreVertical, { size: 16 }),
32287
+ icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MoreVertical, { size: 16 }),
31955
32288
  el: "div",
31956
32289
  readOnly,
31957
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17(), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("fieldset", { className: getClassName17("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
32290
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17(), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("fieldset", { className: getClassName17("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
31958
32291
  const subField = field.objectFields[fieldName];
31959
32292
  const subFieldName = `${name}.${fieldName}`;
31960
32293
  const wildcardFieldName = `${name}.${fieldName}`;
31961
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
32294
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
31962
32295
  InputOrGroup,
31963
32296
  {
31964
32297
  name: subFieldName,
@@ -31985,8 +32318,8 @@ var ObjectField = ({
31985
32318
  };
31986
32319
 
31987
32320
  // components/InputOrGroup/index.tsx
31988
- var import_jsx_runtime21 = require("react/jsx-runtime");
31989
- var getClassName18 = get_class_name_factory_default("Input", styles_module_default9);
32321
+ var import_jsx_runtime24 = require("react/jsx-runtime");
32322
+ var getClassName18 = get_class_name_factory_default("Input", styles_default9);
31990
32323
  var FieldLabel = ({
31991
32324
  children,
31992
32325
  icon,
@@ -31996,11 +32329,11 @@ var FieldLabel = ({
31996
32329
  className
31997
32330
  }) => {
31998
32331
  const El = el;
31999
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(El, { className, children: [
32000
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: getClassName18("label"), children: [
32001
- icon ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, {}),
32332
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(El, { className, children: [
32333
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName18("label"), children: [
32334
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, {}),
32002
32335
  label,
32003
- readOnly && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Lock, { size: "12" }) })
32336
+ readOnly && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Lock, { size: "12" }) })
32004
32337
  ] }),
32005
32338
  children
32006
32339
  ] });
@@ -32013,11 +32346,11 @@ var FieldLabelInternal = ({
32013
32346
  readOnly
32014
32347
  }) => {
32015
32348
  const { overrides } = useAppContext();
32016
- const Wrapper = (0, import_react18.useMemo)(
32349
+ const Wrapper = (0, import_react19.useMemo)(
32017
32350
  () => overrides.fieldLabel || FieldLabel,
32018
32351
  [overrides]
32019
32352
  );
32020
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
32353
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32021
32354
  Wrapper,
32022
32355
  {
32023
32356
  label,
@@ -32034,7 +32367,7 @@ var InputOrGroup = (_a) => {
32034
32367
  var _a2, _b2, _c, _d, _e, _f, _g, _h;
32035
32368
  const { overrides } = useAppContext();
32036
32369
  const { name, field, value, readOnly } = props;
32037
- const [localValue, setLocalValue] = (0, import_react18.useState)(value);
32370
+ const [localValue, setLocalValue] = (0, import_react19.useState)(value);
32038
32371
  const onChangeDb = (0, import_use_debounce2.useDebouncedCallback)(
32039
32372
  (val, ui) => {
32040
32373
  onChange(val, ui);
@@ -32042,11 +32375,11 @@ var InputOrGroup = (_a) => {
32042
32375
  50,
32043
32376
  { leading: true }
32044
32377
  );
32045
- const onChangeLocal = (0, import_react18.useCallback)((val, ui) => {
32378
+ const onChangeLocal = (0, import_react19.useCallback)((val, ui) => {
32046
32379
  setLocalValue(val);
32047
32380
  onChangeDb(val, ui);
32048
32381
  }, []);
32049
- (0, import_react18.useEffect)(() => {
32382
+ (0, import_react19.useEffect)(() => {
32050
32383
  setLocalValue(value);
32051
32384
  }, [value]);
32052
32385
  const localProps = {
@@ -32057,7 +32390,7 @@ var InputOrGroup = (_a) => {
32057
32390
  if (!field.render) {
32058
32391
  return null;
32059
32392
  }
32060
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
32393
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
32061
32394
  field,
32062
32395
  name,
32063
32396
  readOnly
@@ -32086,17 +32419,19 @@ var InputOrGroup = (_a) => {
32086
32419
  const mergedProps = __spreadProps(__spreadValues(__spreadValues({}, props), localProps), { field });
32087
32420
  const children = defaultFields[field.type](mergedProps);
32088
32421
  const Render2 = render[field.type];
32089
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
32422
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
32090
32423
  };
32091
32424
 
32092
- // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
32093
- init_react_import();
32094
- var styles_module_default14 = { "PuckFields": "_PuckFields_17k3p_1", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_17k3p_6" };
32425
+ // components/Puck/components/Fields/styles.module.css
32426
+ var styles_default14 = {
32427
+ PuckFields: "styles_PuckFields",
32428
+ "PuckFields-loadingOverlay": "styles_PuckFields-loadingOverlay"
32429
+ };
32095
32430
 
32096
32431
  // components/Puck/components/Fields/index.tsx
32097
- var import_react19 = require("react");
32098
- var import_jsx_runtime22 = require("react/jsx-runtime");
32099
- var getClassName19 = get_class_name_factory_default("PuckFields", styles_module_default14);
32432
+ var import_react20 = require("react");
32433
+ var import_jsx_runtime25 = require("react/jsx-runtime");
32434
+ var getClassName19 = get_class_name_factory_default("PuckFields", styles_default14);
32100
32435
  var defaultPageFields = {
32101
32436
  title: { type: "text" }
32102
32437
  };
@@ -32104,9 +32439,9 @@ var DefaultFields = ({
32104
32439
  children,
32105
32440
  isLoading
32106
32441
  }) => {
32107
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName19(), children: [
32442
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19(), children: [
32108
32443
  children,
32109
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_spinners6.ClipLoader, { "aria-label": "loading" }) })
32444
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_spinners6.ClipLoader, { "aria-label": "loading" }) })
32110
32445
  ] });
32111
32446
  };
32112
32447
  var Fields = () => {
@@ -32126,15 +32461,15 @@ var Fields = () => {
32126
32461
  const fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
32127
32462
  const isLoading = selectedItem ? (_c = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _c.loading : (_d = componentState["puck-root"]) == null ? void 0 : _d.loading;
32128
32463
  const rootProps = data.root.props || data.root;
32129
- const Wrapper = (0, import_react19.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
32130
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32464
+ const Wrapper = (0, import_react20.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
32465
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32131
32466
  "form",
32132
32467
  {
32133
32468
  className: getClassName19(),
32134
32469
  onSubmit: (e) => {
32135
32470
  e.preventDefault();
32136
32471
  },
32137
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
32472
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
32138
32473
  const field = fields[fieldName];
32139
32474
  const onChange = (value, updatedUi) => {
32140
32475
  var _a2, _b2;
@@ -32200,7 +32535,7 @@ var Fields = () => {
32200
32535
  };
32201
32536
  if (selectedItem && itemSelector) {
32202
32537
  const { readOnly = {} } = selectedItem;
32203
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32538
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32204
32539
  InputOrGroup,
32205
32540
  {
32206
32541
  field,
@@ -32216,7 +32551,7 @@ var Fields = () => {
32216
32551
  );
32217
32552
  } else {
32218
32553
  const { readOnly = {} } = data.root;
32219
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32554
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32220
32555
  InputOrGroup,
32221
32556
  {
32222
32557
  field,
@@ -32241,24 +32576,30 @@ init_react_import();
32241
32576
 
32242
32577
  // lib/use-component-list.tsx
32243
32578
  init_react_import();
32244
- var import_react20 = require("react");
32579
+ var import_react21 = require("react");
32245
32580
 
32246
32581
  // components/ComponentList/index.tsx
32247
32582
  init_react_import();
32248
32583
 
32249
- // css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
32250
- init_react_import();
32251
- var styles_module_default15 = { "ComponentList": "_ComponentList_odh9d_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_odh9d_5", "ComponentList-content": "_ComponentList-content_odh9d_9", "ComponentList-title": "_ComponentList-title_odh9d_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_odh9d_53" };
32584
+ // components/ComponentList/styles.module.css
32585
+ var styles_default15 = {
32586
+ ComponentList: "styles_ComponentList",
32587
+ "ComponentList--isExpanded": "styles_ComponentList--isExpanded",
32588
+ "ComponentList-content": "styles_ComponentList-content",
32589
+ "ComponentList-title": "styles_ComponentList-title",
32590
+ "ComponentList-titleIcon": "styles_ComponentList-titleIcon"
32591
+ };
32252
32592
 
32253
32593
  // components/ComponentList/index.tsx
32254
- var import_jsx_runtime23 = require("react/jsx-runtime");
32255
- var getClassName20 = get_class_name_factory_default("ComponentList", styles_module_default15);
32594
+ var import_jsx_runtime26 = require("react/jsx-runtime");
32595
+ var getClassName20 = get_class_name_factory_default("ComponentList", styles_default15);
32256
32596
  var ComponentListItem = ({
32257
32597
  name,
32598
+ label,
32258
32599
  index
32259
32600
  }) => {
32260
32601
  const { overrides } = useAppContext();
32261
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Drawer.Item, { name, index, children: overrides.componentItem });
32602
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Drawer.Item, { label, name, index, children: overrides.componentItem });
32262
32603
  };
32263
32604
  var ComponentList = ({
32264
32605
  children,
@@ -32267,8 +32608,8 @@ var ComponentList = ({
32267
32608
  }) => {
32268
32609
  const { config, state, setUi } = useAppContext();
32269
32610
  const { expanded = true } = state.ui.componentList[id] || {};
32270
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
32271
- title && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
32611
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
32612
+ title && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
32272
32613
  "button",
32273
32614
  {
32274
32615
  className: getClassName20("title"),
@@ -32281,15 +32622,17 @@ var ComponentList = ({
32281
32622
  }),
32282
32623
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
32283
32624
  children: [
32284
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: title }),
32285
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName20("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ChevronDown, { size: 12 }) })
32625
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { children: title }),
32626
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName20("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronDown, { size: 12 }) })
32286
32627
  ]
32287
32628
  }
32288
32629
  ),
32289
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName20("content"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Drawer, { droppableId: `component-list${title ? `:${title}` : ""}`, children: children || Object.keys(config.components).map((componentKey, i) => {
32290
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
32630
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName20("content"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Drawer, { droppableId: `component-list${title ? `:${title}` : ""}`, children: children || Object.keys(config.components).map((componentKey, i) => {
32631
+ var _a;
32632
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
32291
32633
  ComponentListItem,
32292
32634
  {
32635
+ label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
32293
32636
  name: componentKey,
32294
32637
  index: i
32295
32638
  },
@@ -32301,10 +32644,10 @@ var ComponentList = ({
32301
32644
  ComponentList.Item = ComponentListItem;
32302
32645
 
32303
32646
  // lib/use-component-list.tsx
32304
- var import_jsx_runtime24 = require("react/jsx-runtime");
32647
+ var import_jsx_runtime27 = require("react/jsx-runtime");
32305
32648
  var useComponentList = (config, ui) => {
32306
- const [componentList, setComponentList] = (0, import_react20.useState)();
32307
- (0, import_react20.useEffect)(() => {
32649
+ const [componentList, setComponentList] = (0, import_react21.useState)();
32650
+ (0, import_react21.useEffect)(() => {
32308
32651
  var _a, _b, _c;
32309
32652
  if (Object.keys(ui.componentList).length > 0) {
32310
32653
  const matchedComponents = [];
@@ -32314,16 +32657,18 @@ var useComponentList = (config, ui) => {
32314
32657
  if (category.visible === false || !category.components) {
32315
32658
  return null;
32316
32659
  }
32317
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32660
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32318
32661
  ComponentList,
32319
32662
  {
32320
32663
  id: categoryKey,
32321
32664
  title: category.title || categoryKey,
32322
32665
  children: category.components.map((componentName, i) => {
32666
+ var _a2;
32323
32667
  matchedComponents.push(componentName);
32324
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32668
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32325
32669
  ComponentList.Item,
32326
32670
  {
32671
+ label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
32327
32672
  name: componentName,
32328
32673
  index: i
32329
32674
  },
@@ -32340,16 +32685,18 @@ var useComponentList = (config, ui) => {
32340
32685
  );
32341
32686
  if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
32342
32687
  _componentList.push(
32343
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32688
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32344
32689
  ComponentList,
32345
32690
  {
32346
32691
  id: "other",
32347
32692
  title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
32348
32693
  children: remainingComponents.map((componentName, i) => {
32349
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32694
+ var _a2;
32695
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32350
32696
  ComponentList.Item,
32351
32697
  {
32352
32698
  name: componentName,
32699
+ label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
32353
32700
  index: i
32354
32701
  },
32355
32702
  componentName
@@ -32362,27 +32709,37 @@ var useComponentList = (config, ui) => {
32362
32709
  }
32363
32710
  setComponentList(_componentList);
32364
32711
  }
32365
- }, [config.categories, ui.componentList]);
32712
+ }, [config.categories, config.components, ui.componentList]);
32366
32713
  return componentList;
32367
32714
  };
32368
32715
 
32369
32716
  // components/Puck/components/Components/index.tsx
32370
- var import_react21 = require("react");
32371
- var import_jsx_runtime25 = require("react/jsx-runtime");
32717
+ var import_react22 = require("react");
32718
+ var import_jsx_runtime28 = require("react/jsx-runtime");
32372
32719
  var Components = () => {
32373
32720
  const { config, state, overrides } = useAppContext();
32374
32721
  const componentList = useComponentList(config, state.ui);
32375
- const Wrapper = (0, import_react21.useMemo)(() => overrides.components || "div", [overrides]);
32376
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ComponentList, { id: "all" }) });
32722
+ const Wrapper = (0, import_react22.useMemo)(() => overrides.components || "div", [overrides]);
32723
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComponentList, { id: "all" }) });
32377
32724
  };
32378
32725
 
32379
32726
  // components/Puck/components/Preview/index.tsx
32380
32727
  init_react_import();
32381
- var import_react22 = require("react");
32382
- var import_jsx_runtime26 = require("react/jsx-runtime");
32728
+ var import_react23 = require("react");
32729
+ var import_auto_frame_component = __toESM(require("@measured/auto-frame-component"));
32730
+
32731
+ // components/Puck/components/Preview/styles.module.css
32732
+ var styles_default16 = {
32733
+ PuckPreview: "styles_PuckPreview",
32734
+ "PuckPreview-frame": "styles_PuckPreview-frame"
32735
+ };
32736
+
32737
+ // components/Puck/components/Preview/index.tsx
32738
+ var import_jsx_runtime29 = require("react/jsx-runtime");
32739
+ var getClassName21 = get_class_name_factory_default("PuckPreview", styles_default16);
32383
32740
  var Preview = ({ id = "puck-preview" }) => {
32384
- const { config, dispatch, state } = useAppContext();
32385
- const Page = (0, import_react22.useCallback)(
32741
+ const { config, dispatch, state, setStatus, iframe } = useAppContext();
32742
+ const Page = (0, import_react23.useCallback)(
32386
32743
  (pageProps) => {
32387
32744
  var _a, _b;
32388
32745
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({}, pageProps), { editMode: true })) : pageProps.children;
@@ -32390,16 +32747,28 @@ var Preview = ({ id = "puck-preview" }) => {
32390
32747
  [config.root]
32391
32748
  );
32392
32749
  const rootProps = state.data.root.props || state.data.root;
32393
- const { disableZoom = false } = (0, import_react22.useContext)(dropZoneContext) || {};
32394
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
32750
+ const ref = (0, import_react23.useRef)(null);
32751
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32395
32752
  "div",
32396
32753
  {
32754
+ className: getClassName21(),
32397
32755
  id,
32398
32756
  onClick: () => {
32399
32757
  dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
32400
32758
  },
32401
- style: { zoom: disableZoom ? 1 : 0.75 },
32402
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZone, { zone: rootDroppableId }) }))
32759
+ children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32760
+ import_auto_frame_component.default,
32761
+ {
32762
+ id: "preview-frame",
32763
+ className: getClassName21("frame"),
32764
+ "data-rfd-iframe": true,
32765
+ ref,
32766
+ onStylesLoaded: () => {
32767
+ setStatus("READY");
32768
+ },
32769
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId }) }))
32770
+ }
32771
+ ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { id: "preview-frame", className: getClassName21("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId }) })) })
32403
32772
  }
32404
32773
  );
32405
32774
  };
@@ -32431,9 +32800,24 @@ var areaContainsZones = (data, area) => {
32431
32800
  // components/LayerTree/index.tsx
32432
32801
  init_react_import();
32433
32802
 
32434
- // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
32435
- init_react_import();
32436
- var styles_module_default16 = { "LayerTree": "_LayerTree_1pgw8_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_1pgw8_11", "LayerTree-helper": "_LayerTree-helper_1pgw8_17", "Layer": "_Layer_1pgw8_1", "Layer-inner": "_Layer-inner_1pgw8_29", "Layer--containsZone": "_Layer--containsZone_1pgw8_35", "Layer-clickable": "_Layer-clickable_1pgw8_39", "Layer--isSelected": "_Layer--isSelected_1pgw8_61", "Layer-chevron": "_Layer-chevron_1pgw8_77", "Layer--childIsSelected": "_Layer--childIsSelected_1pgw8_78", "Layer-zones": "_Layer-zones_1pgw8_82", "Layer-title": "_Layer-title_1pgw8_96", "Layer-name": "_Layer-name_1pgw8_105", "Layer-icon": "_Layer-icon_1pgw8_111", "Layer-zoneIcon": "_Layer-zoneIcon_1pgw8_116" };
32803
+ // components/LayerTree/styles.module.css
32804
+ var styles_default17 = {
32805
+ LayerTree: "styles_LayerTree",
32806
+ "LayerTree-zoneTitle": "styles_LayerTree-zoneTitle",
32807
+ "LayerTree-helper": "styles_LayerTree-helper",
32808
+ Layer: "styles_Layer",
32809
+ "Layer-inner": "styles_Layer-inner",
32810
+ "Layer--containsZone": "styles_Layer--containsZone",
32811
+ "Layer-clickable": "styles_Layer-clickable",
32812
+ "Layer--isSelected": "styles_Layer--isSelected",
32813
+ "Layer-chevron": "styles_Layer-chevron",
32814
+ "Layer--childIsSelected": "styles_Layer--childIsSelected",
32815
+ "Layer-zones": "styles_Layer-zones",
32816
+ "Layer-title": "styles_Layer-title",
32817
+ "Layer-name": "styles_Layer-name",
32818
+ "Layer-icon": "styles_Layer-icon",
32819
+ "Layer-zoneIcon": "styles_Layer-zoneIcon"
32820
+ };
32437
32821
 
32438
32822
  // lib/scroll-into-view.ts
32439
32823
  init_react_import();
@@ -32447,7 +32831,7 @@ var scrollIntoView = (el) => {
32447
32831
  };
32448
32832
 
32449
32833
  // components/LayerTree/index.tsx
32450
- var import_react23 = require("react");
32834
+ var import_react24 = require("react");
32451
32835
 
32452
32836
  // lib/is-child-of-zone.ts
32453
32837
  init_react_import();
@@ -32461,11 +32845,12 @@ var isChildOfZone = (item, maybeChild, ctx) => {
32461
32845
  };
32462
32846
 
32463
32847
  // components/LayerTree/index.tsx
32464
- var import_jsx_runtime27 = require("react/jsx-runtime");
32465
- var getClassName21 = get_class_name_factory_default("LayerTree", styles_module_default16);
32466
- var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default16);
32848
+ var import_jsx_runtime30 = require("react/jsx-runtime");
32849
+ var getClassName22 = get_class_name_factory_default("LayerTree", styles_default17);
32850
+ var getClassNameLayer = get_class_name_factory_default("Layer", styles_default17);
32467
32851
  var LayerTree = ({
32468
32852
  data,
32853
+ config,
32469
32854
  zoneContent,
32470
32855
  itemSelector,
32471
32856
  setItemSelector,
@@ -32473,16 +32858,18 @@ var LayerTree = ({
32473
32858
  label
32474
32859
  }) => {
32475
32860
  const zones = data.zones || {};
32476
- const ctx = (0, import_react23.useContext)(dropZoneContext);
32477
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
32478
- label && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName21("zoneTitle"), children: [
32479
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Layers, { size: "16" }) }),
32861
+ const ctx = (0, import_react24.useContext)(dropZoneContext);
32862
+ const frame = useFrame();
32863
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
32864
+ label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName22("zoneTitle"), children: [
32865
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Layers, { size: "16" }) }),
32480
32866
  " ",
32481
32867
  label
32482
32868
  ] }),
32483
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("ul", { className: getClassName21(), children: [
32484
- zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("helper"), children: "No items" }),
32869
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("ul", { className: getClassName22(), children: [
32870
+ zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("helper"), children: "No items" }),
32485
32871
  zoneContent.map((item, i) => {
32872
+ var _a;
32486
32873
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
32487
32874
  const zonesForItem = findZonesForArea(data, item.props.id);
32488
32875
  const containsZone = Object.keys(zonesForItem).length > 0;
@@ -32496,7 +32883,7 @@ var LayerTree = ({
32496
32883
  const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
32497
32884
  const isHovering = hoveringComponent === item.props.id;
32498
32885
  const childIsSelected = isChildOfZone(item, selectedItem, ctx);
32499
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
32886
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
32500
32887
  "li",
32501
32888
  {
32502
32889
  className: getClassNameLayer({
@@ -32506,7 +32893,7 @@ var LayerTree = ({
32506
32893
  childIsSelected
32507
32894
  }),
32508
32895
  children: [
32509
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
32896
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
32510
32897
  "button",
32511
32898
  {
32512
32899
  className: getClassNameLayer("clickable"),
@@ -32521,7 +32908,7 @@ var LayerTree = ({
32521
32908
  });
32522
32909
  const id = zoneContent[i].props.id;
32523
32910
  scrollIntoView(
32524
- document.querySelector(
32911
+ frame == null ? void 0 : frame.querySelector(
32525
32912
  `[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
32526
32913
  )
32527
32914
  );
@@ -32537,24 +32924,25 @@ var LayerTree = ({
32537
32924
  setHoveringComponent(null);
32538
32925
  },
32539
32926
  children: [
32540
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32927
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
32541
32928
  "div",
32542
32929
  {
32543
32930
  className: getClassNameLayer("chevron"),
32544
32931
  title: isSelected ? "Collapse" : "Expand",
32545
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChevronDown, { size: "12" })
32932
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronDown, { size: "12" })
32546
32933
  }
32547
32934
  ),
32548
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassNameLayer("title"), children: [
32549
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LayoutGrid, { size: "16" }) }),
32550
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("name"), children: item.type })
32935
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassNameLayer("title"), children: [
32936
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(LayoutGrid, { size: "16" }) }),
32937
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("name"), children: (_a = config.components[item.type]["label"]) != null ? _a : item.type })
32551
32938
  ] })
32552
32939
  ]
32553
32940
  }
32554
32941
  ) }),
32555
- containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32942
+ containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
32556
32943
  LayerTree,
32557
32944
  {
32945
+ config,
32558
32946
  data,
32559
32947
  zoneContent: zones[zoneKey],
32560
32948
  setItemSelector,
@@ -32573,13 +32961,13 @@ var LayerTree = ({
32573
32961
  };
32574
32962
 
32575
32963
  // components/Puck/components/Outline/index.tsx
32576
- var import_react24 = require("react");
32577
- var import_jsx_runtime28 = require("react/jsx-runtime");
32964
+ var import_react25 = require("react");
32965
+ var import_jsx_runtime31 = require("react/jsx-runtime");
32578
32966
  var Outline = () => {
32579
- const { dispatch, state, overrides } = useAppContext();
32967
+ const { dispatch, state, overrides, config } = useAppContext();
32580
32968
  const { data, ui } = state;
32581
32969
  const { itemSelector } = ui;
32582
- const setItemSelector = (0, import_react24.useCallback)(
32970
+ const setItemSelector = (0, import_react25.useCallback)(
32583
32971
  (newItemSelector) => {
32584
32972
  dispatch({
32585
32973
  type: "setUi",
@@ -32588,11 +32976,12 @@ var Outline = () => {
32588
32976
  },
32589
32977
  []
32590
32978
  );
32591
- const Wrapper = (0, import_react24.useMemo)(() => overrides.outline || "div", [overrides]);
32592
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
32593
- (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32979
+ const Wrapper = (0, import_react25.useMemo)(() => overrides.outline || "div", [overrides]);
32980
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
32981
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
32594
32982
  LayerTree,
32595
32983
  {
32984
+ config,
32596
32985
  data,
32597
32986
  label: areaContainsZones(data, "root") ? rootDroppableId : "",
32598
32987
  zoneContent: data.content,
@@ -32602,9 +32991,10 @@ var Outline = () => {
32602
32991
  ),
32603
32992
  Object.entries(findZonesForArea(data, "root")).map(
32604
32993
  ([zoneKey, zone]) => {
32605
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32994
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
32606
32995
  LayerTree,
32607
32996
  {
32997
+ config,
32608
32998
  data,
32609
32999
  label: zoneKey,
32610
33000
  zone: zoneKey,
@@ -32686,12 +33076,12 @@ function usePuckHistory({
32686
33076
 
32687
33077
  // lib/use-history-store.ts
32688
33078
  init_react_import();
32689
- var import_react25 = require("react");
33079
+ var import_react26 = require("react");
32690
33080
  var import_use_debounce3 = require("use-debounce");
32691
33081
  var EMPTY_HISTORY_INDEX = -1;
32692
33082
  function useHistoryStore() {
32693
- const [histories, setHistories] = (0, import_react25.useState)([]);
32694
- const [index, setIndex] = (0, import_react25.useState)(EMPTY_HISTORY_INDEX);
33083
+ const [histories, setHistories] = (0, import_react26.useState)([]);
33084
+ const [index, setIndex] = (0, import_react26.useState)(EMPTY_HISTORY_INDEX);
32695
33085
  const hasPast = index > EMPTY_HISTORY_INDEX;
32696
33086
  const hasFuture = index < histories.length - 1;
32697
33087
  const currentHistory = histories[index];
@@ -32728,14 +33118,441 @@ function useHistoryStore() {
32728
33118
  };
32729
33119
  }
32730
33120
 
33121
+ // components/Puck/components/Canvas/index.tsx
33122
+ init_react_import();
33123
+
33124
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
33125
+ init_react_import();
33126
+
33127
+ // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
33128
+ init_react_import();
33129
+ var isProduction = process.env.NODE_ENV === "production";
33130
+ var prefix = "Invariant failed";
33131
+ function invariant(condition, message) {
33132
+ if (condition) {
33133
+ return;
33134
+ }
33135
+ if (isProduction) {
33136
+ throw new Error(prefix);
33137
+ }
33138
+ var provided = typeof message === "function" ? message() : message;
33139
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
33140
+ throw new Error(value);
33141
+ }
33142
+
33143
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
33144
+ var getRect = function getRect2(_ref) {
33145
+ var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
33146
+ var width = right - left;
33147
+ var height = bottom - top;
33148
+ var rect = {
33149
+ top,
33150
+ right,
33151
+ bottom,
33152
+ left,
33153
+ width,
33154
+ height,
33155
+ x: left,
33156
+ y: top,
33157
+ center: {
33158
+ x: (right + left) / 2,
33159
+ y: (bottom + top) / 2
33160
+ }
33161
+ };
33162
+ return rect;
33163
+ };
33164
+ var expand = function expand2(target, expandBy) {
33165
+ return {
33166
+ top: target.top - expandBy.top,
33167
+ left: target.left - expandBy.left,
33168
+ bottom: target.bottom + expandBy.bottom,
33169
+ right: target.right + expandBy.right
33170
+ };
33171
+ };
33172
+ var shrink = function shrink2(target, shrinkBy) {
33173
+ return {
33174
+ top: target.top + shrinkBy.top,
33175
+ left: target.left + shrinkBy.left,
33176
+ bottom: target.bottom - shrinkBy.bottom,
33177
+ right: target.right - shrinkBy.right
33178
+ };
33179
+ };
33180
+ var noSpacing = {
33181
+ top: 0,
33182
+ right: 0,
33183
+ bottom: 0,
33184
+ left: 0
33185
+ };
33186
+ var createBox = function createBox2(_ref2) {
33187
+ var borderBox = _ref2.borderBox, _ref2$margin = _ref2.margin, margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin, _ref2$border = _ref2.border, border = _ref2$border === void 0 ? noSpacing : _ref2$border, _ref2$padding = _ref2.padding, padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
33188
+ var marginBox = getRect(expand(borderBox, margin));
33189
+ var paddingBox = getRect(shrink(borderBox, border));
33190
+ var contentBox = getRect(shrink(paddingBox, padding));
33191
+ return {
33192
+ marginBox,
33193
+ borderBox: getRect(borderBox),
33194
+ paddingBox,
33195
+ contentBox,
33196
+ margin,
33197
+ border,
33198
+ padding
33199
+ };
33200
+ };
33201
+ var parse = function parse2(raw) {
33202
+ var value = raw.slice(0, -2);
33203
+ var suffix = raw.slice(-2);
33204
+ if (suffix !== "px") {
33205
+ return 0;
33206
+ }
33207
+ var result = Number(value);
33208
+ !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
33209
+ return result;
33210
+ };
33211
+ var calculateBox = function calculateBox2(borderBox, styles) {
33212
+ var margin = {
33213
+ top: parse(styles.marginTop),
33214
+ right: parse(styles.marginRight),
33215
+ bottom: parse(styles.marginBottom),
33216
+ left: parse(styles.marginLeft)
33217
+ };
33218
+ var padding = {
33219
+ top: parse(styles.paddingTop),
33220
+ right: parse(styles.paddingRight),
33221
+ bottom: parse(styles.paddingBottom),
33222
+ left: parse(styles.paddingLeft)
33223
+ };
33224
+ var border = {
33225
+ top: parse(styles.borderTopWidth),
33226
+ right: parse(styles.borderRightWidth),
33227
+ bottom: parse(styles.borderBottomWidth),
33228
+ left: parse(styles.borderLeftWidth)
33229
+ };
33230
+ return createBox({
33231
+ borderBox,
33232
+ margin,
33233
+ padding,
33234
+ border
33235
+ });
33236
+ };
33237
+ var getBox = function getBox2(el) {
33238
+ var borderBox = el.getBoundingClientRect();
33239
+ var styles = window.getComputedStyle(el);
33240
+ return calculateBox(borderBox, styles);
33241
+ };
33242
+
33243
+ // components/Puck/components/Canvas/index.tsx
33244
+ var import_react28 = require("react");
33245
+
33246
+ // components/ViewportControls/index.tsx
33247
+ init_react_import();
33248
+ var import_react27 = require("react");
33249
+
33250
+ // components/ViewportControls/styles.module.css
33251
+ var styles_default18 = {
33252
+ ViewportControls: "styles_ViewportControls",
33253
+ "ViewportControls-divider": "styles_ViewportControls-divider",
33254
+ "ViewportControls-zoomSelect": "styles_ViewportControls-zoomSelect",
33255
+ "ViewportButton--isActive": "styles_ViewportButton--isActive",
33256
+ "ViewportButton-inner": "styles_ViewportButton-inner"
33257
+ };
33258
+
33259
+ // components/ViewportControls/index.tsx
33260
+ var import_jsx_runtime32 = require("react/jsx-runtime");
33261
+ var icons = {
33262
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Smartphone, { size: 16 }),
33263
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Tablet, { size: 16 }),
33264
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Monitor, { size: 16 })
33265
+ };
33266
+ var getClassName23 = get_class_name_factory_default("ViewportControls", styles_default18);
33267
+ var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_default18);
33268
+ var ViewportButton = ({
33269
+ children,
33270
+ height = "auto",
33271
+ title,
33272
+ width,
33273
+ onClick
33274
+ }) => {
33275
+ const { state } = useAppContext();
33276
+ const [isActive, setIsActive] = (0, import_react27.useState)(false);
33277
+ (0, import_react27.useEffect)(() => {
33278
+ setIsActive(width === state.ui.viewports.current.width);
33279
+ }, [width, state.ui.viewports.current.width]);
33280
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33281
+ IconButton,
33282
+ {
33283
+ title,
33284
+ disabled: isActive,
33285
+ onClick: (e) => {
33286
+ e.stopPropagation();
33287
+ onClick({ width, height });
33288
+ },
33289
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton("inner"), children })
33290
+ }
33291
+ ) });
33292
+ };
33293
+ var defaultZoomOptions = [
33294
+ { label: "25%", value: 0.25 },
33295
+ { label: "50%", value: 0.5 },
33296
+ { label: "75%", value: 0.75 },
33297
+ { label: "100%", value: 1 },
33298
+ { label: "125%", value: 1.25 },
33299
+ { label: "150%", value: 1.5 },
33300
+ { label: "200%", value: 2 }
33301
+ ];
33302
+ var ViewportControls = ({
33303
+ autoZoom,
33304
+ zoom,
33305
+ onViewportChange,
33306
+ onZoom
33307
+ }) => {
33308
+ const { viewports } = useAppContext();
33309
+ const defaultsContainAutoZoom = defaultZoomOptions.find(
33310
+ (option) => option.value === autoZoom
33311
+ );
33312
+ const zoomOptions = (0, import_react27.useMemo)(
33313
+ () => [
33314
+ ...defaultZoomOptions,
33315
+ ...defaultsContainAutoZoom ? [] : [
33316
+ {
33317
+ value: autoZoom,
33318
+ label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
33319
+ }
33320
+ ]
33321
+ ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
33322
+ [autoZoom]
33323
+ );
33324
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName23(), children: [
33325
+ viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33326
+ ViewportButton,
33327
+ {
33328
+ height: viewport.height,
33329
+ width: viewport.width,
33330
+ title: viewport.label ? `Switch to ${viewport.label} viewport` : "Switch viewport",
33331
+ onClick: onViewportChange,
33332
+ children: typeof viewport.icon === "string" ? icons[viewport.icon] || viewport.icon : viewport.icon || icons.Smartphone
33333
+ },
33334
+ i
33335
+ )),
33336
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
33337
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33338
+ IconButton,
33339
+ {
33340
+ title: "Zoom viewport out",
33341
+ disabled: zoom <= zoomOptions[0].value,
33342
+ onClick: (e) => {
33343
+ e.stopPropagation();
33344
+ onZoom(
33345
+ zoomOptions[Math.max(
33346
+ zoomOptions.findIndex((option) => option.value === zoom) - 1,
33347
+ 0
33348
+ )].value
33349
+ );
33350
+ },
33351
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomOut, { size: 16 })
33352
+ }
33353
+ ),
33354
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33355
+ IconButton,
33356
+ {
33357
+ title: "Zoom viewport in",
33358
+ disabled: zoom >= zoomOptions[zoomOptions.length - 1].value,
33359
+ onClick: (e) => {
33360
+ e.stopPropagation();
33361
+ onZoom(
33362
+ zoomOptions[Math.min(
33363
+ zoomOptions.findIndex((option) => option.value === zoom) + 1,
33364
+ zoomOptions.length - 1
33365
+ )].value
33366
+ );
33367
+ },
33368
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomIn, { size: 16 })
33369
+ }
33370
+ ),
33371
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
33372
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33373
+ "select",
33374
+ {
33375
+ className: getClassName23("zoomSelect"),
33376
+ value: zoom.toString(),
33377
+ onChange: (e) => {
33378
+ onZoom(parseFloat(e.currentTarget.value));
33379
+ },
33380
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33381
+ "option",
33382
+ {
33383
+ value: option.value,
33384
+ label: option.label
33385
+ },
33386
+ option.label
33387
+ ))
33388
+ }
33389
+ )
33390
+ ] });
33391
+ };
33392
+
33393
+ // components/Puck/components/Canvas/styles.module.css
33394
+ var styles_default19 = {
33395
+ PuckCanvas: "styles_PuckCanvas",
33396
+ "PuckCanvas-controls": "styles_PuckCanvas-controls",
33397
+ "PuckCanvas-inner": "styles_PuckCanvas-inner",
33398
+ "PuckCanvas-root": "styles_PuckCanvas-root",
33399
+ "PuckCanvas--ready": "styles_PuckCanvas--ready"
33400
+ };
33401
+
33402
+ // lib/get-zoom-config.ts
33403
+ init_react_import();
33404
+ var RESET_ZOOM_SMALLER_THAN_FRAME = true;
33405
+ var getZoomConfig = (uiViewport, frame, zoom) => {
33406
+ const box = getBox(frame);
33407
+ const { width: frameWidth, height: frameHeight } = box.contentBox;
33408
+ const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
33409
+ let rootHeight = 0;
33410
+ let autoZoom = 1;
33411
+ if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
33412
+ const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
33413
+ const heightZoom = Math.min(frameHeight / viewportHeight, 1);
33414
+ zoom = widthZoom;
33415
+ if (widthZoom < heightZoom) {
33416
+ rootHeight = viewportHeight / zoom;
33417
+ } else {
33418
+ rootHeight = viewportHeight;
33419
+ zoom = heightZoom;
33420
+ }
33421
+ autoZoom = zoom;
33422
+ } else {
33423
+ if (RESET_ZOOM_SMALLER_THAN_FRAME) {
33424
+ autoZoom = 1;
33425
+ zoom = 1;
33426
+ rootHeight = viewportHeight;
33427
+ }
33428
+ }
33429
+ return { autoZoom, rootHeight, zoom };
33430
+ };
33431
+
33432
+ // components/Puck/components/Canvas/index.tsx
33433
+ var import_jsx_runtime33 = require("react/jsx-runtime");
33434
+ var getClassName24 = get_class_name_factory_default("PuckCanvas", styles_default19);
33435
+ var ZOOM_ON_CHANGE = true;
33436
+ var Canvas = () => {
33437
+ const { status, iframe } = useAppContext();
33438
+ const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
33439
+ const { ui } = state;
33440
+ const frameRef = (0, import_react28.useRef)(null);
33441
+ const [showTransition, setShowTransition] = (0, import_react28.useState)(false);
33442
+ const defaultRender = (0, import_react28.useMemo)(() => {
33443
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
33444
+ return PuckDefault;
33445
+ }, []);
33446
+ const CustomPreview = (0, import_react28.useMemo)(
33447
+ () => overrides.preview || defaultRender,
33448
+ [overrides]
33449
+ );
33450
+ const getFrameDimensions = (0, import_react28.useCallback)(() => {
33451
+ if (frameRef.current) {
33452
+ const frame = frameRef.current;
33453
+ const box = getBox(frame);
33454
+ return { width: box.contentBox.width, height: box.contentBox.height };
33455
+ }
33456
+ return { width: 0, height: 0 };
33457
+ }, [frameRef]);
33458
+ const resetAutoZoom = (0, import_react28.useCallback)(
33459
+ (ui2 = state.ui) => {
33460
+ if (frameRef.current) {
33461
+ setZoomConfig(
33462
+ getZoomConfig(ui2.viewports.current, frameRef.current, zoomConfig.zoom)
33463
+ );
33464
+ }
33465
+ },
33466
+ [frameRef, zoomConfig, state.ui]
33467
+ );
33468
+ (0, import_react28.useEffect)(() => {
33469
+ setShowTransition(false);
33470
+ resetAutoZoom();
33471
+ }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
33472
+ (0, import_react28.useEffect)(() => {
33473
+ const { height: frameHeight } = getFrameDimensions();
33474
+ if (ui.viewports.current.height === "auto") {
33475
+ setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
33476
+ rootHeight: frameHeight / zoomConfig.zoom
33477
+ }));
33478
+ }
33479
+ }, [zoomConfig.zoom]);
33480
+ (0, import_react28.useEffect)(() => {
33481
+ const observer = new ResizeObserver(() => {
33482
+ setShowTransition(false);
33483
+ resetAutoZoom();
33484
+ });
33485
+ if (document.body) {
33486
+ observer.observe(document.body);
33487
+ }
33488
+ return () => {
33489
+ observer.disconnect();
33490
+ };
33491
+ }, []);
33492
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
33493
+ "div",
33494
+ {
33495
+ className: getClassName24({
33496
+ ready: status === "READY" || !iframe.enabled
33497
+ }),
33498
+ onClick: () => dispatch({
33499
+ type: "setUi",
33500
+ ui: { itemSelector: null },
33501
+ recordHistory: true
33502
+ }),
33503
+ children: [
33504
+ ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33505
+ ViewportControls,
33506
+ {
33507
+ autoZoom: zoomConfig.autoZoom,
33508
+ zoom: zoomConfig.zoom,
33509
+ onViewportChange: (viewport) => {
33510
+ setShowTransition(true);
33511
+ const uiViewport = __spreadProps(__spreadValues({}, viewport), {
33512
+ height: viewport.height || "auto",
33513
+ zoom: zoomConfig.zoom
33514
+ });
33515
+ const newUi = __spreadProps(__spreadValues({}, ui), {
33516
+ viewports: __spreadProps(__spreadValues({}, ui.viewports), { current: uiViewport })
33517
+ });
33518
+ setUi(newUi);
33519
+ if (ZOOM_ON_CHANGE) {
33520
+ resetAutoZoom(newUi);
33521
+ }
33522
+ },
33523
+ onZoom: (zoom) => {
33524
+ setShowTransition(true);
33525
+ setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
33526
+ }
33527
+ }
33528
+ ) }),
33529
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33530
+ "div",
33531
+ {
33532
+ className: getClassName24("root"),
33533
+ style: {
33534
+ width: iframe.enabled ? ui.viewports.current.width : void 0,
33535
+ height: zoomConfig.rootHeight,
33536
+ transform: iframe.enabled ? `scale(${zoomConfig.zoom})` : void 0,
33537
+ transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
33538
+ overflow: iframe.enabled ? void 0 : "auto"
33539
+ },
33540
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Preview, {}) })
33541
+ }
33542
+ ) })
33543
+ ]
33544
+ }
33545
+ );
33546
+ };
33547
+
32731
33548
  // components/Puck/index.tsx
32732
- var import_jsx_runtime29 = require("react/jsx-runtime");
32733
- var getClassName22 = get_class_name_factory_default("Puck", styles_module_default8);
33549
+ var import_jsx_runtime34 = require("react/jsx-runtime");
33550
+ var getClassName25 = get_class_name_factory_default("Puck", styles_default8);
32734
33551
  function Puck({
32735
33552
  children,
32736
33553
  config,
32737
33554
  data: initialData = { content: [], root: { props: { title: "" } } },
32738
- ui: initialUi = defaultAppState.ui,
33555
+ ui: initialUi,
32739
33556
  onChange,
32740
33557
  onPublish,
32741
33558
  plugins = [],
@@ -32743,32 +33560,63 @@ function Puck({
32743
33560
  renderHeader,
32744
33561
  renderHeaderActions,
32745
33562
  headerTitle,
32746
- headerPath
33563
+ headerPath,
33564
+ viewports = defaultViewports,
33565
+ iframe = {
33566
+ enabled: true
33567
+ }
32747
33568
  }) {
33569
+ var _a;
32748
33570
  const historyStore = useHistoryStore();
32749
- const [reducer] = (0, import_react26.useState)(
33571
+ const [reducer] = (0, import_react29.useState)(
32750
33572
  () => createReducer({ config, record: historyStore.record })
32751
33573
  );
32752
- const [initialAppState] = (0, import_react26.useState)(() => __spreadProps(__spreadValues({}, defaultAppState), {
32753
- data: initialData,
32754
- ui: __spreadProps(__spreadValues(__spreadValues({}, defaultAppState.ui), initialUi), {
32755
- // Store categories under componentList on state to allow render functions and plugins to modify
32756
- componentList: config.categories ? Object.entries(config.categories).reduce(
32757
- (acc, [categoryName, category]) => {
32758
- return __spreadProps(__spreadValues({}, acc), {
32759
- [categoryName]: {
32760
- title: category.title,
32761
- components: category.components,
32762
- expanded: category.defaultExpanded,
32763
- visible: category.visible
32764
- }
32765
- });
32766
- },
32767
- {}
32768
- ) : {}
32769
- })
32770
- }));
32771
- const [appState, dispatch] = (0, import_react26.useReducer)(
33574
+ const [initialAppState] = (0, import_react29.useState)(() => {
33575
+ var _a2, _b, _c, _d;
33576
+ const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
33577
+ let clientUiState = {};
33578
+ if (typeof window !== "undefined") {
33579
+ const viewportWidth = window.innerWidth;
33580
+ const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
33581
+ key,
33582
+ diff: Math.abs(viewportWidth - value.width)
33583
+ })).sort((a, b) => a.diff > b.diff ? 1 : -1);
33584
+ const closestViewport = viewportDifferences[0].key;
33585
+ if (iframe.enabled) {
33586
+ clientUiState = __spreadProps(__spreadValues({}, window.matchMedia("(min-width: 638px)").matches ? {} : {
33587
+ leftSideBarVisible: false,
33588
+ rightSideBarVisible: false
33589
+ }), {
33590
+ viewports: __spreadProps(__spreadValues({}, initial.viewports), {
33591
+ current: __spreadProps(__spreadValues({}, initial.viewports.current), {
33592
+ height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || viewports[closestViewport].height || "auto",
33593
+ width: ((_d = (_c = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _c.current) == null ? void 0 : _d.width) || viewports[closestViewport].width
33594
+ })
33595
+ })
33596
+ });
33597
+ }
33598
+ }
33599
+ return __spreadProps(__spreadValues({}, defaultAppState), {
33600
+ data: initialData,
33601
+ ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
33602
+ // Store categories under componentList on state to allow render functions and plugins to modify
33603
+ componentList: config.categories ? Object.entries(config.categories).reduce(
33604
+ (acc, [categoryName, category]) => {
33605
+ return __spreadProps(__spreadValues({}, acc), {
33606
+ [categoryName]: {
33607
+ title: category.title,
33608
+ components: category.components,
33609
+ expanded: category.defaultExpanded,
33610
+ visible: category.visible
33611
+ }
33612
+ });
33613
+ },
33614
+ {}
33615
+ ) : {}
33616
+ })
33617
+ });
33618
+ });
33619
+ const [appState, dispatch] = (0, import_react29.useReducer)(
32772
33620
  reducer,
32773
33621
  flushZones(initialAppState)
32774
33622
  );
@@ -32779,9 +33627,9 @@ function Puck({
32779
33627
  config,
32780
33628
  dispatch
32781
33629
  );
32782
- const [menuOpen, setMenuOpen] = (0, import_react26.useState)(false);
33630
+ const [menuOpen, setMenuOpen] = (0, import_react29.useState)(false);
32783
33631
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
32784
- const setItemSelector = (0, import_react26.useCallback)(
33632
+ const setItemSelector = (0, import_react29.useCallback)(
32785
33633
  (newItemSelector) => {
32786
33634
  if (newItemSelector === itemSelector)
32787
33635
  return;
@@ -32794,21 +33642,21 @@ function Puck({
32794
33642
  [itemSelector]
32795
33643
  );
32796
33644
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
32797
- (0, import_react26.useEffect)(() => {
33645
+ (0, import_react29.useEffect)(() => {
32798
33646
  if (onChange)
32799
33647
  onChange(data);
32800
33648
  }, [data]);
32801
33649
  const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
32802
- const [draggedItem, setDraggedItem] = (0, import_react26.useState)();
33650
+ const [draggedItem, setDraggedItem] = (0, import_react29.useState)();
32803
33651
  const rootProps = data.root.props || data.root;
32804
- (0, import_react26.useEffect)(() => {
33652
+ (0, import_react29.useEffect)(() => {
32805
33653
  if (Object.keys(data.root).length > 0 && !data.root.props) {
32806
33654
  console.error(
32807
33655
  "Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
32808
33656
  );
32809
33657
  }
32810
33658
  }, []);
32811
- const toggleSidebars = (0, import_react26.useCallback)(
33659
+ const toggleSidebars = (0, import_react29.useCallback)(
32812
33660
  (sidebar) => {
32813
33661
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
32814
33662
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -32822,7 +33670,7 @@ function Puck({
32822
33670
  },
32823
33671
  [dispatch, leftSideBarVisible, rightSideBarVisible]
32824
33672
  );
32825
- (0, import_react26.useEffect)(() => {
33673
+ (0, import_react29.useEffect)(() => {
32826
33674
  if (!window.matchMedia("(min-width: 638px)").matches) {
32827
33675
  dispatch({
32828
33676
  type: "setUi",
@@ -32845,59 +33693,54 @@ function Puck({
32845
33693
  window.removeEventListener("resize", handleResize);
32846
33694
  };
32847
33695
  }, []);
32848
- const defaultRender = (0, import_react26.useMemo)(() => {
32849
- const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: children2 });
33696
+ const defaultRender = (0, import_react29.useMemo)(() => {
33697
+ const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: children2 });
32850
33698
  return PuckDefault;
32851
33699
  }, []);
32852
- const defaultHeaderRender = (0, import_react26.useMemo)(() => {
33700
+ const defaultHeaderRender = (0, import_react29.useMemo)(() => {
32853
33701
  if (renderHeader) {
32854
33702
  console.warn(
32855
33703
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
32856
33704
  );
32857
- const RenderHeader = (_a) => {
32858
- var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
33705
+ const RenderHeader = (_a2) => {
33706
+ var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
32859
33707
  const Comp = renderHeader;
32860
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
33708
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
32861
33709
  };
32862
33710
  return RenderHeader;
32863
33711
  }
32864
33712
  return defaultRender;
32865
33713
  }, [renderHeader]);
32866
- const defaultHeaderActionsRender = (0, import_react26.useMemo)(() => {
33714
+ const defaultHeaderActionsRender = (0, import_react29.useMemo)(() => {
32867
33715
  if (renderHeaderActions) {
32868
33716
  console.warn(
32869
33717
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
32870
33718
  );
32871
33719
  const RenderHeader = (props) => {
32872
33720
  const Comp = renderHeaderActions;
32873
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
33721
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
32874
33722
  };
32875
33723
  return RenderHeader;
32876
33724
  }
32877
33725
  return defaultRender;
32878
33726
  }, [renderHeader]);
32879
- const loadedOverrides = (0, import_react26.useMemo)(() => {
33727
+ const loadedOverrides = (0, import_react29.useMemo)(() => {
32880
33728
  return loadOverrides({ overrides, plugins });
32881
33729
  }, [plugins]);
32882
- const CustomPuck = (0, import_react26.useMemo)(
33730
+ const CustomPuck = (0, import_react29.useMemo)(
32883
33731
  () => loadedOverrides.puck || defaultRender,
32884
33732
  [loadedOverrides]
32885
33733
  );
32886
- const CustomPreview = (0, import_react26.useMemo)(
32887
- () => loadedOverrides.preview || defaultRender,
32888
- [loadedOverrides]
32889
- );
32890
- const CustomHeader = (0, import_react26.useMemo)(
33734
+ const CustomHeader = (0, import_react29.useMemo)(
32891
33735
  () => loadedOverrides.header || defaultHeaderRender,
32892
33736
  [loadedOverrides]
32893
33737
  );
32894
- const CustomHeaderActions = (0, import_react26.useMemo)(
33738
+ const CustomHeaderActions = (0, import_react29.useMemo)(
32895
33739
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
32896
33740
  [loadedOverrides]
32897
33741
  );
32898
- const disableZoom = children || loadedOverrides.puck ? true : false;
32899
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "Puck", children: [
32900
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33742
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "Puck", children: [
33743
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32901
33744
  AppProvider,
32902
33745
  {
32903
33746
  value: {
@@ -32908,10 +33751,12 @@ function Puck({
32908
33751
  resolveData,
32909
33752
  plugins,
32910
33753
  overrides: loadedOverrides,
32911
- history
33754
+ history,
33755
+ viewports,
33756
+ iframe
32912
33757
  },
32913
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32914
- import_dnd7.DragDropContext,
33758
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33759
+ DragDropContext,
32915
33760
  {
32916
33761
  onDragUpdate: (update) => {
32917
33762
  setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
@@ -32965,7 +33810,7 @@ function Puck({
32965
33810
  });
32966
33811
  }
32967
33812
  },
32968
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33813
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32969
33814
  DropZoneProvider,
32970
33815
  {
32971
33816
  value: {
@@ -32977,77 +33822,75 @@ function Puck({
32977
33822
  draggedItem,
32978
33823
  placeholderStyle,
32979
33824
  mode: "edit",
32980
- areaId: "root",
32981
- disableZoom
33825
+ areaId: "root"
32982
33826
  },
32983
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
33827
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
32984
33828
  "div",
32985
33829
  {
32986
- className: getClassName22({
33830
+ className: getClassName25({
32987
33831
  leftSideBarVisible,
32988
33832
  menuOpen,
32989
- rightSideBarVisible,
32990
- disableZoom
33833
+ rightSideBarVisible
32991
33834
  }),
32992
33835
  children: [
32993
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33836
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32994
33837
  CustomHeader,
32995
33838
  {
32996
- actions: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
32997
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomHeaderActions, {}),
32998
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33839
+ actions: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
33840
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
33841
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32999
33842
  Button,
33000
33843
  {
33001
33844
  onClick: () => {
33002
33845
  onPublish && onPublish(data);
33003
33846
  },
33004
- icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Globe, { size: "14px" }),
33847
+ icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Globe, { size: "14px" }),
33005
33848
  children: "Publish"
33006
33849
  }
33007
33850
  )
33008
33851
  ] }),
33009
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("header", { className: getClassName22("header"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerInner"), children: [
33010
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerToggle"), children: [
33011
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33852
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerInner"), children: [
33853
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerToggle"), children: [
33854
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33012
33855
  IconButton,
33013
33856
  {
33014
33857
  onClick: () => {
33015
33858
  toggleSidebars("left");
33016
33859
  },
33017
33860
  title: "Toggle left sidebar",
33018
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelLeft, { focusable: "false" })
33861
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelLeft, { focusable: "false" })
33019
33862
  }
33020
33863
  ) }),
33021
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33864
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33022
33865
  IconButton,
33023
33866
  {
33024
33867
  onClick: () => {
33025
33868
  toggleSidebars("right");
33026
33869
  },
33027
33870
  title: "Toggle right sidebar",
33028
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelRight, { focusable: "false" })
33871
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelRight, { focusable: "false" })
33029
33872
  }
33030
33873
  ) })
33031
33874
  ] }),
33032
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Heading, { rank: 2, size: "xs", children: [
33875
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Heading, { rank: 2, size: "xs", children: [
33033
33876
  headerTitle || rootProps.title || "Page",
33034
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
33877
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
33035
33878
  " ",
33036
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("code", { className: getClassName22("headerPath"), children: headerPath })
33879
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
33037
33880
  ] })
33038
33881
  ] }) }),
33039
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerTools"), children: [
33040
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33882
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerTools"), children: [
33883
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33041
33884
  IconButton,
33042
33885
  {
33043
33886
  onClick: () => {
33044
33887
  return setMenuOpen(!menuOpen);
33045
33888
  },
33046
33889
  title: "Toggle menu bar",
33047
- children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, { focusable: "false" })
33890
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { focusable: "false" })
33048
33891
  }
33049
33892
  ) }),
33050
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33893
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33051
33894
  MenuBar,
33052
33895
  {
33053
33896
  appState,
@@ -33055,7 +33898,7 @@ function Puck({
33055
33898
  dispatch,
33056
33899
  onPublish,
33057
33900
  menuOpen,
33058
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomHeaderActions, {}),
33901
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
33059
33902
  setMenuOpen
33060
33903
  }
33061
33904
  )
@@ -33063,38 +33906,19 @@ function Puck({
33063
33906
  ] }) })
33064
33907
  }
33065
33908
  ),
33066
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("leftSideBar"), children: [
33067
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Components, {}) }),
33068
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Outline, {}) })
33909
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
33910
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Components, {}) }),
33911
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Outline, {}) })
33069
33912
  ] }),
33070
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
33071
- "div",
33072
- {
33073
- className: getClassName22("frame"),
33074
- onClick: () => setItemSelector(null),
33075
- children: [
33076
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("root"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Preview, {}) }) }),
33077
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33078
- "div",
33079
- {
33080
- style: {
33081
- background: "var(--puck-color-grey-11)",
33082
- height: "100%",
33083
- flexGrow: 1
33084
- }
33085
- }
33086
- )
33087
- ]
33088
- }
33089
- ),
33090
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33913
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Canvas, {}),
33914
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33091
33915
  SidebarSection,
33092
33916
  {
33093
33917
  noPadding: true,
33094
33918
  noBorderTop: true,
33095
33919
  showBreadcrumbs: true,
33096
- title: selectedItem ? selectedItem.type : "Page",
33097
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Fields, {})
33920
+ title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
33921
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Fields, {})
33098
33922
  }
33099
33923
  ) })
33100
33924
  ]
@@ -33106,7 +33930,7 @@ function Puck({
33106
33930
  )
33107
33931
  }
33108
33932
  ),
33109
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { id: "puck-portal-root" })
33933
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { id: "puck-portal-root" })
33110
33934
  ] });
33111
33935
  }
33112
33936
  Puck.Components = Components;
@@ -33116,13 +33940,13 @@ Puck.Preview = Preview;
33116
33940
 
33117
33941
  // components/Render/index.tsx
33118
33942
  init_react_import();
33119
- var import_jsx_runtime30 = require("react/jsx-runtime");
33943
+ var import_jsx_runtime35 = require("react/jsx-runtime");
33120
33944
  function Render({ config, data }) {
33121
33945
  var _a;
33122
33946
  const rootProps = data.root.props || data.root;
33123
33947
  const title = (rootProps == null ? void 0 : rootProps.title) || "";
33124
33948
  if ((_a = config.root) == null ? void 0 : _a.render) {
33125
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33949
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
33126
33950
  config.root.render,
33127
33951
  __spreadProps(__spreadValues({}, rootProps), {
33128
33952
  puck: {
@@ -33131,11 +33955,11 @@ function Render({ config, data }) {
33131
33955
  title,
33132
33956
  editMode: false,
33133
33957
  id: "puck-root",
33134
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId })
33958
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId })
33135
33959
  })
33136
33960
  ) });
33137
33961
  }
33138
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId }) });
33962
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId }) });
33139
33963
  }
33140
33964
 
33141
33965
  // lib/migrate.ts
@@ -33225,8 +34049,8 @@ var resolveAllData = (data, config, onResolveStart, onResolveEnd) => __async(voi
33225
34049
  // lib/use-puck.ts
33226
34050
  init_react_import();
33227
34051
  var usePuck = () => {
33228
- const { state: appState, config, dispatch } = useAppContext();
33229
- return { appState, config, dispatch };
34052
+ const { state: appState, config, history, dispatch } = useAppContext();
34053
+ return { appState, config, dispatch, history };
33230
34054
  };
33231
34055
  // Annotate the CommonJS export names for ESM import in node:
33232
34056
  0 && (module.exports = {
@@ -33430,6 +34254,14 @@ lucide-react/dist/esm/icons/lock.js:
33430
34254
  * See the LICENSE file in the root directory of this source tree.
33431
34255
  *)
33432
34256
 
34257
+ lucide-react/dist/esm/icons/monitor.js:
34258
+ (**
34259
+ * @license lucide-react v0.298.0 - ISC
34260
+ *
34261
+ * This source code is licensed under the ISC license.
34262
+ * See the LICENSE file in the root directory of this source tree.
34263
+ *)
34264
+
33433
34265
  lucide-react/dist/esm/icons/more-vertical.js:
33434
34266
  (**
33435
34267
  * @license lucide-react v0.298.0 - ISC
@@ -33478,6 +34310,22 @@ lucide-react/dist/esm/icons/sliders-horizontal.js:
33478
34310
  * See the LICENSE file in the root directory of this source tree.
33479
34311
  *)
33480
34312
 
34313
+ lucide-react/dist/esm/icons/smartphone.js:
34314
+ (**
34315
+ * @license lucide-react v0.298.0 - ISC
34316
+ *
34317
+ * This source code is licensed under the ISC license.
34318
+ * See the LICENSE file in the root directory of this source tree.
34319
+ *)
34320
+
34321
+ lucide-react/dist/esm/icons/tablet.js:
34322
+ (**
34323
+ * @license lucide-react v0.298.0 - ISC
34324
+ *
34325
+ * This source code is licensed under the ISC license.
34326
+ * See the LICENSE file in the root directory of this source tree.
34327
+ *)
34328
+
33481
34329
  lucide-react/dist/esm/icons/trash.js:
33482
34330
  (**
33483
34331
  * @license lucide-react v0.298.0 - ISC
@@ -33502,6 +34350,22 @@ lucide-react/dist/esm/icons/unlock.js:
33502
34350
  * See the LICENSE file in the root directory of this source tree.
33503
34351
  *)
33504
34352
 
34353
+ lucide-react/dist/esm/icons/zoom-in.js:
34354
+ (**
34355
+ * @license lucide-react v0.298.0 - ISC
34356
+ *
34357
+ * This source code is licensed under the ISC license.
34358
+ * See the LICENSE file in the root directory of this source tree.
34359
+ *)
34360
+
34361
+ lucide-react/dist/esm/icons/zoom-out.js:
34362
+ (**
34363
+ * @license lucide-react v0.298.0 - ISC
34364
+ *
34365
+ * This source code is licensed under the ISC license.
34366
+ * See the LICENSE file in the root directory of this source tree.
34367
+ *)
34368
+
33505
34369
  lucide-react/dist/esm/lucide-react.js:
33506
34370
  (**
33507
34371
  * @license lucide-react v0.298.0 - ISC