@measured/puck 0.21.0-canary.a3dabae1 → 0.21.0-canary.a62292fd

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 (52) hide show
  1. package/dist/Editor-F2LSS6SE.css +403 -0
  2. package/dist/Editor-O447AVCX.mjs +204 -0
  3. package/dist/Render-OFE6QLI2.mjs +55 -0
  4. package/dist/Render-QEMDIDQC.css +101 -0
  5. package/dist/{walk-tree-Cvtjzg9C.d.mts → actions-ONhOkrvf.d.mts} +270 -95
  6. package/dist/{walk-tree-Cvtjzg9C.d.ts → actions-ONhOkrvf.d.ts} +270 -95
  7. package/dist/chunk-2Q4PACDA.mjs +111 -0
  8. package/dist/chunk-62AAYNXG.mjs +63 -0
  9. package/dist/{chunk-V2FU5KB6.mjs → chunk-7GESFTRA.mjs} +5544 -8012
  10. package/dist/chunk-BSDEIOEK.mjs +706 -0
  11. package/dist/chunk-CSSRLPHM.mjs +11 -0
  12. package/dist/chunk-DAQLMM2T.mjs +1722 -0
  13. package/dist/chunk-M6W7YEVX.mjs +95 -0
  14. package/dist/chunk-NLUHDYVR.mjs +416 -0
  15. package/dist/chunk-PLXSMBAA.mjs +53 -0
  16. package/dist/chunk-QAWJTCV5.mjs +33 -0
  17. package/dist/chunk-QBGM4ELA.mjs +528 -0
  18. package/dist/chunk-T3WX7XJ6.mjs +132 -0
  19. package/dist/chunk-V5I7CVLT.mjs +103 -0
  20. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  21. package/dist/chunk-Y656T6AQ.mjs +419 -0
  22. package/dist/full-2GJTAAZE.css +301 -0
  23. package/dist/full-BEMDJKDS.mjs +93 -0
  24. package/dist/index-BEoNHRI1.d.ts +116 -0
  25. package/dist/index-DfxZ7tZF.d.mts +116 -0
  26. package/dist/index.css +640 -761
  27. package/dist/index.d.mts +95 -123
  28. package/dist/index.d.ts +95 -123
  29. package/dist/index.js +8032 -5511
  30. package/dist/index.mjs +28 -15
  31. package/dist/internal.d.mts +27 -0
  32. package/dist/internal.d.ts +27 -0
  33. package/dist/internal.js +908 -0
  34. package/dist/internal.mjs +13 -0
  35. package/dist/loaded-JU3A7Y4L.mjs +57 -0
  36. package/dist/loaded-N3FYGF2Y.mjs +57 -0
  37. package/dist/loaded-OBY7OMS6.mjs +60 -0
  38. package/dist/loaded-RVWBFK7L.css +87 -0
  39. package/dist/no-external.css +640 -761
  40. package/dist/no-external.d.mts +19 -2
  41. package/dist/no-external.d.ts +19 -2
  42. package/dist/no-external.js +8023 -5502
  43. package/dist/no-external.mjs +28 -15
  44. package/dist/rsc.css +101 -0
  45. package/dist/rsc.d.mts +17 -2
  46. package/dist/rsc.d.ts +17 -2
  47. package/dist/rsc.js +437 -57
  48. package/dist/rsc.mjs +18 -9
  49. package/dist/walk-tree-CdriEzFJ.d.mts +29 -0
  50. package/dist/walk-tree-DHbAZ4wF.d.ts +29 -0
  51. package/package.json +31 -4
  52. package/dist/chunk-C24EBUN6.mjs +0 -971
package/dist/rsc.js CHANGED
@@ -34,6 +34,12 @@ var __objRest = (source, exclude) => {
34
34
  }
35
35
  return target;
36
36
  };
37
+ var __esm = (fn, res) => function __init() {
38
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
39
+ };
40
+ var __commonJS = (cb, mod) => function __require() {
41
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
42
+ };
37
43
  var __export = (target, all) => {
38
44
  for (var name in all)
39
45
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -76,6 +82,276 @@ var __async = (__this, __arguments, generator) => {
76
82
  });
77
83
  };
78
84
 
85
+ // ../tsup-config/react-import.js
86
+ var import_react;
87
+ var init_react_import = __esm({
88
+ "../tsup-config/react-import.js"() {
89
+ "use strict";
90
+ import_react = __toESM(require("react"));
91
+ }
92
+ });
93
+
94
+ // ../../node_modules/classnames/index.js
95
+ var require_classnames = __commonJS({
96
+ "../../node_modules/classnames/index.js"(exports2, module2) {
97
+ "use strict";
98
+ init_react_import();
99
+ (function() {
100
+ "use strict";
101
+ var hasOwn = {}.hasOwnProperty;
102
+ function classNames() {
103
+ var classes = "";
104
+ for (var i = 0; i < arguments.length; i++) {
105
+ var arg = arguments[i];
106
+ if (arg) {
107
+ classes = appendClass(classes, parseValue(arg));
108
+ }
109
+ }
110
+ return classes;
111
+ }
112
+ function parseValue(arg) {
113
+ if (typeof arg === "string" || typeof arg === "number") {
114
+ return arg;
115
+ }
116
+ if (typeof arg !== "object") {
117
+ return "";
118
+ }
119
+ if (Array.isArray(arg)) {
120
+ return classNames.apply(null, arg);
121
+ }
122
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
123
+ return arg.toString();
124
+ }
125
+ var classes = "";
126
+ for (var key in arg) {
127
+ if (hasOwn.call(arg, key) && arg[key]) {
128
+ classes = appendClass(classes, key);
129
+ }
130
+ }
131
+ return classes;
132
+ }
133
+ function appendClass(value, newClass) {
134
+ if (!newClass) {
135
+ return value;
136
+ }
137
+ if (value) {
138
+ return value + " " + newClass;
139
+ }
140
+ return value + newClass;
141
+ }
142
+ if (typeof module2 !== "undefined" && module2.exports) {
143
+ classNames.default = classNames;
144
+ module2.exports = classNames;
145
+ } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
146
+ define("classnames", [], function() {
147
+ return classNames;
148
+ });
149
+ } else {
150
+ window.classNames = classNames;
151
+ }
152
+ })();
153
+ }
154
+ });
155
+
156
+ // lib/get-class-name-factory.ts
157
+ var import_classnames, getClassNameFactory, get_class_name_factory_default;
158
+ var init_get_class_name_factory = __esm({
159
+ "lib/get-class-name-factory.ts"() {
160
+ "use strict";
161
+ init_react_import();
162
+ import_classnames = __toESM(require_classnames());
163
+ getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (options = {}) => {
164
+ if (typeof options === "string") {
165
+ const descendant = options;
166
+ const style = styles[`${rootClass}-${descendant}`];
167
+ if (style) {
168
+ return config.baseClass + styles[`${rootClass}-${descendant}`] || "";
169
+ }
170
+ return "";
171
+ } else if (typeof options === "object") {
172
+ const modifiers = options;
173
+ const prefixedModifiers = {};
174
+ for (let modifier in modifiers) {
175
+ prefixedModifiers[styles[`${rootClass}--${modifier}`]] = modifiers[modifier];
176
+ }
177
+ const c = styles[rootClass];
178
+ return config.baseClass + (0, import_classnames.default)(__spreadValues({
179
+ [c]: !!c
180
+ }, prefixedModifiers));
181
+ } else {
182
+ return config.baseClass + styles[rootClass] || "";
183
+ }
184
+ };
185
+ get_class_name_factory_default = getClassNameFactory;
186
+ }
187
+ });
188
+
189
+ // css-module:/home/runner/work/puck/puck/packages/core/components/RichTextEditor/styles.module.css/#css-module-data
190
+ var init_css_module_data = __esm({
191
+ "css-module:/home/runner/work/puck/puck/packages/core/components/RichTextEditor/styles.module.css/#css-module-data"() {
192
+ }
193
+ });
194
+
195
+ // css-module:/home/runner/work/puck/puck/packages/core/components/RichTextEditor/styles.module.css#css-module
196
+ var styles_module_default;
197
+ var init_styles_module = __esm({
198
+ "css-module:/home/runner/work/puck/puck/packages/core/components/RichTextEditor/styles.module.css#css-module"() {
199
+ "use strict";
200
+ init_react_import();
201
+ init_css_module_data();
202
+ styles_module_default = { "RichTextEditor": "_RichTextEditor_1elol_1", "RichTextEditor--editor": "_RichTextEditor--editor_1elol_50", "RichTextEditor--disabled": "_RichTextEditor--disabled_1elol_106", "RichTextEditor--isActive": "_RichTextEditor--isActive_1elol_110", "RichTextEditor-menu": "_RichTextEditor-menu_1elol_116" };
203
+ }
204
+ });
205
+
206
+ // components/RichTextEditor/extension.ts
207
+ var import_core, import_extension_blockquote, import_extension_bold, import_extension_code, import_extension_code_block, import_extension_document, import_extension_hard_break, import_extension_heading, import_extension_horizontal_rule, import_extension_italic, import_extension_link, import_extension_list, import_extension_paragraph, import_extension_strike, import_extension_text, import_extension_text_align, import_extension_underline, defaultPuckRichTextOptions, PuckRichText;
208
+ var init_extension = __esm({
209
+ "components/RichTextEditor/extension.ts"() {
210
+ "use strict";
211
+ init_react_import();
212
+ import_core = require("@tiptap/core");
213
+ import_extension_blockquote = require("@tiptap/extension-blockquote");
214
+ import_extension_bold = require("@tiptap/extension-bold");
215
+ import_extension_code = require("@tiptap/extension-code");
216
+ import_extension_code_block = require("@tiptap/extension-code-block");
217
+ import_extension_document = require("@tiptap/extension-document");
218
+ import_extension_hard_break = require("@tiptap/extension-hard-break");
219
+ import_extension_heading = require("@tiptap/extension-heading");
220
+ import_extension_horizontal_rule = require("@tiptap/extension-horizontal-rule");
221
+ import_extension_italic = require("@tiptap/extension-italic");
222
+ import_extension_link = require("@tiptap/extension-link");
223
+ import_extension_list = require("@tiptap/extension-list");
224
+ import_extension_paragraph = require("@tiptap/extension-paragraph");
225
+ import_extension_strike = require("@tiptap/extension-strike");
226
+ import_extension_text = require("@tiptap/extension-text");
227
+ import_extension_text_align = __toESM(require("@tiptap/extension-text-align"));
228
+ import_extension_underline = require("@tiptap/extension-underline");
229
+ defaultPuckRichTextOptions = {
230
+ textAlign: {
231
+ types: ["heading", "paragraph"]
232
+ }
233
+ };
234
+ PuckRichText = import_core.Extension.create({
235
+ name: "puckRichText",
236
+ addExtensions() {
237
+ const extensions = [];
238
+ const options = __spreadValues(__spreadValues({}, this.options), defaultPuckRichTextOptions);
239
+ if (options.bold !== false) {
240
+ extensions.push(import_extension_bold.Bold.configure(options.bold));
241
+ }
242
+ if (options.blockquote !== false) {
243
+ extensions.push(import_extension_blockquote.Blockquote.configure(options.blockquote));
244
+ }
245
+ if (options.bulletList !== false) {
246
+ extensions.push(import_extension_list.BulletList.configure(options.bulletList));
247
+ }
248
+ if (options.code !== false) {
249
+ extensions.push(import_extension_code.Code.configure(options.code));
250
+ }
251
+ if (options.codeBlock !== false) {
252
+ extensions.push(import_extension_code_block.CodeBlock.configure(options.codeBlock));
253
+ }
254
+ if (options.document !== false) {
255
+ extensions.push(import_extension_document.Document.configure(options.document));
256
+ }
257
+ if (options.hardBreak !== false) {
258
+ extensions.push(import_extension_hard_break.HardBreak.configure(options.hardBreak));
259
+ }
260
+ if (options.heading !== false) {
261
+ extensions.push(import_extension_heading.Heading.configure(options.heading));
262
+ }
263
+ if (options.horizontalRule !== false) {
264
+ extensions.push(import_extension_horizontal_rule.HorizontalRule.configure(options.horizontalRule));
265
+ }
266
+ if (options.italic !== false) {
267
+ extensions.push(import_extension_italic.Italic.configure(options.italic));
268
+ }
269
+ if (options.listItem !== false) {
270
+ extensions.push(import_extension_list.ListItem.configure(options.listItem));
271
+ }
272
+ if (options.listKeymap !== false) {
273
+ extensions.push(import_extension_list.ListKeymap.configure(options == null ? void 0 : options.listKeymap));
274
+ }
275
+ if (options.link !== false) {
276
+ extensions.push(import_extension_link.Link.configure(options == null ? void 0 : options.link));
277
+ }
278
+ if (options.orderedList !== false) {
279
+ extensions.push(import_extension_list.OrderedList.configure(options.orderedList));
280
+ }
281
+ if (options.paragraph !== false) {
282
+ extensions.push(import_extension_paragraph.Paragraph.configure(options.paragraph));
283
+ }
284
+ if (options.strike !== false) {
285
+ extensions.push(import_extension_strike.Strike.configure(options.strike));
286
+ }
287
+ if (options.text !== false) {
288
+ extensions.push(import_extension_text.Text.configure(options.text));
289
+ }
290
+ if (options.textAlign !== false) {
291
+ extensions.push(import_extension_text_align.default.configure(options.textAlign));
292
+ }
293
+ if (options.underline !== false) {
294
+ extensions.push(import_extension_underline.Underline.configure(options == null ? void 0 : options.underline));
295
+ }
296
+ return extensions;
297
+ }
298
+ });
299
+ }
300
+ });
301
+
302
+ // components/RichTextEditor/components/Render.tsx
303
+ var Render_exports = {};
304
+ __export(Render_exports, {
305
+ RichTextRender: () => RichTextRender
306
+ });
307
+ function RichTextRender({
308
+ content,
309
+ field
310
+ }) {
311
+ const { tiptap = {}, options } = field;
312
+ const { extensions = [] } = tiptap;
313
+ const loadedExtensions = (0, import_react3.useMemo)(
314
+ () => [PuckRichText.configure(options), ...extensions],
315
+ [field, extensions]
316
+ );
317
+ const normalized = (0, import_react3.useMemo)(() => {
318
+ if (typeof content === "object" && (content == null ? void 0 : content.type) === "doc") {
319
+ return content;
320
+ }
321
+ if (typeof content === "string") {
322
+ const isHtml = /<\/?[a-z][\s\S]*>/i.test(content);
323
+ if (isHtml) {
324
+ return (0, import_html.generateJSON)(content, loadedExtensions);
325
+ }
326
+ return {
327
+ type: "doc",
328
+ content: [
329
+ { type: "paragraph", content: [{ type: "text", text: content }] }
330
+ ]
331
+ };
332
+ }
333
+ return { type: "doc", content: [] };
334
+ }, [content, loadedExtensions]);
335
+ const html = (0, import_react3.useMemo)(() => {
336
+ return (0, import_html.generateHTML)(normalized, loadedExtensions);
337
+ }, [normalized, loadedExtensions]);
338
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: getClassName2(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "rich-text", dangerouslySetInnerHTML: { __html: html } }) });
339
+ }
340
+ var import_html, import_react3, import_jsx_runtime2, getClassName2;
341
+ var init_Render = __esm({
342
+ "components/RichTextEditor/components/Render.tsx"() {
343
+ "use strict";
344
+ init_react_import();
345
+ import_html = require("@tiptap/html");
346
+ import_react3 = require("react");
347
+ init_get_class_name_factory();
348
+ init_styles_module();
349
+ init_extension();
350
+ import_jsx_runtime2 = require("react/jsx-runtime");
351
+ getClassName2 = get_class_name_factory_default("RichTextEditor", styles_module_default);
352
+ }
353
+ });
354
+
79
355
  // bundle/rsc.tsx
80
356
  var rsc_exports = {};
81
357
  __export(rsc_exports, {
@@ -86,16 +362,19 @@ __export(rsc_exports, {
86
362
  walkTree: () => walkTree
87
363
  });
88
364
  module.exports = __toCommonJS(rsc_exports);
365
+ init_react_import();
89
366
 
90
- // ../tsup-config/react-import.js
91
- var import_react = __toESM(require("react"));
367
+ // components/ServerRender/index.tsx
368
+ init_react_import();
92
369
 
93
370
  // lib/root-droppable-id.ts
371
+ init_react_import();
94
372
  var rootAreaId = "root";
95
373
  var rootZone = "default-zone";
96
374
  var rootDroppableId = `${rootAreaId}:${rootZone}`;
97
375
 
98
376
  // lib/data/setup-zone.ts
377
+ init_react_import();
99
378
  var setupZone = (data, zoneKey) => {
100
379
  if (zoneKey === rootDroppableId) {
101
380
  return data;
@@ -107,10 +386,18 @@ var setupZone = (data, zoneKey) => {
107
386
  return newData;
108
387
  };
109
388
 
389
+ // lib/use-slots.tsx
390
+ init_react_import();
391
+
110
392
  // lib/field-transforms/use-field-transforms.tsx
393
+ init_react_import();
111
394
  var import_react2 = require("react");
112
395
 
396
+ // lib/data/map-fields.ts
397
+ init_react_import();
398
+
113
399
  // lib/data/default-slots.ts
400
+ init_react_import();
114
401
  var defaultSlots = (value, fields) => Object.keys(fields).reduce(
115
402
  (acc, fieldName) => fields[fieldName].type === "slot" ? __spreadValues({ [fieldName]: [] }, acc) : acc,
116
403
  value
@@ -130,32 +417,27 @@ var walkField = ({
130
417
  config,
131
418
  recurseSlots = false
132
419
  }) => {
133
- var _a, _b, _c, _d, _e;
420
+ var _a, _b, _c;
134
421
  const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
135
422
  const map = mappers[fieldType];
136
423
  if (map && fieldType === "slot") {
137
424
  const content = value || [];
138
- let mappedContent = content;
139
- if (recurseSlots) {
140
- for (let i = 0; i < content.length; i++) {
141
- const el = content[i];
142
- const componentConfig = config.components[el.type];
143
- if (!componentConfig || !((_b = el.props) == null ? void 0 : _b.id)) {
144
- continue;
145
- }
146
- const fields2 = (_c = componentConfig.fields) != null ? _c : {};
147
- mappedContent.push(
148
- walkField({
149
- value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
150
- fields: fields2,
151
- mappers,
152
- id: el.props.id,
153
- config,
154
- recurseSlots
155
- })
156
- );
425
+ const mappedContent = recurseSlots ? content.map((el) => {
426
+ var _a2;
427
+ const componentConfig = config.components[el.type];
428
+ if (!componentConfig) {
429
+ throw new Error(`Could not find component config for ${el.type}`);
157
430
  }
158
- }
431
+ const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
432
+ return walkField({
433
+ value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
434
+ fields: fields2,
435
+ mappers,
436
+ id: el.props.id,
437
+ config,
438
+ recurseSlots
439
+ });
440
+ }) : content;
159
441
  if (containsPromise(mappedContent)) {
160
442
  return Promise.all(mappedContent);
161
443
  }
@@ -177,7 +459,7 @@ var walkField = ({
177
459
  }
178
460
  if (value && typeof value === "object") {
179
461
  if (Array.isArray(value)) {
180
- const arrayFields = ((_d = fields[propKey]) == null ? void 0 : _d.type) === "array" ? fields[propKey].arrayFields : null;
462
+ const arrayFields = ((_b = fields[propKey]) == null ? void 0 : _b.type) === "array" ? fields[propKey].arrayFields : null;
181
463
  if (!arrayFields) return value;
182
464
  const newValue = value.map(
183
465
  (el, idx) => walkField({
@@ -198,7 +480,7 @@ var walkField = ({
198
480
  } else if ("$$typeof" in value) {
199
481
  return value;
200
482
  } else {
201
- const objectFields = ((_e = fields[propKey]) == null ? void 0 : _e.type) === "object" ? fields[propKey].objectFields : fields;
483
+ const objectFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "object" ? fields[propKey].objectFields : fields;
202
484
  return walkObject({
203
485
  value,
204
486
  fields: objectFields,
@@ -305,6 +587,7 @@ function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
305
587
  }
306
588
 
307
589
  // lib/field-transforms/default-transforms/slot-transform.tsx
590
+ init_react_import();
308
591
  var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
309
592
  slot: ({ value: content, propName, field, isReadOnly }) => {
310
593
  const render = isReadOnly ? renderSlotRender : renderSlotEdit;
@@ -331,32 +614,92 @@ function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdi
331
614
  }
332
615
 
333
616
  // components/SlotRender/server.tsx
334
- var import_react3 = require("react");
617
+ init_react_import();
618
+ var import_react5 = require("react");
619
+
620
+ // components/RichTextEditor/lib/use-richtext-props.tsx
621
+ init_react_import();
622
+ var import_react4 = require("react");
623
+
624
+ // components/RichTextEditor/components/RenderFallback.tsx
625
+ init_react_import();
626
+ init_get_class_name_factory();
627
+ init_styles_module();
335
628
  var import_jsx_runtime = require("react/jsx-runtime");
336
- var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlotRender, __spreadValues({}, props));
629
+ var getClassName = get_class_name_factory_default("RichTextEditor", styles_module_default);
630
+ function RichTextRenderFallback({ content }) {
631
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
632
+ "div",
633
+ {
634
+ className: "rich-text",
635
+ dangerouslySetInnerHTML: { __html: content }
636
+ }
637
+ ) });
638
+ }
639
+
640
+ // components/RichTextEditor/lib/use-richtext-props.tsx
641
+ var import_jsx_runtime3 = require("react/jsx-runtime");
642
+ function useRichtextProps(fields, props) {
643
+ const findAllRichtextKeys = (fields2) => {
644
+ if (!fields2) return [];
645
+ const result = [];
646
+ for (const [key, field] of Object.entries(fields2)) {
647
+ if (field.type === "richtext") {
648
+ result.push(key);
649
+ }
650
+ }
651
+ return result;
652
+ };
653
+ const richtextKeys = (0, import_react4.useMemo)(() => findAllRichtextKeys(fields), [fields]);
654
+ const richtextProps = (0, import_react4.useMemo)(() => {
655
+ if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
656
+ const RichTextRender2 = (0, import_react4.lazy)(
657
+ () => Promise.resolve().then(() => (init_Render(), Render_exports)).then((m) => ({
658
+ default: m.RichTextRender
659
+ }))
660
+ );
661
+ return richtextKeys.reduce((acc, key) => {
662
+ acc[key] = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react4.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RichTextRenderFallback, { content: props[key] }), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
663
+ RichTextRender2,
664
+ {
665
+ content: props[key],
666
+ field: fields[key]
667
+ }
668
+ ) });
669
+ return acc;
670
+ }, {});
671
+ }, [richtextKeys, props, fields]);
672
+ return richtextProps;
673
+ }
674
+
675
+ // components/SlotRender/server.tsx
676
+ var import_jsx_runtime4 = require("react/jsx-runtime");
677
+ var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SlotRender, __spreadValues({}, props));
337
678
  var Item = ({
338
679
  config,
339
680
  item,
340
681
  metadata
341
682
  }) => {
342
683
  const Component = config.components[item.type];
343
- const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
344
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
684
+ const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
685
+ const richtextProps = useRichtextProps(Component.fields, props);
686
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
345
687
  Component.render,
346
- __spreadProps(__spreadValues({}, props), {
688
+ __spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
347
689
  puck: __spreadProps(__spreadValues({}, props.puck), {
348
690
  metadata: metadata || {}
349
691
  })
350
692
  })
351
693
  );
352
694
  };
353
- var SlotRender = (0, import_react3.forwardRef)(
354
- function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
355
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className, style, ref, children: content.map((item) => {
695
+ var SlotRender = (0, import_react5.forwardRef)(
696
+ function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
697
+ const El = as != null ? as : "div";
698
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(El, { className, style, ref, children: content.map((item) => {
356
699
  if (!config.components[item.type]) {
357
700
  return null;
358
701
  }
359
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
702
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
360
703
  Item,
361
704
  {
362
705
  config,
@@ -370,7 +713,7 @@ var SlotRender = (0, import_react3.forwardRef)(
370
713
  );
371
714
 
372
715
  // components/ServerRender/index.tsx
373
- var import_jsx_runtime2 = require("react/jsx-runtime");
716
+ var import_jsx_runtime5 = require("react/jsx-runtime");
374
717
  function DropZoneRender({
375
718
  zone,
376
719
  data,
@@ -387,11 +730,11 @@ function DropZoneRender({
387
730
  zoneCompound = `${areaId}:${zone}`;
388
731
  content = setupZone(data, zoneCompound).zones[zoneCompound];
389
732
  }
390
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: content.map((item) => {
733
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: content.map((item) => {
391
734
  const Component = config.components[item.type];
392
735
  const props = __spreadProps(__spreadValues({}, item.props), {
393
736
  puck: {
394
- renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
737
+ renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
395
738
  DropZoneRender,
396
739
  {
397
740
  zone: zone2,
@@ -407,9 +750,9 @@ function DropZoneRender({
407
750
  }
408
751
  });
409
752
  const renderItem = __spreadProps(__spreadValues({}, item), { props });
410
- const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
753
+ const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
411
754
  if (Component) {
412
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
755
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
413
756
  }
414
757
  return null;
415
758
  }) });
@@ -419,12 +762,12 @@ function Render({
419
762
  data,
420
763
  metadata = {}
421
764
  }) {
422
- var _a;
765
+ var _a, _b;
423
766
  const rootProps = "props" in data.root ? data.root.props : data.root;
424
767
  const title = rootProps.title || "";
425
768
  const props = __spreadProps(__spreadValues({}, rootProps), {
426
769
  puck: {
427
- renderDropZone: ({ zone }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
770
+ renderDropZone: ({ zone }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
428
771
  DropZoneRender,
429
772
  {
430
773
  zone,
@@ -441,9 +784,10 @@ function Render({
441
784
  editMode: false,
442
785
  id: "puck-root"
443
786
  });
444
- const propsWithSlots = useSlots(config, { type: "root", props }, (props2) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
445
- if ((_a = config.root) == null ? void 0 : _a.render) {
446
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(config.root.render, __spreadProps(__spreadValues({}, propsWithSlots), { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
787
+ const propsWithSlots = useSlots(config, { type: "root", props }, (props2) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
788
+ const richtextProps = useRichtextProps((_a = config.root) == null ? void 0 : _a.fields, props);
789
+ if ((_b = config.root) == null ? void 0 : _b.render) {
790
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(config.root.render, __spreadProps(__spreadValues(__spreadValues({}, propsWithSlots), richtextProps), { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
447
791
  DropZoneRender,
448
792
  {
449
793
  config,
@@ -453,7 +797,7 @@ function Render({
453
797
  }
454
798
  ) }));
455
799
  }
456
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
800
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
457
801
  DropZoneRender,
458
802
  {
459
803
  config,
@@ -464,7 +808,14 @@ function Render({
464
808
  );
465
809
  }
466
810
 
811
+ // lib/resolve-all-data.ts
812
+ init_react_import();
813
+
814
+ // lib/resolve-component-data.ts
815
+ init_react_import();
816
+
467
817
  // lib/get-changed.ts
818
+ init_react_import();
468
819
  var import_fast_equals = require("fast-equals");
469
820
  var getChanged = (newItem, oldItem) => {
470
821
  return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
@@ -479,7 +830,7 @@ var getChanged = (newItem, oldItem) => {
479
830
  // lib/resolve-component-data.ts
480
831
  var import_fast_equals2 = require("fast-equals");
481
832
  var cache = { lastChange: {} };
482
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
833
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
483
834
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
484
835
  const resolvedItem = __spreadValues({}, item);
485
836
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
@@ -507,11 +858,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
507
858
  let itemWithResolvedChildren = yield mapFields(
508
859
  resolvedItem,
509
860
  {
510
- slot: (_02) => __async(void 0, [_02], function* ({ value }) {
861
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
511
862
  const content = value;
512
863
  return yield Promise.all(
513
864
  content.map(
514
- (childItem) => __async(void 0, null, function* () {
865
+ (childItem) => __async(null, null, function* () {
515
866
  return (yield resolveComponentData(
516
867
  childItem,
517
868
  config,
@@ -541,12 +892,14 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
541
892
  });
542
893
 
543
894
  // lib/data/default-data.ts
895
+ init_react_import();
544
896
  var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
545
897
  root: data.root || {},
546
898
  content: data.content || []
547
899
  });
548
900
 
549
901
  // lib/data/to-component.ts
902
+ init_react_import();
550
903
  var toComponent = (item) => {
551
904
  return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
552
905
  props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
@@ -559,7 +912,7 @@ function resolveAllData(_0, _1) {
559
912
  return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
560
913
  var _a;
561
914
  const defaultedData = defaultData(data);
562
- const resolveNode = (_node) => __async(this, null, function* () {
915
+ const resolveNode = (_node) => __async(null, null, function* () {
563
916
  const node = toComponent(_node);
564
917
  onResolveStart == null ? void 0 : onResolveStart(node);
565
918
  const resolved = (yield resolveComponentData(
@@ -580,13 +933,13 @@ function resolveAllData(_0, _1) {
580
933
  onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
581
934
  return resolvedDeep;
582
935
  });
583
- const processContent = (content) => __async(this, null, function* () {
936
+ const processContent = (content) => __async(null, null, function* () {
584
937
  return Promise.all(content.map(resolveNode));
585
938
  });
586
- const processZones = () => __async(this, null, function* () {
939
+ const processZones = () => __async(null, null, function* () {
587
940
  var _a2;
588
941
  const zones = (_a2 = data.zones) != null ? _a2 : {};
589
- Object.entries(zones).forEach((_02) => __async(this, [_02], function* ([zoneKey, content]) {
942
+ Object.entries(zones).forEach((_02) => __async(null, [_02], function* ([zoneKey, content]) {
590
943
  zones[zoneKey] = yield Promise.all(content.map(resolveNode));
591
944
  }));
592
945
  return zones;
@@ -596,7 +949,7 @@ function resolveAllData(_0, _1) {
596
949
  content: yield processContent(defaultedData.content),
597
950
  zones: yield processZones()
598
951
  };
599
- Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(this, null, function* () {
952
+ Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(null, null, function* () {
600
953
  const content = defaultedData.zones[zoneKey];
601
954
  dynamic.zones[zoneKey] = yield processContent(content);
602
955
  }), {});
@@ -604,7 +957,11 @@ function resolveAllData(_0, _1) {
604
957
  });
605
958
  }
606
959
 
960
+ // lib/transform-props.ts
961
+ init_react_import();
962
+
607
963
  // lib/data/walk-tree.ts
964
+ init_react_import();
608
965
  function walkTree(data, config, callbackFn) {
609
966
  var _a, _b;
610
967
  const walkItem = (item) => {
@@ -672,12 +1029,18 @@ function transformProps(data, propTransforms, config = { components: {} }) {
672
1029
  return updatedData;
673
1030
  }
674
1031
 
1032
+ // lib/migrate.ts
1033
+ init_react_import();
1034
+
1035
+ // store/default-app-state.ts
1036
+ init_react_import();
1037
+
675
1038
  // components/ViewportControls/default-viewports.ts
1039
+ init_react_import();
676
1040
  var defaultViewports = [
677
1041
  { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
678
1042
  { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
679
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
680
- { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
1043
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
681
1044
  ];
682
1045
 
683
1046
  // store/default-app-state.ts
@@ -699,8 +1062,7 @@ var defaultAppState = {
699
1062
  options: [],
700
1063
  controlsVisible: true
701
1064
  },
702
- field: { focus: null },
703
- plugin: { current: null }
1065
+ field: { focus: null }
704
1066
  },
705
1067
  indexes: {
706
1068
  nodes: {},
@@ -708,7 +1070,14 @@ var defaultAppState = {
708
1070
  }
709
1071
  };
710
1072
 
1073
+ // lib/data/walk-app-state.ts
1074
+ init_react_import();
1075
+
1076
+ // lib/data/for-related-zones.ts
1077
+ init_react_import();
1078
+
711
1079
  // lib/get-zone-id.ts
1080
+ init_react_import();
712
1081
  var getZoneId = (zoneCompound) => {
713
1082
  if (!zoneCompound) {
714
1083
  return [];
@@ -730,9 +1099,11 @@ function forRelatedZones(item, data, cb, path = []) {
730
1099
  }
731
1100
 
732
1101
  // lib/data/flatten-node.ts
1102
+ init_react_import();
733
1103
  var import_flat = __toESM(require("flat"));
734
1104
 
735
1105
  // lib/data/strip-slots.ts
1106
+ init_react_import();
736
1107
  var stripSlots = (data, config) => {
737
1108
  return mapFields(data, { slot: () => null }, config);
738
1109
  };
@@ -1000,3 +1371,12 @@ function migrate(data, config, migrationOptions) {
1000
1371
  transformProps,
1001
1372
  walkTree
1002
1373
  });
1374
+ /*! Bundled license information:
1375
+
1376
+ classnames/index.js:
1377
+ (*!
1378
+ Copyright (c) 2018 Jed Watson.
1379
+ Licensed under the MIT License (MIT), see
1380
+ http://jedwatson.github.io/classnames
1381
+ *)
1382
+ */