@measured/puck 0.16.0-canary.53c8bfc → 0.16.0-canary.555902
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{Config-CkVFT1_w.d.mts → Config-RpUGTBxI.d.mts} +49 -42
- package/dist/{Config-CkVFT1_w.d.ts → Config-RpUGTBxI.d.ts} +49 -42
- package/dist/{chunk-TM7CT64S.mjs → chunk-7CYJT5DS.mjs} +6 -2
- package/dist/index.d.mts +19 -25
- package/dist/index.d.ts +19 -25
- package/dist/index.js +113 -98
- package/dist/index.mjs +108 -97
- package/dist/rsc.d.mts +1 -1
- package/dist/rsc.d.ts +1 -1
- package/dist/rsc.js +6 -2
- package/dist/rsc.mjs +1 -1
- package/package.json +13 -4
package/dist/index.mjs
CHANGED
@@ -8,7 +8,7 @@ import {
|
|
8
8
|
init_react_import,
|
9
9
|
rootDroppableId,
|
10
10
|
setupZone
|
11
|
-
} from "./chunk-
|
11
|
+
} from "./chunk-7CYJT5DS.mjs";
|
12
12
|
|
13
13
|
// ../../node_modules/classnames/index.js
|
14
14
|
var require_classnames = __commonJS({
|
@@ -80,31 +80,26 @@ init_react_import();
|
|
80
80
|
// lib/get-class-name-factory.ts
|
81
81
|
init_react_import();
|
82
82
|
var import_classnames = __toESM(require_classnames());
|
83
|
-
var getClassNameFactory = (rootClass, styles, { baseClass
|
84
|
-
let descendant = false;
|
85
|
-
let modifiers = false;
|
83
|
+
var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (options = {}) => {
|
86
84
|
if (typeof options === "string") {
|
87
|
-
descendant = options;
|
88
|
-
} else if (typeof options === "object") {
|
89
|
-
modifiers = options;
|
90
|
-
}
|
91
|
-
if (descendant) {
|
85
|
+
const descendant = options;
|
92
86
|
const style = styles[`${rootClass}-${descendant}`];
|
93
87
|
if (style) {
|
94
|
-
return baseClass + styles[`${rootClass}-${descendant}`] || "";
|
88
|
+
return config.baseClass + styles[`${rootClass}-${descendant}`] || "";
|
95
89
|
}
|
96
90
|
return "";
|
97
|
-
} else if (
|
91
|
+
} else if (typeof options === "object") {
|
92
|
+
const modifiers = options;
|
98
93
|
const prefixedModifiers = {};
|
99
94
|
for (let modifier in modifiers) {
|
100
95
|
prefixedModifiers[styles[`${rootClass}--${modifier}`]] = modifiers[modifier];
|
101
96
|
}
|
102
97
|
const c = styles[rootClass];
|
103
|
-
return baseClass + (0, import_classnames.default)(__spreadValues({
|
98
|
+
return config.baseClass + (0, import_classnames.default)(__spreadValues({
|
104
99
|
[c]: !!c
|
105
100
|
}, prefixedModifiers));
|
106
101
|
} else {
|
107
|
-
return baseClass + styles[rootClass] || "";
|
102
|
+
return config.baseClass + styles[rootClass] || "";
|
108
103
|
}
|
109
104
|
};
|
110
105
|
var get_class_name_factory_default = getClassNameFactory;
|
@@ -562,14 +557,14 @@ import {
|
|
562
557
|
|
563
558
|
// lib/get-item.ts
|
564
559
|
init_react_import();
|
565
|
-
|
560
|
+
function getItem(selector, data, dynamicProps = {}) {
|
566
561
|
if (!selector.zone || selector.zone === rootDroppableId) {
|
567
562
|
const item2 = data.content[selector.index];
|
568
563
|
return (item2 == null ? void 0 : item2.props) ? __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props }) : void 0;
|
569
564
|
}
|
570
565
|
const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
|
571
566
|
return (item == null ? void 0 : item.props) ? __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props }) : void 0;
|
572
|
-
}
|
567
|
+
}
|
573
568
|
|
574
569
|
// components/ViewportControls/default-viewports.ts
|
575
570
|
init_react_import();
|
@@ -583,7 +578,7 @@ var defaultViewports = [
|
|
583
578
|
import { UAParser } from "ua-parser-js";
|
584
579
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
585
580
|
var defaultAppState = {
|
586
|
-
data: { content: [], root: {
|
581
|
+
data: { content: [], root: {} },
|
587
582
|
ui: {
|
588
583
|
leftSideBarVisible: true,
|
589
584
|
rightSideBarVisible: true,
|
@@ -1378,7 +1373,7 @@ var ExternalInput = ({
|
|
1378
1373
|
}
|
1379
1374
|
) })
|
1380
1375
|
] })
|
1381
|
-
] }) : /* @__PURE__ */ jsx14(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
|
1376
|
+
] }) : /* @__PURE__ */ jsx14(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
|
1382
1377
|
/* @__PURE__ */ jsxs7("div", { className: getClassNameModal("grid"), children: [
|
1383
1378
|
hasFilterFields && /* @__PURE__ */ jsx14("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
|
1384
1379
|
const filterField = filterFields[fieldName];
|
@@ -2818,7 +2813,7 @@ var SidebarSection = ({
|
|
2818
2813
|
),
|
2819
2814
|
/* @__PURE__ */ jsx26(ChevronRight, { size: 16 })
|
2820
2815
|
] }, i)) : null,
|
2821
|
-
/* @__PURE__ */ jsx26("div", { className: getClassName19("heading"), children: /* @__PURE__ */ jsx26(Heading, { rank: 2, size: "xs", children: title }) })
|
2816
|
+
/* @__PURE__ */ jsx26("div", { className: getClassName19("heading"), children: /* @__PURE__ */ jsx26(Heading, { rank: "2", size: "xs", children: title }) })
|
2822
2817
|
] }) }),
|
2823
2818
|
/* @__PURE__ */ jsx26("div", { className: getClassName19("content"), children }),
|
2824
2819
|
isLoading && /* @__PURE__ */ jsx26("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ jsx26(Loader, { size: 32 }) })
|
@@ -2851,7 +2846,7 @@ var remove = (list, index) => {
|
|
2851
2846
|
|
2852
2847
|
// lib/reduce-related-zones.ts
|
2853
2848
|
init_react_import();
|
2854
|
-
|
2849
|
+
function reduceRelatedZones(item, data, fn) {
|
2855
2850
|
return __spreadProps(__spreadValues({}, data), {
|
2856
2851
|
zones: Object.keys(data.zones || {}).reduce(
|
2857
2852
|
(acc, key) => {
|
@@ -2865,28 +2860,34 @@ var reduceRelatedZones = (item, data, fn) => {
|
|
2865
2860
|
{}
|
2866
2861
|
)
|
2867
2862
|
});
|
2868
|
-
}
|
2863
|
+
}
|
2869
2864
|
var findRelatedByZoneId = (zoneId, data) => {
|
2870
2865
|
const [zoneParentId] = getZoneId(zoneId);
|
2871
|
-
return (data.zones[zoneId] || []).reduce(
|
2872
|
-
|
2873
|
-
|
2874
|
-
|
2875
|
-
|
2876
|
-
|
2877
|
-
|
2866
|
+
return (data.zones[zoneId] || []).reduce(
|
2867
|
+
(acc, zoneItem) => {
|
2868
|
+
const related = findRelatedByItem(zoneItem, data);
|
2869
|
+
if (zoneItem.props.id === zoneParentId) {
|
2870
|
+
return __spreadProps(__spreadValues(__spreadValues({}, acc), related), { [zoneId]: zoneItem });
|
2871
|
+
}
|
2872
|
+
return __spreadValues(__spreadValues({}, acc), related);
|
2873
|
+
},
|
2874
|
+
{}
|
2875
|
+
);
|
2878
2876
|
};
|
2879
2877
|
var findRelatedByItem = (item, data) => {
|
2880
|
-
return Object.keys(data.zones || {}).reduce(
|
2881
|
-
|
2882
|
-
|
2883
|
-
|
2884
|
-
|
2885
|
-
|
2886
|
-
|
2887
|
-
|
2888
|
-
|
2889
|
-
|
2878
|
+
return Object.keys(data.zones || {}).reduce(
|
2879
|
+
(acc, zoneId) => {
|
2880
|
+
const [zoneParentId] = getZoneId(zoneId);
|
2881
|
+
if (item.props.id === zoneParentId) {
|
2882
|
+
const related = findRelatedByZoneId(zoneId, data);
|
2883
|
+
return __spreadProps(__spreadValues(__spreadValues({}, acc), related), {
|
2884
|
+
[zoneId]: data.zones[zoneId]
|
2885
|
+
});
|
2886
|
+
}
|
2887
|
+
return acc;
|
2888
|
+
},
|
2889
|
+
{}
|
2890
|
+
);
|
2890
2891
|
};
|
2891
2892
|
var removeRelatedZones = (item, data) => {
|
2892
2893
|
const newData = __spreadValues({}, data);
|
@@ -2896,7 +2897,7 @@ var removeRelatedZones = (item, data) => {
|
|
2896
2897
|
});
|
2897
2898
|
return newData;
|
2898
2899
|
};
|
2899
|
-
|
2900
|
+
function duplicateRelatedZones(item, data, newId) {
|
2900
2901
|
return reduceRelatedZones(item, data, (acc, key, zone) => {
|
2901
2902
|
const dupedZone = zone.map((zoneItem) => __spreadProps(__spreadValues({}, zoneItem), {
|
2902
2903
|
props: __spreadProps(__spreadValues({}, zoneItem.props), { id: generateId(zoneItem.type) })
|
@@ -2911,7 +2912,7 @@ var duplicateRelatedZones = (item, data, newId) => {
|
|
2911
2912
|
[`${newId}:${zoneId}`]: dupedZone
|
2912
2913
|
});
|
2913
2914
|
});
|
2914
|
-
}
|
2915
|
+
}
|
2915
2916
|
|
2916
2917
|
// reducer/data.ts
|
2917
2918
|
var zoneCache = {};
|
@@ -2935,7 +2936,7 @@ var replaceAction = (data, action) => {
|
|
2935
2936
|
})
|
2936
2937
|
});
|
2937
2938
|
};
|
2938
|
-
|
2939
|
+
function insertAction(data, action, config) {
|
2939
2940
|
const emptyComponentData = {
|
2940
2941
|
type: action.componentType,
|
2941
2942
|
props: __spreadProps(__spreadValues({}, config.components[action.componentType].defaultProps || {}), {
|
@@ -2961,8 +2962,8 @@ var insertAction = (data, action, config) => {
|
|
2961
2962
|
)
|
2962
2963
|
})
|
2963
2964
|
});
|
2964
|
-
}
|
2965
|
-
|
2965
|
+
}
|
2966
|
+
function reduceData(data, action, config) {
|
2966
2967
|
if (action.type === "insert") {
|
2967
2968
|
return insertAction(data, action, config);
|
2968
2969
|
}
|
@@ -3111,7 +3112,7 @@ var reduceData = (data, action, config) => {
|
|
3111
3112
|
return __spreadValues(__spreadValues({}, data), action.data(data));
|
3112
3113
|
}
|
3113
3114
|
return data;
|
3114
|
-
}
|
3115
|
+
}
|
3115
3116
|
|
3116
3117
|
// reducer/state.ts
|
3117
3118
|
init_react_import();
|
@@ -3129,7 +3130,7 @@ var reduceUi = (ui, action) => {
|
|
3129
3130
|
init_react_import();
|
3130
3131
|
|
3131
3132
|
// reducer/index.ts
|
3132
|
-
|
3133
|
+
function storeInterceptor(reducer, record, onAction) {
|
3133
3134
|
return (state, action) => {
|
3134
3135
|
const newAppState = reducer(state, action);
|
3135
3136
|
const isValidType = ![
|
@@ -3145,7 +3146,7 @@ var storeInterceptor = (reducer, record, onAction) => {
|
|
3145
3146
|
onAction == null ? void 0 : onAction(action, newAppState, state);
|
3146
3147
|
return newAppState;
|
3147
3148
|
};
|
3148
|
-
}
|
3149
|
+
}
|
3149
3150
|
var setAction = (state, action) => {
|
3150
3151
|
if (typeof action.state === "object") {
|
3151
3152
|
return __spreadValues(__spreadValues({}, state), action.state);
|
@@ -3260,28 +3261,30 @@ var applyDynamicProps = (data, dynamicProps, rootData) => {
|
|
3260
3261
|
// lib/resolve-root-data.ts
|
3261
3262
|
init_react_import();
|
3262
3263
|
var cache3 = {};
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
if (((
|
3267
|
-
|
3264
|
+
function resolveRootData(data, config) {
|
3265
|
+
return __async(this, null, function* () {
|
3266
|
+
var _a, _b, _c, _d, _e;
|
3267
|
+
if (((_a = config.root) == null ? void 0 : _a.resolveData) && data.root.props) {
|
3268
|
+
if (((_b = cache3.lastChange) == null ? void 0 : _b.original) === data.root) {
|
3269
|
+
return cache3.lastChange.resolved;
|
3270
|
+
}
|
3271
|
+
const changed = getChanged(data.root, (_c = cache3.lastChange) == null ? void 0 : _c.original);
|
3272
|
+
const rootWithProps = data.root;
|
3273
|
+
const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
|
3274
|
+
changed,
|
3275
|
+
lastData: ((_d = cache3.lastChange) == null ? void 0 : _d.original) || {}
|
3276
|
+
});
|
3277
|
+
cache3.lastChange = {
|
3278
|
+
original: data.root,
|
3279
|
+
resolved: resolvedRoot
|
3280
|
+
};
|
3281
|
+
return __spreadProps(__spreadValues(__spreadValues({}, data.root), resolvedRoot), {
|
3282
|
+
props: __spreadValues(__spreadValues({}, data.root.props), resolvedRoot.props)
|
3283
|
+
});
|
3268
3284
|
}
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3272
|
-
changed,
|
3273
|
-
lastData: ((_d = cache3.lastChange) == null ? void 0 : _d.original) || {}
|
3274
|
-
});
|
3275
|
-
cache3.lastChange = {
|
3276
|
-
original: data.root,
|
3277
|
-
resolved: resolvedRoot
|
3278
|
-
};
|
3279
|
-
return __spreadProps(__spreadValues(__spreadValues({}, data.root), resolvedRoot), {
|
3280
|
-
props: __spreadValues(__spreadValues({}, data.root.props), resolvedRoot.props)
|
3281
|
-
});
|
3282
|
-
}
|
3283
|
-
return data.root;
|
3284
|
-
});
|
3285
|
+
return data.root;
|
3286
|
+
});
|
3287
|
+
}
|
3285
3288
|
|
3286
3289
|
// lib/use-resolved-data.ts
|
3287
3290
|
var useResolvedData = (appState, config, dispatch) => {
|
@@ -3386,15 +3389,14 @@ var styles_module_default14 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpe
|
|
3386
3389
|
// components/MenuBar/index.tsx
|
3387
3390
|
import { Fragment as Fragment12, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
3388
3391
|
var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
|
3389
|
-
|
3392
|
+
function MenuBar({
|
3390
3393
|
appState,
|
3391
|
-
data = { content: [], root: {} },
|
3392
3394
|
dispatch,
|
3393
3395
|
menuOpen = false,
|
3394
3396
|
onPublish,
|
3395
3397
|
renderHeaderActions,
|
3396
3398
|
setMenuOpen
|
3397
|
-
})
|
3399
|
+
}) {
|
3398
3400
|
const {
|
3399
3401
|
history: { back, forward, historyStore }
|
3400
3402
|
} = useAppContext();
|
@@ -3425,7 +3427,7 @@ var MenuBar = ({
|
|
3425
3427
|
] })
|
3426
3428
|
}
|
3427
3429
|
);
|
3428
|
-
}
|
3430
|
+
}
|
3429
3431
|
|
3430
3432
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
3431
3433
|
init_react_import();
|
@@ -3458,9 +3460,7 @@ var useResolvedFields = () => {
|
|
3458
3460
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
3459
3461
|
const defaultFields = selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields;
|
3460
3462
|
const rootProps = data.root.props || data.root;
|
3461
|
-
const [lastSelectedData, setLastSelectedData] = useState14(
|
3462
|
-
{}
|
3463
|
-
);
|
3463
|
+
const [lastSelectedData, setLastSelectedData] = useState14({});
|
3464
3464
|
const [resolvedFields, setResolvedFields] = useState14(defaultFields || {});
|
3465
3465
|
const [fieldsLoading, setFieldsLoading] = useState14(false);
|
3466
3466
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
@@ -3623,7 +3623,7 @@ var Fields = () => {
|
|
3623
3623
|
`${selectedItem.props.id}_${fieldName}`
|
3624
3624
|
);
|
3625
3625
|
} else {
|
3626
|
-
const
|
3626
|
+
const readOnly = data.root.readOnly || {};
|
3627
3627
|
return /* @__PURE__ */ jsx28(
|
3628
3628
|
AutoFieldPrivate,
|
3629
3629
|
{
|
@@ -4084,13 +4084,9 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
4084
4084
|
const Page = useCallback7(
|
4085
4085
|
(pageProps) => {
|
4086
4086
|
var _a, _b;
|
4087
|
-
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(
|
4087
|
+
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
4088
4088
|
id: "puck-root"
|
4089
|
-
}, pageProps), {
|
4090
|
-
editMode: true,
|
4091
|
-
// DEPRECATED
|
4092
|
-
puck: { renderDropZone: DropZone, isEditing: true }
|
4093
|
-
})) : /* @__PURE__ */ jsx33(Fragment15, { children: pageProps.children });
|
4089
|
+
}, pageProps)) : /* @__PURE__ */ jsx33(Fragment15, { children: pageProps.children });
|
4094
4090
|
},
|
4095
4091
|
[config.root]
|
4096
4092
|
);
|
@@ -4114,14 +4110,28 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
4114
4110
|
setStatus("READY");
|
4115
4111
|
},
|
4116
4112
|
children: /* @__PURE__ */ jsx33(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
4117
|
-
const inner = /* @__PURE__ */ jsx33(
|
4113
|
+
const inner = /* @__PURE__ */ jsx33(
|
4114
|
+
Page,
|
4115
|
+
__spreadProps(__spreadValues({}, rootProps), {
|
4116
|
+
puck: { renderDropZone: DropZone, isEditing: true },
|
4117
|
+
editMode: true,
|
4118
|
+
children: /* @__PURE__ */ jsx33(DropZone, { zone: rootDroppableId })
|
4119
|
+
})
|
4120
|
+
);
|
4118
4121
|
if (Frame) {
|
4119
4122
|
return /* @__PURE__ */ jsx33(Frame, { document: document2, children: inner });
|
4120
4123
|
}
|
4121
4124
|
return inner;
|
4122
4125
|
} })
|
4123
4126
|
}
|
4124
|
-
) : /* @__PURE__ */ jsx33("div", { id: "preview-frame", className: getClassName23("frame"), children: /* @__PURE__ */ jsx33(
|
4127
|
+
) : /* @__PURE__ */ jsx33("div", { id: "preview-frame", className: getClassName23("frame"), children: /* @__PURE__ */ jsx33(
|
4128
|
+
Page,
|
4129
|
+
__spreadProps(__spreadValues({}, rootProps), {
|
4130
|
+
puck: { renderDropZone: DropZone, isEditing: true },
|
4131
|
+
editMode: true,
|
4132
|
+
children: /* @__PURE__ */ jsx33(DropZone, { zone: rootDroppableId })
|
4133
|
+
})
|
4134
|
+
) })
|
4125
4135
|
}
|
4126
4136
|
);
|
4127
4137
|
};
|
@@ -4923,7 +4933,8 @@ var loadOverrides = ({
|
|
4923
4933
|
}) => {
|
4924
4934
|
const collected = __spreadValues({}, overrides);
|
4925
4935
|
plugins == null ? void 0 : plugins.forEach((plugin) => {
|
4926
|
-
Object.keys(plugin.overrides).forEach((
|
4936
|
+
Object.keys(plugin.overrides).forEach((_overridesType) => {
|
4937
|
+
const overridesType = _overridesType;
|
4927
4938
|
if (overridesType === "fieldTypes") {
|
4928
4939
|
const fieldTypes = plugin.overrides.fieldTypes;
|
4929
4940
|
Object.keys(fieldTypes).forEach((fieldType) => {
|
@@ -4963,7 +4974,7 @@ var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_mod
|
|
4963
4974
|
function Puck({
|
4964
4975
|
children,
|
4965
4976
|
config,
|
4966
|
-
data: initialData
|
4977
|
+
data: initialData,
|
4967
4978
|
ui: initialUi,
|
4968
4979
|
onChange,
|
4969
4980
|
onPublish,
|
@@ -4985,10 +4996,14 @@ function Puck({
|
|
4985
4996
|
var _a;
|
4986
4997
|
const historyStore = useHistoryStore(initialHistory);
|
4987
4998
|
const [reducer] = useState20(
|
4988
|
-
() => createReducer({
|
4999
|
+
() => createReducer({
|
5000
|
+
config,
|
5001
|
+
record: historyStore.record,
|
5002
|
+
onAction
|
5003
|
+
})
|
4989
5004
|
);
|
4990
5005
|
const [initialAppState] = useState20(() => {
|
4991
|
-
var _a2, _b, _c, _d, _e, _f, _g;
|
5006
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
|
4992
5007
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
4993
5008
|
let clientUiState = {};
|
4994
5009
|
if (typeof window !== "undefined") {
|
@@ -5008,20 +5023,20 @@ function Puck({
|
|
5008
5023
|
clientUiState = {
|
5009
5024
|
viewports: __spreadProps(__spreadValues({}, initial.viewports), {
|
5010
5025
|
current: __spreadProps(__spreadValues({}, initial.viewports.current), {
|
5011
|
-
height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || viewports[closestViewport].height || "auto",
|
5012
|
-
width: ((
|
5026
|
+
height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || ((_c = viewports[closestViewport]) == null ? void 0 : _c.height) || "auto",
|
5027
|
+
width: ((_e = (_d = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _d.current) == null ? void 0 : _e.width) || ((_f = viewports[closestViewport]) == null ? void 0 : _f.width)
|
5013
5028
|
})
|
5014
5029
|
})
|
5015
5030
|
};
|
5016
5031
|
}
|
5017
5032
|
}
|
5018
|
-
if (Object.keys((initialData == null ? void 0 : initialData.root) || {}).length > 0 && !((
|
5033
|
+
if (Object.keys((initialData == null ? void 0 : initialData.root) || {}).length > 0 && !((_g = initialData == null ? void 0 : initialData.root) == null ? void 0 : _g.props)) {
|
5019
5034
|
console.error(
|
5020
5035
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`, or republish this page to migrate automatically."
|
5021
5036
|
);
|
5022
5037
|
}
|
5023
|
-
const rootProps2 = ((
|
5024
|
-
const defaultedRootProps = __spreadValues(__spreadValues({}, (
|
5038
|
+
const rootProps2 = ((_h = initialData == null ? void 0 : initialData.root) == null ? void 0 : _h.props) || (initialData == null ? void 0 : initialData.root) || {};
|
5039
|
+
const defaultedRootProps = __spreadValues(__spreadValues({}, (_i = config.root) == null ? void 0 : _i.defaultProps), rootProps2);
|
5025
5040
|
return __spreadProps(__spreadValues({}, defaultAppState), {
|
5026
5041
|
data: __spreadProps(__spreadValues({}, initialData), {
|
5027
5042
|
root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: defaultedRootProps }),
|
@@ -5313,7 +5328,7 @@ function Puck({
|
|
5313
5328
|
}
|
5314
5329
|
)
|
5315
5330
|
] }),
|
5316
|
-
/* @__PURE__ */ jsx38("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ jsxs21(Heading, { rank: 2, size: "xs", children: [
|
5331
|
+
/* @__PURE__ */ jsx38("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ jsxs21(Heading, { rank: "2", size: "xs", children: [
|
5317
5332
|
headerTitle || rootProps.title || "Page",
|
5318
5333
|
headerPath && /* @__PURE__ */ jsxs21(Fragment19, { children: [
|
5319
5334
|
" ",
|
@@ -5341,7 +5356,6 @@ function Puck({
|
|
5341
5356
|
MenuBar,
|
5342
5357
|
{
|
5343
5358
|
appState,
|
5344
|
-
data,
|
5345
5359
|
dispatch,
|
5346
5360
|
onPublish,
|
5347
5361
|
menuOpen,
|
@@ -5397,10 +5411,7 @@ Puck.Preview = Preview;
|
|
5397
5411
|
// components/Render/index.tsx
|
5398
5412
|
init_react_import();
|
5399
5413
|
import { jsx as jsx39 } from "react/jsx-runtime";
|
5400
|
-
function Render({
|
5401
|
-
config,
|
5402
|
-
data
|
5403
|
-
}) {
|
5414
|
+
function Render({ config, data }) {
|
5404
5415
|
var _a;
|
5405
5416
|
const defaultedData = __spreadProps(__spreadValues({}, data), {
|
5406
5417
|
root: data.root || {},
|
package/dist/rsc.d.mts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { C as Config, D as Data } from './Config-
|
2
|
+
import { C as Config, D as Data } from './Config-RpUGTBxI.mjs';
|
3
3
|
import 'react';
|
4
4
|
|
5
5
|
declare function Render<UserConfig extends Config = Config>({ config, data, }: {
|
package/dist/rsc.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { C as Config, D as Data } from './Config-
|
2
|
+
import { C as Config, D as Data } from './Config-RpUGTBxI.js';
|
3
3
|
import 'react';
|
4
4
|
|
5
5
|
declare function Render<UserConfig extends Config = Config>({ config, data, }: {
|
package/dist/rsc.js
CHANGED
@@ -58,12 +58,16 @@ var import_react = __toESM(require("react"));
|
|
58
58
|
var rootDroppableId = "default-zone";
|
59
59
|
|
60
60
|
// lib/setup-zone.ts
|
61
|
+
function ensureZones(data) {
|
62
|
+
return __spreadProps(__spreadValues({}, data), {
|
63
|
+
zones: data.zones || {}
|
64
|
+
});
|
65
|
+
}
|
61
66
|
var setupZone = (data, zoneKey) => {
|
62
67
|
if (zoneKey === rootDroppableId) {
|
63
68
|
return data;
|
64
69
|
}
|
65
|
-
const newData =
|
66
|
-
newData.zones = data.zones || {};
|
70
|
+
const newData = ensureZones(data);
|
67
71
|
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
68
72
|
return newData;
|
69
73
|
};
|
package/dist/rsc.mjs
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck",
|
3
|
-
"version": "0.16.0-canary.
|
3
|
+
"version": "0.16.0-canary.555902",
|
4
4
|
"author": "Measured Corporation Ltd <hello@measured.co>",
|
5
5
|
"repository": "measuredco/puck",
|
6
6
|
"bugs": "https://github.com/measuredco/puck/issues",
|
@@ -10,9 +10,16 @@
|
|
10
10
|
"types": "./dist/index.d.ts",
|
11
11
|
"exports": {
|
12
12
|
".": {
|
13
|
-
"
|
14
|
-
|
15
|
-
|
13
|
+
"react-server": {
|
14
|
+
"import": "./dist/rsc.mjs",
|
15
|
+
"require": "./dist/rsc.js",
|
16
|
+
"types": "./dist/rsc.d.ts"
|
17
|
+
},
|
18
|
+
"default": {
|
19
|
+
"import": "./dist/index.mjs",
|
20
|
+
"require": "./dist/index.js",
|
21
|
+
"types": "./dist/index.d.ts"
|
22
|
+
}
|
16
23
|
},
|
17
24
|
"./rsc": {
|
18
25
|
"import": "./dist/rsc.mjs",
|
@@ -44,9 +51,11 @@
|
|
44
51
|
"@testing-library/react": "^14.0.0",
|
45
52
|
"@types/deep-diff": "^1.0.3",
|
46
53
|
"@types/jest": "^29.5.4",
|
54
|
+
"@types/object-hash": "^3.0.6",
|
47
55
|
"@types/react": "^18.2.0",
|
48
56
|
"@types/react-dom": "^18.2.0",
|
49
57
|
"@types/ua-parser-js": "^0.7.39",
|
58
|
+
"@types/uuid": "^10.0.0",
|
50
59
|
"css-box-model": "^1.2.1",
|
51
60
|
"eslint": "^7.32.0",
|
52
61
|
"eslint-config-custom": "*",
|