@measured/puck 0.20.0-canary.77cef35d → 0.20.0-canary.7ec3c0b9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-HUKJ36SA.mjs +1064 -0
- package/dist/{chunk-APXUWZWW.mjs → chunk-RYWII4GP.mjs} +2246 -525
- package/dist/index.css +21 -22
- package/dist/index.js +216 -218
- package/dist/index.mjs +4 -4
- package/dist/no-external.css +21 -22
- package/dist/no-external.js +216 -218
- 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
|
@@ -1415,24 +1415,27 @@ body:has(._DropZone--isAnimating_1i2sv_68:empty) [data-puck-overlay] {
|
|
|
1415
1415
|
}
|
|
1416
1416
|
|
|
1417
1417
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Layout/styles.module.css/#css-module-data */
|
|
1418
|
-
.
|
|
1418
|
+
._Puck_1pcou_19 {
|
|
1419
1419
|
--puck-space-px: 16px;
|
|
1420
1420
|
font-family: var(--puck-font-family);
|
|
1421
1421
|
overflow-x: hidden;
|
|
1422
1422
|
}
|
|
1423
1423
|
@media (min-width: 766px) {
|
|
1424
|
-
.
|
|
1424
|
+
._Puck_1pcou_19 {
|
|
1425
1425
|
overflow-x: auto;
|
|
1426
1426
|
}
|
|
1427
1427
|
}
|
|
1428
|
-
._Puck-
|
|
1428
|
+
._Puck-portal_1pcou_31 {
|
|
1429
1429
|
position: relative;
|
|
1430
1430
|
z-index: 2;
|
|
1431
1431
|
}
|
|
1432
|
-
._PuckLayout-
|
|
1432
|
+
._PuckLayout-inner_1pcou_36 {
|
|
1433
1433
|
--puck-frame-width: auto;
|
|
1434
1434
|
--puck-side-bar-width: 0px;
|
|
1435
1435
|
--puck-side-nav-width: 68px;
|
|
1436
|
+
--puck-side-bar-width: 186px;
|
|
1437
|
+
--puck-left-side-bar-width: var( --puck-user-left-side-bar-width, --puck-side-bar-width );
|
|
1438
|
+
--puck-right-side-bar-width: var( --puck-user-right-side-bar-width, --puck-side-bar-width );
|
|
1436
1439
|
display: grid;
|
|
1437
1440
|
grid-template-areas: "header header header header" "sidenav left editor right";
|
|
1438
1441
|
grid-template-columns: var(--puck-side-nav-width) 0 var(--puck-frame-width) 0;
|
|
@@ -1441,63 +1444,59 @@ body:has(._DropZone--isAnimating_1i2sv_68:empty) [data-puck-overlay] {
|
|
|
1441
1444
|
position: relative;
|
|
1442
1445
|
z-index: 0;
|
|
1443
1446
|
}
|
|
1444
|
-
._PuckLayout--
|
|
1445
|
-
--puck-side-bar-width: 186px;
|
|
1446
|
-
--puck-left-side-bar-width: var( --puck-user-left-side-bar-width, --puck-side-bar-width );
|
|
1447
|
-
--puck-right-side-bar-width: var( --puck-user-right-side-bar-width, --puck-side-bar-width );
|
|
1448
|
-
}
|
|
1449
|
-
._PuckLayout--leftSideBarVisible_1q3wx_61 ._PuckLayout-inner_1q3wx_36 {
|
|
1447
|
+
._PuckLayout--leftSideBarVisible_1pcou_59 ._PuckLayout-inner_1pcou_36 {
|
|
1450
1448
|
grid-template-columns: var(--puck-side-nav-width) var(--puck-left-side-bar-width) var( --puck-frame-width ) 0;
|
|
1451
1449
|
}
|
|
1452
|
-
._PuckLayout--
|
|
1450
|
+
._PuckLayout--rightSideBarVisible_1pcou_67 ._PuckLayout-inner_1pcou_36 {
|
|
1453
1451
|
grid-template-columns: var(--puck-side-nav-width) 0 var(--puck-frame-width) var(--puck-side-bar-width);
|
|
1454
1452
|
}
|
|
1455
|
-
._PuckLayout--
|
|
1453
|
+
._PuckLayout--leftSideBarVisible_1pcou_59._PuckLayout--rightSideBarVisible_1pcou_67 ._PuckLayout-inner_1pcou_36 {
|
|
1456
1454
|
grid-template-columns: var(--puck-side-nav-width) var(--puck-left-side-bar-width) var( --puck-frame-width ) var(--puck-right-side-bar-width);
|
|
1457
1455
|
}
|
|
1458
1456
|
@media (min-width: 458px) {
|
|
1459
|
-
._PuckLayout-
|
|
1457
|
+
._PuckLayout-inner_1pcou_36 {
|
|
1460
1458
|
--puck-frame-width: minmax(266px, auto);
|
|
1461
1459
|
}
|
|
1462
1460
|
}
|
|
1463
1461
|
@media (min-width: 638px) {
|
|
1464
|
-
.
|
|
1462
|
+
._PuckLayout_1pcou_36 ._PuckLayout-inner_1pcou_36 {
|
|
1465
1463
|
--puck-side-bar-width: minmax(186px, 250px);
|
|
1466
1464
|
}
|
|
1467
1465
|
}
|
|
1468
1466
|
@media (min-width: 766px) {
|
|
1469
|
-
.
|
|
1467
|
+
._PuckLayout_1pcou_36 ._PuckLayout-inner_1pcou_36 {
|
|
1470
1468
|
--puck-frame-width: auto;
|
|
1471
1469
|
}
|
|
1472
1470
|
}
|
|
1473
1471
|
@media (min-width: 990px) {
|
|
1474
|
-
.
|
|
1472
|
+
._PuckLayout_1pcou_36 ._PuckLayout-inner_1pcou_36 {
|
|
1475
1473
|
--puck-side-bar-width: 256px;
|
|
1476
1474
|
}
|
|
1477
1475
|
}
|
|
1478
1476
|
@media (min-width: 1198px) {
|
|
1479
|
-
.
|
|
1477
|
+
._PuckLayout_1pcou_36 ._PuckLayout-inner_1pcou_36 {
|
|
1480
1478
|
--puck-side-bar-width: 274px;
|
|
1481
1479
|
}
|
|
1482
1480
|
}
|
|
1483
1481
|
@media (min-width: 1398px) {
|
|
1484
|
-
.
|
|
1482
|
+
._PuckLayout_1pcou_36 ._PuckLayout-inner_1pcou_36 {
|
|
1485
1483
|
--puck-side-bar-width: 290px;
|
|
1486
1484
|
}
|
|
1487
1485
|
}
|
|
1488
1486
|
@media (min-width: 1598px) {
|
|
1489
|
-
.
|
|
1487
|
+
._PuckLayout_1pcou_36 ._PuckLayout-inner_1pcou_36 {
|
|
1490
1488
|
--puck-side-bar-width: 320px;
|
|
1491
1489
|
}
|
|
1492
1490
|
}
|
|
1493
|
-
._PuckLayout-
|
|
1491
|
+
._PuckLayout-nav_1pcou_124 {
|
|
1494
1492
|
border-right: 1px solid var(--puck-color-grey-09);
|
|
1495
1493
|
background-color: var(--puck-color-grey-12);
|
|
1496
1494
|
}
|
|
1497
|
-
.
|
|
1495
|
+
._PuckPluginTab_1pcou_129 {
|
|
1498
1496
|
display: none;
|
|
1497
|
+
height: 100%;
|
|
1499
1498
|
}
|
|
1500
|
-
._PuckPluginTab--
|
|
1499
|
+
._PuckPluginTab--visible_1pcou_134 {
|
|
1501
1500
|
display: block;
|
|
1502
1501
|
}
|
|
1503
1502
|
|
package/dist/no-external.js
CHANGED
|
@@ -5523,13 +5523,212 @@ function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
|
5523
5523
|
return mergedProps;
|
|
5524
5524
|
}
|
|
5525
5525
|
|
|
5526
|
-
// lib/field-transforms/default-transforms.tsx
|
|
5526
|
+
// lib/field-transforms/default-transforms/slot-transform.tsx
|
|
5527
5527
|
init_react_import();
|
|
5528
|
+
var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
5529
|
+
slot: ({ value: content, propName, field, isReadOnly }) => {
|
|
5530
|
+
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
|
5531
|
+
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
|
5532
|
+
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
|
5533
|
+
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
|
5534
|
+
}, dzProps), {
|
|
5535
|
+
zone: propName,
|
|
5536
|
+
content
|
|
5537
|
+
}));
|
|
5538
|
+
return Slot;
|
|
5539
|
+
}
|
|
5540
|
+
});
|
|
5528
5541
|
|
|
5529
|
-
//
|
|
5542
|
+
// lib/use-slots.tsx
|
|
5543
|
+
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
|
5544
|
+
return useFieldTransforms(
|
|
5545
|
+
config,
|
|
5546
|
+
item,
|
|
5547
|
+
getSlotTransform(renderSlotEdit, renderSlotRender),
|
|
5548
|
+
readOnly,
|
|
5549
|
+
forceReadOnly
|
|
5550
|
+
);
|
|
5551
|
+
}
|
|
5552
|
+
|
|
5553
|
+
// components/Render/index.tsx
|
|
5554
|
+
var import_react34 = __toESM(require("react"));
|
|
5555
|
+
|
|
5556
|
+
// components/SlotRender/index.tsx
|
|
5557
|
+
init_react_import();
|
|
5558
|
+
var import_shallow4 = require("zustand/react/shallow");
|
|
5559
|
+
|
|
5560
|
+
// components/SlotRender/server.tsx
|
|
5530
5561
|
init_react_import();
|
|
5531
5562
|
var import_react33 = require("react");
|
|
5532
5563
|
|
|
5564
|
+
// components/ServerRender/index.tsx
|
|
5565
|
+
init_react_import();
|
|
5566
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
5567
|
+
function DropZoneRender({
|
|
5568
|
+
zone,
|
|
5569
|
+
data,
|
|
5570
|
+
areaId = "root",
|
|
5571
|
+
config,
|
|
5572
|
+
metadata = {}
|
|
5573
|
+
}) {
|
|
5574
|
+
let zoneCompound = rootDroppableId;
|
|
5575
|
+
let content = (data == null ? void 0 : data.content) || [];
|
|
5576
|
+
if (!data || !config) {
|
|
5577
|
+
return null;
|
|
5578
|
+
}
|
|
5579
|
+
if (areaId !== rootAreaId && zone !== rootZone) {
|
|
5580
|
+
zoneCompound = `${areaId}:${zone}`;
|
|
5581
|
+
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
5582
|
+
}
|
|
5583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: content.map((item) => {
|
|
5584
|
+
const Component = config.components[item.type];
|
|
5585
|
+
const props = __spreadProps(__spreadValues({}, item.props), {
|
|
5586
|
+
puck: {
|
|
5587
|
+
renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
5588
|
+
DropZoneRender,
|
|
5589
|
+
{
|
|
5590
|
+
zone: zone2,
|
|
5591
|
+
data,
|
|
5592
|
+
areaId: item.props.id,
|
|
5593
|
+
config,
|
|
5594
|
+
metadata
|
|
5595
|
+
}
|
|
5596
|
+
),
|
|
5597
|
+
metadata,
|
|
5598
|
+
dragRef: null,
|
|
5599
|
+
isEditing: false
|
|
5600
|
+
}
|
|
5601
|
+
});
|
|
5602
|
+
const renderItem = __spreadProps(__spreadValues({}, item), { props });
|
|
5603
|
+
const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
|
5604
|
+
if (Component) {
|
|
5605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
|
|
5606
|
+
}
|
|
5607
|
+
return null;
|
|
5608
|
+
}) });
|
|
5609
|
+
}
|
|
5610
|
+
|
|
5611
|
+
// components/SlotRender/server.tsx
|
|
5612
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
5613
|
+
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SlotRender, __spreadValues({}, props));
|
|
5614
|
+
var Item = ({
|
|
5615
|
+
config,
|
|
5616
|
+
item,
|
|
5617
|
+
metadata
|
|
5618
|
+
}) => {
|
|
5619
|
+
const Component = config.components[item.type];
|
|
5620
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
5621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5622
|
+
Component.render,
|
|
5623
|
+
__spreadProps(__spreadValues({}, props), {
|
|
5624
|
+
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
5625
|
+
renderDropZone: DropZoneRender,
|
|
5626
|
+
metadata: metadata || {}
|
|
5627
|
+
})
|
|
5628
|
+
})
|
|
5629
|
+
);
|
|
5630
|
+
};
|
|
5631
|
+
var SlotRender = (0, import_react33.forwardRef)(
|
|
5632
|
+
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
|
5633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className, style, ref, children: content.map((item) => {
|
|
5634
|
+
if (!config.components[item.type]) {
|
|
5635
|
+
return null;
|
|
5636
|
+
}
|
|
5637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5638
|
+
Item,
|
|
5639
|
+
{
|
|
5640
|
+
config,
|
|
5641
|
+
item,
|
|
5642
|
+
metadata
|
|
5643
|
+
},
|
|
5644
|
+
item.props.id
|
|
5645
|
+
);
|
|
5646
|
+
}) });
|
|
5647
|
+
}
|
|
5648
|
+
);
|
|
5649
|
+
|
|
5650
|
+
// components/SlotRender/index.tsx
|
|
5651
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
5652
|
+
var ContextSlotRender = ({
|
|
5653
|
+
componentId,
|
|
5654
|
+
zone
|
|
5655
|
+
}) => {
|
|
5656
|
+
const config = useAppStore((s) => s.config);
|
|
5657
|
+
const metadata = useAppStore((s) => s.metadata);
|
|
5658
|
+
const slotContent = useAppStore(
|
|
5659
|
+
(0, import_shallow4.useShallow)((s) => {
|
|
5660
|
+
var _a, _b;
|
|
5661
|
+
const indexes = s.state.indexes;
|
|
5662
|
+
const contentIds = (_b = (_a = indexes.zones[`${componentId}:${zone}`]) == null ? void 0 : _a.contentIds) != null ? _b : [];
|
|
5663
|
+
return contentIds.map((contentId) => indexes.nodes[contentId].flatData);
|
|
5664
|
+
})
|
|
5665
|
+
);
|
|
5666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5667
|
+
SlotRenderPure,
|
|
5668
|
+
{
|
|
5669
|
+
content: slotContent,
|
|
5670
|
+
zone,
|
|
5671
|
+
config,
|
|
5672
|
+
metadata
|
|
5673
|
+
}
|
|
5674
|
+
);
|
|
5675
|
+
};
|
|
5676
|
+
|
|
5677
|
+
// components/Render/index.tsx
|
|
5678
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5679
|
+
var renderContext = import_react34.default.createContext({
|
|
5680
|
+
config: { components: {} },
|
|
5681
|
+
data: { root: {}, content: [] },
|
|
5682
|
+
metadata: {}
|
|
5683
|
+
});
|
|
5684
|
+
function Render({
|
|
5685
|
+
config,
|
|
5686
|
+
data,
|
|
5687
|
+
metadata = {}
|
|
5688
|
+
}) {
|
|
5689
|
+
var _a;
|
|
5690
|
+
const defaultedData = __spreadProps(__spreadValues({}, data), {
|
|
5691
|
+
root: data.root || {},
|
|
5692
|
+
content: data.content || []
|
|
5693
|
+
});
|
|
5694
|
+
const rootProps = "props" in defaultedData.root ? defaultedData.root.props : defaultedData.root;
|
|
5695
|
+
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
|
5696
|
+
const pageProps = __spreadProps(__spreadValues({}, rootProps), {
|
|
5697
|
+
puck: {
|
|
5698
|
+
renderDropZone: DropZonePure,
|
|
5699
|
+
isEditing: false,
|
|
5700
|
+
dragRef: null,
|
|
5701
|
+
metadata
|
|
5702
|
+
},
|
|
5703
|
+
title,
|
|
5704
|
+
editMode: false,
|
|
5705
|
+
id: "puck-root"
|
|
5706
|
+
});
|
|
5707
|
+
const propsWithSlots = useSlots(
|
|
5708
|
+
config,
|
|
5709
|
+
{ type: "root", props: pageProps },
|
|
5710
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
|
|
5711
|
+
);
|
|
5712
|
+
const nextContextValue = (0, import_react34.useMemo)(
|
|
5713
|
+
() => ({
|
|
5714
|
+
mode: "render",
|
|
5715
|
+
depth: 0
|
|
5716
|
+
}),
|
|
5717
|
+
[]
|
|
5718
|
+
);
|
|
5719
|
+
if ((_a = config.root) == null ? void 0 : _a.render) {
|
|
5720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(config.root.render, __spreadProps(__spreadValues({}, propsWithSlots), { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRenderPure, { zone: rootZone }) })) }) });
|
|
5721
|
+
}
|
|
5722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRenderPure, { zone: rootZone }) }) });
|
|
5723
|
+
}
|
|
5724
|
+
|
|
5725
|
+
// lib/field-transforms/default-transforms/inline-text-transform.tsx
|
|
5726
|
+
init_react_import();
|
|
5727
|
+
|
|
5728
|
+
// components/InlineTextField/index.tsx
|
|
5729
|
+
init_react_import();
|
|
5730
|
+
var import_react35 = require("react");
|
|
5731
|
+
|
|
5533
5732
|
// lib/overlay-portal/index.tsx
|
|
5534
5733
|
init_react_import();
|
|
5535
5734
|
var registerOverlayPortal = (el, opts = {}) => {
|
|
@@ -5617,7 +5816,7 @@ function setDeep(node, path, newVal) {
|
|
|
5617
5816
|
}
|
|
5618
5817
|
|
|
5619
5818
|
// components/InlineTextField/index.tsx
|
|
5620
|
-
var
|
|
5819
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5621
5820
|
var getClassName17 = get_class_name_factory_default("InlineTextField", styles_module_default13);
|
|
5622
5821
|
var InlineTextFieldInternal = ({
|
|
5623
5822
|
propPath,
|
|
@@ -5627,10 +5826,10 @@ var InlineTextFieldInternal = ({
|
|
|
5627
5826
|
opts = {}
|
|
5628
5827
|
}) => {
|
|
5629
5828
|
var _a;
|
|
5630
|
-
const ref = (0,
|
|
5829
|
+
const ref = (0, import_react35.useRef)(null);
|
|
5631
5830
|
const appStoreApi = useAppStoreApi();
|
|
5632
5831
|
const disableLineBreaks = (_a = opts.disableLineBreaks) != null ? _a : false;
|
|
5633
|
-
(0,
|
|
5832
|
+
(0, import_react35.useEffect)(() => {
|
|
5634
5833
|
const appStore = appStoreApi.getState();
|
|
5635
5834
|
const data = appStore.state.indexes.nodes[componentId].data;
|
|
5636
5835
|
const componentConfig = appStore.getComponentConfig(data.type);
|
|
@@ -5672,9 +5871,9 @@ var InlineTextFieldInternal = ({
|
|
|
5672
5871
|
};
|
|
5673
5872
|
}
|
|
5674
5873
|
}, [appStoreApi, ref.current, value]);
|
|
5675
|
-
const [isHovering, setIsHovering] = (0,
|
|
5676
|
-
const [isFocused, setIsFocused] = (0,
|
|
5677
|
-
return /* @__PURE__ */ (0,
|
|
5874
|
+
const [isHovering, setIsHovering] = (0, import_react35.useState)(false);
|
|
5875
|
+
const [isFocused, setIsFocused] = (0, import_react35.useState)(false);
|
|
5876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5678
5877
|
"span",
|
|
5679
5878
|
{
|
|
5680
5879
|
className: getClassName17(),
|
|
@@ -5700,27 +5899,14 @@ var InlineTextFieldInternal = ({
|
|
|
5700
5899
|
}
|
|
5701
5900
|
);
|
|
5702
5901
|
};
|
|
5703
|
-
var InlineTextField = (0,
|
|
5902
|
+
var InlineTextField = (0, import_react35.memo)(InlineTextFieldInternal);
|
|
5704
5903
|
|
|
5705
|
-
// lib/field-transforms/default-transforms.tsx
|
|
5706
|
-
var
|
|
5707
|
-
var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
5708
|
-
slot: ({ value: content, propName, field, isReadOnly }) => {
|
|
5709
|
-
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
|
5710
|
-
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
|
5711
|
-
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
|
5712
|
-
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
|
5713
|
-
}, dzProps), {
|
|
5714
|
-
zone: propName,
|
|
5715
|
-
content
|
|
5716
|
-
}));
|
|
5717
|
-
return Slot;
|
|
5718
|
-
}
|
|
5719
|
-
});
|
|
5904
|
+
// lib/field-transforms/default-transforms/inline-text-transform.tsx
|
|
5905
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5720
5906
|
var getInlineTextTransform = () => ({
|
|
5721
5907
|
text: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
5722
5908
|
if (field.contentEditable) {
|
|
5723
|
-
return /* @__PURE__ */ (0,
|
|
5909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5724
5910
|
InlineTextField,
|
|
5725
5911
|
{
|
|
5726
5912
|
propPath,
|
|
@@ -5735,7 +5921,7 @@ var getInlineTextTransform = () => ({
|
|
|
5735
5921
|
},
|
|
5736
5922
|
textarea: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
5737
5923
|
if (field.contentEditable) {
|
|
5738
|
-
return /* @__PURE__ */ (0,
|
|
5924
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5739
5925
|
InlineTextField,
|
|
5740
5926
|
{
|
|
5741
5927
|
propPath,
|
|
@@ -5749,7 +5935,7 @@ var getInlineTextTransform = () => ({
|
|
|
5749
5935
|
},
|
|
5750
5936
|
custom: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
5751
5937
|
if (field.contentEditable && typeof value === "string") {
|
|
5752
|
-
return /* @__PURE__ */ (0,
|
|
5938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5753
5939
|
InlineTextField,
|
|
5754
5940
|
{
|
|
5755
5941
|
propPath,
|
|
@@ -5763,189 +5949,6 @@ var getInlineTextTransform = () => ({
|
|
|
5763
5949
|
}
|
|
5764
5950
|
});
|
|
5765
5951
|
|
|
5766
|
-
// lib/use-slots.tsx
|
|
5767
|
-
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
|
5768
|
-
return useFieldTransforms(
|
|
5769
|
-
config,
|
|
5770
|
-
item,
|
|
5771
|
-
getSlotTransform(renderSlotEdit, renderSlotRender),
|
|
5772
|
-
readOnly,
|
|
5773
|
-
forceReadOnly
|
|
5774
|
-
);
|
|
5775
|
-
}
|
|
5776
|
-
|
|
5777
|
-
// components/Render/index.tsx
|
|
5778
|
-
var import_react35 = __toESM(require("react"));
|
|
5779
|
-
|
|
5780
|
-
// components/SlotRender/index.tsx
|
|
5781
|
-
init_react_import();
|
|
5782
|
-
var import_shallow4 = require("zustand/react/shallow");
|
|
5783
|
-
|
|
5784
|
-
// components/SlotRender/server.tsx
|
|
5785
|
-
init_react_import();
|
|
5786
|
-
var import_react34 = require("react");
|
|
5787
|
-
|
|
5788
|
-
// components/ServerRender/index.tsx
|
|
5789
|
-
init_react_import();
|
|
5790
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
5791
|
-
function DropZoneRender({
|
|
5792
|
-
zone,
|
|
5793
|
-
data,
|
|
5794
|
-
areaId = "root",
|
|
5795
|
-
config,
|
|
5796
|
-
metadata = {}
|
|
5797
|
-
}) {
|
|
5798
|
-
let zoneCompound = rootDroppableId;
|
|
5799
|
-
let content = (data == null ? void 0 : data.content) || [];
|
|
5800
|
-
if (!data || !config) {
|
|
5801
|
-
return null;
|
|
5802
|
-
}
|
|
5803
|
-
if (areaId !== rootAreaId && zone !== rootZone) {
|
|
5804
|
-
zoneCompound = `${areaId}:${zone}`;
|
|
5805
|
-
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
5806
|
-
}
|
|
5807
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: content.map((item) => {
|
|
5808
|
-
const Component = config.components[item.type];
|
|
5809
|
-
const props = __spreadProps(__spreadValues({}, item.props), {
|
|
5810
|
-
puck: {
|
|
5811
|
-
renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5812
|
-
DropZoneRender,
|
|
5813
|
-
{
|
|
5814
|
-
zone: zone2,
|
|
5815
|
-
data,
|
|
5816
|
-
areaId: item.props.id,
|
|
5817
|
-
config,
|
|
5818
|
-
metadata
|
|
5819
|
-
}
|
|
5820
|
-
),
|
|
5821
|
-
metadata,
|
|
5822
|
-
dragRef: null,
|
|
5823
|
-
isEditing: false
|
|
5824
|
-
}
|
|
5825
|
-
});
|
|
5826
|
-
const renderItem = __spreadProps(__spreadValues({}, item), { props });
|
|
5827
|
-
const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
|
5828
|
-
if (Component) {
|
|
5829
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
|
|
5830
|
-
}
|
|
5831
|
-
return null;
|
|
5832
|
-
}) });
|
|
5833
|
-
}
|
|
5834
|
-
|
|
5835
|
-
// components/SlotRender/server.tsx
|
|
5836
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5837
|
-
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SlotRender, __spreadValues({}, props));
|
|
5838
|
-
var Item = ({
|
|
5839
|
-
config,
|
|
5840
|
-
item,
|
|
5841
|
-
metadata
|
|
5842
|
-
}) => {
|
|
5843
|
-
const Component = config.components[item.type];
|
|
5844
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
5845
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5846
|
-
Component.render,
|
|
5847
|
-
__spreadProps(__spreadValues({}, props), {
|
|
5848
|
-
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
5849
|
-
renderDropZone: DropZoneRender,
|
|
5850
|
-
metadata: metadata || {}
|
|
5851
|
-
})
|
|
5852
|
-
})
|
|
5853
|
-
);
|
|
5854
|
-
};
|
|
5855
|
-
var SlotRender = (0, import_react34.forwardRef)(
|
|
5856
|
-
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
|
5857
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className, style, ref, children: content.map((item) => {
|
|
5858
|
-
if (!config.components[item.type]) {
|
|
5859
|
-
return null;
|
|
5860
|
-
}
|
|
5861
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5862
|
-
Item,
|
|
5863
|
-
{
|
|
5864
|
-
config,
|
|
5865
|
-
item,
|
|
5866
|
-
metadata
|
|
5867
|
-
},
|
|
5868
|
-
item.props.id
|
|
5869
|
-
);
|
|
5870
|
-
}) });
|
|
5871
|
-
}
|
|
5872
|
-
);
|
|
5873
|
-
|
|
5874
|
-
// components/SlotRender/index.tsx
|
|
5875
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5876
|
-
var ContextSlotRender = ({
|
|
5877
|
-
componentId,
|
|
5878
|
-
zone
|
|
5879
|
-
}) => {
|
|
5880
|
-
const config = useAppStore((s) => s.config);
|
|
5881
|
-
const metadata = useAppStore((s) => s.metadata);
|
|
5882
|
-
const slotContent = useAppStore(
|
|
5883
|
-
(0, import_shallow4.useShallow)((s) => {
|
|
5884
|
-
var _a, _b;
|
|
5885
|
-
const indexes = s.state.indexes;
|
|
5886
|
-
const contentIds = (_b = (_a = indexes.zones[`${componentId}:${zone}`]) == null ? void 0 : _a.contentIds) != null ? _b : [];
|
|
5887
|
-
return contentIds.map((contentId) => indexes.nodes[contentId].flatData);
|
|
5888
|
-
})
|
|
5889
|
-
);
|
|
5890
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5891
|
-
SlotRenderPure,
|
|
5892
|
-
{
|
|
5893
|
-
content: slotContent,
|
|
5894
|
-
zone,
|
|
5895
|
-
config,
|
|
5896
|
-
metadata
|
|
5897
|
-
}
|
|
5898
|
-
);
|
|
5899
|
-
};
|
|
5900
|
-
|
|
5901
|
-
// components/Render/index.tsx
|
|
5902
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5903
|
-
var renderContext = import_react35.default.createContext({
|
|
5904
|
-
config: { components: {} },
|
|
5905
|
-
data: { root: {}, content: [] },
|
|
5906
|
-
metadata: {}
|
|
5907
|
-
});
|
|
5908
|
-
function Render({
|
|
5909
|
-
config,
|
|
5910
|
-
data,
|
|
5911
|
-
metadata = {}
|
|
5912
|
-
}) {
|
|
5913
|
-
var _a;
|
|
5914
|
-
const defaultedData = __spreadProps(__spreadValues({}, data), {
|
|
5915
|
-
root: data.root || {},
|
|
5916
|
-
content: data.content || []
|
|
5917
|
-
});
|
|
5918
|
-
const rootProps = "props" in defaultedData.root ? defaultedData.root.props : defaultedData.root;
|
|
5919
|
-
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
|
5920
|
-
const pageProps = __spreadProps(__spreadValues({}, rootProps), {
|
|
5921
|
-
puck: {
|
|
5922
|
-
renderDropZone: DropZonePure,
|
|
5923
|
-
isEditing: false,
|
|
5924
|
-
dragRef: null,
|
|
5925
|
-
metadata
|
|
5926
|
-
},
|
|
5927
|
-
title,
|
|
5928
|
-
editMode: false,
|
|
5929
|
-
id: "puck-root"
|
|
5930
|
-
});
|
|
5931
|
-
const propsWithSlots = useSlots(
|
|
5932
|
-
config,
|
|
5933
|
-
{ type: "root", props: pageProps },
|
|
5934
|
-
(props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
|
|
5935
|
-
);
|
|
5936
|
-
const nextContextValue = (0, import_react35.useMemo)(
|
|
5937
|
-
() => ({
|
|
5938
|
-
mode: "render",
|
|
5939
|
-
depth: 0
|
|
5940
|
-
}),
|
|
5941
|
-
[]
|
|
5942
|
-
);
|
|
5943
|
-
if ((_a = config.root) == null ? void 0 : _a.render) {
|
|
5944
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(config.root.render, __spreadProps(__spreadValues({}, propsWithSlots), { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneRenderPure, { zone: rootZone }) })) }) });
|
|
5945
|
-
}
|
|
5946
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneRenderPure, { zone: rootZone }) }) });
|
|
5947
|
-
}
|
|
5948
|
-
|
|
5949
5952
|
// components/DropZone/index.tsx
|
|
5950
5953
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5951
5954
|
var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default12);
|
|
@@ -8378,7 +8381,7 @@ var import_react61 = require("react");
|
|
|
8378
8381
|
|
|
8379
8382
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Layout/styles.module.css#css-module
|
|
8380
8383
|
init_react_import();
|
|
8381
|
-
var styles_module_default20 = { "Puck": "
|
|
8384
|
+
var styles_module_default20 = { "Puck": "_Puck_1pcou_19", "Puck-portal": "_Puck-portal_1pcou_31", "PuckLayout-inner": "_PuckLayout-inner_1pcou_36", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_1pcou_59", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_1pcou_67", "PuckLayout": "_PuckLayout_1pcou_36", "PuckLayout-nav": "_PuckLayout-nav_1pcou_124", "PuckPluginTab": "_PuckPluginTab_1pcou_129", "PuckPluginTab--visible": "_PuckPluginTab--visible_1pcou_134" };
|
|
8382
8385
|
|
|
8383
8386
|
// lib/use-inject-css.ts
|
|
8384
8387
|
init_react_import();
|
|
@@ -9435,10 +9438,6 @@ var Layout = ({ children }) => {
|
|
|
9435
9438
|
() => overrides.puck || DefaultOverride,
|
|
9436
9439
|
[overrides]
|
|
9437
9440
|
);
|
|
9438
|
-
const [mounted, setMounted] = (0, import_react61.useState)(false);
|
|
9439
|
-
(0, import_react61.useEffect)(() => {
|
|
9440
|
-
setMounted(true);
|
|
9441
|
-
}, []);
|
|
9442
9441
|
const ready = useAppStore((s) => s.status === "READY");
|
|
9443
9442
|
useMonitorHotkeys();
|
|
9444
9443
|
(0, import_react61.useEffect)(() => {
|
|
@@ -9486,7 +9485,6 @@ var Layout = ({ children }) => {
|
|
|
9486
9485
|
{
|
|
9487
9486
|
className: getLayoutClassName({
|
|
9488
9487
|
leftSideBarVisible,
|
|
9489
|
-
mounted,
|
|
9490
9488
|
rightSideBarVisible
|
|
9491
9489
|
}),
|
|
9492
9490
|
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
@@ -9494,8 +9492,8 @@ var Layout = ({ children }) => {
|
|
|
9494
9492
|
{
|
|
9495
9493
|
className: getLayoutClassName("inner"),
|
|
9496
9494
|
style: {
|
|
9497
|
-
"--puck-user-left-side-bar-width": `${leftWidth}px
|
|
9498
|
-
"--puck-user-right-side-bar-width": `${rightWidth}px`
|
|
9495
|
+
"--puck-user-left-side-bar-width": leftWidth ? `${leftWidth}px` : "auto",
|
|
9496
|
+
"--puck-user-right-side-bar-width": rightWidth ? `${rightWidth}px` : "auto"
|
|
9499
9497
|
},
|
|
9500
9498
|
children: [
|
|
9501
9499
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Header, {}),
|
package/dist/no-external.mjs
CHANGED
|
@@ -15,19 +15,19 @@ import {
|
|
|
15
15
|
createUsePuck,
|
|
16
16
|
outlinePlugin,
|
|
17
17
|
overrideKeys,
|
|
18
|
+
registerOverlayPortal,
|
|
18
19
|
renderContext,
|
|
20
|
+
setDeep,
|
|
19
21
|
useGetPuck,
|
|
20
22
|
usePuck
|
|
21
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-RYWII4GP.mjs";
|
|
22
24
|
import {
|
|
23
25
|
init_react_import,
|
|
24
26
|
migrate,
|
|
25
|
-
registerOverlayPortal,
|
|
26
27
|
resolveAllData,
|
|
27
|
-
setDeep,
|
|
28
28
|
transformProps,
|
|
29
29
|
walkTree
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-HUKJ36SA.mjs";
|
|
31
31
|
|
|
32
32
|
// bundle/no-external.ts
|
|
33
33
|
init_react_import();
|