@measured/puck 0.21.0-canary.77444503 → 0.21.0-canary.7c2f9283

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.
Files changed (46) hide show
  1. package/dist/{Editor-O447AVCX.mjs → Editor-32UYWE6W.mjs} +10 -10
  2. package/dist/{Editor-F2LSS6SE.css → Editor-IQP25PUX.css} +28 -27
  3. package/dist/{Render-QEMDIDQC.css → Render-3OV4N4MT.css} +28 -27
  4. package/dist/{Render-OFE6QLI2.mjs → Render-FXZX6NFH.mjs} +1 -1
  5. package/dist/{actions-ONhOkrvf.d.mts → actions-BkBoKAc5.d.mts} +26 -10
  6. package/dist/{actions-ONhOkrvf.d.ts → actions-BkBoKAc5.d.ts} +26 -10
  7. package/dist/{chunk-QAWJTCV5.mjs → chunk-3VQHXASI.mjs} +1 -1
  8. package/dist/{chunk-BSDEIOEK.mjs → chunk-6KNQXLQR.mjs} +10 -8
  9. package/dist/{chunk-CSSRLPHM.mjs → chunk-AOEDIUVK.mjs} +1 -1
  10. package/dist/{chunk-4277WLKB.mjs → chunk-FCCNEDWR.mjs} +4373 -3687
  11. package/dist/{chunk-PLXSMBAA.mjs → chunk-GVKHZNTR.mjs} +1 -1
  12. package/dist/{chunk-DAQLMM2T.mjs → chunk-K562SEXI.mjs} +97 -6
  13. package/dist/{chunk-QBGM4ELA.mjs → chunk-KN3XDS7U.mjs} +1 -1
  14. package/dist/{chunk-62AAYNXG.mjs → chunk-MEL7FUSF.mjs} +1 -1
  15. package/dist/{chunk-Y656T6AQ.mjs → chunk-NYGQH27S.mjs} +100 -74
  16. package/dist/{chunk-NLUHDYVR.mjs → chunk-Q3TJ2VYO.mjs} +23 -3
  17. package/dist/{chunk-T3WX7XJ6.mjs → chunk-REWRIUGR.mjs} +33 -9
  18. package/dist/{chunk-2Q4PACDA.mjs → chunk-V2IQTPPK.mjs} +4 -4
  19. package/dist/{full-BEMDJKDS.mjs → full-4OS3O57Y.mjs} +8 -8
  20. package/dist/{index-BEoNHRI1.d.ts → index-bqD1SEOb.d.mts} +3 -1
  21. package/dist/{index-DfxZ7tZF.d.mts → index-lt1zf5WR.d.ts} +3 -1
  22. package/dist/index.css +732 -341
  23. package/dist/index.d.mts +28 -9
  24. package/dist/index.d.ts +28 -9
  25. package/dist/index.js +3340 -2427
  26. package/dist/index.mjs +21 -18
  27. package/dist/internal.d.mts +2 -2
  28. package/dist/internal.d.ts +2 -2
  29. package/dist/internal.js +22 -3
  30. package/dist/internal.mjs +2 -2
  31. package/dist/{loaded-JU3A7Y4L.mjs → loaded-DCQVLO7I.mjs} +5 -5
  32. package/dist/{loaded-N3FYGF2Y.mjs → loaded-JGRO7BH7.mjs} +5 -5
  33. package/dist/{loaded-OBY7OMS6.mjs → loaded-KKVJE5KH.mjs} +5 -5
  34. package/dist/no-external.css +870 -475
  35. package/dist/no-external.d.mts +4 -4
  36. package/dist/no-external.d.ts +4 -4
  37. package/dist/no-external.js +3347 -2431
  38. package/dist/no-external.mjs +20 -12
  39. package/dist/rsc.css +28 -27
  40. package/dist/rsc.d.mts +2 -2
  41. package/dist/rsc.d.ts +2 -2
  42. package/dist/rsc.js +146 -83
  43. package/dist/rsc.mjs +4 -4
  44. package/dist/{walk-tree-CdriEzFJ.d.mts → walk-tree-CRRDqx6_.d.mts} +1 -1
  45. package/dist/{walk-tree-DHbAZ4wF.d.ts → walk-tree-CS7sEpfG.d.ts} +1 -1
  46. package/package.json +1 -1
@@ -6,21 +6,25 @@ import {
6
6
  FieldLabel,
7
7
  Puck,
8
8
  Render,
9
+ blocksPlugin,
9
10
  createUsePuck,
11
+ fieldsPlugin,
12
+ legacySideBarPlugin,
13
+ outlinePlugin,
10
14
  overrideKeys,
11
15
  registerOverlayPortal,
12
16
  renderContext,
13
17
  setDeep,
14
18
  useGetPuck,
15
19
  usePuck
16
- } from "./chunk-4277WLKB.mjs";
17
- import "./chunk-2Q4PACDA.mjs";
20
+ } from "./chunk-FCCNEDWR.mjs";
21
+ import "./chunk-V2IQTPPK.mjs";
18
22
  import {
19
23
  migrate,
20
24
  resolveAllData,
21
25
  transformProps
22
- } from "./chunk-Y656T6AQ.mjs";
23
- import "./chunk-CSSRLPHM.mjs";
26
+ } from "./chunk-NYGQH27S.mjs";
27
+ import "./chunk-AOEDIUVK.mjs";
24
28
  import {
25
29
  Action,
26
30
  ActionBar,
@@ -29,17 +33,17 @@ import {
29
33
  Label,
30
34
  RichTextMenu,
31
35
  Separator
32
- } from "./chunk-BSDEIOEK.mjs";
33
- import "./chunk-PLXSMBAA.mjs";
34
- import "./chunk-62AAYNXG.mjs";
35
- import "./chunk-QAWJTCV5.mjs";
36
- import "./chunk-DAQLMM2T.mjs";
37
- import "./chunk-QBGM4ELA.mjs";
38
- import "./chunk-T3WX7XJ6.mjs";
36
+ } from "./chunk-6KNQXLQR.mjs";
37
+ import "./chunk-GVKHZNTR.mjs";
38
+ import "./chunk-MEL7FUSF.mjs";
39
+ import "./chunk-3VQHXASI.mjs";
40
+ import "./chunk-K562SEXI.mjs";
41
+ import "./chunk-KN3XDS7U.mjs";
42
+ import "./chunk-REWRIUGR.mjs";
39
43
  import "./chunk-Y2EFNT5P.mjs";
40
44
  import {
41
45
  walkTree
42
- } from "./chunk-NLUHDYVR.mjs";
46
+ } from "./chunk-Q3TJ2VYO.mjs";
43
47
  import {
44
48
  init_react_import
45
49
  } from "./chunk-M6W7YEVX.mjs";
@@ -61,8 +65,12 @@ export {
61
65
  Render,
62
66
  RichTextMenu,
63
67
  Separator,
68
+ blocksPlugin,
64
69
  createUsePuck,
70
+ fieldsPlugin,
71
+ legacySideBarPlugin,
65
72
  migrate,
73
+ outlinePlugin,
66
74
  overrideKeys,
67
75
  registerOverlayPortal,
68
76
  renderContext,
package/dist/rsc.css CHANGED
@@ -1,44 +1,44 @@
1
1
  /* css-module:/home/runner/work/puck/puck/packages/core/components/RichTextEditor/styles.module.css/#css-module-data */
2
- ._RichTextEditor_1elol_1 .ProseMirror {
2
+ ._RichTextEditor_z25h4_1 .ProseMirror {
3
3
  white-space: pre-wrap;
4
4
  word-wrap: break-word;
5
5
  cursor: text;
6
6
  outline: none;
7
7
  position: relative;
8
8
  }
9
- ._RichTextEditor_1elol_1 .rich-text * {
9
+ ._RichTextEditor_z25h4_1 .rich-text * {
10
10
  white-space: pre-wrap;
11
11
  user-select: auto;
12
12
  -webkit-user-select: auto;
13
13
  }
14
- ._RichTextEditor_1elol_1 .rich-text blockquote {
14
+ ._RichTextEditor_z25h4_1 .rich-text blockquote {
15
15
  margin: 1em 0;
16
16
  padding: 0 1em;
17
17
  border-left: 4px solid var(--puck-color-grey-09);
18
18
  }
19
- ._RichTextEditor_1elol_1 .rich-text code {
19
+ ._RichTextEditor_z25h4_1 .rich-text code {
20
20
  background-color: var(--puck-color-grey-11);
21
21
  padding: 4px 8px;
22
22
  border-radius: 4px;
23
23
  }
24
- ._RichTextEditor_1elol_1 .rich-text p:empty::before {
24
+ ._RichTextEditor_z25h4_1 .rich-text p:empty::before {
25
25
  content: "\a0";
26
26
  }
27
- ._RichTextEditor_1elol_1 .rich-text pre code {
27
+ ._RichTextEditor_z25h4_1 .rich-text pre code {
28
28
  display: block;
29
29
  padding: 8px 12px;
30
30
  }
31
- ._RichTextEditor_1elol_1 .rich-text > *:first-child,
32
- ._RichTextEditor_1elol_1 .ProseMirror > *:first-child,
33
- ._RichTextEditor_1elol_1 .rich-text * p:first-of-type {
31
+ ._RichTextEditor_z25h4_1 .rich-text > *:first-child,
32
+ ._RichTextEditor_z25h4_1 .ProseMirror > *:first-child,
33
+ ._RichTextEditor_z25h4_1 .rich-text * p:first-of-type {
34
34
  margin-top: 0;
35
35
  }
36
- ._RichTextEditor_1elol_1 .rich-text > *:last-child,
37
- ._RichTextEditor_1elol_1 .ProseMirror > *:last-child,
38
- ._RichTextEditor_1elol_1 .rich-text * p:last-of-type {
36
+ ._RichTextEditor_z25h4_1 .rich-text > *:last-child,
37
+ ._RichTextEditor_z25h4_1 .ProseMirror > *:last-child,
38
+ ._RichTextEditor_z25h4_1 .rich-text * p:last-of-type {
39
39
  margin-bottom: 0;
40
40
  }
41
- ._RichTextEditor--editor_1elol_50 {
41
+ ._RichTextEditor--editor_z25h4_50 {
42
42
  background: var(--puck-color-white);
43
43
  border-width: 1px;
44
44
  border-style: solid;
@@ -50,52 +50,53 @@
50
50
  font-family: inherit;
51
51
  font-size: var(--puck-font-size-xxs);
52
52
  resize: vertical;
53
+ text-align: initial;
53
54
  transition: border-color 50ms ease-in;
54
55
  width: 100%;
55
56
  max-width: 100%;
56
57
  min-height: 128px;
57
58
  }
58
- ._RichTextEditor--editor_1elol_50 .rich-text {
59
+ ._RichTextEditor--editor_z25h4_50 .rich-text {
59
60
  flex-grow: 1;
60
61
  }
61
- ._RichTextEditor--editor_1elol_50 .rich-text:not(:has(.ProseMirror)),
62
- ._RichTextEditor--editor_1elol_50 .rich-text .ProseMirror {
62
+ ._RichTextEditor--editor_z25h4_50 .rich-text:not(:has(.ProseMirror)),
63
+ ._RichTextEditor--editor_z25h4_50 .rich-text .ProseMirror {
63
64
  height: 100%;
64
65
  padding: 12px 15px;
65
66
  }
66
- ._RichTextEditor--editor_1elol_50 .rich-text ul,
67
- ._RichTextEditor--editor_1elol_50 .rich-text ol {
67
+ ._RichTextEditor--editor_z25h4_50 .rich-text ul,
68
+ ._RichTextEditor--editor_z25h4_50 .rich-text ol {
68
69
  padding-left: 24px;
69
70
  }
70
- ._RichTextEditor--editor_1elol_50 .rich-text li {
71
+ ._RichTextEditor--editor_z25h4_50 .rich-text li {
71
72
  line-height: 1.5;
72
73
  }
73
- ._RichTextEditor--editor_1elol_50 .rich-text p {
74
+ ._RichTextEditor--editor_z25h4_50 .rich-text p {
74
75
  margin-block: 12px;
75
76
  }
76
- ._RichTextEditor--editor_1elol_50 .rich-text ul {
77
+ ._RichTextEditor--editor_z25h4_50 .rich-text ul {
77
78
  list-style: disc;
78
79
  }
79
- ._RichTextEditor--editor_1elol_50 .rich-text ol {
80
+ ._RichTextEditor--editor_z25h4_50 .rich-text ol {
80
81
  list-style: decimal;
81
82
  }
82
- ._RichTextEditor--editor_1elol_50:focus-within {
83
+ ._RichTextEditor--editor_z25h4_50:focus-within {
83
84
  border-color: var(--puck-color-grey-05);
84
85
  outline: 2px solid var(--puck-color-azure-05);
85
86
  transition: none;
86
87
  }
87
- ._RichTextEditor--editor_1elol_50._RichTextEditor--disabled_1elol_106 {
88
+ ._RichTextEditor--editor_z25h4_50._RichTextEditor--disabled_z25h4_107 {
88
89
  background: var(--puck-color-grey-11);
89
90
  }
90
- ._RichTextEditor_1elol_1:not(:focus-within):not(._RichTextEditor--isActive_1elol_110) .ProseMirror ::selection {
91
+ ._RichTextEditor_z25h4_1:not(:focus-within):not(._RichTextEditor--isActive_z25h4_111) .ProseMirror ::selection {
91
92
  background-color: transparent;
92
93
  }
93
- ._RichTextEditor-menu_1elol_116 {
94
+ ._RichTextEditor-menu_z25h4_117 {
94
95
  border-bottom: 1px solid var(--puck-color-grey-10);
95
96
  position: sticky;
96
97
  top: 0;
97
98
  z-index: 1;
98
99
  }
99
- ._RichTextEditor--disabled_1elol_106 ._RichTextEditor-menu_1elol_116 {
100
+ ._RichTextEditor--disabled_z25h4_107 ._RichTextEditor-menu_z25h4_117 {
100
101
  border-bottom: 1px solid var(--puck-color-grey-09);
101
102
  }
package/dist/rsc.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, U as UserGenerics, M as Metadata } from './actions-ONhOkrvf.mjs';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CdriEzFJ.mjs';
2
+ import { C as Config, U as UserGenerics, M as Metadata } from './actions-BkBoKAc5.mjs';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CRRDqx6_.mjs';
4
4
  import 'react';
5
5
  import '@tiptap/react';
6
6
  import '@tiptap/extension-blockquote';
package/dist/rsc.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, U as UserGenerics, M as Metadata } from './actions-ONhOkrvf.js';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DHbAZ4wF.js';
2
+ import { C as Config, U as UserGenerics, M as Metadata } from './actions-BkBoKAc5.js';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CS7sEpfG.js';
4
4
  import 'react';
5
5
  import '@tiptap/react';
6
6
  import '@tiptap/extension-blockquote';
package/dist/rsc.js CHANGED
@@ -199,7 +199,7 @@ var init_styles_module = __esm({
199
199
  "use strict";
200
200
  init_react_import();
201
201
  init_css_module_data();
202
- styles_module_default = { "RichTextEditor": "_RichTextEditor_1elol_1", "RichTextEditor--editor": "_RichTextEditor--editor_1elol_50", "RichTextEditor--disabled": "_RichTextEditor--disabled_1elol_106", "RichTextEditor--isActive": "_RichTextEditor--isActive_1elol_110", "RichTextEditor-menu": "_RichTextEditor-menu_1elol_116" };
202
+ styles_module_default = { "RichTextEditor": "_RichTextEditor_z25h4_1", "RichTextEditor--editor": "_RichTextEditor--editor_z25h4_50", "RichTextEditor--disabled": "_RichTextEditor--disabled_z25h4_107", "RichTextEditor--isActive": "_RichTextEditor--isActive_z25h4_111", "RichTextEditor-menu": "_RichTextEditor-menu_z25h4_117" };
203
203
  }
204
204
  });
205
205
 
@@ -529,12 +529,12 @@ var walkObject = ({
529
529
  }
530
530
  return flatten(newProps);
531
531
  };
532
- function mapFields(item, mappers, config, recurseSlots = false) {
532
+ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true) {
533
533
  var _a, _b, _c, _d, _e;
534
534
  const itemType = "type" in item ? item.type : "root";
535
535
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
536
536
  const newProps = walkObject({
537
- value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
537
+ value: shouldDefaultSlots ? defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}) : item.props,
538
538
  fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
539
539
  mappers,
540
540
  id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
@@ -552,32 +552,38 @@ function mapFields(item, mappers, config, recurseSlots = false) {
552
552
  });
553
553
  }
554
554
 
555
+ // lib/field-transforms/build-mappers.ts
556
+ init_react_import();
557
+ function buildMappers(transforms, readOnly, forceReadOnly) {
558
+ return Object.keys(transforms).reduce((acc, _fieldType) => {
559
+ const fieldType = _fieldType;
560
+ return __spreadProps(__spreadValues({}, acc), {
561
+ [fieldType]: (_a) => {
562
+ var _b = _a, {
563
+ parentId
564
+ } = _b, params = __objRest(_b, [
565
+ "parentId"
566
+ ]);
567
+ const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
568
+ const isReadOnly = (readOnly == null ? void 0 : readOnly[params.propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly || false;
569
+ const fn = transforms[fieldType];
570
+ return fn == null ? void 0 : fn(__spreadProps(__spreadValues({}, params), {
571
+ isReadOnly,
572
+ componentId: parentId
573
+ }));
574
+ }
575
+ });
576
+ }, {});
577
+ }
578
+
555
579
  // lib/field-transforms/use-field-transforms.tsx
556
580
  function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
557
- const mappers = (0, import_react2.useMemo)(() => {
558
- return Object.keys(transforms).reduce((acc, _fieldType) => {
559
- const fieldType = _fieldType;
560
- return __spreadProps(__spreadValues({}, acc), {
561
- [fieldType]: (_a) => {
562
- var _b = _a, {
563
- parentId
564
- } = _b, params = __objRest(_b, [
565
- "parentId"
566
- ]);
567
- const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
568
- const isReadOnly = (readOnly == null ? void 0 : readOnly[params.propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly || false;
569
- const fn = transforms[fieldType];
570
- return fn == null ? void 0 : fn(__spreadProps(__spreadValues({}, params), {
571
- isReadOnly,
572
- componentId: parentId
573
- }));
574
- }
575
- });
576
- }, {});
577
- }, [transforms, readOnly, forceReadOnly]);
581
+ const mappers = (0, import_react2.useMemo)(
582
+ () => buildMappers(transforms, readOnly, forceReadOnly),
583
+ [transforms, readOnly, forceReadOnly]
584
+ );
578
585
  const transformedProps = (0, import_react2.useMemo)(() => {
579
- const mapped = mapFields(item, mappers, config).props;
580
- return mapped;
586
+ return mapFields(item, mappers, config).props;
581
587
  }, [config, item, mappers]);
582
588
  const mergedProps = (0, import_react2.useMemo)(
583
589
  () => __spreadValues(__spreadValues({}, item.props), transformedProps),
@@ -814,6 +820,15 @@ init_react_import();
814
820
  // lib/resolve-component-data.ts
815
821
  init_react_import();
816
822
 
823
+ // lib/data/to-component.ts
824
+ init_react_import();
825
+ var toComponent = (item) => {
826
+ return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
827
+ props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
828
+ type: "root"
829
+ });
830
+ };
831
+
817
832
  // lib/get-changed.ts
818
833
  init_react_import();
819
834
  var import_fast_equals = require("fast-equals");
@@ -830,14 +845,22 @@ var getChanged = (newItem, oldItem) => {
830
845
  // lib/resolve-component-data.ts
831
846
  var import_fast_equals2 = require("fast-equals");
832
847
  var cache = { lastChange: {} };
833
- var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
848
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null) {
834
849
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
835
850
  const resolvedItem = __spreadValues({}, item);
836
851
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
837
852
  const id = "id" in item.props ? item.props.id : "root";
838
853
  if (shouldRunResolver) {
839
- const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
840
- if (trigger !== "force" && item && (0, import_fast_equals2.deepEqual)(item, oldItem)) {
854
+ const {
855
+ item: oldItem = null,
856
+ resolved = {},
857
+ parentId: oldParentId = null
858
+ } = cache.lastChange[id] || {};
859
+ const isRootOrInserted = oldParentId === null;
860
+ const parentChanged = !isRootOrInserted && (parent == null ? void 0 : parent.props.id) !== oldParentId;
861
+ const dataChanged = item && !(0, import_fast_equals2.deepEqual)(item, oldItem);
862
+ const shouldSkip = trigger === "move" && !parentChanged || trigger !== "move" && trigger !== "force" && !dataChanged;
863
+ if (shouldSkip) {
841
864
  return { node: resolved, didChange: false };
842
865
  }
843
866
  const changed = getChanged(item, oldItem);
@@ -848,13 +871,15 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
848
871
  changed,
849
872
  lastData: oldItem,
850
873
  metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
851
- trigger
874
+ trigger,
875
+ parent
852
876
  });
853
877
  resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
854
878
  if (Object.keys(readOnly).length) {
855
879
  resolvedItem.readOnly = readOnly;
856
880
  }
857
881
  }
882
+ const itemAsComponentData = toComponent(resolvedItem);
858
883
  let itemWithResolvedChildren = yield mapFields(
859
884
  resolvedItem,
860
885
  {
@@ -869,7 +894,8 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
869
894
  metadata,
870
895
  onResolveStart,
871
896
  onResolveEnd,
872
- trigger
897
+ trigger,
898
+ itemAsComponentData
873
899
  )).node;
874
900
  })
875
901
  )
@@ -883,7 +909,8 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
883
909
  }
884
910
  cache.lastChange[id] = {
885
911
  item,
886
- resolved: itemWithResolvedChildren
912
+ resolved: itemWithResolvedChildren,
913
+ parentId: parent == null ? void 0 : parent.props.id
887
914
  };
888
915
  return {
889
916
  node: itemWithResolvedChildren,
@@ -891,6 +918,36 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
891
918
  };
892
919
  });
893
920
 
921
+ // lib/group-zones-by-component.ts
922
+ init_react_import();
923
+
924
+ // lib/get-zone-id.ts
925
+ init_react_import();
926
+ var getZoneId = (zoneCompound) => {
927
+ if (!zoneCompound) {
928
+ return [];
929
+ }
930
+ if (zoneCompound && zoneCompound.indexOf(":") > -1) {
931
+ return zoneCompound.split(":");
932
+ }
933
+ return [rootDroppableId, zoneCompound];
934
+ };
935
+
936
+ // lib/group-zones-by-component.ts
937
+ var groupZonesByComponent = (data) => {
938
+ var _a;
939
+ const zoneEntries = Object.entries((_a = data.zones) != null ? _a : {});
940
+ return zoneEntries.reduce((acc, [zoneCompound, zoneContent]) => {
941
+ const [componentId, zoneName] = getZoneId(zoneCompound);
942
+ if (!componentId.length || !zoneName.length) return acc;
943
+ if (!acc[componentId]) {
944
+ acc[componentId] = [];
945
+ }
946
+ acc[componentId].push({ zoneCompound, content: zoneContent });
947
+ return acc;
948
+ }, {});
949
+ };
950
+
894
951
  // lib/data/default-data.ts
895
952
  init_react_import();
896
953
  var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
@@ -898,21 +955,13 @@ var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
898
955
  content: data.content || []
899
956
  });
900
957
 
901
- // lib/data/to-component.ts
902
- init_react_import();
903
- var toComponent = (item) => {
904
- return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
905
- props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
906
- type: "root"
907
- });
908
- };
909
-
910
958
  // lib/resolve-all-data.ts
911
959
  function resolveAllData(_0, _1) {
912
960
  return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
913
- var _a;
914
961
  const defaultedData = defaultData(data);
915
- const resolveNode = (_node) => __async(null, null, function* () {
962
+ const zonesByComponent = groupZonesByComponent(defaultedData);
963
+ let resolvedZones = {};
964
+ const resolveNode = (_node, parent) => __async(null, null, function* () {
916
965
  const node = toComponent(_node);
917
966
  onResolveStart == null ? void 0 : onResolveStart(node);
918
967
  const resolved = (yield resolveComponentData(
@@ -923,37 +972,44 @@ function resolveAllData(_0, _1) {
923
972
  },
924
973
  () => {
925
974
  },
926
- "force"
975
+ "force",
976
+ parent
927
977
  )).node;
928
- const resolvedDeep = yield mapFields(
978
+ const resolvedAsComponent = toComponent(resolved);
979
+ const resolvedDeepPromise = mapFields(
929
980
  resolved,
930
- { slot: ({ value }) => processContent(value) },
981
+ {
982
+ slot: ({ value }) => processContent(value, resolvedAsComponent)
983
+ },
931
984
  config
932
985
  );
986
+ let resolveZonePromises = [];
987
+ if (zonesByComponent[resolvedAsComponent.props.id]) {
988
+ resolveZonePromises = zonesByComponent[resolvedAsComponent.props.id].map(
989
+ (_02) => __async(null, [_02], function* ({ zoneCompound, content }) {
990
+ resolvedZones[zoneCompound] = yield processContent(
991
+ content,
992
+ resolvedAsComponent
993
+ );
994
+ })
995
+ );
996
+ }
997
+ const resolvedDeep = yield resolvedDeepPromise;
998
+ yield Promise.all(resolveZonePromises);
933
999
  onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
934
1000
  return resolvedDeep;
935
1001
  });
936
- const processContent = (content) => __async(null, null, function* () {
937
- return Promise.all(content.map(resolveNode));
1002
+ const processContent = (content, parent) => __async(null, null, function* () {
1003
+ return Promise.all(content.map((item) => resolveNode(item, parent)));
938
1004
  });
939
- const processZones = () => __async(null, null, function* () {
940
- var _a2;
941
- const zones = (_a2 = data.zones) != null ? _a2 : {};
942
- Object.entries(zones).forEach((_02) => __async(null, [_02], function* ([zoneKey, content]) {
943
- zones[zoneKey] = yield Promise.all(content.map(resolveNode));
944
- }));
945
- return zones;
946
- });
947
- const dynamic = {
948
- root: yield resolveNode(defaultedData.root),
949
- content: yield processContent(defaultedData.content),
950
- zones: yield processZones()
951
- };
952
- Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(null, null, function* () {
953
- const content = defaultedData.zones[zoneKey];
954
- dynamic.zones[zoneKey] = yield processContent(content);
955
- }), {});
956
- return dynamic;
1005
+ const result = defaultData({});
1006
+ result.root = yield resolveNode(defaultedData.root, null);
1007
+ result.content = yield processContent(
1008
+ defaultedData.content,
1009
+ toComponent(result.root)
1010
+ );
1011
+ result.zones = resolvedZones;
1012
+ return result;
957
1013
  });
958
1014
  }
959
1015
 
@@ -1040,7 +1096,8 @@ init_react_import();
1040
1096
  var defaultViewports = [
1041
1097
  { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1042
1098
  { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1043
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1099
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
1100
+ { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
1044
1101
  ];
1045
1102
 
1046
1103
  // store/default-app-state.ts
@@ -1062,7 +1119,8 @@ var defaultAppState = {
1062
1119
  options: [],
1063
1120
  controlsVisible: true
1064
1121
  },
1065
- field: { focus: null }
1122
+ field: { focus: null },
1123
+ plugin: { current: null }
1066
1124
  },
1067
1125
  indexes: {
1068
1126
  nodes: {},
@@ -1075,20 +1133,6 @@ init_react_import();
1075
1133
 
1076
1134
  // lib/data/for-related-zones.ts
1077
1135
  init_react_import();
1078
-
1079
- // lib/get-zone-id.ts
1080
- init_react_import();
1081
- var getZoneId = (zoneCompound) => {
1082
- if (!zoneCompound) {
1083
- return [];
1084
- }
1085
- if (zoneCompound && zoneCompound.indexOf(":") > -1) {
1086
- return zoneCompound.split(":");
1087
- }
1088
- return [rootDroppableId, zoneCompound];
1089
- };
1090
-
1091
- // lib/data/for-related-zones.ts
1092
1136
  function forRelatedZones(item, data, cb, path = []) {
1093
1137
  Object.entries(data.zones || {}).forEach(([zoneCompound, content]) => {
1094
1138
  const [parentId] = getZoneId(zoneCompound);
@@ -1110,9 +1154,28 @@ var stripSlots = (data, config) => {
1110
1154
 
1111
1155
  // lib/data/flatten-node.ts
1112
1156
  var { flatten: flatten2, unflatten } = import_flat.default;
1157
+ function isEmptyArrayOrObject(val) {
1158
+ if (Array.isArray(val)) {
1159
+ return val.length === 0;
1160
+ }
1161
+ if (val != null && Object.prototype.toString.call(val) === "[object Object]") {
1162
+ return Object.keys(val).length === 0;
1163
+ }
1164
+ return false;
1165
+ }
1166
+ function stripEmptyObjects(props) {
1167
+ const result = {};
1168
+ for (const key in props) {
1169
+ if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
1170
+ const val = props[key];
1171
+ if (isEmptyArrayOrObject(val)) continue;
1172
+ result[key] = val;
1173
+ }
1174
+ return result;
1175
+ }
1113
1176
  var flattenNode = (node, config) => {
1114
1177
  return __spreadProps(__spreadValues({}, node), {
1115
- props: flatten2(stripSlots(node, config).props)
1178
+ props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
1116
1179
  });
1117
1180
  };
1118
1181
 
package/dist/rsc.mjs CHANGED
@@ -5,9 +5,9 @@ import {
5
5
  transformProps,
6
6
  useRichtextProps,
7
7
  useSlots
8
- } from "./chunk-Y656T6AQ.mjs";
9
- import "./chunk-CSSRLPHM.mjs";
10
- import "./chunk-T3WX7XJ6.mjs";
8
+ } from "./chunk-NYGQH27S.mjs";
9
+ import "./chunk-AOEDIUVK.mjs";
10
+ import "./chunk-REWRIUGR.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
12
  import {
13
13
  rootAreaId,
@@ -15,7 +15,7 @@ import {
15
15
  rootZone,
16
16
  setupZone,
17
17
  walkTree
18
- } from "./chunk-NLUHDYVR.mjs";
18
+ } from "./chunk-Q3TJ2VYO.mjs";
19
19
  import {
20
20
  __spreadProps,
21
21
  __spreadValues,
@@ -1,4 +1,4 @@
1
- import { C as Config, D as Data, W as WithId, U as UserGenerics, b as Content, c as ComponentData, d as DefaultComponents, e as DefaultComponentProps, f as DefaultRootFieldProps, M as Metadata, R as RootData } from './actions-ONhOkrvf.mjs';
1
+ import { C as Config, D as Data, W as WithId, U as UserGenerics, b as Content, c as ComponentData, d as DefaultComponents, e as DefaultComponentProps, f as DefaultRootFieldProps, M as Metadata, R as RootData } from './actions-BkBoKAc5.mjs';
2
2
 
3
3
  type MigrationOptions<UserConfig extends Config> = {
4
4
  migrateDynamicZonesForComponent?: {
@@ -1,4 +1,4 @@
1
- import { C as Config, D as Data, W as WithId, U as UserGenerics, b as Content, c as ComponentData, d as DefaultComponents, e as DefaultComponentProps, f as DefaultRootFieldProps, M as Metadata, R as RootData } from './actions-ONhOkrvf.js';
1
+ import { C as Config, D as Data, W as WithId, U as UserGenerics, b as Content, c as ComponentData, d as DefaultComponents, e as DefaultComponentProps, f as DefaultRootFieldProps, M as Metadata, R as RootData } from './actions-BkBoKAc5.js';
2
2
 
3
3
  type MigrationOptions<UserConfig extends Config> = {
4
4
  migrateDynamicZonesForComponent?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.21.0-canary.77444503",
3
+ "version": "0.21.0-canary.7c2f9283",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Chris Villa <chris@puckeditor.com>",
6
6
  "repository": "measuredco/puck",