@measured/puck 0.21.0-canary.e4131567 → 0.21.0-canary.f5820ce9

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.
@@ -19,12 +19,13 @@ import {
19
19
  rootDroppableId,
20
20
  rootZone,
21
21
  setupZone,
22
+ toComponent,
22
23
  useFieldTransforms,
23
24
  useSlots,
24
25
  walkAppState,
25
26
  walkField,
26
27
  walkTree
27
- } from "./chunk-X7YZ3YE7.mjs";
28
+ } from "./chunk-VBJEDLUM.mjs";
28
29
 
29
30
  // ../../node_modules/classnames/index.js
30
31
  var require_classnames = __commonJS({
@@ -5679,26 +5680,26 @@ var registerOverlayPortal = (el, opts = {}) => {
5679
5680
  capture: true
5680
5681
  });
5681
5682
  };
5682
- if (disableDragOnFocus) {
5683
- el.addEventListener("focus", onFocus, { capture: true });
5684
- el.addEventListener("blur", onBlur, { capture: true });
5685
- } else if (disableDrag) {
5683
+ if (disableDrag) {
5686
5684
  el.addEventListener("pointerdown", stopPropagation, {
5687
5685
  capture: true
5688
5686
  });
5687
+ } else if (disableDragOnFocus) {
5688
+ el.addEventListener("focus", onFocus, { capture: true });
5689
+ el.addEventListener("blur", onBlur, { capture: true });
5689
5690
  }
5690
5691
  el.setAttribute("data-puck-overlay-portal", "true");
5691
5692
  return () => {
5692
5693
  el.removeEventListener("mouseover", stopPropagation, {
5693
5694
  capture: true
5694
5695
  });
5695
- if (disableDragOnFocus) {
5696
- el.removeEventListener("focus", onFocus, { capture: true });
5697
- el.removeEventListener("blur", onFocus, { capture: true });
5698
- } else if (disableDrag) {
5696
+ if (disableDrag) {
5699
5697
  el.removeEventListener("pointerdown", stopPropagation, {
5700
5698
  capture: true
5701
5699
  });
5700
+ } else if (disableDragOnFocus) {
5701
+ el.removeEventListener("focus", onFocus, { capture: true });
5702
+ el.removeEventListener("blur", onBlur, { capture: true });
5702
5703
  }
5703
5704
  el.removeAttribute("data-puck-overlay-portal");
5704
5705
  };
@@ -8592,9 +8593,13 @@ function PuckProvider({ children }) {
8592
8593
  }
8593
8594
  const rootProps = ((_h = initialData == null ? void 0 : initialData.root) == null ? void 0 : _h.props) || (initialData == null ? void 0 : initialData.root) || {};
8594
8595
  const defaultedRootProps = __spreadValues(__spreadValues({}, (_i = config.root) == null ? void 0 : _i.defaultProps), rootProps);
8596
+ const root = populateIds(
8597
+ toComponent(__spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: defaultedRootProps })),
8598
+ config
8599
+ );
8595
8600
  const newAppState = __spreadProps(__spreadValues({}, defaultAppState), {
8596
8601
  data: __spreadProps(__spreadValues({}, initialData), {
8597
- root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: defaultedRootProps }),
8602
+ root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: root.props }),
8598
8603
  content: initialData.content || []
8599
8604
  }),
8600
8605
  ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
@@ -958,6 +958,7 @@ export {
958
958
  useSlots,
959
959
  SlotRenderPure,
960
960
  SlotRender,
961
+ toComponent,
961
962
  migrate,
962
963
  transformProps,
963
964
  resolveAllData
package/dist/index.js CHANGED
@@ -5576,26 +5576,26 @@ var registerOverlayPortal = (el, opts = {}) => {
5576
5576
  capture: true
5577
5577
  });
5578
5578
  };
5579
- if (disableDragOnFocus) {
5580
- el.addEventListener("focus", onFocus, { capture: true });
5581
- el.addEventListener("blur", onBlur, { capture: true });
5582
- } else if (disableDrag) {
5579
+ if (disableDrag) {
5583
5580
  el.addEventListener("pointerdown", stopPropagation, {
5584
5581
  capture: true
5585
5582
  });
5583
+ } else if (disableDragOnFocus) {
5584
+ el.addEventListener("focus", onFocus, { capture: true });
5585
+ el.addEventListener("blur", onBlur, { capture: true });
5586
5586
  }
5587
5587
  el.setAttribute("data-puck-overlay-portal", "true");
5588
5588
  return () => {
5589
5589
  el.removeEventListener("mouseover", stopPropagation, {
5590
5590
  capture: true
5591
5591
  });
5592
- if (disableDragOnFocus) {
5593
- el.removeEventListener("focus", onFocus, { capture: true });
5594
- el.removeEventListener("blur", onFocus, { capture: true });
5595
- } else if (disableDrag) {
5592
+ if (disableDrag) {
5596
5593
  el.removeEventListener("pointerdown", stopPropagation, {
5597
5594
  capture: true
5598
5595
  });
5596
+ } else if (disableDragOnFocus) {
5597
+ el.removeEventListener("focus", onFocus, { capture: true });
5598
+ el.removeEventListener("blur", onBlur, { capture: true });
5599
5599
  }
5600
5600
  el.removeAttribute("data-puck-overlay-portal");
5601
5601
  };
@@ -9208,6 +9208,15 @@ function useSidebarResize(position, dispatch) {
9208
9208
  };
9209
9209
  }
9210
9210
 
9211
+ // lib/data/to-component.ts
9212
+ init_react_import();
9213
+ var toComponent = (item) => {
9214
+ return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
9215
+ props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
9216
+ type: "root"
9217
+ });
9218
+ };
9219
+
9211
9220
  // components/Puck/index.tsx
9212
9221
  var import_jsx_runtime46 = require("react/jsx-runtime");
9213
9222
  var getClassName31 = get_class_name_factory_default("Puck", styles_module_default15);
@@ -9284,9 +9293,13 @@ function PuckProvider({ children }) {
9284
9293
  }
9285
9294
  const rootProps = ((_h = initialData == null ? void 0 : initialData.root) == null ? void 0 : _h.props) || (initialData == null ? void 0 : initialData.root) || {};
9286
9295
  const defaultedRootProps = __spreadValues(__spreadValues({}, (_i = config.root) == null ? void 0 : _i.defaultProps), rootProps);
9296
+ const root = populateIds(
9297
+ toComponent(__spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: defaultedRootProps })),
9298
+ config
9299
+ );
9287
9300
  const newAppState = __spreadProps(__spreadValues({}, defaultAppState), {
9288
9301
  data: __spreadProps(__spreadValues({}, initialData), {
9289
- root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: defaultedRootProps }),
9302
+ root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: root.props }),
9290
9303
  content: initialData.content || []
9291
9304
  }),
9292
9305
  ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
@@ -9705,17 +9718,6 @@ function transformProps(data, propTransforms, config = { components: {} }) {
9705
9718
 
9706
9719
  // lib/resolve-all-data.ts
9707
9720
  init_react_import();
9708
-
9709
- // lib/data/to-component.ts
9710
- init_react_import();
9711
- var toComponent = (item) => {
9712
- return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
9713
- props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
9714
- type: "root"
9715
- });
9716
- };
9717
-
9718
- // lib/resolve-all-data.ts
9719
9721
  function resolveAllData(_0, _1) {
9720
9722
  return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
9721
9723
  var _a;
package/dist/index.mjs CHANGED
@@ -18,14 +18,14 @@ import {
18
18
  setDeep,
19
19
  useGetPuck,
20
20
  usePuck
21
- } from "./chunk-KNAV6QTS.mjs";
21
+ } from "./chunk-AO6Y47WD.mjs";
22
22
  import {
23
23
  init_react_import,
24
24
  migrate,
25
25
  resolveAllData,
26
26
  transformProps,
27
27
  walkTree
28
- } from "./chunk-X7YZ3YE7.mjs";
28
+ } from "./chunk-VBJEDLUM.mjs";
29
29
 
30
30
  // bundle/index.ts
31
31
  init_react_import();
@@ -5576,26 +5576,26 @@ var registerOverlayPortal = (el, opts = {}) => {
5576
5576
  capture: true
5577
5577
  });
5578
5578
  };
5579
- if (disableDragOnFocus) {
5580
- el.addEventListener("focus", onFocus, { capture: true });
5581
- el.addEventListener("blur", onBlur, { capture: true });
5582
- } else if (disableDrag) {
5579
+ if (disableDrag) {
5583
5580
  el.addEventListener("pointerdown", stopPropagation, {
5584
5581
  capture: true
5585
5582
  });
5583
+ } else if (disableDragOnFocus) {
5584
+ el.addEventListener("focus", onFocus, { capture: true });
5585
+ el.addEventListener("blur", onBlur, { capture: true });
5586
5586
  }
5587
5587
  el.setAttribute("data-puck-overlay-portal", "true");
5588
5588
  return () => {
5589
5589
  el.removeEventListener("mouseover", stopPropagation, {
5590
5590
  capture: true
5591
5591
  });
5592
- if (disableDragOnFocus) {
5593
- el.removeEventListener("focus", onFocus, { capture: true });
5594
- el.removeEventListener("blur", onFocus, { capture: true });
5595
- } else if (disableDrag) {
5592
+ if (disableDrag) {
5596
5593
  el.removeEventListener("pointerdown", stopPropagation, {
5597
5594
  capture: true
5598
5595
  });
5596
+ } else if (disableDragOnFocus) {
5597
+ el.removeEventListener("focus", onFocus, { capture: true });
5598
+ el.removeEventListener("blur", onBlur, { capture: true });
5599
5599
  }
5600
5600
  el.removeAttribute("data-puck-overlay-portal");
5601
5601
  };
@@ -9208,6 +9208,15 @@ function useSidebarResize(position, dispatch) {
9208
9208
  };
9209
9209
  }
9210
9210
 
9211
+ // lib/data/to-component.ts
9212
+ init_react_import();
9213
+ var toComponent = (item) => {
9214
+ return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
9215
+ props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
9216
+ type: "root"
9217
+ });
9218
+ };
9219
+
9211
9220
  // components/Puck/index.tsx
9212
9221
  var import_jsx_runtime46 = require("react/jsx-runtime");
9213
9222
  var getClassName31 = get_class_name_factory_default("Puck", styles_module_default15);
@@ -9284,9 +9293,13 @@ function PuckProvider({ children }) {
9284
9293
  }
9285
9294
  const rootProps = ((_h = initialData == null ? void 0 : initialData.root) == null ? void 0 : _h.props) || (initialData == null ? void 0 : initialData.root) || {};
9286
9295
  const defaultedRootProps = __spreadValues(__spreadValues({}, (_i = config.root) == null ? void 0 : _i.defaultProps), rootProps);
9296
+ const root = populateIds(
9297
+ toComponent(__spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: defaultedRootProps })),
9298
+ config
9299
+ );
9287
9300
  const newAppState = __spreadProps(__spreadValues({}, defaultAppState), {
9288
9301
  data: __spreadProps(__spreadValues({}, initialData), {
9289
- root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: defaultedRootProps }),
9302
+ root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: root.props }),
9290
9303
  content: initialData.content || []
9291
9304
  }),
9292
9305
  ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
@@ -9705,17 +9718,6 @@ function transformProps(data, propTransforms, config = { components: {} }) {
9705
9718
 
9706
9719
  // lib/resolve-all-data.ts
9707
9720
  init_react_import();
9708
-
9709
- // lib/data/to-component.ts
9710
- init_react_import();
9711
- var toComponent = (item) => {
9712
- return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
9713
- props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
9714
- type: "root"
9715
- });
9716
- };
9717
-
9718
- // lib/resolve-all-data.ts
9719
9721
  function resolveAllData(_0, _1) {
9720
9722
  return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
9721
9723
  var _a;
@@ -18,14 +18,14 @@ import {
18
18
  setDeep,
19
19
  useGetPuck,
20
20
  usePuck
21
- } from "./chunk-KNAV6QTS.mjs";
21
+ } from "./chunk-AO6Y47WD.mjs";
22
22
  import {
23
23
  init_react_import,
24
24
  migrate,
25
25
  resolveAllData,
26
26
  transformProps,
27
27
  walkTree
28
- } from "./chunk-X7YZ3YE7.mjs";
28
+ } from "./chunk-VBJEDLUM.mjs";
29
29
 
30
30
  // bundle/no-external.ts
31
31
  init_react_import();
package/dist/rsc.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  transformProps,
13
13
  useSlots,
14
14
  walkTree
15
- } from "./chunk-X7YZ3YE7.mjs";
15
+ } from "./chunk-VBJEDLUM.mjs";
16
16
 
17
17
  // bundle/rsc.tsx
18
18
  init_react_import();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.21.0-canary.e4131567",
3
+ "version": "0.21.0-canary.f5820ce9",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Chris Villa <chris@puckeditor.com>",
6
6
  "repository": "measuredco/puck",