@measured/puck 0.20.0-canary.3da831b0 → 0.20.0-canary.6760121f
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/index.d.mts +4 -7
- package/dist/index.d.ts +4 -7
- package/dist/index.js +21 -29
- package/dist/index.mjs +21 -29
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/{walk-tree-DhtH8sAC.d.mts → walk-tree-C7k4UmlP.d.mts} +15 -27
- package/dist/{walk-tree-DhtH8sAC.d.ts → walk-tree-C7k4UmlP.d.ts} +15 -27
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as History, P as Permissions, C as ComponentData, a 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 Field, h as FieldProps, D as DropZoneProps, i as Data, j as OnAction, k as InitialHistory, l as ItemSelector } from './walk-tree-
|
|
2
|
-
export {
|
|
1
|
+
import { H as History, P as Permissions, C as ComponentData, a 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 Field, h as FieldProps, D as DropZoneProps, i as Data, j as OnAction, k as InitialHistory, l as ItemSelector } from './walk-tree-C7k4UmlP.mjs';
|
|
2
|
+
export { $ as Adaptor, Z as ArrayField, t as ArrayState, ac as AsFieldProps, B as BaseData, L as BaseField, J as ComponentDataMap, E as ComponentDataOptionalId, K as Content, a3 as CustomField, a2 as CustomFieldRender, a9 as DefaultComponentProps, a6 as DefaultRootFieldProps, a8 as DefaultRootProps, a7 as DefaultRootRenderProps, m as Direction, n as DragAxis, a1 as ExternalField, a0 as ExternalFieldWithAdaptor, ae as ExtractPropsFromConfig, af as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, G as MappedItem, N as NumberField, _ as ObjectField, q as OverrideKey, v as PuckComponent, a5 as PuckContext, Y as RadioField, x as RootConfig, z as RootData, y as RootDataWithoutProps, X as SelectField, S as Slot, u as SlotComponent, a4 as SlotField, T as TextField, Q as TextareaField, o as Viewport, ad as WithChildren, aa as WithId, ab as WithPuckProps, W as WithSlotProps, ag as migrate, p as overrideKeys, ai as resolveAllData, ah as transformProps, w as walkTree } from './walk-tree-C7k4UmlP.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';
|
|
@@ -249,11 +249,8 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
|
|
|
249
249
|
metadata?: Metadata;
|
|
250
250
|
}): react_jsx_runtime.JSX.Element;
|
|
251
251
|
|
|
252
|
-
type WithGet<T> = T & {
|
|
253
|
-
get: () => T;
|
|
254
|
-
};
|
|
255
252
|
type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
256
|
-
appState:
|
|
253
|
+
appState: G["UserPublicAppState"];
|
|
257
254
|
config: UserConfig;
|
|
258
255
|
dispatch: AppStore["dispatch"];
|
|
259
256
|
getPermissions: GetPermissions<UserConfig>;
|
|
@@ -274,7 +271,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
274
271
|
};
|
|
275
272
|
};
|
|
276
273
|
type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
|
|
277
|
-
type UsePuckStore<UserConfig extends Config = Config> =
|
|
274
|
+
type UsePuckStore<UserConfig extends Config = Config> = PuckApi<UserConfig>;
|
|
278
275
|
/**
|
|
279
276
|
* createUsePuck
|
|
280
277
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as History, P as Permissions, C as ComponentData, a 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 Field, h as FieldProps, D as DropZoneProps, i as Data, j as OnAction, k as InitialHistory, l as ItemSelector } from './walk-tree-
|
|
2
|
-
export {
|
|
1
|
+
import { H as History, P as Permissions, C as ComponentData, a 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 Field, h as FieldProps, D as DropZoneProps, i as Data, j as OnAction, k as InitialHistory, l as ItemSelector } from './walk-tree-C7k4UmlP.js';
|
|
2
|
+
export { $ as Adaptor, Z as ArrayField, t as ArrayState, ac as AsFieldProps, B as BaseData, L as BaseField, J as ComponentDataMap, E as ComponentDataOptionalId, K as Content, a3 as CustomField, a2 as CustomFieldRender, a9 as DefaultComponentProps, a6 as DefaultRootFieldProps, a8 as DefaultRootProps, a7 as DefaultRootRenderProps, m as Direction, n as DragAxis, a1 as ExternalField, a0 as ExternalFieldWithAdaptor, ae as ExtractPropsFromConfig, af as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, G as MappedItem, N as NumberField, _ as ObjectField, q as OverrideKey, v as PuckComponent, a5 as PuckContext, Y as RadioField, x as RootConfig, z as RootData, y as RootDataWithoutProps, X as SelectField, S as Slot, u as SlotComponent, a4 as SlotField, T as TextField, Q as TextareaField, o as Viewport, ad as WithChildren, aa as WithId, ab as WithPuckProps, W as WithSlotProps, ag as migrate, p as overrideKeys, ai as resolveAllData, ah as transformProps, w as walkTree } from './walk-tree-C7k4UmlP.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';
|
|
@@ -249,11 +249,8 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
|
|
|
249
249
|
metadata?: Metadata;
|
|
250
250
|
}): react_jsx_runtime.JSX.Element;
|
|
251
251
|
|
|
252
|
-
type WithGet<T> = T & {
|
|
253
|
-
get: () => T;
|
|
254
|
-
};
|
|
255
252
|
type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
256
|
-
appState:
|
|
253
|
+
appState: G["UserPublicAppState"];
|
|
257
254
|
config: UserConfig;
|
|
258
255
|
dispatch: AppStore["dispatch"];
|
|
259
256
|
getPermissions: GetPermissions<UserConfig>;
|
|
@@ -274,7 +271,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
274
271
|
};
|
|
275
272
|
};
|
|
276
273
|
type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
|
|
277
|
-
type UsePuckStore<UserConfig extends Config = Config> =
|
|
274
|
+
type UsePuckStore<UserConfig extends Config = Config> = PuckApi<UserConfig>;
|
|
278
275
|
/**
|
|
279
276
|
* createUsePuck
|
|
280
277
|
*
|
package/dist/index.js
CHANGED
|
@@ -4699,19 +4699,9 @@ var DropZoneProvider = ({
|
|
|
4699
4699
|
},
|
|
4700
4700
|
[dispatch]
|
|
4701
4701
|
);
|
|
4702
|
-
const unregisterZone = (0, import_react25.useCallback)(
|
|
4703
|
-
(zoneCompound) => {
|
|
4704
|
-
dispatch({
|
|
4705
|
-
type: "unregisterZone",
|
|
4706
|
-
zone: zoneCompound
|
|
4707
|
-
});
|
|
4708
|
-
},
|
|
4709
|
-
[dispatch]
|
|
4710
|
-
);
|
|
4711
4702
|
const memoValue = (0, import_react25.useMemo)(
|
|
4712
4703
|
() => __spreadValues({
|
|
4713
|
-
registerZone
|
|
4714
|
-
unregisterZone
|
|
4704
|
+
registerZone
|
|
4715
4705
|
}, value),
|
|
4716
4706
|
[value]
|
|
4717
4707
|
);
|
|
@@ -5083,7 +5073,8 @@ var DraggableComponent = ({
|
|
|
5083
5073
|
el.removeEventListener("mouseout", _onMouseOut);
|
|
5084
5074
|
};
|
|
5085
5075
|
}, [
|
|
5086
|
-
ref,
|
|
5076
|
+
ref.current,
|
|
5077
|
+
// Remount attributes if the element changes
|
|
5087
5078
|
onClick,
|
|
5088
5079
|
containsActiveZone,
|
|
5089
5080
|
zoneCompound,
|
|
@@ -5585,7 +5576,8 @@ var DropZoneChild = ({
|
|
|
5585
5576
|
return {
|
|
5586
5577
|
type: preview.componentType,
|
|
5587
5578
|
props: preview.props,
|
|
5588
|
-
previewType: preview.type
|
|
5579
|
+
previewType: preview.type,
|
|
5580
|
+
element: preview.element
|
|
5589
5581
|
};
|
|
5590
5582
|
}
|
|
5591
5583
|
return null;
|
|
@@ -5618,6 +5610,12 @@ var DropZoneChild = ({
|
|
|
5618
5610
|
let label = (_b = (_a = componentConfig == null ? void 0 : componentConfig.label) != null ? _a : item == null ? void 0 : item.type.toString()) != null ? _b : "Component";
|
|
5619
5611
|
const renderPreview = (0, import_react35.useMemo)(
|
|
5620
5612
|
() => function Preview3() {
|
|
5613
|
+
if (item && "element" in item && item.element) {
|
|
5614
|
+
return (
|
|
5615
|
+
// Safe to use this since the HTML is set by the user
|
|
5616
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
|
|
5617
|
+
);
|
|
5618
|
+
}
|
|
5621
5619
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DrawerItemInner, { name: label, children: overrides.componentItem });
|
|
5622
5620
|
},
|
|
5623
5621
|
[componentId, label, overrides]
|
|
@@ -5693,6 +5691,7 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
|
|
|
5693
5691
|
collisionAxis
|
|
5694
5692
|
}, userRef) {
|
|
5695
5693
|
const ctx = (0, import_react35.useContext)(dropZoneContext);
|
|
5694
|
+
const appStoreApi = useAppStoreApi();
|
|
5696
5695
|
const {
|
|
5697
5696
|
// These all need setting via context
|
|
5698
5697
|
areaId,
|
|
@@ -5734,13 +5733,8 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
|
|
|
5734
5733
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
5735
5734
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
5736
5735
|
}
|
|
5737
|
-
return () => {
|
|
5738
|
-
if (ctx == null ? void 0 : ctx.unregisterZone) {
|
|
5739
|
-
ctx == null ? void 0 : ctx.unregisterZone(zoneCompound);
|
|
5740
|
-
}
|
|
5741
|
-
};
|
|
5742
5736
|
}
|
|
5743
|
-
}, [zoneType]);
|
|
5737
|
+
}, [zoneType, appStoreApi]);
|
|
5744
5738
|
(0, import_react35.useEffect)(() => {
|
|
5745
5739
|
if (zoneType === "dropzone") {
|
|
5746
5740
|
if (zoneCompound !== rootDroppableId) {
|
|
@@ -5912,11 +5906,6 @@ var DropZoneRender2 = (0, import_react35.forwardRef)(
|
|
|
5912
5906
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
5913
5907
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
5914
5908
|
}
|
|
5915
|
-
return () => {
|
|
5916
|
-
if (ctx == null ? void 0 : ctx.unregisterZone) {
|
|
5917
|
-
ctx == null ? void 0 : ctx.unregisterZone(zoneCompound);
|
|
5918
|
-
}
|
|
5919
|
-
};
|
|
5920
5909
|
}
|
|
5921
5910
|
}, [content]);
|
|
5922
5911
|
if (!data || !config) {
|
|
@@ -6177,6 +6166,7 @@ var findDeepestCandidate = (position, manager) => {
|
|
|
6177
6166
|
});
|
|
6178
6167
|
filteredCandidates.reverse();
|
|
6179
6168
|
const primaryCandidate = filteredCandidates[0];
|
|
6169
|
+
if (!primaryCandidate) return { zone: null, area: null };
|
|
6180
6170
|
const primaryCandidateData = primaryCandidate.data;
|
|
6181
6171
|
const primaryCandidateIsComponent = "containsActiveZone" in primaryCandidateData;
|
|
6182
6172
|
const zone = getZoneId2(primaryCandidate);
|
|
@@ -6581,6 +6571,7 @@ var DragDropContextClient = ({
|
|
|
6581
6571
|
type: "insert",
|
|
6582
6572
|
index: targetIndex,
|
|
6583
6573
|
zone: targetZone,
|
|
6574
|
+
element: source.element,
|
|
6584
6575
|
props: {
|
|
6585
6576
|
id: source.id.toString()
|
|
6586
6577
|
}
|
|
@@ -6606,7 +6597,8 @@ var DragDropContextClient = ({
|
|
|
6606
6597
|
type: "move",
|
|
6607
6598
|
index: targetIndex,
|
|
6608
6599
|
zone: targetZone,
|
|
6609
|
-
props: item.props
|
|
6600
|
+
props: item.props,
|
|
6601
|
+
element: source.element
|
|
6610
6602
|
}
|
|
6611
6603
|
}
|
|
6612
6604
|
});
|
|
@@ -6636,7 +6628,8 @@ var DragDropContextClient = ({
|
|
|
6636
6628
|
type: "move",
|
|
6637
6629
|
index: sourceData.index,
|
|
6638
6630
|
zone: sourceData.zone,
|
|
6639
|
-
props: item.props
|
|
6631
|
+
props: item.props,
|
|
6632
|
+
element: source.element
|
|
6640
6633
|
}
|
|
6641
6634
|
}
|
|
6642
6635
|
});
|
|
@@ -7591,7 +7584,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
7591
7584
|
editMode: true,
|
|
7592
7585
|
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DropZonePure, { zone: rootDroppableId })
|
|
7593
7586
|
})
|
|
7594
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Render2, { data: renderData, config });
|
|
7587
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Render2, { data: renderData, config, metadata });
|
|
7595
7588
|
(0, import_react46.useEffect)(() => {
|
|
7596
7589
|
if (!iframe.enabled) {
|
|
7597
7590
|
setStatus("READY");
|
|
@@ -8476,8 +8469,7 @@ var generateUsePuck = (store) => {
|
|
|
8476
8469
|
return { zone: zoneCompound, index };
|
|
8477
8470
|
}
|
|
8478
8471
|
};
|
|
8479
|
-
|
|
8480
|
-
return __spreadProps(__spreadValues({}, storeData), { get });
|
|
8472
|
+
return storeData;
|
|
8481
8473
|
};
|
|
8482
8474
|
var UsePuckStoreContext = (0, import_react54.createContext)(
|
|
8483
8475
|
null
|
package/dist/index.mjs
CHANGED
|
@@ -3808,19 +3808,9 @@ var DropZoneProvider = ({
|
|
|
3808
3808
|
},
|
|
3809
3809
|
[dispatch]
|
|
3810
3810
|
);
|
|
3811
|
-
const unregisterZone = useCallback5(
|
|
3812
|
-
(zoneCompound) => {
|
|
3813
|
-
dispatch({
|
|
3814
|
-
type: "unregisterZone",
|
|
3815
|
-
zone: zoneCompound
|
|
3816
|
-
});
|
|
3817
|
-
},
|
|
3818
|
-
[dispatch]
|
|
3819
|
-
);
|
|
3820
3811
|
const memoValue = useMemo6(
|
|
3821
3812
|
() => __spreadValues({
|
|
3822
|
-
registerZone
|
|
3823
|
-
unregisterZone
|
|
3813
|
+
registerZone
|
|
3824
3814
|
}, value),
|
|
3825
3815
|
[value]
|
|
3826
3816
|
);
|
|
@@ -4192,7 +4182,8 @@ var DraggableComponent = ({
|
|
|
4192
4182
|
el.removeEventListener("mouseout", _onMouseOut);
|
|
4193
4183
|
};
|
|
4194
4184
|
}, [
|
|
4195
|
-
ref,
|
|
4185
|
+
ref.current,
|
|
4186
|
+
// Remount attributes if the element changes
|
|
4196
4187
|
onClick,
|
|
4197
4188
|
containsActiveZone,
|
|
4198
4189
|
zoneCompound,
|
|
@@ -4694,7 +4685,8 @@ var DropZoneChild = ({
|
|
|
4694
4685
|
return {
|
|
4695
4686
|
type: preview.componentType,
|
|
4696
4687
|
props: preview.props,
|
|
4697
|
-
previewType: preview.type
|
|
4688
|
+
previewType: preview.type,
|
|
4689
|
+
element: preview.element
|
|
4698
4690
|
};
|
|
4699
4691
|
}
|
|
4700
4692
|
return null;
|
|
@@ -4727,6 +4719,12 @@ var DropZoneChild = ({
|
|
|
4727
4719
|
let label = (_b = (_a = componentConfig == null ? void 0 : componentConfig.label) != null ? _a : item == null ? void 0 : item.type.toString()) != null ? _b : "Component";
|
|
4728
4720
|
const renderPreview = useMemo9(
|
|
4729
4721
|
() => function Preview3() {
|
|
4722
|
+
if (item && "element" in item && item.element) {
|
|
4723
|
+
return (
|
|
4724
|
+
// Safe to use this since the HTML is set by the user
|
|
4725
|
+
/* @__PURE__ */ jsx23("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
|
|
4726
|
+
);
|
|
4727
|
+
}
|
|
4730
4728
|
return /* @__PURE__ */ jsx23(DrawerItemInner, { name: label, children: overrides.componentItem });
|
|
4731
4729
|
},
|
|
4732
4730
|
[componentId, label, overrides]
|
|
@@ -4802,6 +4800,7 @@ var DropZoneEdit = forwardRef3(
|
|
|
4802
4800
|
collisionAxis
|
|
4803
4801
|
}, userRef) {
|
|
4804
4802
|
const ctx = useContext7(dropZoneContext);
|
|
4803
|
+
const appStoreApi = useAppStoreApi();
|
|
4805
4804
|
const {
|
|
4806
4805
|
// These all need setting via context
|
|
4807
4806
|
areaId,
|
|
@@ -4843,13 +4842,8 @@ var DropZoneEdit = forwardRef3(
|
|
|
4843
4842
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
4844
4843
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
4845
4844
|
}
|
|
4846
|
-
return () => {
|
|
4847
|
-
if (ctx == null ? void 0 : ctx.unregisterZone) {
|
|
4848
|
-
ctx == null ? void 0 : ctx.unregisterZone(zoneCompound);
|
|
4849
|
-
}
|
|
4850
|
-
};
|
|
4851
4845
|
}
|
|
4852
|
-
}, [zoneType]);
|
|
4846
|
+
}, [zoneType, appStoreApi]);
|
|
4853
4847
|
useEffect16(() => {
|
|
4854
4848
|
if (zoneType === "dropzone") {
|
|
4855
4849
|
if (zoneCompound !== rootDroppableId) {
|
|
@@ -5021,11 +5015,6 @@ var DropZoneRender = forwardRef3(
|
|
|
5021
5015
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
5022
5016
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
5023
5017
|
}
|
|
5024
|
-
return () => {
|
|
5025
|
-
if (ctx == null ? void 0 : ctx.unregisterZone) {
|
|
5026
|
-
ctx == null ? void 0 : ctx.unregisterZone(zoneCompound);
|
|
5027
|
-
}
|
|
5028
|
-
};
|
|
5029
5018
|
}
|
|
5030
5019
|
}, [content]);
|
|
5031
5020
|
if (!data || !config) {
|
|
@@ -5286,6 +5275,7 @@ var findDeepestCandidate = (position, manager) => {
|
|
|
5286
5275
|
});
|
|
5287
5276
|
filteredCandidates.reverse();
|
|
5288
5277
|
const primaryCandidate = filteredCandidates[0];
|
|
5278
|
+
if (!primaryCandidate) return { zone: null, area: null };
|
|
5289
5279
|
const primaryCandidateData = primaryCandidate.data;
|
|
5290
5280
|
const primaryCandidateIsComponent = "containsActiveZone" in primaryCandidateData;
|
|
5291
5281
|
const zone = getZoneId(primaryCandidate);
|
|
@@ -5690,6 +5680,7 @@ var DragDropContextClient = ({
|
|
|
5690
5680
|
type: "insert",
|
|
5691
5681
|
index: targetIndex,
|
|
5692
5682
|
zone: targetZone,
|
|
5683
|
+
element: source.element,
|
|
5693
5684
|
props: {
|
|
5694
5685
|
id: source.id.toString()
|
|
5695
5686
|
}
|
|
@@ -5715,7 +5706,8 @@ var DragDropContextClient = ({
|
|
|
5715
5706
|
type: "move",
|
|
5716
5707
|
index: targetIndex,
|
|
5717
5708
|
zone: targetZone,
|
|
5718
|
-
props: item.props
|
|
5709
|
+
props: item.props,
|
|
5710
|
+
element: source.element
|
|
5719
5711
|
}
|
|
5720
5712
|
}
|
|
5721
5713
|
});
|
|
@@ -5745,7 +5737,8 @@ var DragDropContextClient = ({
|
|
|
5745
5737
|
type: "move",
|
|
5746
5738
|
index: sourceData.index,
|
|
5747
5739
|
zone: sourceData.zone,
|
|
5748
|
-
props: item.props
|
|
5740
|
+
props: item.props,
|
|
5741
|
+
element: source.element
|
|
5749
5742
|
}
|
|
5750
5743
|
}
|
|
5751
5744
|
});
|
|
@@ -6713,7 +6706,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
6713
6706
|
editMode: true,
|
|
6714
6707
|
children: /* @__PURE__ */ jsx32(DropZonePure, { zone: rootDroppableId })
|
|
6715
6708
|
})
|
|
6716
|
-
) : /* @__PURE__ */ jsx32(Render, { data: renderData, config });
|
|
6709
|
+
) : /* @__PURE__ */ jsx32(Render, { data: renderData, config, metadata });
|
|
6717
6710
|
useEffect20(() => {
|
|
6718
6711
|
if (!iframe.enabled) {
|
|
6719
6712
|
setStatus("READY");
|
|
@@ -7604,8 +7597,7 @@ var generateUsePuck = (store) => {
|
|
|
7604
7597
|
return { zone: zoneCompound, index };
|
|
7605
7598
|
}
|
|
7606
7599
|
};
|
|
7607
|
-
|
|
7608
|
-
return __spreadProps(__spreadValues({}, storeData), { get });
|
|
7600
|
+
return storeData;
|
|
7609
7601
|
};
|
|
7610
7602
|
var UsePuckStoreContext = createContext6(
|
|
7611
7603
|
null
|
package/dist/rsc.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { a as Config, U as UserGenerics, M as Metadata } from './walk-tree-
|
|
3
|
-
export {
|
|
2
|
+
import { a as Config, U as UserGenerics, M as Metadata } from './walk-tree-C7k4UmlP.mjs';
|
|
3
|
+
export { ag as migrate, ai as resolveAllData, ah as transformProps, w as walkTree } from './walk-tree-C7k4UmlP.mjs';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
6
6
|
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
|
package/dist/rsc.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { a as Config, U as UserGenerics, M as Metadata } from './walk-tree-
|
|
3
|
-
export {
|
|
2
|
+
import { a as Config, U as UserGenerics, M as Metadata } from './walk-tree-C7k4UmlP.js';
|
|
3
|
+
export { ag as migrate, ai as resolveAllData, ah as transformProps, w as walkTree } from './walk-tree-C7k4UmlP.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
6
6
|
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
|
|
@@ -49,11 +49,11 @@ type RadioField = BaseField & {
|
|
|
49
49
|
type: "radio";
|
|
50
50
|
options: FieldOptions;
|
|
51
51
|
};
|
|
52
|
-
type ArrayField<Props extends {
|
|
52
|
+
type ArrayField<Props extends any = {
|
|
53
53
|
[key: string]: any;
|
|
54
|
-
} = {
|
|
54
|
+
}> = Props extends {
|
|
55
55
|
[key: string]: any;
|
|
56
|
-
}
|
|
56
|
+
} ? BaseField & {
|
|
57
57
|
type: "array";
|
|
58
58
|
arrayFields: {
|
|
59
59
|
[SubPropName in keyof Props[0]]: Field<Props[0][SubPropName]>;
|
|
@@ -62,14 +62,12 @@ type ArrayField<Props extends {
|
|
|
62
62
|
getItemSummary?: (item: Props[0], index?: number) => string;
|
|
63
63
|
max?: number;
|
|
64
64
|
min?: number;
|
|
65
|
-
};
|
|
66
|
-
type ObjectField<Props extends {
|
|
67
|
-
[key: string]: any;
|
|
68
|
-
} = {
|
|
65
|
+
} : never;
|
|
66
|
+
type ObjectField<Props extends any = {
|
|
69
67
|
[key: string]: any;
|
|
70
68
|
}> = BaseField & {
|
|
71
69
|
type: "object";
|
|
72
|
-
objectFields:
|
|
70
|
+
objectFields: {
|
|
73
71
|
[SubPropName in keyof Props]: Field<Props[SubPropName]>;
|
|
74
72
|
};
|
|
75
73
|
};
|
|
@@ -78,20 +76,17 @@ type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, Pr
|
|
|
78
76
|
fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
|
|
79
77
|
mapProp?: (value: TableShape) => PropShape;
|
|
80
78
|
};
|
|
81
|
-
type
|
|
82
|
-
|
|
83
|
-
} = {
|
|
79
|
+
type NotUndefined<T> = T extends undefined ? Record<string, any> : T;
|
|
80
|
+
type ExternalFieldWithAdaptor<Props extends any = {
|
|
84
81
|
[key: string]: any;
|
|
85
82
|
}> = BaseField & {
|
|
86
83
|
type: "external";
|
|
87
84
|
placeholder?: string;
|
|
88
85
|
adaptor: Adaptor<any, any, Props>;
|
|
89
86
|
adaptorParams?: object;
|
|
90
|
-
getItemSummary: (item: Props
|
|
87
|
+
getItemSummary: (item: NotUndefined<Props>, index?: number) => string;
|
|
91
88
|
};
|
|
92
|
-
type ExternalField<Props extends {
|
|
93
|
-
[key: string]: any;
|
|
94
|
-
} = {
|
|
89
|
+
type ExternalField<Props extends any = {
|
|
95
90
|
[key: string]: any;
|
|
96
91
|
}> = BaseField & {
|
|
97
92
|
type: "external";
|
|
@@ -102,7 +97,7 @@ type ExternalField<Props extends {
|
|
|
102
97
|
}) => Promise<any[] | null>;
|
|
103
98
|
mapProp?: (value: any) => Props;
|
|
104
99
|
mapRow?: (value: any) => Record<string, string | number | ReactElement>;
|
|
105
|
-
getItemSummary?: (item: Props
|
|
100
|
+
getItemSummary?: (item: NotUndefined<Props>, index?: number) => string;
|
|
106
101
|
showSearch?: boolean;
|
|
107
102
|
renderFooter?: (props: {
|
|
108
103
|
items: any[];
|
|
@@ -128,15 +123,7 @@ type SlotField = BaseField & {
|
|
|
128
123
|
allow?: string[];
|
|
129
124
|
disallow?: string[];
|
|
130
125
|
};
|
|
131
|
-
type Field<
|
|
132
|
-
[key: string]: any;
|
|
133
|
-
} ? Props : any> | ObjectField<Props extends {
|
|
134
|
-
[key: string]: any;
|
|
135
|
-
} ? Props : any> | ExternalField<Props extends {
|
|
136
|
-
[key: string]: any;
|
|
137
|
-
} ? Props : any> | ExternalFieldWithAdaptor<Props extends {
|
|
138
|
-
[key: string]: any;
|
|
139
|
-
} ? Props : any> | CustomField<Props> | SlotField;
|
|
126
|
+
type Field<ValueType = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType> | ObjectField<ValueType> | ExternalField<ValueType> | ExternalFieldWithAdaptor<ValueType> | CustomField<ValueType> | SlotField;
|
|
140
127
|
type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps> = {
|
|
141
128
|
[PropName in keyof Omit<ComponentProps, "editMode">]: Field<ComponentProps[PropName]>;
|
|
142
129
|
};
|
|
@@ -222,12 +209,13 @@ type WithChildren<Props> = Props & {
|
|
|
222
209
|
};
|
|
223
210
|
type ExtractPropsFromConfig<UserConfig> = UserConfig extends Config<infer P, any, any> ? P : never;
|
|
224
211
|
type ExtractRootPropsFromConfig<UserConfig> = UserConfig extends Config<any, infer P, any> ? P : never;
|
|
225
|
-
type UserGenerics<UserConfig extends Config = Config, UserProps extends ExtractPropsFromConfig<UserConfig> = ExtractPropsFromConfig<UserConfig>, UserRootProps extends ExtractRootPropsFromConfig<UserConfig> = ExtractRootPropsFromConfig<UserConfig>, UserData extends Data<UserProps, UserRootProps> | Data = Data<UserProps, UserRootProps>, UserAppState extends PrivateAppState<UserData> = PrivateAppState<UserData>, UserComponentData extends ComponentData = UserData["content"][0]> = {
|
|
212
|
+
type UserGenerics<UserConfig extends Config = Config, UserProps extends ExtractPropsFromConfig<UserConfig> = ExtractPropsFromConfig<UserConfig>, UserRootProps extends ExtractRootPropsFromConfig<UserConfig> = ExtractRootPropsFromConfig<UserConfig>, UserData extends Data<UserProps, UserRootProps> | Data = Data<UserProps, UserRootProps>, UserAppState extends PrivateAppState<UserData> = PrivateAppState<UserData>, UserPublicAppState extends AppState<UserData> = AppState<UserData>, UserComponentData extends ComponentData = UserData["content"][0]> = {
|
|
226
213
|
UserConfig: UserConfig;
|
|
227
214
|
UserProps: UserProps;
|
|
228
215
|
UserRootProps: UserRootProps;
|
|
229
216
|
UserData: UserData;
|
|
230
217
|
UserAppState: UserAppState;
|
|
218
|
+
UserPublicAppState: UserPublicAppState;
|
|
231
219
|
UserComponentData: UserComponentData;
|
|
232
220
|
};
|
|
233
221
|
|
|
@@ -561,4 +549,4 @@ type WalkTreeOptions = {
|
|
|
561
549
|
};
|
|
562
550
|
declare function walkTree<T extends ComponentData | RootData | G["UserData"], UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(data: T, config: UserConfig, callbackFn: (data: Content, options: WalkTreeOptions) => Content | null | void): T;
|
|
563
551
|
|
|
564
|
-
export { type
|
|
552
|
+
export { type Adaptor as $, type AppState as A, type BaseData as B, type ComponentData as C, type DropZoneProps as D, type ComponentDataOptionalId as E, type Fields as F, type MappedItem as G, type History as H, type IframeConfig as I, type ComponentDataMap as J, type Content as K, type BaseField as L, type Metadata as M, type NumberField as N, type Overrides as O, type Permissions as P, type TextareaField as Q, type RootDataWithProps as R, type Slot as S, type TextField as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type SelectField as X, type RadioField as Y, type ArrayField as Z, type ObjectField as _, type Config as a, type ExternalFieldWithAdaptor as a0, type ExternalField as a1, type CustomFieldRender as a2, type CustomField as a3, type SlotField as a4, type PuckContext as a5, type DefaultRootFieldProps as a6, type DefaultRootRenderProps as a7, type DefaultRootProps as a8, type DefaultComponentProps as a9, type WithId as aa, type WithPuckProps as ab, type AsFieldProps as ac, type WithChildren as ad, type ExtractPropsFromConfig as ae, type ExtractRootPropsFromConfig as af, migrate as ag, transformProps as ah, resolveAllData as ai, type PuckAction as b, type ResolveDataTrigger as c, type Plugin as d, type UiState as e, type ComponentConfig as f, type Field as g, type FieldProps as h, type Data as i, type OnAction as j, type InitialHistory as k, type ItemSelector as l, type Direction as m, type DragAxis as n, type Viewport as o, overrideKeys as p, type OverrideKey as q, type FieldRenderFunctions as r, type ItemWithId as s, type ArrayState as t, type SlotComponent as u, type PuckComponent as v, walkTree as w, type RootConfig as x, type RootDataWithoutProps as y, type RootData as z };
|
|
@@ -49,11 +49,11 @@ type RadioField = BaseField & {
|
|
|
49
49
|
type: "radio";
|
|
50
50
|
options: FieldOptions;
|
|
51
51
|
};
|
|
52
|
-
type ArrayField<Props extends {
|
|
52
|
+
type ArrayField<Props extends any = {
|
|
53
53
|
[key: string]: any;
|
|
54
|
-
} = {
|
|
54
|
+
}> = Props extends {
|
|
55
55
|
[key: string]: any;
|
|
56
|
-
}
|
|
56
|
+
} ? BaseField & {
|
|
57
57
|
type: "array";
|
|
58
58
|
arrayFields: {
|
|
59
59
|
[SubPropName in keyof Props[0]]: Field<Props[0][SubPropName]>;
|
|
@@ -62,14 +62,12 @@ type ArrayField<Props extends {
|
|
|
62
62
|
getItemSummary?: (item: Props[0], index?: number) => string;
|
|
63
63
|
max?: number;
|
|
64
64
|
min?: number;
|
|
65
|
-
};
|
|
66
|
-
type ObjectField<Props extends {
|
|
67
|
-
[key: string]: any;
|
|
68
|
-
} = {
|
|
65
|
+
} : never;
|
|
66
|
+
type ObjectField<Props extends any = {
|
|
69
67
|
[key: string]: any;
|
|
70
68
|
}> = BaseField & {
|
|
71
69
|
type: "object";
|
|
72
|
-
objectFields:
|
|
70
|
+
objectFields: {
|
|
73
71
|
[SubPropName in keyof Props]: Field<Props[SubPropName]>;
|
|
74
72
|
};
|
|
75
73
|
};
|
|
@@ -78,20 +76,17 @@ type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, Pr
|
|
|
78
76
|
fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
|
|
79
77
|
mapProp?: (value: TableShape) => PropShape;
|
|
80
78
|
};
|
|
81
|
-
type
|
|
82
|
-
|
|
83
|
-
} = {
|
|
79
|
+
type NotUndefined<T> = T extends undefined ? Record<string, any> : T;
|
|
80
|
+
type ExternalFieldWithAdaptor<Props extends any = {
|
|
84
81
|
[key: string]: any;
|
|
85
82
|
}> = BaseField & {
|
|
86
83
|
type: "external";
|
|
87
84
|
placeholder?: string;
|
|
88
85
|
adaptor: Adaptor<any, any, Props>;
|
|
89
86
|
adaptorParams?: object;
|
|
90
|
-
getItemSummary: (item: Props
|
|
87
|
+
getItemSummary: (item: NotUndefined<Props>, index?: number) => string;
|
|
91
88
|
};
|
|
92
|
-
type ExternalField<Props extends {
|
|
93
|
-
[key: string]: any;
|
|
94
|
-
} = {
|
|
89
|
+
type ExternalField<Props extends any = {
|
|
95
90
|
[key: string]: any;
|
|
96
91
|
}> = BaseField & {
|
|
97
92
|
type: "external";
|
|
@@ -102,7 +97,7 @@ type ExternalField<Props extends {
|
|
|
102
97
|
}) => Promise<any[] | null>;
|
|
103
98
|
mapProp?: (value: any) => Props;
|
|
104
99
|
mapRow?: (value: any) => Record<string, string | number | ReactElement>;
|
|
105
|
-
getItemSummary?: (item: Props
|
|
100
|
+
getItemSummary?: (item: NotUndefined<Props>, index?: number) => string;
|
|
106
101
|
showSearch?: boolean;
|
|
107
102
|
renderFooter?: (props: {
|
|
108
103
|
items: any[];
|
|
@@ -128,15 +123,7 @@ type SlotField = BaseField & {
|
|
|
128
123
|
allow?: string[];
|
|
129
124
|
disallow?: string[];
|
|
130
125
|
};
|
|
131
|
-
type Field<
|
|
132
|
-
[key: string]: any;
|
|
133
|
-
} ? Props : any> | ObjectField<Props extends {
|
|
134
|
-
[key: string]: any;
|
|
135
|
-
} ? Props : any> | ExternalField<Props extends {
|
|
136
|
-
[key: string]: any;
|
|
137
|
-
} ? Props : any> | ExternalFieldWithAdaptor<Props extends {
|
|
138
|
-
[key: string]: any;
|
|
139
|
-
} ? Props : any> | CustomField<Props> | SlotField;
|
|
126
|
+
type Field<ValueType = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType> | ObjectField<ValueType> | ExternalField<ValueType> | ExternalFieldWithAdaptor<ValueType> | CustomField<ValueType> | SlotField;
|
|
140
127
|
type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps> = {
|
|
141
128
|
[PropName in keyof Omit<ComponentProps, "editMode">]: Field<ComponentProps[PropName]>;
|
|
142
129
|
};
|
|
@@ -222,12 +209,13 @@ type WithChildren<Props> = Props & {
|
|
|
222
209
|
};
|
|
223
210
|
type ExtractPropsFromConfig<UserConfig> = UserConfig extends Config<infer P, any, any> ? P : never;
|
|
224
211
|
type ExtractRootPropsFromConfig<UserConfig> = UserConfig extends Config<any, infer P, any> ? P : never;
|
|
225
|
-
type UserGenerics<UserConfig extends Config = Config, UserProps extends ExtractPropsFromConfig<UserConfig> = ExtractPropsFromConfig<UserConfig>, UserRootProps extends ExtractRootPropsFromConfig<UserConfig> = ExtractRootPropsFromConfig<UserConfig>, UserData extends Data<UserProps, UserRootProps> | Data = Data<UserProps, UserRootProps>, UserAppState extends PrivateAppState<UserData> = PrivateAppState<UserData>, UserComponentData extends ComponentData = UserData["content"][0]> = {
|
|
212
|
+
type UserGenerics<UserConfig extends Config = Config, UserProps extends ExtractPropsFromConfig<UserConfig> = ExtractPropsFromConfig<UserConfig>, UserRootProps extends ExtractRootPropsFromConfig<UserConfig> = ExtractRootPropsFromConfig<UserConfig>, UserData extends Data<UserProps, UserRootProps> | Data = Data<UserProps, UserRootProps>, UserAppState extends PrivateAppState<UserData> = PrivateAppState<UserData>, UserPublicAppState extends AppState<UserData> = AppState<UserData>, UserComponentData extends ComponentData = UserData["content"][0]> = {
|
|
226
213
|
UserConfig: UserConfig;
|
|
227
214
|
UserProps: UserProps;
|
|
228
215
|
UserRootProps: UserRootProps;
|
|
229
216
|
UserData: UserData;
|
|
230
217
|
UserAppState: UserAppState;
|
|
218
|
+
UserPublicAppState: UserPublicAppState;
|
|
231
219
|
UserComponentData: UserComponentData;
|
|
232
220
|
};
|
|
233
221
|
|
|
@@ -561,4 +549,4 @@ type WalkTreeOptions = {
|
|
|
561
549
|
};
|
|
562
550
|
declare function walkTree<T extends ComponentData | RootData | G["UserData"], UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(data: T, config: UserConfig, callbackFn: (data: Content, options: WalkTreeOptions) => Content | null | void): T;
|
|
563
551
|
|
|
564
|
-
export { type
|
|
552
|
+
export { type Adaptor as $, type AppState as A, type BaseData as B, type ComponentData as C, type DropZoneProps as D, type ComponentDataOptionalId as E, type Fields as F, type MappedItem as G, type History as H, type IframeConfig as I, type ComponentDataMap as J, type Content as K, type BaseField as L, type Metadata as M, type NumberField as N, type Overrides as O, type Permissions as P, type TextareaField as Q, type RootDataWithProps as R, type Slot as S, type TextField as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type SelectField as X, type RadioField as Y, type ArrayField as Z, type ObjectField as _, type Config as a, type ExternalFieldWithAdaptor as a0, type ExternalField as a1, type CustomFieldRender as a2, type CustomField as a3, type SlotField as a4, type PuckContext as a5, type DefaultRootFieldProps as a6, type DefaultRootRenderProps as a7, type DefaultRootProps as a8, type DefaultComponentProps as a9, type WithId as aa, type WithPuckProps as ab, type AsFieldProps as ac, type WithChildren as ad, type ExtractPropsFromConfig as ae, type ExtractRootPropsFromConfig as af, migrate as ag, transformProps as ah, resolveAllData as ai, type PuckAction as b, type ResolveDataTrigger as c, type Plugin as d, type UiState as e, type ComponentConfig as f, type Field as g, type FieldProps as h, type Data as i, type OnAction as j, type InitialHistory as k, type ItemSelector as l, type Direction as m, type DragAxis as n, type Viewport as o, overrideKeys as p, type OverrideKey as q, type FieldRenderFunctions as r, type ItemWithId as s, type ArrayState as t, type SlotComponent as u, type PuckComponent as v, walkTree as w, type RootConfig as x, type RootDataWithoutProps as y, type RootData as z };
|
package/package.json
CHANGED