@puckeditor/core 0.22.0 → 0.22.1-canary.5ca963ca

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.
@@ -4,20 +4,20 @@ import {
4
4
  import {
5
5
  EditorInner,
6
6
  LoadedRichTextMenu
7
- } from "./chunk-GKUX6MNS.mjs";
7
+ } from "./chunk-VOB4L2BJ.mjs";
8
8
  import "./chunk-H635BA2V.mjs";
9
- import "./chunk-4US666EQ.mjs";
10
- import "./chunk-M5GPDW62.mjs";
11
- import "./chunk-3RQGAM3Z.mjs";
12
- import "./chunk-XIGSFEU7.mjs";
9
+ import "./chunk-73XKHVBN.mjs";
10
+ import "./chunk-2AATV7NG.mjs";
11
+ import "./chunk-BVKXFA4V.mjs";
12
+ import "./chunk-DATOBXTJ.mjs";
13
13
  import {
14
14
  useAppStore,
15
15
  useAppStoreApi
16
- } from "./chunk-XQHCQEAF.mjs";
17
- import "./chunk-DVZWVU66.mjs";
18
- import "./chunk-6MO3E35Y.mjs";
16
+ } from "./chunk-54LFCIWQ.mjs";
17
+ import "./chunk-HRNJ42TO.mjs";
18
+ import "./chunk-GR7NLT4T.mjs";
19
19
  import "./chunk-Y2EFNT5P.mjs";
20
- import "./chunk-SHVCBQDY.mjs";
20
+ import "./chunk-74HKFKJU.mjs";
21
21
  import {
22
22
  __spreadProps,
23
23
  __spreadValues,
@@ -3,7 +3,7 @@ import {
3
3
  AlignJustify,
4
4
  AlignLeft,
5
5
  AlignRight
6
- } from "./chunk-XQHCQEAF.mjs";
6
+ } from "./chunk-54LFCIWQ.mjs";
7
7
  import {
8
8
  init_react_import
9
9
  } from "./chunk-M6W7YEVX.mjs";
@@ -3,19 +3,19 @@ import {
3
3
  generateId,
4
4
  getItem,
5
5
  makeStatePublic
6
- } from "./chunk-DVZWVU66.mjs";
6
+ } from "./chunk-HRNJ42TO.mjs";
7
7
  import {
8
8
  defaultAppState,
9
9
  defaultViewports,
10
10
  getChanged,
11
11
  resolveComponentData
12
- } from "./chunk-6MO3E35Y.mjs";
12
+ } from "./chunk-GR7NLT4T.mjs";
13
13
  import {
14
14
  get_class_name_factory_default
15
15
  } from "./chunk-Y2EFNT5P.mjs";
16
16
  import {
17
17
  walkAppState
18
- } from "./chunk-SHVCBQDY.mjs";
18
+ } from "./chunk-74HKFKJU.mjs";
19
19
  import {
20
20
  __async,
21
21
  __objRest,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EditorInner,
3
3
  LoadedRichTextMenu
4
- } from "./chunk-GKUX6MNS.mjs";
4
+ } from "./chunk-VOB4L2BJ.mjs";
5
5
  import {
6
6
  RichTextRenderFallback,
7
7
  SlotRender,
@@ -10,10 +10,10 @@ import {
10
10
  getSlotTransform,
11
11
  useRichtextProps,
12
12
  useSlots
13
- } from "./chunk-SSXLOL3N.mjs";
13
+ } from "./chunk-FKYOVZNF.mjs";
14
14
  import {
15
15
  LoadedRichTextMenuInner
16
- } from "./chunk-4US666EQ.mjs";
16
+ } from "./chunk-73XKHVBN.mjs";
17
17
  import {
18
18
  ActionBar,
19
19
  ChevronDown,
@@ -68,7 +68,7 @@ import {
68
68
  useRegisterHistorySlice,
69
69
  useRegisterPermissionsSlice,
70
70
  useResetAutoZoom
71
- } from "./chunk-XQHCQEAF.mjs";
71
+ } from "./chunk-54LFCIWQ.mjs";
72
72
  import {
73
73
  generateId,
74
74
  getItem,
@@ -76,11 +76,11 @@ import {
76
76
  insertAction,
77
77
  makeStatePublic,
78
78
  populateIds
79
- } from "./chunk-DVZWVU66.mjs";
79
+ } from "./chunk-HRNJ42TO.mjs";
80
80
  import {
81
81
  defaultAppState,
82
82
  defaultViewports
83
- } from "./chunk-6MO3E35Y.mjs";
83
+ } from "./chunk-GR7NLT4T.mjs";
84
84
  import {
85
85
  get_class_name_factory_default
86
86
  } from "./chunk-Y2EFNT5P.mjs";
@@ -95,7 +95,7 @@ import {
95
95
  toComponent,
96
96
  walkAppState,
97
97
  walkField
98
- } from "./chunk-SHVCBQDY.mjs";
98
+ } from "./chunk-74HKFKJU.mjs";
99
99
  import {
100
100
  __async,
101
101
  __objRest,
@@ -1999,7 +1999,7 @@ EditorFallback.displayName = "EditorFallback";
1999
1999
  // components/AutoField/fields/RichtextField/index.tsx
2000
2000
  import { Fragment as Fragment5, jsx as jsx18 } from "react/jsx-runtime";
2001
2001
  var Editor = lazy(
2002
- () => import("./Editor-FJJNKTC3.mjs").then((m) => ({
2002
+ () => import("./Editor-MXSH3OSX.mjs").then((m) => ({
2003
2003
  default: m.Editor
2004
2004
  }))
2005
2005
  );
@@ -4499,7 +4499,7 @@ import {
4499
4499
  } from "react";
4500
4500
  import { jsx as jsx28 } from "react/jsx-runtime";
4501
4501
  var Editor2 = lazy2(
4502
- () => import("./Editor-FJJNKTC3.mjs").then((m) => ({
4502
+ () => import("./Editor-MXSH3OSX.mjs").then((m) => ({
4503
4503
  default: m.Editor
4504
4504
  }))
4505
4505
  );
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  useAlignOptions
3
- } from "./chunk-M5GPDW62.mjs";
3
+ } from "./chunk-2AATV7NG.mjs";
4
4
  import {
5
5
  useHeadingOptions
6
- } from "./chunk-3RQGAM3Z.mjs";
6
+ } from "./chunk-BVKXFA4V.mjs";
7
7
  import {
8
8
  useListOptions
9
- } from "./chunk-XIGSFEU7.mjs";
9
+ } from "./chunk-DATOBXTJ.mjs";
10
10
  import {
11
11
  Action,
12
12
  AlignCenter,
@@ -28,7 +28,7 @@ import {
28
28
  Strikethrough,
29
29
  Underline,
30
30
  useControlContext
31
- } from "./chunk-XQHCQEAF.mjs";
31
+ } from "./chunk-54LFCIWQ.mjs";
32
32
  import {
33
33
  get_class_name_factory_default
34
34
  } from "./chunk-Y2EFNT5P.mjs";
@@ -199,7 +199,7 @@ function AlignSelectFallback() {
199
199
  // components/RichTextMenu/controls/AlignSelect/index.tsx
200
200
  import { jsx as jsx7 } from "react/jsx-runtime";
201
201
  var AlignSelectLoaded = lazy(
202
- () => import("./loaded-QH5RKCGC.mjs").then((m) => ({
202
+ () => import("./loaded-EFZRGV2Y.mjs").then((m) => ({
203
203
  default: m.AlignSelectLoaded
204
204
  }))
205
205
  );
@@ -430,7 +430,7 @@ function HeadingSelectFallback() {
430
430
  // components/RichTextMenu/controls/HeadingSelect/index.tsx
431
431
  import { jsx as jsx19 } from "react/jsx-runtime";
432
432
  var HeadingSelectLoaded = lazy2(
433
- () => import("./loaded-LAKI4KDY.mjs").then((m) => ({
433
+ () => import("./loaded-B7563MDT.mjs").then((m) => ({
434
434
  default: m.HeadingSelectLoaded
435
435
  }))
436
436
  );
@@ -462,7 +462,7 @@ function ListSelectFallback() {
462
462
  // components/RichTextMenu/controls/ListSelect/index.tsx
463
463
  import { jsx as jsx21 } from "react/jsx-runtime";
464
464
  var ListSelectLoaded = lazy3(
465
- () => import("./loaded-PILFUJGA.mjs").then((m) => ({
465
+ () => import("./loaded-HECCGJKO.mjs").then((m) => ({
466
466
  default: m.ListSelectLoaded
467
467
  }))
468
468
  );
@@ -31,7 +31,7 @@ var walkField = ({
31
31
  config,
32
32
  recurseSlots = false
33
33
  }) => {
34
- var _a, _b, _c;
34
+ var _a, _b, _c, _d;
35
35
  const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
36
36
  const map = mappers[fieldType];
37
37
  if (map && fieldType === "slot") {
@@ -92,7 +92,9 @@ var walkField = ({
92
92
  id,
93
93
  getPropPath: (k) => `${propPath}.${k}`,
94
94
  config,
95
- recurseSlots
95
+ recurseSlots,
96
+ // Only default missing fields when objectFields describe this value
97
+ ownedFields: ((_d = fields[propKey]) == null ? void 0 : _d.type) === "object"
96
98
  });
97
99
  }
98
100
  }
@@ -105,11 +107,21 @@ var walkObject = ({
105
107
  id,
106
108
  getPropPath,
107
109
  config,
108
- recurseSlots
110
+ recurseSlots,
111
+ ownedFields
109
112
  }) => {
110
- const newProps = Object.entries(value).map(([k, v]) => {
113
+ const keys = Object.keys(value);
114
+ if (ownedFields) {
115
+ for (const fieldName in fields) {
116
+ const fieldType = fields[fieldName].type;
117
+ if (fieldType !== "slot" && mappers[fieldType] && !(fieldName in value)) {
118
+ keys.push(fieldName);
119
+ }
120
+ }
121
+ }
122
+ const newProps = keys.map((k) => {
111
123
  const opts = {
112
- value: v,
124
+ value: value[k],
113
125
  fields,
114
126
  mappers,
115
127
  propKey: k,
@@ -144,7 +156,8 @@ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlo
144
156
  id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
145
157
  getPropPath: (k) => k,
146
158
  config,
147
- recurseSlots
159
+ recurseSlots,
160
+ ownedFields: true
148
161
  });
149
162
  if (isPromise(newProps)) {
150
163
  return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
@@ -5,7 +5,7 @@ import {
5
5
  Heading4,
6
6
  Heading5,
7
7
  Heading6
8
- } from "./chunk-XQHCQEAF.mjs";
8
+ } from "./chunk-54LFCIWQ.mjs";
9
9
  import {
10
10
  init_react_import
11
11
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  List,
3
3
  ListOrdered
4
- } from "./chunk-XQHCQEAF.mjs";
4
+ } from "./chunk-54LFCIWQ.mjs";
5
5
  import {
6
6
  init_react_import
7
7
  } from "./chunk-M6W7YEVX.mjs";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  defaultAppState,
6
6
  resolveComponentData
7
- } from "./chunk-6MO3E35Y.mjs";
7
+ } from "./chunk-GR7NLT4T.mjs";
8
8
  import {
9
9
  get_class_name_factory_default
10
10
  } from "./chunk-Y2EFNT5P.mjs";
@@ -14,7 +14,7 @@ import {
14
14
  toComponent,
15
15
  walkAppState,
16
16
  walkTree
17
- } from "./chunk-SHVCBQDY.mjs";
17
+ } from "./chunk-74HKFKJU.mjs";
18
18
  import {
19
19
  __async,
20
20
  __objRest,
@@ -209,6 +209,7 @@ function resolveAllData(_0, _1) {
209
209
  return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
210
210
  const defaultedData = defaultData(data);
211
211
  const zonesByComponent = groupZonesByComponent(defaultedData);
212
+ const cacheStore = { lastChange: {} };
212
213
  let resolvedZones = {};
213
214
  const resolveNode = (_node, parent, root) => __async(null, null, function* () {
214
215
  const node = toComponent(_node);
@@ -223,7 +224,8 @@ function resolveAllData(_0, _1) {
223
224
  },
224
225
  "force",
225
226
  parent,
226
- root
227
+ root,
228
+ cacheStore
227
229
  )).node;
228
230
  const resolvedAsComponent = toComponent(resolved);
229
231
  const resolvedDeepPromise = mapFields(
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  mapFields,
3
3
  toComponent
4
- } from "./chunk-SHVCBQDY.mjs";
4
+ } from "./chunk-74HKFKJU.mjs";
5
5
  import {
6
6
  __async,
7
7
  __spreadProps,
@@ -37,7 +37,7 @@ var getChanged = (newItem, oldItem) => {
37
37
  // lib/resolve-component-data.ts
38
38
  import { deepEqual as deepEqual2 } from "fast-equals";
39
39
  var cache = { lastChange: {} };
40
- var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }) {
40
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }, cacheStore = cache) {
41
41
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
42
42
  const resolvedItem = __spreadValues({}, item);
43
43
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
@@ -47,7 +47,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
47
47
  item: oldItem = null,
48
48
  resolved = {},
49
49
  parentId: oldParentId = null
50
- } = cache.lastChange[id] || {};
50
+ } = cacheStore.lastChange[id] || {};
51
51
  const isRootOrInserted = oldParentId === null;
52
52
  const parentChanged = !isRootOrInserted && (parent == null ? void 0 : parent.props.id) !== oldParentId;
53
53
  const dataChanged = item && !deepEqual2(item, oldItem);
@@ -89,7 +89,8 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
89
89
  onResolveEnd,
90
90
  trigger,
91
91
  itemAsComponentData,
92
- root
92
+ root,
93
+ cacheStore
93
94
  )).node;
94
95
  })
95
96
  )
@@ -101,7 +102,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
101
102
  if (shouldRunResolver && onResolveEnd) {
102
103
  onResolveEnd(resolvedItem);
103
104
  }
104
- cache.lastChange[id] = {
105
+ cacheStore.lastChange[id] = {
105
106
  item,
106
107
  resolved: itemWithResolvedChildren,
107
108
  parentId: parent == null ? void 0 : parent.props.id
@@ -3,7 +3,7 @@ import {
3
3
  setupZone,
4
4
  walkAppState,
5
5
  walkTree
6
- } from "./chunk-SHVCBQDY.mjs";
6
+ } from "./chunk-74HKFKJU.mjs";
7
7
  import {
8
8
  __spreadProps,
9
9
  __spreadValues,
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-H635BA2V.mjs";
4
4
  import {
5
5
  LoadedRichTextMenuInner
6
- } from "./chunk-4US666EQ.mjs";
6
+ } from "./chunk-73XKHVBN.mjs";
7
7
  import {
8
8
  useAppStore,
9
9
  useAppStoreApi
10
- } from "./chunk-XQHCQEAF.mjs";
10
+ } from "./chunk-54LFCIWQ.mjs";
11
11
  import {
12
12
  get_class_name_factory_default
13
13
  } from "./chunk-Y2EFNT5P.mjs";
@@ -100,7 +100,7 @@ init_react_import();
100
100
  import { lazy, Suspense } from "react";
101
101
  import { jsx as jsx2 } from "react/jsx-runtime";
102
102
  var LoadedRichTextMenuFull = lazy(
103
- () => import("./full-6ZILLKCS.mjs").then((m) => ({
103
+ () => import("./full-7JVAMOPS.mjs").then((m) => ({
104
104
  default: m.LoadedRichTextMenuFull
105
105
  }))
106
106
  );
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  LoadedRichTextMenuInner
3
- } from "./chunk-4US666EQ.mjs";
4
- import "./chunk-M5GPDW62.mjs";
5
- import "./chunk-3RQGAM3Z.mjs";
6
- import "./chunk-XIGSFEU7.mjs";
7
- import "./chunk-XQHCQEAF.mjs";
8
- import "./chunk-DVZWVU66.mjs";
9
- import "./chunk-6MO3E35Y.mjs";
3
+ } from "./chunk-73XKHVBN.mjs";
4
+ import "./chunk-2AATV7NG.mjs";
5
+ import "./chunk-BVKXFA4V.mjs";
6
+ import "./chunk-DATOBXTJ.mjs";
7
+ import "./chunk-54LFCIWQ.mjs";
8
+ import "./chunk-HRNJ42TO.mjs";
9
+ import "./chunk-GR7NLT4T.mjs";
10
10
  import "./chunk-Y2EFNT5P.mjs";
11
- import "./chunk-SHVCBQDY.mjs";
11
+ import "./chunk-74HKFKJU.mjs";
12
12
  import {
13
13
  __spreadValues,
14
14
  init_react_import
package/dist/index.js CHANGED
@@ -1438,7 +1438,8 @@ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlo
1438
1438
  id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
1439
1439
  getPropPath: (k) => k,
1440
1440
  config,
1441
- recurseSlots
1441
+ recurseSlots,
1442
+ ownedFields: true
1442
1443
  });
1443
1444
  if (isPromise(newProps)) {
1444
1445
  return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
@@ -1468,7 +1469,7 @@ var init_map_fields = __esm({
1468
1469
  config,
1469
1470
  recurseSlots = false
1470
1471
  }) => {
1471
- var _a, _b, _c;
1472
+ var _a, _b, _c, _d;
1472
1473
  const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
1473
1474
  const map = mappers[fieldType];
1474
1475
  if (map && fieldType === "slot") {
@@ -1529,7 +1530,9 @@ var init_map_fields = __esm({
1529
1530
  id,
1530
1531
  getPropPath: (k) => `${propPath}.${k}`,
1531
1532
  config,
1532
- recurseSlots
1533
+ recurseSlots,
1534
+ // Only default missing fields when objectFields describe this value
1535
+ ownedFields: ((_d = fields[propKey]) == null ? void 0 : _d.type) === "object"
1533
1536
  });
1534
1537
  }
1535
1538
  }
@@ -1542,11 +1545,21 @@ var init_map_fields = __esm({
1542
1545
  id,
1543
1546
  getPropPath,
1544
1547
  config,
1545
- recurseSlots
1548
+ recurseSlots,
1549
+ ownedFields
1546
1550
  }) => {
1547
- const newProps = Object.entries(value).map(([k, v]) => {
1551
+ const keys = Object.keys(value);
1552
+ if (ownedFields) {
1553
+ for (const fieldName in fields) {
1554
+ const fieldType = fields[fieldName].type;
1555
+ if (fieldType !== "slot" && mappers[fieldType] && !(fieldName in value)) {
1556
+ keys.push(fieldName);
1557
+ }
1558
+ }
1559
+ }
1560
+ const newProps = keys.map((k) => {
1548
1561
  const opts = {
1549
- value: v,
1562
+ value: value[k],
1550
1563
  fields,
1551
1564
  mappers,
1552
1565
  propKey: k,
@@ -3199,7 +3212,7 @@ var init_resolve_component_data = __esm({
3199
3212
  init_get_changed();
3200
3213
  import_fast_equals2 = require("fast-equals");
3201
3214
  cache = { lastChange: {} };
3202
- resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }) {
3215
+ resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }, cacheStore = cache) {
3203
3216
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
3204
3217
  const resolvedItem = __spreadValues({}, item);
3205
3218
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
@@ -3209,7 +3222,7 @@ var init_resolve_component_data = __esm({
3209
3222
  item: oldItem = null,
3210
3223
  resolved = {},
3211
3224
  parentId: oldParentId = null
3212
- } = cache.lastChange[id] || {};
3225
+ } = cacheStore.lastChange[id] || {};
3213
3226
  const isRootOrInserted = oldParentId === null;
3214
3227
  const parentChanged = !isRootOrInserted && (parent == null ? void 0 : parent.props.id) !== oldParentId;
3215
3228
  const dataChanged = item && !(0, import_fast_equals2.deepEqual)(item, oldItem);
@@ -3251,7 +3264,8 @@ var init_resolve_component_data = __esm({
3251
3264
  onResolveEnd,
3252
3265
  trigger,
3253
3266
  itemAsComponentData,
3254
- root
3267
+ root,
3268
+ cacheStore
3255
3269
  )).node;
3256
3270
  })
3257
3271
  )
@@ -3263,7 +3277,7 @@ var init_resolve_component_data = __esm({
3263
3277
  if (shouldRunResolver && onResolveEnd) {
3264
3278
  onResolveEnd(resolvedItem);
3265
3279
  }
3266
- cache.lastChange[id] = {
3280
+ cacheStore.lastChange[id] = {
3267
3281
  item,
3268
3282
  resolved: itemWithResolvedChildren,
3269
3283
  parentId: parent == null ? void 0 : parent.props.id
@@ -17565,6 +17579,7 @@ function resolveAllData(_0, _1) {
17565
17579
  return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
17566
17580
  const defaultedData = defaultData(data);
17567
17581
  const zonesByComponent = groupZonesByComponent(defaultedData);
17582
+ const cacheStore = { lastChange: {} };
17568
17583
  let resolvedZones = {};
17569
17584
  const resolveNode = (_node, parent, root) => __async(null, null, function* () {
17570
17585
  const node = toComponent(_node);
@@ -17579,7 +17594,8 @@ function resolveAllData(_0, _1) {
17579
17594
  },
17580
17595
  "force",
17581
17596
  parent,
17582
- root
17597
+ root,
17598
+ cacheStore
17583
17599
  )).node;
17584
17600
  const resolvedAsComponent = toComponent(resolved);
17585
17601
  const resolvedDeepPromise = mapFields(
package/dist/index.mjs CHANGED
@@ -17,20 +17,20 @@ import {
17
17
  setDeep,
18
18
  useGetPuck,
19
19
  usePuck
20
- } from "./chunk-ELDOSC5Y.mjs";
21
- import "./chunk-GKUX6MNS.mjs";
20
+ } from "./chunk-6PIQFZBM.mjs";
21
+ import "./chunk-VOB4L2BJ.mjs";
22
22
  import {
23
23
  migrate,
24
24
  resolveAllData,
25
25
  transformProps
26
- } from "./chunk-SSXLOL3N.mjs";
26
+ } from "./chunk-FKYOVZNF.mjs";
27
27
  import "./chunk-H635BA2V.mjs";
28
28
  import {
29
29
  RichTextMenu
30
- } from "./chunk-4US666EQ.mjs";
31
- import "./chunk-M5GPDW62.mjs";
32
- import "./chunk-3RQGAM3Z.mjs";
33
- import "./chunk-XIGSFEU7.mjs";
30
+ } from "./chunk-73XKHVBN.mjs";
31
+ import "./chunk-2AATV7NG.mjs";
32
+ import "./chunk-BVKXFA4V.mjs";
33
+ import "./chunk-DATOBXTJ.mjs";
34
34
  import {
35
35
  Action,
36
36
  ActionBar,
@@ -38,13 +38,13 @@ import {
38
38
  IconButton,
39
39
  Label,
40
40
  Separator
41
- } from "./chunk-XQHCQEAF.mjs";
42
- import "./chunk-DVZWVU66.mjs";
43
- import "./chunk-6MO3E35Y.mjs";
41
+ } from "./chunk-54LFCIWQ.mjs";
42
+ import "./chunk-HRNJ42TO.mjs";
43
+ import "./chunk-GR7NLT4T.mjs";
44
44
  import "./chunk-Y2EFNT5P.mjs";
45
45
  import {
46
46
  walkTree
47
- } from "./chunk-SHVCBQDY.mjs";
47
+ } from "./chunk-74HKFKJU.mjs";
48
48
  import {
49
49
  init_react_import
50
50
  } from "./chunk-M6W7YEVX.mjs";
package/dist/internal.js CHANGED
@@ -100,7 +100,7 @@ var walkField = ({
100
100
  config,
101
101
  recurseSlots = false
102
102
  }) => {
103
- var _a, _b, _c;
103
+ var _a, _b, _c, _d;
104
104
  const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
105
105
  const map = mappers[fieldType];
106
106
  if (map && fieldType === "slot") {
@@ -161,7 +161,9 @@ var walkField = ({
161
161
  id,
162
162
  getPropPath: (k) => `${propPath}.${k}`,
163
163
  config,
164
- recurseSlots
164
+ recurseSlots,
165
+ // Only default missing fields when objectFields describe this value
166
+ ownedFields: ((_d = fields[propKey]) == null ? void 0 : _d.type) === "object"
165
167
  });
166
168
  }
167
169
  }
@@ -174,11 +176,21 @@ var walkObject = ({
174
176
  id,
175
177
  getPropPath,
176
178
  config,
177
- recurseSlots
179
+ recurseSlots,
180
+ ownedFields
178
181
  }) => {
179
- const newProps = Object.entries(value).map(([k, v]) => {
182
+ const keys = Object.keys(value);
183
+ if (ownedFields) {
184
+ for (const fieldName in fields) {
185
+ const fieldType = fields[fieldName].type;
186
+ if (fieldType !== "slot" && mappers[fieldType] && !(fieldName in value)) {
187
+ keys.push(fieldName);
188
+ }
189
+ }
190
+ }
191
+ const newProps = keys.map((k) => {
180
192
  const opts = {
181
- value: v,
193
+ value: value[k],
182
194
  fields,
183
195
  mappers,
184
196
  propKey: k,
@@ -213,7 +225,8 @@ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlo
213
225
  id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
214
226
  getPropPath: (k) => k,
215
227
  config,
216
- recurseSlots
228
+ recurseSlots,
229
+ ownedFields: true
217
230
  });
218
231
  if (isPromise(newProps)) {
219
232
  return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
package/dist/internal.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createReducer
3
- } from "./chunk-DVZWVU66.mjs";
4
- import "./chunk-SHVCBQDY.mjs";
3
+ } from "./chunk-HRNJ42TO.mjs";
4
+ import "./chunk-74HKFKJU.mjs";
5
5
  import {
6
6
  init_react_import
7
7
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  useHeadingOptions
3
- } from "./chunk-3RQGAM3Z.mjs";
3
+ } from "./chunk-BVKXFA4V.mjs";
4
4
  import {
5
5
  Heading,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-XQHCQEAF.mjs";
9
- import "./chunk-DVZWVU66.mjs";
10
- import "./chunk-6MO3E35Y.mjs";
8
+ } from "./chunk-54LFCIWQ.mjs";
9
+ import "./chunk-HRNJ42TO.mjs";
10
+ import "./chunk-GR7NLT4T.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
- import "./chunk-SHVCBQDY.mjs";
12
+ import "./chunk-74HKFKJU.mjs";
13
13
  import {
14
14
  init_react_import
15
15
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  useAlignOptions
3
- } from "./chunk-M5GPDW62.mjs";
3
+ } from "./chunk-2AATV7NG.mjs";
4
4
  import {
5
5
  AlignLeft,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-XQHCQEAF.mjs";
9
- import "./chunk-DVZWVU66.mjs";
10
- import "./chunk-6MO3E35Y.mjs";
8
+ } from "./chunk-54LFCIWQ.mjs";
9
+ import "./chunk-HRNJ42TO.mjs";
10
+ import "./chunk-GR7NLT4T.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
- import "./chunk-SHVCBQDY.mjs";
12
+ import "./chunk-74HKFKJU.mjs";
13
13
  import {
14
14
  init_react_import
15
15
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  useListOptions
3
- } from "./chunk-XIGSFEU7.mjs";
3
+ } from "./chunk-DATOBXTJ.mjs";
4
4
  import {
5
5
  List,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-XQHCQEAF.mjs";
9
- import "./chunk-DVZWVU66.mjs";
10
- import "./chunk-6MO3E35Y.mjs";
8
+ } from "./chunk-54LFCIWQ.mjs";
9
+ import "./chunk-HRNJ42TO.mjs";
10
+ import "./chunk-GR7NLT4T.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
- import "./chunk-SHVCBQDY.mjs";
12
+ import "./chunk-74HKFKJU.mjs";
13
13
  import {
14
14
  init_react_import
15
15
  } from "./chunk-M6W7YEVX.mjs";
@@ -1438,7 +1438,8 @@ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlo
1438
1438
  id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
1439
1439
  getPropPath: (k) => k,
1440
1440
  config,
1441
- recurseSlots
1441
+ recurseSlots,
1442
+ ownedFields: true
1442
1443
  });
1443
1444
  if (isPromise(newProps)) {
1444
1445
  return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
@@ -1468,7 +1469,7 @@ var init_map_fields = __esm({
1468
1469
  config,
1469
1470
  recurseSlots = false
1470
1471
  }) => {
1471
- var _a, _b, _c;
1472
+ var _a, _b, _c, _d;
1472
1473
  const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
1473
1474
  const map = mappers[fieldType];
1474
1475
  if (map && fieldType === "slot") {
@@ -1529,7 +1530,9 @@ var init_map_fields = __esm({
1529
1530
  id,
1530
1531
  getPropPath: (k) => `${propPath}.${k}`,
1531
1532
  config,
1532
- recurseSlots
1533
+ recurseSlots,
1534
+ // Only default missing fields when objectFields describe this value
1535
+ ownedFields: ((_d = fields[propKey]) == null ? void 0 : _d.type) === "object"
1533
1536
  });
1534
1537
  }
1535
1538
  }
@@ -1542,11 +1545,21 @@ var init_map_fields = __esm({
1542
1545
  id,
1543
1546
  getPropPath,
1544
1547
  config,
1545
- recurseSlots
1548
+ recurseSlots,
1549
+ ownedFields
1546
1550
  }) => {
1547
- const newProps = Object.entries(value).map(([k, v]) => {
1551
+ const keys = Object.keys(value);
1552
+ if (ownedFields) {
1553
+ for (const fieldName in fields) {
1554
+ const fieldType = fields[fieldName].type;
1555
+ if (fieldType !== "slot" && mappers[fieldType] && !(fieldName in value)) {
1556
+ keys.push(fieldName);
1557
+ }
1558
+ }
1559
+ }
1560
+ const newProps = keys.map((k) => {
1548
1561
  const opts = {
1549
- value: v,
1562
+ value: value[k],
1550
1563
  fields,
1551
1564
  mappers,
1552
1565
  propKey: k,
@@ -3199,7 +3212,7 @@ var init_resolve_component_data = __esm({
3199
3212
  init_get_changed();
3200
3213
  import_fast_equals2 = require("fast-equals");
3201
3214
  cache = { lastChange: {} };
3202
- resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }) {
3215
+ resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }, cacheStore = cache) {
3203
3216
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
3204
3217
  const resolvedItem = __spreadValues({}, item);
3205
3218
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
@@ -3209,7 +3222,7 @@ var init_resolve_component_data = __esm({
3209
3222
  item: oldItem = null,
3210
3223
  resolved = {},
3211
3224
  parentId: oldParentId = null
3212
- } = cache.lastChange[id] || {};
3225
+ } = cacheStore.lastChange[id] || {};
3213
3226
  const isRootOrInserted = oldParentId === null;
3214
3227
  const parentChanged = !isRootOrInserted && (parent == null ? void 0 : parent.props.id) !== oldParentId;
3215
3228
  const dataChanged = item && !(0, import_fast_equals2.deepEqual)(item, oldItem);
@@ -3251,7 +3264,8 @@ var init_resolve_component_data = __esm({
3251
3264
  onResolveEnd,
3252
3265
  trigger,
3253
3266
  itemAsComponentData,
3254
- root
3267
+ root,
3268
+ cacheStore
3255
3269
  )).node;
3256
3270
  })
3257
3271
  )
@@ -3263,7 +3277,7 @@ var init_resolve_component_data = __esm({
3263
3277
  if (shouldRunResolver && onResolveEnd) {
3264
3278
  onResolveEnd(resolvedItem);
3265
3279
  }
3266
- cache.lastChange[id] = {
3280
+ cacheStore.lastChange[id] = {
3267
3281
  item,
3268
3282
  resolved: itemWithResolvedChildren,
3269
3283
  parentId: parent == null ? void 0 : parent.props.id
@@ -17565,6 +17579,7 @@ function resolveAllData(_0, _1) {
17565
17579
  return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
17566
17580
  const defaultedData = defaultData(data);
17567
17581
  const zonesByComponent = groupZonesByComponent(defaultedData);
17582
+ const cacheStore = { lastChange: {} };
17568
17583
  let resolvedZones = {};
17569
17584
  const resolveNode = (_node, parent, root) => __async(null, null, function* () {
17570
17585
  const node = toComponent(_node);
@@ -17579,7 +17594,8 @@ function resolveAllData(_0, _1) {
17579
17594
  },
17580
17595
  "force",
17581
17596
  parent,
17582
- root
17597
+ root,
17598
+ cacheStore
17583
17599
  )).node;
17584
17600
  const resolvedAsComponent = toComponent(resolved);
17585
17601
  const resolvedDeepPromise = mapFields(
@@ -17,20 +17,20 @@ import {
17
17
  setDeep,
18
18
  useGetPuck,
19
19
  usePuck
20
- } from "./chunk-ELDOSC5Y.mjs";
21
- import "./chunk-GKUX6MNS.mjs";
20
+ } from "./chunk-6PIQFZBM.mjs";
21
+ import "./chunk-VOB4L2BJ.mjs";
22
22
  import {
23
23
  migrate,
24
24
  resolveAllData,
25
25
  transformProps
26
- } from "./chunk-SSXLOL3N.mjs";
26
+ } from "./chunk-FKYOVZNF.mjs";
27
27
  import "./chunk-H635BA2V.mjs";
28
28
  import {
29
29
  RichTextMenu
30
- } from "./chunk-4US666EQ.mjs";
31
- import "./chunk-M5GPDW62.mjs";
32
- import "./chunk-3RQGAM3Z.mjs";
33
- import "./chunk-XIGSFEU7.mjs";
30
+ } from "./chunk-73XKHVBN.mjs";
31
+ import "./chunk-2AATV7NG.mjs";
32
+ import "./chunk-BVKXFA4V.mjs";
33
+ import "./chunk-DATOBXTJ.mjs";
34
34
  import {
35
35
  Action,
36
36
  ActionBar,
@@ -38,13 +38,13 @@ import {
38
38
  IconButton,
39
39
  Label,
40
40
  Separator
41
- } from "./chunk-XQHCQEAF.mjs";
42
- import "./chunk-DVZWVU66.mjs";
43
- import "./chunk-6MO3E35Y.mjs";
41
+ } from "./chunk-54LFCIWQ.mjs";
42
+ import "./chunk-HRNJ42TO.mjs";
43
+ import "./chunk-GR7NLT4T.mjs";
44
44
  import "./chunk-Y2EFNT5P.mjs";
45
45
  import {
46
46
  walkTree
47
- } from "./chunk-SHVCBQDY.mjs";
47
+ } from "./chunk-74HKFKJU.mjs";
48
48
  import {
49
49
  init_react_import
50
50
  } from "./chunk-M6W7YEVX.mjs";
package/dist/rsc.js CHANGED
@@ -420,7 +420,7 @@ var walkField = ({
420
420
  config,
421
421
  recurseSlots = false
422
422
  }) => {
423
- var _a, _b, _c;
423
+ var _a, _b, _c, _d;
424
424
  const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
425
425
  const map = mappers[fieldType];
426
426
  if (map && fieldType === "slot") {
@@ -481,7 +481,9 @@ var walkField = ({
481
481
  id,
482
482
  getPropPath: (k) => `${propPath}.${k}`,
483
483
  config,
484
- recurseSlots
484
+ recurseSlots,
485
+ // Only default missing fields when objectFields describe this value
486
+ ownedFields: ((_d = fields[propKey]) == null ? void 0 : _d.type) === "object"
485
487
  });
486
488
  }
487
489
  }
@@ -494,11 +496,21 @@ var walkObject = ({
494
496
  id,
495
497
  getPropPath,
496
498
  config,
497
- recurseSlots
499
+ recurseSlots,
500
+ ownedFields
498
501
  }) => {
499
- const newProps = Object.entries(value).map(([k, v]) => {
502
+ const keys = Object.keys(value);
503
+ if (ownedFields) {
504
+ for (const fieldName in fields) {
505
+ const fieldType = fields[fieldName].type;
506
+ if (fieldType !== "slot" && mappers[fieldType] && !(fieldName in value)) {
507
+ keys.push(fieldName);
508
+ }
509
+ }
510
+ }
511
+ const newProps = keys.map((k) => {
500
512
  const opts = {
501
- value: v,
513
+ value: value[k],
502
514
  fields,
503
515
  mappers,
504
516
  propKey: k,
@@ -533,7 +545,8 @@ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlo
533
545
  id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
534
546
  getPropPath: (k) => k,
535
547
  config,
536
- recurseSlots
548
+ recurseSlots,
549
+ ownedFields: true
537
550
  });
538
551
  if (isPromise(newProps)) {
539
552
  return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
@@ -886,7 +899,7 @@ var getChanged = (newItem, oldItem) => {
886
899
  // lib/resolve-component-data.ts
887
900
  var import_fast_equals2 = require("fast-equals");
888
901
  var cache = { lastChange: {} };
889
- var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }) {
902
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }, cacheStore = cache) {
890
903
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
891
904
  const resolvedItem = __spreadValues({}, item);
892
905
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
@@ -896,7 +909,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
896
909
  item: oldItem = null,
897
910
  resolved = {},
898
911
  parentId: oldParentId = null
899
- } = cache.lastChange[id] || {};
912
+ } = cacheStore.lastChange[id] || {};
900
913
  const isRootOrInserted = oldParentId === null;
901
914
  const parentChanged = !isRootOrInserted && (parent == null ? void 0 : parent.props.id) !== oldParentId;
902
915
  const dataChanged = item && !(0, import_fast_equals2.deepEqual)(item, oldItem);
@@ -938,7 +951,8 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
938
951
  onResolveEnd,
939
952
  trigger,
940
953
  itemAsComponentData,
941
- root
954
+ root,
955
+ cacheStore
942
956
  )).node;
943
957
  })
944
958
  )
@@ -950,7 +964,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
950
964
  if (shouldRunResolver && onResolveEnd) {
951
965
  onResolveEnd(resolvedItem);
952
966
  }
953
- cache.lastChange[id] = {
967
+ cacheStore.lastChange[id] = {
954
968
  item,
955
969
  resolved: itemWithResolvedChildren,
956
970
  parentId: parent == null ? void 0 : parent.props.id
@@ -1003,6 +1017,7 @@ function resolveAllData(_0, _1) {
1003
1017
  return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
1004
1018
  const defaultedData = defaultData(data);
1005
1019
  const zonesByComponent = groupZonesByComponent(defaultedData);
1020
+ const cacheStore = { lastChange: {} };
1006
1021
  let resolvedZones = {};
1007
1022
  const resolveNode = (_node, parent, root) => __async(null, null, function* () {
1008
1023
  const node = toComponent(_node);
@@ -1017,7 +1032,8 @@ function resolveAllData(_0, _1) {
1017
1032
  },
1018
1033
  "force",
1019
1034
  parent,
1020
- root
1035
+ root,
1036
+ cacheStore
1021
1037
  )).node;
1022
1038
  const resolvedAsComponent = toComponent(resolved);
1023
1039
  const resolvedDeepPromise = mapFields(
package/dist/rsc.mjs CHANGED
@@ -5,9 +5,9 @@ import {
5
5
  transformProps,
6
6
  useRichtextProps,
7
7
  useSlots
8
- } from "./chunk-SSXLOL3N.mjs";
8
+ } from "./chunk-FKYOVZNF.mjs";
9
9
  import "./chunk-H635BA2V.mjs";
10
- import "./chunk-6MO3E35Y.mjs";
10
+ import "./chunk-GR7NLT4T.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-SHVCBQDY.mjs";
18
+ } from "./chunk-74HKFKJU.mjs";
19
19
  import {
20
20
  __spreadProps,
21
21
  __spreadValues,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puckeditor/core",
3
- "version": "0.22.0",
3
+ "version": "0.22.1-canary.5ca963ca",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Chris Villa <chris@puckeditor.com>",
6
6
  "repository": "puckeditor/puck",
@@ -63,6 +63,9 @@
63
63
  }
64
64
  },
65
65
  "license": "MIT",
66
+ "engines": {
67
+ "node": ">=20.0.0"
68
+ },
66
69
  "scripts": {
67
70
  "lint": "eslint \"**/*.ts*\"",
68
71
  "build": "rm -rf dist && tsup bundle/index.ts bundle/rsc.tsx bundle/no-external.ts bundle/internal.ts",