@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
package/dist/index.js
CHANGED
|
@@ -153,9 +153,45 @@ var require_classnames = __commonJS({
|
|
|
153
153
|
}
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
+
// ../../node_modules/fast-deep-equal/index.js
|
|
157
|
+
var require_fast_deep_equal = __commonJS({
|
|
158
|
+
"../../node_modules/fast-deep-equal/index.js"(exports2, module2) {
|
|
159
|
+
"use strict";
|
|
160
|
+
init_react_import();
|
|
161
|
+
module2.exports = function equal(a, b) {
|
|
162
|
+
if (a === b) return true;
|
|
163
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
164
|
+
if (a.constructor !== b.constructor) return false;
|
|
165
|
+
var length, i, keys;
|
|
166
|
+
if (Array.isArray(a)) {
|
|
167
|
+
length = a.length;
|
|
168
|
+
if (length != b.length) return false;
|
|
169
|
+
for (i = length; i-- !== 0; )
|
|
170
|
+
if (!equal(a[i], b[i])) return false;
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
174
|
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
175
|
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
176
|
+
keys = Object.keys(a);
|
|
177
|
+
length = keys.length;
|
|
178
|
+
if (length !== Object.keys(b).length) return false;
|
|
179
|
+
for (i = length; i-- !== 0; )
|
|
180
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
181
|
+
for (i = length; i-- !== 0; ) {
|
|
182
|
+
var key = keys[i];
|
|
183
|
+
if (!equal(a[key], b[key])) return false;
|
|
184
|
+
}
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
return a !== a && b !== b;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
156
192
|
// bundle/index.ts
|
|
157
|
-
var
|
|
158
|
-
__export(
|
|
193
|
+
var index_exports = {};
|
|
194
|
+
__export(index_exports, {
|
|
159
195
|
Action: () => Action,
|
|
160
196
|
ActionBar: () => ActionBar,
|
|
161
197
|
AutoField: () => AutoField,
|
|
@@ -180,7 +216,7 @@ __export(bundle_exports, {
|
|
|
180
216
|
usePuck: () => usePuck,
|
|
181
217
|
walkTree: () => walkTree
|
|
182
218
|
});
|
|
183
|
-
module.exports = __toCommonJS(
|
|
219
|
+
module.exports = __toCommonJS(index_exports);
|
|
184
220
|
init_react_import();
|
|
185
221
|
|
|
186
222
|
// bundle/core.ts
|
|
@@ -1661,7 +1697,9 @@ var keyCodeMap = {
|
|
|
1661
1697
|
KeyW: "w",
|
|
1662
1698
|
KeyX: "x",
|
|
1663
1699
|
KeyY: "y",
|
|
1664
|
-
KeyZ: "z"
|
|
1700
|
+
KeyZ: "z",
|
|
1701
|
+
Delete: "delete",
|
|
1702
|
+
Backspace: "backspace"
|
|
1665
1703
|
};
|
|
1666
1704
|
var useHotkeyStore = (0, import_zustand.create)()(
|
|
1667
1705
|
(0, import_middleware.subscribeWithSelector)((set) => ({
|
|
@@ -1685,8 +1723,10 @@ var monitorHotkeys = (doc) => {
|
|
|
1685
1723
|
([key2, value]) => value === !!combo[key2]
|
|
1686
1724
|
);
|
|
1687
1725
|
if (conditionMet) {
|
|
1688
|
-
e
|
|
1689
|
-
|
|
1726
|
+
const handled = cb(e);
|
|
1727
|
+
if (handled !== false) {
|
|
1728
|
+
e.preventDefault();
|
|
1729
|
+
}
|
|
1690
1730
|
}
|
|
1691
1731
|
});
|
|
1692
1732
|
if (key !== "meta" && key !== "ctrl" && key !== "shift") {
|
|
@@ -1709,6 +1749,10 @@ var monitorHotkeys = (doc) => {
|
|
|
1709
1749
|
useHotkeyStore.getState().reset();
|
|
1710
1750
|
}
|
|
1711
1751
|
};
|
|
1752
|
+
const onBlur = () => {
|
|
1753
|
+
useHotkeyStore.getState().reset();
|
|
1754
|
+
};
|
|
1755
|
+
window.addEventListener("blur", onBlur);
|
|
1712
1756
|
doc.addEventListener("keydown", onKeyDown);
|
|
1713
1757
|
doc.addEventListener("keyup", onKeyUp);
|
|
1714
1758
|
doc.addEventListener("visibilitychange", onVisibilityChanged);
|
|
@@ -1716,6 +1760,7 @@ var monitorHotkeys = (doc) => {
|
|
|
1716
1760
|
doc.removeEventListener("keydown", onKeyDown);
|
|
1717
1761
|
doc.removeEventListener("keyup", onKeyUp);
|
|
1718
1762
|
doc.removeEventListener("visibilitychange", onVisibilityChanged);
|
|
1763
|
+
window.removeEventListener("blur", onBlur);
|
|
1719
1764
|
};
|
|
1720
1765
|
};
|
|
1721
1766
|
var useMonitorHotkeys = () => {
|
|
@@ -1910,7 +1955,7 @@ var flattenData = (state, config) => {
|
|
|
1910
1955
|
(content) => content,
|
|
1911
1956
|
(item) => {
|
|
1912
1957
|
data.push(item);
|
|
1913
|
-
return
|
|
1958
|
+
return item;
|
|
1914
1959
|
}
|
|
1915
1960
|
);
|
|
1916
1961
|
return data;
|
|
@@ -1918,42 +1963,50 @@ var flattenData = (state, config) => {
|
|
|
1918
1963
|
|
|
1919
1964
|
// lib/get-changed.ts
|
|
1920
1965
|
init_react_import();
|
|
1921
|
-
var
|
|
1966
|
+
var import_fast_equals = require("fast-equals");
|
|
1922
1967
|
var getChanged = (newItem, oldItem) => {
|
|
1923
1968
|
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
|
1924
1969
|
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
|
1925
1970
|
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
|
1926
1971
|
return __spreadProps(__spreadValues({}, acc), {
|
|
1927
|
-
[item]: !(0,
|
|
1972
|
+
[item]: !(0, import_fast_equals.deepEqual)(oldItemProps[item], newItemProps[item])
|
|
1928
1973
|
});
|
|
1929
1974
|
}, {}) : {};
|
|
1930
1975
|
};
|
|
1931
1976
|
|
|
1932
1977
|
// store/slices/permissions.ts
|
|
1933
1978
|
var createPermissionsSlice = (set, get) => {
|
|
1934
|
-
const resolvePermissions = (..._0) => __async(
|
|
1979
|
+
const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
|
|
1935
1980
|
const { state, permissions, config } = get();
|
|
1936
1981
|
const { cache: cache2, globalPermissions } = permissions;
|
|
1937
|
-
const
|
|
1938
|
-
var _a, _b
|
|
1982
|
+
const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
|
|
1983
|
+
var _a, _b;
|
|
1939
1984
|
const { config: config2, state: appState, setComponentLoading } = get();
|
|
1985
|
+
const itemCache = cache2[item2.props.id];
|
|
1986
|
+
const nodes = appState.indexes.nodes;
|
|
1987
|
+
const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
|
|
1988
|
+
const parentNode = parentId ? nodes[parentId] : null;
|
|
1989
|
+
const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
|
|
1940
1990
|
const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
|
|
1941
1991
|
if (!componentConfig) {
|
|
1942
1992
|
return;
|
|
1943
1993
|
}
|
|
1944
1994
|
const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
|
|
1945
1995
|
if (componentConfig.resolvePermissions) {
|
|
1946
|
-
const changed = getChanged(item2,
|
|
1947
|
-
|
|
1996
|
+
const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
|
|
1997
|
+
const propsChanged = Object.values(changed).some((el) => el === true);
|
|
1998
|
+
const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
|
|
1999
|
+
if (propsChanged || parentChanged || force2) {
|
|
1948
2000
|
const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
|
|
1949
2001
|
const resolvedPermissions = yield componentConfig.resolvePermissions(
|
|
1950
2002
|
item2,
|
|
1951
2003
|
{
|
|
1952
2004
|
changed,
|
|
1953
|
-
lastPermissions: (
|
|
2005
|
+
lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
|
|
1954
2006
|
permissions: initialPermissions,
|
|
1955
2007
|
appState: makeStatePublic(appState),
|
|
1956
|
-
lastData: (
|
|
2008
|
+
lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
|
|
2009
|
+
parent: parentData
|
|
1957
2010
|
}
|
|
1958
2011
|
);
|
|
1959
2012
|
const latest = get().permissions;
|
|
@@ -1961,6 +2014,7 @@ var createPermissionsSlice = (set, get) => {
|
|
|
1961
2014
|
permissions: __spreadProps(__spreadValues({}, latest), {
|
|
1962
2015
|
cache: __spreadProps(__spreadValues({}, latest.cache), {
|
|
1963
2016
|
[item2.props.id]: {
|
|
2017
|
+
lastParentId: parentId,
|
|
1964
2018
|
lastData: item2,
|
|
1965
2019
|
lastPermissions: resolvedPermissions
|
|
1966
2020
|
}
|
|
@@ -1974,9 +2028,9 @@ var createPermissionsSlice = (set, get) => {
|
|
|
1974
2028
|
}
|
|
1975
2029
|
}
|
|
1976
2030
|
});
|
|
1977
|
-
const
|
|
2031
|
+
const resolvePermissionsForRoot = (force2 = false) => {
|
|
1978
2032
|
const { state: appState } = get();
|
|
1979
|
-
|
|
2033
|
+
resolvePermissionsForItem(
|
|
1980
2034
|
// Shim the root data in by conforming to component data shape
|
|
1981
2035
|
{
|
|
1982
2036
|
type: "root",
|
|
@@ -1987,16 +2041,16 @@ var createPermissionsSlice = (set, get) => {
|
|
|
1987
2041
|
};
|
|
1988
2042
|
const { item, type, root } = params;
|
|
1989
2043
|
if (item) {
|
|
1990
|
-
yield
|
|
2044
|
+
yield resolvePermissionsForItem(item, force);
|
|
1991
2045
|
} else if (type) {
|
|
1992
|
-
flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(
|
|
1993
|
-
yield
|
|
2046
|
+
flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
|
|
2047
|
+
yield resolvePermissionsForItem(item2, force);
|
|
1994
2048
|
}));
|
|
1995
2049
|
} else if (root) {
|
|
1996
|
-
|
|
2050
|
+
resolvePermissionsForRoot(force);
|
|
1997
2051
|
} else {
|
|
1998
|
-
flattenData(state, config).map((item2) => __async(
|
|
1999
|
-
yield
|
|
2052
|
+
flattenData(state, config).map((item2) => __async(null, null, function* () {
|
|
2053
|
+
yield resolvePermissionsForItem(item2, force);
|
|
2000
2054
|
}));
|
|
2001
2055
|
}
|
|
2002
2056
|
});
|
|
@@ -2076,7 +2130,7 @@ var createFieldsSlice = (_set, _get) => {
|
|
|
2076
2130
|
};
|
|
2077
2131
|
var useRegisterFieldsSlice = (appStore, id) => {
|
|
2078
2132
|
const resolveFields = (0, import_react7.useCallback)(
|
|
2079
|
-
(reset) => __async(
|
|
2133
|
+
(reset) => __async(null, null, function* () {
|
|
2080
2134
|
var _a, _b;
|
|
2081
2135
|
const { fields, lastResolvedData } = appStore.getState().fields;
|
|
2082
2136
|
const metadata = appStore.getState().metadata;
|
|
@@ -2145,16 +2199,16 @@ var useRegisterFieldsSlice = (appStore, id) => {
|
|
|
2145
2199
|
|
|
2146
2200
|
// lib/resolve-component-data.ts
|
|
2147
2201
|
init_react_import();
|
|
2148
|
-
var
|
|
2202
|
+
var import_fast_equals2 = require("fast-equals");
|
|
2149
2203
|
var cache = { lastChange: {} };
|
|
2150
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(
|
|
2204
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
|
2151
2205
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
2152
2206
|
const resolvedItem = __spreadValues({}, item);
|
|
2153
2207
|
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
2154
2208
|
const id = "id" in item.props ? item.props.id : "root";
|
|
2155
2209
|
if (shouldRunResolver) {
|
|
2156
2210
|
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
|
2157
|
-
if (trigger !== "force" && item && (0,
|
|
2211
|
+
if (trigger !== "force" && item && (0, import_fast_equals2.deepEqual)(item, oldItem)) {
|
|
2158
2212
|
return { node: resolved, didChange: false };
|
|
2159
2213
|
}
|
|
2160
2214
|
const changed = getChanged(item, oldItem);
|
|
@@ -2175,11 +2229,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
|
2175
2229
|
let itemWithResolvedChildren = yield mapFields(
|
|
2176
2230
|
resolvedItem,
|
|
2177
2231
|
{
|
|
2178
|
-
slot: (_02) => __async(
|
|
2232
|
+
slot: (_02) => __async(null, [_02], function* ({ value }) {
|
|
2179
2233
|
const content = value;
|
|
2180
2234
|
return yield Promise.all(
|
|
2181
2235
|
content.map(
|
|
2182
|
-
(childItem) => __async(
|
|
2236
|
+
(childItem) => __async(null, null, function* () {
|
|
2183
2237
|
return (yield resolveComponentData(
|
|
2184
2238
|
childItem,
|
|
2185
2239
|
config,
|
|
@@ -2204,7 +2258,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
|
2204
2258
|
};
|
|
2205
2259
|
return {
|
|
2206
2260
|
node: itemWithResolvedChildren,
|
|
2207
|
-
didChange: !(0,
|
|
2261
|
+
didChange: !(0, import_fast_equals2.deepEqual)(item, itemWithResolvedChildren)
|
|
2208
2262
|
};
|
|
2209
2263
|
});
|
|
2210
2264
|
|
|
@@ -2369,7 +2423,7 @@ var createAppStore = (initialAppStore) => (0, import_zustand2.create)()(
|
|
|
2369
2423
|
const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
|
|
2370
2424
|
return __spreadProps(__spreadValues({}, s), { state, selectedItem });
|
|
2371
2425
|
}),
|
|
2372
|
-
resolveComponentData: (componentData, trigger) => __async(
|
|
2426
|
+
resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
|
|
2373
2427
|
const { config, metadata, setComponentLoading, permissions } = get();
|
|
2374
2428
|
const timeouts = {};
|
|
2375
2429
|
return yield resolveComponentData(
|
|
@@ -2380,7 +2434,7 @@ var createAppStore = (initialAppStore) => (0, import_zustand2.create)()(
|
|
|
2380
2434
|
const id = "id" in item.props ? item.props.id : "root";
|
|
2381
2435
|
timeouts[id] = setComponentLoading(id, true, 50);
|
|
2382
2436
|
},
|
|
2383
|
-
(item) => __async(
|
|
2437
|
+
(item) => __async(null, null, function* () {
|
|
2384
2438
|
const id = "id" in item.props ? item.props.id : "root";
|
|
2385
2439
|
if ("type" in item) {
|
|
2386
2440
|
yield permissions.refreshPermissions({ item });
|
|
@@ -2392,7 +2446,7 @@ var createAppStore = (initialAppStore) => (0, import_zustand2.create)()(
|
|
|
2392
2446
|
trigger
|
|
2393
2447
|
);
|
|
2394
2448
|
}),
|
|
2395
|
-
resolveAndCommitData: () => __async(
|
|
2449
|
+
resolveAndCommitData: () => __async(null, null, function* () {
|
|
2396
2450
|
const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
|
|
2397
2451
|
walkAppState(
|
|
2398
2452
|
state,
|
|
@@ -2964,7 +3018,7 @@ var collisionStore = (0, import_vanilla.createStore)(() => ({
|
|
|
2964
3018
|
|
|
2965
3019
|
// lib/dnd/collision/dynamic/index.ts
|
|
2966
3020
|
var flushNext = "";
|
|
2967
|
-
var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input) => {
|
|
3021
|
+
var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((input) => {
|
|
2968
3022
|
var _a, _b, _c, _d, _e;
|
|
2969
3023
|
const { dragOperation, droppable } = input;
|
|
2970
3024
|
const { position } = dragOperation;
|
|
@@ -3057,7 +3111,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
|
3057
3111
|
}
|
|
3058
3112
|
collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "hotpink");
|
|
3059
3113
|
return null;
|
|
3060
|
-
};
|
|
3114
|
+
});
|
|
3061
3115
|
|
|
3062
3116
|
// components/Sortable/index.tsx
|
|
3063
3117
|
var import_sortable = require("@dnd-kit/react/sortable");
|
|
@@ -3490,8 +3544,9 @@ var ArrayField = ({
|
|
|
3490
3544
|
var _a;
|
|
3491
3545
|
if (isDraggingAny) return;
|
|
3492
3546
|
const existingValue = value || [];
|
|
3547
|
+
const defaultProps = typeof field.defaultItemProps === "function" ? field.defaultItemProps(existingValue.length) : (_a = field.defaultItemProps) != null ? _a : {};
|
|
3493
3548
|
const newItem = defaultSlots(
|
|
3494
|
-
uniqifyItem(
|
|
3549
|
+
uniqifyItem(defaultProps),
|
|
3495
3550
|
field.arrayFields
|
|
3496
3551
|
);
|
|
3497
3552
|
const newValue = [...existingValue, newItem];
|
|
@@ -3750,11 +3805,13 @@ var ExternalInput = ({
|
|
|
3750
3805
|
id,
|
|
3751
3806
|
readOnly
|
|
3752
3807
|
}) => {
|
|
3808
|
+
var _a;
|
|
3753
3809
|
const {
|
|
3754
3810
|
mapProp = (val) => val,
|
|
3755
3811
|
mapRow = (val) => val,
|
|
3756
3812
|
filterFields
|
|
3757
3813
|
} = field || {};
|
|
3814
|
+
const { enabled: shouldCacheData } = (_a = field.cache) != null ? _a : { enabled: true };
|
|
3758
3815
|
const [data, setData] = (0, import_react17.useState)([]);
|
|
3759
3816
|
const [isOpen, setOpen] = (0, import_react17.useState)(false);
|
|
3760
3817
|
const [isLoading, setIsLoading] = (0, import_react17.useState)(true);
|
|
@@ -3777,14 +3834,21 @@ var ExternalInput = ({
|
|
|
3777
3834
|
}, [mappedData]);
|
|
3778
3835
|
const [searchQuery, setSearchQuery] = (0, import_react17.useState)(field.initialQuery || "");
|
|
3779
3836
|
const search = (0, import_react17.useCallback)(
|
|
3780
|
-
(query, filters2) => __async(
|
|
3837
|
+
(query, filters2) => __async(null, null, function* () {
|
|
3781
3838
|
setIsLoading(true);
|
|
3782
3839
|
const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
|
|
3783
|
-
|
|
3840
|
+
let listData;
|
|
3841
|
+
if (shouldCacheData && dataCache[cacheKey]) {
|
|
3842
|
+
listData = dataCache[cacheKey];
|
|
3843
|
+
} else {
|
|
3844
|
+
listData = yield field.fetchList({ query, filters: filters2 });
|
|
3845
|
+
}
|
|
3784
3846
|
if (listData) {
|
|
3785
3847
|
setData(listData);
|
|
3786
3848
|
setIsLoading(false);
|
|
3787
|
-
|
|
3849
|
+
if (shouldCacheData) {
|
|
3850
|
+
dataCache[cacheKey] = listData;
|
|
3851
|
+
}
|
|
3788
3852
|
}
|
|
3789
3853
|
}),
|
|
3790
3854
|
[id, field]
|
|
@@ -3848,6 +3912,7 @@ var ExternalInput = ({
|
|
|
3848
3912
|
}),
|
|
3849
3913
|
onSubmit: (e) => {
|
|
3850
3914
|
e.preventDefault();
|
|
3915
|
+
e.stopPropagation();
|
|
3851
3916
|
search(searchQuery, filters);
|
|
3852
3917
|
},
|
|
3853
3918
|
children: [
|
|
@@ -3995,7 +4060,7 @@ var ExternalField = ({
|
|
|
3995
4060
|
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
|
|
3996
4061
|
mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
|
|
3997
4062
|
mapRow: validField.mapRow,
|
|
3998
|
-
fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(
|
|
4063
|
+
fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(null, null, function* () {
|
|
3999
4064
|
return yield deprecatedField.adaptor.fetchList(
|
|
4000
4065
|
deprecatedField.adaptorParams
|
|
4001
4066
|
);
|
|
@@ -4371,6 +4436,7 @@ function AutoFieldInternal(props) {
|
|
|
4371
4436
|
}
|
|
4372
4437
|
return (_props) => null;
|
|
4373
4438
|
}, [field.type]);
|
|
4439
|
+
const fieldKey = field.type === "custom" ? field.key : void 0;
|
|
4374
4440
|
let FieldComponent = (0, import_react20.useMemo)(() => {
|
|
4375
4441
|
if (field.type === "custom") {
|
|
4376
4442
|
if (!field.render) {
|
|
@@ -4380,7 +4446,7 @@ function AutoFieldInternal(props) {
|
|
|
4380
4446
|
} else if (field.type !== "slot") {
|
|
4381
4447
|
return render[field.type];
|
|
4382
4448
|
}
|
|
4383
|
-
}, [field.type, render]);
|
|
4449
|
+
}, [field.type, fieldKey, render]);
|
|
4384
4450
|
const { visible = true } = props.field;
|
|
4385
4451
|
if (!visible) {
|
|
4386
4452
|
return null;
|
|
@@ -4751,12 +4817,14 @@ var DraggableComponent = ({
|
|
|
4751
4817
|
}
|
|
4752
4818
|
return cleanup;
|
|
4753
4819
|
}, [permissions.drag, zoneCompound]);
|
|
4820
|
+
const [, setRerender] = (0, import_react24.useState)(0);
|
|
4754
4821
|
const ref = (0, import_react24.useRef)(null);
|
|
4755
4822
|
const refSetter = (0, import_react24.useCallback)(
|
|
4756
4823
|
(el) => {
|
|
4757
4824
|
sortableRef(el);
|
|
4758
|
-
if (el) {
|
|
4825
|
+
if (ref.current !== el) {
|
|
4759
4826
|
ref.current = el;
|
|
4827
|
+
setRerender((update) => update + 1);
|
|
4760
4828
|
}
|
|
4761
4829
|
},
|
|
4762
4830
|
[sortableRef]
|
|
@@ -5203,7 +5271,7 @@ var import_react27 = require("react");
|
|
|
5203
5271
|
function useRenderedCallback(callback, deps) {
|
|
5204
5272
|
const manager = (0, import_react26.useDragDropManager)();
|
|
5205
5273
|
return (0, import_react27.useCallback)(
|
|
5206
|
-
(...args) => __async(
|
|
5274
|
+
(...args) => __async(null, null, function* () {
|
|
5207
5275
|
yield manager == null ? void 0 : manager.renderer.rendering;
|
|
5208
5276
|
return callback(...args);
|
|
5209
5277
|
}),
|
|
@@ -5408,8 +5476,9 @@ var Item = ({
|
|
|
5408
5476
|
);
|
|
5409
5477
|
};
|
|
5410
5478
|
var SlotRender = (0, import_react31.forwardRef)(
|
|
5411
|
-
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
|
5412
|
-
|
|
5479
|
+
function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
|
|
5480
|
+
const El = as != null ? as : "div";
|
|
5481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(El, { className, style, ref, children: content.map((item) => {
|
|
5413
5482
|
if (!config.components[item.type]) {
|
|
5414
5483
|
return null;
|
|
5415
5484
|
}
|
|
@@ -5531,26 +5600,26 @@ var registerOverlayPortal = (el, opts = {}) => {
|
|
|
5531
5600
|
capture: true
|
|
5532
5601
|
});
|
|
5533
5602
|
};
|
|
5534
|
-
if (
|
|
5535
|
-
el.addEventListener("focus", onFocus, { capture: true });
|
|
5536
|
-
el.addEventListener("blur", onBlur, { capture: true });
|
|
5537
|
-
} else if (disableDrag) {
|
|
5603
|
+
if (disableDrag) {
|
|
5538
5604
|
el.addEventListener("pointerdown", stopPropagation, {
|
|
5539
5605
|
capture: true
|
|
5540
5606
|
});
|
|
5607
|
+
} else if (disableDragOnFocus) {
|
|
5608
|
+
el.addEventListener("focus", onFocus, { capture: true });
|
|
5609
|
+
el.addEventListener("blur", onBlur, { capture: true });
|
|
5541
5610
|
}
|
|
5542
5611
|
el.setAttribute("data-puck-overlay-portal", "true");
|
|
5543
5612
|
return () => {
|
|
5544
5613
|
el.removeEventListener("mouseover", stopPropagation, {
|
|
5545
5614
|
capture: true
|
|
5546
5615
|
});
|
|
5547
|
-
if (
|
|
5548
|
-
el.removeEventListener("focus", onFocus, { capture: true });
|
|
5549
|
-
el.removeEventListener("blur", onFocus, { capture: true });
|
|
5550
|
-
} else if (disableDrag) {
|
|
5616
|
+
if (disableDrag) {
|
|
5551
5617
|
el.removeEventListener("pointerdown", stopPropagation, {
|
|
5552
5618
|
capture: true
|
|
5553
5619
|
});
|
|
5620
|
+
} else if (disableDragOnFocus) {
|
|
5621
|
+
el.removeEventListener("focus", onFocus, { capture: true });
|
|
5622
|
+
el.removeEventListener("blur", onBlur, { capture: true });
|
|
5554
5623
|
}
|
|
5555
5624
|
el.removeAttribute("data-puck-overlay-portal");
|
|
5556
5625
|
};
|
|
@@ -5558,7 +5627,7 @@ var registerOverlayPortal = (el, opts = {}) => {
|
|
|
5558
5627
|
|
|
5559
5628
|
// css-module:/home/runner/work/puck/puck/packages/core/components/InlineTextField/styles.module.css#css-module
|
|
5560
5629
|
init_react_import();
|
|
5561
|
-
var styles_module_default13 = { "InlineTextField": "
|
|
5630
|
+
var styles_module_default13 = { "InlineTextField": "_InlineTextField_104qp_1" };
|
|
5562
5631
|
|
|
5563
5632
|
// lib/data/set-deep.ts
|
|
5564
5633
|
init_react_import();
|
|
@@ -5632,7 +5701,7 @@ var InlineTextFieldInternal = ({
|
|
|
5632
5701
|
ref.current.replaceChildren(value);
|
|
5633
5702
|
}
|
|
5634
5703
|
const cleanupPortal = registerOverlayPortal(ref.current);
|
|
5635
|
-
const handleInput = (e) => __async(
|
|
5704
|
+
const handleInput = (e) => __async(null, null, function* () {
|
|
5636
5705
|
var _a2;
|
|
5637
5706
|
const appStore2 = appStoreApi.getState();
|
|
5638
5707
|
const node = appStore2.state.indexes.nodes[componentId];
|
|
@@ -5924,7 +5993,8 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
|
|
|
5924
5993
|
style,
|
|
5925
5994
|
className,
|
|
5926
5995
|
minEmptyHeight: userMinEmptyHeight = 128,
|
|
5927
|
-
collisionAxis
|
|
5996
|
+
collisionAxis,
|
|
5997
|
+
as
|
|
5928
5998
|
}, userRef) {
|
|
5929
5999
|
const ctx = (0, import_react34.useContext)(dropZoneContext);
|
|
5930
6000
|
const appStoreApi = useAppStoreApi();
|
|
@@ -6067,8 +6137,9 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
|
|
|
6067
6137
|
userMinEmptyHeight,
|
|
6068
6138
|
ref
|
|
6069
6139
|
});
|
|
6140
|
+
const El = as != null ? as : "div";
|
|
6070
6141
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
6071
|
-
|
|
6142
|
+
El,
|
|
6072
6143
|
{
|
|
6073
6144
|
className: `${getClassName18({
|
|
6074
6145
|
isRootZone,
|
|
@@ -6131,7 +6202,7 @@ var DropZoneRenderItem = ({
|
|
|
6131
6202
|
};
|
|
6132
6203
|
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZoneRender, __spreadValues({}, props));
|
|
6133
6204
|
var DropZoneRender = (0, import_react34.forwardRef)(
|
|
6134
|
-
function DropZoneRenderInternal({ className, style, zone }, ref) {
|
|
6205
|
+
function DropZoneRenderInternal({ className, style, zone, as }, ref) {
|
|
6135
6206
|
const ctx = (0, import_react34.useContext)(dropZoneContext);
|
|
6136
6207
|
const { areaId = "root" } = ctx || {};
|
|
6137
6208
|
const { config, data, metadata } = (0, import_react34.useContext)(renderContext);
|
|
@@ -6144,13 +6215,14 @@ var DropZoneRender = (0, import_react34.forwardRef)(
|
|
|
6144
6215
|
}
|
|
6145
6216
|
}
|
|
6146
6217
|
}, [content]);
|
|
6218
|
+
const El = as != null ? as : "div";
|
|
6147
6219
|
if (!data || !config) {
|
|
6148
6220
|
return null;
|
|
6149
6221
|
}
|
|
6150
6222
|
if (zoneCompound !== rootDroppableId) {
|
|
6151
6223
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
6152
6224
|
}
|
|
6153
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
6225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(El, { className, style, ref, children: content.map((item) => {
|
|
6154
6226
|
const Component = config.components[item.type];
|
|
6155
6227
|
if (Component) {
|
|
6156
6228
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
@@ -6456,7 +6528,8 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
|
|
|
6456
6528
|
|
|
6457
6529
|
// lib/insert-component.ts
|
|
6458
6530
|
init_react_import();
|
|
6459
|
-
var insertComponent = (componentType, zone, index, appStore) => __async(
|
|
6531
|
+
var insertComponent = (componentType, zone, index, appStore) => __async(null, null, function* () {
|
|
6532
|
+
const { getState } = appStore;
|
|
6460
6533
|
const id = generateId(componentType);
|
|
6461
6534
|
const insertActionData = {
|
|
6462
6535
|
type: "insert",
|
|
@@ -6465,8 +6538,9 @@ var insertComponent = (componentType, zone, index, appStore) => __async(void 0,
|
|
|
6465
6538
|
destinationZone: zone,
|
|
6466
6539
|
id
|
|
6467
6540
|
};
|
|
6468
|
-
const
|
|
6469
|
-
const insertedState = insertAction(
|
|
6541
|
+
const stateBefore = getState().state;
|
|
6542
|
+
const insertedState = insertAction(stateBefore, insertActionData, getState());
|
|
6543
|
+
const dispatch = getState().dispatch;
|
|
6470
6544
|
dispatch(__spreadProps(__spreadValues({}, insertActionData), {
|
|
6471
6545
|
// Dispatch insert rather set, as user's may rely on this via onAction
|
|
6472
6546
|
// We must always record history here so the insert is added to user history
|
|
@@ -6474,23 +6548,21 @@ var insertComponent = (componentType, zone, index, appStore) => __async(void 0,
|
|
|
6474
6548
|
// entries on insert - one for the initial insert, and one when the data resolves
|
|
6475
6549
|
recordHistory: true
|
|
6476
6550
|
}));
|
|
6477
|
-
const itemSelector = {
|
|
6478
|
-
index,
|
|
6479
|
-
zone
|
|
6480
|
-
};
|
|
6551
|
+
const itemSelector = { index, zone };
|
|
6481
6552
|
dispatch({ type: "setUi", ui: { itemSelector } });
|
|
6482
6553
|
const itemData = getItem(itemSelector, insertedState);
|
|
6483
|
-
if (itemData)
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6554
|
+
if (!itemData) return;
|
|
6555
|
+
const resolveComponentData2 = getState().resolveComponentData;
|
|
6556
|
+
const resolved = yield resolveComponentData2(itemData, "insert");
|
|
6557
|
+
if (!resolved.didChange) return;
|
|
6558
|
+
const latestItemSelector = getSelectorForId(getState().state, id);
|
|
6559
|
+
if (!latestItemSelector) return;
|
|
6560
|
+
dispatch({
|
|
6561
|
+
type: "replace",
|
|
6562
|
+
destinationZone: latestItemSelector.zone,
|
|
6563
|
+
destinationIndex: latestItemSelector.index,
|
|
6564
|
+
data: resolved.node
|
|
6565
|
+
});
|
|
6494
6566
|
});
|
|
6495
6567
|
|
|
6496
6568
|
// components/DragDropContext/index.tsx
|
|
@@ -6727,7 +6799,7 @@ var DragDropContextClient = ({
|
|
|
6727
6799
|
thisPreview.componentType,
|
|
6728
6800
|
thisPreview.zone,
|
|
6729
6801
|
thisPreview.index,
|
|
6730
|
-
appStore
|
|
6802
|
+
appStore
|
|
6731
6803
|
);
|
|
6732
6804
|
} else if (initialSelector.current) {
|
|
6733
6805
|
dispatch({
|
|
@@ -7048,7 +7120,7 @@ Drawer.Item = DrawerItem;
|
|
|
7048
7120
|
|
|
7049
7121
|
// components/Puck/index.tsx
|
|
7050
7122
|
init_react_import();
|
|
7051
|
-
var
|
|
7123
|
+
var import_react60 = require("react");
|
|
7052
7124
|
|
|
7053
7125
|
// components/SidebarSection/index.tsx
|
|
7054
7126
|
init_react_import();
|
|
@@ -7164,49 +7236,48 @@ var DefaultFields = ({
|
|
|
7164
7236
|
}) => {
|
|
7165
7237
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children });
|
|
7166
7238
|
};
|
|
7167
|
-
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(
|
|
7168
|
-
let currentProps;
|
|
7239
|
+
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
|
|
7169
7240
|
const { dispatch, state, selectedItem, resolveComponentData: resolveComponentData2 } = appStore.getState();
|
|
7170
7241
|
const { data, ui } = state;
|
|
7171
7242
|
const { itemSelector } = ui;
|
|
7172
7243
|
const rootProps = data.root.props || data.root;
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
} else {
|
|
7176
|
-
currentProps = rootProps;
|
|
7177
|
-
}
|
|
7178
|
-
const newProps = __spreadProps(__spreadValues({}, currentProps), {
|
|
7179
|
-
[fieldName]: value
|
|
7180
|
-
});
|
|
7244
|
+
const currentProps = selectedItem ? selectedItem.props : rootProps;
|
|
7245
|
+
const newProps = __spreadProps(__spreadValues({}, currentProps), { [fieldName]: value });
|
|
7181
7246
|
if (selectedItem && itemSelector) {
|
|
7247
|
+
const resolved = yield resolveComponentData2(
|
|
7248
|
+
__spreadProps(__spreadValues({}, selectedItem), { props: newProps }),
|
|
7249
|
+
"replace"
|
|
7250
|
+
);
|
|
7251
|
+
const latestSelector = getSelectorForId(
|
|
7252
|
+
appStore.getState().state,
|
|
7253
|
+
selectedItem.props.id
|
|
7254
|
+
);
|
|
7255
|
+
if (!latestSelector) return;
|
|
7182
7256
|
dispatch({
|
|
7183
7257
|
type: "replace",
|
|
7184
|
-
destinationIndex:
|
|
7185
|
-
destinationZone:
|
|
7186
|
-
data:
|
|
7187
|
-
|
|
7258
|
+
destinationIndex: latestSelector.index,
|
|
7259
|
+
destinationZone: latestSelector.zone || rootDroppableId,
|
|
7260
|
+
data: resolved.node,
|
|
7261
|
+
ui: updatedUi
|
|
7262
|
+
});
|
|
7263
|
+
return;
|
|
7264
|
+
}
|
|
7265
|
+
if (data.root.props) {
|
|
7266
|
+
dispatch({
|
|
7267
|
+
type: "replaceRoot",
|
|
7268
|
+
root: (yield resolveComponentData2(
|
|
7269
|
+
__spreadProps(__spreadValues({}, data.root), { props: newProps }),
|
|
7188
7270
|
"replace"
|
|
7189
7271
|
)).node,
|
|
7190
|
-
ui: updatedUi
|
|
7272
|
+
ui: __spreadValues(__spreadValues({}, ui), updatedUi),
|
|
7273
|
+
recordHistory: true
|
|
7191
7274
|
});
|
|
7192
|
-
|
|
7193
|
-
if (data.root.props) {
|
|
7194
|
-
dispatch({
|
|
7195
|
-
type: "replaceRoot",
|
|
7196
|
-
root: (yield resolveComponentData2(
|
|
7197
|
-
__spreadProps(__spreadValues({}, data.root), { props: newProps }),
|
|
7198
|
-
"replace"
|
|
7199
|
-
)).node,
|
|
7200
|
-
ui: __spreadValues(__spreadValues({}, ui), updatedUi),
|
|
7201
|
-
recordHistory: true
|
|
7202
|
-
});
|
|
7203
|
-
} else {
|
|
7204
|
-
dispatch({
|
|
7205
|
-
type: "setData",
|
|
7206
|
-
data: { root: newProps }
|
|
7207
|
-
});
|
|
7208
|
-
}
|
|
7275
|
+
return;
|
|
7209
7276
|
}
|
|
7277
|
+
dispatch({
|
|
7278
|
+
type: "setData",
|
|
7279
|
+
data: { root: newProps }
|
|
7280
|
+
});
|
|
7210
7281
|
});
|
|
7211
7282
|
var FieldsChild = ({ fieldName }) => {
|
|
7212
7283
|
const field = useAppStore((s) => s.fields.fields[fieldName]);
|
|
@@ -7533,7 +7604,7 @@ var CopyHostStyles = ({
|
|
|
7533
7604
|
let elements = [];
|
|
7534
7605
|
const hashes = {};
|
|
7535
7606
|
const lookupEl = (el) => elements.findIndex((elementMap) => elementMap.original === el);
|
|
7536
|
-
const mirrorEl = (el, inlineStyles = false) => __async(
|
|
7607
|
+
const mirrorEl = (el, inlineStyles = false) => __async(null, null, function* () {
|
|
7537
7608
|
let mirror;
|
|
7538
7609
|
if (el.nodeName === "LINK" && inlineStyles) {
|
|
7539
7610
|
mirror = document.createElement("style");
|
|
@@ -7565,7 +7636,7 @@ var CopyHostStyles = ({
|
|
|
7565
7636
|
}
|
|
7566
7637
|
return mirror;
|
|
7567
7638
|
});
|
|
7568
|
-
const addEl = (el) => __async(
|
|
7639
|
+
const addEl = (el) => __async(null, null, function* () {
|
|
7569
7640
|
const index = lookupEl(el);
|
|
7570
7641
|
if (index > -1) {
|
|
7571
7642
|
if (debug)
|
|
@@ -7638,7 +7709,7 @@ var CopyHostStyles = ({
|
|
|
7638
7709
|
const parentBody = parentDocument.getElementsByTagName("body")[0];
|
|
7639
7710
|
syncAttributes(parentBody, doc.body);
|
|
7640
7711
|
Promise.all(
|
|
7641
|
-
collectedStyles.map((styleNode, i) => __async(
|
|
7712
|
+
collectedStyles.map((styleNode, i) => __async(null, null, function* () {
|
|
7642
7713
|
if (styleNode.nodeName === "LINK") {
|
|
7643
7714
|
const linkHref = styleNode.href;
|
|
7644
7715
|
if (hrefs.indexOf(linkHref) > -1) {
|
|
@@ -8586,9 +8657,70 @@ var usePreviewModeHotkeys = () => {
|
|
|
8586
8657
|
useHotkey({ ctrl: true, i: true }, toggleInteractive);
|
|
8587
8658
|
};
|
|
8588
8659
|
|
|
8589
|
-
// lib/use-
|
|
8660
|
+
// lib/use-delete-hotkeys.ts
|
|
8590
8661
|
init_react_import();
|
|
8591
8662
|
var import_react55 = require("react");
|
|
8663
|
+
var isElementVisible = (element) => {
|
|
8664
|
+
let current = element;
|
|
8665
|
+
while (current && current !== document.body) {
|
|
8666
|
+
const style = window.getComputedStyle(current);
|
|
8667
|
+
if (style.display === "none" || style.visibility === "hidden" || style.opacity === "0" || current.getAttribute("aria-hidden") === "true" || current.hasAttribute("hidden")) {
|
|
8668
|
+
return false;
|
|
8669
|
+
}
|
|
8670
|
+
current = current.parentElement;
|
|
8671
|
+
}
|
|
8672
|
+
return true;
|
|
8673
|
+
};
|
|
8674
|
+
var shouldBlockDeleteHotkey = (e) => {
|
|
8675
|
+
var _a;
|
|
8676
|
+
if (e == null ? void 0 : e.defaultPrevented) return true;
|
|
8677
|
+
const origin = ((_a = e == null ? void 0 : e.composedPath) == null ? void 0 : _a.call(e)[0]) || (e == null ? void 0 : e.target) || document.activeElement;
|
|
8678
|
+
if (origin instanceof HTMLElement) {
|
|
8679
|
+
const tag = origin.tagName.toLowerCase();
|
|
8680
|
+
if (tag === "input" || tag === "textarea" || tag === "select") return true;
|
|
8681
|
+
if (origin.isContentEditable) return true;
|
|
8682
|
+
const role = origin.getAttribute("role");
|
|
8683
|
+
if (role === "textbox" || role === "combobox" || role === "searchbox" || role === "listbox" || role === "grid") {
|
|
8684
|
+
return true;
|
|
8685
|
+
}
|
|
8686
|
+
}
|
|
8687
|
+
const modal = document.querySelector(
|
|
8688
|
+
'dialog[open], [aria-modal="true"], [role="dialog"], [role="alertdialog"]'
|
|
8689
|
+
);
|
|
8690
|
+
if (modal && isElementVisible(modal)) {
|
|
8691
|
+
return true;
|
|
8692
|
+
}
|
|
8693
|
+
return false;
|
|
8694
|
+
};
|
|
8695
|
+
var useDeleteHotkeys = () => {
|
|
8696
|
+
const appStore = useAppStoreApi();
|
|
8697
|
+
const deleteSelectedComponent = (0, import_react55.useCallback)(
|
|
8698
|
+
(e) => {
|
|
8699
|
+
var _a;
|
|
8700
|
+
if (shouldBlockDeleteHotkey(e)) {
|
|
8701
|
+
return false;
|
|
8702
|
+
}
|
|
8703
|
+
const { state, dispatch, permissions, selectedItem } = appStore.getState();
|
|
8704
|
+
const sel = (_a = state.ui) == null ? void 0 : _a.itemSelector;
|
|
8705
|
+
if (!(sel == null ? void 0 : sel.zone) || !selectedItem) return true;
|
|
8706
|
+
if (!permissions.getPermissions({ item: selectedItem }).delete)
|
|
8707
|
+
return true;
|
|
8708
|
+
dispatch({
|
|
8709
|
+
type: "remove",
|
|
8710
|
+
index: sel.index,
|
|
8711
|
+
zone: sel.zone
|
|
8712
|
+
});
|
|
8713
|
+
return true;
|
|
8714
|
+
},
|
|
8715
|
+
[appStore]
|
|
8716
|
+
);
|
|
8717
|
+
useHotkey({ delete: true }, deleteSelectedComponent);
|
|
8718
|
+
useHotkey({ backspace: true }, deleteSelectedComponent);
|
|
8719
|
+
};
|
|
8720
|
+
|
|
8721
|
+
// lib/use-puck.ts
|
|
8722
|
+
init_react_import();
|
|
8723
|
+
var import_react56 = require("react");
|
|
8592
8724
|
var import_zustand6 = require("zustand");
|
|
8593
8725
|
var generateUsePuck = (store) => {
|
|
8594
8726
|
const history = {
|
|
@@ -8615,7 +8747,7 @@ var generateUsePuck = (store) => {
|
|
|
8615
8747
|
};
|
|
8616
8748
|
return storeData;
|
|
8617
8749
|
};
|
|
8618
|
-
var UsePuckStoreContext = (0,
|
|
8750
|
+
var UsePuckStoreContext = (0, import_react56.createContext)(
|
|
8619
8751
|
null
|
|
8620
8752
|
);
|
|
8621
8753
|
var convertToPickedStore = (store) => {
|
|
@@ -8629,12 +8761,12 @@ var convertToPickedStore = (store) => {
|
|
|
8629
8761
|
};
|
|
8630
8762
|
};
|
|
8631
8763
|
var useRegisterUsePuckStore = (appStore) => {
|
|
8632
|
-
const [usePuckStore] = (0,
|
|
8764
|
+
const [usePuckStore] = (0, import_react56.useState)(
|
|
8633
8765
|
() => (0, import_zustand6.createStore)(
|
|
8634
8766
|
() => generateUsePuck(convertToPickedStore(appStore.getState()))
|
|
8635
8767
|
)
|
|
8636
8768
|
);
|
|
8637
|
-
(0,
|
|
8769
|
+
(0, import_react56.useEffect)(() => {
|
|
8638
8770
|
return appStore.subscribe(
|
|
8639
8771
|
(store) => convertToPickedStore(store),
|
|
8640
8772
|
(pickedStore) => {
|
|
@@ -8646,19 +8778,19 @@ var useRegisterUsePuckStore = (appStore) => {
|
|
|
8646
8778
|
};
|
|
8647
8779
|
function createUsePuck() {
|
|
8648
8780
|
return function usePuck2(selector) {
|
|
8649
|
-
const usePuckApi = (0,
|
|
8781
|
+
const usePuckApi = (0, import_react56.useContext)(UsePuckStoreContext);
|
|
8650
8782
|
if (!usePuckApi) {
|
|
8651
8783
|
throw new Error("usePuck must be used inside <Puck>.");
|
|
8652
8784
|
}
|
|
8653
8785
|
const result = (0, import_zustand6.useStore)(
|
|
8654
8786
|
usePuckApi,
|
|
8655
|
-
selector != null ? selector : (s) => s
|
|
8787
|
+
selector != null ? selector : ((s) => s)
|
|
8656
8788
|
);
|
|
8657
8789
|
return result;
|
|
8658
8790
|
};
|
|
8659
8791
|
}
|
|
8660
8792
|
function usePuck() {
|
|
8661
|
-
(0,
|
|
8793
|
+
(0, import_react56.useEffect)(() => {
|
|
8662
8794
|
console.warn(
|
|
8663
8795
|
"You're using the `usePuck` method without a selector, which may cause unnecessary re-renders. Replace with `createUsePuck` and provide a selector for improved performance."
|
|
8664
8796
|
);
|
|
@@ -8666,7 +8798,7 @@ function usePuck() {
|
|
|
8666
8798
|
return createUsePuck()((s) => s);
|
|
8667
8799
|
}
|
|
8668
8800
|
function useGetPuck() {
|
|
8669
|
-
const usePuckApi = (0,
|
|
8801
|
+
const usePuckApi = (0, import_react56.useContext)(UsePuckStoreContext);
|
|
8670
8802
|
if (!usePuckApi) {
|
|
8671
8803
|
throw new Error("usePuckGet must be used inside <Puck>.");
|
|
8672
8804
|
}
|
|
@@ -8674,11 +8806,11 @@ function useGetPuck() {
|
|
|
8674
8806
|
}
|
|
8675
8807
|
|
|
8676
8808
|
// components/Puck/index.tsx
|
|
8677
|
-
var
|
|
8809
|
+
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
|
8678
8810
|
|
|
8679
8811
|
// components/Puck/components/Header/index.tsx
|
|
8680
8812
|
init_react_import();
|
|
8681
|
-
var
|
|
8813
|
+
var import_react57 = require("react");
|
|
8682
8814
|
|
|
8683
8815
|
// components/MenuBar/index.tsx
|
|
8684
8816
|
init_react_import();
|
|
@@ -8760,7 +8892,7 @@ var HeaderInner = () => {
|
|
|
8760
8892
|
} = usePropsContext();
|
|
8761
8893
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
8762
8894
|
const appStore = useAppStoreApi();
|
|
8763
|
-
const defaultHeaderRender = (0,
|
|
8895
|
+
const defaultHeaderRender = (0, import_react57.useMemo)(() => {
|
|
8764
8896
|
if (renderHeader) {
|
|
8765
8897
|
console.warn(
|
|
8766
8898
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
|
@@ -8775,7 +8907,7 @@ var HeaderInner = () => {
|
|
|
8775
8907
|
}
|
|
8776
8908
|
return DefaultOverride;
|
|
8777
8909
|
}, [renderHeader]);
|
|
8778
|
-
const defaultHeaderActionsRender = (0,
|
|
8910
|
+
const defaultHeaderActionsRender = (0, import_react57.useMemo)(() => {
|
|
8779
8911
|
if (renderHeaderActions) {
|
|
8780
8912
|
console.warn(
|
|
8781
8913
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
|
@@ -8795,7 +8927,7 @@ var HeaderInner = () => {
|
|
|
8795
8927
|
const CustomHeaderActions = useAppStore(
|
|
8796
8928
|
(s) => s.overrides.headerActions || defaultHeaderActionsRender
|
|
8797
8929
|
);
|
|
8798
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
8930
|
+
const [menuOpen, setMenuOpen] = (0, import_react57.useState)(false);
|
|
8799
8931
|
const rootTitle = useAppStore((s) => {
|
|
8800
8932
|
var _a, _b;
|
|
8801
8933
|
const rootData = (_a = s.state.indexes.nodes["root"]) == null ? void 0 : _a.data;
|
|
@@ -8805,7 +8937,7 @@ var HeaderInner = () => {
|
|
|
8805
8937
|
const rightSideBarVisible = useAppStore(
|
|
8806
8938
|
(s) => s.state.ui.rightSideBarVisible
|
|
8807
8939
|
);
|
|
8808
|
-
const toggleSidebars = (0,
|
|
8940
|
+
const toggleSidebars = (0, import_react57.useCallback)(
|
|
8809
8941
|
(sidebar) => {
|
|
8810
8942
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
|
8811
8943
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
|
@@ -8908,14 +9040,14 @@ var HeaderInner = () => {
|
|
|
8908
9040
|
}
|
|
8909
9041
|
);
|
|
8910
9042
|
};
|
|
8911
|
-
var Header = (0,
|
|
9043
|
+
var Header = (0, import_react57.memo)(HeaderInner);
|
|
8912
9044
|
|
|
8913
9045
|
// components/Puck/components/Sidebar/index.tsx
|
|
8914
9046
|
init_react_import();
|
|
8915
9047
|
|
|
8916
9048
|
// components/Puck/components/ResizeHandle/index.tsx
|
|
8917
9049
|
init_react_import();
|
|
8918
|
-
var
|
|
9050
|
+
var import_react58 = require("react");
|
|
8919
9051
|
|
|
8920
9052
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/ResizeHandle/styles.module.css#css-module
|
|
8921
9053
|
init_react_import();
|
|
@@ -8932,11 +9064,11 @@ var ResizeHandle = ({
|
|
|
8932
9064
|
}) => {
|
|
8933
9065
|
const { frameRef } = useCanvasFrame();
|
|
8934
9066
|
const resetAutoZoom = useResetAutoZoom(frameRef);
|
|
8935
|
-
const handleRef = (0,
|
|
8936
|
-
const isDragging = (0,
|
|
8937
|
-
const startX = (0,
|
|
8938
|
-
const startWidth = (0,
|
|
8939
|
-
const handleMouseMove = (0,
|
|
9067
|
+
const handleRef = (0, import_react58.useRef)(null);
|
|
9068
|
+
const isDragging = (0, import_react58.useRef)(false);
|
|
9069
|
+
const startX = (0, import_react58.useRef)(0);
|
|
9070
|
+
const startWidth = (0, import_react58.useRef)(0);
|
|
9071
|
+
const handleMouseMove = (0, import_react58.useCallback)(
|
|
8940
9072
|
(e) => {
|
|
8941
9073
|
if (!isDragging.current) return;
|
|
8942
9074
|
const delta = e.clientX - startX.current;
|
|
@@ -8947,7 +9079,7 @@ var ResizeHandle = ({
|
|
|
8947
9079
|
},
|
|
8948
9080
|
[onResize, position]
|
|
8949
9081
|
);
|
|
8950
|
-
const handleMouseUp = (0,
|
|
9082
|
+
const handleMouseUp = (0, import_react58.useCallback)(() => {
|
|
8951
9083
|
var _a;
|
|
8952
9084
|
if (!isDragging.current) return;
|
|
8953
9085
|
isDragging.current = false;
|
|
@@ -8963,7 +9095,7 @@ var ResizeHandle = ({
|
|
|
8963
9095
|
onResizeEnd(finalWidth);
|
|
8964
9096
|
resetAutoZoom();
|
|
8965
9097
|
}, [onResizeEnd]);
|
|
8966
|
-
const handleMouseDown = (0,
|
|
9098
|
+
const handleMouseDown = (0, import_react58.useCallback)(
|
|
8967
9099
|
(e) => {
|
|
8968
9100
|
var _a;
|
|
8969
9101
|
isDragging.current = true;
|
|
@@ -9023,14 +9155,14 @@ var Sidebar = ({
|
|
|
9023
9155
|
|
|
9024
9156
|
// lib/use-sidebar-resize.ts
|
|
9025
9157
|
init_react_import();
|
|
9026
|
-
var
|
|
9158
|
+
var import_react59 = require("react");
|
|
9027
9159
|
function useSidebarResize(position, dispatch) {
|
|
9028
|
-
const [width, setWidth] = (0,
|
|
9029
|
-
const sidebarRef = (0,
|
|
9160
|
+
const [width, setWidth] = (0, import_react59.useState)(null);
|
|
9161
|
+
const sidebarRef = (0, import_react59.useRef)(null);
|
|
9030
9162
|
const storeWidth = useAppStore(
|
|
9031
9163
|
(s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
|
|
9032
9164
|
);
|
|
9033
|
-
(0,
|
|
9165
|
+
(0, import_react59.useEffect)(() => {
|
|
9034
9166
|
if (typeof window !== "undefined" && !storeWidth) {
|
|
9035
9167
|
try {
|
|
9036
9168
|
const savedWidths = localStorage.getItem("puck-sidebar-widths");
|
|
@@ -9055,12 +9187,12 @@ function useSidebarResize(position, dispatch) {
|
|
|
9055
9187
|
}
|
|
9056
9188
|
}
|
|
9057
9189
|
}, [dispatch, position, storeWidth]);
|
|
9058
|
-
(0,
|
|
9190
|
+
(0, import_react59.useEffect)(() => {
|
|
9059
9191
|
if (storeWidth !== void 0) {
|
|
9060
9192
|
setWidth(storeWidth);
|
|
9061
9193
|
}
|
|
9062
9194
|
}, [storeWidth]);
|
|
9063
|
-
const handleResizeEnd = (0,
|
|
9195
|
+
const handleResizeEnd = (0, import_react59.useCallback)(
|
|
9064
9196
|
(width2) => {
|
|
9065
9197
|
dispatch({
|
|
9066
9198
|
type: "setUi",
|
|
@@ -9102,6 +9234,15 @@ function useSidebarResize(position, dispatch) {
|
|
|
9102
9234
|
};
|
|
9103
9235
|
}
|
|
9104
9236
|
|
|
9237
|
+
// lib/data/to-component.ts
|
|
9238
|
+
init_react_import();
|
|
9239
|
+
var toComponent = (item) => {
|
|
9240
|
+
return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
|
|
9241
|
+
props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
|
|
9242
|
+
type: "root"
|
|
9243
|
+
});
|
|
9244
|
+
};
|
|
9245
|
+
|
|
9105
9246
|
// components/Puck/index.tsx
|
|
9106
9247
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
9107
9248
|
var getClassName31 = get_class_name_factory_default("Puck", styles_module_default15);
|
|
@@ -9115,11 +9256,11 @@ var FieldSideBar = () => {
|
|
|
9115
9256
|
);
|
|
9116
9257
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Fields, {}) });
|
|
9117
9258
|
};
|
|
9118
|
-
var propsContext = (0,
|
|
9259
|
+
var propsContext = (0, import_react60.createContext)({});
|
|
9119
9260
|
function PropsProvider(props) {
|
|
9120
9261
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(propsContext.Provider, { value: props, children: props.children });
|
|
9121
9262
|
}
|
|
9122
|
-
var usePropsContext = () => (0,
|
|
9263
|
+
var usePropsContext = () => (0, import_react60.useContext)(propsContext);
|
|
9123
9264
|
function PuckProvider({ children }) {
|
|
9124
9265
|
const {
|
|
9125
9266
|
config,
|
|
@@ -9136,14 +9277,14 @@ function PuckProvider({ children }) {
|
|
|
9136
9277
|
onAction,
|
|
9137
9278
|
fieldTransforms
|
|
9138
9279
|
} = usePropsContext();
|
|
9139
|
-
const iframe = (0,
|
|
9280
|
+
const iframe = (0, import_react60.useMemo)(
|
|
9140
9281
|
() => __spreadValues({
|
|
9141
9282
|
enabled: true,
|
|
9142
9283
|
waitForStyles: true
|
|
9143
9284
|
}, _iframe),
|
|
9144
9285
|
[_iframe]
|
|
9145
9286
|
);
|
|
9146
|
-
const [generatedAppState] = (0,
|
|
9287
|
+
const [generatedAppState] = (0, import_react60.useState)(() => {
|
|
9147
9288
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
9148
9289
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
|
9149
9290
|
let clientUiState = {};
|
|
@@ -9178,9 +9319,13 @@ function PuckProvider({ children }) {
|
|
|
9178
9319
|
}
|
|
9179
9320
|
const rootProps = ((_h = initialData == null ? void 0 : initialData.root) == null ? void 0 : _h.props) || (initialData == null ? void 0 : initialData.root) || {};
|
|
9180
9321
|
const defaultedRootProps = __spreadValues(__spreadValues({}, (_i = config.root) == null ? void 0 : _i.defaultProps), rootProps);
|
|
9322
|
+
const root = populateIds(
|
|
9323
|
+
toComponent(__spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: defaultedRootProps })),
|
|
9324
|
+
config
|
|
9325
|
+
);
|
|
9181
9326
|
const newAppState = __spreadProps(__spreadValues({}, defaultAppState), {
|
|
9182
9327
|
data: __spreadProps(__spreadValues({}, initialData), {
|
|
9183
|
-
root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props:
|
|
9328
|
+
root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: root.props }),
|
|
9184
9329
|
content: initialData.content || []
|
|
9185
9330
|
}),
|
|
9186
9331
|
ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
|
|
@@ -9203,7 +9348,7 @@ function PuckProvider({ children }) {
|
|
|
9203
9348
|
return walkAppState(newAppState, config);
|
|
9204
9349
|
});
|
|
9205
9350
|
const { appendData = true } = _initialHistory || {};
|
|
9206
|
-
const [blendedHistories] = (0,
|
|
9351
|
+
const [blendedHistories] = (0, import_react60.useState)(
|
|
9207
9352
|
[
|
|
9208
9353
|
...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
|
|
9209
9354
|
...appendData ? [{ state: generatedAppState }] : []
|
|
@@ -9217,13 +9362,18 @@ function PuckProvider({ children }) {
|
|
|
9217
9362
|
});
|
|
9218
9363
|
})
|
|
9219
9364
|
);
|
|
9220
|
-
const initialHistoryIndex = (
|
|
9365
|
+
const initialHistoryIndex = (0, import_react60.useMemo)(() => {
|
|
9366
|
+
if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
|
|
9367
|
+
return _initialHistory == null ? void 0 : _initialHistory.index;
|
|
9368
|
+
}
|
|
9369
|
+
return blendedHistories.length - 1;
|
|
9370
|
+
}, []);
|
|
9221
9371
|
const initialAppState = blendedHistories[initialHistoryIndex].state;
|
|
9222
9372
|
const loadedOverrides = useLoadedOverrides({
|
|
9223
9373
|
overrides,
|
|
9224
9374
|
plugins
|
|
9225
9375
|
});
|
|
9226
|
-
const loadedFieldTransforms = (0,
|
|
9376
|
+
const loadedFieldTransforms = (0, import_react60.useMemo)(() => {
|
|
9227
9377
|
const _plugins = plugins || [];
|
|
9228
9378
|
const pluginFieldTransforms = _plugins.reduce(
|
|
9229
9379
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
@@ -9231,7 +9381,7 @@ function PuckProvider({ children }) {
|
|
|
9231
9381
|
);
|
|
9232
9382
|
return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
|
|
9233
9383
|
}, [fieldTransforms, plugins]);
|
|
9234
|
-
const generateAppStore = (0,
|
|
9384
|
+
const generateAppStore = (0, import_react60.useCallback)(
|
|
9235
9385
|
(state) => {
|
|
9236
9386
|
return {
|
|
9237
9387
|
state,
|
|
@@ -9257,15 +9407,15 @@ function PuckProvider({ children }) {
|
|
|
9257
9407
|
loadedFieldTransforms
|
|
9258
9408
|
]
|
|
9259
9409
|
);
|
|
9260
|
-
const [appStore] = (0,
|
|
9410
|
+
const [appStore] = (0, import_react60.useState)(
|
|
9261
9411
|
() => createAppStore(generateAppStore(initialAppState))
|
|
9262
9412
|
);
|
|
9263
|
-
(0,
|
|
9413
|
+
(0, import_react60.useEffect)(() => {
|
|
9264
9414
|
if (process.env.NODE_ENV !== "production") {
|
|
9265
9415
|
window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
|
|
9266
9416
|
}
|
|
9267
9417
|
}, [appStore]);
|
|
9268
|
-
(0,
|
|
9418
|
+
(0, import_react60.useEffect)(() => {
|
|
9269
9419
|
const state = appStore.getState().state;
|
|
9270
9420
|
appStore.setState(__spreadValues({}, generateAppStore(state)));
|
|
9271
9421
|
}, [config, plugins, loadedOverrides, viewports, iframe, onAction, metadata]);
|
|
@@ -9274,22 +9424,22 @@ function PuckProvider({ children }) {
|
|
|
9274
9424
|
index: initialHistoryIndex,
|
|
9275
9425
|
initialAppState
|
|
9276
9426
|
});
|
|
9277
|
-
const previousData = (0,
|
|
9278
|
-
(0,
|
|
9279
|
-
appStore.subscribe(
|
|
9427
|
+
const previousData = (0, import_react60.useRef)(null);
|
|
9428
|
+
(0, import_react60.useEffect)(() => {
|
|
9429
|
+
return appStore.subscribe(
|
|
9280
9430
|
(s) => s.state.data,
|
|
9281
9431
|
(data) => {
|
|
9282
9432
|
if (onChange) {
|
|
9283
|
-
if ((0,
|
|
9433
|
+
if ((0, import_fast_deep_equal.default)(data, previousData.current)) return;
|
|
9284
9434
|
onChange(data);
|
|
9285
9435
|
previousData.current = data;
|
|
9286
9436
|
}
|
|
9287
9437
|
}
|
|
9288
9438
|
);
|
|
9289
|
-
}, []);
|
|
9439
|
+
}, [onChange]);
|
|
9290
9440
|
useRegisterPermissionsSlice(appStore, permissions);
|
|
9291
9441
|
const uPuckStore = useRegisterUsePuckStore(appStore);
|
|
9292
|
-
(0,
|
|
9442
|
+
(0, import_react60.useEffect)(() => {
|
|
9293
9443
|
const { resolveAndCommitData } = appStore.getState();
|
|
9294
9444
|
resolveAndCommitData();
|
|
9295
9445
|
}, []);
|
|
@@ -9301,7 +9451,7 @@ function PuckLayout({ children }) {
|
|
|
9301
9451
|
dnd,
|
|
9302
9452
|
initialHistory: _initialHistory
|
|
9303
9453
|
} = usePropsContext();
|
|
9304
|
-
const iframe = (0,
|
|
9454
|
+
const iframe = (0, import_react60.useMemo)(
|
|
9305
9455
|
() => __spreadValues({
|
|
9306
9456
|
enabled: true,
|
|
9307
9457
|
waitForStyles: true
|
|
@@ -9326,7 +9476,7 @@ function PuckLayout({ children }) {
|
|
|
9326
9476
|
sidebarRef: rightSidebarRef,
|
|
9327
9477
|
handleResizeEnd: handleRightSidebarResizeEnd
|
|
9328
9478
|
} = useSidebarResize("right", dispatch);
|
|
9329
|
-
(0,
|
|
9479
|
+
(0, import_react60.useEffect)(() => {
|
|
9330
9480
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
9331
9481
|
dispatch({
|
|
9332
9482
|
type: "setUi",
|
|
@@ -9350,17 +9500,18 @@ function PuckLayout({ children }) {
|
|
|
9350
9500
|
};
|
|
9351
9501
|
}, []);
|
|
9352
9502
|
const overrides = useAppStore((s) => s.overrides);
|
|
9353
|
-
const CustomPuck = (0,
|
|
9503
|
+
const CustomPuck = (0, import_react60.useMemo)(
|
|
9354
9504
|
() => overrides.puck || DefaultOverride,
|
|
9355
9505
|
[overrides]
|
|
9356
9506
|
);
|
|
9357
|
-
const [mounted, setMounted] = (0,
|
|
9358
|
-
(0,
|
|
9507
|
+
const [mounted, setMounted] = (0, import_react60.useState)(false);
|
|
9508
|
+
(0, import_react60.useEffect)(() => {
|
|
9359
9509
|
setMounted(true);
|
|
9360
9510
|
}, []);
|
|
9361
9511
|
const ready = useAppStore((s) => s.status === "READY");
|
|
9362
9512
|
useMonitorHotkeys();
|
|
9363
|
-
(
|
|
9513
|
+
useDeleteHotkeys();
|
|
9514
|
+
(0, import_react60.useEffect)(() => {
|
|
9364
9515
|
if (ready && iframe.enabled) {
|
|
9365
9516
|
const frameDoc = getFrame();
|
|
9366
9517
|
if (frameDoc) {
|
|
@@ -9598,22 +9749,11 @@ function transformProps(data, propTransforms, config = { components: {} }) {
|
|
|
9598
9749
|
|
|
9599
9750
|
// lib/resolve-all-data.ts
|
|
9600
9751
|
init_react_import();
|
|
9601
|
-
|
|
9602
|
-
// lib/data/to-component.ts
|
|
9603
|
-
init_react_import();
|
|
9604
|
-
var toComponent = (item) => {
|
|
9605
|
-
return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
|
|
9606
|
-
props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
|
|
9607
|
-
type: "root"
|
|
9608
|
-
});
|
|
9609
|
-
};
|
|
9610
|
-
|
|
9611
|
-
// lib/resolve-all-data.ts
|
|
9612
9752
|
function resolveAllData(_0, _1) {
|
|
9613
9753
|
return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
|
|
9614
9754
|
var _a;
|
|
9615
9755
|
const defaultedData = defaultData(data);
|
|
9616
|
-
const resolveNode = (_node) => __async(
|
|
9756
|
+
const resolveNode = (_node) => __async(null, null, function* () {
|
|
9617
9757
|
const node = toComponent(_node);
|
|
9618
9758
|
onResolveStart == null ? void 0 : onResolveStart(node);
|
|
9619
9759
|
const resolved = (yield resolveComponentData(
|
|
@@ -9634,13 +9774,13 @@ function resolveAllData(_0, _1) {
|
|
|
9634
9774
|
onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
|
|
9635
9775
|
return resolvedDeep;
|
|
9636
9776
|
});
|
|
9637
|
-
const processContent = (content) => __async(
|
|
9777
|
+
const processContent = (content) => __async(null, null, function* () {
|
|
9638
9778
|
return Promise.all(content.map(resolveNode));
|
|
9639
9779
|
});
|
|
9640
|
-
const processZones = () => __async(
|
|
9780
|
+
const processZones = () => __async(null, null, function* () {
|
|
9641
9781
|
var _a2;
|
|
9642
9782
|
const zones = (_a2 = data.zones) != null ? _a2 : {};
|
|
9643
|
-
Object.entries(zones).forEach((_02) => __async(
|
|
9783
|
+
Object.entries(zones).forEach((_02) => __async(null, [_02], function* ([zoneKey, content]) {
|
|
9644
9784
|
zones[zoneKey] = yield Promise.all(content.map(resolveNode));
|
|
9645
9785
|
}));
|
|
9646
9786
|
return zones;
|
|
@@ -9650,7 +9790,7 @@ function resolveAllData(_0, _1) {
|
|
|
9650
9790
|
content: yield processContent(defaultedData.content),
|
|
9651
9791
|
zones: yield processZones()
|
|
9652
9792
|
};
|
|
9653
|
-
Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(
|
|
9793
|
+
Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(null, null, function* () {
|
|
9654
9794
|
const content = defaultedData.zones[zoneKey];
|
|
9655
9795
|
dynamic.zones[zoneKey] = yield processContent(content);
|
|
9656
9796
|
}), {});
|
|
@@ -9693,269 +9833,38 @@ classnames/index.js:
|
|
|
9693
9833
|
*)
|
|
9694
9834
|
|
|
9695
9835
|
lucide-react/dist/esm/shared/src/utils.js:
|
|
9696
|
-
(**
|
|
9697
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9698
|
-
*
|
|
9699
|
-
* This source code is licensed under the ISC license.
|
|
9700
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9701
|
-
*)
|
|
9702
|
-
|
|
9703
9836
|
lucide-react/dist/esm/defaultAttributes.js:
|
|
9704
|
-
(**
|
|
9705
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9706
|
-
*
|
|
9707
|
-
* This source code is licensed under the ISC license.
|
|
9708
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9709
|
-
*)
|
|
9710
|
-
|
|
9711
9837
|
lucide-react/dist/esm/Icon.js:
|
|
9712
|
-
(**
|
|
9713
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9714
|
-
*
|
|
9715
|
-
* This source code is licensed under the ISC license.
|
|
9716
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9717
|
-
*)
|
|
9718
|
-
|
|
9719
9838
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
9720
|
-
(**
|
|
9721
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9722
|
-
*
|
|
9723
|
-
* This source code is licensed under the ISC license.
|
|
9724
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9725
|
-
*)
|
|
9726
|
-
|
|
9727
9839
|
lucide-react/dist/esm/icons/chevron-down.js:
|
|
9728
|
-
(**
|
|
9729
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9730
|
-
*
|
|
9731
|
-
* This source code is licensed under the ISC license.
|
|
9732
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9733
|
-
*)
|
|
9734
|
-
|
|
9735
9840
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
9736
|
-
(**
|
|
9737
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9738
|
-
*
|
|
9739
|
-
* This source code is licensed under the ISC license.
|
|
9740
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9741
|
-
*)
|
|
9742
|
-
|
|
9743
9841
|
lucide-react/dist/esm/icons/chevron-up.js:
|
|
9744
|
-
(**
|
|
9745
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9746
|
-
*
|
|
9747
|
-
* This source code is licensed under the ISC license.
|
|
9748
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9749
|
-
*)
|
|
9750
|
-
|
|
9751
9842
|
lucide-react/dist/esm/icons/circle-check-big.js:
|
|
9752
|
-
(**
|
|
9753
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9754
|
-
*
|
|
9755
|
-
* This source code is licensed under the ISC license.
|
|
9756
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9757
|
-
*)
|
|
9758
|
-
|
|
9759
9843
|
lucide-react/dist/esm/icons/copy.js:
|
|
9760
|
-
(**
|
|
9761
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9762
|
-
*
|
|
9763
|
-
* This source code is licensed under the ISC license.
|
|
9764
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9765
|
-
*)
|
|
9766
|
-
|
|
9767
9844
|
lucide-react/dist/esm/icons/corner-left-up.js:
|
|
9768
|
-
(**
|
|
9769
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9770
|
-
*
|
|
9771
|
-
* This source code is licensed under the ISC license.
|
|
9772
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9773
|
-
*)
|
|
9774
|
-
|
|
9775
9845
|
lucide-react/dist/esm/icons/ellipsis-vertical.js:
|
|
9776
|
-
(**
|
|
9777
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9778
|
-
*
|
|
9779
|
-
* This source code is licensed under the ISC license.
|
|
9780
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9781
|
-
*)
|
|
9782
|
-
|
|
9783
9846
|
lucide-react/dist/esm/icons/globe.js:
|
|
9784
|
-
(**
|
|
9785
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9786
|
-
*
|
|
9787
|
-
* This source code is licensed under the ISC license.
|
|
9788
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9789
|
-
*)
|
|
9790
|
-
|
|
9791
9847
|
lucide-react/dist/esm/icons/hash.js:
|
|
9792
|
-
(**
|
|
9793
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9794
|
-
*
|
|
9795
|
-
* This source code is licensed under the ISC license.
|
|
9796
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9797
|
-
*)
|
|
9798
|
-
|
|
9799
9848
|
lucide-react/dist/esm/icons/layers.js:
|
|
9800
|
-
(**
|
|
9801
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9802
|
-
*
|
|
9803
|
-
* This source code is licensed under the ISC license.
|
|
9804
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9805
|
-
*)
|
|
9806
|
-
|
|
9807
9849
|
lucide-react/dist/esm/icons/layout-grid.js:
|
|
9808
|
-
(**
|
|
9809
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9810
|
-
*
|
|
9811
|
-
* This source code is licensed under the ISC license.
|
|
9812
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9813
|
-
*)
|
|
9814
|
-
|
|
9815
9850
|
lucide-react/dist/esm/icons/link.js:
|
|
9816
|
-
(**
|
|
9817
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9818
|
-
*
|
|
9819
|
-
* This source code is licensed under the ISC license.
|
|
9820
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9821
|
-
*)
|
|
9822
|
-
|
|
9823
9851
|
lucide-react/dist/esm/icons/list.js:
|
|
9824
|
-
(**
|
|
9825
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9826
|
-
*
|
|
9827
|
-
* This source code is licensed under the ISC license.
|
|
9828
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9829
|
-
*)
|
|
9830
|
-
|
|
9831
9852
|
lucide-react/dist/esm/icons/lock-open.js:
|
|
9832
|
-
(**
|
|
9833
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9834
|
-
*
|
|
9835
|
-
* This source code is licensed under the ISC license.
|
|
9836
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9837
|
-
*)
|
|
9838
|
-
|
|
9839
9853
|
lucide-react/dist/esm/icons/lock.js:
|
|
9840
|
-
(**
|
|
9841
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9842
|
-
*
|
|
9843
|
-
* This source code is licensed under the ISC license.
|
|
9844
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9845
|
-
*)
|
|
9846
|
-
|
|
9847
9854
|
lucide-react/dist/esm/icons/monitor.js:
|
|
9848
|
-
(**
|
|
9849
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9850
|
-
*
|
|
9851
|
-
* This source code is licensed under the ISC license.
|
|
9852
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9853
|
-
*)
|
|
9854
|
-
|
|
9855
9855
|
lucide-react/dist/esm/icons/panel-left.js:
|
|
9856
|
-
(**
|
|
9857
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9858
|
-
*
|
|
9859
|
-
* This source code is licensed under the ISC license.
|
|
9860
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9861
|
-
*)
|
|
9862
|
-
|
|
9863
9856
|
lucide-react/dist/esm/icons/panel-right.js:
|
|
9864
|
-
(**
|
|
9865
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9866
|
-
*
|
|
9867
|
-
* This source code is licensed under the ISC license.
|
|
9868
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9869
|
-
*)
|
|
9870
|
-
|
|
9871
9857
|
lucide-react/dist/esm/icons/plus.js:
|
|
9872
|
-
(**
|
|
9873
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9874
|
-
*
|
|
9875
|
-
* This source code is licensed under the ISC license.
|
|
9876
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9877
|
-
*)
|
|
9878
|
-
|
|
9879
9858
|
lucide-react/dist/esm/icons/redo-2.js:
|
|
9880
|
-
(**
|
|
9881
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9882
|
-
*
|
|
9883
|
-
* This source code is licensed under the ISC license.
|
|
9884
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9885
|
-
*)
|
|
9886
|
-
|
|
9887
9859
|
lucide-react/dist/esm/icons/search.js:
|
|
9888
|
-
(**
|
|
9889
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9890
|
-
*
|
|
9891
|
-
* This source code is licensed under the ISC license.
|
|
9892
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9893
|
-
*)
|
|
9894
|
-
|
|
9895
9860
|
lucide-react/dist/esm/icons/sliders-horizontal.js:
|
|
9896
|
-
(**
|
|
9897
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9898
|
-
*
|
|
9899
|
-
* This source code is licensed under the ISC license.
|
|
9900
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9901
|
-
*)
|
|
9902
|
-
|
|
9903
9861
|
lucide-react/dist/esm/icons/smartphone.js:
|
|
9904
|
-
(**
|
|
9905
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9906
|
-
*
|
|
9907
|
-
* This source code is licensed under the ISC license.
|
|
9908
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9909
|
-
*)
|
|
9910
|
-
|
|
9911
9862
|
lucide-react/dist/esm/icons/tablet.js:
|
|
9912
|
-
(**
|
|
9913
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9914
|
-
*
|
|
9915
|
-
* This source code is licensed under the ISC license.
|
|
9916
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9917
|
-
*)
|
|
9918
|
-
|
|
9919
9863
|
lucide-react/dist/esm/icons/trash.js:
|
|
9920
|
-
(**
|
|
9921
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9922
|
-
*
|
|
9923
|
-
* This source code is licensed under the ISC license.
|
|
9924
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9925
|
-
*)
|
|
9926
|
-
|
|
9927
9864
|
lucide-react/dist/esm/icons/type.js:
|
|
9928
|
-
(**
|
|
9929
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9930
|
-
*
|
|
9931
|
-
* This source code is licensed under the ISC license.
|
|
9932
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9933
|
-
*)
|
|
9934
|
-
|
|
9935
9865
|
lucide-react/dist/esm/icons/undo-2.js:
|
|
9936
|
-
(**
|
|
9937
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9938
|
-
*
|
|
9939
|
-
* This source code is licensed under the ISC license.
|
|
9940
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9941
|
-
*)
|
|
9942
|
-
|
|
9943
9866
|
lucide-react/dist/esm/icons/zoom-in.js:
|
|
9944
|
-
(**
|
|
9945
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9946
|
-
*
|
|
9947
|
-
* This source code is licensed under the ISC license.
|
|
9948
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9949
|
-
*)
|
|
9950
|
-
|
|
9951
9867
|
lucide-react/dist/esm/icons/zoom-out.js:
|
|
9952
|
-
(**
|
|
9953
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9954
|
-
*
|
|
9955
|
-
* This source code is licensed under the ISC license.
|
|
9956
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9957
|
-
*)
|
|
9958
|
-
|
|
9959
9868
|
lucide-react/dist/esm/lucide-react.js:
|
|
9960
9869
|
(**
|
|
9961
9870
|
* @license lucide-react v0.468.0 - ISC
|