@measured/puck 0.21.0-canary.ace4c8b3 → 0.21.0-canary.af48a401
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-TC25DCTQ.mjs → chunk-JA7SEUEH.mjs} +3 -2
- package/dist/{chunk-AIFI2M23.mjs → chunk-UABEUL66.mjs} +108 -81
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +98 -72
- package/dist/index.mjs +2 -2
- package/dist/no-external.d.mts +1 -1
- package/dist/no-external.d.ts +1 -1
- package/dist/no-external.js +98 -72
- 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 +3 -2
- package/dist/rsc.mjs +1 -1
- package/dist/{walk-tree-CkSoNBF7.d.mts → walk-tree-CgWnYC1X.d.mts} +7 -5
- package/dist/{walk-tree-CkSoNBF7.d.ts → walk-tree-CgWnYC1X.d.ts} +7 -5
- package/package.json +1 -1
|
@@ -914,8 +914,9 @@ var Item = ({
|
|
|
914
914
|
);
|
|
915
915
|
};
|
|
916
916
|
var SlotRender = forwardRef(
|
|
917
|
-
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
|
918
|
-
|
|
917
|
+
function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
|
|
918
|
+
const El = as != null ? as : "div";
|
|
919
|
+
return /* @__PURE__ */ jsx(El, { className, style, ref, children: content.map((item) => {
|
|
919
920
|
if (!config.components[item.type]) {
|
|
920
921
|
return null;
|
|
921
922
|
}
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
walkAppState,
|
|
26
26
|
walkField,
|
|
27
27
|
walkTree
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-JA7SEUEH.mjs";
|
|
29
29
|
|
|
30
30
|
// ../../node_modules/classnames/index.js
|
|
31
31
|
var require_classnames = __commonJS({
|
|
@@ -1074,26 +1074,34 @@ var createPermissionsSlice = (set, get) => {
|
|
|
1074
1074
|
const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
|
|
1075
1075
|
const { state, permissions, config } = get();
|
|
1076
1076
|
const { cache, globalPermissions } = permissions;
|
|
1077
|
-
const
|
|
1078
|
-
var _a, _b
|
|
1077
|
+
const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
|
|
1078
|
+
var _a, _b;
|
|
1079
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;
|
|
1080
1085
|
const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
|
|
1081
1086
|
if (!componentConfig) {
|
|
1082
1087
|
return;
|
|
1083
1088
|
}
|
|
1084
1089
|
const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
|
|
1085
1090
|
if (componentConfig.resolvePermissions) {
|
|
1086
|
-
const changed = getChanged(item2,
|
|
1087
|
-
|
|
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) {
|
|
1088
1095
|
const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
|
|
1089
1096
|
const resolvedPermissions = yield componentConfig.resolvePermissions(
|
|
1090
1097
|
item2,
|
|
1091
1098
|
{
|
|
1092
1099
|
changed,
|
|
1093
|
-
lastPermissions: (
|
|
1100
|
+
lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
|
|
1094
1101
|
permissions: initialPermissions,
|
|
1095
1102
|
appState: makeStatePublic(appState),
|
|
1096
|
-
lastData: (
|
|
1103
|
+
lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
|
|
1104
|
+
parent: parentData
|
|
1097
1105
|
}
|
|
1098
1106
|
);
|
|
1099
1107
|
const latest = get().permissions;
|
|
@@ -1101,6 +1109,7 @@ var createPermissionsSlice = (set, get) => {
|
|
|
1101
1109
|
permissions: __spreadProps(__spreadValues({}, latest), {
|
|
1102
1110
|
cache: __spreadProps(__spreadValues({}, latest.cache), {
|
|
1103
1111
|
[item2.props.id]: {
|
|
1112
|
+
lastParentId: parentId,
|
|
1104
1113
|
lastData: item2,
|
|
1105
1114
|
lastPermissions: resolvedPermissions
|
|
1106
1115
|
}
|
|
@@ -1114,9 +1123,9 @@ var createPermissionsSlice = (set, get) => {
|
|
|
1114
1123
|
}
|
|
1115
1124
|
}
|
|
1116
1125
|
});
|
|
1117
|
-
const
|
|
1126
|
+
const resolvePermissionsForRoot = (force2 = false) => {
|
|
1118
1127
|
const { state: appState } = get();
|
|
1119
|
-
|
|
1128
|
+
resolvePermissionsForItem(
|
|
1120
1129
|
// Shim the root data in by conforming to component data shape
|
|
1121
1130
|
{
|
|
1122
1131
|
type: "root",
|
|
@@ -1127,16 +1136,16 @@ var createPermissionsSlice = (set, get) => {
|
|
|
1127
1136
|
};
|
|
1128
1137
|
const { item, type, root } = params;
|
|
1129
1138
|
if (item) {
|
|
1130
|
-
yield
|
|
1139
|
+
yield resolvePermissionsForItem(item, force);
|
|
1131
1140
|
} else if (type) {
|
|
1132
1141
|
flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
|
|
1133
|
-
yield
|
|
1142
|
+
yield resolvePermissionsForItem(item2, force);
|
|
1134
1143
|
}));
|
|
1135
1144
|
} else if (root) {
|
|
1136
|
-
|
|
1145
|
+
resolvePermissionsForRoot(force);
|
|
1137
1146
|
} else {
|
|
1138
1147
|
flattenData(state, config).map((item2) => __async(null, null, function* () {
|
|
1139
|
-
yield
|
|
1148
|
+
yield resolvePermissionsForItem(item2, force);
|
|
1140
1149
|
}));
|
|
1141
1150
|
}
|
|
1142
1151
|
});
|
|
@@ -4844,7 +4853,20 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
|
|
|
4844
4853
|
|
|
4845
4854
|
// lib/insert-component.ts
|
|
4846
4855
|
init_react_import();
|
|
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
|
|
4847
4868
|
var insertComponent = (componentType, zone, index, appStore) => __async(null, null, function* () {
|
|
4869
|
+
const { getState } = appStore;
|
|
4848
4870
|
const id = generateId(componentType);
|
|
4849
4871
|
const insertActionData = {
|
|
4850
4872
|
type: "insert",
|
|
@@ -4853,8 +4875,9 @@ var insertComponent = (componentType, zone, index, appStore) => __async(null, nu
|
|
|
4853
4875
|
destinationZone: zone,
|
|
4854
4876
|
id
|
|
4855
4877
|
};
|
|
4856
|
-
const
|
|
4857
|
-
const insertedState = insertAction(
|
|
4878
|
+
const stateBefore = getState().state;
|
|
4879
|
+
const insertedState = insertAction(stateBefore, insertActionData, getState());
|
|
4880
|
+
const dispatch = getState().dispatch;
|
|
4858
4881
|
dispatch(__spreadProps(__spreadValues({}, insertActionData), {
|
|
4859
4882
|
// Dispatch insert rather set, as user's may rely on this via onAction
|
|
4860
4883
|
// We must always record history here so the insert is added to user history
|
|
@@ -4862,23 +4885,21 @@ var insertComponent = (componentType, zone, index, appStore) => __async(null, nu
|
|
|
4862
4885
|
// entries on insert - one for the initial insert, and one when the data resolves
|
|
4863
4886
|
recordHistory: true
|
|
4864
4887
|
}));
|
|
4865
|
-
const itemSelector = {
|
|
4866
|
-
index,
|
|
4867
|
-
zone
|
|
4868
|
-
};
|
|
4888
|
+
const itemSelector = { index, zone };
|
|
4869
4889
|
dispatch({ type: "setUi", ui: { itemSelector } });
|
|
4870
4890
|
const itemData = getItem(itemSelector, insertedState);
|
|
4871
|
-
if (itemData)
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
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
|
+
});
|
|
4882
4903
|
});
|
|
4883
4904
|
|
|
4884
4905
|
// components/DragDropContext/index.tsx
|
|
@@ -5115,7 +5136,7 @@ var DragDropContextClient = ({
|
|
|
5115
5136
|
thisPreview.componentType,
|
|
5116
5137
|
thisPreview.zone,
|
|
5117
5138
|
thisPreview.index,
|
|
5118
|
-
appStore
|
|
5139
|
+
appStore
|
|
5119
5140
|
);
|
|
5120
5141
|
} else if (initialSelector.current) {
|
|
5121
5142
|
dispatch({
|
|
@@ -5499,7 +5520,8 @@ var useMinEmptyHeight = ({
|
|
|
5499
5520
|
}
|
|
5500
5521
|
}
|
|
5501
5522
|
}, [ref.current, draggedItem, onDragFinished]);
|
|
5502
|
-
|
|
5523
|
+
const returnedMinHeight = isNaN(Number(userMinEmptyHeight)) ? userMinEmptyHeight : `${userMinEmptyHeight}px`;
|
|
5524
|
+
return [prevHeight ? `${prevHeight}px` : returnedMinHeight, isAnimating];
|
|
5503
5525
|
};
|
|
5504
5526
|
|
|
5505
5527
|
// lib/assign-refs.ts
|
|
@@ -5757,16 +5779,6 @@ function setDeep(node, path, newVal) {
|
|
|
5757
5779
|
return __spreadValues(__spreadValues({}, node), newNode);
|
|
5758
5780
|
}
|
|
5759
5781
|
|
|
5760
|
-
// lib/get-selector-for-id.ts
|
|
5761
|
-
init_react_import();
|
|
5762
|
-
var getSelectorForId = (state, id) => {
|
|
5763
|
-
const node = state.indexes.nodes[id];
|
|
5764
|
-
if (!node) return;
|
|
5765
|
-
const zoneCompound = `${node.parentId}:${node.zone}`;
|
|
5766
|
-
const index = state.indexes.zones[zoneCompound].contentIds.indexOf(id);
|
|
5767
|
-
return { zone: zoneCompound, index };
|
|
5768
|
-
};
|
|
5769
|
-
|
|
5770
5782
|
// components/InlineTextField/index.tsx
|
|
5771
5783
|
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
5772
5784
|
var getClassName18 = get_class_name_factory_default("InlineTextField", styles_module_default13);
|
|
@@ -6086,8 +6098,9 @@ var DropZoneEdit = forwardRef3(
|
|
|
6086
6098
|
disallow,
|
|
6087
6099
|
style,
|
|
6088
6100
|
className,
|
|
6089
|
-
minEmptyHeight: userMinEmptyHeight =
|
|
6090
|
-
collisionAxis
|
|
6101
|
+
minEmptyHeight: userMinEmptyHeight = "128px",
|
|
6102
|
+
collisionAxis,
|
|
6103
|
+
as
|
|
6091
6104
|
}, userRef) {
|
|
6092
6105
|
const ctx = useContext8(dropZoneContext);
|
|
6093
6106
|
const appStoreApi = useAppStoreApi();
|
|
@@ -6230,8 +6243,9 @@ var DropZoneEdit = forwardRef3(
|
|
|
6230
6243
|
userMinEmptyHeight,
|
|
6231
6244
|
ref
|
|
6232
6245
|
});
|
|
6246
|
+
const El = as != null ? as : "div";
|
|
6233
6247
|
return /* @__PURE__ */ jsx26(
|
|
6234
|
-
|
|
6248
|
+
El,
|
|
6235
6249
|
{
|
|
6236
6250
|
className: `${getClassName19({
|
|
6237
6251
|
isRootZone,
|
|
@@ -6247,7 +6261,7 @@ var DropZoneEdit = forwardRef3(
|
|
|
6247
6261
|
"data-testid": `dropzone:${zoneCompound}`,
|
|
6248
6262
|
"data-puck-dropzone": zoneCompound,
|
|
6249
6263
|
style: __spreadProps(__spreadValues({}, style), {
|
|
6250
|
-
"--min-empty-height":
|
|
6264
|
+
"--min-empty-height": minEmptyHeight,
|
|
6251
6265
|
backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
|
|
6252
6266
|
}),
|
|
6253
6267
|
children: contentIdsWithPreview.map((componentId, i) => {
|
|
@@ -6294,7 +6308,7 @@ var DropZoneRenderItem = ({
|
|
|
6294
6308
|
};
|
|
6295
6309
|
var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx26(DropZoneRender, __spreadValues({}, props));
|
|
6296
6310
|
var DropZoneRender = forwardRef3(
|
|
6297
|
-
function DropZoneRenderInternal({ className, style, zone }, ref) {
|
|
6311
|
+
function DropZoneRenderInternal({ className, style, zone, as }, ref) {
|
|
6298
6312
|
const ctx = useContext8(dropZoneContext);
|
|
6299
6313
|
const { areaId = "root" } = ctx || {};
|
|
6300
6314
|
const { config, data, metadata } = useContext8(renderContext);
|
|
@@ -6307,13 +6321,14 @@ var DropZoneRender = forwardRef3(
|
|
|
6307
6321
|
}
|
|
6308
6322
|
}
|
|
6309
6323
|
}, [content]);
|
|
6324
|
+
const El = as != null ? as : "div";
|
|
6310
6325
|
if (!data || !config) {
|
|
6311
6326
|
return null;
|
|
6312
6327
|
}
|
|
6313
6328
|
if (zoneCompound !== rootDroppableId) {
|
|
6314
6329
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
6315
6330
|
}
|
|
6316
|
-
return /* @__PURE__ */ jsx26(
|
|
6331
|
+
return /* @__PURE__ */ jsx26(El, { className, style, ref, children: content.map((item) => {
|
|
6317
6332
|
const Component = config.components[item.type];
|
|
6318
6333
|
if (Component) {
|
|
6319
6334
|
return /* @__PURE__ */ jsx26(
|
|
@@ -6415,7 +6430,15 @@ var generateUsePuck = (store) => {
|
|
|
6415
6430
|
selectedItem: store.selectedItem || null,
|
|
6416
6431
|
getItemBySelector: (selector) => getItem(selector, store.state),
|
|
6417
6432
|
getItemById: (id) => store.state.indexes.nodes[id].data,
|
|
6418
|
-
getSelectorForId: (id) => getSelectorForId(store.state, id)
|
|
6433
|
+
getSelectorForId: (id) => getSelectorForId(store.state, id),
|
|
6434
|
+
getParentById: (id) => {
|
|
6435
|
+
const node = store.state.indexes.nodes[id];
|
|
6436
|
+
const parentId = node.parentId;
|
|
6437
|
+
if (parentId === null) return;
|
|
6438
|
+
const parentNode = store.state.indexes.nodes[parentId];
|
|
6439
|
+
if (!parentNode) return;
|
|
6440
|
+
return parentNode.data;
|
|
6441
|
+
}
|
|
6419
6442
|
};
|
|
6420
6443
|
return storeData;
|
|
6421
6444
|
};
|
|
@@ -6604,48 +6627,47 @@ var DefaultFields = ({
|
|
|
6604
6627
|
return /* @__PURE__ */ jsx29(Fragment8, { children });
|
|
6605
6628
|
};
|
|
6606
6629
|
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
|
|
6607
|
-
let currentProps;
|
|
6608
6630
|
const { dispatch, state, selectedItem, resolveComponentData: resolveComponentData2 } = appStore.getState();
|
|
6609
6631
|
const { data, ui } = state;
|
|
6610
6632
|
const { itemSelector } = ui;
|
|
6611
6633
|
const rootProps = data.root.props || data.root;
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
} else {
|
|
6615
|
-
currentProps = rootProps;
|
|
6616
|
-
}
|
|
6617
|
-
const newProps = __spreadProps(__spreadValues({}, currentProps), {
|
|
6618
|
-
[fieldName]: value
|
|
6619
|
-
});
|
|
6634
|
+
const currentProps = selectedItem ? selectedItem.props : rootProps;
|
|
6635
|
+
const newProps = __spreadProps(__spreadValues({}, currentProps), { [fieldName]: value });
|
|
6620
6636
|
if (selectedItem && itemSelector) {
|
|
6637
|
+
const resolved = yield resolveComponentData2(
|
|
6638
|
+
__spreadProps(__spreadValues({}, selectedItem), { props: newProps }),
|
|
6639
|
+
"replace"
|
|
6640
|
+
);
|
|
6641
|
+
const latestSelector = getSelectorForId(
|
|
6642
|
+
appStore.getState().state,
|
|
6643
|
+
selectedItem.props.id
|
|
6644
|
+
);
|
|
6645
|
+
if (!latestSelector) return;
|
|
6621
6646
|
dispatch({
|
|
6622
6647
|
type: "replace",
|
|
6623
|
-
destinationIndex:
|
|
6624
|
-
destinationZone:
|
|
6625
|
-
data:
|
|
6626
|
-
|
|
6648
|
+
destinationIndex: latestSelector.index,
|
|
6649
|
+
destinationZone: latestSelector.zone || rootDroppableId,
|
|
6650
|
+
data: resolved.node,
|
|
6651
|
+
ui: updatedUi
|
|
6652
|
+
});
|
|
6653
|
+
return;
|
|
6654
|
+
}
|
|
6655
|
+
if (data.root.props) {
|
|
6656
|
+
dispatch({
|
|
6657
|
+
type: "replaceRoot",
|
|
6658
|
+
root: (yield resolveComponentData2(
|
|
6659
|
+
__spreadProps(__spreadValues({}, data.root), { props: newProps }),
|
|
6627
6660
|
"replace"
|
|
6628
6661
|
)).node,
|
|
6629
|
-
ui: updatedUi
|
|
6662
|
+
ui: __spreadValues(__spreadValues({}, ui), updatedUi),
|
|
6663
|
+
recordHistory: true
|
|
6630
6664
|
});
|
|
6631
|
-
|
|
6632
|
-
if (data.root.props) {
|
|
6633
|
-
dispatch({
|
|
6634
|
-
type: "replaceRoot",
|
|
6635
|
-
root: (yield resolveComponentData2(
|
|
6636
|
-
__spreadProps(__spreadValues({}, data.root), { props: newProps }),
|
|
6637
|
-
"replace"
|
|
6638
|
-
)).node,
|
|
6639
|
-
ui: __spreadValues(__spreadValues({}, ui), updatedUi),
|
|
6640
|
-
recordHistory: true
|
|
6641
|
-
});
|
|
6642
|
-
} else {
|
|
6643
|
-
dispatch({
|
|
6644
|
-
type: "setData",
|
|
6645
|
-
data: { root: newProps }
|
|
6646
|
-
});
|
|
6647
|
-
}
|
|
6665
|
+
return;
|
|
6648
6666
|
}
|
|
6667
|
+
dispatch({
|
|
6668
|
+
type: "setData",
|
|
6669
|
+
data: { root: newProps }
|
|
6670
|
+
});
|
|
6649
6671
|
});
|
|
6650
6672
|
var FieldsChild = ({ fieldName }) => {
|
|
6651
6673
|
const field = useAppStore((s) => s.fields.fields[fieldName]);
|
|
@@ -8650,7 +8672,12 @@ function PuckProvider({ children }) {
|
|
|
8650
8672
|
});
|
|
8651
8673
|
})
|
|
8652
8674
|
);
|
|
8653
|
-
const initialHistoryIndex = (
|
|
8675
|
+
const initialHistoryIndex = useMemo20(() => {
|
|
8676
|
+
if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
|
|
8677
|
+
return _initialHistory == null ? void 0 : _initialHistory.index;
|
|
8678
|
+
}
|
|
8679
|
+
return blendedHistories.length - 1;
|
|
8680
|
+
}, []);
|
|
8654
8681
|
const initialAppState = blendedHistories[initialHistoryIndex].state;
|
|
8655
8682
|
const loadedOverrides = useLoadedOverrides({
|
|
8656
8683
|
overrides,
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as History, P as Permissions, a as ComponentData, C as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector } from './walk-tree-
|
|
2
|
-
export { ad as Adaptor, ab as ArrayField, B as ArrayState, ar as AsFieldProps, X as BaseData, a5 as BaseField, af as CacheOpts, J as ComponentConfigExtensions, T as ComponentConfigParams, a0 as ComponentDataMap, _ as ComponentDataOptionalId, a3 as ComponentMetadata, Q as ConfigParams, a1 as Content, ai as CustomField, ah as CustomFieldRender, ao as DefaultComponentProps, L as DefaultComponents, al as DefaultRootFieldProps, an as DefaultRootProps, am as DefaultRootRenderProps, o as Direction, p as DragAxis, ag as ExternalField, ae as ExternalFieldWithAdaptor, N as ExtractConfigParams, at as ExtractField, a4 as FieldMetadata, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, z as ItemWithId, $ as MappedItem, a7 as NumberField, ac as ObjectField, x as OverrideKey, G as PuckComponent, ak as PuckContext, a2 as PuckMetadata, aa as RadioField, K as RootConfig, Z as RootData, Y as RootDataWithoutProps, a9 as SelectField, S as Slot, E as SlotComponent, aj as SlotField, a6 as TextField, a8 as TextareaField, q as Viewport, as as WithChildren, ap as WithId, aq as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
1
|
+
import { H as History, P as Permissions, a as ComponentData, C as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector } from './walk-tree-CgWnYC1X.mjs';
|
|
2
|
+
export { ad as Adaptor, ab as ArrayField, B as ArrayState, ar as AsFieldProps, X as BaseData, a5 as BaseField, af as CacheOpts, J as ComponentConfigExtensions, T as ComponentConfigParams, a0 as ComponentDataMap, _ as ComponentDataOptionalId, a3 as ComponentMetadata, Q as ConfigParams, a1 as Content, ai as CustomField, ah as CustomFieldRender, ao as DefaultComponentProps, L as DefaultComponents, al as DefaultRootFieldProps, an as DefaultRootProps, am as DefaultRootRenderProps, o as Direction, p as DragAxis, ag as ExternalField, ae as ExternalFieldWithAdaptor, N as ExtractConfigParams, at as ExtractField, a4 as FieldMetadata, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, z as ItemWithId, $ as MappedItem, a7 as NumberField, ac as ObjectField, x as OverrideKey, G as PuckComponent, ak as PuckContext, a2 as PuckMetadata, aa as RadioField, K as RootConfig, Z as RootData, Y as RootDataWithoutProps, a9 as SelectField, S as Slot, E as SlotComponent, aj as SlotField, a6 as TextField, a8 as TextareaField, q as Viewport, as as WithChildren, ap as WithId, aq as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CgWnYC1X.mjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
|
|
@@ -47,6 +47,7 @@ type RefreshPermissions<UserConfig extends Config = Config> = (params?: Permissi
|
|
|
47
47
|
type Cache = Record<string, {
|
|
48
48
|
lastPermissions: Partial<Permissions>;
|
|
49
49
|
lastData: ComponentData | null;
|
|
50
|
+
lastParentId: string | null;
|
|
50
51
|
}>;
|
|
51
52
|
type PermissionsSlice = {
|
|
52
53
|
cache: Cache;
|
|
@@ -271,6 +272,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
271
272
|
getItemBySelector: (selector: ItemSelector) => G["UserComponentData"] | undefined;
|
|
272
273
|
getItemById: (id: string) => G["UserComponentData"] | undefined;
|
|
273
274
|
getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
|
|
275
|
+
getParentById: (id: string) => ComponentData | undefined;
|
|
274
276
|
history: {
|
|
275
277
|
back: HistorySlice["back"];
|
|
276
278
|
forward: HistorySlice["forward"];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as History, P as Permissions, a as ComponentData, C as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector } from './walk-tree-
|
|
2
|
-
export { ad as Adaptor, ab as ArrayField, B as ArrayState, ar as AsFieldProps, X as BaseData, a5 as BaseField, af as CacheOpts, J as ComponentConfigExtensions, T as ComponentConfigParams, a0 as ComponentDataMap, _ as ComponentDataOptionalId, a3 as ComponentMetadata, Q as ConfigParams, a1 as Content, ai as CustomField, ah as CustomFieldRender, ao as DefaultComponentProps, L as DefaultComponents, al as DefaultRootFieldProps, an as DefaultRootProps, am as DefaultRootRenderProps, o as Direction, p as DragAxis, ag as ExternalField, ae as ExternalFieldWithAdaptor, N as ExtractConfigParams, at as ExtractField, a4 as FieldMetadata, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, z as ItemWithId, $ as MappedItem, a7 as NumberField, ac as ObjectField, x as OverrideKey, G as PuckComponent, ak as PuckContext, a2 as PuckMetadata, aa as RadioField, K as RootConfig, Z as RootData, Y as RootDataWithoutProps, a9 as SelectField, S as Slot, E as SlotComponent, aj as SlotField, a6 as TextField, a8 as TextareaField, q as Viewport, as as WithChildren, ap as WithId, aq as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
1
|
+
import { H as History, P as Permissions, a as ComponentData, C as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector } from './walk-tree-CgWnYC1X.js';
|
|
2
|
+
export { ad as Adaptor, ab as ArrayField, B as ArrayState, ar as AsFieldProps, X as BaseData, a5 as BaseField, af as CacheOpts, J as ComponentConfigExtensions, T as ComponentConfigParams, a0 as ComponentDataMap, _ as ComponentDataOptionalId, a3 as ComponentMetadata, Q as ConfigParams, a1 as Content, ai as CustomField, ah as CustomFieldRender, ao as DefaultComponentProps, L as DefaultComponents, al as DefaultRootFieldProps, an as DefaultRootProps, am as DefaultRootRenderProps, o as Direction, p as DragAxis, ag as ExternalField, ae as ExternalFieldWithAdaptor, N as ExtractConfigParams, at as ExtractField, a4 as FieldMetadata, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, z as ItemWithId, $ as MappedItem, a7 as NumberField, ac as ObjectField, x as OverrideKey, G as PuckComponent, ak as PuckContext, a2 as PuckMetadata, aa as RadioField, K as RootConfig, Z as RootData, Y as RootDataWithoutProps, a9 as SelectField, S as Slot, E as SlotComponent, aj as SlotField, a6 as TextField, a8 as TextareaField, q as Viewport, as as WithChildren, ap as WithId, aq as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CgWnYC1X.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
|
|
@@ -47,6 +47,7 @@ type RefreshPermissions<UserConfig extends Config = Config> = (params?: Permissi
|
|
|
47
47
|
type Cache = Record<string, {
|
|
48
48
|
lastPermissions: Partial<Permissions>;
|
|
49
49
|
lastData: ComponentData | null;
|
|
50
|
+
lastParentId: string | null;
|
|
50
51
|
}>;
|
|
51
52
|
type PermissionsSlice = {
|
|
52
53
|
cache: Cache;
|
|
@@ -271,6 +272,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
271
272
|
getItemBySelector: (selector: ItemSelector) => G["UserComponentData"] | undefined;
|
|
272
273
|
getItemById: (id: string) => G["UserComponentData"] | undefined;
|
|
273
274
|
getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
|
|
275
|
+
getParentById: (id: string) => ComponentData | undefined;
|
|
274
276
|
history: {
|
|
275
277
|
back: HistorySlice["back"];
|
|
276
278
|
forward: HistorySlice["forward"];
|