@measured/puck 0.17.0-canary.2d82115 → 0.17.0-canary.552c8f9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-7IH6SUIT.mjs → chunk-EXKSBUY5.mjs} +10 -0
- package/dist/index.css +44 -37
- package/dist/index.js +402 -92
- package/dist/index.mjs +393 -80
- package/dist/rsc.mjs +1 -1
- package/package.json +1 -1
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) => {
|
@@ -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": "
|
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
|
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" ?
|
2888
|
-
var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ?
|
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
|
2907
|
+
return __privateGet2(this, extra);
|
2900
2908
|
}, set [name](x) {
|
2901
|
-
return
|
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 ?
|
2909
|
-
if (k > 2) access.set = p2 ? (x, 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)
|
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
|
2919
|
-
var __privateIn = (member, obj) => Object(obj) !== obj ?
|
2920
|
-
var
|
2921
|
-
var
|
2922
|
-
var
|
2923
|
-
var __privateMethod = (obj, member, 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
|
-
|
2982
|
-
|
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
|
-
|
2987
|
-
|
2988
|
-
|
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
|
-
|
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 -
|
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
|
-
|
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
|
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" ?
|
3095
|
-
var __decoratorContext2 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings2[kind], name, metadata, addInitializer: (fn) => done._ ?
|
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
|
3131
|
+
return __privateGet3(this, extra);
|
3107
3132
|
}, set [name](x) {
|
3108
|
-
return
|
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 ?
|
3116
|
-
if (k > 2) access.set = p2 ? (x, 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)
|
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
|
3126
|
-
var __privateIn2 = (member, obj) => Object(obj) !== obj ?
|
3127
|
-
var
|
3128
|
-
var
|
3129
|
-
var
|
3130
|
-
var __privateMethod2 = (obj, member, 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
|
-
|
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
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
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
|
-
|
3316
|
-
|
3317
|
-
|
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
|
-
|
3355
|
-
|
3356
|
-
|
3357
|
-
|
3358
|
-
|
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();
|
@@ -3744,7 +3781,7 @@ var DEBUG2 = false;
|
|
3744
3781
|
var space = 8;
|
3745
3782
|
var actionsOverlayTop = space * 6.5;
|
3746
3783
|
var actionsTop = -(actionsOverlayTop - 8);
|
3747
|
-
var
|
3784
|
+
var actionsSide = space;
|
3748
3785
|
var DefaultActionBar = ({
|
3749
3786
|
label,
|
3750
3787
|
children
|
@@ -3776,7 +3813,6 @@ var DraggableComponent = ({
|
|
3776
3813
|
} = useAppContext();
|
3777
3814
|
const isModifierHeld = useModifierHeld("Alt");
|
3778
3815
|
const ctx = (0, import_react16.useContext)(dropZoneContext);
|
3779
|
-
const overlayRef = (0, import_react16.useRef)(null);
|
3780
3816
|
const [localZones, setLocalZones] = (0, import_react16.useState)({});
|
3781
3817
|
const registerLocalZone = (0, import_react16.useCallback)(
|
3782
3818
|
(zoneCompound2, active) => {
|
@@ -3865,11 +3901,11 @@ var DraggableComponent = ({
|
|
3865
3901
|
width: `${rect.width}px`
|
3866
3902
|
};
|
3867
3903
|
return style2;
|
3868
|
-
}, [ref,
|
3904
|
+
}, [ref, iframe]);
|
3869
3905
|
const [style, setStyle] = (0, import_react16.useState)();
|
3870
3906
|
const sync = (0, import_react16.useCallback)(() => {
|
3871
3907
|
setStyle(getStyle());
|
3872
|
-
}, [ref,
|
3908
|
+
}, [ref, iframe]);
|
3873
3909
|
(0, import_react16.useEffect)(() => {
|
3874
3910
|
ctx == null ? void 0 : ctx.registerPath({
|
3875
3911
|
index,
|
@@ -3951,6 +3987,7 @@ var DraggableComponent = ({
|
|
3951
3987
|
el.removeAttribute("data-puck-dragging");
|
3952
3988
|
}
|
3953
3989
|
return () => {
|
3990
|
+
el.removeAttribute("data-puck-component");
|
3954
3991
|
el.removeEventListener("click", onClick);
|
3955
3992
|
el.removeEventListener("mouseover", _onMouseOver);
|
3956
3993
|
el.removeEventListener("mouseout", _onMouseOut);
|
@@ -3958,7 +3995,6 @@ var DraggableComponent = ({
|
|
3958
3995
|
};
|
3959
3996
|
}, [
|
3960
3997
|
ref,
|
3961
|
-
overlayRef,
|
3962
3998
|
onClick,
|
3963
3999
|
containsActiveZone,
|
3964
4000
|
zoneCompound,
|
@@ -3985,19 +4021,26 @@ var DraggableComponent = ({
|
|
3985
4021
|
setIsVisible(false);
|
3986
4022
|
}
|
3987
4023
|
}, [isSelected, hover, indicativeHover, iframe, state.data, userIsDragging]);
|
3988
|
-
const
|
3989
|
-
|
3990
|
-
|
3991
|
-
|
3992
|
-
|
3993
|
-
|
3994
|
-
|
3995
|
-
|
3996
|
-
|
3997
|
-
|
3998
|
-
|
3999
|
-
|
4000
|
-
|
4024
|
+
const syncActionsPosition = (0, import_react16.useCallback)(
|
4025
|
+
(el) => {
|
4026
|
+
if (el) {
|
4027
|
+
const view = el.ownerDocument.defaultView;
|
4028
|
+
if (view) {
|
4029
|
+
const rect = el.getBoundingClientRect();
|
4030
|
+
const diffLeft = rect.x;
|
4031
|
+
const exceedsBoundsLeft = diffLeft < 0;
|
4032
|
+
if (exceedsBoundsLeft) {
|
4033
|
+
el.style.transformOrigin = "left top";
|
4034
|
+
el.style.left = "0px";
|
4035
|
+
} else {
|
4036
|
+
el.style.transformOrigin = "right top";
|
4037
|
+
el.style.left = "";
|
4038
|
+
}
|
4039
|
+
}
|
4040
|
+
}
|
4041
|
+
},
|
4042
|
+
[zoomConfig]
|
4043
|
+
);
|
4001
4044
|
(0, import_react16.useEffect)(() => {
|
4002
4045
|
if (userDragAxis) {
|
4003
4046
|
setDragAxis(userDragAxis);
|
@@ -4034,7 +4077,6 @@ var DraggableComponent = ({
|
|
4034
4077
|
isModifierHeld,
|
4035
4078
|
hover: hover || indicativeHover
|
4036
4079
|
}),
|
4037
|
-
ref: overlayRef,
|
4038
4080
|
style: __spreadValues({}, style),
|
4039
4081
|
children: [
|
4040
4082
|
debug,
|
@@ -4044,9 +4086,7 @@ var DraggableComponent = ({
|
|
4044
4086
|
{
|
4045
4087
|
className: getClassName16("actionsOverlay"),
|
4046
4088
|
style: {
|
4047
|
-
top: actionsOverlayTop / zoomConfig.zoom
|
4048
|
-
// Offset against left of frame
|
4049
|
-
minWidth: actionsWidth + 2 * actionsRight
|
4089
|
+
top: actionsOverlayTop / zoomConfig.zoom
|
4050
4090
|
},
|
4051
4091
|
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
4052
4092
|
"div",
|
@@ -4055,9 +4095,11 @@ var DraggableComponent = ({
|
|
4055
4095
|
style: {
|
4056
4096
|
transform: `scale(${1 / zoomConfig.zoom}`,
|
4057
4097
|
top: actionsTop / zoomConfig.zoom,
|
4058
|
-
right:
|
4098
|
+
right: 0,
|
4099
|
+
paddingLeft: actionsSide,
|
4100
|
+
paddingRight: actionsSide
|
4059
4101
|
},
|
4060
|
-
ref:
|
4102
|
+
ref: syncActionsPosition,
|
4061
4103
|
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(CustomActionBar, { label: DEBUG2 ? id : label, children: [
|
4062
4104
|
permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Copy, { size: 16 }) }),
|
4063
4105
|
permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Trash, { size: 16 }) })
|
@@ -4080,7 +4122,7 @@ var DraggableComponent = ({
|
|
4080
4122
|
|
4081
4123
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
|
4082
4124
|
init_react_import();
|
4083
|
-
var styles_module_default12 = { "DropZone": "
|
4125
|
+
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" };
|
4084
4126
|
|
4085
4127
|
// components/DropZone/context.tsx
|
4086
4128
|
init_react_import();
|
@@ -4960,6 +5002,11 @@ var reduceUi = (ui, action) => {
|
|
4960
5002
|
}
|
4961
5003
|
return __spreadValues(__spreadValues({}, ui), action.ui(ui));
|
4962
5004
|
}
|
5005
|
+
if (action.type === "duplicate") {
|
5006
|
+
return __spreadProps(__spreadValues({}, ui), {
|
5007
|
+
itemSelector: { index: action.sourceIndex + 1, zone: action.sourceZone }
|
5008
|
+
});
|
5009
|
+
}
|
4963
5010
|
return ui;
|
4964
5011
|
};
|
4965
5012
|
|
@@ -5045,7 +5092,267 @@ var insertComponent = (componentType, zone, index, {
|
|
5045
5092
|
|
5046
5093
|
// components/DragDropContext/index.tsx
|
5047
5094
|
var import_use_debounce2 = require("use-debounce");
|
5095
|
+
var import_utilities2 = require("@dnd-kit/dom/utilities");
|
5096
|
+
|
5097
|
+
// components/DragDropContext/PointerSensor.ts
|
5098
|
+
init_react_import();
|
5048
5099
|
var import_utilities = require("@dnd-kit/dom/utilities");
|
5100
|
+
var _clearTimeout;
|
5101
|
+
var _PointerSensor = class _PointerSensor extends Sensor {
|
5102
|
+
constructor(manager, options) {
|
5103
|
+
super(manager);
|
5104
|
+
this.manager = manager;
|
5105
|
+
this.options = options;
|
5106
|
+
this.listeners = new import_utilities.Listeners();
|
5107
|
+
this.cleanup = /* @__PURE__ */ new Set();
|
5108
|
+
this.source = void 0;
|
5109
|
+
__privateAdd(this, _clearTimeout);
|
5110
|
+
this.handleCancel = this.handleCancel.bind(this);
|
5111
|
+
this.handlePointerUp = this.handlePointerUp.bind(this);
|
5112
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
5113
|
+
E(() => {
|
5114
|
+
const unbindGlobal = this.bindGlobal(options != null ? options : {});
|
5115
|
+
return () => {
|
5116
|
+
unbindGlobal();
|
5117
|
+
};
|
5118
|
+
});
|
5119
|
+
}
|
5120
|
+
bind(source, options = this.options) {
|
5121
|
+
const unbind = E(() => {
|
5122
|
+
var _a;
|
5123
|
+
const target = (_a = source.handle) != null ? _a : source.element;
|
5124
|
+
const listener = (event) => {
|
5125
|
+
if ((0, import_utilities.isPointerEvent)(event)) {
|
5126
|
+
this.handlePointerDown(event, source, options);
|
5127
|
+
}
|
5128
|
+
};
|
5129
|
+
if (target) {
|
5130
|
+
patchWindow(target.ownerDocument.defaultView);
|
5131
|
+
target.addEventListener("pointerdown", listener);
|
5132
|
+
return () => {
|
5133
|
+
target.removeEventListener("pointerdown", listener);
|
5134
|
+
};
|
5135
|
+
}
|
5136
|
+
});
|
5137
|
+
return unbind;
|
5138
|
+
}
|
5139
|
+
bindGlobal(options) {
|
5140
|
+
const documents = /* @__PURE__ */ new Set();
|
5141
|
+
for (const draggable of this.manager.registry.draggables.value) {
|
5142
|
+
if (draggable.element) {
|
5143
|
+
documents.add((0, import_utilities.getDocument)(draggable.element));
|
5144
|
+
}
|
5145
|
+
}
|
5146
|
+
for (const droppable of this.manager.registry.droppables.value) {
|
5147
|
+
if (droppable.element) {
|
5148
|
+
documents.add((0, import_utilities.getDocument)(droppable.element));
|
5149
|
+
}
|
5150
|
+
}
|
5151
|
+
const unbindFns = Array.from(documents).map(
|
5152
|
+
(doc) => this.listeners.bind(doc, [
|
5153
|
+
{
|
5154
|
+
type: "pointermove",
|
5155
|
+
listener: (event) => this.handlePointerMove(event, doc, options)
|
5156
|
+
},
|
5157
|
+
{
|
5158
|
+
type: "pointerup",
|
5159
|
+
listener: this.handlePointerUp,
|
5160
|
+
options: {
|
5161
|
+
capture: true
|
5162
|
+
}
|
5163
|
+
},
|
5164
|
+
{
|
5165
|
+
// Cancel activation if there is a competing Drag and Drop interaction
|
5166
|
+
type: "dragstart",
|
5167
|
+
listener: this.handleDragStart
|
5168
|
+
}
|
5169
|
+
])
|
5170
|
+
);
|
5171
|
+
return () => {
|
5172
|
+
unbindFns.forEach((unbind) => unbind());
|
5173
|
+
};
|
5174
|
+
}
|
5175
|
+
handlePointerDown(event, source, options = {}) {
|
5176
|
+
if (this.disabled || !event.isPrimary || event.button !== 0 || !(0, import_utilities.isElement)(event.target) || source.disabled) {
|
5177
|
+
return;
|
5178
|
+
}
|
5179
|
+
const offset = (0, import_utilities.getFrameTransform)(source.element);
|
5180
|
+
this.initialCoordinates = {
|
5181
|
+
x: event.clientX * offset.scaleX + offset.x,
|
5182
|
+
y: event.clientY * offset.scaleY + offset.y
|
5183
|
+
};
|
5184
|
+
this.source = source;
|
5185
|
+
const { activationConstraints } = options;
|
5186
|
+
const constraints = typeof activationConstraints === "function" ? activationConstraints(event, source) : activationConstraints;
|
5187
|
+
event.stopImmediatePropagation();
|
5188
|
+
if (!(constraints == null ? void 0 : constraints.delay) && !(constraints == null ? void 0 : constraints.distance)) {
|
5189
|
+
this.handleStart(source, event);
|
5190
|
+
} else {
|
5191
|
+
const { delay } = constraints;
|
5192
|
+
if (delay) {
|
5193
|
+
const timeout3 = setTimeout(
|
5194
|
+
() => this.handleStart(source, event),
|
5195
|
+
delay.value
|
5196
|
+
);
|
5197
|
+
__privateSet(this, _clearTimeout, () => {
|
5198
|
+
clearTimeout(timeout3);
|
5199
|
+
__privateSet(this, _clearTimeout, void 0);
|
5200
|
+
});
|
5201
|
+
}
|
5202
|
+
}
|
5203
|
+
const cleanup = () => {
|
5204
|
+
var _a;
|
5205
|
+
(_a = __privateGet(this, _clearTimeout)) == null ? void 0 : _a.call(this);
|
5206
|
+
this.initialCoordinates = void 0;
|
5207
|
+
this.source = void 0;
|
5208
|
+
};
|
5209
|
+
this.cleanup.add(cleanup);
|
5210
|
+
}
|
5211
|
+
handlePointerMove(event, doc, options) {
|
5212
|
+
if (!this.source) {
|
5213
|
+
return;
|
5214
|
+
}
|
5215
|
+
const ownerDocument = this.source.element && (0, import_utilities.getDocument)(this.source.element);
|
5216
|
+
if (doc !== ownerDocument) {
|
5217
|
+
return;
|
5218
|
+
}
|
5219
|
+
const coordinates = {
|
5220
|
+
x: event.clientX,
|
5221
|
+
y: event.clientY
|
5222
|
+
};
|
5223
|
+
const offset = (0, import_utilities.getFrameTransform)(this.source.element);
|
5224
|
+
coordinates.x = coordinates.x * offset.scaleX + offset.x;
|
5225
|
+
coordinates.y = coordinates.y * offset.scaleY + offset.y;
|
5226
|
+
if (this.manager.dragOperation.status.dragging) {
|
5227
|
+
event.preventDefault();
|
5228
|
+
event.stopPropagation();
|
5229
|
+
this.manager.actions.move({ to: coordinates });
|
5230
|
+
return;
|
5231
|
+
}
|
5232
|
+
if (!this.initialCoordinates) {
|
5233
|
+
return;
|
5234
|
+
}
|
5235
|
+
const delta = {
|
5236
|
+
x: coordinates.x - this.initialCoordinates.x,
|
5237
|
+
y: coordinates.y - this.initialCoordinates.y
|
5238
|
+
};
|
5239
|
+
const { activationConstraints } = options;
|
5240
|
+
const constraints = typeof activationConstraints === "function" ? activationConstraints(event, this.source) : activationConstraints;
|
5241
|
+
const { distance, delay } = constraints != null ? constraints : {};
|
5242
|
+
if (distance) {
|
5243
|
+
if (distance.tolerance != null && exceedsDistance(delta, distance.tolerance)) {
|
5244
|
+
return this.handleCancel();
|
5245
|
+
}
|
5246
|
+
if (exceedsDistance(delta, distance.value)) {
|
5247
|
+
return this.handleStart(this.source, event);
|
5248
|
+
}
|
5249
|
+
}
|
5250
|
+
if (delay) {
|
5251
|
+
if (exceedsDistance(delta, delay.tolerance)) {
|
5252
|
+
return this.handleCancel();
|
5253
|
+
}
|
5254
|
+
}
|
5255
|
+
}
|
5256
|
+
handlePointerUp(event) {
|
5257
|
+
event.preventDefault();
|
5258
|
+
event.stopPropagation();
|
5259
|
+
const { status } = this.manager.dragOperation;
|
5260
|
+
if (!status.idle) {
|
5261
|
+
const canceled = !status.initialized;
|
5262
|
+
this.manager.actions.stop({ canceled });
|
5263
|
+
}
|
5264
|
+
this.cleanup.forEach((cleanup) => cleanup());
|
5265
|
+
this.cleanup.clear();
|
5266
|
+
}
|
5267
|
+
handleKeyDown(event) {
|
5268
|
+
if (event.key === "Escape") {
|
5269
|
+
event.preventDefault();
|
5270
|
+
this.handleCancel();
|
5271
|
+
}
|
5272
|
+
}
|
5273
|
+
handleStart(source, event) {
|
5274
|
+
var _a;
|
5275
|
+
const { manager, initialCoordinates } = this;
|
5276
|
+
(_a = __privateGet(this, _clearTimeout)) == null ? void 0 : _a.call(this);
|
5277
|
+
if (!initialCoordinates || manager.dragOperation.status.initialized) {
|
5278
|
+
return;
|
5279
|
+
}
|
5280
|
+
if (event.defaultPrevented) {
|
5281
|
+
return;
|
5282
|
+
}
|
5283
|
+
event.preventDefault();
|
5284
|
+
o(() => {
|
5285
|
+
manager.actions.setDragSource(source.id);
|
5286
|
+
manager.actions.start({ coordinates: initialCoordinates, event });
|
5287
|
+
});
|
5288
|
+
const ownerDocument = (0, import_utilities.getDocument)(event.target);
|
5289
|
+
const unbind = this.listeners.bind(ownerDocument, [
|
5290
|
+
{
|
5291
|
+
// Prevent scrolling on touch devices
|
5292
|
+
type: "touchmove",
|
5293
|
+
listener: preventDefault,
|
5294
|
+
options: {
|
5295
|
+
passive: false
|
5296
|
+
}
|
5297
|
+
},
|
5298
|
+
{
|
5299
|
+
// Prevent click events
|
5300
|
+
type: "click",
|
5301
|
+
listener: preventDefault
|
5302
|
+
},
|
5303
|
+
{
|
5304
|
+
type: "keydown",
|
5305
|
+
listener: this.handleKeyDown
|
5306
|
+
}
|
5307
|
+
]);
|
5308
|
+
ownerDocument.body.setPointerCapture(event.pointerId);
|
5309
|
+
this.cleanup.add(unbind);
|
5310
|
+
}
|
5311
|
+
handleDragStart(event) {
|
5312
|
+
const { target } = event;
|
5313
|
+
if (!(0, import_utilities.isElement)(target)) {
|
5314
|
+
return;
|
5315
|
+
}
|
5316
|
+
const isNativeDraggable = (0, import_utilities.isHTMLElement)(target) && target.draggable && target.getAttribute("draggable") === "true";
|
5317
|
+
if (isNativeDraggable) {
|
5318
|
+
this.handleCancel();
|
5319
|
+
} else {
|
5320
|
+
preventDefault(event);
|
5321
|
+
}
|
5322
|
+
}
|
5323
|
+
handleCancel() {
|
5324
|
+
const { dragOperation } = this.manager;
|
5325
|
+
if (dragOperation.status.initialized) {
|
5326
|
+
this.manager.actions.stop({ canceled: true });
|
5327
|
+
}
|
5328
|
+
this.cleanup.forEach((cleanup) => cleanup());
|
5329
|
+
this.cleanup.clear();
|
5330
|
+
}
|
5331
|
+
destroy() {
|
5332
|
+
this.listeners.clear();
|
5333
|
+
}
|
5334
|
+
};
|
5335
|
+
_clearTimeout = new WeakMap();
|
5336
|
+
_PointerSensor.configure = configurator(_PointerSensor);
|
5337
|
+
var PointerSensor = _PointerSensor;
|
5338
|
+
function preventDefault(event) {
|
5339
|
+
event.preventDefault();
|
5340
|
+
}
|
5341
|
+
function noop() {
|
5342
|
+
}
|
5343
|
+
var windows = /* @__PURE__ */ new WeakSet();
|
5344
|
+
function patchWindow(window2) {
|
5345
|
+
if (!window2 || windows.has(window2)) {
|
5346
|
+
return;
|
5347
|
+
}
|
5348
|
+
window2.addEventListener("touchmove", noop, {
|
5349
|
+
capture: false,
|
5350
|
+
passive: false
|
5351
|
+
});
|
5352
|
+
windows.add(window2);
|
5353
|
+
}
|
5354
|
+
|
5355
|
+
// components/DragDropContext/index.tsx
|
5049
5356
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
5050
5357
|
var dragListenerContext = (0, import_react20.createContext)({
|
5051
5358
|
dragListeners: {}
|
@@ -5065,6 +5372,7 @@ var AREA_CHANGE_DEBOUNCE_MS = 100;
|
|
5065
5372
|
var DragDropContextClient = ({ children }) => {
|
5066
5373
|
const { state, config, dispatch, resolveData } = useAppContext();
|
5067
5374
|
const [preview, setPreview] = (0, import_react20.useState)(null);
|
5375
|
+
const previewRef = (0, import_react20.useRef)(null);
|
5068
5376
|
const { data } = state;
|
5069
5377
|
const [deepest, setDeepest] = (0, import_react20.useState)(null);
|
5070
5378
|
const [nextDeepest, setNextDeepest] = (0, import_react20.useState)(null);
|
@@ -5112,11 +5420,11 @@ var DragDropContextClient = ({ children }) => {
|
|
5112
5420
|
})
|
5113
5421
|
]);
|
5114
5422
|
const [sensors] = (0, import_react20.useState)(() => [
|
5115
|
-
|
5423
|
+
PointerSensor.configure({
|
5116
5424
|
activationConstraints(event, source) {
|
5117
5425
|
var _a;
|
5118
5426
|
const { pointerType, target } = event;
|
5119
|
-
if (pointerType === "mouse" && (0,
|
5427
|
+
if (pointerType === "mouse" && (0, import_utilities2.isElement)(target) && (source.handle === target || ((_a = source.handle) == null ? void 0 : _a.contains(target)))) {
|
5120
5428
|
return void 0;
|
5121
5429
|
}
|
5122
5430
|
const delay = { value: 200, tolerance: 10 };
|
@@ -5181,21 +5489,20 @@ var DragDropContextClient = ({ children }) => {
|
|
5181
5489
|
var _a, _b;
|
5182
5490
|
setDraggedItem(null);
|
5183
5491
|
if (event.canceled || (target == null ? void 0 : target.type) === "void") {
|
5184
|
-
|
5185
|
-
|
5186
|
-
}
|
5492
|
+
setPreview(null);
|
5493
|
+
previewRef.current = null;
|
5187
5494
|
(_a = dragListeners.dragend) == null ? void 0 : _a.forEach((fn) => {
|
5188
5495
|
fn(event, manager);
|
5189
5496
|
});
|
5190
5497
|
return;
|
5191
5498
|
}
|
5192
|
-
if (
|
5499
|
+
if (previewRef.current) {
|
5193
5500
|
setPreview(null);
|
5194
|
-
if (
|
5501
|
+
if (previewRef.current.type === "insert") {
|
5195
5502
|
insertComponent(
|
5196
|
-
|
5197
|
-
|
5198
|
-
|
5503
|
+
previewRef.current.componentType,
|
5504
|
+
previewRef.current.zone,
|
5505
|
+
previewRef.current.index,
|
5199
5506
|
{ config, dispatch, resolveData, state }
|
5200
5507
|
);
|
5201
5508
|
} else if (initialSelector.current) {
|
@@ -5203,11 +5510,12 @@ var DragDropContextClient = ({ children }) => {
|
|
5203
5510
|
type: "move",
|
5204
5511
|
sourceIndex: initialSelector.current.index,
|
5205
5512
|
sourceZone: initialSelector.current.zone,
|
5206
|
-
destinationIndex:
|
5207
|
-
destinationZone:
|
5513
|
+
destinationIndex: previewRef.current.index,
|
5514
|
+
destinationZone: previewRef.current.zone,
|
5208
5515
|
recordHistory: false
|
5209
5516
|
});
|
5210
5517
|
}
|
5518
|
+
previewRef.current = null;
|
5211
5519
|
}
|
5212
5520
|
dispatch({
|
5213
5521
|
type: "setUi",
|
@@ -5258,7 +5566,7 @@ var DragDropContextClient = ({ children }) => {
|
|
5258
5566
|
return;
|
5259
5567
|
}
|
5260
5568
|
if (dragMode.current === "new") {
|
5261
|
-
|
5569
|
+
previewRef.current = {
|
5262
5570
|
componentType: sourceData.componentType,
|
5263
5571
|
type: "insert",
|
5264
5572
|
index: targetIndex,
|
@@ -5266,7 +5574,8 @@ var DragDropContextClient = ({ children }) => {
|
|
5266
5574
|
props: {
|
5267
5575
|
id: source.id.toString()
|
5268
5576
|
}
|
5269
|
-
}
|
5577
|
+
};
|
5578
|
+
setPreview(previewRef.current);
|
5270
5579
|
} else {
|
5271
5580
|
if (!initialSelector.current) {
|
5272
5581
|
initialSelector.current = {
|
@@ -5276,13 +5585,14 @@ var DragDropContextClient = ({ children }) => {
|
|
5276
5585
|
}
|
5277
5586
|
const item = getItem(initialSelector.current, data);
|
5278
5587
|
if (item) {
|
5279
|
-
|
5588
|
+
previewRef.current = {
|
5280
5589
|
componentType: sourceData.componentType,
|
5281
5590
|
type: "move",
|
5282
5591
|
index: targetIndex,
|
5283
5592
|
zone: targetZone,
|
5284
5593
|
props: item.props
|
5285
|
-
}
|
5594
|
+
};
|
5595
|
+
setPreview(previewRef.current);
|
5286
5596
|
}
|
5287
5597
|
}
|
5288
5598
|
(_d = dragListeners.dragover) == null ? void 0 : _d.forEach((fn) => {
|
@@ -7060,7 +7370,7 @@ var ViewportControls = ({
|
|
7060
7370
|
|
7061
7371
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
|
7062
7372
|
init_react_import();
|
7063
|
-
var styles_module_default21 = { "PuckCanvas": "
|
7373
|
+
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" };
|
7064
7374
|
|
7065
7375
|
// lib/get-zoom-config.ts
|
7066
7376
|
init_react_import();
|