@puckeditor/core 0.21.0-canary.d701a1da → 0.21.0

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-V2IQTPPK.mjs";
7
+ } from "./chunk-ZPR7EC3T.mjs";
8
8
  import "./chunk-AOEDIUVK.mjs";
9
- import "./chunk-6KNQXLQR.mjs";
10
- import "./chunk-GVKHZNTR.mjs";
11
- import "./chunk-MEL7FUSF.mjs";
12
- import "./chunk-3VQHXASI.mjs";
9
+ import "./chunk-RYILZVCB.mjs";
10
+ import "./chunk-UFXHMVJE.mjs";
11
+ import "./chunk-MNNPATDB.mjs";
12
+ import "./chunk-YBJ32VYI.mjs";
13
13
  import {
14
14
  useAppStore,
15
15
  useAppStoreApi
16
- } from "./chunk-K562SEXI.mjs";
17
- import "./chunk-KN3XDS7U.mjs";
18
- import "./chunk-REWRIUGR.mjs";
16
+ } from "./chunk-HLB66X4S.mjs";
17
+ import "./chunk-QIJR53IK.mjs";
18
+ import "./chunk-AHX7X7NZ.mjs";
19
19
  import "./chunk-Y2EFNT5P.mjs";
20
- import "./chunk-Q3TJ2VYO.mjs";
20
+ import "./chunk-7TZD3NRP.mjs";
21
21
  import {
22
22
  __spreadProps,
23
23
  __spreadValues,
@@ -222,32 +222,46 @@ var stripSlots = (data, config) => {
222
222
 
223
223
  // lib/data/flatten-node.ts
224
224
  var { flatten: flatten2, unflatten } = flat;
225
- function isEmptyArrayOrObject(val) {
226
- if (Array.isArray(val)) {
227
- return val.length === 0;
228
- }
229
- if (val != null && Object.prototype.toString.call(val) === "[object Object]") {
230
- return Object.keys(val).length === 0;
225
+ var isPureObject = (val) => val != null && Object.prototype.toString.call(val) === "[object Object]";
226
+ var emptyArrayStr = "__puck_[]";
227
+ var emptyObjectStr = "__puck_{}";
228
+ function encodeEmptyObjects(props = {}) {
229
+ const result = {};
230
+ for (const key in props) {
231
+ if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
232
+ const val = props[key];
233
+ if (Array.isArray(val) && val.length === 0) {
234
+ result[key] = emptyArrayStr;
235
+ } else if (isPureObject(val) && Object.keys(val).length === 0) {
236
+ result[key] = emptyObjectStr;
237
+ } else {
238
+ result[key] = val;
239
+ }
231
240
  }
232
- return false;
241
+ return result;
233
242
  }
234
- function stripEmptyObjects(props) {
243
+ function decodeEmptyObjects(props = {}) {
235
244
  const result = {};
236
245
  for (const key in props) {
237
246
  if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
238
247
  const val = props[key];
239
- if (isEmptyArrayOrObject(val)) continue;
240
- result[key] = val;
248
+ if (val === emptyArrayStr) {
249
+ result[key] = [];
250
+ } else if (val === emptyObjectStr) {
251
+ result[key] = {};
252
+ } else {
253
+ result[key] = val;
254
+ }
241
255
  }
242
256
  return result;
243
257
  }
244
258
  var flattenNode = (node, config) => {
245
259
  return __spreadProps(__spreadValues({}, node), {
246
- props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
260
+ props: encodeEmptyObjects(flatten2(stripSlots(node, config).props))
247
261
  });
248
262
  };
249
263
  var expandNode = (node) => {
250
- const props = unflatten(node.props);
264
+ const props = unflatten(decodeEmptyObjects(node.props));
251
265
  return __spreadProps(__spreadValues({}, node), {
252
266
  props
253
267
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mapFields
3
- } from "./chunk-Q3TJ2VYO.mjs";
3
+ } from "./chunk-7TZD3NRP.mjs";
4
4
  import {
5
5
  __async,
6
6
  __spreadProps,
@@ -3,19 +3,19 @@ import {
3
3
  generateId,
4
4
  getItem,
5
5
  makeStatePublic
6
- } from "./chunk-KN3XDS7U.mjs";
6
+ } from "./chunk-QIJR53IK.mjs";
7
7
  import {
8
8
  defaultAppState,
9
9
  defaultViewports,
10
10
  getChanged,
11
11
  resolveComponentData
12
- } from "./chunk-REWRIUGR.mjs";
12
+ } from "./chunk-AHX7X7NZ.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-Q3TJ2VYO.mjs";
18
+ } from "./chunk-7TZD3NRP.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-V2IQTPPK.mjs";
4
+ } from "./chunk-ZPR7EC3T.mjs";
5
5
  import {
6
6
  RichTextRenderFallback,
7
7
  SlotRender,
@@ -10,13 +10,13 @@ import {
10
10
  getSlotTransform,
11
11
  useRichtextProps,
12
12
  useSlots
13
- } from "./chunk-NYGQH27S.mjs";
13
+ } from "./chunk-WB2EIKOA.mjs";
14
14
  import {
15
15
  ActionBar,
16
16
  IconButton,
17
17
  LoadedRichTextMenuInner,
18
18
  Loader
19
- } from "./chunk-6KNQXLQR.mjs";
19
+ } from "./chunk-RYILZVCB.mjs";
20
20
  import {
21
21
  ChevronDown,
22
22
  ChevronRight,
@@ -68,7 +68,7 @@ import {
68
68
  useRegisterHistorySlice,
69
69
  useRegisterPermissionsSlice,
70
70
  useResetAutoZoom
71
- } from "./chunk-K562SEXI.mjs";
71
+ } from "./chunk-HLB66X4S.mjs";
72
72
  import {
73
73
  generateId,
74
74
  getItem,
@@ -76,12 +76,12 @@ import {
76
76
  insertAction,
77
77
  makeStatePublic,
78
78
  populateIds
79
- } from "./chunk-KN3XDS7U.mjs";
79
+ } from "./chunk-QIJR53IK.mjs";
80
80
  import {
81
81
  defaultAppState,
82
82
  defaultViewports,
83
83
  toComponent
84
- } from "./chunk-REWRIUGR.mjs";
84
+ } from "./chunk-AHX7X7NZ.mjs";
85
85
  import {
86
86
  get_class_name_factory_default
87
87
  } from "./chunk-Y2EFNT5P.mjs";
@@ -95,7 +95,7 @@ import {
95
95
  setupZone,
96
96
  walkAppState,
97
97
  walkField
98
- } from "./chunk-Q3TJ2VYO.mjs";
98
+ } from "./chunk-7TZD3NRP.mjs";
99
99
  import {
100
100
  __async,
101
101
  __commonJS,
@@ -1971,7 +1971,7 @@ EditorFallback.displayName = "EditorFallback";
1971
1971
  // components/AutoField/fields/RichtextField/index.tsx
1972
1972
  import { Fragment as Fragment4, jsx as jsx17 } from "react/jsx-runtime";
1973
1973
  var Editor = lazy(
1974
- () => import("./Editor-32UYWE6W.mjs").then((m) => ({
1974
+ () => import("./Editor-L7XD2QW3.mjs").then((m) => ({
1975
1975
  default: m.Editor
1976
1976
  }))
1977
1977
  );
@@ -3604,7 +3604,7 @@ import {
3604
3604
  } from "react";
3605
3605
  import { jsx as jsx27 } from "react/jsx-runtime";
3606
3606
  var Editor2 = lazy2(
3607
- () => import("./Editor-32UYWE6W.mjs").then((m) => ({
3607
+ () => import("./Editor-L7XD2QW3.mjs").then((m) => ({
3608
3608
  default: m.Editor
3609
3609
  }))
3610
3610
  );
@@ -7603,8 +7603,8 @@ var getPluginTabClassName = get_class_name_factory_default("PuckPluginTab", styl
7603
7603
  var FieldSideBar = () => {
7604
7604
  const title = useAppStore(
7605
7605
  (s) => {
7606
- var _a, _b;
7607
- return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
7606
+ var _a, _b, _c;
7607
+ return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : ((_c = s.config.root) == null ? void 0 : _c.label) || "Page";
7608
7608
  }
7609
7609
  );
7610
7610
  return /* @__PURE__ */ jsx54(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx54(Fields, {}) });
@@ -5,7 +5,7 @@ import {
5
5
  Heading4,
6
6
  Heading5,
7
7
  Heading6
8
- } from "./chunk-K562SEXI.mjs";
8
+ } from "./chunk-HLB66X4S.mjs";
9
9
  import {
10
10
  init_react_import
11
11
  } from "./chunk-M6W7YEVX.mjs";
@@ -3,7 +3,7 @@ import {
3
3
  setupZone,
4
4
  walkAppState,
5
5
  walkTree
6
- } from "./chunk-Q3TJ2VYO.mjs";
6
+ } from "./chunk-7TZD3NRP.mjs";
7
7
  import {
8
8
  __spreadProps,
9
9
  __spreadValues,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  useAlignOptions
3
- } from "./chunk-GVKHZNTR.mjs";
3
+ } from "./chunk-UFXHMVJE.mjs";
4
4
  import {
5
5
  useHeadingOptions
6
- } from "./chunk-MEL7FUSF.mjs";
6
+ } from "./chunk-MNNPATDB.mjs";
7
7
  import {
8
8
  useListOptions
9
- } from "./chunk-3VQHXASI.mjs";
9
+ } from "./chunk-YBJ32VYI.mjs";
10
10
  import {
11
11
  AlignCenter,
12
12
  AlignJustify,
@@ -26,7 +26,7 @@ import {
26
26
  Strikethrough,
27
27
  Underline,
28
28
  useControlContext
29
- } from "./chunk-K562SEXI.mjs";
29
+ } from "./chunk-HLB66X4S.mjs";
30
30
  import {
31
31
  get_class_name_factory_default
32
32
  } from "./chunk-Y2EFNT5P.mjs";
@@ -349,7 +349,7 @@ function AlignSelectFallback() {
349
349
  // components/RichTextMenu/controls/AlignSelect/index.tsx
350
350
  import { jsx as jsx10 } from "react/jsx-runtime";
351
351
  var AlignSelectLoaded = lazy(
352
- () => import("./loaded-DCQVLO7I.mjs").then((m) => ({
352
+ () => import("./loaded-G2WSQZO7.mjs").then((m) => ({
353
353
  default: m.AlignSelectLoaded
354
354
  }))
355
355
  );
@@ -580,7 +580,7 @@ function HeadingSelectFallback() {
580
580
  // components/RichTextMenu/controls/HeadingSelect/index.tsx
581
581
  import { jsx as jsx22 } from "react/jsx-runtime";
582
582
  var HeadingSelectLoaded = lazy2(
583
- () => import("./loaded-KKVJE5KH.mjs").then((m) => ({
583
+ () => import("./loaded-MYALJBRK.mjs").then((m) => ({
584
584
  default: m.HeadingSelectLoaded
585
585
  }))
586
586
  );
@@ -612,7 +612,7 @@ function ListSelectFallback() {
612
612
  // components/RichTextMenu/controls/ListSelect/index.tsx
613
613
  import { jsx as jsx24 } from "react/jsx-runtime";
614
614
  var ListSelectLoaded = lazy3(
615
- () => import("./loaded-JGRO7BH7.mjs").then((m) => ({
615
+ () => import("./loaded-5AM4V5PV.mjs").then((m) => ({
616
616
  default: m.ListSelectLoaded
617
617
  }))
618
618
  );
@@ -3,7 +3,7 @@ import {
3
3
  AlignJustify,
4
4
  AlignLeft,
5
5
  AlignRight
6
- } from "./chunk-K562SEXI.mjs";
6
+ } from "./chunk-HLB66X4S.mjs";
7
7
  import {
8
8
  init_react_import
9
9
  } from "./chunk-M6W7YEVX.mjs";
@@ -5,7 +5,7 @@ import {
5
5
  defaultAppState,
6
6
  resolveComponentData,
7
7
  toComponent
8
- } from "./chunk-REWRIUGR.mjs";
8
+ } from "./chunk-AHX7X7NZ.mjs";
9
9
  import {
10
10
  get_class_name_factory_default
11
11
  } from "./chunk-Y2EFNT5P.mjs";
@@ -14,7 +14,7 @@ import {
14
14
  mapFields,
15
15
  walkAppState,
16
16
  walkTree
17
- } from "./chunk-Q3TJ2VYO.mjs";
17
+ } from "./chunk-7TZD3NRP.mjs";
18
18
  import {
19
19
  __async,
20
20
  __objRest,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  List,
3
3
  ListOrdered
4
- } from "./chunk-K562SEXI.mjs";
4
+ } from "./chunk-HLB66X4S.mjs";
5
5
  import {
6
6
  init_react_import
7
7
  } from "./chunk-M6W7YEVX.mjs";
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-AOEDIUVK.mjs";
4
4
  import {
5
5
  LoadedRichTextMenuInner
6
- } from "./chunk-6KNQXLQR.mjs";
6
+ } from "./chunk-RYILZVCB.mjs";
7
7
  import {
8
8
  useAppStore,
9
9
  useAppStoreApi
10
- } from "./chunk-K562SEXI.mjs";
10
+ } from "./chunk-HLB66X4S.mjs";
11
11
  import {
12
12
  get_class_name_factory_default
13
13
  } from "./chunk-Y2EFNT5P.mjs";
@@ -97,7 +97,7 @@ init_react_import();
97
97
  import { lazy, Suspense } from "react";
98
98
  import { jsx as jsx2 } from "react/jsx-runtime";
99
99
  var LoadedRichTextMenuFull = lazy(
100
- () => import("./full-4OS3O57Y.mjs").then((m) => ({
100
+ () => import("./full-4UGAOTTB.mjs").then((m) => ({
101
101
  default: m.LoadedRichTextMenuFull
102
102
  }))
103
103
  );
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  LoadedRichTextMenuInner
3
- } from "./chunk-6KNQXLQR.mjs";
4
- import "./chunk-GVKHZNTR.mjs";
5
- import "./chunk-MEL7FUSF.mjs";
6
- import "./chunk-3VQHXASI.mjs";
7
- import "./chunk-K562SEXI.mjs";
8
- import "./chunk-KN3XDS7U.mjs";
9
- import "./chunk-REWRIUGR.mjs";
3
+ } from "./chunk-RYILZVCB.mjs";
4
+ import "./chunk-UFXHMVJE.mjs";
5
+ import "./chunk-MNNPATDB.mjs";
6
+ import "./chunk-YBJ32VYI.mjs";
7
+ import "./chunk-HLB66X4S.mjs";
8
+ import "./chunk-QIJR53IK.mjs";
9
+ import "./chunk-AHX7X7NZ.mjs";
10
10
  import "./chunk-Y2EFNT5P.mjs";
11
- import "./chunk-Q3TJ2VYO.mjs";
11
+ import "./chunk-7TZD3NRP.mjs";
12
12
  import {
13
13
  __spreadValues,
14
14
  init_react_import
package/dist/index.js CHANGED
@@ -1596,26 +1596,37 @@ var init_strip_slots = __esm({
1596
1596
  });
1597
1597
 
1598
1598
  // lib/data/flatten-node.ts
1599
- function isEmptyArrayOrObject(val) {
1600
- if (Array.isArray(val)) {
1601
- return val.length === 0;
1602
- }
1603
- if (val != null && Object.prototype.toString.call(val) === "[object Object]") {
1604
- return Object.keys(val).length === 0;
1599
+ function encodeEmptyObjects(props = {}) {
1600
+ const result = {};
1601
+ for (const key in props) {
1602
+ if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
1603
+ const val = props[key];
1604
+ if (Array.isArray(val) && val.length === 0) {
1605
+ result[key] = emptyArrayStr;
1606
+ } else if (isPureObject(val) && Object.keys(val).length === 0) {
1607
+ result[key] = emptyObjectStr;
1608
+ } else {
1609
+ result[key] = val;
1610
+ }
1605
1611
  }
1606
- return false;
1612
+ return result;
1607
1613
  }
1608
- function stripEmptyObjects(props) {
1614
+ function decodeEmptyObjects(props = {}) {
1609
1615
  const result = {};
1610
1616
  for (const key in props) {
1611
1617
  if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
1612
1618
  const val = props[key];
1613
- if (isEmptyArrayOrObject(val)) continue;
1614
- result[key] = val;
1619
+ if (val === emptyArrayStr) {
1620
+ result[key] = [];
1621
+ } else if (val === emptyObjectStr) {
1622
+ result[key] = {};
1623
+ } else {
1624
+ result[key] = val;
1625
+ }
1615
1626
  }
1616
1627
  return result;
1617
1628
  }
1618
- var import_flat, flatten2, unflatten, flattenNode, expandNode;
1629
+ var import_flat, flatten2, unflatten, isPureObject, emptyArrayStr, emptyObjectStr, flattenNode, expandNode;
1619
1630
  var init_flatten_node = __esm({
1620
1631
  "lib/data/flatten-node.ts"() {
1621
1632
  "use strict";
@@ -1623,13 +1634,16 @@ var init_flatten_node = __esm({
1623
1634
  import_flat = __toESM(require("flat"));
1624
1635
  init_strip_slots();
1625
1636
  ({ flatten: flatten2, unflatten } = import_flat.default);
1637
+ isPureObject = (val) => val != null && Object.prototype.toString.call(val) === "[object Object]";
1638
+ emptyArrayStr = "__puck_[]";
1639
+ emptyObjectStr = "__puck_{}";
1626
1640
  flattenNode = (node, config) => {
1627
1641
  return __spreadProps(__spreadValues({}, node), {
1628
- props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
1642
+ props: encodeEmptyObjects(flatten2(stripSlots(node, config).props))
1629
1643
  });
1630
1644
  };
1631
1645
  expandNode = (node) => {
1632
- const props = unflatten(node.props);
1646
+ const props = unflatten(decodeEmptyObjects(node.props));
1633
1647
  return __spreadProps(__spreadValues({}, node), {
1634
1648
  props
1635
1649
  });
@@ -13365,8 +13379,8 @@ var getPluginTabClassName = get_class_name_factory_default("PuckPluginTab", styl
13365
13379
  var FieldSideBar = () => {
13366
13380
  const title = useAppStore(
13367
13381
  (s) => {
13368
- var _a, _b;
13369
- return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
13382
+ var _a, _b, _c;
13383
+ return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : ((_c = s.config.root) == null ? void 0 : _c.label) || "Page";
13370
13384
  }
13371
13385
  );
13372
13386
  return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Fields, {}) });
package/dist/index.mjs CHANGED
@@ -17,13 +17,13 @@ import {
17
17
  setDeep,
18
18
  useGetPuck,
19
19
  usePuck
20
- } from "./chunk-LJYBMDKR.mjs";
21
- import "./chunk-V2IQTPPK.mjs";
20
+ } from "./chunk-K66K75HC.mjs";
21
+ import "./chunk-ZPR7EC3T.mjs";
22
22
  import {
23
23
  migrate,
24
24
  resolveAllData,
25
25
  transformProps
26
- } from "./chunk-NYGQH27S.mjs";
26
+ } from "./chunk-WB2EIKOA.mjs";
27
27
  import "./chunk-AOEDIUVK.mjs";
28
28
  import {
29
29
  Action,
@@ -33,17 +33,17 @@ import {
33
33
  Label,
34
34
  RichTextMenu,
35
35
  Separator
36
- } from "./chunk-6KNQXLQR.mjs";
37
- import "./chunk-GVKHZNTR.mjs";
38
- import "./chunk-MEL7FUSF.mjs";
39
- import "./chunk-3VQHXASI.mjs";
40
- import "./chunk-K562SEXI.mjs";
41
- import "./chunk-KN3XDS7U.mjs";
42
- import "./chunk-REWRIUGR.mjs";
36
+ } from "./chunk-RYILZVCB.mjs";
37
+ import "./chunk-UFXHMVJE.mjs";
38
+ import "./chunk-MNNPATDB.mjs";
39
+ import "./chunk-YBJ32VYI.mjs";
40
+ import "./chunk-HLB66X4S.mjs";
41
+ import "./chunk-QIJR53IK.mjs";
42
+ import "./chunk-AHX7X7NZ.mjs";
43
43
  import "./chunk-Y2EFNT5P.mjs";
44
44
  import {
45
45
  walkTree
46
- } from "./chunk-Q3TJ2VYO.mjs";
46
+ } from "./chunk-7TZD3NRP.mjs";
47
47
  import "./chunk-M6W7YEVX.mjs";
48
48
  export {
49
49
  Action,
package/dist/internal.js CHANGED
@@ -245,28 +245,27 @@ var stripSlots = (data, config) => {
245
245
 
246
246
  // lib/data/flatten-node.ts
247
247
  var { flatten: flatten2, unflatten } = import_flat.default;
248
- function isEmptyArrayOrObject(val) {
249
- if (Array.isArray(val)) {
250
- return val.length === 0;
251
- }
252
- if (val != null && Object.prototype.toString.call(val) === "[object Object]") {
253
- return Object.keys(val).length === 0;
254
- }
255
- return false;
256
- }
257
- function stripEmptyObjects(props) {
248
+ var isPureObject = (val) => val != null && Object.prototype.toString.call(val) === "[object Object]";
249
+ var emptyArrayStr = "__puck_[]";
250
+ var emptyObjectStr = "__puck_{}";
251
+ function encodeEmptyObjects(props = {}) {
258
252
  const result = {};
259
253
  for (const key in props) {
260
254
  if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
261
255
  const val = props[key];
262
- if (isEmptyArrayOrObject(val)) continue;
263
- result[key] = val;
256
+ if (Array.isArray(val) && val.length === 0) {
257
+ result[key] = emptyArrayStr;
258
+ } else if (isPureObject(val) && Object.keys(val).length === 0) {
259
+ result[key] = emptyObjectStr;
260
+ } else {
261
+ result[key] = val;
262
+ }
264
263
  }
265
264
  return result;
266
265
  }
267
266
  var flattenNode = (node, config) => {
268
267
  return __spreadProps(__spreadValues({}, node), {
269
- props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
268
+ props: encodeEmptyObjects(flatten2(stripSlots(node, config).props))
270
269
  });
271
270
  };
272
271
 
package/dist/internal.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createReducer
3
- } from "./chunk-KN3XDS7U.mjs";
4
- import "./chunk-Q3TJ2VYO.mjs";
3
+ } from "./chunk-QIJR53IK.mjs";
4
+ import "./chunk-7TZD3NRP.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-3VQHXASI.mjs";
3
+ } from "./chunk-YBJ32VYI.mjs";
4
4
  import {
5
5
  List,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-K562SEXI.mjs";
9
- import "./chunk-KN3XDS7U.mjs";
10
- import "./chunk-REWRIUGR.mjs";
8
+ } from "./chunk-HLB66X4S.mjs";
9
+ import "./chunk-QIJR53IK.mjs";
10
+ import "./chunk-AHX7X7NZ.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
- import "./chunk-Q3TJ2VYO.mjs";
12
+ import "./chunk-7TZD3NRP.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-GVKHZNTR.mjs";
3
+ } from "./chunk-UFXHMVJE.mjs";
4
4
  import {
5
5
  AlignLeft,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-K562SEXI.mjs";
9
- import "./chunk-KN3XDS7U.mjs";
10
- import "./chunk-REWRIUGR.mjs";
8
+ } from "./chunk-HLB66X4S.mjs";
9
+ import "./chunk-QIJR53IK.mjs";
10
+ import "./chunk-AHX7X7NZ.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
- import "./chunk-Q3TJ2VYO.mjs";
12
+ import "./chunk-7TZD3NRP.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-MEL7FUSF.mjs";
3
+ } from "./chunk-MNNPATDB.mjs";
4
4
  import {
5
5
  Heading,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-K562SEXI.mjs";
9
- import "./chunk-KN3XDS7U.mjs";
10
- import "./chunk-REWRIUGR.mjs";
8
+ } from "./chunk-HLB66X4S.mjs";
9
+ import "./chunk-QIJR53IK.mjs";
10
+ import "./chunk-AHX7X7NZ.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
- import "./chunk-Q3TJ2VYO.mjs";
12
+ import "./chunk-7TZD3NRP.mjs";
13
13
  import {
14
14
  init_react_import
15
15
  } from "./chunk-M6W7YEVX.mjs";
@@ -1596,26 +1596,37 @@ var init_strip_slots = __esm({
1596
1596
  });
1597
1597
 
1598
1598
  // lib/data/flatten-node.ts
1599
- function isEmptyArrayOrObject(val) {
1600
- if (Array.isArray(val)) {
1601
- return val.length === 0;
1602
- }
1603
- if (val != null && Object.prototype.toString.call(val) === "[object Object]") {
1604
- return Object.keys(val).length === 0;
1599
+ function encodeEmptyObjects(props = {}) {
1600
+ const result = {};
1601
+ for (const key in props) {
1602
+ if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
1603
+ const val = props[key];
1604
+ if (Array.isArray(val) && val.length === 0) {
1605
+ result[key] = emptyArrayStr;
1606
+ } else if (isPureObject(val) && Object.keys(val).length === 0) {
1607
+ result[key] = emptyObjectStr;
1608
+ } else {
1609
+ result[key] = val;
1610
+ }
1605
1611
  }
1606
- return false;
1612
+ return result;
1607
1613
  }
1608
- function stripEmptyObjects(props) {
1614
+ function decodeEmptyObjects(props = {}) {
1609
1615
  const result = {};
1610
1616
  for (const key in props) {
1611
1617
  if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
1612
1618
  const val = props[key];
1613
- if (isEmptyArrayOrObject(val)) continue;
1614
- result[key] = val;
1619
+ if (val === emptyArrayStr) {
1620
+ result[key] = [];
1621
+ } else if (val === emptyObjectStr) {
1622
+ result[key] = {};
1623
+ } else {
1624
+ result[key] = val;
1625
+ }
1615
1626
  }
1616
1627
  return result;
1617
1628
  }
1618
- var import_flat, flatten2, unflatten, flattenNode, expandNode;
1629
+ var import_flat, flatten2, unflatten, isPureObject, emptyArrayStr, emptyObjectStr, flattenNode, expandNode;
1619
1630
  var init_flatten_node = __esm({
1620
1631
  "lib/data/flatten-node.ts"() {
1621
1632
  "use strict";
@@ -1623,13 +1634,16 @@ var init_flatten_node = __esm({
1623
1634
  import_flat = __toESM(require("flat"));
1624
1635
  init_strip_slots();
1625
1636
  ({ flatten: flatten2, unflatten } = import_flat.default);
1637
+ isPureObject = (val) => val != null && Object.prototype.toString.call(val) === "[object Object]";
1638
+ emptyArrayStr = "__puck_[]";
1639
+ emptyObjectStr = "__puck_{}";
1626
1640
  flattenNode = (node, config) => {
1627
1641
  return __spreadProps(__spreadValues({}, node), {
1628
- props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
1642
+ props: encodeEmptyObjects(flatten2(stripSlots(node, config).props))
1629
1643
  });
1630
1644
  };
1631
1645
  expandNode = (node) => {
1632
- const props = unflatten(node.props);
1646
+ const props = unflatten(decodeEmptyObjects(node.props));
1633
1647
  return __spreadProps(__spreadValues({}, node), {
1634
1648
  props
1635
1649
  });
@@ -13368,8 +13382,8 @@ var getPluginTabClassName = get_class_name_factory_default("PuckPluginTab", styl
13368
13382
  var FieldSideBar = () => {
13369
13383
  const title = useAppStore(
13370
13384
  (s) => {
13371
- var _a, _b;
13372
- return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
13385
+ var _a, _b, _c;
13386
+ return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : ((_c = s.config.root) == null ? void 0 : _c.label) || "Page";
13373
13387
  }
13374
13388
  );
13375
13389
  return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Fields, {}) });
@@ -17,13 +17,13 @@ import {
17
17
  setDeep,
18
18
  useGetPuck,
19
19
  usePuck
20
- } from "./chunk-LJYBMDKR.mjs";
21
- import "./chunk-V2IQTPPK.mjs";
20
+ } from "./chunk-K66K75HC.mjs";
21
+ import "./chunk-ZPR7EC3T.mjs";
22
22
  import {
23
23
  migrate,
24
24
  resolveAllData,
25
25
  transformProps
26
- } from "./chunk-NYGQH27S.mjs";
26
+ } from "./chunk-WB2EIKOA.mjs";
27
27
  import "./chunk-AOEDIUVK.mjs";
28
28
  import {
29
29
  Action,
@@ -33,17 +33,17 @@ import {
33
33
  Label,
34
34
  RichTextMenu,
35
35
  Separator
36
- } from "./chunk-6KNQXLQR.mjs";
37
- import "./chunk-GVKHZNTR.mjs";
38
- import "./chunk-MEL7FUSF.mjs";
39
- import "./chunk-3VQHXASI.mjs";
40
- import "./chunk-K562SEXI.mjs";
41
- import "./chunk-KN3XDS7U.mjs";
42
- import "./chunk-REWRIUGR.mjs";
36
+ } from "./chunk-RYILZVCB.mjs";
37
+ import "./chunk-UFXHMVJE.mjs";
38
+ import "./chunk-MNNPATDB.mjs";
39
+ import "./chunk-YBJ32VYI.mjs";
40
+ import "./chunk-HLB66X4S.mjs";
41
+ import "./chunk-QIJR53IK.mjs";
42
+ import "./chunk-AHX7X7NZ.mjs";
43
43
  import "./chunk-Y2EFNT5P.mjs";
44
44
  import {
45
45
  walkTree
46
- } from "./chunk-Q3TJ2VYO.mjs";
46
+ } from "./chunk-7TZD3NRP.mjs";
47
47
  import {
48
48
  init_react_import
49
49
  } from "./chunk-M6W7YEVX.mjs";
package/dist/rsc.js CHANGED
@@ -1154,28 +1154,27 @@ var stripSlots = (data, config) => {
1154
1154
 
1155
1155
  // lib/data/flatten-node.ts
1156
1156
  var { flatten: flatten2, unflatten } = import_flat.default;
1157
- function isEmptyArrayOrObject(val) {
1158
- if (Array.isArray(val)) {
1159
- return val.length === 0;
1160
- }
1161
- if (val != null && Object.prototype.toString.call(val) === "[object Object]") {
1162
- return Object.keys(val).length === 0;
1163
- }
1164
- return false;
1165
- }
1166
- function stripEmptyObjects(props) {
1157
+ var isPureObject = (val) => val != null && Object.prototype.toString.call(val) === "[object Object]";
1158
+ var emptyArrayStr = "__puck_[]";
1159
+ var emptyObjectStr = "__puck_{}";
1160
+ function encodeEmptyObjects(props = {}) {
1167
1161
  const result = {};
1168
1162
  for (const key in props) {
1169
1163
  if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
1170
1164
  const val = props[key];
1171
- if (isEmptyArrayOrObject(val)) continue;
1172
- result[key] = val;
1165
+ if (Array.isArray(val) && val.length === 0) {
1166
+ result[key] = emptyArrayStr;
1167
+ } else if (isPureObject(val) && Object.keys(val).length === 0) {
1168
+ result[key] = emptyObjectStr;
1169
+ } else {
1170
+ result[key] = val;
1171
+ }
1173
1172
  }
1174
1173
  return result;
1175
1174
  }
1176
1175
  var flattenNode = (node, config) => {
1177
1176
  return __spreadProps(__spreadValues({}, node), {
1178
- props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
1177
+ props: encodeEmptyObjects(flatten2(stripSlots(node, config).props))
1179
1178
  });
1180
1179
  };
1181
1180
 
package/dist/rsc.mjs CHANGED
@@ -5,9 +5,9 @@ import {
5
5
  transformProps,
6
6
  useRichtextProps,
7
7
  useSlots
8
- } from "./chunk-NYGQH27S.mjs";
8
+ } from "./chunk-WB2EIKOA.mjs";
9
9
  import "./chunk-AOEDIUVK.mjs";
10
- import "./chunk-REWRIUGR.mjs";
10
+ import "./chunk-AHX7X7NZ.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-Q3TJ2VYO.mjs";
18
+ } from "./chunk-7TZD3NRP.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.21.0-canary.d701a1da",
3
+ "version": "0.21.0",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Chris Villa <chris@puckeditor.com>",
6
6
  "repository": "puckeditor/puck",