@puckeditor/core 0.22.1 → 0.22.2

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-VOB4L2BJ.mjs";
7
+ } from "./chunk-PRZEIT36.mjs";
8
8
  import "./chunk-H635BA2V.mjs";
9
- import "./chunk-73XKHVBN.mjs";
10
- import "./chunk-2AATV7NG.mjs";
11
- import "./chunk-BVKXFA4V.mjs";
12
- import "./chunk-DATOBXTJ.mjs";
9
+ import "./chunk-25O24MZR.mjs";
10
+ import "./chunk-NKDMBWQC.mjs";
11
+ import "./chunk-C2H4WQP2.mjs";
12
+ import "./chunk-4I2WN43X.mjs";
13
13
  import {
14
14
  useAppStore,
15
15
  useAppStoreApi
16
- } from "./chunk-54LFCIWQ.mjs";
17
- import "./chunk-HRNJ42TO.mjs";
18
- import "./chunk-GR7NLT4T.mjs";
16
+ } from "./chunk-KJQTOPIV.mjs";
17
+ import "./chunk-25QAPMLH.mjs";
18
+ import "./chunk-WUO7D6OQ.mjs";
19
19
  import "./chunk-Y2EFNT5P.mjs";
20
- import "./chunk-74HKFKJU.mjs";
20
+ import "./chunk-QHQD3BMI.mjs";
21
21
  import {
22
22
  __spreadProps,
23
23
  __spreadValues,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  useAlignOptions
3
- } from "./chunk-2AATV7NG.mjs";
3
+ } from "./chunk-NKDMBWQC.mjs";
4
4
  import {
5
5
  useHeadingOptions
6
- } from "./chunk-BVKXFA4V.mjs";
6
+ } from "./chunk-C2H4WQP2.mjs";
7
7
  import {
8
8
  useListOptions
9
- } from "./chunk-DATOBXTJ.mjs";
9
+ } from "./chunk-4I2WN43X.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-54LFCIWQ.mjs";
31
+ } from "./chunk-KJQTOPIV.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-EFZRGV2Y.mjs").then((m) => ({
202
+ () => import("./loaded-LMF4JLYG.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-B7563MDT.mjs").then((m) => ({
433
+ () => import("./loaded-SJJPEREQ.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-HECCGJKO.mjs").then((m) => ({
465
+ () => import("./loaded-IFFZACEG.mjs").then((m) => ({
466
466
  default: m.ListSelectLoaded
467
467
  }))
468
468
  );
@@ -3,7 +3,7 @@ import {
3
3
  setupZone,
4
4
  walkAppState,
5
5
  walkTree
6
- } from "./chunk-74HKFKJU.mjs";
6
+ } from "./chunk-QHQD3BMI.mjs";
7
7
  import {
8
8
  __spreadProps,
9
9
  __spreadValues,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  List,
3
3
  ListOrdered
4
- } from "./chunk-54LFCIWQ.mjs";
4
+ } from "./chunk-KJQTOPIV.mjs";
5
5
  import {
6
6
  init_react_import
7
7
  } from "./chunk-M6W7YEVX.mjs";
@@ -5,7 +5,7 @@ import {
5
5
  Heading4,
6
6
  Heading5,
7
7
  Heading6
8
- } from "./chunk-54LFCIWQ.mjs";
8
+ } from "./chunk-KJQTOPIV.mjs";
9
9
  import {
10
10
  init_react_import
11
11
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EditorInner,
3
3
  LoadedRichTextMenu
4
- } from "./chunk-VOB4L2BJ.mjs";
4
+ } from "./chunk-PRZEIT36.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-FKYOVZNF.mjs";
13
+ } from "./chunk-JNJJ2M57.mjs";
14
14
  import {
15
15
  LoadedRichTextMenuInner
16
- } from "./chunk-73XKHVBN.mjs";
16
+ } from "./chunk-25O24MZR.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-54LFCIWQ.mjs";
71
+ } from "./chunk-KJQTOPIV.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-HRNJ42TO.mjs";
79
+ } from "./chunk-25QAPMLH.mjs";
80
80
  import {
81
81
  defaultAppState,
82
82
  defaultViewports
83
- } from "./chunk-GR7NLT4T.mjs";
83
+ } from "./chunk-WUO7D6OQ.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-74HKFKJU.mjs";
98
+ } from "./chunk-QHQD3BMI.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-MXSH3OSX.mjs").then((m) => ({
2002
+ () => import("./Editor-MLHOIEVM.mjs").then((m) => ({
2003
2003
  default: m.Editor
2004
2004
  }))
2005
2005
  );
@@ -4240,6 +4240,7 @@ var ContextSlotRender = ({
4240
4240
  init_react_import();
4241
4241
  import { useMemo as useMemo10, useRef as useRef5 } from "react";
4242
4242
  function useFieldTransformsTracked(config, item, transforms, readOnly, forceReadOnly) {
4243
+ const prevMappers = useRef5(null);
4243
4244
  const prevProps = useRef5(null);
4244
4245
  const prevResult = useRef5(item.props);
4245
4246
  const mappers = useMemo10(
@@ -4247,29 +4248,44 @@ function useFieldTransformsTracked(config, item, transforms, readOnly, forceRead
4247
4248
  [transforms, readOnly, forceReadOnly]
4248
4249
  );
4249
4250
  const transformedProps = useMemo10(() => {
4250
- var _a, _b, _c;
4251
- const changedProps = {};
4251
+ var _a, _b, _c, _d;
4252
4252
  const componentConfig = item.type === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[item.type];
4253
+ const componentFields = (_b = componentConfig == null ? void 0 : componentConfig.fields) != null ? _b : {};
4254
+ const fullRemap = prevMappers.current !== mappers;
4255
+ let changedFields;
4253
4256
  let changeIncludesSlot = false;
4254
- for (const fieldName in item.props) {
4255
- const fieldType = (_c = (_b = componentConfig == null ? void 0 : componentConfig.fields) == null ? void 0 : _b[fieldName]) == null ? void 0 : _c.type;
4256
- if (!prevProps.current || item.props[fieldName] !== prevProps.current[fieldName]) {
4257
- changedProps[fieldName] = item.props[fieldName];
4258
- if (fieldType === "slot") {
4257
+ if (!prevProps.current || fullRemap) {
4258
+ for (const fieldName in item.props) {
4259
+ if (((_c = componentFields[fieldName]) == null ? void 0 : _c.type) === "slot") {
4259
4260
  changeIncludesSlot = true;
4260
4261
  }
4261
4262
  }
4263
+ } else {
4264
+ changedFields = ["id"];
4265
+ const allFieldNames = /* @__PURE__ */ new Set([
4266
+ ...Object.keys(item.props),
4267
+ ...Object.keys(prevProps.current)
4268
+ ]);
4269
+ for (const fieldName of allFieldNames) {
4270
+ if (item.props[fieldName] !== prevProps.current[fieldName]) {
4271
+ changedFields.push(fieldName);
4272
+ if (((_d = componentFields[fieldName]) == null ? void 0 : _d.type) === "slot") {
4273
+ changeIncludesSlot = true;
4274
+ }
4275
+ }
4276
+ }
4262
4277
  }
4263
- changedProps.id = item.props.id;
4264
- prevProps.current = item.props;
4265
4278
  const mapped = mapFields(
4266
- __spreadProps(__spreadValues({}, item), { props: changedProps }),
4279
+ item,
4267
4280
  mappers,
4268
4281
  config,
4269
4282
  false,
4270
- changeIncludesSlot
4283
+ changeIncludesSlot,
4284
+ changedFields
4271
4285
  ).props;
4272
- prevResult.current = __spreadValues(__spreadValues({}, prevResult.current), mapped);
4286
+ prevProps.current = item.props;
4287
+ prevMappers.current = mappers;
4288
+ prevResult.current = changedFields ? __spreadValues(__spreadValues({}, prevResult.current), mapped) : mapped;
4273
4289
  return prevResult.current;
4274
4290
  }, [config, item, mappers]);
4275
4291
  const mergedProps = useMemo10(
@@ -4499,7 +4515,7 @@ import {
4499
4515
  } from "react";
4500
4516
  import { jsx as jsx28 } from "react/jsx-runtime";
4501
4517
  var Editor2 = lazy2(
4502
- () => import("./Editor-MXSH3OSX.mjs").then((m) => ({
4518
+ () => import("./Editor-MLHOIEVM.mjs").then((m) => ({
4503
4519
  default: m.Editor
4504
4520
  }))
4505
4521
  );
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  defaultAppState,
6
6
  resolveComponentData
7
- } from "./chunk-GR7NLT4T.mjs";
7
+ } from "./chunk-WUO7D6OQ.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-74HKFKJU.mjs";
17
+ } from "./chunk-QHQD3BMI.mjs";
18
18
  import {
19
19
  __async,
20
20
  __objRest,
@@ -3,19 +3,19 @@ import {
3
3
  generateId,
4
4
  getItem,
5
5
  makeStatePublic
6
- } from "./chunk-HRNJ42TO.mjs";
6
+ } from "./chunk-25QAPMLH.mjs";
7
7
  import {
8
8
  defaultAppState,
9
9
  defaultViewports,
10
10
  getChanged,
11
11
  resolveComponentData
12
- } from "./chunk-GR7NLT4T.mjs";
12
+ } from "./chunk-WUO7D6OQ.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-74HKFKJU.mjs";
18
+ } from "./chunk-QHQD3BMI.mjs";
19
19
  import {
20
20
  __async,
21
21
  __objRest,
@@ -3,7 +3,7 @@ import {
3
3
  AlignJustify,
4
4
  AlignLeft,
5
5
  AlignRight
6
- } from "./chunk-54LFCIWQ.mjs";
6
+ } from "./chunk-KJQTOPIV.mjs";
7
7
  import {
8
8
  init_react_import
9
9
  } from "./chunk-M6W7YEVX.mjs";
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-H635BA2V.mjs";
4
4
  import {
5
5
  LoadedRichTextMenuInner
6
- } from "./chunk-73XKHVBN.mjs";
6
+ } from "./chunk-25O24MZR.mjs";
7
7
  import {
8
8
  useAppStore,
9
9
  useAppStoreApi
10
- } from "./chunk-54LFCIWQ.mjs";
10
+ } from "./chunk-KJQTOPIV.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-7JVAMOPS.mjs").then((m) => ({
103
+ () => import("./full-YXSOFDYM.mjs").then((m) => ({
104
104
  default: m.LoadedRichTextMenuFull
105
105
  }))
106
106
  );
@@ -108,10 +108,11 @@ var walkObject = ({
108
108
  getPropPath,
109
109
  config,
110
110
  recurseSlots,
111
- ownedFields
111
+ ownedFields,
112
+ keysToWalk: providedKeys
112
113
  }) => {
113
- const keys = Object.keys(value);
114
- if (ownedFields) {
114
+ const keys = providedKeys != null ? providedKeys : Object.keys(value);
115
+ if (!providedKeys && ownedFields) {
115
116
  for (const fieldName in fields) {
116
117
  const fieldType = fields[fieldName].type;
117
118
  if (fieldType !== "slot" && mappers[fieldType] && !(fieldName in value)) {
@@ -145,7 +146,7 @@ var walkObject = ({
145
146
  }
146
147
  return flatten(newProps);
147
148
  };
148
- function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true) {
149
+ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true, fieldsToMap) {
149
150
  var _a, _b, _c, _d, _e;
150
151
  const itemType = "type" in item ? item.type : "root";
151
152
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
@@ -157,7 +158,8 @@ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlo
157
158
  getPropPath: (k) => k,
158
159
  config,
159
160
  recurseSlots,
160
- ownedFields: true
161
+ ownedFields: true,
162
+ keysToWalk: fieldsToMap
161
163
  });
162
164
  if (isPromise(newProps)) {
163
165
  return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  mapFields,
3
3
  toComponent
4
- } from "./chunk-74HKFKJU.mjs";
4
+ } from "./chunk-QHQD3BMI.mjs";
5
5
  import {
6
6
  __async,
7
7
  __spreadProps,
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  LoadedRichTextMenuInner
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";
3
+ } from "./chunk-25O24MZR.mjs";
4
+ import "./chunk-NKDMBWQC.mjs";
5
+ import "./chunk-C2H4WQP2.mjs";
6
+ import "./chunk-4I2WN43X.mjs";
7
+ import "./chunk-KJQTOPIV.mjs";
8
+ import "./chunk-25QAPMLH.mjs";
9
+ import "./chunk-WUO7D6OQ.mjs";
10
10
  import "./chunk-Y2EFNT5P.mjs";
11
- import "./chunk-74HKFKJU.mjs";
11
+ import "./chunk-QHQD3BMI.mjs";
12
12
  import {
13
13
  __spreadValues,
14
14
  init_react_import
package/dist/index.js CHANGED
@@ -1427,7 +1427,7 @@ var init_default_slots = __esm({
1427
1427
  });
1428
1428
 
1429
1429
  // lib/data/map-fields.ts
1430
- function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true) {
1430
+ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true, fieldsToMap) {
1431
1431
  var _a, _b, _c, _d, _e;
1432
1432
  const itemType = "type" in item ? item.type : "root";
1433
1433
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
@@ -1439,7 +1439,8 @@ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlo
1439
1439
  getPropPath: (k) => k,
1440
1440
  config,
1441
1441
  recurseSlots,
1442
- ownedFields: true
1442
+ ownedFields: true,
1443
+ keysToWalk: fieldsToMap
1443
1444
  });
1444
1445
  if (isPromise(newProps)) {
1445
1446
  return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
@@ -1546,10 +1547,11 @@ var init_map_fields = __esm({
1546
1547
  getPropPath,
1547
1548
  config,
1548
1549
  recurseSlots,
1549
- ownedFields
1550
+ ownedFields,
1551
+ keysToWalk: providedKeys
1550
1552
  }) => {
1551
- const keys = Object.keys(value);
1552
- if (ownedFields) {
1553
+ const keys = providedKeys != null ? providedKeys : Object.keys(value);
1554
+ if (!providedKeys && ownedFields) {
1553
1555
  for (const fieldName in fields) {
1554
1556
  const fieldType = fields[fieldName].type;
1555
1557
  if (fieldType !== "slot" && mappers[fieldType] && !(fieldName in value)) {
@@ -9235,6 +9237,7 @@ init_react_import();
9235
9237
  var import_react63 = require("react");
9236
9238
  init_map_fields();
9237
9239
  function useFieldTransformsTracked(config, item, transforms, readOnly, forceReadOnly) {
9240
+ const prevMappers = (0, import_react63.useRef)(null);
9238
9241
  const prevProps = (0, import_react63.useRef)(null);
9239
9242
  const prevResult = (0, import_react63.useRef)(item.props);
9240
9243
  const mappers = (0, import_react63.useMemo)(
@@ -9242,29 +9245,44 @@ function useFieldTransformsTracked(config, item, transforms, readOnly, forceRead
9242
9245
  [transforms, readOnly, forceReadOnly]
9243
9246
  );
9244
9247
  const transformedProps = (0, import_react63.useMemo)(() => {
9245
- var _a, _b, _c;
9246
- const changedProps = {};
9248
+ var _a, _b, _c, _d;
9247
9249
  const componentConfig = item.type === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[item.type];
9250
+ const componentFields = (_b = componentConfig == null ? void 0 : componentConfig.fields) != null ? _b : {};
9251
+ const fullRemap = prevMappers.current !== mappers;
9252
+ let changedFields;
9248
9253
  let changeIncludesSlot = false;
9249
- for (const fieldName in item.props) {
9250
- const fieldType = (_c = (_b = componentConfig == null ? void 0 : componentConfig.fields) == null ? void 0 : _b[fieldName]) == null ? void 0 : _c.type;
9251
- if (!prevProps.current || item.props[fieldName] !== prevProps.current[fieldName]) {
9252
- changedProps[fieldName] = item.props[fieldName];
9253
- if (fieldType === "slot") {
9254
+ if (!prevProps.current || fullRemap) {
9255
+ for (const fieldName in item.props) {
9256
+ if (((_c = componentFields[fieldName]) == null ? void 0 : _c.type) === "slot") {
9254
9257
  changeIncludesSlot = true;
9255
9258
  }
9256
9259
  }
9260
+ } else {
9261
+ changedFields = ["id"];
9262
+ const allFieldNames = /* @__PURE__ */ new Set([
9263
+ ...Object.keys(item.props),
9264
+ ...Object.keys(prevProps.current)
9265
+ ]);
9266
+ for (const fieldName of allFieldNames) {
9267
+ if (item.props[fieldName] !== prevProps.current[fieldName]) {
9268
+ changedFields.push(fieldName);
9269
+ if (((_d = componentFields[fieldName]) == null ? void 0 : _d.type) === "slot") {
9270
+ changeIncludesSlot = true;
9271
+ }
9272
+ }
9273
+ }
9257
9274
  }
9258
- changedProps.id = item.props.id;
9259
- prevProps.current = item.props;
9260
9275
  const mapped = mapFields(
9261
- __spreadProps(__spreadValues({}, item), { props: changedProps }),
9276
+ item,
9262
9277
  mappers,
9263
9278
  config,
9264
9279
  false,
9265
- changeIncludesSlot
9280
+ changeIncludesSlot,
9281
+ changedFields
9266
9282
  ).props;
9267
- prevResult.current = __spreadValues(__spreadValues({}, prevResult.current), mapped);
9283
+ prevProps.current = item.props;
9284
+ prevMappers.current = mappers;
9285
+ prevResult.current = changedFields ? __spreadValues(__spreadValues({}, prevResult.current), mapped) : mapped;
9268
9286
  return prevResult.current;
9269
9287
  }, [config, item, mappers]);
9270
9288
  const mergedProps = (0, import_react63.useMemo)(
package/dist/index.mjs CHANGED
@@ -17,20 +17,20 @@ import {
17
17
  setDeep,
18
18
  useGetPuck,
19
19
  usePuck
20
- } from "./chunk-6PIQFZBM.mjs";
21
- import "./chunk-VOB4L2BJ.mjs";
20
+ } from "./chunk-CGHMSBNM.mjs";
21
+ import "./chunk-PRZEIT36.mjs";
22
22
  import {
23
23
  migrate,
24
24
  resolveAllData,
25
25
  transformProps
26
- } from "./chunk-FKYOVZNF.mjs";
26
+ } from "./chunk-JNJJ2M57.mjs";
27
27
  import "./chunk-H635BA2V.mjs";
28
28
  import {
29
29
  RichTextMenu
30
- } from "./chunk-73XKHVBN.mjs";
31
- import "./chunk-2AATV7NG.mjs";
32
- import "./chunk-BVKXFA4V.mjs";
33
- import "./chunk-DATOBXTJ.mjs";
30
+ } from "./chunk-25O24MZR.mjs";
31
+ import "./chunk-NKDMBWQC.mjs";
32
+ import "./chunk-C2H4WQP2.mjs";
33
+ import "./chunk-4I2WN43X.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-54LFCIWQ.mjs";
42
- import "./chunk-HRNJ42TO.mjs";
43
- import "./chunk-GR7NLT4T.mjs";
41
+ } from "./chunk-KJQTOPIV.mjs";
42
+ import "./chunk-25QAPMLH.mjs";
43
+ import "./chunk-WUO7D6OQ.mjs";
44
44
  import "./chunk-Y2EFNT5P.mjs";
45
45
  import {
46
46
  walkTree
47
- } from "./chunk-74HKFKJU.mjs";
47
+ } from "./chunk-QHQD3BMI.mjs";
48
48
  import {
49
49
  init_react_import
50
50
  } from "./chunk-M6W7YEVX.mjs";
package/dist/internal.js CHANGED
@@ -177,10 +177,11 @@ var walkObject = ({
177
177
  getPropPath,
178
178
  config,
179
179
  recurseSlots,
180
- ownedFields
180
+ ownedFields,
181
+ keysToWalk: providedKeys
181
182
  }) => {
182
- const keys = Object.keys(value);
183
- if (ownedFields) {
183
+ const keys = providedKeys != null ? providedKeys : Object.keys(value);
184
+ if (!providedKeys && ownedFields) {
184
185
  for (const fieldName in fields) {
185
186
  const fieldType = fields[fieldName].type;
186
187
  if (fieldType !== "slot" && mappers[fieldType] && !(fieldName in value)) {
@@ -214,7 +215,7 @@ var walkObject = ({
214
215
  }
215
216
  return flatten(newProps);
216
217
  };
217
- function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true) {
218
+ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true, fieldsToMap) {
218
219
  var _a, _b, _c, _d, _e;
219
220
  const itemType = "type" in item ? item.type : "root";
220
221
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
@@ -226,7 +227,8 @@ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlo
226
227
  getPropPath: (k) => k,
227
228
  config,
228
229
  recurseSlots,
229
- ownedFields: true
230
+ ownedFields: true,
231
+ keysToWalk: fieldsToMap
230
232
  });
231
233
  if (isPromise(newProps)) {
232
234
  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-HRNJ42TO.mjs";
4
- import "./chunk-74HKFKJU.mjs";
3
+ } from "./chunk-25QAPMLH.mjs";
4
+ import "./chunk-QHQD3BMI.mjs";
5
5
  import {
6
6
  init_react_import
7
7
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  useListOptions
3
- } from "./chunk-DATOBXTJ.mjs";
3
+ } from "./chunk-4I2WN43X.mjs";
4
4
  import {
5
5
  List,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-54LFCIWQ.mjs";
9
- import "./chunk-HRNJ42TO.mjs";
10
- import "./chunk-GR7NLT4T.mjs";
8
+ } from "./chunk-KJQTOPIV.mjs";
9
+ import "./chunk-25QAPMLH.mjs";
10
+ import "./chunk-WUO7D6OQ.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
- import "./chunk-74HKFKJU.mjs";
12
+ import "./chunk-QHQD3BMI.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-2AATV7NG.mjs";
3
+ } from "./chunk-NKDMBWQC.mjs";
4
4
  import {
5
5
  AlignLeft,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-54LFCIWQ.mjs";
9
- import "./chunk-HRNJ42TO.mjs";
10
- import "./chunk-GR7NLT4T.mjs";
8
+ } from "./chunk-KJQTOPIV.mjs";
9
+ import "./chunk-25QAPMLH.mjs";
10
+ import "./chunk-WUO7D6OQ.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
- import "./chunk-74HKFKJU.mjs";
12
+ import "./chunk-QHQD3BMI.mjs";
13
13
  import {
14
14
  init_react_import
15
15
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  useHeadingOptions
3
- } from "./chunk-BVKXFA4V.mjs";
3
+ } from "./chunk-C2H4WQP2.mjs";
4
4
  import {
5
5
  Heading,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-54LFCIWQ.mjs";
9
- import "./chunk-HRNJ42TO.mjs";
10
- import "./chunk-GR7NLT4T.mjs";
8
+ } from "./chunk-KJQTOPIV.mjs";
9
+ import "./chunk-25QAPMLH.mjs";
10
+ import "./chunk-WUO7D6OQ.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
- import "./chunk-74HKFKJU.mjs";
12
+ import "./chunk-QHQD3BMI.mjs";
13
13
  import {
14
14
  init_react_import
15
15
  } from "./chunk-M6W7YEVX.mjs";
@@ -1427,7 +1427,7 @@ var init_default_slots = __esm({
1427
1427
  });
1428
1428
 
1429
1429
  // lib/data/map-fields.ts
1430
- function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true) {
1430
+ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true, fieldsToMap) {
1431
1431
  var _a, _b, _c, _d, _e;
1432
1432
  const itemType = "type" in item ? item.type : "root";
1433
1433
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
@@ -1439,7 +1439,8 @@ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlo
1439
1439
  getPropPath: (k) => k,
1440
1440
  config,
1441
1441
  recurseSlots,
1442
- ownedFields: true
1442
+ ownedFields: true,
1443
+ keysToWalk: fieldsToMap
1443
1444
  });
1444
1445
  if (isPromise(newProps)) {
1445
1446
  return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
@@ -1546,10 +1547,11 @@ var init_map_fields = __esm({
1546
1547
  getPropPath,
1547
1548
  config,
1548
1549
  recurseSlots,
1549
- ownedFields
1550
+ ownedFields,
1551
+ keysToWalk: providedKeys
1550
1552
  }) => {
1551
- const keys = Object.keys(value);
1552
- if (ownedFields) {
1553
+ const keys = providedKeys != null ? providedKeys : Object.keys(value);
1554
+ if (!providedKeys && ownedFields) {
1553
1555
  for (const fieldName in fields) {
1554
1556
  const fieldType = fields[fieldName].type;
1555
1557
  if (fieldType !== "slot" && mappers[fieldType] && !(fieldName in value)) {
@@ -9235,6 +9237,7 @@ init_react_import();
9235
9237
  var import_react63 = require("react");
9236
9238
  init_map_fields();
9237
9239
  function useFieldTransformsTracked(config, item, transforms, readOnly, forceReadOnly) {
9240
+ const prevMappers = (0, import_react63.useRef)(null);
9238
9241
  const prevProps = (0, import_react63.useRef)(null);
9239
9242
  const prevResult = (0, import_react63.useRef)(item.props);
9240
9243
  const mappers = (0, import_react63.useMemo)(
@@ -9242,29 +9245,44 @@ function useFieldTransformsTracked(config, item, transforms, readOnly, forceRead
9242
9245
  [transforms, readOnly, forceReadOnly]
9243
9246
  );
9244
9247
  const transformedProps = (0, import_react63.useMemo)(() => {
9245
- var _a, _b, _c;
9246
- const changedProps = {};
9248
+ var _a, _b, _c, _d;
9247
9249
  const componentConfig = item.type === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[item.type];
9250
+ const componentFields = (_b = componentConfig == null ? void 0 : componentConfig.fields) != null ? _b : {};
9251
+ const fullRemap = prevMappers.current !== mappers;
9252
+ let changedFields;
9248
9253
  let changeIncludesSlot = false;
9249
- for (const fieldName in item.props) {
9250
- const fieldType = (_c = (_b = componentConfig == null ? void 0 : componentConfig.fields) == null ? void 0 : _b[fieldName]) == null ? void 0 : _c.type;
9251
- if (!prevProps.current || item.props[fieldName] !== prevProps.current[fieldName]) {
9252
- changedProps[fieldName] = item.props[fieldName];
9253
- if (fieldType === "slot") {
9254
+ if (!prevProps.current || fullRemap) {
9255
+ for (const fieldName in item.props) {
9256
+ if (((_c = componentFields[fieldName]) == null ? void 0 : _c.type) === "slot") {
9254
9257
  changeIncludesSlot = true;
9255
9258
  }
9256
9259
  }
9260
+ } else {
9261
+ changedFields = ["id"];
9262
+ const allFieldNames = /* @__PURE__ */ new Set([
9263
+ ...Object.keys(item.props),
9264
+ ...Object.keys(prevProps.current)
9265
+ ]);
9266
+ for (const fieldName of allFieldNames) {
9267
+ if (item.props[fieldName] !== prevProps.current[fieldName]) {
9268
+ changedFields.push(fieldName);
9269
+ if (((_d = componentFields[fieldName]) == null ? void 0 : _d.type) === "slot") {
9270
+ changeIncludesSlot = true;
9271
+ }
9272
+ }
9273
+ }
9257
9274
  }
9258
- changedProps.id = item.props.id;
9259
- prevProps.current = item.props;
9260
9275
  const mapped = mapFields(
9261
- __spreadProps(__spreadValues({}, item), { props: changedProps }),
9276
+ item,
9262
9277
  mappers,
9263
9278
  config,
9264
9279
  false,
9265
- changeIncludesSlot
9280
+ changeIncludesSlot,
9281
+ changedFields
9266
9282
  ).props;
9267
- prevResult.current = __spreadValues(__spreadValues({}, prevResult.current), mapped);
9283
+ prevProps.current = item.props;
9284
+ prevMappers.current = mappers;
9285
+ prevResult.current = changedFields ? __spreadValues(__spreadValues({}, prevResult.current), mapped) : mapped;
9268
9286
  return prevResult.current;
9269
9287
  }, [config, item, mappers]);
9270
9288
  const mergedProps = (0, import_react63.useMemo)(
@@ -17,20 +17,20 @@ import {
17
17
  setDeep,
18
18
  useGetPuck,
19
19
  usePuck
20
- } from "./chunk-6PIQFZBM.mjs";
21
- import "./chunk-VOB4L2BJ.mjs";
20
+ } from "./chunk-CGHMSBNM.mjs";
21
+ import "./chunk-PRZEIT36.mjs";
22
22
  import {
23
23
  migrate,
24
24
  resolveAllData,
25
25
  transformProps
26
- } from "./chunk-FKYOVZNF.mjs";
26
+ } from "./chunk-JNJJ2M57.mjs";
27
27
  import "./chunk-H635BA2V.mjs";
28
28
  import {
29
29
  RichTextMenu
30
- } from "./chunk-73XKHVBN.mjs";
31
- import "./chunk-2AATV7NG.mjs";
32
- import "./chunk-BVKXFA4V.mjs";
33
- import "./chunk-DATOBXTJ.mjs";
30
+ } from "./chunk-25O24MZR.mjs";
31
+ import "./chunk-NKDMBWQC.mjs";
32
+ import "./chunk-C2H4WQP2.mjs";
33
+ import "./chunk-4I2WN43X.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-54LFCIWQ.mjs";
42
- import "./chunk-HRNJ42TO.mjs";
43
- import "./chunk-GR7NLT4T.mjs";
41
+ } from "./chunk-KJQTOPIV.mjs";
42
+ import "./chunk-25QAPMLH.mjs";
43
+ import "./chunk-WUO7D6OQ.mjs";
44
44
  import "./chunk-Y2EFNT5P.mjs";
45
45
  import {
46
46
  walkTree
47
- } from "./chunk-74HKFKJU.mjs";
47
+ } from "./chunk-QHQD3BMI.mjs";
48
48
  import {
49
49
  init_react_import
50
50
  } from "./chunk-M6W7YEVX.mjs";
package/dist/rsc.js CHANGED
@@ -497,10 +497,11 @@ var walkObject = ({
497
497
  getPropPath,
498
498
  config,
499
499
  recurseSlots,
500
- ownedFields
500
+ ownedFields,
501
+ keysToWalk: providedKeys
501
502
  }) => {
502
- const keys = Object.keys(value);
503
- if (ownedFields) {
503
+ const keys = providedKeys != null ? providedKeys : Object.keys(value);
504
+ if (!providedKeys && ownedFields) {
504
505
  for (const fieldName in fields) {
505
506
  const fieldType = fields[fieldName].type;
506
507
  if (fieldType !== "slot" && mappers[fieldType] && !(fieldName in value)) {
@@ -534,7 +535,7 @@ var walkObject = ({
534
535
  }
535
536
  return flatten(newProps);
536
537
  };
537
- function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true) {
538
+ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true, fieldsToMap) {
538
539
  var _a, _b, _c, _d, _e;
539
540
  const itemType = "type" in item ? item.type : "root";
540
541
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
@@ -546,7 +547,8 @@ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlo
546
547
  getPropPath: (k) => k,
547
548
  config,
548
549
  recurseSlots,
549
- ownedFields: true
550
+ ownedFields: true,
551
+ keysToWalk: fieldsToMap
550
552
  });
551
553
  if (isPromise(newProps)) {
552
554
  return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
package/dist/rsc.mjs CHANGED
@@ -5,9 +5,9 @@ import {
5
5
  transformProps,
6
6
  useRichtextProps,
7
7
  useSlots
8
- } from "./chunk-FKYOVZNF.mjs";
8
+ } from "./chunk-JNJJ2M57.mjs";
9
9
  import "./chunk-H635BA2V.mjs";
10
- import "./chunk-GR7NLT4T.mjs";
10
+ import "./chunk-WUO7D6OQ.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-74HKFKJU.mjs";
18
+ } from "./chunk-QHQD3BMI.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.1",
3
+ "version": "0.22.2",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Chris Villa <chris@puckeditor.com>",
6
6
  "repository": "puckeditor/puck",