@measured/puck 0.20.0-canary.7d869af1 → 0.20.0-canary.82bd49a3
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 +9 -9
- package/dist/{chunk-FNRZXWXT.mjs → chunk-AQUDTV7N.mjs} +2185 -461
- package/dist/chunk-HUKJ36SA.mjs +1064 -0
- package/dist/index.css +20 -18
- package/dist/index.js +223 -222
- package/dist/index.mjs +4 -4
- package/dist/no-external.css +20 -18
- package/dist/no-external.js +223 -222
- package/dist/no-external.mjs +4 -4
- package/dist/rsc.js +455 -1808
- package/dist/rsc.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-IP64IXIP.mjs +0 -2820
- package/dist/rsc.css +0 -26
package/dist/no-external.css
CHANGED
|
@@ -1428,23 +1428,25 @@ body:has(._DropZone--isAnimating_1i2sv_68:empty) [data-puck-overlay] {
|
|
|
1428
1428
|
}
|
|
1429
1429
|
|
|
1430
1430
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css/#css-module-data */
|
|
1431
|
-
.
|
|
1431
|
+
._Puck_a45x1_19 {
|
|
1432
1432
|
--puck-space-px: 16px;
|
|
1433
1433
|
font-family: var(--puck-font-family);
|
|
1434
1434
|
overflow-x: hidden;
|
|
1435
1435
|
}
|
|
1436
1436
|
@media (min-width: 766px) {
|
|
1437
|
-
.
|
|
1437
|
+
._Puck_a45x1_19 {
|
|
1438
1438
|
overflow-x: auto;
|
|
1439
1439
|
}
|
|
1440
1440
|
}
|
|
1441
|
-
._Puck-
|
|
1441
|
+
._Puck-portal_a45x1_31 {
|
|
1442
1442
|
position: relative;
|
|
1443
1443
|
z-index: 2;
|
|
1444
1444
|
}
|
|
1445
|
-
._PuckLayout-
|
|
1445
|
+
._PuckLayout-inner_a45x1_38 {
|
|
1446
1446
|
--puck-frame-width: auto;
|
|
1447
1447
|
--puck-side-bar-width: 0px;
|
|
1448
|
+
--puck-left-side-bar-width: var( --puck-user-left-side-bar-width, var(--puck-side-bar-width) );
|
|
1449
|
+
--puck-right-side-bar-width: var( --puck-user-right-side-bar-width, var(--puck-side-bar-width) );
|
|
1448
1450
|
display: grid;
|
|
1449
1451
|
grid-template-areas: "header header header" "left editor right";
|
|
1450
1452
|
grid-template-columns: 0 var(--puck-frame-width) 0;
|
|
@@ -1453,50 +1455,50 @@ body:has(._DropZone--isAnimating_1i2sv_68:empty) [data-puck-overlay] {
|
|
|
1453
1455
|
position: relative;
|
|
1454
1456
|
z-index: 0;
|
|
1455
1457
|
}
|
|
1456
|
-
._PuckLayout--
|
|
1458
|
+
._PuckLayout--mounted_a45x1_59 ._PuckLayout-inner_a45x1_38 {
|
|
1457
1459
|
--puck-side-bar-width: 186px;
|
|
1458
1460
|
}
|
|
1459
|
-
._PuckLayout--
|
|
1460
|
-
grid-template-columns: var(--puck-side-bar-width) var(--puck-frame-width) 0;
|
|
1461
|
+
._PuckLayout--leftSideBarVisible_a45x1_63 ._PuckLayout-inner_a45x1_38 {
|
|
1462
|
+
grid-template-columns: var(--puck-left-side-bar-width) var(--puck-frame-width) 0;
|
|
1461
1463
|
}
|
|
1462
|
-
._PuckLayout--
|
|
1463
|
-
grid-template-columns:
|
|
1464
|
+
._PuckLayout--rightSideBarVisible_a45x1_69 ._PuckLayout-inner_a45x1_38 {
|
|
1465
|
+
grid-template-columns: var(--puck-left-side-bar-width) var(--puck-frame-width) var(--puck-right-side-bar-width);
|
|
1464
1466
|
}
|
|
1465
|
-
._PuckLayout--
|
|
1466
|
-
grid-template-columns: var(--puck-side-bar-width) var(--puck-frame-width) var(--puck-side-bar-width);
|
|
1467
|
+
._PuckLayout--leftSideBarVisible_a45x1_63._PuckLayout--rightSideBarVisible_a45x1_69 ._PuckLayout-inner_a45x1_38 {
|
|
1468
|
+
grid-template-columns: var(--puck-left-side-bar-width) var(--puck-frame-width) var(--puck-right-side-bar-width);
|
|
1467
1469
|
}
|
|
1468
1470
|
@media (min-width: 458px) {
|
|
1469
|
-
._PuckLayout-
|
|
1471
|
+
._PuckLayout-mounted_a45x1_83 ._PuckLayout-inner_a45x1_38 {
|
|
1470
1472
|
--puck-frame-width: minmax(266px, auto);
|
|
1471
1473
|
}
|
|
1472
1474
|
}
|
|
1473
1475
|
@media (min-width: 638px) {
|
|
1474
|
-
.
|
|
1476
|
+
._PuckLayout_a45x1_38 ._PuckLayout-inner_a45x1_38 {
|
|
1475
1477
|
--puck-side-bar-width: minmax(186px, 250px);
|
|
1476
1478
|
}
|
|
1477
1479
|
}
|
|
1478
1480
|
@media (min-width: 766px) {
|
|
1479
|
-
.
|
|
1481
|
+
._PuckLayout_a45x1_38 ._PuckLayout-inner_a45x1_38 {
|
|
1480
1482
|
--puck-frame-width: auto;
|
|
1481
1483
|
}
|
|
1482
1484
|
}
|
|
1483
1485
|
@media (min-width: 990px) {
|
|
1484
|
-
.
|
|
1486
|
+
._PuckLayout_a45x1_38 ._PuckLayout-inner_a45x1_38 {
|
|
1485
1487
|
--puck-side-bar-width: 256px;
|
|
1486
1488
|
}
|
|
1487
1489
|
}
|
|
1488
1490
|
@media (min-width: 1198px) {
|
|
1489
|
-
.
|
|
1491
|
+
._PuckLayout_a45x1_38 ._PuckLayout-inner_a45x1_38 {
|
|
1490
1492
|
--puck-side-bar-width: 274px;
|
|
1491
1493
|
}
|
|
1492
1494
|
}
|
|
1493
1495
|
@media (min-width: 1398px) {
|
|
1494
|
-
.
|
|
1496
|
+
._PuckLayout_a45x1_38 ._PuckLayout-inner_a45x1_38 {
|
|
1495
1497
|
--puck-side-bar-width: 290px;
|
|
1496
1498
|
}
|
|
1497
1499
|
}
|
|
1498
1500
|
@media (min-width: 1598px) {
|
|
1499
|
-
.
|
|
1501
|
+
._PuckLayout_a45x1_38 ._PuckLayout-inner_a45x1_38 {
|
|
1500
1502
|
--puck-side-bar-width: 320px;
|
|
1501
1503
|
}
|
|
1502
1504
|
}
|
package/dist/no-external.js
CHANGED
|
@@ -5333,13 +5333,212 @@ function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
|
5333
5333
|
return mergedProps;
|
|
5334
5334
|
}
|
|
5335
5335
|
|
|
5336
|
-
// lib/field-transforms/default-transforms.tsx
|
|
5336
|
+
// lib/field-transforms/default-transforms/slot-transform.tsx
|
|
5337
5337
|
init_react_import();
|
|
5338
|
+
var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
5339
|
+
slot: ({ value: content, propName, field, isReadOnly }) => {
|
|
5340
|
+
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
|
5341
|
+
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
|
5342
|
+
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
|
5343
|
+
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
|
5344
|
+
}, dzProps), {
|
|
5345
|
+
zone: propName,
|
|
5346
|
+
content
|
|
5347
|
+
}));
|
|
5348
|
+
return Slot;
|
|
5349
|
+
}
|
|
5350
|
+
});
|
|
5338
5351
|
|
|
5339
|
-
//
|
|
5352
|
+
// lib/use-slots.tsx
|
|
5353
|
+
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
|
5354
|
+
return useFieldTransforms(
|
|
5355
|
+
config,
|
|
5356
|
+
item,
|
|
5357
|
+
getSlotTransform(renderSlotEdit, renderSlotRender),
|
|
5358
|
+
readOnly,
|
|
5359
|
+
forceReadOnly
|
|
5360
|
+
);
|
|
5361
|
+
}
|
|
5362
|
+
|
|
5363
|
+
// components/Render/index.tsx
|
|
5364
|
+
var import_react32 = __toESM(require("react"));
|
|
5365
|
+
|
|
5366
|
+
// components/SlotRender/index.tsx
|
|
5367
|
+
init_react_import();
|
|
5368
|
+
var import_shallow3 = require("zustand/react/shallow");
|
|
5369
|
+
|
|
5370
|
+
// components/SlotRender/server.tsx
|
|
5340
5371
|
init_react_import();
|
|
5341
5372
|
var import_react31 = require("react");
|
|
5342
5373
|
|
|
5374
|
+
// components/ServerRender/index.tsx
|
|
5375
|
+
init_react_import();
|
|
5376
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
5377
|
+
function DropZoneRender({
|
|
5378
|
+
zone,
|
|
5379
|
+
data,
|
|
5380
|
+
areaId = "root",
|
|
5381
|
+
config,
|
|
5382
|
+
metadata = {}
|
|
5383
|
+
}) {
|
|
5384
|
+
let zoneCompound = rootDroppableId;
|
|
5385
|
+
let content = (data == null ? void 0 : data.content) || [];
|
|
5386
|
+
if (!data || !config) {
|
|
5387
|
+
return null;
|
|
5388
|
+
}
|
|
5389
|
+
if (areaId !== rootAreaId && zone !== rootZone) {
|
|
5390
|
+
zoneCompound = `${areaId}:${zone}`;
|
|
5391
|
+
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
5392
|
+
}
|
|
5393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: content.map((item) => {
|
|
5394
|
+
const Component = config.components[item.type];
|
|
5395
|
+
const props = __spreadProps(__spreadValues({}, item.props), {
|
|
5396
|
+
puck: {
|
|
5397
|
+
renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5398
|
+
DropZoneRender,
|
|
5399
|
+
{
|
|
5400
|
+
zone: zone2,
|
|
5401
|
+
data,
|
|
5402
|
+
areaId: item.props.id,
|
|
5403
|
+
config,
|
|
5404
|
+
metadata
|
|
5405
|
+
}
|
|
5406
|
+
),
|
|
5407
|
+
metadata,
|
|
5408
|
+
dragRef: null,
|
|
5409
|
+
isEditing: false
|
|
5410
|
+
}
|
|
5411
|
+
});
|
|
5412
|
+
const renderItem = __spreadProps(__spreadValues({}, item), { props });
|
|
5413
|
+
const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
|
5414
|
+
if (Component) {
|
|
5415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
|
|
5416
|
+
}
|
|
5417
|
+
return null;
|
|
5418
|
+
}) });
|
|
5419
|
+
}
|
|
5420
|
+
|
|
5421
|
+
// components/SlotRender/server.tsx
|
|
5422
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
5423
|
+
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlotRender, __spreadValues({}, props));
|
|
5424
|
+
var Item = ({
|
|
5425
|
+
config,
|
|
5426
|
+
item,
|
|
5427
|
+
metadata
|
|
5428
|
+
}) => {
|
|
5429
|
+
const Component = config.components[item.type];
|
|
5430
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
5431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
5432
|
+
Component.render,
|
|
5433
|
+
__spreadProps(__spreadValues({}, props), {
|
|
5434
|
+
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
5435
|
+
renderDropZone: DropZoneRender,
|
|
5436
|
+
metadata: metadata || {}
|
|
5437
|
+
})
|
|
5438
|
+
})
|
|
5439
|
+
);
|
|
5440
|
+
};
|
|
5441
|
+
var SlotRender = (0, import_react31.forwardRef)(
|
|
5442
|
+
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
|
5443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className, style, ref, children: content.map((item) => {
|
|
5444
|
+
if (!config.components[item.type]) {
|
|
5445
|
+
return null;
|
|
5446
|
+
}
|
|
5447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
5448
|
+
Item,
|
|
5449
|
+
{
|
|
5450
|
+
config,
|
|
5451
|
+
item,
|
|
5452
|
+
metadata
|
|
5453
|
+
},
|
|
5454
|
+
item.props.id
|
|
5455
|
+
);
|
|
5456
|
+
}) });
|
|
5457
|
+
}
|
|
5458
|
+
);
|
|
5459
|
+
|
|
5460
|
+
// components/SlotRender/index.tsx
|
|
5461
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
5462
|
+
var ContextSlotRender = ({
|
|
5463
|
+
componentId,
|
|
5464
|
+
zone
|
|
5465
|
+
}) => {
|
|
5466
|
+
const config = useAppStore((s) => s.config);
|
|
5467
|
+
const metadata = useAppStore((s) => s.metadata);
|
|
5468
|
+
const slotContent = useAppStore(
|
|
5469
|
+
(0, import_shallow3.useShallow)((s) => {
|
|
5470
|
+
var _a, _b;
|
|
5471
|
+
const indexes = s.state.indexes;
|
|
5472
|
+
const contentIds = (_b = (_a = indexes.zones[`${componentId}:${zone}`]) == null ? void 0 : _a.contentIds) != null ? _b : [];
|
|
5473
|
+
return contentIds.map((contentId) => indexes.nodes[contentId].flatData);
|
|
5474
|
+
})
|
|
5475
|
+
);
|
|
5476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5477
|
+
SlotRenderPure,
|
|
5478
|
+
{
|
|
5479
|
+
content: slotContent,
|
|
5480
|
+
zone,
|
|
5481
|
+
config,
|
|
5482
|
+
metadata
|
|
5483
|
+
}
|
|
5484
|
+
);
|
|
5485
|
+
};
|
|
5486
|
+
|
|
5487
|
+
// components/Render/index.tsx
|
|
5488
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
5489
|
+
var renderContext = import_react32.default.createContext({
|
|
5490
|
+
config: { components: {} },
|
|
5491
|
+
data: { root: {}, content: [] },
|
|
5492
|
+
metadata: {}
|
|
5493
|
+
});
|
|
5494
|
+
function Render({
|
|
5495
|
+
config,
|
|
5496
|
+
data,
|
|
5497
|
+
metadata = {}
|
|
5498
|
+
}) {
|
|
5499
|
+
var _a;
|
|
5500
|
+
const defaultedData = __spreadProps(__spreadValues({}, data), {
|
|
5501
|
+
root: data.root || {},
|
|
5502
|
+
content: data.content || []
|
|
5503
|
+
});
|
|
5504
|
+
const rootProps = "props" in defaultedData.root ? defaultedData.root.props : defaultedData.root;
|
|
5505
|
+
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
|
5506
|
+
const pageProps = __spreadProps(__spreadValues({}, rootProps), {
|
|
5507
|
+
puck: {
|
|
5508
|
+
renderDropZone: DropZonePure,
|
|
5509
|
+
isEditing: false,
|
|
5510
|
+
dragRef: null,
|
|
5511
|
+
metadata
|
|
5512
|
+
},
|
|
5513
|
+
title,
|
|
5514
|
+
editMode: false,
|
|
5515
|
+
id: "puck-root"
|
|
5516
|
+
});
|
|
5517
|
+
const propsWithSlots = useSlots(
|
|
5518
|
+
config,
|
|
5519
|
+
{ type: "root", props: pageProps },
|
|
5520
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
|
|
5521
|
+
);
|
|
5522
|
+
const nextContextValue = (0, import_react32.useMemo)(
|
|
5523
|
+
() => ({
|
|
5524
|
+
mode: "render",
|
|
5525
|
+
depth: 0
|
|
5526
|
+
}),
|
|
5527
|
+
[]
|
|
5528
|
+
);
|
|
5529
|
+
if ((_a = config.root) == null ? void 0 : _a.render) {
|
|
5530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(config.root.render, __spreadProps(__spreadValues({}, propsWithSlots), { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZoneRenderPure, { zone: rootZone }) })) }) });
|
|
5531
|
+
}
|
|
5532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZoneRenderPure, { zone: rootZone }) }) });
|
|
5533
|
+
}
|
|
5534
|
+
|
|
5535
|
+
// lib/field-transforms/default-transforms/inline-text-transform.tsx
|
|
5536
|
+
init_react_import();
|
|
5537
|
+
|
|
5538
|
+
// components/InlineTextField/index.tsx
|
|
5539
|
+
init_react_import();
|
|
5540
|
+
var import_react33 = require("react");
|
|
5541
|
+
|
|
5343
5542
|
// lib/overlay-portal/index.tsx
|
|
5344
5543
|
init_react_import();
|
|
5345
5544
|
var registerOverlayPortal = (el, opts = {}) => {
|
|
@@ -5427,7 +5626,7 @@ function setDeep(node, path, newVal) {
|
|
|
5427
5626
|
}
|
|
5428
5627
|
|
|
5429
5628
|
// components/InlineTextField/index.tsx
|
|
5430
|
-
var
|
|
5629
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5431
5630
|
var getClassName17 = get_class_name_factory_default("InlineTextField", styles_module_default13);
|
|
5432
5631
|
var InlineTextFieldInternal = ({
|
|
5433
5632
|
propPath,
|
|
@@ -5437,10 +5636,10 @@ var InlineTextFieldInternal = ({
|
|
|
5437
5636
|
opts = {}
|
|
5438
5637
|
}) => {
|
|
5439
5638
|
var _a;
|
|
5440
|
-
const ref = (0,
|
|
5639
|
+
const ref = (0, import_react33.useRef)(null);
|
|
5441
5640
|
const appStoreApi = useAppStoreApi();
|
|
5442
5641
|
const disableLineBreaks = (_a = opts.disableLineBreaks) != null ? _a : false;
|
|
5443
|
-
(0,
|
|
5642
|
+
(0, import_react33.useEffect)(() => {
|
|
5444
5643
|
const appStore = appStoreApi.getState();
|
|
5445
5644
|
const data = appStore.state.indexes.nodes[componentId].data;
|
|
5446
5645
|
const componentConfig = appStore.getComponentConfig(data.type);
|
|
@@ -5482,9 +5681,9 @@ var InlineTextFieldInternal = ({
|
|
|
5482
5681
|
};
|
|
5483
5682
|
}
|
|
5484
5683
|
}, [appStoreApi, ref.current, value]);
|
|
5485
|
-
const [isHovering, setIsHovering] = (0,
|
|
5486
|
-
const [isFocused, setIsFocused] = (0,
|
|
5487
|
-
return /* @__PURE__ */ (0,
|
|
5684
|
+
const [isHovering, setIsHovering] = (0, import_react33.useState)(false);
|
|
5685
|
+
const [isFocused, setIsFocused] = (0, import_react33.useState)(false);
|
|
5686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5488
5687
|
"span",
|
|
5489
5688
|
{
|
|
5490
5689
|
className: getClassName17(),
|
|
@@ -5510,27 +5709,14 @@ var InlineTextFieldInternal = ({
|
|
|
5510
5709
|
}
|
|
5511
5710
|
);
|
|
5512
5711
|
};
|
|
5513
|
-
var InlineTextField = (0,
|
|
5712
|
+
var InlineTextField = (0, import_react33.memo)(InlineTextFieldInternal);
|
|
5514
5713
|
|
|
5515
|
-
// lib/field-transforms/default-transforms.tsx
|
|
5516
|
-
var
|
|
5517
|
-
var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
5518
|
-
slot: ({ value: content, propName, field, isReadOnly }) => {
|
|
5519
|
-
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
|
5520
|
-
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
|
5521
|
-
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
|
5522
|
-
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
|
5523
|
-
}, dzProps), {
|
|
5524
|
-
zone: propName,
|
|
5525
|
-
content
|
|
5526
|
-
}));
|
|
5527
|
-
return Slot;
|
|
5528
|
-
}
|
|
5529
|
-
});
|
|
5714
|
+
// lib/field-transforms/default-transforms/inline-text-transform.tsx
|
|
5715
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5530
5716
|
var getInlineTextTransform = () => ({
|
|
5531
5717
|
text: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
5532
5718
|
if (field.contentEditable) {
|
|
5533
|
-
return /* @__PURE__ */ (0,
|
|
5719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5534
5720
|
InlineTextField,
|
|
5535
5721
|
{
|
|
5536
5722
|
propPath,
|
|
@@ -5545,7 +5731,7 @@ var getInlineTextTransform = () => ({
|
|
|
5545
5731
|
},
|
|
5546
5732
|
textarea: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
5547
5733
|
if (field.contentEditable) {
|
|
5548
|
-
return /* @__PURE__ */ (0,
|
|
5734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5549
5735
|
InlineTextField,
|
|
5550
5736
|
{
|
|
5551
5737
|
propPath,
|
|
@@ -5559,7 +5745,7 @@ var getInlineTextTransform = () => ({
|
|
|
5559
5745
|
},
|
|
5560
5746
|
custom: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
5561
5747
|
if (field.contentEditable && typeof value === "string") {
|
|
5562
|
-
return /* @__PURE__ */ (0,
|
|
5748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5563
5749
|
InlineTextField,
|
|
5564
5750
|
{
|
|
5565
5751
|
propPath,
|
|
@@ -5573,189 +5759,6 @@ var getInlineTextTransform = () => ({
|
|
|
5573
5759
|
}
|
|
5574
5760
|
});
|
|
5575
5761
|
|
|
5576
|
-
// lib/use-slots.tsx
|
|
5577
|
-
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
|
5578
|
-
return useFieldTransforms(
|
|
5579
|
-
config,
|
|
5580
|
-
item,
|
|
5581
|
-
getSlotTransform(renderSlotEdit, renderSlotRender),
|
|
5582
|
-
readOnly,
|
|
5583
|
-
forceReadOnly
|
|
5584
|
-
);
|
|
5585
|
-
}
|
|
5586
|
-
|
|
5587
|
-
// components/Render/index.tsx
|
|
5588
|
-
var import_react33 = __toESM(require("react"));
|
|
5589
|
-
|
|
5590
|
-
// components/SlotRender/index.tsx
|
|
5591
|
-
init_react_import();
|
|
5592
|
-
var import_shallow3 = require("zustand/react/shallow");
|
|
5593
|
-
|
|
5594
|
-
// components/SlotRender/server.tsx
|
|
5595
|
-
init_react_import();
|
|
5596
|
-
var import_react32 = require("react");
|
|
5597
|
-
|
|
5598
|
-
// components/ServerRender/index.tsx
|
|
5599
|
-
init_react_import();
|
|
5600
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
5601
|
-
function DropZoneRender({
|
|
5602
|
-
zone,
|
|
5603
|
-
data,
|
|
5604
|
-
areaId = "root",
|
|
5605
|
-
config,
|
|
5606
|
-
metadata = {}
|
|
5607
|
-
}) {
|
|
5608
|
-
let zoneCompound = rootDroppableId;
|
|
5609
|
-
let content = (data == null ? void 0 : data.content) || [];
|
|
5610
|
-
if (!data || !config) {
|
|
5611
|
-
return null;
|
|
5612
|
-
}
|
|
5613
|
-
if (areaId !== rootAreaId && zone !== rootZone) {
|
|
5614
|
-
zoneCompound = `${areaId}:${zone}`;
|
|
5615
|
-
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
5616
|
-
}
|
|
5617
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, { children: content.map((item) => {
|
|
5618
|
-
const Component = config.components[item.type];
|
|
5619
|
-
const props = __spreadProps(__spreadValues({}, item.props), {
|
|
5620
|
-
puck: {
|
|
5621
|
-
renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5622
|
-
DropZoneRender,
|
|
5623
|
-
{
|
|
5624
|
-
zone: zone2,
|
|
5625
|
-
data,
|
|
5626
|
-
areaId: item.props.id,
|
|
5627
|
-
config,
|
|
5628
|
-
metadata
|
|
5629
|
-
}
|
|
5630
|
-
),
|
|
5631
|
-
metadata,
|
|
5632
|
-
dragRef: null,
|
|
5633
|
-
isEditing: false
|
|
5634
|
-
}
|
|
5635
|
-
});
|
|
5636
|
-
const renderItem = __spreadProps(__spreadValues({}, item), { props });
|
|
5637
|
-
const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
|
5638
|
-
if (Component) {
|
|
5639
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
|
|
5640
|
-
}
|
|
5641
|
-
return null;
|
|
5642
|
-
}) });
|
|
5643
|
-
}
|
|
5644
|
-
|
|
5645
|
-
// components/SlotRender/server.tsx
|
|
5646
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
5647
|
-
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SlotRender, __spreadValues({}, props));
|
|
5648
|
-
var Item = ({
|
|
5649
|
-
config,
|
|
5650
|
-
item,
|
|
5651
|
-
metadata
|
|
5652
|
-
}) => {
|
|
5653
|
-
const Component = config.components[item.type];
|
|
5654
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
5655
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5656
|
-
Component.render,
|
|
5657
|
-
__spreadProps(__spreadValues({}, props), {
|
|
5658
|
-
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
5659
|
-
renderDropZone: DropZoneRender,
|
|
5660
|
-
metadata: metadata || {}
|
|
5661
|
-
})
|
|
5662
|
-
})
|
|
5663
|
-
);
|
|
5664
|
-
};
|
|
5665
|
-
var SlotRender = (0, import_react32.forwardRef)(
|
|
5666
|
-
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
|
5667
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className, style, ref, children: content.map((item) => {
|
|
5668
|
-
if (!config.components[item.type]) {
|
|
5669
|
-
return null;
|
|
5670
|
-
}
|
|
5671
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5672
|
-
Item,
|
|
5673
|
-
{
|
|
5674
|
-
config,
|
|
5675
|
-
item,
|
|
5676
|
-
metadata
|
|
5677
|
-
},
|
|
5678
|
-
item.props.id
|
|
5679
|
-
);
|
|
5680
|
-
}) });
|
|
5681
|
-
}
|
|
5682
|
-
);
|
|
5683
|
-
|
|
5684
|
-
// components/SlotRender/index.tsx
|
|
5685
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5686
|
-
var ContextSlotRender = ({
|
|
5687
|
-
componentId,
|
|
5688
|
-
zone
|
|
5689
|
-
}) => {
|
|
5690
|
-
const config = useAppStore((s) => s.config);
|
|
5691
|
-
const metadata = useAppStore((s) => s.metadata);
|
|
5692
|
-
const slotContent = useAppStore(
|
|
5693
|
-
(0, import_shallow3.useShallow)((s) => {
|
|
5694
|
-
var _a, _b;
|
|
5695
|
-
const indexes = s.state.indexes;
|
|
5696
|
-
const contentIds = (_b = (_a = indexes.zones[`${componentId}:${zone}`]) == null ? void 0 : _a.contentIds) != null ? _b : [];
|
|
5697
|
-
return contentIds.map((contentId) => indexes.nodes[contentId].flatData);
|
|
5698
|
-
})
|
|
5699
|
-
);
|
|
5700
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5701
|
-
SlotRenderPure,
|
|
5702
|
-
{
|
|
5703
|
-
content: slotContent,
|
|
5704
|
-
zone,
|
|
5705
|
-
config,
|
|
5706
|
-
metadata
|
|
5707
|
-
}
|
|
5708
|
-
);
|
|
5709
|
-
};
|
|
5710
|
-
|
|
5711
|
-
// components/Render/index.tsx
|
|
5712
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5713
|
-
var renderContext = import_react33.default.createContext({
|
|
5714
|
-
config: { components: {} },
|
|
5715
|
-
data: { root: {}, content: [] },
|
|
5716
|
-
metadata: {}
|
|
5717
|
-
});
|
|
5718
|
-
function Render({
|
|
5719
|
-
config,
|
|
5720
|
-
data,
|
|
5721
|
-
metadata = {}
|
|
5722
|
-
}) {
|
|
5723
|
-
var _a;
|
|
5724
|
-
const defaultedData = __spreadProps(__spreadValues({}, data), {
|
|
5725
|
-
root: data.root || {},
|
|
5726
|
-
content: data.content || []
|
|
5727
|
-
});
|
|
5728
|
-
const rootProps = "props" in defaultedData.root ? defaultedData.root.props : defaultedData.root;
|
|
5729
|
-
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
|
5730
|
-
const pageProps = __spreadProps(__spreadValues({}, rootProps), {
|
|
5731
|
-
puck: {
|
|
5732
|
-
renderDropZone: DropZonePure,
|
|
5733
|
-
isEditing: false,
|
|
5734
|
-
dragRef: null,
|
|
5735
|
-
metadata
|
|
5736
|
-
},
|
|
5737
|
-
title,
|
|
5738
|
-
editMode: false,
|
|
5739
|
-
id: "puck-root"
|
|
5740
|
-
});
|
|
5741
|
-
const propsWithSlots = useSlots(
|
|
5742
|
-
config,
|
|
5743
|
-
{ type: "root", props: pageProps },
|
|
5744
|
-
(props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
|
|
5745
|
-
);
|
|
5746
|
-
const nextContextValue = (0, import_react33.useMemo)(
|
|
5747
|
-
() => ({
|
|
5748
|
-
mode: "render",
|
|
5749
|
-
depth: 0
|
|
5750
|
-
}),
|
|
5751
|
-
[]
|
|
5752
|
-
);
|
|
5753
|
-
if ((_a = config.root) == null ? void 0 : _a.render) {
|
|
5754
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(config.root.render, __spreadProps(__spreadValues({}, propsWithSlots), { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZoneRenderPure, { zone: rootZone }) })) }) });
|
|
5755
|
-
}
|
|
5756
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZoneRenderPure, { zone: rootZone }) }) });
|
|
5757
|
-
}
|
|
5758
|
-
|
|
5759
5762
|
// components/DropZone/index.tsx
|
|
5760
5763
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5761
5764
|
var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default12);
|
|
@@ -7149,7 +7152,7 @@ var SidebarSection = ({
|
|
|
7149
7152
|
|
|
7150
7153
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
|
7151
7154
|
init_react_import();
|
|
7152
|
-
var styles_module_default15 = { "Puck": "
|
|
7155
|
+
var styles_module_default15 = { "Puck": "_Puck_a45x1_19", "Puck-portal": "_Puck-portal_a45x1_31", "PuckLayout-inner": "_PuckLayout-inner_a45x1_38", "PuckLayout--mounted": "_PuckLayout--mounted_a45x1_59", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_a45x1_63", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_a45x1_69", "PuckLayout-mounted": "_PuckLayout-mounted_a45x1_83", "PuckLayout": "_PuckLayout_a45x1_38" };
|
|
7153
7156
|
|
|
7154
7157
|
// components/Puck/components/Fields/index.tsx
|
|
7155
7158
|
init_react_import();
|
|
@@ -8791,7 +8794,7 @@ var HeaderInner = () => {
|
|
|
8791
8794
|
return RenderHeader;
|
|
8792
8795
|
}
|
|
8793
8796
|
return DefaultOverride;
|
|
8794
|
-
}, [
|
|
8797
|
+
}, [renderHeaderActions]);
|
|
8795
8798
|
const CustomHeader = useAppStore(
|
|
8796
8799
|
(s) => s.overrides.header || defaultHeaderRender
|
|
8797
8800
|
);
|
|
@@ -9005,7 +9008,6 @@ var Sidebar = ({
|
|
|
9005
9008
|
position,
|
|
9006
9009
|
sidebarRef,
|
|
9007
9010
|
isVisible,
|
|
9008
|
-
width,
|
|
9009
9011
|
onResize,
|
|
9010
9012
|
onResizeEnd,
|
|
9011
9013
|
children
|
|
@@ -9373,6 +9375,13 @@ function PuckLayout({ children }) {
|
|
|
9373
9375
|
}
|
|
9374
9376
|
}, [ready, iframe.enabled]);
|
|
9375
9377
|
usePreviewModeHotkeys();
|
|
9378
|
+
const layoutOptions = {};
|
|
9379
|
+
if (leftWidth) {
|
|
9380
|
+
layoutOptions["--puck-user-left-side-bar-width"] = `${leftWidth}px`;
|
|
9381
|
+
}
|
|
9382
|
+
if (rightWidth) {
|
|
9383
|
+
layoutOptions["--puck-user-right-side-bar-width"] = `${rightWidth}px`;
|
|
9384
|
+
}
|
|
9376
9385
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: `Puck ${getClassName31()}`, children: [
|
|
9377
9386
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(FrameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9378
9387
|
"div",
|
|
@@ -9386,13 +9395,7 @@ function PuckLayout({ children }) {
|
|
|
9386
9395
|
"div",
|
|
9387
9396
|
{
|
|
9388
9397
|
className: getLayoutClassName("inner"),
|
|
9389
|
-
style:
|
|
9390
|
-
gridTemplateColumns: `
|
|
9391
|
-
${leftSideBarVisible ? leftWidth ? `${leftWidth}px` : "var(--puck-side-bar-width)" : "0"}
|
|
9392
|
-
var(--puck-frame-width)
|
|
9393
|
-
${rightSideBarVisible ? rightWidth ? `${rightWidth}px` : "var(--puck-side-bar-width)" : "0"}
|
|
9394
|
-
`
|
|
9395
|
-
},
|
|
9398
|
+
style: layoutOptions,
|
|
9396
9399
|
children: [
|
|
9397
9400
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Header, {}),
|
|
9398
9401
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
@@ -9401,7 +9404,6 @@ function PuckLayout({ children }) {
|
|
|
9401
9404
|
position: "left",
|
|
9402
9405
|
sidebarRef: leftSidebarRef,
|
|
9403
9406
|
isVisible: leftSideBarVisible,
|
|
9404
|
-
width: leftWidth,
|
|
9405
9407
|
onResize: setLeftWidth,
|
|
9406
9408
|
onResizeEnd: handleLeftSidebarResizeEnd,
|
|
9407
9409
|
children: [
|
|
@@ -9417,7 +9419,6 @@ function PuckLayout({ children }) {
|
|
|
9417
9419
|
position: "right",
|
|
9418
9420
|
sidebarRef: rightSidebarRef,
|
|
9419
9421
|
isVisible: rightSideBarVisible,
|
|
9420
|
-
width: rightWidth,
|
|
9421
9422
|
onResize: setRightWidth,
|
|
9422
9423
|
onResizeEnd: handleRightSidebarResizeEnd,
|
|
9423
9424
|
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(FieldSideBar, {})
|
package/dist/no-external.mjs
CHANGED
|
@@ -13,19 +13,19 @@ import {
|
|
|
13
13
|
Render,
|
|
14
14
|
createUsePuck,
|
|
15
15
|
overrideKeys,
|
|
16
|
+
registerOverlayPortal,
|
|
16
17
|
renderContext,
|
|
18
|
+
setDeep,
|
|
17
19
|
useGetPuck,
|
|
18
20
|
usePuck
|
|
19
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-AQUDTV7N.mjs";
|
|
20
22
|
import {
|
|
21
23
|
init_react_import,
|
|
22
24
|
migrate,
|
|
23
|
-
registerOverlayPortal,
|
|
24
25
|
resolveAllData,
|
|
25
|
-
setDeep,
|
|
26
26
|
transformProps,
|
|
27
27
|
walkTree
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-HUKJ36SA.mjs";
|
|
29
29
|
|
|
30
30
|
// bundle/no-external.ts
|
|
31
31
|
init_react_import();
|