@measured/puck 0.21.0-canary.6dae6cb7 → 0.21.0-canary.73b98fb4
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-NBNCSA43.mjs → chunk-47DMTRCY.mjs} +273 -360
- package/dist/{chunk-OOLYDXKW.mjs → chunk-JA7SEUEH.mjs} +17 -15
- package/dist/index.css +4 -3
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +324 -415
- package/dist/index.mjs +2 -2
- package/dist/no-external.css +4 -3
- package/dist/no-external.d.mts +1 -1
- package/dist/no-external.d.ts +1 -1
- package/dist/no-external.js +321 -412
- package/dist/no-external.mjs +2 -2
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +16 -15
- package/dist/rsc.mjs +1 -1
- package/dist/{walk-tree-Ctf3FZQI.d.mts → walk-tree-bsPSSmt9.d.mts} +62 -47
- package/dist/{walk-tree-Ctf3FZQI.d.ts → walk-tree-bsPSSmt9.d.ts} +62 -47
- package/package.json +2 -2
|
@@ -19,12 +19,13 @@ import {
|
|
|
19
19
|
rootDroppableId,
|
|
20
20
|
rootZone,
|
|
21
21
|
setupZone,
|
|
22
|
+
toComponent,
|
|
22
23
|
useFieldTransforms,
|
|
23
24
|
useSlots,
|
|
24
25
|
walkAppState,
|
|
25
26
|
walkField,
|
|
26
27
|
walkTree
|
|
27
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-JA7SEUEH.mjs";
|
|
28
29
|
|
|
29
30
|
// ../../node_modules/classnames/index.js
|
|
30
31
|
var require_classnames = __commonJS({
|
|
@@ -88,6 +89,42 @@ var require_classnames = __commonJS({
|
|
|
88
89
|
}
|
|
89
90
|
});
|
|
90
91
|
|
|
92
|
+
// ../../node_modules/fast-deep-equal/index.js
|
|
93
|
+
var require_fast_deep_equal = __commonJS({
|
|
94
|
+
"../../node_modules/fast-deep-equal/index.js"(exports, module) {
|
|
95
|
+
"use strict";
|
|
96
|
+
init_react_import();
|
|
97
|
+
module.exports = function equal(a, b) {
|
|
98
|
+
if (a === b) return true;
|
|
99
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
100
|
+
if (a.constructor !== b.constructor) return false;
|
|
101
|
+
var length, i, keys;
|
|
102
|
+
if (Array.isArray(a)) {
|
|
103
|
+
length = a.length;
|
|
104
|
+
if (length != b.length) return false;
|
|
105
|
+
for (i = length; i-- !== 0; )
|
|
106
|
+
if (!equal(a[i], b[i])) return false;
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
110
|
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
111
|
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
112
|
+
keys = Object.keys(a);
|
|
113
|
+
length = keys.length;
|
|
114
|
+
if (length !== Object.keys(b).length) return false;
|
|
115
|
+
for (i = length; i-- !== 0; )
|
|
116
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
117
|
+
for (i = length; i-- !== 0; ) {
|
|
118
|
+
var key = keys[i];
|
|
119
|
+
if (!equal(a[key], b[key])) return false;
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
return a !== a && b !== b;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
91
128
|
// types/API/Overrides.ts
|
|
92
129
|
init_react_import();
|
|
93
130
|
var overrideKeys = [
|
|
@@ -768,7 +805,9 @@ var keyCodeMap = {
|
|
|
768
805
|
KeyW: "w",
|
|
769
806
|
KeyX: "x",
|
|
770
807
|
KeyY: "y",
|
|
771
|
-
KeyZ: "z"
|
|
808
|
+
KeyZ: "z",
|
|
809
|
+
Delete: "delete",
|
|
810
|
+
Backspace: "backspace"
|
|
772
811
|
};
|
|
773
812
|
var useHotkeyStore = create()(
|
|
774
813
|
subscribeWithSelector((set) => ({
|
|
@@ -792,8 +831,10 @@ var monitorHotkeys = (doc) => {
|
|
|
792
831
|
([key2, value]) => value === !!combo[key2]
|
|
793
832
|
);
|
|
794
833
|
if (conditionMet) {
|
|
795
|
-
e
|
|
796
|
-
|
|
834
|
+
const handled = cb(e);
|
|
835
|
+
if (handled !== false) {
|
|
836
|
+
e.preventDefault();
|
|
837
|
+
}
|
|
797
838
|
}
|
|
798
839
|
});
|
|
799
840
|
if (key !== "meta" && key !== "ctrl" && key !== "shift") {
|
|
@@ -816,6 +857,10 @@ var monitorHotkeys = (doc) => {
|
|
|
816
857
|
useHotkeyStore.getState().reset();
|
|
817
858
|
}
|
|
818
859
|
};
|
|
860
|
+
const onBlur = () => {
|
|
861
|
+
useHotkeyStore.getState().reset();
|
|
862
|
+
};
|
|
863
|
+
window.addEventListener("blur", onBlur);
|
|
819
864
|
doc.addEventListener("keydown", onKeyDown);
|
|
820
865
|
doc.addEventListener("keyup", onKeyUp);
|
|
821
866
|
doc.addEventListener("visibilitychange", onVisibilityChanged);
|
|
@@ -823,6 +868,7 @@ var monitorHotkeys = (doc) => {
|
|
|
823
868
|
doc.removeEventListener("keydown", onKeyDown);
|
|
824
869
|
doc.removeEventListener("keyup", onKeyUp);
|
|
825
870
|
doc.removeEventListener("visibilitychange", onVisibilityChanged);
|
|
871
|
+
window.removeEventListener("blur", onBlur);
|
|
826
872
|
};
|
|
827
873
|
};
|
|
828
874
|
var useMonitorHotkeys = () => {
|
|
@@ -1017,7 +1063,7 @@ var flattenData = (state, config) => {
|
|
|
1017
1063
|
(content) => content,
|
|
1018
1064
|
(item) => {
|
|
1019
1065
|
data.push(item);
|
|
1020
|
-
return
|
|
1066
|
+
return item;
|
|
1021
1067
|
}
|
|
1022
1068
|
);
|
|
1023
1069
|
return data;
|
|
@@ -1025,29 +1071,37 @@ var flattenData = (state, config) => {
|
|
|
1025
1071
|
|
|
1026
1072
|
// store/slices/permissions.ts
|
|
1027
1073
|
var createPermissionsSlice = (set, get) => {
|
|
1028
|
-
const resolvePermissions = (..._0) => __async(
|
|
1074
|
+
const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
|
|
1029
1075
|
const { state, permissions, config } = get();
|
|
1030
1076
|
const { cache, globalPermissions } = permissions;
|
|
1031
|
-
const
|
|
1032
|
-
var _a, _b
|
|
1077
|
+
const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
|
|
1078
|
+
var _a, _b;
|
|
1033
1079
|
const { config: config2, state: appState, setComponentLoading } = get();
|
|
1080
|
+
const itemCache = cache[item2.props.id];
|
|
1081
|
+
const nodes = appState.indexes.nodes;
|
|
1082
|
+
const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
|
|
1083
|
+
const parentNode = parentId ? nodes[parentId] : null;
|
|
1084
|
+
const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
|
|
1034
1085
|
const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
|
|
1035
1086
|
if (!componentConfig) {
|
|
1036
1087
|
return;
|
|
1037
1088
|
}
|
|
1038
1089
|
const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
|
|
1039
1090
|
if (componentConfig.resolvePermissions) {
|
|
1040
|
-
const changed = getChanged(item2,
|
|
1041
|
-
|
|
1091
|
+
const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
|
|
1092
|
+
const propsChanged = Object.values(changed).some((el) => el === true);
|
|
1093
|
+
const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
|
|
1094
|
+
if (propsChanged || parentChanged || force2) {
|
|
1042
1095
|
const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
|
|
1043
1096
|
const resolvedPermissions = yield componentConfig.resolvePermissions(
|
|
1044
1097
|
item2,
|
|
1045
1098
|
{
|
|
1046
1099
|
changed,
|
|
1047
|
-
lastPermissions: (
|
|
1100
|
+
lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
|
|
1048
1101
|
permissions: initialPermissions,
|
|
1049
1102
|
appState: makeStatePublic(appState),
|
|
1050
|
-
lastData: (
|
|
1103
|
+
lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
|
|
1104
|
+
parent: parentData
|
|
1051
1105
|
}
|
|
1052
1106
|
);
|
|
1053
1107
|
const latest = get().permissions;
|
|
@@ -1055,6 +1109,7 @@ var createPermissionsSlice = (set, get) => {
|
|
|
1055
1109
|
permissions: __spreadProps(__spreadValues({}, latest), {
|
|
1056
1110
|
cache: __spreadProps(__spreadValues({}, latest.cache), {
|
|
1057
1111
|
[item2.props.id]: {
|
|
1112
|
+
lastParentId: parentId,
|
|
1058
1113
|
lastData: item2,
|
|
1059
1114
|
lastPermissions: resolvedPermissions
|
|
1060
1115
|
}
|
|
@@ -1068,9 +1123,9 @@ var createPermissionsSlice = (set, get) => {
|
|
|
1068
1123
|
}
|
|
1069
1124
|
}
|
|
1070
1125
|
});
|
|
1071
|
-
const
|
|
1126
|
+
const resolvePermissionsForRoot = (force2 = false) => {
|
|
1072
1127
|
const { state: appState } = get();
|
|
1073
|
-
|
|
1128
|
+
resolvePermissionsForItem(
|
|
1074
1129
|
// Shim the root data in by conforming to component data shape
|
|
1075
1130
|
{
|
|
1076
1131
|
type: "root",
|
|
@@ -1081,16 +1136,16 @@ var createPermissionsSlice = (set, get) => {
|
|
|
1081
1136
|
};
|
|
1082
1137
|
const { item, type, root } = params;
|
|
1083
1138
|
if (item) {
|
|
1084
|
-
yield
|
|
1139
|
+
yield resolvePermissionsForItem(item, force);
|
|
1085
1140
|
} else if (type) {
|
|
1086
|
-
flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(
|
|
1087
|
-
yield
|
|
1141
|
+
flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
|
|
1142
|
+
yield resolvePermissionsForItem(item2, force);
|
|
1088
1143
|
}));
|
|
1089
1144
|
} else if (root) {
|
|
1090
|
-
|
|
1145
|
+
resolvePermissionsForRoot(force);
|
|
1091
1146
|
} else {
|
|
1092
|
-
flattenData(state, config).map((item2) => __async(
|
|
1093
|
-
yield
|
|
1147
|
+
flattenData(state, config).map((item2) => __async(null, null, function* () {
|
|
1148
|
+
yield resolvePermissionsForItem(item2, force);
|
|
1094
1149
|
}));
|
|
1095
1150
|
}
|
|
1096
1151
|
});
|
|
@@ -1170,7 +1225,7 @@ var createFieldsSlice = (_set, _get) => {
|
|
|
1170
1225
|
};
|
|
1171
1226
|
var useRegisterFieldsSlice = (appStore, id) => {
|
|
1172
1227
|
const resolveFields = useCallback(
|
|
1173
|
-
(reset) => __async(
|
|
1228
|
+
(reset) => __async(null, null, function* () {
|
|
1174
1229
|
var _a, _b;
|
|
1175
1230
|
const { fields, lastResolvedData } = appStore.getState().fields;
|
|
1176
1231
|
const metadata = appStore.getState().metadata;
|
|
@@ -1370,7 +1425,7 @@ var createAppStore = (initialAppStore) => create2()(
|
|
|
1370
1425
|
const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
|
|
1371
1426
|
return __spreadProps(__spreadValues({}, s), { state, selectedItem });
|
|
1372
1427
|
}),
|
|
1373
|
-
resolveComponentData: (componentData, trigger) => __async(
|
|
1428
|
+
resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
|
|
1374
1429
|
const { config, metadata, setComponentLoading, permissions } = get();
|
|
1375
1430
|
const timeouts = {};
|
|
1376
1431
|
return yield resolveComponentData(
|
|
@@ -1381,7 +1436,7 @@ var createAppStore = (initialAppStore) => create2()(
|
|
|
1381
1436
|
const id = "id" in item.props ? item.props.id : "root";
|
|
1382
1437
|
timeouts[id] = setComponentLoading(id, true, 50);
|
|
1383
1438
|
},
|
|
1384
|
-
(item) => __async(
|
|
1439
|
+
(item) => __async(null, null, function* () {
|
|
1385
1440
|
const id = "id" in item.props ? item.props.id : "root";
|
|
1386
1441
|
if ("type" in item) {
|
|
1387
1442
|
yield permissions.refreshPermissions({ item });
|
|
@@ -1393,7 +1448,7 @@ var createAppStore = (initialAppStore) => create2()(
|
|
|
1393
1448
|
trigger
|
|
1394
1449
|
);
|
|
1395
1450
|
}),
|
|
1396
|
-
resolveAndCommitData: () => __async(
|
|
1451
|
+
resolveAndCommitData: () => __async(null, null, function* () {
|
|
1397
1452
|
const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
|
|
1398
1453
|
walkAppState(
|
|
1399
1454
|
state,
|
|
@@ -2414,7 +2469,7 @@ var collisionStore = createStore(() => ({
|
|
|
2414
2469
|
|
|
2415
2470
|
// lib/dnd/collision/dynamic/index.ts
|
|
2416
2471
|
var flushNext = "";
|
|
2417
|
-
var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input) => {
|
|
2472
|
+
var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((input) => {
|
|
2418
2473
|
var _a, _b, _c, _d, _e;
|
|
2419
2474
|
const { dragOperation, droppable } = input;
|
|
2420
2475
|
const { position } = dragOperation;
|
|
@@ -2507,7 +2562,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
|
2507
2562
|
}
|
|
2508
2563
|
collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "hotpink");
|
|
2509
2564
|
return null;
|
|
2510
|
-
};
|
|
2565
|
+
});
|
|
2511
2566
|
|
|
2512
2567
|
// components/Sortable/index.tsx
|
|
2513
2568
|
import { useSortable } from "@dnd-kit/react/sortable";
|
|
@@ -2940,8 +2995,9 @@ var ArrayField = ({
|
|
|
2940
2995
|
var _a;
|
|
2941
2996
|
if (isDraggingAny) return;
|
|
2942
2997
|
const existingValue = value || [];
|
|
2998
|
+
const defaultProps = typeof field.defaultItemProps === "function" ? field.defaultItemProps(existingValue.length) : (_a = field.defaultItemProps) != null ? _a : {};
|
|
2943
2999
|
const newItem = defaultSlots(
|
|
2944
|
-
uniqifyItem(
|
|
3000
|
+
uniqifyItem(defaultProps),
|
|
2945
3001
|
field.arrayFields
|
|
2946
3002
|
);
|
|
2947
3003
|
const newValue = [...existingValue, newItem];
|
|
@@ -3116,11 +3172,13 @@ var ExternalInput = ({
|
|
|
3116
3172
|
id,
|
|
3117
3173
|
readOnly
|
|
3118
3174
|
}) => {
|
|
3175
|
+
var _a;
|
|
3119
3176
|
const {
|
|
3120
3177
|
mapProp = (val) => val,
|
|
3121
3178
|
mapRow = (val) => val,
|
|
3122
3179
|
filterFields
|
|
3123
3180
|
} = field || {};
|
|
3181
|
+
const { enabled: shouldCacheData } = (_a = field.cache) != null ? _a : { enabled: true };
|
|
3124
3182
|
const [data, setData] = useState6([]);
|
|
3125
3183
|
const [isOpen, setOpen] = useState6(false);
|
|
3126
3184
|
const [isLoading, setIsLoading] = useState6(true);
|
|
@@ -3143,14 +3201,21 @@ var ExternalInput = ({
|
|
|
3143
3201
|
}, [mappedData]);
|
|
3144
3202
|
const [searchQuery, setSearchQuery] = useState6(field.initialQuery || "");
|
|
3145
3203
|
const search = useCallback3(
|
|
3146
|
-
(query, filters2) => __async(
|
|
3204
|
+
(query, filters2) => __async(null, null, function* () {
|
|
3147
3205
|
setIsLoading(true);
|
|
3148
3206
|
const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
|
|
3149
|
-
|
|
3207
|
+
let listData;
|
|
3208
|
+
if (shouldCacheData && dataCache[cacheKey]) {
|
|
3209
|
+
listData = dataCache[cacheKey];
|
|
3210
|
+
} else {
|
|
3211
|
+
listData = yield field.fetchList({ query, filters: filters2 });
|
|
3212
|
+
}
|
|
3150
3213
|
if (listData) {
|
|
3151
3214
|
setData(listData);
|
|
3152
3215
|
setIsLoading(false);
|
|
3153
|
-
|
|
3216
|
+
if (shouldCacheData) {
|
|
3217
|
+
dataCache[cacheKey] = listData;
|
|
3218
|
+
}
|
|
3154
3219
|
}
|
|
3155
3220
|
}),
|
|
3156
3221
|
[id, field]
|
|
@@ -3214,6 +3279,7 @@ var ExternalInput = ({
|
|
|
3214
3279
|
}),
|
|
3215
3280
|
onSubmit: (e) => {
|
|
3216
3281
|
e.preventDefault();
|
|
3282
|
+
e.stopPropagation();
|
|
3217
3283
|
search(searchQuery, filters);
|
|
3218
3284
|
},
|
|
3219
3285
|
children: [
|
|
@@ -3361,7 +3427,7 @@ var ExternalField = ({
|
|
|
3361
3427
|
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
|
|
3362
3428
|
mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
|
|
3363
3429
|
mapRow: validField.mapRow,
|
|
3364
|
-
fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(
|
|
3430
|
+
fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(null, null, function* () {
|
|
3365
3431
|
return yield deprecatedField.adaptor.fetchList(
|
|
3366
3432
|
deprecatedField.adaptorParams
|
|
3367
3433
|
);
|
|
@@ -3737,6 +3803,7 @@ function AutoFieldInternal(props) {
|
|
|
3737
3803
|
}
|
|
3738
3804
|
return (_props) => null;
|
|
3739
3805
|
}, [field.type]);
|
|
3806
|
+
const fieldKey = field.type === "custom" ? field.key : void 0;
|
|
3740
3807
|
let FieldComponent = useMemo3(() => {
|
|
3741
3808
|
if (field.type === "custom") {
|
|
3742
3809
|
if (!field.render) {
|
|
@@ -3746,7 +3813,7 @@ function AutoFieldInternal(props) {
|
|
|
3746
3813
|
} else if (field.type !== "slot") {
|
|
3747
3814
|
return render[field.type];
|
|
3748
3815
|
}
|
|
3749
|
-
}, [field.type, render]);
|
|
3816
|
+
}, [field.type, fieldKey, render]);
|
|
3750
3817
|
const { visible = true } = props.field;
|
|
3751
3818
|
if (!visible) {
|
|
3752
3819
|
return null;
|
|
@@ -4124,12 +4191,14 @@ var DraggableComponent = ({
|
|
|
4124
4191
|
}
|
|
4125
4192
|
return cleanup;
|
|
4126
4193
|
}, [permissions.drag, zoneCompound]);
|
|
4194
|
+
const [, setRerender] = useState10(0);
|
|
4127
4195
|
const ref = useRef2(null);
|
|
4128
4196
|
const refSetter = useCallback7(
|
|
4129
4197
|
(el) => {
|
|
4130
4198
|
sortableRef(el);
|
|
4131
|
-
if (el) {
|
|
4199
|
+
if (ref.current !== el) {
|
|
4132
4200
|
ref.current = el;
|
|
4201
|
+
setRerender((update) => update + 1);
|
|
4133
4202
|
}
|
|
4134
4203
|
},
|
|
4135
4204
|
[sortableRef]
|
|
@@ -4784,7 +4853,20 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
|
|
|
4784
4853
|
|
|
4785
4854
|
// lib/insert-component.ts
|
|
4786
4855
|
init_react_import();
|
|
4787
|
-
|
|
4856
|
+
|
|
4857
|
+
// lib/get-selector-for-id.ts
|
|
4858
|
+
init_react_import();
|
|
4859
|
+
var getSelectorForId = (state, id) => {
|
|
4860
|
+
const node = state.indexes.nodes[id];
|
|
4861
|
+
if (!node) return;
|
|
4862
|
+
const zoneCompound = `${node.parentId}:${node.zone}`;
|
|
4863
|
+
const index = state.indexes.zones[zoneCompound].contentIds.indexOf(id);
|
|
4864
|
+
return { zone: zoneCompound, index };
|
|
4865
|
+
};
|
|
4866
|
+
|
|
4867
|
+
// lib/insert-component.ts
|
|
4868
|
+
var insertComponent = (componentType, zone, index, appStore) => __async(null, null, function* () {
|
|
4869
|
+
const { getState } = appStore;
|
|
4788
4870
|
const id = generateId(componentType);
|
|
4789
4871
|
const insertActionData = {
|
|
4790
4872
|
type: "insert",
|
|
@@ -4793,8 +4875,9 @@ var insertComponent = (componentType, zone, index, appStore) => __async(void 0,
|
|
|
4793
4875
|
destinationZone: zone,
|
|
4794
4876
|
id
|
|
4795
4877
|
};
|
|
4796
|
-
const
|
|
4797
|
-
const insertedState = insertAction(
|
|
4878
|
+
const stateBefore = getState().state;
|
|
4879
|
+
const insertedState = insertAction(stateBefore, insertActionData, getState());
|
|
4880
|
+
const dispatch = getState().dispatch;
|
|
4798
4881
|
dispatch(__spreadProps(__spreadValues({}, insertActionData), {
|
|
4799
4882
|
// Dispatch insert rather set, as user's may rely on this via onAction
|
|
4800
4883
|
// We must always record history here so the insert is added to user history
|
|
@@ -4802,23 +4885,21 @@ var insertComponent = (componentType, zone, index, appStore) => __async(void 0,
|
|
|
4802
4885
|
// entries on insert - one for the initial insert, and one when the data resolves
|
|
4803
4886
|
recordHistory: true
|
|
4804
4887
|
}));
|
|
4805
|
-
const itemSelector = {
|
|
4806
|
-
index,
|
|
4807
|
-
zone
|
|
4808
|
-
};
|
|
4888
|
+
const itemSelector = { index, zone };
|
|
4809
4889
|
dispatch({ type: "setUi", ui: { itemSelector } });
|
|
4810
4890
|
const itemData = getItem(itemSelector, insertedState);
|
|
4811
|
-
if (itemData)
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4891
|
+
if (!itemData) return;
|
|
4892
|
+
const resolveComponentData2 = getState().resolveComponentData;
|
|
4893
|
+
const resolved = yield resolveComponentData2(itemData, "insert");
|
|
4894
|
+
if (!resolved.didChange) return;
|
|
4895
|
+
const latestItemSelector = getSelectorForId(getState().state, id);
|
|
4896
|
+
if (!latestItemSelector) return;
|
|
4897
|
+
dispatch({
|
|
4898
|
+
type: "replace",
|
|
4899
|
+
destinationZone: latestItemSelector.zone,
|
|
4900
|
+
destinationIndex: latestItemSelector.index,
|
|
4901
|
+
data: resolved.node
|
|
4902
|
+
});
|
|
4822
4903
|
});
|
|
4823
4904
|
|
|
4824
4905
|
// components/DragDropContext/index.tsx
|
|
@@ -5055,7 +5136,7 @@ var DragDropContextClient = ({
|
|
|
5055
5136
|
thisPreview.componentType,
|
|
5056
5137
|
thisPreview.zone,
|
|
5057
5138
|
thisPreview.index,
|
|
5058
|
-
appStore
|
|
5139
|
+
appStore
|
|
5059
5140
|
);
|
|
5060
5141
|
} else if (initialSelector.current) {
|
|
5061
5142
|
dispatch({
|
|
@@ -5468,7 +5549,7 @@ import { useCallback as useCallback9 } from "react";
|
|
|
5468
5549
|
function useRenderedCallback(callback, deps) {
|
|
5469
5550
|
const manager = useDragDropManager();
|
|
5470
5551
|
return useCallback9(
|
|
5471
|
-
(...args) => __async(
|
|
5552
|
+
(...args) => __async(null, null, function* () {
|
|
5472
5553
|
yield manager == null ? void 0 : manager.renderer.rendering;
|
|
5473
5554
|
return callback(...args);
|
|
5474
5555
|
}),
|
|
@@ -5634,26 +5715,26 @@ var registerOverlayPortal = (el, opts = {}) => {
|
|
|
5634
5715
|
capture: true
|
|
5635
5716
|
});
|
|
5636
5717
|
};
|
|
5637
|
-
if (
|
|
5638
|
-
el.addEventListener("focus", onFocus, { capture: true });
|
|
5639
|
-
el.addEventListener("blur", onBlur, { capture: true });
|
|
5640
|
-
} else if (disableDrag) {
|
|
5718
|
+
if (disableDrag) {
|
|
5641
5719
|
el.addEventListener("pointerdown", stopPropagation, {
|
|
5642
5720
|
capture: true
|
|
5643
5721
|
});
|
|
5722
|
+
} else if (disableDragOnFocus) {
|
|
5723
|
+
el.addEventListener("focus", onFocus, { capture: true });
|
|
5724
|
+
el.addEventListener("blur", onBlur, { capture: true });
|
|
5644
5725
|
}
|
|
5645
5726
|
el.setAttribute("data-puck-overlay-portal", "true");
|
|
5646
5727
|
return () => {
|
|
5647
5728
|
el.removeEventListener("mouseover", stopPropagation, {
|
|
5648
5729
|
capture: true
|
|
5649
5730
|
});
|
|
5650
|
-
if (
|
|
5651
|
-
el.removeEventListener("focus", onFocus, { capture: true });
|
|
5652
|
-
el.removeEventListener("blur", onFocus, { capture: true });
|
|
5653
|
-
} else if (disableDrag) {
|
|
5731
|
+
if (disableDrag) {
|
|
5654
5732
|
el.removeEventListener("pointerdown", stopPropagation, {
|
|
5655
5733
|
capture: true
|
|
5656
5734
|
});
|
|
5735
|
+
} else if (disableDragOnFocus) {
|
|
5736
|
+
el.removeEventListener("focus", onFocus, { capture: true });
|
|
5737
|
+
el.removeEventListener("blur", onBlur, { capture: true });
|
|
5657
5738
|
}
|
|
5658
5739
|
el.removeAttribute("data-puck-overlay-portal");
|
|
5659
5740
|
};
|
|
@@ -5661,7 +5742,7 @@ var registerOverlayPortal = (el, opts = {}) => {
|
|
|
5661
5742
|
|
|
5662
5743
|
// css-module:/home/runner/work/puck/puck/packages/core/components/InlineTextField/styles.module.css#css-module
|
|
5663
5744
|
init_react_import();
|
|
5664
|
-
var styles_module_default13 = { "InlineTextField": "
|
|
5745
|
+
var styles_module_default13 = { "InlineTextField": "_InlineTextField_104qp_1" };
|
|
5665
5746
|
|
|
5666
5747
|
// lib/data/set-deep.ts
|
|
5667
5748
|
init_react_import();
|
|
@@ -5697,16 +5778,6 @@ function setDeep(node, path, newVal) {
|
|
|
5697
5778
|
return __spreadValues(__spreadValues({}, node), newNode);
|
|
5698
5779
|
}
|
|
5699
5780
|
|
|
5700
|
-
// lib/get-selector-for-id.ts
|
|
5701
|
-
init_react_import();
|
|
5702
|
-
var getSelectorForId = (state, id) => {
|
|
5703
|
-
const node = state.indexes.nodes[id];
|
|
5704
|
-
if (!node) return;
|
|
5705
|
-
const zoneCompound = `${node.parentId}:${node.zone}`;
|
|
5706
|
-
const index = state.indexes.zones[zoneCompound].contentIds.indexOf(id);
|
|
5707
|
-
return { zone: zoneCompound, index };
|
|
5708
|
-
};
|
|
5709
|
-
|
|
5710
5781
|
// components/InlineTextField/index.tsx
|
|
5711
5782
|
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
5712
5783
|
var getClassName18 = get_class_name_factory_default("InlineTextField", styles_module_default13);
|
|
@@ -5735,7 +5806,7 @@ var InlineTextFieldInternal = ({
|
|
|
5735
5806
|
ref.current.replaceChildren(value);
|
|
5736
5807
|
}
|
|
5737
5808
|
const cleanupPortal = registerOverlayPortal(ref.current);
|
|
5738
|
-
const handleInput = (e) => __async(
|
|
5809
|
+
const handleInput = (e) => __async(null, null, function* () {
|
|
5739
5810
|
var _a2;
|
|
5740
5811
|
const appStore2 = appStoreApi.getState();
|
|
5741
5812
|
const node = appStore2.state.indexes.nodes[componentId];
|
|
@@ -6027,7 +6098,8 @@ var DropZoneEdit = forwardRef3(
|
|
|
6027
6098
|
style,
|
|
6028
6099
|
className,
|
|
6029
6100
|
minEmptyHeight: userMinEmptyHeight = 128,
|
|
6030
|
-
collisionAxis
|
|
6101
|
+
collisionAxis,
|
|
6102
|
+
as
|
|
6031
6103
|
}, userRef) {
|
|
6032
6104
|
const ctx = useContext8(dropZoneContext);
|
|
6033
6105
|
const appStoreApi = useAppStoreApi();
|
|
@@ -6170,8 +6242,9 @@ var DropZoneEdit = forwardRef3(
|
|
|
6170
6242
|
userMinEmptyHeight,
|
|
6171
6243
|
ref
|
|
6172
6244
|
});
|
|
6245
|
+
const El = as != null ? as : "div";
|
|
6173
6246
|
return /* @__PURE__ */ jsx26(
|
|
6174
|
-
|
|
6247
|
+
El,
|
|
6175
6248
|
{
|
|
6176
6249
|
className: `${getClassName19({
|
|
6177
6250
|
isRootZone,
|
|
@@ -6234,7 +6307,7 @@ var DropZoneRenderItem = ({
|
|
|
6234
6307
|
};
|
|
6235
6308
|
var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx26(DropZoneRender, __spreadValues({}, props));
|
|
6236
6309
|
var DropZoneRender = forwardRef3(
|
|
6237
|
-
function DropZoneRenderInternal({ className, style, zone }, ref) {
|
|
6310
|
+
function DropZoneRenderInternal({ className, style, zone, as }, ref) {
|
|
6238
6311
|
const ctx = useContext8(dropZoneContext);
|
|
6239
6312
|
const { areaId = "root" } = ctx || {};
|
|
6240
6313
|
const { config, data, metadata } = useContext8(renderContext);
|
|
@@ -6247,13 +6320,14 @@ var DropZoneRender = forwardRef3(
|
|
|
6247
6320
|
}
|
|
6248
6321
|
}
|
|
6249
6322
|
}, [content]);
|
|
6323
|
+
const El = as != null ? as : "div";
|
|
6250
6324
|
if (!data || !config) {
|
|
6251
6325
|
return null;
|
|
6252
6326
|
}
|
|
6253
6327
|
if (zoneCompound !== rootDroppableId) {
|
|
6254
6328
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
6255
6329
|
}
|
|
6256
|
-
return /* @__PURE__ */ jsx26(
|
|
6330
|
+
return /* @__PURE__ */ jsx26(El, { className, style, ref, children: content.map((item) => {
|
|
6257
6331
|
const Component = config.components[item.type];
|
|
6258
6332
|
if (Component) {
|
|
6259
6333
|
return /* @__PURE__ */ jsx26(
|
|
@@ -6396,7 +6470,7 @@ function createUsePuck() {
|
|
|
6396
6470
|
}
|
|
6397
6471
|
const result = useStore3(
|
|
6398
6472
|
usePuckApi,
|
|
6399
|
-
selector != null ? selector : (s) => s
|
|
6473
|
+
selector != null ? selector : ((s) => s)
|
|
6400
6474
|
);
|
|
6401
6475
|
return result;
|
|
6402
6476
|
};
|
|
@@ -6421,7 +6495,7 @@ function useGetPuck() {
|
|
|
6421
6495
|
init_react_import();
|
|
6422
6496
|
import {
|
|
6423
6497
|
createContext as createContext8,
|
|
6424
|
-
useCallback as
|
|
6498
|
+
useCallback as useCallback21,
|
|
6425
6499
|
useContext as useContext13,
|
|
6426
6500
|
useEffect as useEffect29,
|
|
6427
6501
|
useMemo as useMemo20,
|
|
@@ -6543,49 +6617,48 @@ var DefaultFields = ({
|
|
|
6543
6617
|
}) => {
|
|
6544
6618
|
return /* @__PURE__ */ jsx29(Fragment8, { children });
|
|
6545
6619
|
};
|
|
6546
|
-
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(
|
|
6547
|
-
let currentProps;
|
|
6620
|
+
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
|
|
6548
6621
|
const { dispatch, state, selectedItem, resolveComponentData: resolveComponentData2 } = appStore.getState();
|
|
6549
6622
|
const { data, ui } = state;
|
|
6550
6623
|
const { itemSelector } = ui;
|
|
6551
6624
|
const rootProps = data.root.props || data.root;
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
} else {
|
|
6555
|
-
currentProps = rootProps;
|
|
6556
|
-
}
|
|
6557
|
-
const newProps = __spreadProps(__spreadValues({}, currentProps), {
|
|
6558
|
-
[fieldName]: value
|
|
6559
|
-
});
|
|
6625
|
+
const currentProps = selectedItem ? selectedItem.props : rootProps;
|
|
6626
|
+
const newProps = __spreadProps(__spreadValues({}, currentProps), { [fieldName]: value });
|
|
6560
6627
|
if (selectedItem && itemSelector) {
|
|
6628
|
+
const resolved = yield resolveComponentData2(
|
|
6629
|
+
__spreadProps(__spreadValues({}, selectedItem), { props: newProps }),
|
|
6630
|
+
"replace"
|
|
6631
|
+
);
|
|
6632
|
+
const latestSelector = getSelectorForId(
|
|
6633
|
+
appStore.getState().state,
|
|
6634
|
+
selectedItem.props.id
|
|
6635
|
+
);
|
|
6636
|
+
if (!latestSelector) return;
|
|
6561
6637
|
dispatch({
|
|
6562
6638
|
type: "replace",
|
|
6563
|
-
destinationIndex:
|
|
6564
|
-
destinationZone:
|
|
6565
|
-
data:
|
|
6566
|
-
|
|
6639
|
+
destinationIndex: latestSelector.index,
|
|
6640
|
+
destinationZone: latestSelector.zone || rootDroppableId,
|
|
6641
|
+
data: resolved.node,
|
|
6642
|
+
ui: updatedUi
|
|
6643
|
+
});
|
|
6644
|
+
return;
|
|
6645
|
+
}
|
|
6646
|
+
if (data.root.props) {
|
|
6647
|
+
dispatch({
|
|
6648
|
+
type: "replaceRoot",
|
|
6649
|
+
root: (yield resolveComponentData2(
|
|
6650
|
+
__spreadProps(__spreadValues({}, data.root), { props: newProps }),
|
|
6567
6651
|
"replace"
|
|
6568
6652
|
)).node,
|
|
6569
|
-
ui: updatedUi
|
|
6653
|
+
ui: __spreadValues(__spreadValues({}, ui), updatedUi),
|
|
6654
|
+
recordHistory: true
|
|
6570
6655
|
});
|
|
6571
|
-
|
|
6572
|
-
if (data.root.props) {
|
|
6573
|
-
dispatch({
|
|
6574
|
-
type: "replaceRoot",
|
|
6575
|
-
root: (yield resolveComponentData2(
|
|
6576
|
-
__spreadProps(__spreadValues({}, data.root), { props: newProps }),
|
|
6577
|
-
"replace"
|
|
6578
|
-
)).node,
|
|
6579
|
-
ui: __spreadValues(__spreadValues({}, ui), updatedUi),
|
|
6580
|
-
recordHistory: true
|
|
6581
|
-
});
|
|
6582
|
-
} else {
|
|
6583
|
-
dispatch({
|
|
6584
|
-
type: "setData",
|
|
6585
|
-
data: { root: newProps }
|
|
6586
|
-
});
|
|
6587
|
-
}
|
|
6656
|
+
return;
|
|
6588
6657
|
}
|
|
6658
|
+
dispatch({
|
|
6659
|
+
type: "setData",
|
|
6660
|
+
data: { root: newProps }
|
|
6661
|
+
});
|
|
6589
6662
|
});
|
|
6590
6663
|
var FieldsChild = ({ fieldName }) => {
|
|
6591
6664
|
const field = useAppStore((s) => s.fields.fields[fieldName]);
|
|
@@ -6917,7 +6990,7 @@ var CopyHostStyles = ({
|
|
|
6917
6990
|
let elements = [];
|
|
6918
6991
|
const hashes = {};
|
|
6919
6992
|
const lookupEl = (el) => elements.findIndex((elementMap) => elementMap.original === el);
|
|
6920
|
-
const mirrorEl = (el, inlineStyles = false) => __async(
|
|
6993
|
+
const mirrorEl = (el, inlineStyles = false) => __async(null, null, function* () {
|
|
6921
6994
|
let mirror;
|
|
6922
6995
|
if (el.nodeName === "LINK" && inlineStyles) {
|
|
6923
6996
|
mirror = document.createElement("style");
|
|
@@ -6949,7 +7022,7 @@ var CopyHostStyles = ({
|
|
|
6949
7022
|
}
|
|
6950
7023
|
return mirror;
|
|
6951
7024
|
});
|
|
6952
|
-
const addEl = (el) => __async(
|
|
7025
|
+
const addEl = (el) => __async(null, null, function* () {
|
|
6953
7026
|
const index = lookupEl(el);
|
|
6954
7027
|
if (index > -1) {
|
|
6955
7028
|
if (debug)
|
|
@@ -7022,7 +7095,7 @@ var CopyHostStyles = ({
|
|
|
7022
7095
|
const parentBody = parentDocument.getElementsByTagName("body")[0];
|
|
7023
7096
|
syncAttributes(parentBody, doc.body);
|
|
7024
7097
|
Promise.all(
|
|
7025
|
-
collectedStyles.map((styleNode, i) => __async(
|
|
7098
|
+
collectedStyles.map((styleNode, i) => __async(null, null, function* () {
|
|
7026
7099
|
if (styleNode.nodeName === "LINK") {
|
|
7027
7100
|
const linkHref = styleNode.href;
|
|
7028
7101
|
if (hrefs.indexOf(linkHref) > -1) {
|
|
@@ -7981,12 +8054,73 @@ var usePreviewModeHotkeys = () => {
|
|
|
7981
8054
|
useHotkey({ ctrl: true, i: true }, toggleInteractive);
|
|
7982
8055
|
};
|
|
7983
8056
|
|
|
8057
|
+
// lib/use-delete-hotkeys.ts
|
|
8058
|
+
init_react_import();
|
|
8059
|
+
import { useCallback as useCallback17 } from "react";
|
|
8060
|
+
var isElementVisible = (element) => {
|
|
8061
|
+
let current = element;
|
|
8062
|
+
while (current && current !== document.body) {
|
|
8063
|
+
const style = window.getComputedStyle(current);
|
|
8064
|
+
if (style.display === "none" || style.visibility === "hidden" || style.opacity === "0" || current.getAttribute("aria-hidden") === "true" || current.hasAttribute("hidden")) {
|
|
8065
|
+
return false;
|
|
8066
|
+
}
|
|
8067
|
+
current = current.parentElement;
|
|
8068
|
+
}
|
|
8069
|
+
return true;
|
|
8070
|
+
};
|
|
8071
|
+
var shouldBlockDeleteHotkey = (e) => {
|
|
8072
|
+
var _a;
|
|
8073
|
+
if (e == null ? void 0 : e.defaultPrevented) return true;
|
|
8074
|
+
const origin = ((_a = e == null ? void 0 : e.composedPath) == null ? void 0 : _a.call(e)[0]) || (e == null ? void 0 : e.target) || document.activeElement;
|
|
8075
|
+
if (origin instanceof HTMLElement) {
|
|
8076
|
+
const tag = origin.tagName.toLowerCase();
|
|
8077
|
+
if (tag === "input" || tag === "textarea" || tag === "select") return true;
|
|
8078
|
+
if (origin.isContentEditable) return true;
|
|
8079
|
+
const role = origin.getAttribute("role");
|
|
8080
|
+
if (role === "textbox" || role === "combobox" || role === "searchbox" || role === "listbox" || role === "grid") {
|
|
8081
|
+
return true;
|
|
8082
|
+
}
|
|
8083
|
+
}
|
|
8084
|
+
const modal = document.querySelector(
|
|
8085
|
+
'dialog[open], [aria-modal="true"], [role="dialog"], [role="alertdialog"]'
|
|
8086
|
+
);
|
|
8087
|
+
if (modal && isElementVisible(modal)) {
|
|
8088
|
+
return true;
|
|
8089
|
+
}
|
|
8090
|
+
return false;
|
|
8091
|
+
};
|
|
8092
|
+
var useDeleteHotkeys = () => {
|
|
8093
|
+
const appStore = useAppStoreApi();
|
|
8094
|
+
const deleteSelectedComponent = useCallback17(
|
|
8095
|
+
(e) => {
|
|
8096
|
+
var _a;
|
|
8097
|
+
if (shouldBlockDeleteHotkey(e)) {
|
|
8098
|
+
return false;
|
|
8099
|
+
}
|
|
8100
|
+
const { state, dispatch, permissions, selectedItem } = appStore.getState();
|
|
8101
|
+
const sel = (_a = state.ui) == null ? void 0 : _a.itemSelector;
|
|
8102
|
+
if (!(sel == null ? void 0 : sel.zone) || !selectedItem) return true;
|
|
8103
|
+
if (!permissions.getPermissions({ item: selectedItem }).delete)
|
|
8104
|
+
return true;
|
|
8105
|
+
dispatch({
|
|
8106
|
+
type: "remove",
|
|
8107
|
+
index: sel.index,
|
|
8108
|
+
zone: sel.zone
|
|
8109
|
+
});
|
|
8110
|
+
return true;
|
|
8111
|
+
},
|
|
8112
|
+
[appStore]
|
|
8113
|
+
);
|
|
8114
|
+
useHotkey({ delete: true }, deleteSelectedComponent);
|
|
8115
|
+
useHotkey({ backspace: true }, deleteSelectedComponent);
|
|
8116
|
+
};
|
|
8117
|
+
|
|
7984
8118
|
// components/Puck/index.tsx
|
|
7985
|
-
|
|
8119
|
+
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
|
7986
8120
|
|
|
7987
8121
|
// components/Puck/components/Header/index.tsx
|
|
7988
8122
|
init_react_import();
|
|
7989
|
-
import { memo as memo4, useCallback as
|
|
8123
|
+
import { memo as memo4, useCallback as useCallback18, useMemo as useMemo19, useState as useState23 } from "react";
|
|
7990
8124
|
|
|
7991
8125
|
// components/MenuBar/index.tsx
|
|
7992
8126
|
init_react_import();
|
|
@@ -8113,7 +8247,7 @@ var HeaderInner = () => {
|
|
|
8113
8247
|
const rightSideBarVisible = useAppStore(
|
|
8114
8248
|
(s) => s.state.ui.rightSideBarVisible
|
|
8115
8249
|
);
|
|
8116
|
-
const toggleSidebars =
|
|
8250
|
+
const toggleSidebars = useCallback18(
|
|
8117
8251
|
(sidebar) => {
|
|
8118
8252
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
|
8119
8253
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
|
@@ -8223,7 +8357,7 @@ init_react_import();
|
|
|
8223
8357
|
|
|
8224
8358
|
// components/Puck/components/ResizeHandle/index.tsx
|
|
8225
8359
|
init_react_import();
|
|
8226
|
-
import { useCallback as
|
|
8360
|
+
import { useCallback as useCallback19, useRef as useRef10 } from "react";
|
|
8227
8361
|
|
|
8228
8362
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/ResizeHandle/styles.module.css#css-module
|
|
8229
8363
|
init_react_import();
|
|
@@ -8244,7 +8378,7 @@ var ResizeHandle = ({
|
|
|
8244
8378
|
const isDragging = useRef10(false);
|
|
8245
8379
|
const startX = useRef10(0);
|
|
8246
8380
|
const startWidth = useRef10(0);
|
|
8247
|
-
const handleMouseMove =
|
|
8381
|
+
const handleMouseMove = useCallback19(
|
|
8248
8382
|
(e) => {
|
|
8249
8383
|
if (!isDragging.current) return;
|
|
8250
8384
|
const delta = e.clientX - startX.current;
|
|
@@ -8255,7 +8389,7 @@ var ResizeHandle = ({
|
|
|
8255
8389
|
},
|
|
8256
8390
|
[onResize, position]
|
|
8257
8391
|
);
|
|
8258
|
-
const handleMouseUp =
|
|
8392
|
+
const handleMouseUp = useCallback19(() => {
|
|
8259
8393
|
var _a;
|
|
8260
8394
|
if (!isDragging.current) return;
|
|
8261
8395
|
isDragging.current = false;
|
|
@@ -8271,7 +8405,7 @@ var ResizeHandle = ({
|
|
|
8271
8405
|
onResizeEnd(finalWidth);
|
|
8272
8406
|
resetAutoZoom();
|
|
8273
8407
|
}, [onResizeEnd]);
|
|
8274
|
-
const handleMouseDown =
|
|
8408
|
+
const handleMouseDown = useCallback19(
|
|
8275
8409
|
(e) => {
|
|
8276
8410
|
var _a;
|
|
8277
8411
|
isDragging.current = true;
|
|
@@ -8331,7 +8465,7 @@ var Sidebar = ({
|
|
|
8331
8465
|
|
|
8332
8466
|
// lib/use-sidebar-resize.ts
|
|
8333
8467
|
init_react_import();
|
|
8334
|
-
import { useCallback as
|
|
8468
|
+
import { useCallback as useCallback20, useEffect as useEffect28, useRef as useRef11, useState as useState24 } from "react";
|
|
8335
8469
|
function useSidebarResize(position, dispatch) {
|
|
8336
8470
|
const [width, setWidth] = useState24(null);
|
|
8337
8471
|
const sidebarRef = useRef11(null);
|
|
@@ -8368,7 +8502,7 @@ function useSidebarResize(position, dispatch) {
|
|
|
8368
8502
|
setWidth(storeWidth);
|
|
8369
8503
|
}
|
|
8370
8504
|
}, [storeWidth]);
|
|
8371
|
-
const handleResizeEnd =
|
|
8505
|
+
const handleResizeEnd = useCallback20(
|
|
8372
8506
|
(width2) => {
|
|
8373
8507
|
dispatch({
|
|
8374
8508
|
type: "setUi",
|
|
@@ -8486,9 +8620,13 @@ function PuckProvider({ children }) {
|
|
|
8486
8620
|
}
|
|
8487
8621
|
const rootProps = ((_h = initialData == null ? void 0 : initialData.root) == null ? void 0 : _h.props) || (initialData == null ? void 0 : initialData.root) || {};
|
|
8488
8622
|
const defaultedRootProps = __spreadValues(__spreadValues({}, (_i = config.root) == null ? void 0 : _i.defaultProps), rootProps);
|
|
8623
|
+
const root = populateIds(
|
|
8624
|
+
toComponent(__spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: defaultedRootProps })),
|
|
8625
|
+
config
|
|
8626
|
+
);
|
|
8489
8627
|
const newAppState = __spreadProps(__spreadValues({}, defaultAppState), {
|
|
8490
8628
|
data: __spreadProps(__spreadValues({}, initialData), {
|
|
8491
|
-
root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props:
|
|
8629
|
+
root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: root.props }),
|
|
8492
8630
|
content: initialData.content || []
|
|
8493
8631
|
}),
|
|
8494
8632
|
ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
|
|
@@ -8525,7 +8663,12 @@ function PuckProvider({ children }) {
|
|
|
8525
8663
|
});
|
|
8526
8664
|
})
|
|
8527
8665
|
);
|
|
8528
|
-
const initialHistoryIndex = (
|
|
8666
|
+
const initialHistoryIndex = useMemo20(() => {
|
|
8667
|
+
if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
|
|
8668
|
+
return _initialHistory == null ? void 0 : _initialHistory.index;
|
|
8669
|
+
}
|
|
8670
|
+
return blendedHistories.length - 1;
|
|
8671
|
+
}, []);
|
|
8529
8672
|
const initialAppState = blendedHistories[initialHistoryIndex].state;
|
|
8530
8673
|
const loadedOverrides = useLoadedOverrides({
|
|
8531
8674
|
overrides,
|
|
@@ -8539,7 +8682,7 @@ function PuckProvider({ children }) {
|
|
|
8539
8682
|
);
|
|
8540
8683
|
return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
|
|
8541
8684
|
}, [fieldTransforms, plugins]);
|
|
8542
|
-
const generateAppStore =
|
|
8685
|
+
const generateAppStore = useCallback21(
|
|
8543
8686
|
(state) => {
|
|
8544
8687
|
return {
|
|
8545
8688
|
state,
|
|
@@ -8584,17 +8727,17 @@ function PuckProvider({ children }) {
|
|
|
8584
8727
|
});
|
|
8585
8728
|
const previousData = useRef12(null);
|
|
8586
8729
|
useEffect29(() => {
|
|
8587
|
-
appStore.subscribe(
|
|
8730
|
+
return appStore.subscribe(
|
|
8588
8731
|
(s) => s.state.data,
|
|
8589
8732
|
(data) => {
|
|
8590
8733
|
if (onChange) {
|
|
8591
|
-
if (
|
|
8734
|
+
if ((0, import_fast_deep_equal.default)(data, previousData.current)) return;
|
|
8592
8735
|
onChange(data);
|
|
8593
8736
|
previousData.current = data;
|
|
8594
8737
|
}
|
|
8595
8738
|
}
|
|
8596
8739
|
);
|
|
8597
|
-
}, []);
|
|
8740
|
+
}, [onChange]);
|
|
8598
8741
|
useRegisterPermissionsSlice(appStore, permissions);
|
|
8599
8742
|
const uPuckStore = useRegisterUsePuckStore(appStore);
|
|
8600
8743
|
useEffect29(() => {
|
|
@@ -8668,6 +8811,7 @@ function PuckLayout({ children }) {
|
|
|
8668
8811
|
}, []);
|
|
8669
8812
|
const ready = useAppStore((s) => s.status === "READY");
|
|
8670
8813
|
useMonitorHotkeys();
|
|
8814
|
+
useDeleteHotkeys();
|
|
8671
8815
|
useEffect29(() => {
|
|
8672
8816
|
if (ready && iframe.enabled) {
|
|
8673
8817
|
const frameDoc = getFrame();
|
|
@@ -8809,269 +8953,38 @@ classnames/index.js:
|
|
|
8809
8953
|
*)
|
|
8810
8954
|
|
|
8811
8955
|
lucide-react/dist/esm/shared/src/utils.js:
|
|
8812
|
-
(**
|
|
8813
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8814
|
-
*
|
|
8815
|
-
* This source code is licensed under the ISC license.
|
|
8816
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8817
|
-
*)
|
|
8818
|
-
|
|
8819
8956
|
lucide-react/dist/esm/defaultAttributes.js:
|
|
8820
|
-
(**
|
|
8821
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8822
|
-
*
|
|
8823
|
-
* This source code is licensed under the ISC license.
|
|
8824
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8825
|
-
*)
|
|
8826
|
-
|
|
8827
8957
|
lucide-react/dist/esm/Icon.js:
|
|
8828
|
-
(**
|
|
8829
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8830
|
-
*
|
|
8831
|
-
* This source code is licensed under the ISC license.
|
|
8832
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8833
|
-
*)
|
|
8834
|
-
|
|
8835
8958
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
8836
|
-
(**
|
|
8837
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8838
|
-
*
|
|
8839
|
-
* This source code is licensed under the ISC license.
|
|
8840
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8841
|
-
*)
|
|
8842
|
-
|
|
8843
8959
|
lucide-react/dist/esm/icons/chevron-down.js:
|
|
8844
|
-
(**
|
|
8845
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8846
|
-
*
|
|
8847
|
-
* This source code is licensed under the ISC license.
|
|
8848
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8849
|
-
*)
|
|
8850
|
-
|
|
8851
8960
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
8852
|
-
(**
|
|
8853
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8854
|
-
*
|
|
8855
|
-
* This source code is licensed under the ISC license.
|
|
8856
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8857
|
-
*)
|
|
8858
|
-
|
|
8859
8961
|
lucide-react/dist/esm/icons/chevron-up.js:
|
|
8860
|
-
(**
|
|
8861
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8862
|
-
*
|
|
8863
|
-
* This source code is licensed under the ISC license.
|
|
8864
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8865
|
-
*)
|
|
8866
|
-
|
|
8867
8962
|
lucide-react/dist/esm/icons/circle-check-big.js:
|
|
8868
|
-
(**
|
|
8869
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8870
|
-
*
|
|
8871
|
-
* This source code is licensed under the ISC license.
|
|
8872
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8873
|
-
*)
|
|
8874
|
-
|
|
8875
8963
|
lucide-react/dist/esm/icons/copy.js:
|
|
8876
|
-
(**
|
|
8877
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8878
|
-
*
|
|
8879
|
-
* This source code is licensed under the ISC license.
|
|
8880
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8881
|
-
*)
|
|
8882
|
-
|
|
8883
8964
|
lucide-react/dist/esm/icons/corner-left-up.js:
|
|
8884
|
-
(**
|
|
8885
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8886
|
-
*
|
|
8887
|
-
* This source code is licensed under the ISC license.
|
|
8888
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8889
|
-
*)
|
|
8890
|
-
|
|
8891
8965
|
lucide-react/dist/esm/icons/ellipsis-vertical.js:
|
|
8892
|
-
(**
|
|
8893
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8894
|
-
*
|
|
8895
|
-
* This source code is licensed under the ISC license.
|
|
8896
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8897
|
-
*)
|
|
8898
|
-
|
|
8899
8966
|
lucide-react/dist/esm/icons/globe.js:
|
|
8900
|
-
(**
|
|
8901
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8902
|
-
*
|
|
8903
|
-
* This source code is licensed under the ISC license.
|
|
8904
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8905
|
-
*)
|
|
8906
|
-
|
|
8907
8967
|
lucide-react/dist/esm/icons/hash.js:
|
|
8908
|
-
(**
|
|
8909
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8910
|
-
*
|
|
8911
|
-
* This source code is licensed under the ISC license.
|
|
8912
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8913
|
-
*)
|
|
8914
|
-
|
|
8915
8968
|
lucide-react/dist/esm/icons/layers.js:
|
|
8916
|
-
(**
|
|
8917
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8918
|
-
*
|
|
8919
|
-
* This source code is licensed under the ISC license.
|
|
8920
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8921
|
-
*)
|
|
8922
|
-
|
|
8923
8969
|
lucide-react/dist/esm/icons/layout-grid.js:
|
|
8924
|
-
(**
|
|
8925
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8926
|
-
*
|
|
8927
|
-
* This source code is licensed under the ISC license.
|
|
8928
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8929
|
-
*)
|
|
8930
|
-
|
|
8931
8970
|
lucide-react/dist/esm/icons/link.js:
|
|
8932
|
-
(**
|
|
8933
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8934
|
-
*
|
|
8935
|
-
* This source code is licensed under the ISC license.
|
|
8936
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8937
|
-
*)
|
|
8938
|
-
|
|
8939
8971
|
lucide-react/dist/esm/icons/list.js:
|
|
8940
|
-
(**
|
|
8941
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8942
|
-
*
|
|
8943
|
-
* This source code is licensed under the ISC license.
|
|
8944
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8945
|
-
*)
|
|
8946
|
-
|
|
8947
8972
|
lucide-react/dist/esm/icons/lock-open.js:
|
|
8948
|
-
(**
|
|
8949
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8950
|
-
*
|
|
8951
|
-
* This source code is licensed under the ISC license.
|
|
8952
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8953
|
-
*)
|
|
8954
|
-
|
|
8955
8973
|
lucide-react/dist/esm/icons/lock.js:
|
|
8956
|
-
(**
|
|
8957
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8958
|
-
*
|
|
8959
|
-
* This source code is licensed under the ISC license.
|
|
8960
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8961
|
-
*)
|
|
8962
|
-
|
|
8963
8974
|
lucide-react/dist/esm/icons/monitor.js:
|
|
8964
|
-
(**
|
|
8965
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8966
|
-
*
|
|
8967
|
-
* This source code is licensed under the ISC license.
|
|
8968
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8969
|
-
*)
|
|
8970
|
-
|
|
8971
8975
|
lucide-react/dist/esm/icons/panel-left.js:
|
|
8972
|
-
(**
|
|
8973
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8974
|
-
*
|
|
8975
|
-
* This source code is licensed under the ISC license.
|
|
8976
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8977
|
-
*)
|
|
8978
|
-
|
|
8979
8976
|
lucide-react/dist/esm/icons/panel-right.js:
|
|
8980
|
-
(**
|
|
8981
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8982
|
-
*
|
|
8983
|
-
* This source code is licensed under the ISC license.
|
|
8984
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8985
|
-
*)
|
|
8986
|
-
|
|
8987
8977
|
lucide-react/dist/esm/icons/plus.js:
|
|
8988
|
-
(**
|
|
8989
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8990
|
-
*
|
|
8991
|
-
* This source code is licensed under the ISC license.
|
|
8992
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8993
|
-
*)
|
|
8994
|
-
|
|
8995
8978
|
lucide-react/dist/esm/icons/redo-2.js:
|
|
8996
|
-
(**
|
|
8997
|
-
* @license lucide-react v0.468.0 - ISC
|
|
8998
|
-
*
|
|
8999
|
-
* This source code is licensed under the ISC license.
|
|
9000
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9001
|
-
*)
|
|
9002
|
-
|
|
9003
8979
|
lucide-react/dist/esm/icons/search.js:
|
|
9004
|
-
(**
|
|
9005
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9006
|
-
*
|
|
9007
|
-
* This source code is licensed under the ISC license.
|
|
9008
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9009
|
-
*)
|
|
9010
|
-
|
|
9011
8980
|
lucide-react/dist/esm/icons/sliders-horizontal.js:
|
|
9012
|
-
(**
|
|
9013
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9014
|
-
*
|
|
9015
|
-
* This source code is licensed under the ISC license.
|
|
9016
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9017
|
-
*)
|
|
9018
|
-
|
|
9019
8981
|
lucide-react/dist/esm/icons/smartphone.js:
|
|
9020
|
-
(**
|
|
9021
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9022
|
-
*
|
|
9023
|
-
* This source code is licensed under the ISC license.
|
|
9024
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9025
|
-
*)
|
|
9026
|
-
|
|
9027
8982
|
lucide-react/dist/esm/icons/tablet.js:
|
|
9028
|
-
(**
|
|
9029
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9030
|
-
*
|
|
9031
|
-
* This source code is licensed under the ISC license.
|
|
9032
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9033
|
-
*)
|
|
9034
|
-
|
|
9035
8983
|
lucide-react/dist/esm/icons/trash.js:
|
|
9036
|
-
(**
|
|
9037
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9038
|
-
*
|
|
9039
|
-
* This source code is licensed under the ISC license.
|
|
9040
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9041
|
-
*)
|
|
9042
|
-
|
|
9043
8984
|
lucide-react/dist/esm/icons/type.js:
|
|
9044
|
-
(**
|
|
9045
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9046
|
-
*
|
|
9047
|
-
* This source code is licensed under the ISC license.
|
|
9048
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9049
|
-
*)
|
|
9050
|
-
|
|
9051
8985
|
lucide-react/dist/esm/icons/undo-2.js:
|
|
9052
|
-
(**
|
|
9053
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9054
|
-
*
|
|
9055
|
-
* This source code is licensed under the ISC license.
|
|
9056
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9057
|
-
*)
|
|
9058
|
-
|
|
9059
8986
|
lucide-react/dist/esm/icons/zoom-in.js:
|
|
9060
|
-
(**
|
|
9061
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9062
|
-
*
|
|
9063
|
-
* This source code is licensed under the ISC license.
|
|
9064
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9065
|
-
*)
|
|
9066
|
-
|
|
9067
8987
|
lucide-react/dist/esm/icons/zoom-out.js:
|
|
9068
|
-
(**
|
|
9069
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9070
|
-
*
|
|
9071
|
-
* This source code is licensed under the ISC license.
|
|
9072
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9073
|
-
*)
|
|
9074
|
-
|
|
9075
8988
|
lucide-react/dist/esm/lucide-react.js:
|
|
9076
8989
|
(**
|
|
9077
8990
|
* @license lucide-react v0.468.0 - ISC
|