@measured/puck 0.17.0-canary.9de5e5e → 0.17.0-canary.bda6153

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -9,6 +9,9 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
9
  var __getProtoOf = Object.getPrototypeOf;
10
10
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
11
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __typeError = (msg) => {
13
+ throw TypeError(msg);
14
+ };
12
15
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
16
  var __spreadValues = (a2, b2) => {
14
17
  for (var prop in b2 || (b2 = {}))
@@ -61,6 +64,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
61
64
  mod
62
65
  ));
63
66
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
67
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
68
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
69
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
70
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
64
71
  var __async = (__this, __arguments, generator) => {
65
72
  return new Promise((resolve, reject) => {
66
73
  var fulfilled = (value) => {
@@ -2411,7 +2418,7 @@ init_react_import();
2411
2418
 
2412
2419
  // css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
2413
2420
  init_react_import();
2414
- var styles_module_default10 = { "Drawer": "_Drawer_1pb1t_1", "DrawerItem-draggable": "_DrawerItem-draggable_1pb1t_8", "DrawerItem--disabled": "_DrawerItem--disabled_1pb1t_20", "DrawerItem": "_DrawerItem_1pb1t_8", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_1pb1t_30", "DrawerItem-name": "_DrawerItem-name_1pb1t_48" };
2421
+ var styles_module_default10 = { "Drawer": "_Drawer_1ob9x_1", "DrawerItem-draggable": "_DrawerItem-draggable_1ob9x_8", "DrawerItem--disabled": "_DrawerItem--disabled_1ob9x_21", "DrawerItem": "_DrawerItem_1ob9x_8", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_1ob9x_31", "DrawerItem-name": "_DrawerItem-name_1ob9x_49" };
2415
2422
 
2416
2423
  // components/Drawer/index.tsx
2417
2424
  var import_react21 = require("react");
@@ -2432,7 +2439,7 @@ var import_react16 = require("react");
2432
2439
 
2433
2440
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
2434
2441
  init_react_import();
2435
- var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_33bhx_1", "DraggableComponent-overlay": "_DraggableComponent-overlay_33bhx_13", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_33bhx_30", "DraggableComponent--hover": "_DraggableComponent--hover_33bhx_46", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_33bhx_46", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_33bhx_55", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_33bhx_67", "DraggableComponent-actions": "_DraggableComponent-actions_33bhx_67" };
2442
+ var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_1uqah_1", "DraggableComponent-overlay": "_DraggableComponent-overlay_1uqah_12", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_1uqah_29", "DraggableComponent--hover": "_DraggableComponent--hover_1uqah_45", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_1uqah_45", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_1uqah_54", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_1uqah_66", "DraggableComponent-actions": "_DraggableComponent-actions_1uqah_66" };
2436
2443
 
2437
2444
  // lib/use-modifier-held.ts
2438
2445
  init_react_import();
@@ -2874,9 +2881,10 @@ var __create2 = Object.create;
2874
2881
  var __defProp2 = Object.defineProperty;
2875
2882
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
2876
2883
  var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
2877
- var __typeError = (msg) => {
2884
+ var __typeError2 = (msg) => {
2878
2885
  throw TypeError(msg);
2879
2886
  };
2887
+ var __pow = Math.pow;
2880
2888
  var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2881
2889
  var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
2882
2890
  var __decoratorStart = (base) => {
@@ -2884,8 +2892,8 @@ var __decoratorStart = (base) => {
2884
2892
  return [, , , __create2((_a = base == null ? void 0 : base[__knownSymbol("metadata")]) != null ? _a : null)];
2885
2893
  };
2886
2894
  var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
2887
- var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
2888
- var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
2895
+ var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError2("Function expected") : fn;
2896
+ var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError2("Already initialized") : fns.push(__expectFn(fn || null)) });
2889
2897
  var __decoratorMetadata = (array, target) => __defNormalProp2(target, __knownSymbol("metadata"), array[3]);
2890
2898
  var __runInitializers = (array, flags, self, value) => {
2891
2899
  for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
@@ -2896,31 +2904,31 @@ var __decorateElement = (array, flags, name, decorators, target, extra) => {
2896
2904
  var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
2897
2905
  var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
2898
2906
  var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc2(k < 4 ? target : { get [name]() {
2899
- return __privateGet(this, extra);
2907
+ return __privateGet2(this, extra);
2900
2908
  }, set [name](x) {
2901
- return __privateSet(this, extra, x);
2909
+ return __privateSet2(this, extra, x);
2902
2910
  } }, name));
2903
2911
  k ? p2 && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
2904
2912
  for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
2905
2913
  ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
2906
2914
  if (k) {
2907
2915
  ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn(target, x) : (x) => name in x };
2908
- if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
2909
- if (k > 2) access.set = p2 ? (x, y2) => __privateSet(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
2916
+ if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet2 : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
2917
+ if (k > 2) access.set = p2 ? (x, y2) => __privateSet2(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
2910
2918
  }
2911
2919
  it = (0, decorators[i2])(k ? k < 4 ? p2 ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
2912
2920
  if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
2913
- else if (typeof it !== "object" || it === null) __typeError("Object expected");
2921
+ else if (typeof it !== "object" || it === null) __typeError2("Object expected");
2914
2922
  else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
2915
2923
  }
2916
2924
  return k || __decoratorMetadata(array, target), desc && __defProp2(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
2917
2925
  };
2918
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
2919
- var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
2920
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
2921
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2922
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
2923
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
2926
+ var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
2927
+ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError2('Cannot use the "in" operator on this value') : member.has(obj);
2928
+ var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
2929
+ var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2930
+ var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
2931
+ var __privateMethod = (obj, member, method) => (__accessCheck2(obj, member, "access private method"), method);
2924
2932
  var Point = class _Point {
2925
2933
  /**
2926
2934
  * @param {number} Coordinate of the point on the horizontal axis
@@ -2978,14 +2986,14 @@ _velocity_dec = [reactive], _initial_dec = [reactive], _previous_dec = [reactive
2978
2986
  var Position = class {
2979
2987
  constructor(initialValue) {
2980
2988
  __runInitializers(_init, 5, this);
2981
- __privateAdd(this, _timestamp, 0);
2982
- __privateAdd(this, _velocity, __runInitializers(_init, 8, this, {
2989
+ __privateAdd2(this, _timestamp, 0);
2990
+ __privateAdd2(this, _velocity, __runInitializers(_init, 8, this, {
2983
2991
  x: 0,
2984
2992
  y: 0
2985
2993
  })), __runInitializers(_init, 11, this);
2986
- __privateAdd(this, _initial, __runInitializers(_init, 12, this)), __runInitializers(_init, 15, this);
2987
- __privateAdd(this, _previous, __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
2988
- __privateAdd(this, _current, __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
2994
+ __privateAdd2(this, _initial, __runInitializers(_init, 12, this)), __runInitializers(_init, 15, this);
2995
+ __privateAdd2(this, _previous, __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
2996
+ __privateAdd2(this, _current, __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
2989
2997
  const point = Point.from(initialValue);
2990
2998
  this.initial = point;
2991
2999
  this.current = point;
@@ -3010,7 +3018,7 @@ var Position = class {
3010
3018
  reset(coordinates) {
3011
3019
  const point = Point.from(coordinates);
3012
3020
  o(() => {
3013
- __privateSet(this, _timestamp, 0);
3021
+ __privateSet2(this, _timestamp, 0);
3014
3022
  this.velocity = { x: 0, y: 0 };
3015
3023
  this.current = point;
3016
3024
  this.previous = point;
@@ -3028,12 +3036,12 @@ var Position = class {
3028
3036
  y: point.y - current.y
3029
3037
  };
3030
3038
  const timestamp = Date.now();
3031
- const timeDelta = timestamp - __privateGet(this, _timestamp);
3039
+ const timeDelta = timestamp - __privateGet2(this, _timestamp);
3032
3040
  const velocity = (delta2) => Math.round(delta2 / timeDelta * 100);
3033
3041
  if (Math.abs(delta.x) < SENSITIVITY || Math.abs(delta.y) < SENSITIVITY) {
3034
3042
  this.previous = current;
3035
3043
  }
3036
- __privateSet(this, _timestamp, timestamp);
3044
+ __privateSet2(this, _timestamp, timestamp);
3037
3045
  this.velocity = {
3038
3046
  x: velocity(delta.x),
3039
3047
  y: velocity(delta.y)
@@ -3054,6 +3062,23 @@ __decorateElement(_init, 4, "current", _current_dec, Position, _current);
3054
3062
  __decorateElement(_init, 2, "delta", _delta_dec, Position);
3055
3063
  __decorateElement(_init, 2, "direction", _direction_dec, Position);
3056
3064
  __decoratorMetadata(_init, Position);
3065
+ function exceedsDistance({ x, y: y2 }, distance) {
3066
+ const dx = Math.abs(x);
3067
+ const dy = Math.abs(y2);
3068
+ if (typeof distance === "number") {
3069
+ return Math.sqrt(__pow(dx, 2) + __pow(dy, 2)) > distance;
3070
+ }
3071
+ if ("x" in distance && "y" in distance) {
3072
+ return dx > distance.x && dy > distance.y;
3073
+ }
3074
+ if ("x" in distance) {
3075
+ return dx > distance.x;
3076
+ }
3077
+ if ("y" in distance) {
3078
+ return dy > distance.y;
3079
+ }
3080
+ return false;
3081
+ }
3057
3082
  var Axis = /* @__PURE__ */ ((Axis2) => {
3058
3083
  Axis2["Horizontal"] = "x";
3059
3084
  Axis2["Vertical"] = "y";
@@ -3069,7 +3094,7 @@ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
3069
3094
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
3070
3095
  var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
3071
3096
  var __knownSymbol2 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
3072
- var __typeError2 = (msg) => {
3097
+ var __typeError3 = (msg) => {
3073
3098
  throw TypeError(msg);
3074
3099
  };
3075
3100
  var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -3091,8 +3116,8 @@ var __decoratorStart2 = (base) => {
3091
3116
  return [, , , __create3((_a = base == null ? void 0 : base[__knownSymbol2("metadata")]) != null ? _a : null)];
3092
3117
  };
3093
3118
  var __decoratorStrings2 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
3094
- var __expectFn2 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError2("Function expected") : fn;
3095
- var __decoratorContext2 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings2[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError2("Already initialized") : fns.push(__expectFn2(fn || null)) });
3119
+ var __expectFn2 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError3("Function expected") : fn;
3120
+ var __decoratorContext2 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings2[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError3("Already initialized") : fns.push(__expectFn2(fn || null)) });
3096
3121
  var __decoratorMetadata2 = (array, target) => __defNormalProp3(target, __knownSymbol2("metadata"), array[3]);
3097
3122
  var __runInitializers2 = (array, flags, self, value) => {
3098
3123
  for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
@@ -3103,37 +3128,42 @@ var __decorateElement2 = (array, flags, name, decorators, target, extra) => {
3103
3128
  var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings2[k + 5];
3104
3129
  var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
3105
3130
  var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc3(k < 4 ? target : { get [name]() {
3106
- return __privateGet2(this, extra);
3131
+ return __privateGet3(this, extra);
3107
3132
  }, set [name](x) {
3108
- return __privateSet2(this, extra, x);
3133
+ return __privateSet3(this, extra, x);
3109
3134
  } }, name));
3110
3135
  k ? p2 && k < 4 && __name2(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name2(target, name);
3111
3136
  for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
3112
3137
  ctx = __decoratorContext2(k, name, done = {}, array[3], extraInitializers);
3113
3138
  if (k) {
3114
3139
  ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn2(target, x) : (x) => name in x };
3115
- if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet2 : __privateMethod2)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
3116
- if (k > 2) access.set = p2 ? (x, y2) => __privateSet2(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
3140
+ if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet3 : __privateMethod2)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
3141
+ if (k > 2) access.set = p2 ? (x, y2) => __privateSet3(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
3117
3142
  }
3118
3143
  it = (0, decorators[i2])(k ? k < 4 ? p2 ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
3119
3144
  if (k ^ 4 || it === void 0) __expectFn2(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
3120
- else if (typeof it !== "object" || it === null) __typeError2("Object expected");
3145
+ else if (typeof it !== "object" || it === null) __typeError3("Object expected");
3121
3146
  else __expectFn2(fn = it.get) && (desc.get = fn), __expectFn2(fn = it.set) && (desc.set = fn), __expectFn2(fn = it.init) && initializers.unshift(fn);
3122
3147
  }
3123
3148
  return k || __decoratorMetadata2(array, target), desc && __defProp3(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
3124
3149
  };
3125
- var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
3126
- var __privateIn2 = (member, obj) => Object(obj) !== obj ? __typeError2('Cannot use the "in" operator on this value') : member.has(obj);
3127
- var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
3128
- var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3129
- var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
3130
- var __privateMethod2 = (obj, member, method) => (__accessCheck2(obj, member, "access private method"), method);
3150
+ var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
3151
+ var __privateIn2 = (member, obj) => Object(obj) !== obj ? __typeError3('Cannot use the "in" operator on this value') : member.has(obj);
3152
+ var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
3153
+ var __privateAdd3 = (obj, member, value) => member.has(obj) ? __typeError3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3154
+ var __privateSet3 = (obj, member, value, setter) => (__accessCheck3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
3155
+ var __privateMethod2 = (obj, member, method) => (__accessCheck3(obj, member, "access private method"), method);
3131
3156
  function configure(plugin, options) {
3132
3157
  return {
3133
3158
  plugin,
3134
3159
  options
3135
3160
  };
3136
3161
  }
3162
+ function configurator(plugin) {
3163
+ return (options) => {
3164
+ return configure(plugin, options);
3165
+ };
3166
+ }
3137
3167
  var _disabled_dec;
3138
3168
  var _init2;
3139
3169
  var _disabled;
@@ -3142,7 +3172,7 @@ var Plugin = class {
3142
3172
  constructor(manager, options) {
3143
3173
  this.manager = manager;
3144
3174
  this.options = options;
3145
- __privateAdd2(this, _disabled, __runInitializers2(_init2, 8, this, false)), __runInitializers2(_init2, 11, this);
3175
+ __privateAdd3(this, _disabled, __runInitializers2(_init2, 8, this, false)), __runInitializers2(_init2, 11, this);
3146
3176
  }
3147
3177
  /**
3148
3178
  * Enable a disabled plugin instance.
@@ -3229,10 +3259,10 @@ var Entity = class {
3229
3259
  * @param manager - The manager that controls the drag and drop operations.
3230
3260
  */
3231
3261
  constructor(input, manager) {
3232
- __privateAdd2(this, _manager, __runInitializers2(_init22, 8, this)), __runInitializers2(_init22, 11, this);
3233
- __privateAdd2(this, _id, __runInitializers2(_init22, 12, this)), __runInitializers2(_init22, 15, this);
3234
- __privateAdd2(this, _data, __runInitializers2(_init22, 16, this)), __runInitializers2(_init22, 19, this);
3235
- __privateAdd2(this, _disabled2, __runInitializers2(_init22, 20, this)), __runInitializers2(_init22, 23, this);
3262
+ __privateAdd3(this, _manager, __runInitializers2(_init22, 8, this)), __runInitializers2(_init22, 11, this);
3263
+ __privateAdd3(this, _id, __runInitializers2(_init22, 12, this)), __runInitializers2(_init22, 15, this);
3264
+ __privateAdd3(this, _data, __runInitializers2(_init22, 16, this)), __runInitializers2(_init22, 19, this);
3265
+ __privateAdd3(this, _disabled2, __runInitializers2(_init22, 20, this)), __runInitializers2(_init22, 23, this);
3236
3266
  this.effects = void 0;
3237
3267
  const { effects: effects5, id, data = {}, disabled = false } = input;
3238
3268
  let previousId = id;
@@ -3312,9 +3342,9 @@ var Draggable2 = class extends (_c = Entity, _modifiers_dec = [reactive], _type_
3312
3342
  super(input, manager);
3313
3343
  __runInitializers2(_init3, 5, this);
3314
3344
  this.sensors = void 0;
3315
- __privateAdd2(this, _modifiers, __runInitializers2(_init3, 8, this)), __runInitializers2(_init3, 11, this);
3316
- __privateAdd2(this, _type, __runInitializers2(_init3, 12, this)), __runInitializers2(_init3, 15, this);
3317
- __privateAdd2(this, _status, __runInitializers2(_init3, 16, this, "idle")), __runInitializers2(_init3, 19, this);
3345
+ __privateAdd3(this, _modifiers, __runInitializers2(_init3, 8, this)), __runInitializers2(_init3, 11, this);
3346
+ __privateAdd3(this, _type, __runInitializers2(_init3, 12, this)), __runInitializers2(_init3, 15, this);
3347
+ __privateAdd3(this, _status, __runInitializers2(_init3, 16, this, "idle")), __runInitializers2(_init3, 19, this);
3318
3348
  this.type = type;
3319
3349
  this.sensors = sensors;
3320
3350
  this.modifiers = modifiers;
@@ -3351,11 +3381,11 @@ var Droppable2 = class extends (_c2 = Entity, _accept_dec = [reactive], _type_de
3351
3381
  var _b = _a, { accept, collisionDetector, collisionPriority, type } = _b, input = __objRest2(_b, ["accept", "collisionDetector", "collisionPriority", "type"]);
3352
3382
  super(input, manager);
3353
3383
  __runInitializers2(_init4, 5, this);
3354
- __privateAdd2(this, _accept, __runInitializers2(_init4, 8, this)), __runInitializers2(_init4, 11, this);
3355
- __privateAdd2(this, _type2, __runInitializers2(_init4, 12, this)), __runInitializers2(_init4, 15, this);
3356
- __privateAdd2(this, _collisionDetector, __runInitializers2(_init4, 16, this)), __runInitializers2(_init4, 19, this);
3357
- __privateAdd2(this, _collisionPriority, __runInitializers2(_init4, 20, this)), __runInitializers2(_init4, 23, this);
3358
- __privateAdd2(this, _shape, __runInitializers2(_init4, 24, this)), __runInitializers2(_init4, 27, this);
3384
+ __privateAdd3(this, _accept, __runInitializers2(_init4, 8, this)), __runInitializers2(_init4, 11, this);
3385
+ __privateAdd3(this, _type2, __runInitializers2(_init4, 12, this)), __runInitializers2(_init4, 15, this);
3386
+ __privateAdd3(this, _collisionDetector, __runInitializers2(_init4, 16, this)), __runInitializers2(_init4, 19, this);
3387
+ __privateAdd3(this, _collisionPriority, __runInitializers2(_init4, 20, this)), __runInitializers2(_init4, 23, this);
3388
+ __privateAdd3(this, _shape, __runInitializers2(_init4, 24, this)), __runInitializers2(_init4, 27, this);
3359
3389
  this.accept = accept;
3360
3390
  this.collisionDetector = collisionDetector;
3361
3391
  this.collisionPriority = collisionPriority;
@@ -3401,6 +3431,13 @@ __decorateElement2(_init4, 4, "collisionPriority", _collisionPriority_dec, Dropp
3401
3431
  __decorateElement2(_init4, 4, "shape", _shape_dec, Droppable2, _shape);
3402
3432
  __decorateElement2(_init4, 2, "isDropTarget", _isDropTarget_dec, Droppable2);
3403
3433
  __decoratorMetadata2(_init4, Droppable2);
3434
+ var Sensor = class extends Plugin {
3435
+ constructor(manager, options) {
3436
+ super(manager, options);
3437
+ this.manager = manager;
3438
+ this.options = options;
3439
+ }
3440
+ };
3404
3441
 
3405
3442
  // components/DraggableComponent/collision/directional/index.ts
3406
3443
  init_react_import();
@@ -3737,6 +3774,25 @@ function useSortableSafe(input) {
3737
3774
  return (0, import_sortable.useSortable)(input);
3738
3775
  }
3739
3776
 
3777
+ // lib/get-deep-scroll-position.ts
3778
+ init_react_import();
3779
+ function getDeepScrollPosition(element) {
3780
+ let totalScroll = {
3781
+ x: 0,
3782
+ y: 0
3783
+ };
3784
+ let current = element;
3785
+ while (current && current !== document.documentElement) {
3786
+ const parent = current.parentElement;
3787
+ if (parent) {
3788
+ totalScroll.x += parent.scrollLeft;
3789
+ totalScroll.y += parent.scrollTop;
3790
+ }
3791
+ current = parent;
3792
+ }
3793
+ return totalScroll;
3794
+ }
3795
+
3740
3796
  // components/DraggableComponent/index.tsx
3741
3797
  var import_jsx_runtime21 = require("react/jsx-runtime");
3742
3798
  var getClassName16 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
@@ -3744,7 +3800,7 @@ var DEBUG2 = false;
3744
3800
  var space = 8;
3745
3801
  var actionsOverlayTop = space * 6.5;
3746
3802
  var actionsTop = -(actionsOverlayTop - 8);
3747
- var actionsRight = space;
3803
+ var actionsSide = space;
3748
3804
  var DefaultActionBar = ({
3749
3805
  label,
3750
3806
  children
@@ -3776,7 +3832,6 @@ var DraggableComponent = ({
3776
3832
  } = useAppContext();
3777
3833
  const isModifierHeld = useModifierHeld("Alt");
3778
3834
  const ctx = (0, import_react16.useContext)(dropZoneContext);
3779
- const overlayRef = (0, import_react16.useRef)(null);
3780
3835
  const [localZones, setLocalZones] = (0, import_react16.useState)({});
3781
3836
  const registerLocalZone = (0, import_react16.useCallback)(
3782
3837
  (zoneCompound2, active) => {
@@ -3846,24 +3901,31 @@ var DraggableComponent = ({
3846
3901
  (_b = iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : document.getElementById("puck-preview")) != null ? _b : document.body
3847
3902
  );
3848
3903
  }, [iframe.enabled]);
3849
- const sync = (0, import_react16.useCallback)(() => {
3904
+ const portalContainerRect = (0, import_react16.useMemo)(() => {
3905
+ const portalContainerEl = iframe.enabled ? null : document.getElementById("puck-preview");
3906
+ return portalContainerEl == null ? void 0 : portalContainerEl.getBoundingClientRect();
3907
+ }, [iframe.enabled]);
3908
+ const getStyle = (0, import_react16.useCallback)(() => {
3850
3909
  var _a, _b;
3851
- if (!ref.current || !overlayRef.current) return;
3910
+ if (!ref.current) return;
3852
3911
  const rect = ref.current.getBoundingClientRect();
3853
- const doc = ref.current.ownerDocument;
3854
- const view = doc.defaultView;
3855
- const portalContainerEl = iframe.enabled ? null : document.getElementById("puck-preview");
3856
- const portalContainerRect = portalContainerEl == null ? void 0 : portalContainerEl.getBoundingClientRect();
3912
+ const deepScrollPosition = getDeepScrollPosition(ref.current);
3857
3913
  const scroll = {
3858
- x: ((view == null ? void 0 : view.scrollX) || 0) - ((_a = portalContainerRect == null ? void 0 : portalContainerRect.left) != null ? _a : 0),
3859
- y: ((view == null ? void 0 : view.scrollY) || 0) - ((_b = portalContainerRect == null ? void 0 : portalContainerRect.top) != null ? _b : 0)
3914
+ x: deepScrollPosition.x - ((_a = portalContainerRect == null ? void 0 : portalContainerRect.left) != null ? _a : 0),
3915
+ y: deepScrollPosition.y - ((_b = portalContainerRect == null ? void 0 : portalContainerRect.top) != null ? _b : 0)
3916
+ };
3917
+ const style2 = {
3918
+ left: `${rect.left + scroll.x}px`,
3919
+ top: `${rect.top + scroll.y}px`,
3920
+ height: `${rect.height}px`,
3921
+ width: `${rect.width}px`
3860
3922
  };
3861
- overlayRef.current.style.left = `${rect.left + scroll.x}px`;
3862
- overlayRef.current.style.top = `${rect.top + scroll.y}px`;
3863
- overlayRef.current.style.height = `${rect.height}px`;
3864
- overlayRef.current.style.width = `${rect.width}px`;
3865
- overlayRef.current.style.opacity = "1";
3866
- }, [ref, overlayRef, iframe]);
3923
+ return style2;
3924
+ }, [ref, portalContainerRect]);
3925
+ const [style, setStyle] = (0, import_react16.useState)();
3926
+ const sync = (0, import_react16.useCallback)(() => {
3927
+ setStyle(getStyle());
3928
+ }, [ref, iframe]);
3867
3929
  (0, import_react16.useEffect)(() => {
3868
3930
  ctx == null ? void 0 : ctx.registerPath({
3869
3931
  index,
@@ -3945,6 +4007,7 @@ var DraggableComponent = ({
3945
4007
  el.removeAttribute("data-puck-dragging");
3946
4008
  }
3947
4009
  return () => {
4010
+ el.removeAttribute("data-puck-component");
3948
4011
  el.removeEventListener("click", onClick);
3949
4012
  el.removeEventListener("mouseover", _onMouseOver);
3950
4013
  el.removeEventListener("mouseout", _onMouseOut);
@@ -3952,7 +4015,6 @@ var DraggableComponent = ({
3952
4015
  };
3953
4016
  }, [
3954
4017
  ref,
3955
- overlayRef,
3956
4018
  onClick,
3957
4019
  containsActiveZone,
3958
4020
  zoneCompound,
@@ -3970,20 +4032,35 @@ var DraggableComponent = ({
3970
4032
  };
3971
4033
  }
3972
4034
  }, [disabled, ref]);
3973
- const isVisible = isSelected || hover || indicativeHover;
3974
- const [actionsWidth, setActionsWidth] = (0, import_react16.useState)(250);
3975
- const actionsRef = (0, import_react16.useRef)(null);
3976
- const updateActionsWidth = (0, import_react16.useCallback)(() => {
3977
- if (actionsRef.current) {
3978
- const rect = actionsRef.current.getBoundingClientRect();
3979
- setActionsWidth(rect.width);
4035
+ const [isVisible, setIsVisible] = (0, import_react16.useState)(false);
4036
+ (0, import_react16.useEffect)(() => {
4037
+ sync();
4038
+ if ((isSelected || hover || indicativeHover) && !userIsDragging) {
4039
+ setIsVisible(true);
4040
+ } else {
4041
+ setIsVisible(false);
3980
4042
  }
3981
- }, []);
3982
- (0, import_react16.useEffect)(updateActionsWidth, [
3983
- actionsRef.current,
3984
- zoomConfig.zoom,
3985
- isSelected
3986
- ]);
4043
+ }, [isSelected, hover, indicativeHover, iframe, state.data, userIsDragging]);
4044
+ const syncActionsPosition = (0, import_react16.useCallback)(
4045
+ (el) => {
4046
+ if (el) {
4047
+ const view = el.ownerDocument.defaultView;
4048
+ if (view) {
4049
+ const rect = el.getBoundingClientRect();
4050
+ const diffLeft = rect.x;
4051
+ const exceedsBoundsLeft = diffLeft < 0;
4052
+ if (exceedsBoundsLeft) {
4053
+ el.style.transformOrigin = "left top";
4054
+ el.style.left = "0px";
4055
+ } else {
4056
+ el.style.transformOrigin = "right top";
4057
+ el.style.left = "";
4058
+ }
4059
+ }
4060
+ }
4061
+ },
4062
+ [zoomConfig]
4063
+ );
3987
4064
  (0, import_react16.useEffect)(() => {
3988
4065
  if (userDragAxis) {
3989
4066
  setDragAxis(userDragAxis);
@@ -3998,7 +4075,6 @@ var DraggableComponent = ({
3998
4075
  }
3999
4076
  setDragAxis(autoDragAxis);
4000
4077
  }, [ref, userDragAxis, autoDragAxis]);
4001
- (0, import_react16.useEffect)(sync, [ref, overlayRef, isVisible, hover, iframe, state.data]);
4002
4078
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4003
4079
  DropZoneProvider,
4004
4080
  {
@@ -4021,7 +4097,7 @@ var DraggableComponent = ({
4021
4097
  isModifierHeld,
4022
4098
  hover: hover || indicativeHover
4023
4099
  }),
4024
- ref: overlayRef,
4100
+ style: __spreadValues({}, style),
4025
4101
  children: [
4026
4102
  debug,
4027
4103
  isLoading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName16("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader, {}) }),
@@ -4030,9 +4106,7 @@ var DraggableComponent = ({
4030
4106
  {
4031
4107
  className: getClassName16("actionsOverlay"),
4032
4108
  style: {
4033
- top: actionsOverlayTop / zoomConfig.zoom,
4034
- // Offset against left of frame
4035
- minWidth: actionsWidth + 2 * actionsRight
4109
+ top: actionsOverlayTop / zoomConfig.zoom
4036
4110
  },
4037
4111
  children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4038
4112
  "div",
@@ -4041,9 +4115,11 @@ var DraggableComponent = ({
4041
4115
  style: {
4042
4116
  transform: `scale(${1 / zoomConfig.zoom}`,
4043
4117
  top: actionsTop / zoomConfig.zoom,
4044
- right: actionsRight / zoomConfig.zoom
4118
+ right: 0,
4119
+ paddingLeft: actionsSide,
4120
+ paddingRight: actionsSide
4045
4121
  },
4046
- ref: actionsRef,
4122
+ ref: syncActionsPosition,
4047
4123
  children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(CustomActionBar, { label: DEBUG2 ? id : label, children: [
4048
4124
  permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Copy, { size: 16 }) }),
4049
4125
  permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Trash, { size: 16 }) })
@@ -4066,7 +4142,7 @@ var DraggableComponent = ({
4066
4142
 
4067
4143
  // css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
4068
4144
  init_react_import();
4069
- var styles_module_default12 = { "DropZone": "_DropZone_q2ip3_1", "DropZone--hasChildren": "_DropZone--hasChildren_q2ip3_12", "DropZone--userIsDragging": "_DropZone--userIsDragging_q2ip3_20", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_q2ip3_29", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_q2ip3_30", "DropZone--isRootZone": "_DropZone--isRootZone_q2ip3_30", "DropZone--isDestination": "_DropZone--isDestination_q2ip3_40", "DropZone-item": "_DropZone-item_q2ip3_52", "DropZone-hitbox": "_DropZone-hitbox_q2ip3_56", "DropZone--isEnabled": "_DropZone--isEnabled_q2ip3_64" };
4145
+ var styles_module_default12 = { "DropZone": "_DropZone_74ebh_1", "DropZone--hasChildren": "_DropZone--hasChildren_74ebh_12", "DropZone--userIsDragging": "_DropZone--userIsDragging_74ebh_20", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_74ebh_29", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_74ebh_30", "DropZone--isRootZone": "_DropZone--isRootZone_74ebh_30", "DropZone--isDestination": "_DropZone--isDestination_74ebh_40", "DropZone-item": "_DropZone-item_74ebh_52", "DropZone-hitbox": "_DropZone-hitbox_74ebh_56", "DropZone--isEnabled": "_DropZone--isEnabled_74ebh_64" };
4070
4146
 
4071
4147
  // components/DropZone/context.tsx
4072
4148
  init_react_import();
@@ -4280,7 +4356,7 @@ function DropZoneEdit({
4280
4356
  const [dragAxis, setDragAxis] = (0, import_react18.useState)(
4281
4357
  collisionAxis || DEFAULT_DRAG_AXIS
4282
4358
  );
4283
- (0, import_react18.useEffect)(() => {
4359
+ const calculateDragAxis = (0, import_react18.useCallback)(() => {
4284
4360
  if (ref.current) {
4285
4361
  const computedStyle = window.getComputedStyle(ref.current);
4286
4362
  if (computedStyle.display === "grid") {
@@ -4291,7 +4367,17 @@ function DropZoneEdit({
4291
4367
  setDragAxis(DEFAULT_DRAG_AXIS);
4292
4368
  }
4293
4369
  }
4294
- }, [ref, appContext2.status, collisionAxis]);
4370
+ }, [ref.current]);
4371
+ (0, import_react18.useEffect)(calculateDragAxis, [appContext2.status, collisionAxis]);
4372
+ (0, import_react18.useEffect)(() => {
4373
+ const onViewportChange = () => {
4374
+ calculateDragAxis();
4375
+ };
4376
+ window.addEventListener("viewportchange", onViewportChange);
4377
+ return () => {
4378
+ window.removeEventListener("viewportchange", onViewportChange);
4379
+ };
4380
+ }, []);
4295
4381
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4296
4382
  "div",
4297
4383
  {
@@ -4580,6 +4666,11 @@ var findDeepestCandidate = (position, manager) => {
4580
4666
  if (candidateData2.areaId === draggedCandidateId) {
4581
4667
  return false;
4582
4668
  }
4669
+ } else if (candidate.type === "component") {
4670
+ const candidateData2 = candidate.data;
4671
+ if (!candidateData2.inDroppableZone) {
4672
+ return false;
4673
+ }
4583
4674
  }
4584
4675
  return true;
4585
4676
  });
@@ -4617,9 +4708,14 @@ var createNestedDroppablePlugin = ({
4617
4708
  y: event.clientY
4618
4709
  });
4619
4710
  };
4620
- document.body.addEventListener("pointermove", handlePointerMove);
4711
+ document.body.addEventListener("pointermove", handlePointerMove, {
4712
+ capture: true
4713
+ // dndkit's PointerSensor prevents propagation during drag
4714
+ });
4621
4715
  this.destroy = () => {
4622
- document.body.removeEventListener("pointermove", handlePointerMove);
4716
+ document.body.removeEventListener("pointermove", handlePointerMove, {
4717
+ capture: true
4718
+ });
4623
4719
  cleanupEffect();
4624
4720
  };
4625
4721
  });
@@ -4931,6 +5027,11 @@ var reduceUi = (ui, action) => {
4931
5027
  }
4932
5028
  return __spreadValues(__spreadValues({}, ui), action.ui(ui));
4933
5029
  }
5030
+ if (action.type === "duplicate") {
5031
+ return __spreadProps(__spreadValues({}, ui), {
5032
+ itemSelector: { index: action.sourceIndex + 1, zone: action.sourceZone }
5033
+ });
5034
+ }
4934
5035
  return ui;
4935
5036
  };
4936
5037
 
@@ -5016,6 +5117,267 @@ var insertComponent = (componentType, zone, index, {
5016
5117
 
5017
5118
  // components/DragDropContext/index.tsx
5018
5119
  var import_use_debounce2 = require("use-debounce");
5120
+ var import_utilities2 = require("@dnd-kit/dom/utilities");
5121
+
5122
+ // components/DragDropContext/PointerSensor.ts
5123
+ init_react_import();
5124
+ var import_utilities = require("@dnd-kit/dom/utilities");
5125
+ var _clearTimeout;
5126
+ var _PointerSensor = class _PointerSensor extends Sensor {
5127
+ constructor(manager, options) {
5128
+ super(manager);
5129
+ this.manager = manager;
5130
+ this.options = options;
5131
+ this.listeners = new import_utilities.Listeners();
5132
+ this.cleanup = /* @__PURE__ */ new Set();
5133
+ this.source = void 0;
5134
+ __privateAdd(this, _clearTimeout);
5135
+ this.handleCancel = this.handleCancel.bind(this);
5136
+ this.handlePointerUp = this.handlePointerUp.bind(this);
5137
+ this.handleKeyDown = this.handleKeyDown.bind(this);
5138
+ E(() => {
5139
+ const unbindGlobal = this.bindGlobal(options != null ? options : {});
5140
+ return () => {
5141
+ unbindGlobal();
5142
+ };
5143
+ });
5144
+ }
5145
+ bind(source, options = this.options) {
5146
+ const unbind = E(() => {
5147
+ var _a;
5148
+ const target = (_a = source.handle) != null ? _a : source.element;
5149
+ const listener = (event) => {
5150
+ if ((0, import_utilities.isPointerEvent)(event)) {
5151
+ this.handlePointerDown(event, source, options);
5152
+ }
5153
+ };
5154
+ if (target) {
5155
+ patchWindow(target.ownerDocument.defaultView);
5156
+ target.addEventListener("pointerdown", listener);
5157
+ return () => {
5158
+ target.removeEventListener("pointerdown", listener);
5159
+ };
5160
+ }
5161
+ });
5162
+ return unbind;
5163
+ }
5164
+ bindGlobal(options) {
5165
+ const documents = /* @__PURE__ */ new Set();
5166
+ for (const draggable of this.manager.registry.draggables.value) {
5167
+ if (draggable.element) {
5168
+ documents.add((0, import_utilities.getDocument)(draggable.element));
5169
+ }
5170
+ }
5171
+ for (const droppable of this.manager.registry.droppables.value) {
5172
+ if (droppable.element) {
5173
+ documents.add((0, import_utilities.getDocument)(droppable.element));
5174
+ }
5175
+ }
5176
+ const unbindFns = Array.from(documents).map(
5177
+ (doc) => this.listeners.bind(doc, [
5178
+ {
5179
+ type: "pointermove",
5180
+ listener: (event) => this.handlePointerMove(event, doc, options)
5181
+ },
5182
+ {
5183
+ type: "pointerup",
5184
+ listener: this.handlePointerUp,
5185
+ options: {
5186
+ capture: true
5187
+ }
5188
+ },
5189
+ {
5190
+ // Cancel activation if there is a competing Drag and Drop interaction
5191
+ type: "dragstart",
5192
+ listener: this.handleDragStart
5193
+ }
5194
+ ])
5195
+ );
5196
+ return () => {
5197
+ unbindFns.forEach((unbind) => unbind());
5198
+ };
5199
+ }
5200
+ handlePointerDown(event, source, options = {}) {
5201
+ if (this.disabled || !event.isPrimary || event.button !== 0 || !(0, import_utilities.isElement)(event.target) || source.disabled) {
5202
+ return;
5203
+ }
5204
+ const offset = (0, import_utilities.getFrameTransform)(source.element);
5205
+ this.initialCoordinates = {
5206
+ x: event.clientX * offset.scaleX + offset.x,
5207
+ y: event.clientY * offset.scaleY + offset.y
5208
+ };
5209
+ this.source = source;
5210
+ const { activationConstraints } = options;
5211
+ const constraints = typeof activationConstraints === "function" ? activationConstraints(event, source) : activationConstraints;
5212
+ event.stopImmediatePropagation();
5213
+ if (!(constraints == null ? void 0 : constraints.delay) && !(constraints == null ? void 0 : constraints.distance)) {
5214
+ this.handleStart(source, event);
5215
+ } else {
5216
+ const { delay } = constraints;
5217
+ if (delay) {
5218
+ const timeout3 = setTimeout(
5219
+ () => this.handleStart(source, event),
5220
+ delay.value
5221
+ );
5222
+ __privateSet(this, _clearTimeout, () => {
5223
+ clearTimeout(timeout3);
5224
+ __privateSet(this, _clearTimeout, void 0);
5225
+ });
5226
+ }
5227
+ }
5228
+ const cleanup = () => {
5229
+ var _a;
5230
+ (_a = __privateGet(this, _clearTimeout)) == null ? void 0 : _a.call(this);
5231
+ this.initialCoordinates = void 0;
5232
+ this.source = void 0;
5233
+ };
5234
+ this.cleanup.add(cleanup);
5235
+ }
5236
+ handlePointerMove(event, doc, options) {
5237
+ if (!this.source) {
5238
+ return;
5239
+ }
5240
+ const ownerDocument = this.source.element && (0, import_utilities.getDocument)(this.source.element);
5241
+ if (doc !== ownerDocument) {
5242
+ return;
5243
+ }
5244
+ const coordinates = {
5245
+ x: event.clientX,
5246
+ y: event.clientY
5247
+ };
5248
+ const offset = (0, import_utilities.getFrameTransform)(this.source.element);
5249
+ coordinates.x = coordinates.x * offset.scaleX + offset.x;
5250
+ coordinates.y = coordinates.y * offset.scaleY + offset.y;
5251
+ if (this.manager.dragOperation.status.dragging) {
5252
+ event.preventDefault();
5253
+ event.stopPropagation();
5254
+ this.manager.actions.move({ to: coordinates });
5255
+ return;
5256
+ }
5257
+ if (!this.initialCoordinates) {
5258
+ return;
5259
+ }
5260
+ const delta = {
5261
+ x: coordinates.x - this.initialCoordinates.x,
5262
+ y: coordinates.y - this.initialCoordinates.y
5263
+ };
5264
+ const { activationConstraints } = options;
5265
+ const constraints = typeof activationConstraints === "function" ? activationConstraints(event, this.source) : activationConstraints;
5266
+ const { distance, delay } = constraints != null ? constraints : {};
5267
+ if (distance) {
5268
+ if (distance.tolerance != null && exceedsDistance(delta, distance.tolerance)) {
5269
+ return this.handleCancel();
5270
+ }
5271
+ if (exceedsDistance(delta, distance.value)) {
5272
+ return this.handleStart(this.source, event);
5273
+ }
5274
+ }
5275
+ if (delay) {
5276
+ if (exceedsDistance(delta, delay.tolerance)) {
5277
+ return this.handleCancel();
5278
+ }
5279
+ }
5280
+ }
5281
+ handlePointerUp(event) {
5282
+ event.preventDefault();
5283
+ event.stopPropagation();
5284
+ const { status } = this.manager.dragOperation;
5285
+ if (!status.idle) {
5286
+ const canceled = !status.initialized;
5287
+ this.manager.actions.stop({ canceled });
5288
+ }
5289
+ this.cleanup.forEach((cleanup) => cleanup());
5290
+ this.cleanup.clear();
5291
+ }
5292
+ handleKeyDown(event) {
5293
+ if (event.key === "Escape") {
5294
+ event.preventDefault();
5295
+ this.handleCancel();
5296
+ }
5297
+ }
5298
+ handleStart(source, event) {
5299
+ var _a;
5300
+ const { manager, initialCoordinates } = this;
5301
+ (_a = __privateGet(this, _clearTimeout)) == null ? void 0 : _a.call(this);
5302
+ if (!initialCoordinates || manager.dragOperation.status.initialized) {
5303
+ return;
5304
+ }
5305
+ if (event.defaultPrevented) {
5306
+ return;
5307
+ }
5308
+ event.preventDefault();
5309
+ o(() => {
5310
+ manager.actions.setDragSource(source.id);
5311
+ manager.actions.start({ coordinates: initialCoordinates, event });
5312
+ });
5313
+ const ownerDocument = (0, import_utilities.getDocument)(event.target);
5314
+ const unbind = this.listeners.bind(ownerDocument, [
5315
+ {
5316
+ // Prevent scrolling on touch devices
5317
+ type: "touchmove",
5318
+ listener: preventDefault,
5319
+ options: {
5320
+ passive: false
5321
+ }
5322
+ },
5323
+ {
5324
+ // Prevent click events
5325
+ type: "click",
5326
+ listener: preventDefault
5327
+ },
5328
+ {
5329
+ type: "keydown",
5330
+ listener: this.handleKeyDown
5331
+ }
5332
+ ]);
5333
+ ownerDocument.body.setPointerCapture(event.pointerId);
5334
+ this.cleanup.add(unbind);
5335
+ }
5336
+ handleDragStart(event) {
5337
+ const { target } = event;
5338
+ if (!(0, import_utilities.isElement)(target)) {
5339
+ return;
5340
+ }
5341
+ const isNativeDraggable = (0, import_utilities.isHTMLElement)(target) && target.draggable && target.getAttribute("draggable") === "true";
5342
+ if (isNativeDraggable) {
5343
+ this.handleCancel();
5344
+ } else {
5345
+ preventDefault(event);
5346
+ }
5347
+ }
5348
+ handleCancel() {
5349
+ const { dragOperation } = this.manager;
5350
+ if (dragOperation.status.initialized) {
5351
+ this.manager.actions.stop({ canceled: true });
5352
+ }
5353
+ this.cleanup.forEach((cleanup) => cleanup());
5354
+ this.cleanup.clear();
5355
+ }
5356
+ destroy() {
5357
+ this.listeners.clear();
5358
+ }
5359
+ };
5360
+ _clearTimeout = new WeakMap();
5361
+ _PointerSensor.configure = configurator(_PointerSensor);
5362
+ var PointerSensor = _PointerSensor;
5363
+ function preventDefault(event) {
5364
+ event.preventDefault();
5365
+ }
5366
+ function noop() {
5367
+ }
5368
+ var windows = /* @__PURE__ */ new WeakSet();
5369
+ function patchWindow(window2) {
5370
+ if (!window2 || windows.has(window2)) {
5371
+ return;
5372
+ }
5373
+ window2.addEventListener("touchmove", noop, {
5374
+ capture: false,
5375
+ passive: false
5376
+ });
5377
+ windows.add(window2);
5378
+ }
5379
+
5380
+ // components/DragDropContext/index.tsx
5019
5381
  var import_jsx_runtime24 = require("react/jsx-runtime");
5020
5382
  var dragListenerContext = (0, import_react20.createContext)({
5021
5383
  dragListeners: {}
@@ -5031,10 +5393,11 @@ function useDragListener(type, fn, deps = []) {
5031
5393
  }, deps);
5032
5394
  }
5033
5395
  var previewContext = (0, import_react20.createContext)(null);
5034
- var AREA_CHANGE_DEBOUNCE_MS = 150;
5396
+ var AREA_CHANGE_DEBOUNCE_MS = 100;
5035
5397
  var DragDropContextClient = ({ children }) => {
5036
5398
  const { state, config, dispatch, resolveData } = useAppContext();
5037
5399
  const [preview, setPreview] = (0, import_react20.useState)(null);
5400
+ const previewRef = (0, import_react20.useRef)(null);
5038
5401
  const { data } = state;
5039
5402
  const [deepest, setDeepest] = (0, import_react20.useState)(null);
5040
5403
  const [nextDeepest, setNextDeepest] = (0, import_react20.useState)(null);
@@ -5081,6 +5444,25 @@ var DragDropContextClient = ({ children }) => {
5081
5444
  }
5082
5445
  })
5083
5446
  ]);
5447
+ const [sensors] = (0, import_react20.useState)(() => [
5448
+ PointerSensor.configure({
5449
+ activationConstraints(event, source) {
5450
+ var _a;
5451
+ const { pointerType, target } = event;
5452
+ if (pointerType === "mouse" && (0, import_utilities2.isElement)(target) && (source.handle === target || ((_a = source.handle) == null ? void 0 : _a.contains(target)))) {
5453
+ return void 0;
5454
+ }
5455
+ const delay = { value: 200, tolerance: 10 };
5456
+ if (pointerType === "touch") {
5457
+ return { delay };
5458
+ }
5459
+ return {
5460
+ delay,
5461
+ distance: { value: 5 }
5462
+ };
5463
+ }
5464
+ })
5465
+ ]);
5084
5466
  const [draggedItem, setDraggedItem] = (0, import_react20.useState)();
5085
5467
  const [dragListeners, setDragListeners] = (0, import_react20.useState)({});
5086
5468
  const [pathData, setPathData] = (0, import_react20.useState)();
@@ -5119,32 +5501,34 @@ var DragDropContextClient = ({ children }) => {
5119
5501
  import_react19.DragDropProvider,
5120
5502
  {
5121
5503
  plugins,
5504
+ sensors,
5122
5505
  onDragEnd: (event, manager) => {
5123
5506
  const { source, target } = event.operation;
5507
+ deepestRef.current = null;
5124
5508
  if (!source) {
5125
5509
  setDraggedItem(null);
5126
5510
  return;
5127
5511
  }
5128
5512
  const { zone, index } = source.data;
5513
+ const thisPreview = previewRef.current ? __spreadValues({}, previewRef.current) : null;
5514
+ previewRef.current = null;
5129
5515
  setTimeout(() => {
5130
5516
  var _a, _b;
5131
5517
  setDraggedItem(null);
5132
5518
  if (event.canceled || (target == null ? void 0 : target.type) === "void") {
5133
- if (preview) {
5134
- setPreview(null);
5135
- }
5519
+ setPreview(null);
5136
5520
  (_a = dragListeners.dragend) == null ? void 0 : _a.forEach((fn) => {
5137
5521
  fn(event, manager);
5138
5522
  });
5139
5523
  return;
5140
5524
  }
5141
- if (preview) {
5525
+ if (thisPreview) {
5142
5526
  setPreview(null);
5143
- if (preview.type === "insert") {
5527
+ if (thisPreview.type === "insert") {
5144
5528
  insertComponent(
5145
- preview.componentType,
5146
- preview.zone,
5147
- preview.index,
5529
+ thisPreview.componentType,
5530
+ thisPreview.zone,
5531
+ thisPreview.index,
5148
5532
  { config, dispatch, resolveData, state }
5149
5533
  );
5150
5534
  } else if (initialSelector.current) {
@@ -5152,8 +5536,8 @@ var DragDropContextClient = ({ children }) => {
5152
5536
  type: "move",
5153
5537
  sourceIndex: initialSelector.current.index,
5154
5538
  sourceZone: initialSelector.current.zone,
5155
- destinationIndex: preview.index,
5156
- destinationZone: preview.zone,
5539
+ destinationIndex: thisPreview.index,
5540
+ destinationZone: thisPreview.zone,
5157
5541
  recordHistory: false
5158
5542
  });
5159
5543
  }
@@ -5169,7 +5553,7 @@ var DragDropContextClient = ({ children }) => {
5169
5553
  (_b = dragListeners.dragend) == null ? void 0 : _b.forEach((fn) => {
5170
5554
  fn(event, manager);
5171
5555
  });
5172
- }, 250);
5556
+ }, 300);
5173
5557
  },
5174
5558
  onDragOver: (event, manager) => {
5175
5559
  var _a, _b, _c3, _d;
@@ -5207,7 +5591,7 @@ var DragDropContextClient = ({ children }) => {
5207
5591
  return;
5208
5592
  }
5209
5593
  if (dragMode.current === "new") {
5210
- setPreview({
5594
+ previewRef.current = {
5211
5595
  componentType: sourceData.componentType,
5212
5596
  type: "insert",
5213
5597
  index: targetIndex,
@@ -5215,7 +5599,8 @@ var DragDropContextClient = ({ children }) => {
5215
5599
  props: {
5216
5600
  id: source.id.toString()
5217
5601
  }
5218
- });
5602
+ };
5603
+ setPreview(previewRef.current);
5219
5604
  } else {
5220
5605
  if (!initialSelector.current) {
5221
5606
  initialSelector.current = {
@@ -5225,13 +5610,14 @@ var DragDropContextClient = ({ children }) => {
5225
5610
  }
5226
5611
  const item = getItem(initialSelector.current, data);
5227
5612
  if (item) {
5228
- setPreview({
5613
+ previewRef.current = {
5229
5614
  componentType: sourceData.componentType,
5230
5615
  type: "move",
5231
5616
  index: targetIndex,
5232
5617
  zone: targetZone,
5233
5618
  props: item.props
5234
- });
5619
+ };
5620
+ setPreview(previewRef.current);
5235
5621
  }
5236
5622
  }
5237
5623
  (_d = dragListeners.dragover) == null ? void 0 : _d.forEach((fn) => {
@@ -5398,7 +5784,9 @@ var Drawer = ({
5398
5784
  const [id] = (0, import_react21.useState)(generateId());
5399
5785
  const { ref } = useDroppableSafe({
5400
5786
  id,
5401
- type: "void"
5787
+ type: "void",
5788
+ collisionPriority: 0
5789
+ // Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
5402
5790
  });
5403
5791
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName18(), ref, children });
5404
5792
  };
@@ -6254,11 +6642,12 @@ var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPrev
6254
6642
  var import_jsx_runtime33 = require("react/jsx-runtime");
6255
6643
  var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
6256
6644
  var useBubbleIframeEvents = (ref) => {
6645
+ const { status } = useAppContext();
6257
6646
  (0, import_react28.useEffect)(() => {
6258
6647
  var _a;
6259
- if (ref.current) {
6648
+ if (ref.current && status === "READY") {
6260
6649
  const iframe = ref.current;
6261
- (_a = iframe.contentWindow) == null ? void 0 : _a.addEventListener("mousemove", function(event) {
6650
+ const handlePointerMove = (event) => {
6262
6651
  var _a2;
6263
6652
  const rect = iframe.getBoundingClientRect();
6264
6653
  const evt = new CustomEvent("pointermove", {
@@ -6269,9 +6658,23 @@ var useBubbleIframeEvents = (ref) => {
6269
6658
  evt.clientX = event.clientX * scaleFactor + rect.left;
6270
6659
  evt.clientY = event.clientY * scaleFactor + rect.top;
6271
6660
  iframe.dispatchEvent(evt);
6272
- });
6661
+ };
6662
+ (_a = iframe.contentDocument) == null ? void 0 : _a.addEventListener(
6663
+ "pointermove",
6664
+ handlePointerMove,
6665
+ {
6666
+ capture: true
6667
+ }
6668
+ );
6669
+ return () => {
6670
+ var _a2;
6671
+ (_a2 = iframe.contentDocument) == null ? void 0 : _a2.removeEventListener(
6672
+ "pointermove",
6673
+ handlePointerMove
6674
+ );
6675
+ };
6273
6676
  }
6274
- }, [ref]);
6677
+ }, [status]);
6275
6678
  };
6276
6679
  var Preview = ({ id = "puck-preview" }) => {
6277
6680
  const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
@@ -6992,7 +7395,7 @@ var ViewportControls = ({
6992
7395
 
6993
7396
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
6994
7397
  init_react_import();
6995
- var styles_module_default21 = { "PuckCanvas": "_PuckCanvas_avf1c_1", "PuckCanvas-controls": "_PuckCanvas-controls_avf1c_16", "PuckCanvas-inner": "_PuckCanvas-inner_avf1c_21", "PuckCanvas-root": "_PuckCanvas-root_avf1c_32", "PuckCanvas--ready": "_PuckCanvas--ready_avf1c_57", "PuckCanvas-loader": "_PuckCanvas-loader_avf1c_62", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_avf1c_72" };
7398
+ var styles_module_default21 = { "PuckCanvas": "_PuckCanvas_18jay_1", "PuckCanvas-controls": "_PuckCanvas-controls_18jay_16", "PuckCanvas-inner": "_PuckCanvas-inner_18jay_21", "PuckCanvas-root": "_PuckCanvas-root_18jay_30", "PuckCanvas--ready": "_PuckCanvas--ready_18jay_55", "PuckCanvas-loader": "_PuckCanvas-loader_18jay_60", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_18jay_70" };
6996
7399
 
6997
7400
  // lib/get-zoom-config.ts
6998
7401
  init_react_import();
@@ -7147,6 +7550,14 @@ var Canvas = () => {
7147
7550
  },
7148
7551
  suppressHydrationWarning: true,
7149
7552
  id: "puck-canvas-root",
7553
+ onTransitionEnd: () => {
7554
+ window.dispatchEvent(
7555
+ new CustomEvent("viewportchange", {
7556
+ bubbles: true,
7557
+ cancelable: false
7558
+ })
7559
+ );
7560
+ },
7150
7561
  children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Preview, {}) })
7151
7562
  }
7152
7563
  ),
@@ -7217,6 +7628,7 @@ var import_react35 = require("react");
7217
7628
  var styles = `
7218
7629
  /* Prevent user from interacting with underlying component */
7219
7630
  [data-puck-component] * {
7631
+ pointer-events: none;
7220
7632
  user-select: none;
7221
7633
  -webkit-user-select: none;
7222
7634
  }