@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/index.css CHANGED
@@ -1559,24 +1559,27 @@ body:has(._DropZone--isAnimating_1i2sv_68:empty) [data-puck-overlay] {
1559
1559
  }
1560
1560
 
1561
1561
  /* css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Layout/styles.module.css/#css-module-data */
1562
- ._Puck_1q3wx_19 {
1562
+ ._Puck_1pcou_19 {
1563
1563
  --puck-space-px: 16px;
1564
1564
  font-family: var(--puck-font-family);
1565
1565
  overflow-x: hidden;
1566
1566
  }
1567
1567
  @media (min-width: 766px) {
1568
- ._Puck_1q3wx_19 {
1568
+ ._Puck_1pcou_19 {
1569
1569
  overflow-x: auto;
1570
1570
  }
1571
1571
  }
1572
- ._Puck-portal_1q3wx_31 {
1572
+ ._Puck-portal_1pcou_31 {
1573
1573
  position: relative;
1574
1574
  z-index: 2;
1575
1575
  }
1576
- ._PuckLayout-inner_1q3wx_36 {
1576
+ ._PuckLayout-inner_1pcou_36 {
1577
1577
  --puck-frame-width: auto;
1578
1578
  --puck-side-bar-width: 0px;
1579
1579
  --puck-side-nav-width: 68px;
1580
+ --puck-side-bar-width: 186px;
1581
+ --puck-left-side-bar-width: var( --puck-user-left-side-bar-width, --puck-side-bar-width );
1582
+ --puck-right-side-bar-width: var( --puck-user-right-side-bar-width, --puck-side-bar-width );
1580
1583
  display: grid;
1581
1584
  grid-template-areas: "header header header header" "sidenav left editor right";
1582
1585
  grid-template-columns: var(--puck-side-nav-width) 0 var(--puck-frame-width) 0;
@@ -1585,63 +1588,59 @@ body:has(._DropZone--isAnimating_1i2sv_68:empty) [data-puck-overlay] {
1585
1588
  position: relative;
1586
1589
  z-index: 0;
1587
1590
  }
1588
- ._PuckLayout--mounted_1q3wx_49 ._PuckLayout-inner_1q3wx_36 {
1589
- --puck-side-bar-width: 186px;
1590
- --puck-left-side-bar-width: var( --puck-user-left-side-bar-width, --puck-side-bar-width );
1591
- --puck-right-side-bar-width: var( --puck-user-right-side-bar-width, --puck-side-bar-width );
1592
- }
1593
- ._PuckLayout--leftSideBarVisible_1q3wx_61 ._PuckLayout-inner_1q3wx_36 {
1591
+ ._PuckLayout--leftSideBarVisible_1pcou_59 ._PuckLayout-inner_1pcou_36 {
1594
1592
  grid-template-columns: var(--puck-side-nav-width) var(--puck-left-side-bar-width) var( --puck-frame-width ) 0;
1595
1593
  }
1596
- ._PuckLayout--rightSideBarVisible_1q3wx_69 ._PuckLayout-inner_1q3wx_36 {
1594
+ ._PuckLayout--rightSideBarVisible_1pcou_67 ._PuckLayout-inner_1pcou_36 {
1597
1595
  grid-template-columns: var(--puck-side-nav-width) 0 var(--puck-frame-width) var(--puck-side-bar-width);
1598
1596
  }
1599
- ._PuckLayout--leftSideBarVisible_1q3wx_61._PuckLayout--rightSideBarVisible_1q3wx_69 ._PuckLayout-inner_1q3wx_36 {
1597
+ ._PuckLayout--leftSideBarVisible_1pcou_59._PuckLayout--rightSideBarVisible_1pcou_67 ._PuckLayout-inner_1pcou_36 {
1600
1598
  grid-template-columns: var(--puck-side-nav-width) var(--puck-left-side-bar-width) var( --puck-frame-width ) var(--puck-right-side-bar-width);
1601
1599
  }
1602
1600
  @media (min-width: 458px) {
1603
- ._PuckLayout-mounted_1q3wx_85 ._PuckLayout-inner_1q3wx_36 {
1601
+ ._PuckLayout-inner_1pcou_36 {
1604
1602
  --puck-frame-width: minmax(266px, auto);
1605
1603
  }
1606
1604
  }
1607
1605
  @media (min-width: 638px) {
1608
- ._PuckLayout_1q3wx_36 ._PuckLayout-inner_1q3wx_36 {
1606
+ ._PuckLayout_1pcou_36 ._PuckLayout-inner_1pcou_36 {
1609
1607
  --puck-side-bar-width: minmax(186px, 250px);
1610
1608
  }
1611
1609
  }
1612
1610
  @media (min-width: 766px) {
1613
- ._PuckLayout_1q3wx_36 ._PuckLayout-inner_1q3wx_36 {
1611
+ ._PuckLayout_1pcou_36 ._PuckLayout-inner_1pcou_36 {
1614
1612
  --puck-frame-width: auto;
1615
1613
  }
1616
1614
  }
1617
1615
  @media (min-width: 990px) {
1618
- ._PuckLayout_1q3wx_36 ._PuckLayout-inner_1q3wx_36 {
1616
+ ._PuckLayout_1pcou_36 ._PuckLayout-inner_1pcou_36 {
1619
1617
  --puck-side-bar-width: 256px;
1620
1618
  }
1621
1619
  }
1622
1620
  @media (min-width: 1198px) {
1623
- ._PuckLayout_1q3wx_36 ._PuckLayout-inner_1q3wx_36 {
1621
+ ._PuckLayout_1pcou_36 ._PuckLayout-inner_1pcou_36 {
1624
1622
  --puck-side-bar-width: 274px;
1625
1623
  }
1626
1624
  }
1627
1625
  @media (min-width: 1398px) {
1628
- ._PuckLayout_1q3wx_36 ._PuckLayout-inner_1q3wx_36 {
1626
+ ._PuckLayout_1pcou_36 ._PuckLayout-inner_1pcou_36 {
1629
1627
  --puck-side-bar-width: 290px;
1630
1628
  }
1631
1629
  }
1632
1630
  @media (min-width: 1598px) {
1633
- ._PuckLayout_1q3wx_36 ._PuckLayout-inner_1q3wx_36 {
1631
+ ._PuckLayout_1pcou_36 ._PuckLayout-inner_1pcou_36 {
1634
1632
  --puck-side-bar-width: 320px;
1635
1633
  }
1636
1634
  }
1637
- ._PuckLayout-nav_1q3wx_126 {
1635
+ ._PuckLayout-nav_1pcou_124 {
1638
1636
  border-right: 1px solid var(--puck-color-grey-09);
1639
1637
  background-color: var(--puck-color-grey-12);
1640
1638
  }
1641
- ._PuckPluginTab_1q3wx_131 {
1639
+ ._PuckPluginTab_1pcou_129 {
1642
1640
  display: none;
1641
+ height: 100%;
1643
1642
  }
1644
- ._PuckPluginTab--visible_1q3wx_135 {
1643
+ ._PuckPluginTab--visible_1pcou_134 {
1645
1644
  display: block;
1646
1645
  }
1647
1646
 
package/dist/index.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
- // components/InlineTextField/index.tsx
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 import_jsx_runtime22 = require("react/jsx-runtime");
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, import_react33.useRef)(null);
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, import_react33.useEffect)(() => {
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, import_react33.useState)(false);
5676
- const [isFocused, setIsFocused] = (0, import_react33.useState)(false);
5677
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
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, import_react33.memo)(InlineTextFieldInternal);
5902
+ var InlineTextField = (0, import_react35.memo)(InlineTextFieldInternal);
5704
5903
 
5705
- // lib/field-transforms/default-transforms.tsx
5706
- var import_jsx_runtime23 = require("react/jsx-runtime");
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, import_jsx_runtime23.jsx)(
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, import_jsx_runtime23.jsx)(
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, import_jsx_runtime23.jsx)(
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": "_Puck_1q3wx_19", "Puck-portal": "_Puck-portal_1q3wx_31", "PuckLayout-inner": "_PuckLayout-inner_1q3wx_36", "PuckLayout--mounted": "_PuckLayout--mounted_1q3wx_49", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_1q3wx_61", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_1q3wx_69", "PuckLayout-mounted": "_PuckLayout-mounted_1q3wx_85", "PuckLayout": "_PuckLayout_1q3wx_36", "PuckLayout-nav": "_PuckLayout-nav_1q3wx_126", "PuckPluginTab": "_PuckPluginTab_1q3wx_131", "PuckPluginTab--visible": "_PuckPluginTab--visible_1q3wx_135" };
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();
@@ -9432,10 +9435,6 @@ var Layout = ({ children }) => {
9432
9435
  () => overrides.puck || DefaultOverride,
9433
9436
  [overrides]
9434
9437
  );
9435
- const [mounted, setMounted] = (0, import_react61.useState)(false);
9436
- (0, import_react61.useEffect)(() => {
9437
- setMounted(true);
9438
- }, []);
9439
9438
  const ready = useAppStore((s) => s.status === "READY");
9440
9439
  useMonitorHotkeys();
9441
9440
  (0, import_react61.useEffect)(() => {
@@ -9483,7 +9482,6 @@ var Layout = ({ children }) => {
9483
9482
  {
9484
9483
  className: getLayoutClassName({
9485
9484
  leftSideBarVisible,
9486
- mounted,
9487
9485
  rightSideBarVisible
9488
9486
  }),
9489
9487
  children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
@@ -9491,8 +9489,8 @@ var Layout = ({ children }) => {
9491
9489
  {
9492
9490
  className: getLayoutClassName("inner"),
9493
9491
  style: {
9494
- "--puck-user-left-side-bar-width": `${leftWidth}px`,
9495
- "--puck-user-right-side-bar-width": `${rightWidth}px`
9492
+ "--puck-user-left-side-bar-width": leftWidth ? `${leftWidth}px` : "auto",
9493
+ "--puck-user-right-side-bar-width": rightWidth ? `${rightWidth}px` : "auto"
9496
9494
  },
9497
9495
  children: [
9498
9496
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Header, {}),
package/dist/index.mjs CHANGED
@@ -15,18 +15,18 @@ 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-APXUWZWW.mjs";
23
+ } from "./chunk-RYWII4GP.mjs";
22
24
  import {
23
25
  migrate,
24
- registerOverlayPortal,
25
26
  resolveAllData,
26
- setDeep,
27
27
  transformProps,
28
28
  walkTree
29
- } from "./chunk-IP64IXIP.mjs";
29
+ } from "./chunk-HUKJ36SA.mjs";
30
30
  export {
31
31
  Action,
32
32
  ActionBar,