@measured/puck 0.21.0-canary.c78dc826 → 0.21.0-canary.d1e8fa71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/{Editor-F2LSS6SE.css → Editor-IQP25PUX.css} +28 -27
  2. package/dist/{Editor-N46HUQEC.mjs → Editor-L3JAAT2X.mjs} +13 -10
  3. package/dist/{Render-QEMDIDQC.css → Render-3OV4N4MT.css} +28 -27
  4. package/dist/{Render-Y567PGZ7.mjs → Render-FXZX6NFH.mjs} +6 -4
  5. package/dist/{walk-tree-Ja9bNCM9.d.mts → actions-tsxxcX1z.d.mts} +24 -35
  6. package/dist/{walk-tree-Ja9bNCM9.d.ts → actions-tsxxcX1z.d.ts} +24 -35
  7. package/dist/chunk-23IZFPL7.mjs +528 -0
  8. package/dist/{chunk-C2TVYIYC.mjs → chunk-3SDLQIUZ.mjs} +57 -43
  9. package/dist/chunk-45I5SDOI.mjs +134 -0
  10. package/dist/{chunk-DNF2EMM4.mjs → chunk-5ZZVX2Z3.mjs} +2 -2
  11. package/dist/chunk-AOEDIUVK.mjs +11 -0
  12. package/dist/{chunk-DJSH5REF.mjs → chunk-B7REOAA7.mjs} +24 -126
  13. package/dist/{chunk-K3V4LVUL.mjs → chunk-BXQQARCR.mjs} +14 -10
  14. package/dist/{chunk-TB3SSIAY.mjs → chunk-CQUAWHOK.mjs} +5224 -4509
  15. package/dist/{chunk-7KY6RHEY.mjs → chunk-D2SRL6YA.mjs} +101 -524
  16. package/dist/{chunk-GQKMOYLG.mjs → chunk-LJEGWHDD.mjs} +2 -2
  17. package/dist/{chunk-DCSQEDMK.mjs → chunk-M6W7YEVX.mjs} +1 -100
  18. package/dist/{chunk-FNWOH4R6.mjs → chunk-PBAAIKXA.mjs} +8 -6
  19. package/dist/{chunk-3QHWXJEI.mjs → chunk-U4VSQKO3.mjs} +2 -2
  20. package/dist/{chunk-R6CVX2IY.mjs → chunk-V5I7CVLT.mjs} +1 -1
  21. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  22. package/dist/{full-NLUNPJWS.mjs → full-L7DWVNTZ.mjs} +10 -7
  23. package/dist/index-Ca6V6NQD.d.ts +118 -0
  24. package/dist/index-mQvUCH3C.d.mts +118 -0
  25. package/dist/index.css +732 -341
  26. package/dist/index.d.mts +29 -120
  27. package/dist/index.d.ts +29 -120
  28. package/dist/index.js +3273 -2392
  29. package/dist/index.mjs +22 -16
  30. package/dist/internal.d.mts +27 -0
  31. package/dist/internal.d.ts +27 -0
  32. package/dist/internal.js +927 -0
  33. package/dist/internal.mjs +13 -0
  34. package/dist/{loaded-HMSPJUZM.mjs → loaded-2HLHDP2G.mjs} +7 -4
  35. package/dist/{loaded-EV34KGYJ.mjs → loaded-LZUXYAGW.mjs} +7 -4
  36. package/dist/{loaded-ZXOU6S6R.mjs → loaded-UHVTB6OD.mjs} +7 -4
  37. package/dist/no-external.css +870 -475
  38. package/dist/no-external.d.mts +4 -2
  39. package/dist/no-external.d.ts +4 -2
  40. package/dist/no-external.js +3276 -2392
  41. package/dist/no-external.mjs +22 -11
  42. package/dist/rsc.css +28 -27
  43. package/dist/rsc.d.mts +2 -2
  44. package/dist/rsc.d.ts +2 -2
  45. package/dist/rsc.js +56 -29
  46. package/dist/rsc.mjs +6 -4
  47. package/dist/walk-tree-Bh85NMeo.d.ts +29 -0
  48. package/dist/walk-tree-CDA3K5S3.d.mts +29 -0
  49. package/package.json +9 -4
  50. package/dist/chunk-WUWXFMEM.mjs +0 -11
@@ -0,0 +1,134 @@
1
+ import {
2
+ mapFields
3
+ } from "./chunk-B7REOAA7.mjs";
4
+ import {
5
+ __async,
6
+ __spreadProps,
7
+ __spreadValues,
8
+ init_react_import
9
+ } from "./chunk-M6W7YEVX.mjs";
10
+
11
+ // components/ViewportControls/default-viewports.ts
12
+ init_react_import();
13
+ var defaultViewports = [
14
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
15
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
16
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
17
+ { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
18
+ ];
19
+
20
+ // lib/resolve-component-data.ts
21
+ init_react_import();
22
+
23
+ // lib/get-changed.ts
24
+ init_react_import();
25
+ import { deepEqual } from "fast-equals";
26
+ var getChanged = (newItem, oldItem) => {
27
+ return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
28
+ const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
29
+ const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
30
+ return __spreadProps(__spreadValues({}, acc), {
31
+ [item]: !deepEqual(oldItemProps[item], newItemProps[item])
32
+ });
33
+ }, {}) : {};
34
+ };
35
+
36
+ // lib/resolve-component-data.ts
37
+ import { deepEqual as deepEqual2 } from "fast-equals";
38
+ var cache = { lastChange: {} };
39
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
40
+ const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
41
+ const resolvedItem = __spreadValues({}, item);
42
+ const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
43
+ const id = "id" in item.props ? item.props.id : "root";
44
+ if (shouldRunResolver) {
45
+ const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
46
+ if (trigger !== "force" && item && deepEqual2(item, oldItem)) {
47
+ return { node: resolved, didChange: false };
48
+ }
49
+ const changed = getChanged(item, oldItem);
50
+ if (onResolveStart) {
51
+ onResolveStart(item);
52
+ }
53
+ const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
54
+ changed,
55
+ lastData: oldItem,
56
+ metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
57
+ trigger
58
+ });
59
+ resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
60
+ if (Object.keys(readOnly).length) {
61
+ resolvedItem.readOnly = readOnly;
62
+ }
63
+ }
64
+ let itemWithResolvedChildren = yield mapFields(
65
+ resolvedItem,
66
+ {
67
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
68
+ const content = value;
69
+ return yield Promise.all(
70
+ content.map(
71
+ (childItem) => __async(null, null, function* () {
72
+ return (yield resolveComponentData(
73
+ childItem,
74
+ config,
75
+ metadata,
76
+ onResolveStart,
77
+ onResolveEnd,
78
+ trigger
79
+ )).node;
80
+ })
81
+ )
82
+ );
83
+ })
84
+ },
85
+ config
86
+ );
87
+ if (shouldRunResolver && onResolveEnd) {
88
+ onResolveEnd(resolvedItem);
89
+ }
90
+ cache.lastChange[id] = {
91
+ item,
92
+ resolved: itemWithResolvedChildren
93
+ };
94
+ return {
95
+ node: itemWithResolvedChildren,
96
+ didChange: !deepEqual2(item, itemWithResolvedChildren)
97
+ };
98
+ });
99
+
100
+ // store/default-app-state.ts
101
+ init_react_import();
102
+ var defaultAppState = {
103
+ data: { content: [], root: {}, zones: {} },
104
+ ui: {
105
+ leftSideBarVisible: true,
106
+ rightSideBarVisible: true,
107
+ arrayState: {},
108
+ itemSelector: null,
109
+ componentList: {},
110
+ isDragging: false,
111
+ previewMode: "edit",
112
+ viewports: {
113
+ current: {
114
+ width: defaultViewports[0].width,
115
+ height: defaultViewports[0].height || "auto"
116
+ },
117
+ options: [],
118
+ controlsVisible: true
119
+ },
120
+ field: { focus: null },
121
+ plugin: { current: null }
122
+ },
123
+ indexes: {
124
+ nodes: {},
125
+ zones: {}
126
+ }
127
+ };
128
+
129
+ export {
130
+ defaultViewports,
131
+ getChanged,
132
+ resolveComponentData,
133
+ defaultAppState
134
+ };
@@ -5,10 +5,10 @@ import {
5
5
  Heading4,
6
6
  Heading5,
7
7
  Heading6
8
- } from "./chunk-7KY6RHEY.mjs";
8
+ } from "./chunk-D2SRL6YA.mjs";
9
9
  import {
10
10
  init_react_import
11
- } from "./chunk-DCSQEDMK.mjs";
11
+ } from "./chunk-M6W7YEVX.mjs";
12
12
 
13
13
  // components/RichTextMenu/controls/HeadingSelect/use-options.ts
14
14
  init_react_import();
@@ -0,0 +1,11 @@
1
+ import {
2
+ init_react_import
3
+ } from "./chunk-M6W7YEVX.mjs";
4
+
5
+ // css-module:/home/runner/work/puck/puck/packages/core/components/RichTextEditor/styles.module.css#css-module
6
+ init_react_import();
7
+ var styles_module_default = { "RichTextEditor": "_RichTextEditor_z25h4_1", "RichTextEditor--editor": "_RichTextEditor--editor_z25h4_50", "RichTextEditor--disabled": "_RichTextEditor--disabled_z25h4_107", "RichTextEditor--isActive": "_RichTextEditor--isActive_z25h4_111", "RichTextEditor-menu": "_RichTextEditor-menu_z25h4_117" };
8
+
9
+ export {
10
+ styles_module_default
11
+ };
@@ -1,9 +1,8 @@
1
1
  import {
2
- __async,
3
2
  __spreadProps,
4
3
  __spreadValues,
5
4
  init_react_import
6
- } from "./chunk-DCSQEDMK.mjs";
5
+ } from "./chunk-M6W7YEVX.mjs";
7
6
 
8
7
  // lib/data/walk-tree.ts
9
8
  init_react_import();
@@ -144,12 +143,12 @@ var walkObject = ({
144
143
  }
145
144
  return flatten(newProps);
146
145
  };
147
- function mapFields(item, mappers, config, recurseSlots = false) {
146
+ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true) {
148
147
  var _a, _b, _c, _d, _e;
149
148
  const itemType = "type" in item ? item.type : "root";
150
149
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
151
150
  const newProps = walkObject({
152
- value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
151
+ value: shouldDefaultSlots ? defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}) : item.props,
153
152
  fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
154
153
  mappers,
155
154
  id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
@@ -223,9 +222,28 @@ var stripSlots = (data, config) => {
223
222
 
224
223
  // lib/data/flatten-node.ts
225
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;
231
+ }
232
+ return false;
233
+ }
234
+ function stripEmptyObjects(props) {
235
+ const result = {};
236
+ for (const key in props) {
237
+ if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
238
+ const val = props[key];
239
+ if (isEmptyArrayOrObject(val)) continue;
240
+ result[key] = val;
241
+ }
242
+ return result;
243
+ }
226
244
  var flattenNode = (node, config) => {
227
245
  return __spreadProps(__spreadValues({}, node), {
228
- props: flatten2(stripSlots(node, config).props)
246
+ props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
229
247
  });
230
248
  };
231
249
  var expandNode = (node) => {
@@ -403,122 +421,6 @@ var setupZone = (data, zoneKey) => {
403
421
  return newData;
404
422
  };
405
423
 
406
- // components/ViewportControls/default-viewports.ts
407
- init_react_import();
408
- var defaultViewports = [
409
- { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
410
- { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
411
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
412
- ];
413
-
414
- // lib/resolve-component-data.ts
415
- init_react_import();
416
-
417
- // lib/get-changed.ts
418
- init_react_import();
419
- import { deepEqual } from "fast-equals";
420
- var getChanged = (newItem, oldItem) => {
421
- return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
422
- const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
423
- const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
424
- return __spreadProps(__spreadValues({}, acc), {
425
- [item]: !deepEqual(oldItemProps[item], newItemProps[item])
426
- });
427
- }, {}) : {};
428
- };
429
-
430
- // lib/resolve-component-data.ts
431
- import { deepEqual as deepEqual2 } from "fast-equals";
432
- var cache = { lastChange: {} };
433
- var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
434
- const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
435
- const resolvedItem = __spreadValues({}, item);
436
- const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
437
- const id = "id" in item.props ? item.props.id : "root";
438
- if (shouldRunResolver) {
439
- const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
440
- if (trigger !== "force" && item && deepEqual2(item, oldItem)) {
441
- return { node: resolved, didChange: false };
442
- }
443
- const changed = getChanged(item, oldItem);
444
- if (onResolveStart) {
445
- onResolveStart(item);
446
- }
447
- const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
448
- changed,
449
- lastData: oldItem,
450
- metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
451
- trigger
452
- });
453
- resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
454
- if (Object.keys(readOnly).length) {
455
- resolvedItem.readOnly = readOnly;
456
- }
457
- }
458
- let itemWithResolvedChildren = yield mapFields(
459
- resolvedItem,
460
- {
461
- slot: (_02) => __async(null, [_02], function* ({ value }) {
462
- const content = value;
463
- return yield Promise.all(
464
- content.map(
465
- (childItem) => __async(null, null, function* () {
466
- return (yield resolveComponentData(
467
- childItem,
468
- config,
469
- metadata,
470
- onResolveStart,
471
- onResolveEnd,
472
- trigger
473
- )).node;
474
- })
475
- )
476
- );
477
- })
478
- },
479
- config
480
- );
481
- if (shouldRunResolver && onResolveEnd) {
482
- onResolveEnd(resolvedItem);
483
- }
484
- cache.lastChange[id] = {
485
- item,
486
- resolved: itemWithResolvedChildren
487
- };
488
- return {
489
- node: itemWithResolvedChildren,
490
- didChange: !deepEqual2(item, itemWithResolvedChildren)
491
- };
492
- });
493
-
494
- // store/default-app-state.ts
495
- init_react_import();
496
- var defaultAppState = {
497
- data: { content: [], root: {}, zones: {} },
498
- ui: {
499
- leftSideBarVisible: true,
500
- rightSideBarVisible: true,
501
- arrayState: {},
502
- itemSelector: null,
503
- componentList: {},
504
- isDragging: false,
505
- previewMode: "edit",
506
- viewports: {
507
- current: {
508
- width: defaultViewports[0].width,
509
- height: defaultViewports[0].height || "auto"
510
- },
511
- options: [],
512
- controlsVisible: true
513
- },
514
- field: { focus: null }
515
- },
516
- indexes: {
517
- nodes: {},
518
- zones: {}
519
- }
520
- };
521
-
522
424
  export {
523
425
  rootAreaId,
524
426
  rootZone,
@@ -529,9 +431,5 @@ export {
529
431
  expandNode,
530
432
  walkAppState,
531
433
  walkTree,
532
- setupZone,
533
- defaultViewports,
534
- getChanged,
535
- resolveComponentData,
536
- defaultAppState
434
+ setupZone
537
435
  };
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  useAlignOptions
3
- } from "./chunk-GQKMOYLG.mjs";
3
+ } from "./chunk-LJEGWHDD.mjs";
4
4
  import {
5
5
  useHeadingOptions
6
- } from "./chunk-DNF2EMM4.mjs";
6
+ } from "./chunk-5ZZVX2Z3.mjs";
7
7
  import {
8
8
  useListOptions
9
- } from "./chunk-3QHWXJEI.mjs";
9
+ } from "./chunk-U4VSQKO3.mjs";
10
10
  import {
11
11
  AlignCenter,
12
12
  AlignJustify,
@@ -26,13 +26,15 @@ import {
26
26
  Strikethrough,
27
27
  Underline,
28
28
  useControlContext
29
- } from "./chunk-7KY6RHEY.mjs";
29
+ } from "./chunk-D2SRL6YA.mjs";
30
+ import {
31
+ get_class_name_factory_default
32
+ } from "./chunk-Y2EFNT5P.mjs";
30
33
  import {
31
34
  __objRest,
32
35
  __spreadValues,
33
- get_class_name_factory_default,
34
36
  init_react_import
35
- } from "./chunk-DCSQEDMK.mjs";
37
+ } from "./chunk-M6W7YEVX.mjs";
36
38
 
37
39
  // components/ActionBar/index.tsx
38
40
  init_react_import();
@@ -140,7 +142,8 @@ var IconButton = ({
140
142
  tabIndex,
141
143
  newTab,
142
144
  fullWidth,
143
- title
145
+ title,
146
+ suppressHydrationWarning
144
147
  }) => {
145
148
  const [loading, setLoading] = useState(false);
146
149
  const ElementType = href ? "a" : "button";
@@ -166,6 +169,7 @@ var IconButton = ({
166
169
  rel: newTab ? "noreferrer" : void 0,
167
170
  href,
168
171
  title,
172
+ suppressHydrationWarning,
169
173
  children: [
170
174
  /* @__PURE__ */ jsx3("span", { className: getClassName3("title"), children: title }),
171
175
  children,
@@ -345,7 +349,7 @@ function AlignSelectFallback() {
345
349
  // components/RichTextMenu/controls/AlignSelect/index.tsx
346
350
  import { jsx as jsx10 } from "react/jsx-runtime";
347
351
  var AlignSelectLoaded = lazy(
348
- () => import("./loaded-ZXOU6S6R.mjs").then((m) => ({
352
+ () => import("./loaded-UHVTB6OD.mjs").then((m) => ({
349
353
  default: m.AlignSelectLoaded
350
354
  }))
351
355
  );
@@ -576,7 +580,7 @@ function HeadingSelectFallback() {
576
580
  // components/RichTextMenu/controls/HeadingSelect/index.tsx
577
581
  import { jsx as jsx22 } from "react/jsx-runtime";
578
582
  var HeadingSelectLoaded = lazy2(
579
- () => import("./loaded-EV34KGYJ.mjs").then((m) => ({
583
+ () => import("./loaded-LZUXYAGW.mjs").then((m) => ({
580
584
  default: m.HeadingSelectLoaded
581
585
  }))
582
586
  );
@@ -608,7 +612,7 @@ function ListSelectFallback() {
608
612
  // components/RichTextMenu/controls/ListSelect/index.tsx
609
613
  import { jsx as jsx24 } from "react/jsx-runtime";
610
614
  var ListSelectLoaded = lazy3(
611
- () => import("./loaded-HMSPJUZM.mjs").then((m) => ({
615
+ () => import("./loaded-2HLHDP2G.mjs").then((m) => ({
612
616
  default: m.ListSelectLoaded
613
617
  }))
614
618
  );