@measured/puck 0.19.0-canary.896a6279 → 0.19.0-canary.a6dd529f
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/README.md +1 -0
- package/dist/{chunk-LT6HN46T.mjs → chunk-ZOHJNF5K.mjs} +187 -110
- package/dist/index.css +44 -38
- package/dist/index.d.mts +16 -6
- package/dist/index.d.ts +16 -6
- package/dist/index.js +221 -76
- package/dist/index.mjs +76 -7
- package/dist/{resolve-all-data-Cs8PfTrg.d.mts → resolve-all-data-BFRAghCj.d.mts} +5 -1
- package/dist/{resolve-all-data-Cs8PfTrg.d.ts → resolve-all-data-BFRAghCj.d.ts} +5 -1
- package/dist/rsc.css +12 -11
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +123 -69
- package/dist/rsc.mjs +1 -1
- package/package.json +1 -1
@@ -23,6 +23,7 @@ type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
|
|
23
23
|
type BaseField = {
|
24
24
|
label?: string;
|
25
25
|
labelIcon?: ReactElement;
|
26
|
+
metadata?: Metadata;
|
26
27
|
};
|
27
28
|
type TextField = BaseField & {
|
28
29
|
type: "text";
|
@@ -122,6 +123,8 @@ type CustomField<Props extends any = {}> = BaseField & {
|
|
122
123
|
};
|
123
124
|
type SlotField = BaseField & {
|
124
125
|
type: "slot";
|
126
|
+
allow?: string[];
|
127
|
+
disallow?: string[];
|
125
128
|
};
|
126
129
|
type Field<Props extends any = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props extends {
|
127
130
|
[key: string]: any;
|
@@ -187,6 +190,7 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
|
|
187
190
|
appState: AppState;
|
188
191
|
lastData: DataShape | null;
|
189
192
|
}) => Promise<Partial<Permissions>> | Partial<Permissions>;
|
193
|
+
metadata?: Metadata;
|
190
194
|
};
|
191
195
|
type RootConfig<RootProps extends DefaultComponentProps = any> = Partial<ComponentConfig<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
|
192
196
|
type Category<ComponentName> = {
|
@@ -522,4 +526,4 @@ declare function transformProps<Props extends DefaultComponentProps = DefaultCom
|
|
522
526
|
|
523
527
|
declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, metadata?: Metadata, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
|
524
528
|
|
525
|
-
export { type
|
529
|
+
export { type SlotField as $, type AppState as A, type BaseData as B, type ComponentData as C, type DropZoneProps as D, type ComponentDataMap as E, type Fields as F, type BaseField as G, type History as H, type IframeConfig as I, type TextareaField as J, type SelectField as K, type RadioField as L, type Metadata as M, type NumberField as N, type Overrides as O, type Permissions as P, type ArrayField as Q, type RootDataWithProps as R, type Slot as S, type TextField as T, type UserGenerics as U, type Viewports as V, type ObjectField as W, type Adaptor as X, type ExternalFieldWithAdaptor as Y, type ExternalField as Z, type CustomField as _, type Config as a, type PuckContext as a0, type DefaultRootFieldProps as a1, type DefaultRootRenderProps as a2, type DefaultRootProps as a3, type DefaultComponentProps as a4, type WithId as a5, type WithPuckProps as a6, type AsFieldProps as a7, type WithChildren as a8, type ExtractPropsFromConfig as a9, type ExtractRootPropsFromConfig as aa, transformProps as ab, resolveAllData as ac, 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 RootData as l, type Content as m, type ItemSelector as n, type Direction as o, type DragAxis as p, type Viewport as q, overrideKeys as r, type OverrideKey as s, type FieldRenderFunctions as t, type ItemWithId as u, type ArrayState as v, type PuckComponent as w, type RootConfig as x, type RootDataWithoutProps as y, type MappedItem as z };
|
package/dist/rsc.css
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css/#css-module-data */
|
2
|
-
.
|
2
|
+
._DraggableComponent_qzbgx_1 {
|
3
3
|
position: absolute;
|
4
4
|
pointer-events: none;
|
5
5
|
--overlay-background: color-mix( in srgb, var(--puck-color-azure-08) 30%, transparent );
|
6
6
|
}
|
7
|
-
._DraggableComponent-
|
7
|
+
._DraggableComponent-overlay_qzbgx_12 {
|
8
8
|
cursor: pointer;
|
9
9
|
height: 100%;
|
10
10
|
width: 100%;
|
@@ -16,10 +16,10 @@
|
|
16
16
|
box-sizing: border-box;
|
17
17
|
z-index: 1;
|
18
18
|
}
|
19
|
-
.
|
19
|
+
._DraggableComponent_qzbgx_1:focus-visible > ._DraggableComponent-overlay_qzbgx_12 {
|
20
20
|
outline: 1px solid var(--puck-color-azure-05);
|
21
21
|
}
|
22
|
-
._DraggableComponent-
|
22
|
+
._DraggableComponent-loadingOverlay_qzbgx_29 {
|
23
23
|
background: var(--puck-color-white);
|
24
24
|
color: var(--puck-color-grey-03);
|
25
25
|
border-radius: 4px;
|
@@ -34,35 +34,36 @@
|
|
34
34
|
opacity: 0.8;
|
35
35
|
z-index: 1;
|
36
36
|
}
|
37
|
-
._DraggableComponent--
|
37
|
+
._DraggableComponent--hover_qzbgx_45:not(._DraggableComponent--isLocked_qzbgx_45) > ._DraggableComponent-overlay_qzbgx_12 {
|
38
38
|
background: var(--overlay-background);
|
39
39
|
}
|
40
|
-
._DraggableComponent--
|
40
|
+
._DraggableComponent--hover_qzbgx_45 > ._DraggableComponent-overlay_qzbgx_12 {
|
41
41
|
outline: 2px var(--puck-color-azure-09) solid;
|
42
42
|
}
|
43
|
-
._DraggableComponent--
|
43
|
+
._DraggableComponent--isSelected_qzbgx_54 > ._DraggableComponent-overlay_qzbgx_12 {
|
44
44
|
outline-color: var(--puck-color-azure-07);
|
45
45
|
}
|
46
|
-
.
|
46
|
+
._DraggableComponent_qzbgx_1:has(._DraggableComponent--hover_qzbgx_45 > ._DraggableComponent-overlay_qzbgx_12) > ._DraggableComponent-overlay_qzbgx_12 {
|
47
47
|
display: none;
|
48
48
|
}
|
49
|
-
._DraggableComponent-
|
49
|
+
._DraggableComponent-actionsOverlay_qzbgx_66 {
|
50
50
|
position: sticky;
|
51
51
|
opacity: 0;
|
52
52
|
pointer-events: none;
|
53
53
|
z-index: 2;
|
54
54
|
}
|
55
|
-
._DraggableComponent--
|
55
|
+
._DraggableComponent--isSelected_qzbgx_54 ._DraggableComponent-actionsOverlay_qzbgx_66 {
|
56
56
|
opacity: 1;
|
57
57
|
pointer-events: auto;
|
58
58
|
}
|
59
|
-
._DraggableComponent-
|
59
|
+
._DraggableComponent-actions_qzbgx_66 {
|
60
60
|
position: absolute;
|
61
61
|
width: auto;
|
62
62
|
cursor: grab;
|
63
63
|
display: flex;
|
64
64
|
box-sizing: border-box;
|
65
65
|
transform-origin: right top;
|
66
|
+
min-height: 36px;
|
66
67
|
}
|
67
68
|
|
68
69
|
/* components/DraggableComponent/styles.css */
|
package/dist/rsc.d.mts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import {
|
3
|
-
export {
|
2
|
+
import { a as Config, U as UserGenerics, M as Metadata } from './resolve-all-data-BFRAghCj.mjs';
|
3
|
+
export { ac as resolveAllData, ab as transformProps } from './resolve-all-data-BFRAghCj.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 {
|
3
|
-
export {
|
2
|
+
import { a as Config, U as UserGenerics, M as Metadata } from './resolve-all-data-BFRAghCj.js';
|
3
|
+
export { ac as resolveAllData, ab as transformProps } from './resolve-all-data-BFRAghCj.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, }: {
|
package/dist/rsc.js
CHANGED
@@ -195,7 +195,7 @@ var setupZone = (data, zoneKey) => {
|
|
195
195
|
// lib/use-slots.tsx
|
196
196
|
init_react_import();
|
197
197
|
var import_react2 = require("react");
|
198
|
-
function useSlots(config, props,
|
198
|
+
function useSlots(config, props, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
199
199
|
const slotProps = (0, import_react2.useMemo)(() => {
|
200
200
|
if (!(config == null ? void 0 : config.fields)) return props;
|
201
201
|
const slotProps2 = {};
|
@@ -205,7 +205,11 @@ function useSlots(config, props, renderSlot) {
|
|
205
205
|
const field = config.fields[fieldKey];
|
206
206
|
if ((field == null ? void 0 : field.type) === "slot") {
|
207
207
|
const content = props[fieldKey] || [];
|
208
|
-
const
|
208
|
+
const render = (readOnly == null ? void 0 : readOnly[fieldKey]) || forceReadOnly ? renderSlotRender : renderSlotEdit;
|
209
|
+
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
210
|
+
allow: field.allow,
|
211
|
+
disallow: field.disallow
|
212
|
+
}, dzProps), {
|
209
213
|
zone: fieldKey,
|
210
214
|
content
|
211
215
|
}));
|
@@ -213,7 +217,7 @@ function useSlots(config, props, renderSlot) {
|
|
213
217
|
}
|
214
218
|
}
|
215
219
|
return slotProps2;
|
216
|
-
}, [config]);
|
220
|
+
}, [config, readOnly, forceReadOnly]);
|
217
221
|
return __spreadValues(__spreadValues({}, props), slotProps);
|
218
222
|
}
|
219
223
|
|
@@ -231,7 +235,7 @@ var import_react13 = require("react");
|
|
231
235
|
|
232
236
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
233
237
|
init_react_import();
|
234
|
-
var styles_module_default = { "DraggableComponent": "
|
238
|
+
var styles_module_default = { "DraggableComponent": "_DraggableComponent_qzbgx_1", "DraggableComponent-overlay": "_DraggableComponent-overlay_qzbgx_12", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_qzbgx_29", "DraggableComponent--hover": "_DraggableComponent--hover_qzbgx_45", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_qzbgx_45", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_qzbgx_54", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_qzbgx_66", "DraggableComponent-actions": "_DraggableComponent-actions_qzbgx_66" };
|
235
239
|
|
236
240
|
// lib/get-class-name-factory.ts
|
237
241
|
init_react_import();
|
@@ -852,7 +856,6 @@ var reorderAction = (state, action, appStore) => {
|
|
852
856
|
init_react_import();
|
853
857
|
var removeAction = (state, action, appStore) => {
|
854
858
|
const item = getItem({ index: action.index, zone: action.zone }, state);
|
855
|
-
const [parentId] = action.zone.split(":");
|
856
859
|
const nodesToDelete = Object.entries(state.indexes.nodes).reduce(
|
857
860
|
(acc, [nodeId, nodeData]) => {
|
858
861
|
const pathIds = nodeData.path.map((p) => p.split(":")[0]);
|
@@ -871,24 +874,17 @@ var removeAction = (state, action, appStore) => {
|
|
871
874
|
return remove(content, action.index);
|
872
875
|
}
|
873
876
|
return content;
|
874
|
-
},
|
875
|
-
(childItem, path) => {
|
876
|
-
const parentIds = path.map((p) => p.split(":")[0]);
|
877
|
-
if (childItem.props.id === parentId || childItem.props.id === item.props.id || parentIds.indexOf(item.props.id) > -1) {
|
878
|
-
return childItem;
|
879
|
-
}
|
880
|
-
return null;
|
881
877
|
}
|
882
878
|
);
|
883
879
|
Object.keys(newState.data.zones || {}).forEach((zoneCompound) => {
|
884
|
-
const
|
885
|
-
if (nodesToDelete.includes(
|
880
|
+
const parentId = zoneCompound.split(":")[0];
|
881
|
+
if (nodesToDelete.includes(parentId) && newState.data.zones) {
|
886
882
|
delete newState.data.zones[zoneCompound];
|
887
883
|
}
|
888
884
|
});
|
889
885
|
Object.keys(newState.indexes.zones).forEach((zoneCompound) => {
|
890
|
-
const
|
891
|
-
if (nodesToDelete.includes(
|
886
|
+
const parentId = zoneCompound.split(":")[0];
|
887
|
+
if (nodesToDelete.includes(parentId)) {
|
892
888
|
delete newState.indexes.zones[zoneCompound];
|
893
889
|
}
|
894
890
|
});
|
@@ -1171,7 +1167,7 @@ var createHistorySlice = (set, get) => {
|
|
1171
1167
|
const { dispatch, history } = get();
|
1172
1168
|
dispatch({
|
1173
1169
|
type: "set",
|
1174
|
-
state: ((_a = history.histories[
|
1170
|
+
state: ((_a = history.histories[index]) == null ? void 0 : _a.state) || history.initialAppState
|
1175
1171
|
});
|
1176
1172
|
set({ history: __spreadProps(__spreadValues({}, history), { index }) });
|
1177
1173
|
},
|
@@ -1370,7 +1366,7 @@ init_react_import();
|
|
1370
1366
|
|
1371
1367
|
// lib/data/map-slots.ts
|
1372
1368
|
init_react_import();
|
1373
|
-
function
|
1369
|
+
function mapSlotsAsync(_0, _1) {
|
1374
1370
|
return __async(this, arguments, function* (item, map, recursive = true, isSlot2 = isSlot) {
|
1375
1371
|
const props = __spreadValues({}, item.props);
|
1376
1372
|
const propKeys = Object.keys(props);
|
@@ -1381,7 +1377,7 @@ function mapSlots(_0, _1) {
|
|
1381
1377
|
const content = props[propKey];
|
1382
1378
|
const mappedContent = recursive ? yield Promise.all(
|
1383
1379
|
content.map((item2) => __async(this, null, function* () {
|
1384
|
-
return yield
|
1380
|
+
return yield mapSlotsAsync(item2, map, recursive, isSlot2);
|
1385
1381
|
}))
|
1386
1382
|
) : content;
|
1387
1383
|
props[propKey] = yield map(mappedContent, propKey);
|
@@ -1409,14 +1405,14 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1409
1405
|
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
1410
1406
|
changed,
|
1411
1407
|
lastData: oldItem,
|
1412
|
-
metadata,
|
1408
|
+
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
1413
1409
|
trigger
|
1414
1410
|
});
|
1415
1411
|
let resolvedItem = __spreadProps(__spreadValues({}, item), {
|
1416
1412
|
props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
|
1417
1413
|
});
|
1418
1414
|
if (recursive) {
|
1419
|
-
resolvedItem = yield
|
1415
|
+
resolvedItem = yield mapSlotsAsync(
|
1420
1416
|
resolvedItem,
|
1421
1417
|
(content) => __async(void 0, null, function* () {
|
1422
1418
|
return Promise.all(
|
@@ -3326,12 +3322,6 @@ var DropZoneChild = ({
|
|
3326
3322
|
}) => {
|
3327
3323
|
var _a, _b;
|
3328
3324
|
const metadata = useAppStore((s) => s.metadata);
|
3329
|
-
const puckProps = {
|
3330
|
-
renderDropZone: DropZoneEditPure,
|
3331
|
-
isEditing: true,
|
3332
|
-
dragRef: null,
|
3333
|
-
metadata
|
3334
|
-
};
|
3335
3325
|
const ctx = (0, import_react25.useContext)(dropZoneContext);
|
3336
3326
|
const { depth = 1 } = ctx != null ? ctx : {};
|
3337
3327
|
const nodeProps = useAppStore(
|
@@ -3346,11 +3336,23 @@ var DropZoneChild = ({
|
|
3346
3336
|
return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.data.type;
|
3347
3337
|
}
|
3348
3338
|
);
|
3339
|
+
const nodeReadOnly = useAppStore(
|
3340
|
+
(0, import_shallow3.useShallow)((s) => {
|
3341
|
+
var _a2;
|
3342
|
+
return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.data.readOnly;
|
3343
|
+
})
|
3344
|
+
);
|
3349
3345
|
const node = { type: nodeType, props: nodeProps };
|
3350
3346
|
const item = nodeProps ? node : (preview == null ? void 0 : preview.componentType) ? { type: preview.componentType, props: preview.props } : null;
|
3351
3347
|
const componentConfig = useAppStore(
|
3352
3348
|
(s) => (item == null ? void 0 : item.type) ? s.config.components[item.type] : null
|
3353
3349
|
);
|
3350
|
+
const puckProps = {
|
3351
|
+
renderDropZone: DropZoneEditPure,
|
3352
|
+
isEditing: true,
|
3353
|
+
dragRef: null,
|
3354
|
+
metadata: __spreadValues(__spreadValues({}, metadata), componentConfig == null ? void 0 : componentConfig.metadata)
|
3355
|
+
};
|
3354
3356
|
const overrides = useAppStore((s) => s.overrides);
|
3355
3357
|
const isLoading = useAppStore(
|
3356
3358
|
(s) => {
|
@@ -3382,7 +3384,10 @@ var DropZoneChild = ({
|
|
3382
3384
|
const defaultedPropsWithSlots = useSlots(
|
3383
3385
|
componentConfig,
|
3384
3386
|
defaultsProps,
|
3385
|
-
DropZoneEditPure
|
3387
|
+
DropZoneEditPure,
|
3388
|
+
(slotProps) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }),
|
3389
|
+
nodeReadOnly,
|
3390
|
+
isLoading
|
3386
3391
|
);
|
3387
3392
|
if (!item) return;
|
3388
3393
|
let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
@@ -3480,6 +3485,11 @@ var DropZoneEdit = (0, import_react25.forwardRef)(
|
|
3480
3485
|
);
|
3481
3486
|
(0, import_react25.useEffect)(() => {
|
3482
3487
|
if (!zoneType || zoneType === "dropzone") {
|
3488
|
+
if (zoneCompound !== rootDroppableId) {
|
3489
|
+
console.warn(
|
3490
|
+
"DropZones have been deprecated in favor of slot fields and will be removed in a future version of Puck. Please see the migration guide: https://www.puckeditor.com/docs/guides/migrations/dropzones-to-slots"
|
3491
|
+
);
|
3492
|
+
}
|
3483
3493
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
3484
3494
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
3485
3495
|
}
|
@@ -3603,6 +3613,30 @@ var DropZoneEdit = (0, import_react25.forwardRef)(
|
|
3603
3613
|
);
|
3604
3614
|
}
|
3605
3615
|
);
|
3616
|
+
var DropZoneRenderItem = ({
|
3617
|
+
config,
|
3618
|
+
item,
|
3619
|
+
metadata
|
3620
|
+
}) => {
|
3621
|
+
const Component = config.components[item.type];
|
3622
|
+
const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
3623
|
+
const nextContextValue = (0, import_react25.useMemo)(
|
3624
|
+
() => ({
|
3625
|
+
areaId: props.id,
|
3626
|
+
depth: 1
|
3627
|
+
}),
|
3628
|
+
[props]
|
3629
|
+
);
|
3630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
3631
|
+
Component.render,
|
3632
|
+
__spreadProps(__spreadValues({}, props), {
|
3633
|
+
puck: __spreadProps(__spreadValues({}, props.puck), {
|
3634
|
+
renderDropZone: DropZoneRenderPure,
|
3635
|
+
metadata: __spreadValues(__spreadValues({}, metadata), Component.metadata)
|
3636
|
+
})
|
3637
|
+
})
|
3638
|
+
) }, props.id);
|
3639
|
+
};
|
3606
3640
|
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneRender, __spreadValues({}, props));
|
3607
3641
|
var DropZoneRender = (0, import_react25.forwardRef)(
|
3608
3642
|
function DropZoneRenderInternal({ className, style, zone }, ref) {
|
@@ -3633,29 +3667,15 @@ var DropZoneRender = (0, import_react25.forwardRef)(
|
|
3633
3667
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className, style, ref, children: content.map((item) => {
|
3634
3668
|
const Component = config.components[item.type];
|
3635
3669
|
if (Component) {
|
3636
|
-
|
3637
|
-
|
3638
|
-
|
3670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
3671
|
+
DropZoneRenderItem,
|
3672
|
+
{
|
3639
3673
|
config,
|
3674
|
+
item,
|
3640
3675
|
metadata
|
3641
|
-
}
|
3642
|
-
|
3643
|
-
const nextContextValue = (0, import_react25.useMemo)(
|
3644
|
-
() => ({
|
3645
|
-
areaId: props.id,
|
3646
|
-
depth: 1
|
3647
|
-
}),
|
3648
|
-
[props]
|
3676
|
+
},
|
3677
|
+
item.props.id
|
3649
3678
|
);
|
3650
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
3651
|
-
Component.render,
|
3652
|
-
__spreadProps(__spreadValues({}, props), {
|
3653
|
-
puck: {
|
3654
|
-
renderDropZone: DropZoneRenderPure,
|
3655
|
-
metadata: metadata || {}
|
3656
|
-
}
|
3657
|
-
})
|
3658
|
-
) }, props.id);
|
3659
3679
|
}
|
3660
3680
|
return null;
|
3661
3681
|
}) });
|
@@ -3674,30 +3694,60 @@ var DropZone = (0, import_react25.forwardRef)(
|
|
3674
3694
|
// components/SlotRender/index.tsx
|
3675
3695
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
3676
3696
|
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SlotRender, __spreadValues({}, props));
|
3697
|
+
var ContextSlotRender = ({
|
3698
|
+
componentId,
|
3699
|
+
zone
|
3700
|
+
}) => {
|
3701
|
+
const config = useAppStore((s) => s.config);
|
3702
|
+
const metadata = useAppStore((s) => s.metadata);
|
3703
|
+
const slotContent = useAppStore(
|
3704
|
+
(s) => {
|
3705
|
+
var _a, _b;
|
3706
|
+
return (_b = (_a = s.state.indexes.nodes[componentId]) == null ? void 0 : _a.data.props[zone]) != null ? _b : null;
|
3707
|
+
}
|
3708
|
+
);
|
3709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
3710
|
+
SlotRenderPure,
|
3711
|
+
{
|
3712
|
+
content: slotContent,
|
3713
|
+
zone,
|
3714
|
+
config,
|
3715
|
+
metadata
|
3716
|
+
}
|
3717
|
+
);
|
3718
|
+
};
|
3719
|
+
var Item = ({
|
3720
|
+
config,
|
3721
|
+
item,
|
3722
|
+
metadata
|
3723
|
+
}) => {
|
3724
|
+
const Component = config.components[item.type];
|
3725
|
+
const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
3726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
3727
|
+
Component.render,
|
3728
|
+
__spreadProps(__spreadValues({}, props), {
|
3729
|
+
puck: __spreadProps(__spreadValues({}, props.puck), {
|
3730
|
+
renderDropZone: DropZoneRenderPure,
|
3731
|
+
metadata: metadata || {}
|
3732
|
+
})
|
3733
|
+
})
|
3734
|
+
);
|
3735
|
+
};
|
3677
3736
|
var SlotRender = (0, import_react26.forwardRef)(
|
3678
3737
|
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
3679
3738
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className, style, ref, children: content.map((item) => {
|
3680
|
-
|
3681
|
-
|
3682
|
-
const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
3683
|
-
SlotRenderPure,
|
3684
|
-
__spreadProps(__spreadValues({}, slotProps), {
|
3685
|
-
config,
|
3686
|
-
metadata
|
3687
|
-
})
|
3688
|
-
));
|
3689
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
3690
|
-
Component.render,
|
3691
|
-
__spreadProps(__spreadValues({}, props), {
|
3692
|
-
puck: {
|
3693
|
-
renderDropZone: DropZoneRenderPure,
|
3694
|
-
metadata: metadata || {}
|
3695
|
-
}
|
3696
|
-
}),
|
3697
|
-
props.id
|
3698
|
-
);
|
3739
|
+
if (!config.components[item.type]) {
|
3740
|
+
return null;
|
3699
3741
|
}
|
3700
|
-
return
|
3742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
3743
|
+
Item,
|
3744
|
+
{
|
3745
|
+
config,
|
3746
|
+
item,
|
3747
|
+
metadata
|
3748
|
+
},
|
3749
|
+
item.props.id
|
3750
|
+
);
|
3701
3751
|
}) });
|
3702
3752
|
}
|
3703
3753
|
);
|
@@ -3832,7 +3882,11 @@ function resolveAllData(_0, _1) {
|
|
3832
3882
|
"force",
|
3833
3883
|
false
|
3834
3884
|
)).node;
|
3835
|
-
const resolvedDeep = yield
|
3885
|
+
const resolvedDeep = yield mapSlotsAsync(
|
3886
|
+
resolved,
|
3887
|
+
processContent,
|
3888
|
+
false
|
3889
|
+
);
|
3836
3890
|
onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
|
3837
3891
|
return resolvedDeep;
|
3838
3892
|
});
|
package/dist/rsc.mjs
CHANGED
package/package.json
CHANGED