@puckeditor/core 0.23.0-canary.7ca16bcb → 0.23.0-canary.9bf3e00a

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-WABMBXFK.mjs";
7
+ } from "./chunk-BMRBP3ET.mjs";
8
8
  import "./chunk-H635BA2V.mjs";
9
- import "./chunk-OI2LQGRV.mjs";
10
- import "./chunk-G3YMTKUD.mjs";
11
- import "./chunk-X4NMPUXH.mjs";
12
- import "./chunk-EQADD6J2.mjs";
9
+ import "./chunk-WQV7W7OC.mjs";
10
+ import "./chunk-EYJW64M2.mjs";
11
+ import "./chunk-MU6IPW26.mjs";
12
+ import "./chunk-HB4CVO3I.mjs";
13
13
  import {
14
14
  useAppStore,
15
15
  useAppStoreApi
16
- } from "./chunk-2KHLVDRT.mjs";
17
- import "./chunk-HRNJ42TO.mjs";
18
- import "./chunk-GR7NLT4T.mjs";
16
+ } from "./chunk-JHNG6XYK.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,
@@ -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,
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-H635BA2V.mjs";
4
4
  import {
5
5
  LoadedRichTextMenuInner
6
- } from "./chunk-OI2LQGRV.mjs";
6
+ } from "./chunk-WQV7W7OC.mjs";
7
7
  import {
8
8
  useAppStore,
9
9
  useAppStoreApi
10
- } from "./chunk-2KHLVDRT.mjs";
10
+ } from "./chunk-JHNG6XYK.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-GSJGH3OO.mjs").then((m) => ({
103
+ () => import("./full-7ONH7UPJ.mjs").then((m) => ({
104
104
  default: m.LoadedRichTextMenuFull
105
105
  }))
106
106
  );
@@ -4,7 +4,7 @@ import {
4
4
  AlignLeft,
5
5
  AlignRight,
6
6
  useMessage
7
- } from "./chunk-2KHLVDRT.mjs";
7
+ } from "./chunk-JHNG6XYK.mjs";
8
8
  import {
9
9
  init_react_import
10
10
  } from "./chunk-M6W7YEVX.mjs";
@@ -2,7 +2,7 @@ import {
2
2
  List,
3
3
  ListOrdered,
4
4
  useMessage
5
- } from "./chunk-2KHLVDRT.mjs";
5
+ } from "./chunk-JHNG6XYK.mjs";
6
6
  import {
7
7
  init_react_import
8
8
  } from "./chunk-M6W7YEVX.mjs";
@@ -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,
@@ -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,
@@ -6,7 +6,7 @@ import {
6
6
  Heading5,
7
7
  Heading6,
8
8
  useMessage
9
- } from "./chunk-2KHLVDRT.mjs";
9
+ } from "./chunk-JHNG6XYK.mjs";
10
10
  import {
11
11
  init_react_import
12
12
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EditorInner,
3
3
  LoadedRichTextMenu
4
- } from "./chunk-WABMBXFK.mjs";
4
+ } from "./chunk-BMRBP3ET.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-OI2LQGRV.mjs";
16
+ } from "./chunk-WQV7W7OC.mjs";
17
17
  import {
18
18
  ActionBar,
19
19
  ChevronDown,
@@ -69,7 +69,7 @@ import {
69
69
  useRegisterHistorySlice,
70
70
  useRegisterPermissionsSlice,
71
71
  useResetAutoZoom
72
- } from "./chunk-2KHLVDRT.mjs";
72
+ } from "./chunk-JHNG6XYK.mjs";
73
73
  import {
74
74
  generateId,
75
75
  getItem,
@@ -77,11 +77,11 @@ import {
77
77
  insertAction,
78
78
  makeStatePublic,
79
79
  populateIds
80
- } from "./chunk-HRNJ42TO.mjs";
80
+ } from "./chunk-25QAPMLH.mjs";
81
81
  import {
82
82
  defaultAppState,
83
83
  defaultViewports
84
- } from "./chunk-GR7NLT4T.mjs";
84
+ } from "./chunk-WUO7D6OQ.mjs";
85
85
  import {
86
86
  get_class_name_factory_default
87
87
  } from "./chunk-Y2EFNT5P.mjs";
@@ -96,7 +96,7 @@ import {
96
96
  toComponent,
97
97
  walkAppState,
98
98
  walkField
99
- } from "./chunk-74HKFKJU.mjs";
99
+ } from "./chunk-QHQD3BMI.mjs";
100
100
  import {
101
101
  __async,
102
102
  __objRest,
@@ -2012,7 +2012,7 @@ EditorFallback.displayName = "EditorFallback";
2012
2012
  // components/AutoField/fields/RichtextField/index.tsx
2013
2013
  import { Fragment as Fragment5, jsx as jsx18 } from "react/jsx-runtime";
2014
2014
  var Editor = lazy(
2015
- () => import("./Editor-V2RQPQAL.mjs").then((m) => ({
2015
+ () => import("./Editor-BJP5AFD5.mjs").then((m) => ({
2016
2016
  default: m.Editor
2017
2017
  }))
2018
2018
  );
@@ -4263,6 +4263,7 @@ var ContextSlotRender = ({
4263
4263
  init_react_import();
4264
4264
  import { useMemo as useMemo10, useRef as useRef5 } from "react";
4265
4265
  function useFieldTransformsTracked(config, item, transforms, readOnly, forceReadOnly) {
4266
+ const prevMappers = useRef5(null);
4266
4267
  const prevProps = useRef5(null);
4267
4268
  const prevResult = useRef5(item.props);
4268
4269
  const mappers = useMemo10(
@@ -4270,29 +4271,44 @@ function useFieldTransformsTracked(config, item, transforms, readOnly, forceRead
4270
4271
  [transforms, readOnly, forceReadOnly]
4271
4272
  );
4272
4273
  const transformedProps = useMemo10(() => {
4273
- var _a, _b, _c;
4274
- const changedProps = {};
4274
+ var _a, _b, _c, _d;
4275
4275
  const componentConfig = item.type === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[item.type];
4276
+ const componentFields = (_b = componentConfig == null ? void 0 : componentConfig.fields) != null ? _b : {};
4277
+ const fullRemap = prevMappers.current !== mappers;
4278
+ let changedFields;
4276
4279
  let changeIncludesSlot = false;
4277
- for (const fieldName in item.props) {
4278
- const fieldType = (_c = (_b = componentConfig == null ? void 0 : componentConfig.fields) == null ? void 0 : _b[fieldName]) == null ? void 0 : _c.type;
4279
- if (!prevProps.current || item.props[fieldName] !== prevProps.current[fieldName]) {
4280
- changedProps[fieldName] = item.props[fieldName];
4281
- if (fieldType === "slot") {
4280
+ if (!prevProps.current || fullRemap) {
4281
+ for (const fieldName in item.props) {
4282
+ if (((_c = componentFields[fieldName]) == null ? void 0 : _c.type) === "slot") {
4282
4283
  changeIncludesSlot = true;
4283
4284
  }
4284
4285
  }
4286
+ } else {
4287
+ changedFields = ["id"];
4288
+ const allFieldNames = /* @__PURE__ */ new Set([
4289
+ ...Object.keys(item.props),
4290
+ ...Object.keys(prevProps.current)
4291
+ ]);
4292
+ for (const fieldName of allFieldNames) {
4293
+ if (item.props[fieldName] !== prevProps.current[fieldName]) {
4294
+ changedFields.push(fieldName);
4295
+ if (((_d = componentFields[fieldName]) == null ? void 0 : _d.type) === "slot") {
4296
+ changeIncludesSlot = true;
4297
+ }
4298
+ }
4299
+ }
4285
4300
  }
4286
- changedProps.id = item.props.id;
4287
- prevProps.current = item.props;
4288
4301
  const mapped = mapFields(
4289
- __spreadProps(__spreadValues({}, item), { props: changedProps }),
4302
+ item,
4290
4303
  mappers,
4291
4304
  config,
4292
4305
  false,
4293
- changeIncludesSlot
4306
+ changeIncludesSlot,
4307
+ changedFields
4294
4308
  ).props;
4295
- prevResult.current = __spreadValues(__spreadValues({}, prevResult.current), mapped);
4309
+ prevProps.current = item.props;
4310
+ prevMappers.current = mappers;
4311
+ prevResult.current = changedFields ? __spreadValues(__spreadValues({}, prevResult.current), mapped) : mapped;
4296
4312
  return prevResult.current;
4297
4313
  }, [config, item, mappers]);
4298
4314
  const mergedProps = useMemo10(
@@ -4522,7 +4538,7 @@ import {
4522
4538
  } from "react";
4523
4539
  import { jsx as jsx28 } from "react/jsx-runtime";
4524
4540
  var Editor2 = lazy2(
4525
- () => import("./Editor-V2RQPQAL.mjs").then((m) => ({
4541
+ () => import("./Editor-BJP5AFD5.mjs").then((m) => ({
4526
4542
  default: m.Editor
4527
4543
  }))
4528
4544
  );
@@ -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,12 +1,12 @@
1
1
  import {
2
2
  useAlignOptions
3
- } from "./chunk-G3YMTKUD.mjs";
3
+ } from "./chunk-EYJW64M2.mjs";
4
4
  import {
5
5
  useHeadingOptions
6
- } from "./chunk-X4NMPUXH.mjs";
6
+ } from "./chunk-MU6IPW26.mjs";
7
7
  import {
8
8
  useListOptions
9
- } from "./chunk-EQADD6J2.mjs";
9
+ } from "./chunk-HB4CVO3I.mjs";
10
10
  import {
11
11
  Action,
12
12
  AlignCenter,
@@ -29,7 +29,7 @@ import {
29
29
  Underline,
30
30
  useControlContext,
31
31
  useMessage
32
- } from "./chunk-2KHLVDRT.mjs";
32
+ } from "./chunk-JHNG6XYK.mjs";
33
33
  import {
34
34
  get_class_name_factory_default
35
35
  } from "./chunk-Y2EFNT5P.mjs";
@@ -204,7 +204,7 @@ function AlignSelectFallback() {
204
204
  // components/RichTextMenu/controls/AlignSelect/index.tsx
205
205
  import { jsx as jsx7 } from "react/jsx-runtime";
206
206
  var AlignSelectLoaded = lazy(
207
- () => import("./loaded-A7IXFU7M.mjs").then((m) => ({
207
+ () => import("./loaded-PF5Y4VWH.mjs").then((m) => ({
208
208
  default: m.AlignSelectLoaded
209
209
  }))
210
210
  );
@@ -445,7 +445,7 @@ function HeadingSelectFallback() {
445
445
  // components/RichTextMenu/controls/HeadingSelect/index.tsx
446
446
  import { jsx as jsx19 } from "react/jsx-runtime";
447
447
  var HeadingSelectLoaded = lazy2(
448
- () => import("./loaded-7EVGM4NA.mjs").then((m) => ({
448
+ () => import("./loaded-6YDNF4HS.mjs").then((m) => ({
449
449
  default: m.HeadingSelectLoaded
450
450
  }))
451
451
  );
@@ -477,7 +477,7 @@ function ListSelectFallback() {
477
477
  // components/RichTextMenu/controls/ListSelect/index.tsx
478
478
  import { jsx as jsx21 } from "react/jsx-runtime";
479
479
  var ListSelectLoaded = lazy3(
480
- () => import("./loaded-QAIOZVXW.mjs").then((m) => ({
480
+ () => import("./loaded-35D7XAOE.mjs").then((m) => ({
481
481
  default: m.ListSelectLoaded
482
482
  }))
483
483
  );
@@ -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-OI2LQGRV.mjs";
4
- import "./chunk-G3YMTKUD.mjs";
5
- import "./chunk-X4NMPUXH.mjs";
6
- import "./chunk-EQADD6J2.mjs";
7
- import "./chunk-2KHLVDRT.mjs";
8
- import "./chunk-HRNJ42TO.mjs";
9
- import "./chunk-GR7NLT4T.mjs";
3
+ } from "./chunk-WQV7W7OC.mjs";
4
+ import "./chunk-EYJW64M2.mjs";
5
+ import "./chunk-MU6IPW26.mjs";
6
+ import "./chunk-HB4CVO3I.mjs";
7
+ import "./chunk-JHNG6XYK.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)) {
@@ -9451,6 +9453,7 @@ init_react_import();
9451
9453
  var import_react63 = require("react");
9452
9454
  init_map_fields();
9453
9455
  function useFieldTransformsTracked(config, item, transforms, readOnly, forceReadOnly) {
9456
+ const prevMappers = (0, import_react63.useRef)(null);
9454
9457
  const prevProps = (0, import_react63.useRef)(null);
9455
9458
  const prevResult = (0, import_react63.useRef)(item.props);
9456
9459
  const mappers = (0, import_react63.useMemo)(
@@ -9458,29 +9461,44 @@ function useFieldTransformsTracked(config, item, transforms, readOnly, forceRead
9458
9461
  [transforms, readOnly, forceReadOnly]
9459
9462
  );
9460
9463
  const transformedProps = (0, import_react63.useMemo)(() => {
9461
- var _a, _b, _c;
9462
- const changedProps = {};
9464
+ var _a, _b, _c, _d;
9463
9465
  const componentConfig = item.type === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[item.type];
9466
+ const componentFields = (_b = componentConfig == null ? void 0 : componentConfig.fields) != null ? _b : {};
9467
+ const fullRemap = prevMappers.current !== mappers;
9468
+ let changedFields;
9464
9469
  let changeIncludesSlot = false;
9465
- for (const fieldName in item.props) {
9466
- const fieldType = (_c = (_b = componentConfig == null ? void 0 : componentConfig.fields) == null ? void 0 : _b[fieldName]) == null ? void 0 : _c.type;
9467
- if (!prevProps.current || item.props[fieldName] !== prevProps.current[fieldName]) {
9468
- changedProps[fieldName] = item.props[fieldName];
9469
- if (fieldType === "slot") {
9470
+ if (!prevProps.current || fullRemap) {
9471
+ for (const fieldName in item.props) {
9472
+ if (((_c = componentFields[fieldName]) == null ? void 0 : _c.type) === "slot") {
9470
9473
  changeIncludesSlot = true;
9471
9474
  }
9472
9475
  }
9476
+ } else {
9477
+ changedFields = ["id"];
9478
+ const allFieldNames = /* @__PURE__ */ new Set([
9479
+ ...Object.keys(item.props),
9480
+ ...Object.keys(prevProps.current)
9481
+ ]);
9482
+ for (const fieldName of allFieldNames) {
9483
+ if (item.props[fieldName] !== prevProps.current[fieldName]) {
9484
+ changedFields.push(fieldName);
9485
+ if (((_d = componentFields[fieldName]) == null ? void 0 : _d.type) === "slot") {
9486
+ changeIncludesSlot = true;
9487
+ }
9488
+ }
9489
+ }
9473
9490
  }
9474
- changedProps.id = item.props.id;
9475
- prevProps.current = item.props;
9476
9491
  const mapped = mapFields(
9477
- __spreadProps(__spreadValues({}, item), { props: changedProps }),
9492
+ item,
9478
9493
  mappers,
9479
9494
  config,
9480
9495
  false,
9481
- changeIncludesSlot
9496
+ changeIncludesSlot,
9497
+ changedFields
9482
9498
  ).props;
9483
- prevResult.current = __spreadValues(__spreadValues({}, prevResult.current), mapped);
9499
+ prevProps.current = item.props;
9500
+ prevMappers.current = mappers;
9501
+ prevResult.current = changedFields ? __spreadValues(__spreadValues({}, prevResult.current), mapped) : mapped;
9484
9502
  return prevResult.current;
9485
9503
  }, [config, item, mappers]);
9486
9504
  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-D6RLJXOY.mjs";
21
- import "./chunk-WABMBXFK.mjs";
20
+ } from "./chunk-Q6WCB6GM.mjs";
21
+ import "./chunk-BMRBP3ET.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-OI2LQGRV.mjs";
31
- import "./chunk-G3YMTKUD.mjs";
32
- import "./chunk-X4NMPUXH.mjs";
33
- import "./chunk-EQADD6J2.mjs";
30
+ } from "./chunk-WQV7W7OC.mjs";
31
+ import "./chunk-EYJW64M2.mjs";
32
+ import "./chunk-MU6IPW26.mjs";
33
+ import "./chunk-HB4CVO3I.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-2KHLVDRT.mjs";
42
- import "./chunk-HRNJ42TO.mjs";
43
- import "./chunk-GR7NLT4T.mjs";
41
+ } from "./chunk-JHNG6XYK.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-EQADD6J2.mjs";
3
+ } from "./chunk-HB4CVO3I.mjs";
4
4
  import {
5
5
  List,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-2KHLVDRT.mjs";
9
- import "./chunk-HRNJ42TO.mjs";
10
- import "./chunk-GR7NLT4T.mjs";
8
+ } from "./chunk-JHNG6XYK.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-X4NMPUXH.mjs";
3
+ } from "./chunk-MU6IPW26.mjs";
4
4
  import {
5
5
  Heading,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-2KHLVDRT.mjs";
9
- import "./chunk-HRNJ42TO.mjs";
10
- import "./chunk-GR7NLT4T.mjs";
8
+ } from "./chunk-JHNG6XYK.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-G3YMTKUD.mjs";
3
+ } from "./chunk-EYJW64M2.mjs";
4
4
  import {
5
5
  AlignLeft,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-2KHLVDRT.mjs";
9
- import "./chunk-HRNJ42TO.mjs";
10
- import "./chunk-GR7NLT4T.mjs";
8
+ } from "./chunk-JHNG6XYK.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)) {
@@ -9451,6 +9453,7 @@ init_react_import();
9451
9453
  var import_react63 = require("react");
9452
9454
  init_map_fields();
9453
9455
  function useFieldTransformsTracked(config, item, transforms, readOnly, forceReadOnly) {
9456
+ const prevMappers = (0, import_react63.useRef)(null);
9454
9457
  const prevProps = (0, import_react63.useRef)(null);
9455
9458
  const prevResult = (0, import_react63.useRef)(item.props);
9456
9459
  const mappers = (0, import_react63.useMemo)(
@@ -9458,29 +9461,44 @@ function useFieldTransformsTracked(config, item, transforms, readOnly, forceRead
9458
9461
  [transforms, readOnly, forceReadOnly]
9459
9462
  );
9460
9463
  const transformedProps = (0, import_react63.useMemo)(() => {
9461
- var _a, _b, _c;
9462
- const changedProps = {};
9464
+ var _a, _b, _c, _d;
9463
9465
  const componentConfig = item.type === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[item.type];
9466
+ const componentFields = (_b = componentConfig == null ? void 0 : componentConfig.fields) != null ? _b : {};
9467
+ const fullRemap = prevMappers.current !== mappers;
9468
+ let changedFields;
9464
9469
  let changeIncludesSlot = false;
9465
- for (const fieldName in item.props) {
9466
- const fieldType = (_c = (_b = componentConfig == null ? void 0 : componentConfig.fields) == null ? void 0 : _b[fieldName]) == null ? void 0 : _c.type;
9467
- if (!prevProps.current || item.props[fieldName] !== prevProps.current[fieldName]) {
9468
- changedProps[fieldName] = item.props[fieldName];
9469
- if (fieldType === "slot") {
9470
+ if (!prevProps.current || fullRemap) {
9471
+ for (const fieldName in item.props) {
9472
+ if (((_c = componentFields[fieldName]) == null ? void 0 : _c.type) === "slot") {
9470
9473
  changeIncludesSlot = true;
9471
9474
  }
9472
9475
  }
9476
+ } else {
9477
+ changedFields = ["id"];
9478
+ const allFieldNames = /* @__PURE__ */ new Set([
9479
+ ...Object.keys(item.props),
9480
+ ...Object.keys(prevProps.current)
9481
+ ]);
9482
+ for (const fieldName of allFieldNames) {
9483
+ if (item.props[fieldName] !== prevProps.current[fieldName]) {
9484
+ changedFields.push(fieldName);
9485
+ if (((_d = componentFields[fieldName]) == null ? void 0 : _d.type) === "slot") {
9486
+ changeIncludesSlot = true;
9487
+ }
9488
+ }
9489
+ }
9473
9490
  }
9474
- changedProps.id = item.props.id;
9475
- prevProps.current = item.props;
9476
9491
  const mapped = mapFields(
9477
- __spreadProps(__spreadValues({}, item), { props: changedProps }),
9492
+ item,
9478
9493
  mappers,
9479
9494
  config,
9480
9495
  false,
9481
- changeIncludesSlot
9496
+ changeIncludesSlot,
9497
+ changedFields
9482
9498
  ).props;
9483
- prevResult.current = __spreadValues(__spreadValues({}, prevResult.current), mapped);
9499
+ prevProps.current = item.props;
9500
+ prevMappers.current = mappers;
9501
+ prevResult.current = changedFields ? __spreadValues(__spreadValues({}, prevResult.current), mapped) : mapped;
9484
9502
  return prevResult.current;
9485
9503
  }, [config, item, mappers]);
9486
9504
  const mergedProps = (0, import_react63.useMemo)(
@@ -17,20 +17,20 @@ import {
17
17
  setDeep,
18
18
  useGetPuck,
19
19
  usePuck
20
- } from "./chunk-D6RLJXOY.mjs";
21
- import "./chunk-WABMBXFK.mjs";
20
+ } from "./chunk-Q6WCB6GM.mjs";
21
+ import "./chunk-BMRBP3ET.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-OI2LQGRV.mjs";
31
- import "./chunk-G3YMTKUD.mjs";
32
- import "./chunk-X4NMPUXH.mjs";
33
- import "./chunk-EQADD6J2.mjs";
30
+ } from "./chunk-WQV7W7OC.mjs";
31
+ import "./chunk-EYJW64M2.mjs";
32
+ import "./chunk-MU6IPW26.mjs";
33
+ import "./chunk-HB4CVO3I.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-2KHLVDRT.mjs";
42
- import "./chunk-HRNJ42TO.mjs";
43
- import "./chunk-GR7NLT4T.mjs";
41
+ } from "./chunk-JHNG6XYK.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.23.0-canary.7ca16bcb",
3
+ "version": "0.23.0-canary.9bf3e00a",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Chris Villa <chris@puckeditor.com>",
6
6
  "repository": "puckeditor/puck",