@measured/puck 0.21.0-canary.c6d4e0ec → 0.21.0-canary.cbc526d1
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.
- package/dist/Editor-32UYWE6W.mjs +204 -0
- package/dist/Editor-IQP25PUX.css +404 -0
- package/dist/Render-3OV4N4MT.css +102 -0
- package/dist/Render-FXZX6NFH.mjs +55 -0
- package/dist/{walk-tree-Ctf3FZQI.d.mts → actions-BkBoKAc5.d.mts} +287 -83
- package/dist/{walk-tree-Ctf3FZQI.d.ts → actions-BkBoKAc5.d.ts} +287 -83
- package/dist/chunk-3VQHXASI.mjs +33 -0
- package/dist/chunk-6KNQXLQR.mjs +708 -0
- package/dist/chunk-AOEDIUVK.mjs +11 -0
- package/dist/chunk-GVKHZNTR.mjs +53 -0
- package/dist/chunk-K562SEXI.mjs +1813 -0
- package/dist/chunk-KN3XDS7U.mjs +528 -0
- package/dist/chunk-M6W7YEVX.mjs +95 -0
- package/dist/chunk-MEL7FUSF.mjs +63 -0
- package/dist/chunk-NYGQH27S.mjs +445 -0
- package/dist/chunk-Q3TJ2VYO.mjs +436 -0
- package/dist/chunk-REWRIUGR.mjs +156 -0
- package/dist/chunk-V2IQTPPK.mjs +111 -0
- package/dist/chunk-V5I7CVLT.mjs +103 -0
- package/dist/{chunk-HNR5CJAZ.mjs → chunk-WD3LNSAC.mjs} +7041 -8151
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/full-2GJTAAZE.css +301 -0
- package/dist/full-4OS3O57Y.mjs +93 -0
- package/dist/index-bqD1SEOb.d.mts +118 -0
- package/dist/index-lt1zf5WR.d.ts +118 -0
- package/dist/index.css +1032 -385
- package/dist/index.d.mts +118 -114
- package/dist/index.d.ts +118 -114
- package/dist/index.js +9823 -5714
- package/dist/index.mjs +34 -12
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +927 -0
- package/dist/internal.mjs +13 -0
- package/dist/loaded-DCQVLO7I.mjs +57 -0
- package/dist/loaded-JGRO7BH7.mjs +57 -0
- package/dist/loaded-KKVJE5KH.mjs +60 -0
- package/dist/loaded-RVWBFK7L.css +87 -0
- package/dist/no-external.css +1121 -470
- package/dist/no-external.d.mts +19 -2
- package/dist/no-external.d.ts +19 -2
- package/dist/no-external.js +9825 -5713
- package/dist/no-external.mjs +36 -9
- package/dist/rsc.css +102 -0
- package/dist/rsc.d.mts +17 -2
- package/dist/rsc.d.ts +17 -2
- package/dist/rsc.js +551 -101
- package/dist/rsc.mjs +18 -9
- package/dist/walk-tree-CRRDqx6_.d.mts +29 -0
- package/dist/walk-tree-CS7sEpfG.d.ts +29 -0
- package/package.json +31 -4
- package/dist/chunk-X7YZ3YE7.mjs +0 -964
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_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" };
|
|
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
|
-
//
|
|
91
|
-
|
|
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
|
|
@@ -242,12 +529,12 @@ var walkObject = ({
|
|
|
242
529
|
}
|
|
243
530
|
return flatten(newProps);
|
|
244
531
|
};
|
|
245
|
-
function mapFields(item, mappers, config, recurseSlots = false) {
|
|
532
|
+
function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true) {
|
|
246
533
|
var _a, _b, _c, _d, _e;
|
|
247
534
|
const itemType = "type" in item ? item.type : "root";
|
|
248
535
|
const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
|
|
249
536
|
const newProps = walkObject({
|
|
250
|
-
value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
|
|
537
|
+
value: shouldDefaultSlots ? defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}) : item.props,
|
|
251
538
|
fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
|
|
252
539
|
mappers,
|
|
253
540
|
id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
|
|
@@ -265,32 +552,38 @@ function mapFields(item, mappers, config, recurseSlots = false) {
|
|
|
265
552
|
});
|
|
266
553
|
}
|
|
267
554
|
|
|
555
|
+
// lib/field-transforms/build-mappers.ts
|
|
556
|
+
init_react_import();
|
|
557
|
+
function buildMappers(transforms, readOnly, forceReadOnly) {
|
|
558
|
+
return Object.keys(transforms).reduce((acc, _fieldType) => {
|
|
559
|
+
const fieldType = _fieldType;
|
|
560
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
561
|
+
[fieldType]: (_a) => {
|
|
562
|
+
var _b = _a, {
|
|
563
|
+
parentId
|
|
564
|
+
} = _b, params = __objRest(_b, [
|
|
565
|
+
"parentId"
|
|
566
|
+
]);
|
|
567
|
+
const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
|
|
568
|
+
const isReadOnly = (readOnly == null ? void 0 : readOnly[params.propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly || false;
|
|
569
|
+
const fn = transforms[fieldType];
|
|
570
|
+
return fn == null ? void 0 : fn(__spreadProps(__spreadValues({}, params), {
|
|
571
|
+
isReadOnly,
|
|
572
|
+
componentId: parentId
|
|
573
|
+
}));
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
}, {});
|
|
577
|
+
}
|
|
578
|
+
|
|
268
579
|
// lib/field-transforms/use-field-transforms.tsx
|
|
269
580
|
function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
270
|
-
const mappers = (0, import_react2.useMemo)(
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
[fieldType]: (_a) => {
|
|
275
|
-
var _b = _a, {
|
|
276
|
-
parentId
|
|
277
|
-
} = _b, params = __objRest(_b, [
|
|
278
|
-
"parentId"
|
|
279
|
-
]);
|
|
280
|
-
const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
|
|
281
|
-
const isReadOnly = (readOnly == null ? void 0 : readOnly[params.propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly || false;
|
|
282
|
-
const fn = transforms[fieldType];
|
|
283
|
-
return fn == null ? void 0 : fn(__spreadProps(__spreadValues({}, params), {
|
|
284
|
-
isReadOnly,
|
|
285
|
-
componentId: parentId
|
|
286
|
-
}));
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
}, {});
|
|
290
|
-
}, [transforms, readOnly, forceReadOnly]);
|
|
581
|
+
const mappers = (0, import_react2.useMemo)(
|
|
582
|
+
() => buildMappers(transforms, readOnly, forceReadOnly),
|
|
583
|
+
[transforms, readOnly, forceReadOnly]
|
|
584
|
+
);
|
|
291
585
|
const transformedProps = (0, import_react2.useMemo)(() => {
|
|
292
|
-
|
|
293
|
-
return mapped;
|
|
586
|
+
return mapFields(item, mappers, config).props;
|
|
294
587
|
}, [config, item, mappers]);
|
|
295
588
|
const mergedProps = (0, import_react2.useMemo)(
|
|
296
589
|
() => __spreadValues(__spreadValues({}, item.props), transformedProps),
|
|
@@ -300,6 +593,7 @@ function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
|
300
593
|
}
|
|
301
594
|
|
|
302
595
|
// lib/field-transforms/default-transforms/slot-transform.tsx
|
|
596
|
+
init_react_import();
|
|
303
597
|
var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
304
598
|
slot: ({ value: content, propName, field, isReadOnly }) => {
|
|
305
599
|
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
|
@@ -326,32 +620,92 @@ function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdi
|
|
|
326
620
|
}
|
|
327
621
|
|
|
328
622
|
// components/SlotRender/server.tsx
|
|
329
|
-
|
|
623
|
+
init_react_import();
|
|
624
|
+
var import_react5 = require("react");
|
|
625
|
+
|
|
626
|
+
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
627
|
+
init_react_import();
|
|
628
|
+
var import_react4 = require("react");
|
|
629
|
+
|
|
630
|
+
// components/RichTextEditor/components/RenderFallback.tsx
|
|
631
|
+
init_react_import();
|
|
632
|
+
init_get_class_name_factory();
|
|
633
|
+
init_styles_module();
|
|
330
634
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
331
|
-
var
|
|
635
|
+
var getClassName = get_class_name_factory_default("RichTextEditor", styles_module_default);
|
|
636
|
+
function RichTextRenderFallback({ content }) {
|
|
637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
638
|
+
"div",
|
|
639
|
+
{
|
|
640
|
+
className: "rich-text",
|
|
641
|
+
dangerouslySetInnerHTML: { __html: content }
|
|
642
|
+
}
|
|
643
|
+
) });
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
647
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
648
|
+
function useRichtextProps(fields, props) {
|
|
649
|
+
const findAllRichtextKeys = (fields2) => {
|
|
650
|
+
if (!fields2) return [];
|
|
651
|
+
const result = [];
|
|
652
|
+
for (const [key, field] of Object.entries(fields2)) {
|
|
653
|
+
if (field.type === "richtext") {
|
|
654
|
+
result.push(key);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
return result;
|
|
658
|
+
};
|
|
659
|
+
const richtextKeys = (0, import_react4.useMemo)(() => findAllRichtextKeys(fields), [fields]);
|
|
660
|
+
const richtextProps = (0, import_react4.useMemo)(() => {
|
|
661
|
+
if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
|
|
662
|
+
const RichTextRender2 = (0, import_react4.lazy)(
|
|
663
|
+
() => Promise.resolve().then(() => (init_Render(), Render_exports)).then((m) => ({
|
|
664
|
+
default: m.RichTextRender
|
|
665
|
+
}))
|
|
666
|
+
);
|
|
667
|
+
return richtextKeys.reduce((acc, key) => {
|
|
668
|
+
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)(
|
|
669
|
+
RichTextRender2,
|
|
670
|
+
{
|
|
671
|
+
content: props[key],
|
|
672
|
+
field: fields[key]
|
|
673
|
+
}
|
|
674
|
+
) });
|
|
675
|
+
return acc;
|
|
676
|
+
}, {});
|
|
677
|
+
}, [richtextKeys, props, fields]);
|
|
678
|
+
return richtextProps;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
// components/SlotRender/server.tsx
|
|
682
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
683
|
+
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SlotRender, __spreadValues({}, props));
|
|
332
684
|
var Item = ({
|
|
333
685
|
config,
|
|
334
686
|
item,
|
|
335
687
|
metadata
|
|
336
688
|
}) => {
|
|
337
689
|
const Component = config.components[item.type];
|
|
338
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0,
|
|
339
|
-
|
|
690
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
691
|
+
const richtextProps = useRichtextProps(Component.fields, props);
|
|
692
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
340
693
|
Component.render,
|
|
341
|
-
__spreadProps(__spreadValues({}, props), {
|
|
694
|
+
__spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
|
|
342
695
|
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
343
696
|
metadata: metadata || {}
|
|
344
697
|
})
|
|
345
698
|
})
|
|
346
699
|
);
|
|
347
700
|
};
|
|
348
|
-
var SlotRender = (0,
|
|
349
|
-
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
|
350
|
-
|
|
701
|
+
var SlotRender = (0, import_react5.forwardRef)(
|
|
702
|
+
function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
|
|
703
|
+
const El = as != null ? as : "div";
|
|
704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(El, { className, style, ref, children: content.map((item) => {
|
|
351
705
|
if (!config.components[item.type]) {
|
|
352
706
|
return null;
|
|
353
707
|
}
|
|
354
|
-
return /* @__PURE__ */ (0,
|
|
708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
355
709
|
Item,
|
|
356
710
|
{
|
|
357
711
|
config,
|
|
@@ -365,7 +719,7 @@ var SlotRender = (0, import_react3.forwardRef)(
|
|
|
365
719
|
);
|
|
366
720
|
|
|
367
721
|
// components/ServerRender/index.tsx
|
|
368
|
-
var
|
|
722
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
369
723
|
function DropZoneRender({
|
|
370
724
|
zone,
|
|
371
725
|
data,
|
|
@@ -382,11 +736,11 @@ function DropZoneRender({
|
|
|
382
736
|
zoneCompound = `${areaId}:${zone}`;
|
|
383
737
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
384
738
|
}
|
|
385
|
-
return /* @__PURE__ */ (0,
|
|
739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: content.map((item) => {
|
|
386
740
|
const Component = config.components[item.type];
|
|
387
741
|
const props = __spreadProps(__spreadValues({}, item.props), {
|
|
388
742
|
puck: {
|
|
389
|
-
renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0,
|
|
743
|
+
renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
390
744
|
DropZoneRender,
|
|
391
745
|
{
|
|
392
746
|
zone: zone2,
|
|
@@ -402,9 +756,9 @@ function DropZoneRender({
|
|
|
402
756
|
}
|
|
403
757
|
});
|
|
404
758
|
const renderItem = __spreadProps(__spreadValues({}, item), { props });
|
|
405
|
-
const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ (0,
|
|
759
|
+
const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
|
406
760
|
if (Component) {
|
|
407
|
-
return /* @__PURE__ */ (0,
|
|
761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
|
|
408
762
|
}
|
|
409
763
|
return null;
|
|
410
764
|
}) });
|
|
@@ -414,12 +768,12 @@ function Render({
|
|
|
414
768
|
data,
|
|
415
769
|
metadata = {}
|
|
416
770
|
}) {
|
|
417
|
-
var _a;
|
|
771
|
+
var _a, _b;
|
|
418
772
|
const rootProps = "props" in data.root ? data.root.props : data.root;
|
|
419
773
|
const title = rootProps.title || "";
|
|
420
774
|
const props = __spreadProps(__spreadValues({}, rootProps), {
|
|
421
775
|
puck: {
|
|
422
|
-
renderDropZone: ({ zone }) => /* @__PURE__ */ (0,
|
|
776
|
+
renderDropZone: ({ zone }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
423
777
|
DropZoneRender,
|
|
424
778
|
{
|
|
425
779
|
zone,
|
|
@@ -436,9 +790,10 @@ function Render({
|
|
|
436
790
|
editMode: false,
|
|
437
791
|
id: "puck-root"
|
|
438
792
|
});
|
|
439
|
-
const propsWithSlots = useSlots(config, { type: "root", props }, (props2) => /* @__PURE__ */ (0,
|
|
440
|
-
|
|
441
|
-
|
|
793
|
+
const propsWithSlots = useSlots(config, { type: "root", props }, (props2) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
|
794
|
+
const richtextProps = useRichtextProps((_a = config.root) == null ? void 0 : _a.fields, props);
|
|
795
|
+
if ((_b = config.root) == null ? void 0 : _b.render) {
|
|
796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(config.root.render, __spreadProps(__spreadValues(__spreadValues({}, propsWithSlots), richtextProps), { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
442
797
|
DropZoneRender,
|
|
443
798
|
{
|
|
444
799
|
config,
|
|
@@ -448,7 +803,7 @@ function Render({
|
|
|
448
803
|
}
|
|
449
804
|
) }));
|
|
450
805
|
}
|
|
451
|
-
return /* @__PURE__ */ (0,
|
|
806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
452
807
|
DropZoneRender,
|
|
453
808
|
{
|
|
454
809
|
config,
|
|
@@ -459,7 +814,23 @@ function Render({
|
|
|
459
814
|
);
|
|
460
815
|
}
|
|
461
816
|
|
|
817
|
+
// lib/resolve-all-data.ts
|
|
818
|
+
init_react_import();
|
|
819
|
+
|
|
820
|
+
// lib/resolve-component-data.ts
|
|
821
|
+
init_react_import();
|
|
822
|
+
|
|
823
|
+
// lib/data/to-component.ts
|
|
824
|
+
init_react_import();
|
|
825
|
+
var toComponent = (item) => {
|
|
826
|
+
return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
|
|
827
|
+
props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
|
|
828
|
+
type: "root"
|
|
829
|
+
});
|
|
830
|
+
};
|
|
831
|
+
|
|
462
832
|
// lib/get-changed.ts
|
|
833
|
+
init_react_import();
|
|
463
834
|
var import_fast_equals = require("fast-equals");
|
|
464
835
|
var getChanged = (newItem, oldItem) => {
|
|
465
836
|
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
|
@@ -474,14 +845,22 @@ var getChanged = (newItem, oldItem) => {
|
|
|
474
845
|
// lib/resolve-component-data.ts
|
|
475
846
|
var import_fast_equals2 = require("fast-equals");
|
|
476
847
|
var cache = { lastChange: {} };
|
|
477
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(
|
|
848
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null) {
|
|
478
849
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
479
850
|
const resolvedItem = __spreadValues({}, item);
|
|
480
851
|
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
481
852
|
const id = "id" in item.props ? item.props.id : "root";
|
|
482
853
|
if (shouldRunResolver) {
|
|
483
|
-
const {
|
|
484
|
-
|
|
854
|
+
const {
|
|
855
|
+
item: oldItem = null,
|
|
856
|
+
resolved = {},
|
|
857
|
+
parentId: oldParentId = null
|
|
858
|
+
} = cache.lastChange[id] || {};
|
|
859
|
+
const isRootOrInserted = oldParentId === null;
|
|
860
|
+
const parentChanged = !isRootOrInserted && (parent == null ? void 0 : parent.props.id) !== oldParentId;
|
|
861
|
+
const dataChanged = item && !(0, import_fast_equals2.deepEqual)(item, oldItem);
|
|
862
|
+
const shouldSkip = trigger === "move" && !parentChanged || trigger !== "move" && trigger !== "force" && !dataChanged;
|
|
863
|
+
if (shouldSkip) {
|
|
485
864
|
return { node: resolved, didChange: false };
|
|
486
865
|
}
|
|
487
866
|
const changed = getChanged(item, oldItem);
|
|
@@ -492,28 +871,31 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
|
492
871
|
changed,
|
|
493
872
|
lastData: oldItem,
|
|
494
873
|
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
|
495
|
-
trigger
|
|
874
|
+
trigger,
|
|
875
|
+
parent
|
|
496
876
|
});
|
|
497
877
|
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
|
498
878
|
if (Object.keys(readOnly).length) {
|
|
499
879
|
resolvedItem.readOnly = readOnly;
|
|
500
880
|
}
|
|
501
881
|
}
|
|
882
|
+
const itemAsComponentData = toComponent(resolvedItem);
|
|
502
883
|
let itemWithResolvedChildren = yield mapFields(
|
|
503
884
|
resolvedItem,
|
|
504
885
|
{
|
|
505
|
-
slot: (_02) => __async(
|
|
886
|
+
slot: (_02) => __async(null, [_02], function* ({ value }) {
|
|
506
887
|
const content = value;
|
|
507
888
|
return yield Promise.all(
|
|
508
889
|
content.map(
|
|
509
|
-
(childItem) => __async(
|
|
890
|
+
(childItem) => __async(null, null, function* () {
|
|
510
891
|
return (yield resolveComponentData(
|
|
511
892
|
childItem,
|
|
512
893
|
config,
|
|
513
894
|
metadata,
|
|
514
895
|
onResolveStart,
|
|
515
896
|
onResolveEnd,
|
|
516
|
-
trigger
|
|
897
|
+
trigger,
|
|
898
|
+
itemAsComponentData
|
|
517
899
|
)).node;
|
|
518
900
|
})
|
|
519
901
|
)
|
|
@@ -527,7 +909,8 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
|
527
909
|
}
|
|
528
910
|
cache.lastChange[id] = {
|
|
529
911
|
item,
|
|
530
|
-
resolved: itemWithResolvedChildren
|
|
912
|
+
resolved: itemWithResolvedChildren,
|
|
913
|
+
parentId: parent == null ? void 0 : parent.props.id
|
|
531
914
|
};
|
|
532
915
|
return {
|
|
533
916
|
node: itemWithResolvedChildren,
|
|
@@ -535,26 +918,50 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
|
535
918
|
};
|
|
536
919
|
});
|
|
537
920
|
|
|
921
|
+
// lib/group-zones-by-component.ts
|
|
922
|
+
init_react_import();
|
|
923
|
+
|
|
924
|
+
// lib/get-zone-id.ts
|
|
925
|
+
init_react_import();
|
|
926
|
+
var getZoneId = (zoneCompound) => {
|
|
927
|
+
if (!zoneCompound) {
|
|
928
|
+
return [];
|
|
929
|
+
}
|
|
930
|
+
if (zoneCompound && zoneCompound.indexOf(":") > -1) {
|
|
931
|
+
return zoneCompound.split(":");
|
|
932
|
+
}
|
|
933
|
+
return [rootDroppableId, zoneCompound];
|
|
934
|
+
};
|
|
935
|
+
|
|
936
|
+
// lib/group-zones-by-component.ts
|
|
937
|
+
var groupZonesByComponent = (data) => {
|
|
938
|
+
var _a;
|
|
939
|
+
const zoneEntries = Object.entries((_a = data.zones) != null ? _a : {});
|
|
940
|
+
return zoneEntries.reduce((acc, [zoneCompound, zoneContent]) => {
|
|
941
|
+
const [componentId, zoneName] = getZoneId(zoneCompound);
|
|
942
|
+
if (!componentId.length || !zoneName.length) return acc;
|
|
943
|
+
if (!acc[componentId]) {
|
|
944
|
+
acc[componentId] = [];
|
|
945
|
+
}
|
|
946
|
+
acc[componentId].push({ zoneCompound, content: zoneContent });
|
|
947
|
+
return acc;
|
|
948
|
+
}, {});
|
|
949
|
+
};
|
|
950
|
+
|
|
538
951
|
// lib/data/default-data.ts
|
|
952
|
+
init_react_import();
|
|
539
953
|
var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
|
|
540
954
|
root: data.root || {},
|
|
541
955
|
content: data.content || []
|
|
542
956
|
});
|
|
543
957
|
|
|
544
|
-
// lib/data/to-component.ts
|
|
545
|
-
var toComponent = (item) => {
|
|
546
|
-
return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
|
|
547
|
-
props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
|
|
548
|
-
type: "root"
|
|
549
|
-
});
|
|
550
|
-
};
|
|
551
|
-
|
|
552
958
|
// lib/resolve-all-data.ts
|
|
553
959
|
function resolveAllData(_0, _1) {
|
|
554
960
|
return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
|
|
555
|
-
var _a;
|
|
556
961
|
const defaultedData = defaultData(data);
|
|
557
|
-
const
|
|
962
|
+
const zonesByComponent = groupZonesByComponent(defaultedData);
|
|
963
|
+
let resolvedZones = {};
|
|
964
|
+
const resolveNode = (_node, parent) => __async(null, null, function* () {
|
|
558
965
|
const node = toComponent(_node);
|
|
559
966
|
onResolveStart == null ? void 0 : onResolveStart(node);
|
|
560
967
|
const resolved = (yield resolveComponentData(
|
|
@@ -565,41 +972,52 @@ function resolveAllData(_0, _1) {
|
|
|
565
972
|
},
|
|
566
973
|
() => {
|
|
567
974
|
},
|
|
568
|
-
"force"
|
|
975
|
+
"force",
|
|
976
|
+
parent
|
|
569
977
|
)).node;
|
|
570
|
-
const
|
|
978
|
+
const resolvedAsComponent = toComponent(resolved);
|
|
979
|
+
const resolvedDeepPromise = mapFields(
|
|
571
980
|
resolved,
|
|
572
|
-
{
|
|
981
|
+
{
|
|
982
|
+
slot: ({ value }) => processContent(value, resolvedAsComponent)
|
|
983
|
+
},
|
|
573
984
|
config
|
|
574
985
|
);
|
|
986
|
+
let resolveZonePromises = [];
|
|
987
|
+
if (zonesByComponent[resolvedAsComponent.props.id]) {
|
|
988
|
+
resolveZonePromises = zonesByComponent[resolvedAsComponent.props.id].map(
|
|
989
|
+
(_02) => __async(null, [_02], function* ({ zoneCompound, content }) {
|
|
990
|
+
resolvedZones[zoneCompound] = yield processContent(
|
|
991
|
+
content,
|
|
992
|
+
resolvedAsComponent
|
|
993
|
+
);
|
|
994
|
+
})
|
|
995
|
+
);
|
|
996
|
+
}
|
|
997
|
+
const resolvedDeep = yield resolvedDeepPromise;
|
|
998
|
+
yield Promise.all(resolveZonePromises);
|
|
575
999
|
onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
|
|
576
1000
|
return resolvedDeep;
|
|
577
1001
|
});
|
|
578
|
-
const processContent = (content) => __async(
|
|
579
|
-
return Promise.all(content.map(resolveNode));
|
|
1002
|
+
const processContent = (content, parent) => __async(null, null, function* () {
|
|
1003
|
+
return Promise.all(content.map((item) => resolveNode(item, parent)));
|
|
580
1004
|
});
|
|
581
|
-
const
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
const dynamic = {
|
|
590
|
-
root: yield resolveNode(defaultedData.root),
|
|
591
|
-
content: yield processContent(defaultedData.content),
|
|
592
|
-
zones: yield processZones()
|
|
593
|
-
};
|
|
594
|
-
Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(this, null, function* () {
|
|
595
|
-
const content = defaultedData.zones[zoneKey];
|
|
596
|
-
dynamic.zones[zoneKey] = yield processContent(content);
|
|
597
|
-
}), {});
|
|
598
|
-
return dynamic;
|
|
1005
|
+
const result = defaultData({});
|
|
1006
|
+
result.root = yield resolveNode(defaultedData.root, null);
|
|
1007
|
+
result.content = yield processContent(
|
|
1008
|
+
defaultedData.content,
|
|
1009
|
+
toComponent(result.root)
|
|
1010
|
+
);
|
|
1011
|
+
result.zones = resolvedZones;
|
|
1012
|
+
return result;
|
|
599
1013
|
});
|
|
600
1014
|
}
|
|
601
1015
|
|
|
1016
|
+
// lib/transform-props.ts
|
|
1017
|
+
init_react_import();
|
|
1018
|
+
|
|
602
1019
|
// lib/data/walk-tree.ts
|
|
1020
|
+
init_react_import();
|
|
603
1021
|
function walkTree(data, config, callbackFn) {
|
|
604
1022
|
var _a, _b;
|
|
605
1023
|
const walkItem = (item) => {
|
|
@@ -667,11 +1085,19 @@ function transformProps(data, propTransforms, config = { components: {} }) {
|
|
|
667
1085
|
return updatedData;
|
|
668
1086
|
}
|
|
669
1087
|
|
|
1088
|
+
// lib/migrate.ts
|
|
1089
|
+
init_react_import();
|
|
1090
|
+
|
|
1091
|
+
// store/default-app-state.ts
|
|
1092
|
+
init_react_import();
|
|
1093
|
+
|
|
670
1094
|
// components/ViewportControls/default-viewports.ts
|
|
1095
|
+
init_react_import();
|
|
671
1096
|
var defaultViewports = [
|
|
672
1097
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
|
673
1098
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
|
674
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
|
1099
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" },
|
|
1100
|
+
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
|
675
1101
|
];
|
|
676
1102
|
|
|
677
1103
|
// store/default-app-state.ts
|
|
@@ -693,7 +1119,8 @@ var defaultAppState = {
|
|
|
693
1119
|
options: [],
|
|
694
1120
|
controlsVisible: true
|
|
695
1121
|
},
|
|
696
|
-
field: { focus: null }
|
|
1122
|
+
field: { focus: null },
|
|
1123
|
+
plugin: { current: null }
|
|
697
1124
|
},
|
|
698
1125
|
indexes: {
|
|
699
1126
|
nodes: {},
|
|
@@ -701,18 +1128,11 @@ var defaultAppState = {
|
|
|
701
1128
|
}
|
|
702
1129
|
};
|
|
703
1130
|
|
|
704
|
-
// lib/
|
|
705
|
-
|
|
706
|
-
if (!zoneCompound) {
|
|
707
|
-
return [];
|
|
708
|
-
}
|
|
709
|
-
if (zoneCompound && zoneCompound.indexOf(":") > -1) {
|
|
710
|
-
return zoneCompound.split(":");
|
|
711
|
-
}
|
|
712
|
-
return [rootDroppableId, zoneCompound];
|
|
713
|
-
};
|
|
1131
|
+
// lib/data/walk-app-state.ts
|
|
1132
|
+
init_react_import();
|
|
714
1133
|
|
|
715
1134
|
// lib/data/for-related-zones.ts
|
|
1135
|
+
init_react_import();
|
|
716
1136
|
function forRelatedZones(item, data, cb, path = []) {
|
|
717
1137
|
Object.entries(data.zones || {}).forEach(([zoneCompound, content]) => {
|
|
718
1138
|
const [parentId] = getZoneId(zoneCompound);
|
|
@@ -723,18 +1143,39 @@ function forRelatedZones(item, data, cb, path = []) {
|
|
|
723
1143
|
}
|
|
724
1144
|
|
|
725
1145
|
// lib/data/flatten-node.ts
|
|
1146
|
+
init_react_import();
|
|
726
1147
|
var import_flat = __toESM(require("flat"));
|
|
727
1148
|
|
|
728
1149
|
// lib/data/strip-slots.ts
|
|
1150
|
+
init_react_import();
|
|
729
1151
|
var stripSlots = (data, config) => {
|
|
730
1152
|
return mapFields(data, { slot: () => null }, config);
|
|
731
1153
|
};
|
|
732
1154
|
|
|
733
1155
|
// lib/data/flatten-node.ts
|
|
734
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) {
|
|
1167
|
+
const result = {};
|
|
1168
|
+
for (const key in props) {
|
|
1169
|
+
if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
|
|
1170
|
+
const val = props[key];
|
|
1171
|
+
if (isEmptyArrayOrObject(val)) continue;
|
|
1172
|
+
result[key] = val;
|
|
1173
|
+
}
|
|
1174
|
+
return result;
|
|
1175
|
+
}
|
|
735
1176
|
var flattenNode = (node, config) => {
|
|
736
1177
|
return __spreadProps(__spreadValues({}, node), {
|
|
737
|
-
props: flatten2(stripSlots(node, config).props)
|
|
1178
|
+
props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
|
|
738
1179
|
});
|
|
739
1180
|
};
|
|
740
1181
|
|
|
@@ -993,3 +1434,12 @@ function migrate(data, config, migrationOptions) {
|
|
|
993
1434
|
transformProps,
|
|
994
1435
|
walkTree
|
|
995
1436
|
});
|
|
1437
|
+
/*! Bundled license information:
|
|
1438
|
+
|
|
1439
|
+
classnames/index.js:
|
|
1440
|
+
(*!
|
|
1441
|
+
Copyright (c) 2018 Jed Watson.
|
|
1442
|
+
Licensed under the MIT License (MIT), see
|
|
1443
|
+
http://jedwatson.github.io/classnames
|
|
1444
|
+
*)
|
|
1445
|
+
*/
|