@measured/puck 0.17.0-canary.35170f8 → 0.17.0-canary.361e5f9
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/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +453 -313
- package/dist/index.mjs +318 -178
- package/dist/{resolve-all-data-Ch-Pcasj.d.mts → resolve-all-data-zN5E6nBu.d.mts} +2 -1
- package/dist/{resolve-all-data-Ch-Pcasj.d.ts → resolve-all-data-zN5E6nBu.d.ts} +2 -1
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/package.json +12 -12
package/dist/index.js
CHANGED
@@ -99,35 +99,45 @@ var require_classnames = __commonJS({
|
|
99
99
|
(function() {
|
100
100
|
"use strict";
|
101
101
|
var hasOwn = {}.hasOwnProperty;
|
102
|
-
var nativeCodeString = "[native code]";
|
103
102
|
function classNames() {
|
104
|
-
var classes =
|
103
|
+
var classes = "";
|
105
104
|
for (var i = 0; i < arguments.length; i++) {
|
106
105
|
var arg = arguments[i];
|
107
|
-
if (
|
108
|
-
|
109
|
-
if (argType === "string" || argType === "number") {
|
110
|
-
classes.push(arg);
|
111
|
-
} else if (Array.isArray(arg)) {
|
112
|
-
if (arg.length) {
|
113
|
-
var inner = classNames.apply(null, arg);
|
114
|
-
if (inner) {
|
115
|
-
classes.push(inner);
|
116
|
-
}
|
117
|
-
}
|
118
|
-
} else if (argType === "object") {
|
119
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
120
|
-
classes.push(arg.toString());
|
121
|
-
continue;
|
122
|
-
}
|
123
|
-
for (var key in arg) {
|
124
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
125
|
-
classes.push(key);
|
126
|
-
}
|
127
|
-
}
|
106
|
+
if (arg) {
|
107
|
+
classes = appendClass(classes, parseValue(arg));
|
128
108
|
}
|
129
109
|
}
|
130
|
-
return classes
|
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;
|
131
141
|
}
|
132
142
|
if (typeof module2 !== "undefined" && module2.exports) {
|
133
143
|
classNames.default = classNames;
|
@@ -279,7 +289,7 @@ init_react_import();
|
|
279
289
|
var styles_module_default2 = { "InputWrapper": "_InputWrapper_1l5m8_1", "Input": "_Input_1l5m8_1", "Input-label": "_Input-label_1l5m8_26", "Input-labelIcon": "_Input-labelIcon_1l5m8_35", "Input-disabledIcon": "_Input-disabledIcon_1l5m8_42", "Input-input": "_Input-input_1l5m8_47", "Input--readOnly": "_Input--readOnly_1l5m8_91", "Input-radioGroupItems": "_Input-radioGroupItems_1l5m8_102", "Input-radio": "_Input-radio_1l5m8_102", "Input-radioInner": "_Input-radioInner_1l5m8_119", "Input-radioInput": "_Input-radioInput_1l5m8_164" };
|
280
290
|
|
281
291
|
// components/AutoField/index.tsx
|
282
|
-
var
|
292
|
+
var import_react16 = require("react");
|
283
293
|
|
284
294
|
// components/AutoField/fields/index.tsx
|
285
295
|
init_react_import();
|
@@ -296,6 +306,17 @@ init_react_import();
|
|
296
306
|
|
297
307
|
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
298
308
|
init_react_import();
|
309
|
+
var import_react3 = require("react");
|
310
|
+
|
311
|
+
// ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
|
312
|
+
init_react_import();
|
313
|
+
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
314
|
+
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
315
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
316
|
+
}).join(" ").trim();
|
317
|
+
|
318
|
+
// ../../node_modules/lucide-react/dist/esm/Icon.js
|
319
|
+
init_react_import();
|
299
320
|
var import_react2 = require("react");
|
300
321
|
|
301
322
|
// ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
|
@@ -312,41 +333,61 @@ var defaultAttributes = {
|
|
312
333
|
strokeLinejoin: "round"
|
313
334
|
};
|
314
335
|
|
336
|
+
// ../../node_modules/lucide-react/dist/esm/Icon.js
|
337
|
+
var Icon = (0, import_react2.forwardRef)(
|
338
|
+
(_a, ref) => {
|
339
|
+
var _b = _a, {
|
340
|
+
color = "currentColor",
|
341
|
+
size = 24,
|
342
|
+
strokeWidth = 2,
|
343
|
+
absoluteStrokeWidth,
|
344
|
+
className = "",
|
345
|
+
children,
|
346
|
+
iconNode
|
347
|
+
} = _b, rest = __objRest(_b, [
|
348
|
+
"color",
|
349
|
+
"size",
|
350
|
+
"strokeWidth",
|
351
|
+
"absoluteStrokeWidth",
|
352
|
+
"className",
|
353
|
+
"children",
|
354
|
+
"iconNode"
|
355
|
+
]);
|
356
|
+
return (0, import_react2.createElement)(
|
357
|
+
"svg",
|
358
|
+
__spreadValues(__spreadProps(__spreadValues({
|
359
|
+
ref
|
360
|
+
}, defaultAttributes), {
|
361
|
+
width: size,
|
362
|
+
height: size,
|
363
|
+
stroke: color,
|
364
|
+
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
365
|
+
className: mergeClasses("lucide", className)
|
366
|
+
}), rest),
|
367
|
+
[
|
368
|
+
...iconNode.map(([tag, attrs]) => (0, import_react2.createElement)(tag, attrs)),
|
369
|
+
...Array.isArray(children) ? children : [children]
|
370
|
+
]
|
371
|
+
);
|
372
|
+
}
|
373
|
+
);
|
374
|
+
|
315
375
|
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
316
|
-
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim();
|
317
376
|
var createLucideIcon = (iconName, iconNode) => {
|
318
|
-
const Component = (0,
|
377
|
+
const Component = (0, import_react3.forwardRef)(
|
319
378
|
(_a, ref) => {
|
320
|
-
var _b = _a, {
|
321
|
-
return (0,
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
width: size,
|
327
|
-
height: size,
|
328
|
-
stroke: color,
|
329
|
-
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
330
|
-
className: ["lucide", `lucide-${toKebabCase(iconName)}`, className].join(" ")
|
331
|
-
}), rest),
|
332
|
-
[
|
333
|
-
...iconNode.map(([tag, attrs]) => (0, import_react2.createElement)(tag, attrs)),
|
334
|
-
...Array.isArray(children) ? children : [children]
|
335
|
-
]
|
336
|
-
);
|
379
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
380
|
+
return (0, import_react3.createElement)(Icon, __spreadValues({
|
381
|
+
ref,
|
382
|
+
iconNode,
|
383
|
+
className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className)
|
384
|
+
}, props));
|
337
385
|
}
|
338
386
|
);
|
339
387
|
Component.displayName = `${iconName}`;
|
340
388
|
return Component;
|
341
389
|
};
|
342
390
|
|
343
|
-
// ../../node_modules/lucide-react/dist/esm/icons/check-circle.js
|
344
|
-
init_react_import();
|
345
|
-
var CheckCircle = createLucideIcon("CheckCircle", [
|
346
|
-
["path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14", key: "g774vq" }],
|
347
|
-
["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
|
348
|
-
]);
|
349
|
-
|
350
391
|
// ../../node_modules/lucide-react/dist/esm/icons/chevron-down.js
|
351
392
|
init_react_import();
|
352
393
|
var ChevronDown = createLucideIcon("ChevronDown", [
|
@@ -363,6 +404,13 @@ var ChevronRight = createLucideIcon("ChevronRight", [
|
|
363
404
|
init_react_import();
|
364
405
|
var ChevronUp = createLucideIcon("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
|
365
406
|
|
407
|
+
// ../../node_modules/lucide-react/dist/esm/icons/circle-check-big.js
|
408
|
+
init_react_import();
|
409
|
+
var CircleCheckBig = createLucideIcon("CircleCheckBig", [
|
410
|
+
["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
|
411
|
+
["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
|
412
|
+
]);
|
413
|
+
|
366
414
|
// ../../node_modules/lucide-react/dist/esm/icons/copy.js
|
367
415
|
init_react_import();
|
368
416
|
var Copy = createLucideIcon("Copy", [
|
@@ -370,6 +418,14 @@ var Copy = createLucideIcon("Copy", [
|
|
370
418
|
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
371
419
|
]);
|
372
420
|
|
421
|
+
// ../../node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.js
|
422
|
+
init_react_import();
|
423
|
+
var EllipsisVertical = createLucideIcon("EllipsisVertical", [
|
424
|
+
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
425
|
+
["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
|
426
|
+
["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
|
427
|
+
]);
|
428
|
+
|
373
429
|
// ../../node_modules/lucide-react/dist/esm/icons/globe.js
|
374
430
|
init_react_import();
|
375
431
|
var Globe = createLucideIcon("Globe", [
|
@@ -393,12 +449,24 @@ var Layers = createLucideIcon("Layers", [
|
|
393
449
|
[
|
394
450
|
"path",
|
395
451
|
{
|
396
|
-
d: "
|
397
|
-
key: "
|
452
|
+
d: "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",
|
453
|
+
key: "zw3jo"
|
454
|
+
}
|
455
|
+
],
|
456
|
+
[
|
457
|
+
"path",
|
458
|
+
{
|
459
|
+
d: "M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",
|
460
|
+
key: "1wduqc"
|
398
461
|
}
|
399
462
|
],
|
400
|
-
[
|
401
|
-
|
463
|
+
[
|
464
|
+
"path",
|
465
|
+
{
|
466
|
+
d: "M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",
|
467
|
+
key: "kqbvx6"
|
468
|
+
}
|
469
|
+
]
|
402
470
|
]);
|
403
471
|
|
404
472
|
// ../../node_modules/lucide-react/dist/esm/icons/layout-grid.js
|
@@ -420,12 +488,19 @@ var Link = createLucideIcon("Link", [
|
|
420
488
|
// ../../node_modules/lucide-react/dist/esm/icons/list.js
|
421
489
|
init_react_import();
|
422
490
|
var List = createLucideIcon("List", [
|
423
|
-
["
|
424
|
-
["
|
425
|
-
["
|
426
|
-
["
|
427
|
-
["
|
428
|
-
["
|
491
|
+
["path", { d: "M3 12h.01", key: "nlz23k" }],
|
492
|
+
["path", { d: "M3 18h.01", key: "1tta3j" }],
|
493
|
+
["path", { d: "M3 6h.01", key: "1rqtza" }],
|
494
|
+
["path", { d: "M8 12h13", key: "1za7za" }],
|
495
|
+
["path", { d: "M8 18h13", key: "1lx6n3" }],
|
496
|
+
["path", { d: "M8 6h13", key: "ik3vkj" }]
|
497
|
+
]);
|
498
|
+
|
499
|
+
// ../../node_modules/lucide-react/dist/esm/icons/lock-open.js
|
500
|
+
init_react_import();
|
501
|
+
var LockOpen = createLucideIcon("LockOpen", [
|
502
|
+
["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
|
503
|
+
["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
|
429
504
|
]);
|
430
505
|
|
431
506
|
// ../../node_modules/lucide-react/dist/esm/icons/lock.js
|
@@ -443,26 +518,18 @@ var Monitor = createLucideIcon("Monitor", [
|
|
443
518
|
["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
|
444
519
|
]);
|
445
520
|
|
446
|
-
// ../../node_modules/lucide-react/dist/esm/icons/more-vertical.js
|
447
|
-
init_react_import();
|
448
|
-
var MoreVertical = createLucideIcon("MoreVertical", [
|
449
|
-
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
450
|
-
["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
|
451
|
-
["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
|
452
|
-
]);
|
453
|
-
|
454
521
|
// ../../node_modules/lucide-react/dist/esm/icons/panel-left.js
|
455
522
|
init_react_import();
|
456
523
|
var PanelLeft = createLucideIcon("PanelLeft", [
|
457
|
-
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2",
|
458
|
-
["
|
524
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
525
|
+
["path", { d: "M9 3v18", key: "fh3hqa" }]
|
459
526
|
]);
|
460
527
|
|
461
528
|
// ../../node_modules/lucide-react/dist/esm/icons/panel-right.js
|
462
529
|
init_react_import();
|
463
530
|
var PanelRight = createLucideIcon("PanelRight", [
|
464
|
-
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2",
|
465
|
-
["
|
531
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
532
|
+
["path", { d: "M15 3v18", key: "14nvp0" }]
|
466
533
|
]);
|
467
534
|
|
468
535
|
// ../../node_modules/lucide-react/dist/esm/icons/plus.js
|
@@ -476,7 +543,7 @@ var Plus = createLucideIcon("Plus", [
|
|
476
543
|
init_react_import();
|
477
544
|
var Redo2 = createLucideIcon("Redo2", [
|
478
545
|
["path", { d: "m15 14 5-5-5-5", key: "12vg1m" }],
|
479
|
-
["path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.
|
546
|
+
["path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13", key: "6uklza" }]
|
480
547
|
]);
|
481
548
|
|
482
549
|
// ../../node_modules/lucide-react/dist/esm/icons/search.js
|
@@ -534,14 +601,7 @@ var Type = createLucideIcon("Type", [
|
|
534
601
|
init_react_import();
|
535
602
|
var Undo2 = createLucideIcon("Undo2", [
|
536
603
|
["path", { d: "M9 14 4 9l5-5", key: "102s5s" }],
|
537
|
-
["path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.
|
538
|
-
]);
|
539
|
-
|
540
|
-
// ../../node_modules/lucide-react/dist/esm/icons/unlock.js
|
541
|
-
init_react_import();
|
542
|
-
var Unlock = createLucideIcon("Unlock", [
|
543
|
-
["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
|
544
|
-
["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
|
604
|
+
["path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11", key: "f3b9sd" }]
|
545
605
|
]);
|
546
606
|
|
547
607
|
// ../../node_modules/lucide-react/dist/esm/icons/zoom-in.js
|
@@ -566,7 +626,7 @@ init_react_import();
|
|
566
626
|
|
567
627
|
// components/IconButton/IconButton.tsx
|
568
628
|
init_react_import();
|
569
|
-
var
|
629
|
+
var import_react4 = require("react");
|
570
630
|
|
571
631
|
// css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
|
572
632
|
init_react_import();
|
@@ -643,7 +703,7 @@ var IconButton = ({
|
|
643
703
|
fullWidth,
|
644
704
|
title
|
645
705
|
}) => {
|
646
|
-
const [loading, setLoading] = (0,
|
706
|
+
const [loading, setLoading] = (0, import_react4.useState)(false);
|
647
707
|
const ElementType = href ? "a" : "button";
|
648
708
|
const el = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
649
709
|
ElementType,
|
@@ -687,7 +747,7 @@ var import_dnd = require("@measured/dnd");
|
|
687
747
|
|
688
748
|
// components/Puck/context.tsx
|
689
749
|
init_react_import();
|
690
|
-
var
|
750
|
+
var import_react7 = require("react");
|
691
751
|
|
692
752
|
// lib/get-item.ts
|
693
753
|
init_react_import();
|
@@ -732,7 +792,7 @@ var import_ua_parser_js = require("ua-parser-js");
|
|
732
792
|
|
733
793
|
// lib/use-resolved-permissions.ts
|
734
794
|
init_react_import();
|
735
|
-
var
|
795
|
+
var import_react5 = require("react");
|
736
796
|
|
737
797
|
// lib/flatten-data.ts
|
738
798
|
init_react_import();
|
@@ -757,9 +817,9 @@ var getChanged = (newItem, oldItem) => {
|
|
757
817
|
|
758
818
|
// lib/use-resolved-permissions.ts
|
759
819
|
var useResolvedPermissions = (config, appState, globalPermissions, setComponentLoading, unsetComponentLoading) => {
|
760
|
-
const [cache3, setCache] = (0,
|
761
|
-
const [resolvedPermissions, setResolvedPermissions] = (0,
|
762
|
-
const resolveDataForItem = (0,
|
820
|
+
const [cache3, setCache] = (0, import_react5.useState)({});
|
821
|
+
const [resolvedPermissions, setResolvedPermissions] = (0, import_react5.useState)({});
|
822
|
+
const resolveDataForItem = (0, import_react5.useCallback)(
|
763
823
|
(item, force = false) => __async(void 0, null, function* () {
|
764
824
|
var _a, _b, _c;
|
765
825
|
const componentConfig = item.type === "root" ? config.root : config.components[item.type];
|
@@ -806,7 +866,7 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
|
|
806
866
|
force
|
807
867
|
);
|
808
868
|
};
|
809
|
-
const resolvePermissions = (0,
|
869
|
+
const resolvePermissions = (0, import_react5.useCallback)(
|
810
870
|
(..._0) => __async(void 0, [..._0], function* ({ item, type, root } = {}, force = false) {
|
811
871
|
if (item) {
|
812
872
|
yield resolveDataForItem(item, force);
|
@@ -825,16 +885,16 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
|
|
825
885
|
}),
|
826
886
|
[config, appState]
|
827
887
|
);
|
828
|
-
const refreshPermissions = (0,
|
888
|
+
const refreshPermissions = (0, import_react5.useCallback)(
|
829
889
|
(params) => __async(void 0, null, function* () {
|
830
890
|
resolvePermissions(params, true);
|
831
891
|
}),
|
832
892
|
[config, appState]
|
833
893
|
);
|
834
|
-
(0,
|
894
|
+
(0, import_react5.useEffect)(() => {
|
835
895
|
resolvePermissions();
|
836
896
|
}, [config, appState.data]);
|
837
|
-
const getPermissions = (0,
|
897
|
+
const getPermissions = (0, import_react5.useCallback)(
|
838
898
|
({ item, type, root } = {}) => {
|
839
899
|
if (item) {
|
840
900
|
const componentConfig = config.components[item.type];
|
@@ -862,7 +922,7 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
|
|
862
922
|
|
863
923
|
// lib/use-resolved-data.ts
|
864
924
|
init_react_import();
|
865
|
-
var
|
925
|
+
var import_react6 = require("react");
|
866
926
|
|
867
927
|
// lib/resolve-component-data.ts
|
868
928
|
init_react_import();
|
@@ -959,12 +1019,12 @@ function resolveRootData(data, config) {
|
|
959
1019
|
|
960
1020
|
// lib/use-resolved-data.ts
|
961
1021
|
var useResolvedData = (appState, config, dispatch, setComponentLoading, unsetComponentLoading, refreshPermissions) => {
|
962
|
-
const [{ resolverKey, newAppState }, setResolverState] = (0,
|
1022
|
+
const [{ resolverKey, newAppState }, setResolverState] = (0, import_react6.useState)({
|
963
1023
|
resolverKey: 0,
|
964
1024
|
newAppState: appState
|
965
1025
|
});
|
966
1026
|
const deferredSetStates = {};
|
967
|
-
const _setComponentLoading = (0,
|
1027
|
+
const _setComponentLoading = (0, import_react6.useCallback)(
|
968
1028
|
(id, loading, defer2 = 0) => {
|
969
1029
|
if (deferredSetStates[id]) {
|
970
1030
|
clearTimeout(deferredSetStates[id]);
|
@@ -1039,10 +1099,10 @@ var useResolvedData = (appState, config, dispatch, setComponentLoading, unsetCom
|
|
1039
1099
|
});
|
1040
1100
|
yield Promise.all(promises);
|
1041
1101
|
});
|
1042
|
-
(0,
|
1102
|
+
(0, import_react6.useEffect)(() => {
|
1043
1103
|
runResolvers();
|
1044
1104
|
}, [resolverKey]);
|
1045
|
-
const resolveData = (0,
|
1105
|
+
const resolveData = (0, import_react6.useCallback)((newAppState2 = appState) => {
|
1046
1106
|
setResolverState((curr) => ({
|
1047
1107
|
resolverKey: curr.resolverKey + 1,
|
1048
1108
|
newAppState: newAppState2
|
@@ -1102,18 +1162,18 @@ var defaultContext = {
|
|
1102
1162
|
getPermissions: () => ({}),
|
1103
1163
|
refreshPermissions: () => null
|
1104
1164
|
};
|
1105
|
-
var appContext = (0,
|
1165
|
+
var appContext = (0, import_react7.createContext)(defaultContext);
|
1106
1166
|
var AppProvider = ({
|
1107
1167
|
children,
|
1108
1168
|
value
|
1109
1169
|
}) => {
|
1110
|
-
const [zoomConfig, setZoomConfig] = (0,
|
1111
|
-
const [status, setStatus] = (0,
|
1112
|
-
(0,
|
1170
|
+
const [zoomConfig, setZoomConfig] = (0, import_react7.useState)(defaultContext.zoomConfig);
|
1171
|
+
const [status, setStatus] = (0, import_react7.useState)("LOADING");
|
1172
|
+
(0, import_react7.useEffect)(() => {
|
1113
1173
|
setStatus("MOUNTED");
|
1114
1174
|
}, []);
|
1115
|
-
const [safariFallbackMode, setSafariFallbackMode] = (0,
|
1116
|
-
(0,
|
1175
|
+
const [safariFallbackMode, setSafariFallbackMode] = (0, import_react7.useState)(false);
|
1176
|
+
(0, import_react7.useEffect)(() => {
|
1117
1177
|
var _a, _b, _c;
|
1118
1178
|
const ua = new import_ua_parser_js.UAParser(navigator.userAgent);
|
1119
1179
|
const { browser } = ua.getResult();
|
@@ -1131,7 +1191,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
1131
1191
|
}
|
1132
1192
|
}, []);
|
1133
1193
|
const selectedItem = value.state.ui.itemSelector ? getItem(value.state.ui.itemSelector, value.state.data) : void 0;
|
1134
|
-
const [componentState, setComponentState] = (0,
|
1194
|
+
const [componentState, setComponentState] = (0, import_react7.useState)({});
|
1135
1195
|
const setComponentLoading = (id) => {
|
1136
1196
|
setComponentState((prev) => {
|
1137
1197
|
var _a;
|
@@ -1188,7 +1248,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
1188
1248
|
);
|
1189
1249
|
};
|
1190
1250
|
function useAppContext() {
|
1191
|
-
const mainContext = (0,
|
1251
|
+
const mainContext = (0, import_react7.useContext)(appContext);
|
1192
1252
|
return __spreadProps(__spreadValues({}, mainContext), {
|
1193
1253
|
// Helpers
|
1194
1254
|
setUi: (ui, recordHistory) => {
|
@@ -1292,7 +1352,7 @@ var Draggable = ({
|
|
1292
1352
|
};
|
1293
1353
|
|
1294
1354
|
// components/AutoField/fields/ArrayField/index.tsx
|
1295
|
-
var
|
1355
|
+
var import_react8 = require("react");
|
1296
1356
|
|
1297
1357
|
// components/DragIcon/index.tsx
|
1298
1358
|
init_react_import();
|
@@ -1343,11 +1403,11 @@ var ArrayField = ({
|
|
1343
1403
|
}),
|
1344
1404
|
openId: ""
|
1345
1405
|
};
|
1346
|
-
const [localState, setLocalState] = (0,
|
1347
|
-
(0,
|
1406
|
+
const [localState, setLocalState] = (0, import_react8.useState)({ arrayState, value });
|
1407
|
+
(0, import_react8.useEffect)(() => {
|
1348
1408
|
setLocalState({ arrayState, value });
|
1349
1409
|
}, [value, state.ui.arrayState[id]]);
|
1350
|
-
const mapArrayStateToUi = (0,
|
1410
|
+
const mapArrayStateToUi = (0, import_react8.useCallback)(
|
1351
1411
|
(partialArrayState) => {
|
1352
1412
|
return {
|
1353
1413
|
arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
|
@@ -1357,13 +1417,13 @@ var ArrayField = ({
|
|
1357
1417
|
},
|
1358
1418
|
[arrayState]
|
1359
1419
|
);
|
1360
|
-
const getHighestIndex = (0,
|
1420
|
+
const getHighestIndex = (0, import_react8.useCallback)(() => {
|
1361
1421
|
return arrayState.items.reduce(
|
1362
1422
|
(acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
|
1363
1423
|
-1
|
1364
1424
|
);
|
1365
1425
|
}, [arrayState]);
|
1366
|
-
const regenerateArrayState = (0,
|
1426
|
+
const regenerateArrayState = (0, import_react8.useCallback)(
|
1367
1427
|
(value2) => {
|
1368
1428
|
let highestIndex = getHighestIndex();
|
1369
1429
|
const newItems = Array.from(value2 || []).map((item, idx) => {
|
@@ -1382,12 +1442,12 @@ var ArrayField = ({
|
|
1382
1442
|
},
|
1383
1443
|
[arrayState]
|
1384
1444
|
);
|
1385
|
-
(0,
|
1445
|
+
(0, import_react8.useEffect)(() => {
|
1386
1446
|
if (arrayState.items.length > 0) {
|
1387
1447
|
setUi(mapArrayStateToUi(arrayState));
|
1388
1448
|
}
|
1389
1449
|
}, []);
|
1390
|
-
const [hovering, setHovering] = (0,
|
1450
|
+
const [hovering, setHovering] = (0, import_react8.useState)(false);
|
1391
1451
|
const forceReadOnly = getPermissions({ item: selectedItem }).edit === false;
|
1392
1452
|
if (field.type !== "array" || !field.arrayFields) {
|
1393
1453
|
return null;
|
@@ -1637,6 +1697,7 @@ var DefaultField = ({
|
|
1637
1697
|
className: getClassName6("input"),
|
1638
1698
|
autoComplete: "off",
|
1639
1699
|
type: field.type,
|
1700
|
+
title: label || name,
|
1640
1701
|
name,
|
1641
1702
|
value: typeof value === "undefined" ? "" : value.toString(),
|
1642
1703
|
onChange: (e) => {
|
@@ -1659,11 +1720,11 @@ var DefaultField = ({
|
|
1659
1720
|
|
1660
1721
|
// components/AutoField/fields/ExternalField/index.tsx
|
1661
1722
|
init_react_import();
|
1662
|
-
var
|
1723
|
+
var import_react12 = require("react");
|
1663
1724
|
|
1664
1725
|
// components/ExternalInput/index.tsx
|
1665
1726
|
init_react_import();
|
1666
|
-
var
|
1727
|
+
var import_react11 = require("react");
|
1667
1728
|
|
1668
1729
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
1669
1730
|
init_react_import();
|
@@ -1671,7 +1732,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
|
|
1671
1732
|
|
1672
1733
|
// components/Modal/index.tsx
|
1673
1734
|
init_react_import();
|
1674
|
-
var
|
1735
|
+
var import_react9 = require("react");
|
1675
1736
|
|
1676
1737
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
1677
1738
|
init_react_import();
|
@@ -1686,8 +1747,8 @@ var Modal = ({
|
|
1686
1747
|
onClose,
|
1687
1748
|
isOpen
|
1688
1749
|
}) => {
|
1689
|
-
const [rootEl, setRootEl] = (0,
|
1690
|
-
(0,
|
1750
|
+
const [rootEl, setRootEl] = (0, import_react9.useState)(null);
|
1751
|
+
(0, import_react9.useEffect)(() => {
|
1691
1752
|
setRootEl(document.getElementById("puck-portal-root"));
|
1692
1753
|
}, []);
|
1693
1754
|
if (!rootEl) {
|
@@ -1734,7 +1795,7 @@ init_react_import();
|
|
1734
1795
|
|
1735
1796
|
// components/Button/Button.tsx
|
1736
1797
|
init_react_import();
|
1737
|
-
var
|
1798
|
+
var import_react10 = require("react");
|
1738
1799
|
|
1739
1800
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
|
1740
1801
|
init_react_import();
|
@@ -1757,8 +1818,8 @@ var Button = ({
|
|
1757
1818
|
size = "medium",
|
1758
1819
|
loading: loadingProp = false
|
1759
1820
|
}) => {
|
1760
|
-
const [loading, setLoading] = (0,
|
1761
|
-
(0,
|
1821
|
+
const [loading, setLoading] = (0, import_react10.useState)(loadingProp);
|
1822
|
+
(0, import_react10.useEffect)(() => setLoading(loadingProp), [loadingProp]);
|
1762
1823
|
const ElementType = href ? "a" : type ? "button" : "span";
|
1763
1824
|
const el = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
1764
1825
|
ElementType,
|
@@ -1811,28 +1872,28 @@ var ExternalInput = ({
|
|
1811
1872
|
mapRow = (val) => val,
|
1812
1873
|
filterFields
|
1813
1874
|
} = field || {};
|
1814
|
-
const [data, setData] = (0,
|
1815
|
-
const [isOpen, setOpen] = (0,
|
1816
|
-
const [isLoading, setIsLoading] = (0,
|
1875
|
+
const [data, setData] = (0, import_react11.useState)([]);
|
1876
|
+
const [isOpen, setOpen] = (0, import_react11.useState)(false);
|
1877
|
+
const [isLoading, setIsLoading] = (0, import_react11.useState)(true);
|
1817
1878
|
const hasFilterFields = !!filterFields;
|
1818
|
-
const [filters, setFilters] = (0,
|
1819
|
-
const [filtersToggled, setFiltersToggled] = (0,
|
1820
|
-
const mappedData = (0,
|
1879
|
+
const [filters, setFilters] = (0, import_react11.useState)(field.initialFilters || {});
|
1880
|
+
const [filtersToggled, setFiltersToggled] = (0, import_react11.useState)(hasFilterFields);
|
1881
|
+
const mappedData = (0, import_react11.useMemo)(() => {
|
1821
1882
|
return data.map(mapRow);
|
1822
1883
|
}, [data]);
|
1823
|
-
const keys = (0,
|
1884
|
+
const keys = (0, import_react11.useMemo)(() => {
|
1824
1885
|
const validKeys = /* @__PURE__ */ new Set();
|
1825
1886
|
for (const item of mappedData) {
|
1826
1887
|
for (const key of Object.keys(item)) {
|
1827
|
-
if (typeof item[key] === "string" || typeof item[key] === "number" || (0,
|
1888
|
+
if (typeof item[key] === "string" || typeof item[key] === "number" || (0, import_react11.isValidElement)(item[key])) {
|
1828
1889
|
validKeys.add(key);
|
1829
1890
|
}
|
1830
1891
|
}
|
1831
1892
|
}
|
1832
1893
|
return Array.from(validKeys);
|
1833
1894
|
}, [mappedData]);
|
1834
|
-
const [searchQuery, setSearchQuery] = (0,
|
1835
|
-
const search = (0,
|
1895
|
+
const [searchQuery, setSearchQuery] = (0, import_react11.useState)(field.initialQuery || "");
|
1896
|
+
const search = (0, import_react11.useCallback)(
|
1836
1897
|
(query, filters2) => __async(void 0, null, function* () {
|
1837
1898
|
setIsLoading(true);
|
1838
1899
|
const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
|
@@ -1845,7 +1906,7 @@ var ExternalInput = ({
|
|
1845
1906
|
}),
|
1846
1907
|
[id, field]
|
1847
1908
|
);
|
1848
|
-
const Footer = (0,
|
1909
|
+
const Footer = (0, import_react11.useCallback)(
|
1849
1910
|
(props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: getClassNameModal("footer"), children: [
|
1850
1911
|
props.items.length,
|
1851
1912
|
" result",
|
@@ -1853,7 +1914,7 @@ var ExternalInput = ({
|
|
1853
1914
|
] }),
|
1854
1915
|
[field.renderFooter]
|
1855
1916
|
);
|
1856
|
-
(0,
|
1917
|
+
(0, import_react11.useEffect)(() => {
|
1857
1918
|
search(searchQuery, filters);
|
1858
1919
|
}, []);
|
1859
1920
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
@@ -1889,7 +1950,7 @@ var ExternalInput = ({
|
|
1889
1950
|
onChange(null);
|
1890
1951
|
},
|
1891
1952
|
disabled: readOnly,
|
1892
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
1953
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LockOpen, { size: 16 })
|
1893
1954
|
}
|
1894
1955
|
)
|
1895
1956
|
] }),
|
@@ -2016,7 +2077,7 @@ var ExternalField = ({
|
|
2016
2077
|
var _a, _b, _c;
|
2017
2078
|
const validField = field;
|
2018
2079
|
const deprecatedField = field;
|
2019
|
-
(0,
|
2080
|
+
(0, import_react12.useEffect)(() => {
|
2020
2081
|
if (deprecatedField.adaptor) {
|
2021
2082
|
console.error(
|
2022
2083
|
"Warning: The `adaptor` API is deprecated. Please use updated APIs on the `external` field instead. This will be a breaking change in a future release."
|
@@ -2051,6 +2112,20 @@ var ExternalField = ({
|
|
2051
2112
|
|
2052
2113
|
// components/AutoField/fields/RadioField/index.tsx
|
2053
2114
|
init_react_import();
|
2115
|
+
var import_react13 = require("react");
|
2116
|
+
|
2117
|
+
// lib/safe-json-parse.ts
|
2118
|
+
init_react_import();
|
2119
|
+
var safeJsonParse = (str) => {
|
2120
|
+
try {
|
2121
|
+
const jsonValue = JSON.parse(str);
|
2122
|
+
return jsonValue;
|
2123
|
+
} catch (e) {
|
2124
|
+
return str;
|
2125
|
+
}
|
2126
|
+
};
|
2127
|
+
|
2128
|
+
// components/AutoField/fields/RadioField/index.tsx
|
2054
2129
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
2055
2130
|
var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
|
2056
2131
|
var RadioField = ({
|
@@ -2063,13 +2138,17 @@ var RadioField = ({
|
|
2063
2138
|
label,
|
2064
2139
|
Label
|
2065
2140
|
}) => {
|
2141
|
+
const flatOptions = (0, import_react13.useMemo)(
|
2142
|
+
() => field.type === "radio" ? field.options.map(({ value: value2 }) => value2) : [],
|
2143
|
+
[field]
|
2144
|
+
);
|
2066
2145
|
if (field.type !== "radio" || !field.options) {
|
2067
2146
|
return null;
|
2068
2147
|
}
|
2069
2148
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
2070
2149
|
Label,
|
2071
2150
|
{
|
2072
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
2151
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleCheckBig, { size: 16 }),
|
2073
2152
|
label: label || name,
|
2074
2153
|
readOnly,
|
2075
2154
|
el: "div",
|
@@ -2086,11 +2165,12 @@ var RadioField = ({
|
|
2086
2165
|
value: option.value,
|
2087
2166
|
name,
|
2088
2167
|
onChange: (e) => {
|
2089
|
-
|
2090
|
-
|
2091
|
-
|
2168
|
+
const jsonValue = safeJsonParse(e.target.value) || e.target.value;
|
2169
|
+
if (flatOptions.indexOf(jsonValue) > -1) {
|
2170
|
+
onChange(jsonValue);
|
2171
|
+
} else {
|
2172
|
+
onChange(e.target.value);
|
2092
2173
|
}
|
2093
|
-
onChange(e.currentTarget.value);
|
2094
2174
|
},
|
2095
2175
|
disabled: readOnly,
|
2096
2176
|
checked: value === option.value
|
@@ -2107,6 +2187,7 @@ var RadioField = ({
|
|
2107
2187
|
|
2108
2188
|
// components/AutoField/fields/SelectField/index.tsx
|
2109
2189
|
init_react_import();
|
2190
|
+
var import_react14 = require("react");
|
2110
2191
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
2111
2192
|
var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
|
2112
2193
|
var SelectField = ({
|
@@ -2119,6 +2200,10 @@ var SelectField = ({
|
|
2119
2200
|
readOnly,
|
2120
2201
|
id
|
2121
2202
|
}) => {
|
2203
|
+
const flatOptions = (0, import_react14.useMemo)(
|
2204
|
+
() => field.type === "select" ? field.options.map(({ value: value2 }) => value2) : [],
|
2205
|
+
[field]
|
2206
|
+
);
|
2122
2207
|
if (field.type !== "select" || !field.options) {
|
2123
2208
|
return null;
|
2124
2209
|
}
|
@@ -2132,14 +2217,16 @@ var SelectField = ({
|
|
2132
2217
|
"select",
|
2133
2218
|
{
|
2134
2219
|
id,
|
2220
|
+
title: label || name,
|
2135
2221
|
className: getClassName12("input"),
|
2136
2222
|
disabled: readOnly,
|
2137
2223
|
onChange: (e) => {
|
2138
|
-
|
2139
|
-
|
2140
|
-
|
2224
|
+
const jsonValue = safeJsonParse(e.target.value) || e.target.value;
|
2225
|
+
if (flatOptions.indexOf(jsonValue) > -1) {
|
2226
|
+
onChange(jsonValue);
|
2227
|
+
} else {
|
2228
|
+
onChange(e.target.value);
|
2141
2229
|
}
|
2142
|
-
onChange(e.currentTarget.value);
|
2143
2230
|
},
|
2144
2231
|
value,
|
2145
2232
|
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
@@ -2218,7 +2305,7 @@ var ObjectField = ({
|
|
2218
2305
|
Label,
|
2219
2306
|
{
|
2220
2307
|
label: label || name,
|
2221
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
2308
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EllipsisVertical, { size: 16 }),
|
2222
2309
|
el: "div",
|
2223
2310
|
readOnly,
|
2224
2311
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName14(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
|
@@ -2253,7 +2340,7 @@ var ObjectField = ({
|
|
2253
2340
|
|
2254
2341
|
// lib/use-safe-id.ts
|
2255
2342
|
init_react_import();
|
2256
|
-
var
|
2343
|
+
var import_react15 = __toESM(require("react"));
|
2257
2344
|
|
2258
2345
|
// lib/generate-id.ts
|
2259
2346
|
init_react_import();
|
@@ -2262,10 +2349,10 @@ var generateId = (type) => type ? `${type}-${(0, import_uuid.v4)()}` : (0, impor
|
|
2262
2349
|
|
2263
2350
|
// lib/use-safe-id.ts
|
2264
2351
|
var useSafeId = () => {
|
2265
|
-
if (typeof
|
2266
|
-
return
|
2352
|
+
if (typeof import_react15.default.useId !== "undefined") {
|
2353
|
+
return import_react15.default.useId();
|
2267
2354
|
}
|
2268
|
-
const [id] = (0,
|
2355
|
+
const [id] = (0, import_react15.useState)(generateId());
|
2269
2356
|
return id;
|
2270
2357
|
};
|
2271
2358
|
|
@@ -2299,7 +2386,7 @@ var FieldLabelInternal2 = ({
|
|
2299
2386
|
readOnly
|
2300
2387
|
}) => {
|
2301
2388
|
const { overrides } = useAppContext();
|
2302
|
-
const Wrapper = (0,
|
2389
|
+
const Wrapper = (0, import_react16.useMemo)(
|
2303
2390
|
() => overrides.fieldLabel || FieldLabel,
|
2304
2391
|
[overrides]
|
2305
2392
|
);
|
@@ -2352,7 +2439,7 @@ function AutoFieldInternal(props) {
|
|
2352
2439
|
Label,
|
2353
2440
|
id: resolvedId
|
2354
2441
|
});
|
2355
|
-
const onFocus = (0,
|
2442
|
+
const onFocus = (0, import_react16.useCallback)(
|
2356
2443
|
(e) => {
|
2357
2444
|
if (mergedProps.name && e.target.nodeName === "INPUT") {
|
2358
2445
|
e.stopPropagation();
|
@@ -2366,7 +2453,7 @@ function AutoFieldInternal(props) {
|
|
2366
2453
|
},
|
2367
2454
|
[mergedProps.name]
|
2368
2455
|
);
|
2369
|
-
const onBlur = (0,
|
2456
|
+
const onBlur = (0, import_react16.useCallback)((e) => {
|
2370
2457
|
if ("name" in e.target) {
|
2371
2458
|
dispatch({
|
2372
2459
|
type: "setUi",
|
@@ -2385,12 +2472,23 @@ function AutoFieldInternal(props) {
|
|
2385
2472
|
}
|
2386
2473
|
const children = defaultFields[field.type](mergedProps);
|
2387
2474
|
const Render2 = render[field.type];
|
2388
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
2475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
2476
|
+
"div",
|
2477
|
+
{
|
2478
|
+
className: getClassNameWrapper(),
|
2479
|
+
onFocus,
|
2480
|
+
onBlur,
|
2481
|
+
onClick: (e) => {
|
2482
|
+
e.stopPropagation();
|
2483
|
+
},
|
2484
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
|
2485
|
+
}
|
2486
|
+
);
|
2389
2487
|
}
|
2390
2488
|
function AutoFieldPrivate(props) {
|
2391
2489
|
const { state } = useAppContext();
|
2392
2490
|
const { value, onChange } = props;
|
2393
|
-
const [localValue, setLocalValue] = (0,
|
2491
|
+
const [localValue, setLocalValue] = (0, import_react16.useState)(value);
|
2394
2492
|
const onChangeDb = (0, import_use_debounce.useDebouncedCallback)(
|
2395
2493
|
(val, ui) => {
|
2396
2494
|
onChange(val, ui);
|
@@ -2398,11 +2496,11 @@ function AutoFieldPrivate(props) {
|
|
2398
2496
|
50,
|
2399
2497
|
{ leading: true }
|
2400
2498
|
);
|
2401
|
-
const onChangeLocal = (0,
|
2499
|
+
const onChangeLocal = (0, import_react16.useCallback)((val, ui) => {
|
2402
2500
|
setLocalValue(val);
|
2403
2501
|
onChangeDb(val, ui);
|
2404
2502
|
}, []);
|
2405
|
-
(0,
|
2503
|
+
(0, import_react16.useEffect)(() => {
|
2406
2504
|
if (state.ui.field.focus !== props.name) {
|
2407
2505
|
setLocalValue(value);
|
2408
2506
|
}
|
@@ -2414,7 +2512,7 @@ function AutoFieldPrivate(props) {
|
|
2414
2512
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
|
2415
2513
|
}
|
2416
2514
|
function AutoField(props) {
|
2417
|
-
const DefaultLabel = (0,
|
2515
|
+
const DefaultLabel = (0, import_react16.useMemo)(() => {
|
2418
2516
|
const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
2419
2517
|
"div",
|
2420
2518
|
__spreadProps(__spreadValues({}, labelProps), {
|
@@ -2434,11 +2532,11 @@ init_react_import();
|
|
2434
2532
|
var styles_module_default10 = { "Drawer": "_Drawer_1oa7v_1", "DrawerItem--disabled": "_DrawerItem--disabled_1oa7v_5", "DrawerItem-draggable": "_DrawerItem-draggable_1oa7v_5", "DrawerItem-default": "_DrawerItem-default_1oa7v_11", "DrawerItem-draggableWrapper": "_DrawerItem-draggableWrapper_1oa7v_11", "DrawerItem": "_DrawerItem_1oa7v_5", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_1oa7v_36", "DrawerItem-name": "_DrawerItem-name_1oa7v_54" };
|
2435
2533
|
|
2436
2534
|
// components/Drawer/index.tsx
|
2437
|
-
var
|
2535
|
+
var import_react17 = require("react");
|
2438
2536
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
2439
2537
|
var getClassName16 = get_class_name_factory_default("Drawer", styles_module_default10);
|
2440
2538
|
var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
|
2441
|
-
var drawerContext = (0,
|
2539
|
+
var drawerContext = (0, import_react17.createContext)({
|
2442
2540
|
droppableId: ""
|
2443
2541
|
});
|
2444
2542
|
var DrawerDraggable = ({
|
@@ -2469,9 +2567,9 @@ var DrawerItem = ({
|
|
2469
2567
|
index,
|
2470
2568
|
isDragDisabled
|
2471
2569
|
}) => {
|
2472
|
-
const ctx = (0,
|
2570
|
+
const ctx = (0, import_react17.useContext)(drawerContext);
|
2473
2571
|
const resolvedId = `${ctx.droppableId}::${id || name}`;
|
2474
|
-
const CustomInner = (0,
|
2572
|
+
const CustomInner = (0, import_react17.useMemo)(
|
2475
2573
|
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
|
2476
2574
|
[children]
|
2477
2575
|
);
|
@@ -2512,11 +2610,11 @@ Drawer.Item = DrawerItem;
|
|
2512
2610
|
|
2513
2611
|
// components/DropZone/index.tsx
|
2514
2612
|
init_react_import();
|
2515
|
-
var
|
2613
|
+
var import_react21 = require("react");
|
2516
2614
|
|
2517
2615
|
// components/DraggableComponent/index.tsx
|
2518
2616
|
init_react_import();
|
2519
|
-
var
|
2617
|
+
var import_react19 = require("react");
|
2520
2618
|
var import_dnd4 = require("@measured/dnd");
|
2521
2619
|
|
2522
2620
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
@@ -2525,10 +2623,10 @@ var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_1bhad
|
|
2525
2623
|
|
2526
2624
|
// lib/use-modifier-held.ts
|
2527
2625
|
init_react_import();
|
2528
|
-
var
|
2626
|
+
var import_react18 = require("react");
|
2529
2627
|
var useModifierHeld = (modifier) => {
|
2530
|
-
const [modifierHeld, setModifierHeld] = (0,
|
2531
|
-
(0,
|
2628
|
+
const [modifierHeld, setModifierHeld] = (0, import_react18.useState)(false);
|
2629
|
+
(0, import_react18.useEffect)(() => {
|
2532
2630
|
function downHandler({ key }) {
|
2533
2631
|
if (key === modifier) {
|
2534
2632
|
setModifierHeld(true);
|
@@ -2597,14 +2695,14 @@ var DraggableComponent = ({
|
|
2597
2695
|
const { zoomConfig, status, overrides, selectedItem, getPermissions } = useAppContext();
|
2598
2696
|
const isModifierHeld = useModifierHeld("Alt");
|
2599
2697
|
const El = status !== "LOADING" ? import_dnd4.Draggable : DefaultDraggable;
|
2600
|
-
(0,
|
2601
|
-
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0,
|
2602
|
-
(0,
|
2698
|
+
(0, import_react19.useEffect)(onMount, []);
|
2699
|
+
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0, import_react19.useState)(false);
|
2700
|
+
(0, import_react19.useEffect)(() => {
|
2603
2701
|
if (isIos()) {
|
2604
2702
|
setDisableSecondaryAnimation(true);
|
2605
2703
|
}
|
2606
2704
|
}, []);
|
2607
|
-
const CustomActionBar = (0,
|
2705
|
+
const CustomActionBar = (0, import_react19.useMemo)(
|
2608
2706
|
() => overrides.actionBar || DefaultActionBar,
|
2609
2707
|
[overrides.actionBar]
|
2610
2708
|
);
|
@@ -2682,7 +2780,7 @@ var styles_module_default12 = { "DropZone": "_DropZone_djoti_1", "DropZone-conte
|
|
2682
2780
|
|
2683
2781
|
// components/DropZone/context.tsx
|
2684
2782
|
init_react_import();
|
2685
|
-
var
|
2783
|
+
var import_react20 = require("react");
|
2686
2784
|
var import_use_debounce2 = require("use-debounce");
|
2687
2785
|
|
2688
2786
|
// lib/get-zone-id.ts
|
@@ -2699,29 +2797,29 @@ var getZoneId = (zoneCompound) => {
|
|
2699
2797
|
|
2700
2798
|
// components/DropZone/context.tsx
|
2701
2799
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
2702
|
-
var dropZoneContext = (0,
|
2800
|
+
var dropZoneContext = (0, import_react20.createContext)(null);
|
2703
2801
|
var DropZoneProvider = ({
|
2704
2802
|
children,
|
2705
2803
|
value
|
2706
2804
|
}) => {
|
2707
|
-
const [hoveringArea, setHoveringArea] = (0,
|
2708
|
-
const [hoveringZone, setHoveringZone] = (0,
|
2805
|
+
const [hoveringArea, setHoveringArea] = (0, import_react20.useState)(null);
|
2806
|
+
const [hoveringZone, setHoveringZone] = (0, import_react20.useState)(
|
2709
2807
|
rootDroppableId
|
2710
2808
|
);
|
2711
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
2809
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react20.useState)();
|
2712
2810
|
const [hoveringAreaDb] = (0, import_use_debounce2.useDebounce)(hoveringArea, 75, { leading: false });
|
2713
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
2811
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react20.useState)(
|
2714
2812
|
{}
|
2715
2813
|
);
|
2716
|
-
const [activeZones, setActiveZones] = (0,
|
2814
|
+
const [activeZones, setActiveZones] = (0, import_react20.useState)({});
|
2717
2815
|
const { dispatch = null } = value ? value : {};
|
2718
|
-
const registerZoneArea = (0,
|
2816
|
+
const registerZoneArea = (0, import_react20.useCallback)(
|
2719
2817
|
(area) => {
|
2720
2818
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
2721
2819
|
},
|
2722
2820
|
[setAreasWithZones]
|
2723
2821
|
);
|
2724
|
-
const registerZone = (0,
|
2822
|
+
const registerZone = (0, import_react20.useCallback)(
|
2725
2823
|
(zoneCompound) => {
|
2726
2824
|
if (!dispatch) {
|
2727
2825
|
return;
|
@@ -2734,7 +2832,7 @@ var DropZoneProvider = ({
|
|
2734
2832
|
},
|
2735
2833
|
[setActiveZones, dispatch]
|
2736
2834
|
);
|
2737
|
-
const unregisterZone = (0,
|
2835
|
+
const unregisterZone = (0, import_react20.useCallback)(
|
2738
2836
|
(zoneCompound) => {
|
2739
2837
|
if (!dispatch) {
|
2740
2838
|
return;
|
@@ -2749,8 +2847,8 @@ var DropZoneProvider = ({
|
|
2749
2847
|
},
|
2750
2848
|
[setActiveZones, dispatch]
|
2751
2849
|
);
|
2752
|
-
const [pathData, setPathData] = (0,
|
2753
|
-
const registerPath = (0,
|
2850
|
+
const [pathData, setPathData] = (0, import_react20.useState)();
|
2851
|
+
const registerPath = (0, import_react20.useCallback)(
|
2754
2852
|
(selector) => {
|
2755
2853
|
if (!(value == null ? void 0 : value.data)) {
|
2756
2854
|
return;
|
@@ -2775,7 +2873,7 @@ var DropZoneProvider = ({
|
|
2775
2873
|
},
|
2776
2874
|
[value, setPathData]
|
2777
2875
|
);
|
2778
|
-
const [zoneWillDrag, setZoneWillDrag] = (0,
|
2876
|
+
const [zoneWillDrag, setZoneWillDrag] = (0, import_react20.useState)("");
|
2779
2877
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
2780
2878
|
dropZoneContext.Provider,
|
2781
2879
|
{
|
@@ -2807,7 +2905,7 @@ var getClassName18 = get_class_name_factory_default("DropZone", styles_module_de
|
|
2807
2905
|
function DropZoneEdit({ zone, allow, disallow, style }) {
|
2808
2906
|
var _a;
|
2809
2907
|
const appContext2 = useAppContext();
|
2810
|
-
const ctx = (0,
|
2908
|
+
const ctx = (0, import_react21.useContext)(dropZoneContext);
|
2811
2909
|
const {
|
2812
2910
|
// These all need setting via context
|
2813
2911
|
data,
|
@@ -2826,12 +2924,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
2826
2924
|
} = ctx || {};
|
2827
2925
|
let content = data.content || [];
|
2828
2926
|
let zoneCompound = rootDroppableId;
|
2829
|
-
(0,
|
2927
|
+
(0, import_react21.useEffect)(() => {
|
2830
2928
|
if (areaId && registerZoneArea) {
|
2831
2929
|
registerZoneArea(areaId);
|
2832
2930
|
}
|
2833
2931
|
}, [areaId]);
|
2834
|
-
(0,
|
2932
|
+
(0, import_react21.useEffect)(() => {
|
2835
2933
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
2836
2934
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
2837
2935
|
}
|
@@ -3087,7 +3185,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
3087
3185
|
);
|
3088
3186
|
}
|
3089
3187
|
function DropZoneRender({ zone }) {
|
3090
|
-
const ctx = (0,
|
3188
|
+
const ctx = (0, import_react21.useContext)(dropZoneContext);
|
3091
3189
|
const { data, areaId = "root", config } = ctx || {};
|
3092
3190
|
let zoneCompound = rootDroppableId;
|
3093
3191
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -3119,7 +3217,7 @@ function DropZoneRender({ zone }) {
|
|
3119
3217
|
}) });
|
3120
3218
|
}
|
3121
3219
|
function DropZone(props) {
|
3122
|
-
const ctx = (0,
|
3220
|
+
const ctx = (0, import_react21.useContext)(dropZoneContext);
|
3123
3221
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
3124
3222
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZoneEdit, __spreadValues({}, props));
|
3125
3223
|
}
|
@@ -3128,11 +3226,11 @@ function DropZone(props) {
|
|
3128
3226
|
|
3129
3227
|
// components/Puck/index.tsx
|
3130
3228
|
init_react_import();
|
3131
|
-
var
|
3229
|
+
var import_react36 = require("react");
|
3132
3230
|
|
3133
3231
|
// lib/use-placeholder-style.ts
|
3134
3232
|
init_react_import();
|
3135
|
-
var
|
3233
|
+
var import_react22 = require("react");
|
3136
3234
|
|
3137
3235
|
// lib/get-frame.ts
|
3138
3236
|
init_react_import();
|
@@ -3147,7 +3245,7 @@ var getFrame = () => {
|
|
3147
3245
|
// lib/use-placeholder-style.ts
|
3148
3246
|
var usePlaceholderStyle = () => {
|
3149
3247
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
3150
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
3248
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react22.useState)();
|
3151
3249
|
const onDragStartOrUpdate = (draggedItem) => {
|
3152
3250
|
var _a;
|
3153
3251
|
const draggableId = draggedItem.draggableId;
|
@@ -3200,7 +3298,7 @@ var styles_module_default13 = { "SidebarSection": "_SidebarSection_125qe_1", "Si
|
|
3200
3298
|
|
3201
3299
|
// lib/use-breadcrumbs.ts
|
3202
3300
|
init_react_import();
|
3203
|
-
var
|
3301
|
+
var import_react23 = require("react");
|
3204
3302
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
3205
3303
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
3206
3304
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -3250,8 +3348,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
3250
3348
|
state: { data },
|
3251
3349
|
selectedItem
|
3252
3350
|
} = useAppContext();
|
3253
|
-
const dzContext = (0,
|
3254
|
-
return (0,
|
3351
|
+
const dzContext = (0, import_react23.useContext)(dropZoneContext);
|
3352
|
+
return (0, import_react23.useMemo)(() => {
|
3255
3353
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
3256
3354
|
selectedItem,
|
3257
3355
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -3735,7 +3833,23 @@ init_react_import();
|
|
3735
3833
|
var styles_module_default16 = { "PuckFields": "_PuckFields_jp3lw_1", "PuckFields--isLoading": "_PuckFields--isLoading_jp3lw_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_jp3lw_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_jp3lw_25" };
|
3736
3834
|
|
3737
3835
|
// components/Puck/components/Fields/index.tsx
|
3738
|
-
var
|
3836
|
+
var import_react25 = require("react");
|
3837
|
+
|
3838
|
+
// lib/use-parent.ts
|
3839
|
+
init_react_import();
|
3840
|
+
var import_react24 = require("react");
|
3841
|
+
var useParent = (itemSelector) => {
|
3842
|
+
var _a;
|
3843
|
+
const { selectedItem, state } = useAppContext();
|
3844
|
+
const { pathData } = (0, import_react24.useContext)(dropZoneContext) || {};
|
3845
|
+
const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
|
3846
|
+
const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
|
3847
|
+
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
3848
|
+
const parent = (lastItem == null ? void 0 : lastItem.selector) ? (_a = getItem(lastItem.selector, state.data)) != null ? _a : null : null;
|
3849
|
+
return parent || null;
|
3850
|
+
};
|
3851
|
+
|
3852
|
+
// components/Puck/components/Fields/index.tsx
|
3739
3853
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
3740
3854
|
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
3741
3855
|
var defaultPageFields = {
|
@@ -3749,23 +3863,24 @@ var DefaultFields = ({
|
|
3749
3863
|
var useResolvedFields = () => {
|
3750
3864
|
var _a, _b;
|
3751
3865
|
const { selectedItem, state, config } = useAppContext();
|
3866
|
+
const parent = useParent();
|
3752
3867
|
const { data } = state;
|
3753
3868
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
3754
3869
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
3755
|
-
const defaultFields = (0,
|
3870
|
+
const defaultFields = (0, import_react25.useMemo)(
|
3756
3871
|
() => (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {},
|
3757
3872
|
[selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
|
3758
3873
|
);
|
3759
3874
|
const rootProps = data.root.props || data.root;
|
3760
|
-
const [lastSelectedData, setLastSelectedData] = (0,
|
3761
|
-
const [resolvedFields, setResolvedFields] = (0,
|
3762
|
-
const [fieldsLoading, setFieldsLoading] = (0,
|
3875
|
+
const [lastSelectedData, setLastSelectedData] = (0, import_react25.useState)({});
|
3876
|
+
const [resolvedFields, setResolvedFields] = (0, import_react25.useState)(defaultFields);
|
3877
|
+
const [fieldsLoading, setFieldsLoading] = (0, import_react25.useState)(false);
|
3763
3878
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
3764
3879
|
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
3765
3880
|
const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
|
3766
3881
|
const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
|
3767
3882
|
const hasResolver = hasComponentResolver || hasRootResolver;
|
3768
|
-
const resolveFields = (0,
|
3883
|
+
const resolveFields = (0, import_react25.useCallback)(
|
3769
3884
|
(..._0) => __async(void 0, [..._0], function* (fields = {}) {
|
3770
3885
|
var _a2;
|
3771
3886
|
const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : null;
|
@@ -3779,7 +3894,8 @@ var useResolvedFields = () => {
|
|
3779
3894
|
fields,
|
3780
3895
|
lastFields: resolvedFields,
|
3781
3896
|
lastData,
|
3782
|
-
appState: state
|
3897
|
+
appState: state,
|
3898
|
+
parent
|
3783
3899
|
}
|
3784
3900
|
);
|
3785
3901
|
}
|
@@ -3789,7 +3905,8 @@ var useResolvedFields = () => {
|
|
3789
3905
|
fields,
|
3790
3906
|
lastFields: resolvedFields,
|
3791
3907
|
lastData,
|
3792
|
-
appState: state
|
3908
|
+
appState: state,
|
3909
|
+
parent
|
3793
3910
|
});
|
3794
3911
|
}
|
3795
3912
|
return defaultResolveFields(componentData, {
|
@@ -3801,7 +3918,7 @@ var useResolvedFields = () => {
|
|
3801
3918
|
}),
|
3802
3919
|
[data, config, componentData, selectedItem, resolvedFields, state]
|
3803
3920
|
);
|
3804
|
-
(0,
|
3921
|
+
(0, import_react25.useEffect)(() => {
|
3805
3922
|
if (hasResolver) {
|
3806
3923
|
setFieldsLoading(true);
|
3807
3924
|
resolveFields(defaultFields).then((fields) => {
|
@@ -3811,7 +3928,7 @@ var useResolvedFields = () => {
|
|
3811
3928
|
} else {
|
3812
3929
|
setResolvedFields(defaultFields);
|
3813
3930
|
}
|
3814
|
-
}, [data, defaultFields,
|
3931
|
+
}, [data, defaultFields, selectedItem, hasResolver]);
|
3815
3932
|
return [resolvedFields, fieldsLoading];
|
3816
3933
|
};
|
3817
3934
|
var Fields = () => {
|
@@ -3832,7 +3949,7 @@ var Fields = () => {
|
|
3832
3949
|
const componentResolving = selectedItem ? ((_a = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a.loadingCount) > 0 : ((_b = componentState["puck-root"]) == null ? void 0 : _b.loadingCount) > 0;
|
3833
3950
|
const isLoading = fieldsResolving || componentResolving;
|
3834
3951
|
const rootProps = data.root.props || data.root;
|
3835
|
-
const Wrapper = (0,
|
3952
|
+
const Wrapper = (0, import_react25.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
3836
3953
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
3837
3954
|
"form",
|
3838
3955
|
{
|
@@ -3911,34 +4028,36 @@ var Fields = () => {
|
|
3911
4028
|
const { edit } = getPermissions({
|
3912
4029
|
item: selectedItem
|
3913
4030
|
});
|
4031
|
+
const id = `${selectedItem.props.id}_${field.type}_${fieldName}`;
|
3914
4032
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
3915
4033
|
AutoFieldPrivate,
|
3916
4034
|
{
|
3917
4035
|
field,
|
3918
4036
|
name: fieldName,
|
3919
|
-
id
|
4037
|
+
id,
|
3920
4038
|
readOnly: !edit || readOnly[fieldName],
|
3921
4039
|
value: selectedItem.props[fieldName],
|
3922
4040
|
onChange
|
3923
4041
|
},
|
3924
|
-
|
4042
|
+
id
|
3925
4043
|
);
|
3926
4044
|
} else {
|
3927
4045
|
const readOnly = data.root.readOnly || {};
|
3928
4046
|
const { edit } = getPermissions({
|
3929
4047
|
root: true
|
3930
4048
|
});
|
4049
|
+
const id = `root_${field.type}_${fieldName}`;
|
3931
4050
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
3932
4051
|
AutoFieldPrivate,
|
3933
4052
|
{
|
3934
4053
|
field,
|
3935
4054
|
name: fieldName,
|
3936
|
-
id
|
4055
|
+
id,
|
3937
4056
|
readOnly: !edit || readOnly[fieldName],
|
3938
4057
|
value: rootProps[fieldName],
|
3939
4058
|
onChange
|
3940
4059
|
},
|
3941
|
-
|
4060
|
+
id
|
3942
4061
|
);
|
3943
4062
|
}
|
3944
4063
|
}) }),
|
@@ -3953,7 +4072,7 @@ init_react_import();
|
|
3953
4072
|
|
3954
4073
|
// lib/use-component-list.tsx
|
3955
4074
|
init_react_import();
|
3956
|
-
var
|
4075
|
+
var import_react26 = require("react");
|
3957
4076
|
|
3958
4077
|
// components/ComponentList/index.tsx
|
3959
4078
|
init_react_import();
|
@@ -4031,8 +4150,8 @@ ComponentList.Item = ComponentListItem;
|
|
4031
4150
|
// lib/use-component-list.tsx
|
4032
4151
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
4033
4152
|
var useComponentList = (config, ui) => {
|
4034
|
-
const [componentList, setComponentList] = (0,
|
4035
|
-
(0,
|
4153
|
+
const [componentList, setComponentList] = (0, import_react26.useState)();
|
4154
|
+
(0, import_react26.useEffect)(() => {
|
4036
4155
|
var _a, _b, _c;
|
4037
4156
|
if (Object.keys(ui.componentList).length > 0) {
|
4038
4157
|
const matchedComponents = [];
|
@@ -4101,22 +4220,22 @@ var useComponentList = (config, ui) => {
|
|
4101
4220
|
};
|
4102
4221
|
|
4103
4222
|
// components/Puck/components/Components/index.tsx
|
4104
|
-
var
|
4223
|
+
var import_react27 = require("react");
|
4105
4224
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
4106
4225
|
var Components = () => {
|
4107
4226
|
const { config, state, overrides } = useAppContext();
|
4108
4227
|
const componentList = useComponentList(config, state.ui);
|
4109
|
-
const Wrapper = (0,
|
4228
|
+
const Wrapper = (0, import_react27.useMemo)(() => overrides.components || "div", [overrides]);
|
4110
4229
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ComponentList, { id: "all" }) });
|
4111
4230
|
};
|
4112
4231
|
|
4113
4232
|
// components/Puck/components/Preview/index.tsx
|
4114
4233
|
init_react_import();
|
4115
|
-
var
|
4234
|
+
var import_react29 = require("react");
|
4116
4235
|
|
4117
4236
|
// components/AutoFrame/index.tsx
|
4118
4237
|
init_react_import();
|
4119
|
-
var
|
4238
|
+
var import_react28 = require("react");
|
4120
4239
|
var import_object_hash = __toESM(require("object-hash"));
|
4121
4240
|
var import_react_dom2 = require("react-dom");
|
4122
4241
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
@@ -4162,7 +4281,7 @@ var CopyHostStyles = ({
|
|
4162
4281
|
onStylesLoaded = () => null
|
4163
4282
|
}) => {
|
4164
4283
|
const { document: doc, window: win } = useFrame();
|
4165
|
-
(0,
|
4284
|
+
(0, import_react28.useEffect)(() => {
|
4166
4285
|
if (!win || !doc) {
|
4167
4286
|
return () => {
|
4168
4287
|
};
|
@@ -4321,8 +4440,8 @@ var CopyHostStyles = ({
|
|
4321
4440
|
}, []);
|
4322
4441
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
|
4323
4442
|
};
|
4324
|
-
var autoFrameContext = (0,
|
4325
|
-
var useFrame = () => (0,
|
4443
|
+
var autoFrameContext = (0, import_react28.createContext)({});
|
4444
|
+
var useFrame = () => (0, import_react28.useContext)(autoFrameContext);
|
4326
4445
|
function AutoFrame(_a) {
|
4327
4446
|
var _b = _a, {
|
4328
4447
|
children,
|
@@ -4337,11 +4456,11 @@ function AutoFrame(_a) {
|
|
4337
4456
|
"id",
|
4338
4457
|
"onStylesLoaded"
|
4339
4458
|
]);
|
4340
|
-
const [loaded, setLoaded] = (0,
|
4341
|
-
const [ctx, setCtx] = (0,
|
4342
|
-
const ref = (0,
|
4343
|
-
const [mountTarget, setMountTarget] = (0,
|
4344
|
-
(0,
|
4459
|
+
const [loaded, setLoaded] = (0, import_react28.useState)(false);
|
4460
|
+
const [ctx, setCtx] = (0, import_react28.useState)({});
|
4461
|
+
const ref = (0, import_react28.useRef)(null);
|
4462
|
+
const [mountTarget, setMountTarget] = (0, import_react28.useState)();
|
4463
|
+
(0, import_react28.useEffect)(() => {
|
4345
4464
|
var _a2;
|
4346
4465
|
if (ref.current) {
|
4347
4466
|
setCtx({
|
@@ -4377,7 +4496,7 @@ var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4377
4496
|
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
4378
4497
|
var Preview = ({ id = "puck-preview" }) => {
|
4379
4498
|
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
|
4380
|
-
const Page = (0,
|
4499
|
+
const Page = (0, import_react29.useCallback)(
|
4381
4500
|
(pageProps) => {
|
4382
4501
|
var _a, _b;
|
4383
4502
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
@@ -4386,7 +4505,7 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
4386
4505
|
},
|
4387
4506
|
[config.root]
|
4388
4507
|
);
|
4389
|
-
const Frame = (0,
|
4508
|
+
const Frame = (0, import_react29.useMemo)(() => overrides.iframe, [overrides]);
|
4390
4509
|
const rootProps = state.data.root.props || state.data.root;
|
4391
4510
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
4392
4511
|
"div",
|
@@ -4475,7 +4594,7 @@ var scrollIntoView = (el) => {
|
|
4475
4594
|
};
|
4476
4595
|
|
4477
4596
|
// components/LayerTree/index.tsx
|
4478
|
-
var
|
4597
|
+
var import_react30 = require("react");
|
4479
4598
|
|
4480
4599
|
// lib/is-child-of-zone.ts
|
4481
4600
|
init_react_import();
|
@@ -4502,7 +4621,7 @@ var LayerTree = ({
|
|
4502
4621
|
label
|
4503
4622
|
}) => {
|
4504
4623
|
const zones = data.zones || {};
|
4505
|
-
const ctx = (0,
|
4624
|
+
const ctx = (0, import_react30.useContext)(dropZoneContext);
|
4506
4625
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
4507
4626
|
label && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
|
4508
4627
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Layers, { size: "16" }) }),
|
@@ -4608,13 +4727,13 @@ var LayerTree = ({
|
|
4608
4727
|
};
|
4609
4728
|
|
4610
4729
|
// components/Puck/components/Outline/index.tsx
|
4611
|
-
var
|
4730
|
+
var import_react31 = require("react");
|
4612
4731
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
4613
4732
|
var Outline = () => {
|
4614
4733
|
const { dispatch, state, overrides, config } = useAppContext();
|
4615
4734
|
const { data, ui } = state;
|
4616
4735
|
const { itemSelector } = ui;
|
4617
|
-
const setItemSelector = (0,
|
4736
|
+
const setItemSelector = (0, import_react31.useCallback)(
|
4618
4737
|
(newItemSelector) => {
|
4619
4738
|
dispatch({
|
4620
4739
|
type: "setUi",
|
@@ -4623,7 +4742,7 @@ var Outline = () => {
|
|
4623
4742
|
},
|
4624
4743
|
[]
|
4625
4744
|
);
|
4626
|
-
const Wrapper = (0,
|
4745
|
+
const Wrapper = (0, import_react31.useMemo)(() => overrides.outline || "div", [overrides]);
|
4627
4746
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
4628
4747
|
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
4629
4748
|
LayerTree,
|
@@ -4712,19 +4831,19 @@ function usePuckHistory({
|
|
4712
4831
|
|
4713
4832
|
// lib/use-history-store.ts
|
4714
4833
|
init_react_import();
|
4715
|
-
var
|
4834
|
+
var import_react32 = require("react");
|
4716
4835
|
var import_use_debounce3 = require("use-debounce");
|
4717
4836
|
var EMPTY_HISTORY_INDEX = 0;
|
4718
4837
|
function useHistoryStore(initialHistory) {
|
4719
4838
|
var _a, _b;
|
4720
|
-
const [histories, setHistories] = (0,
|
4839
|
+
const [histories, setHistories] = (0, import_react32.useState)(
|
4721
4840
|
(_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
|
4722
4841
|
);
|
4723
4842
|
const updateHistories = (histories2) => {
|
4724
4843
|
setHistories(histories2);
|
4725
4844
|
setIndex(histories2.length - 1);
|
4726
4845
|
};
|
4727
|
-
const [index, setIndex] = (0,
|
4846
|
+
const [index, setIndex] = (0, import_react32.useState)(
|
4728
4847
|
(_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
|
4729
4848
|
);
|
4730
4849
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -4884,11 +5003,11 @@ var getBox = function getBox2(el) {
|
|
4884
5003
|
};
|
4885
5004
|
|
4886
5005
|
// components/Puck/components/Canvas/index.tsx
|
4887
|
-
var
|
5006
|
+
var import_react34 = require("react");
|
4888
5007
|
|
4889
5008
|
// components/ViewportControls/index.tsx
|
4890
5009
|
init_react_import();
|
4891
|
-
var
|
5010
|
+
var import_react33 = require("react");
|
4892
5011
|
|
4893
5012
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
4894
5013
|
init_react_import();
|
@@ -4911,8 +5030,8 @@ var ViewportButton = ({
|
|
4911
5030
|
onClick
|
4912
5031
|
}) => {
|
4913
5032
|
const { state } = useAppContext();
|
4914
|
-
const [isActive, setIsActive] = (0,
|
4915
|
-
(0,
|
5033
|
+
const [isActive, setIsActive] = (0, import_react33.useState)(false);
|
5034
|
+
(0, import_react33.useEffect)(() => {
|
4916
5035
|
setIsActive(width === state.ui.viewports.current.width);
|
4917
5036
|
}, [width, state.ui.viewports.current.width]);
|
4918
5037
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
@@ -4948,7 +5067,7 @@ var ViewportControls = ({
|
|
4948
5067
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
4949
5068
|
(option) => option.value === autoZoom
|
4950
5069
|
);
|
4951
|
-
const zoomOptions = (0,
|
5070
|
+
const zoomOptions = (0, import_react33.useMemo)(
|
4952
5071
|
() => [
|
4953
5072
|
...defaultZoomOptions,
|
4954
5073
|
...defaultsContainAutoZoom ? [] : [
|
@@ -5071,17 +5190,17 @@ var Canvas = () => {
|
|
5071
5190
|
const { status, iframe } = useAppContext();
|
5072
5191
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
5073
5192
|
const { ui } = state;
|
5074
|
-
const frameRef = (0,
|
5075
|
-
const [showTransition, setShowTransition] = (0,
|
5076
|
-
const defaultRender = (0,
|
5193
|
+
const frameRef = (0, import_react34.useRef)(null);
|
5194
|
+
const [showTransition, setShowTransition] = (0, import_react34.useState)(false);
|
5195
|
+
const defaultRender = (0, import_react34.useMemo)(() => {
|
5077
5196
|
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children });
|
5078
5197
|
return PuckDefault;
|
5079
5198
|
}, []);
|
5080
|
-
const CustomPreview = (0,
|
5199
|
+
const CustomPreview = (0, import_react34.useMemo)(
|
5081
5200
|
() => overrides.preview || defaultRender,
|
5082
5201
|
[overrides]
|
5083
5202
|
);
|
5084
|
-
const getFrameDimensions = (0,
|
5203
|
+
const getFrameDimensions = (0, import_react34.useCallback)(() => {
|
5085
5204
|
if (frameRef.current) {
|
5086
5205
|
const frame = frameRef.current;
|
5087
5206
|
const box = getBox(frame);
|
@@ -5089,7 +5208,7 @@ var Canvas = () => {
|
|
5089
5208
|
}
|
5090
5209
|
return { width: 0, height: 0 };
|
5091
5210
|
}, [frameRef]);
|
5092
|
-
const resetAutoZoom = (0,
|
5211
|
+
const resetAutoZoom = (0, import_react34.useCallback)(
|
5093
5212
|
(ui2 = state.ui) => {
|
5094
5213
|
if (frameRef.current) {
|
5095
5214
|
setZoomConfig(
|
@@ -5099,11 +5218,11 @@ var Canvas = () => {
|
|
5099
5218
|
},
|
5100
5219
|
[frameRef, zoomConfig, state.ui]
|
5101
5220
|
);
|
5102
|
-
(0,
|
5221
|
+
(0, import_react34.useEffect)(() => {
|
5103
5222
|
setShowTransition(false);
|
5104
5223
|
resetAutoZoom();
|
5105
5224
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
5106
|
-
(0,
|
5225
|
+
(0, import_react34.useEffect)(() => {
|
5107
5226
|
const { height: frameHeight } = getFrameDimensions();
|
5108
5227
|
if (ui.viewports.current.height === "auto") {
|
5109
5228
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
@@ -5111,13 +5230,13 @@ var Canvas = () => {
|
|
5111
5230
|
}));
|
5112
5231
|
}
|
5113
5232
|
}, [zoomConfig.zoom]);
|
5114
|
-
(0,
|
5233
|
+
(0, import_react34.useEffect)(() => {
|
5115
5234
|
if (ZOOM_ON_CHANGE) {
|
5116
5235
|
setShowTransition(true);
|
5117
5236
|
resetAutoZoom(ui);
|
5118
5237
|
}
|
5119
5238
|
}, [ui.viewports.current.width]);
|
5120
|
-
(0,
|
5239
|
+
(0, import_react34.useEffect)(() => {
|
5121
5240
|
const observer = new ResizeObserver(() => {
|
5122
5241
|
setShowTransition(false);
|
5123
5242
|
resetAutoZoom();
|
@@ -5129,8 +5248,8 @@ var Canvas = () => {
|
|
5129
5248
|
observer.disconnect();
|
5130
5249
|
};
|
5131
5250
|
}, []);
|
5132
|
-
const [showLoader, setShowLoader] = (0,
|
5133
|
-
(0,
|
5251
|
+
const [showLoader, setShowLoader] = (0, import_react34.useState)(false);
|
5252
|
+
(0, import_react34.useEffect)(() => {
|
5134
5253
|
setTimeout(() => {
|
5135
5254
|
setShowLoader(true);
|
5136
5255
|
}, 500);
|
@@ -5233,7 +5352,7 @@ var insertComponent = (componentType, zone, index, {
|
|
5233
5352
|
|
5234
5353
|
// lib/use-loaded-overrides.ts
|
5235
5354
|
init_react_import();
|
5236
|
-
var
|
5355
|
+
var import_react35 = require("react");
|
5237
5356
|
|
5238
5357
|
// lib/load-overrides.ts
|
5239
5358
|
init_react_import();
|
@@ -5272,7 +5391,7 @@ var useLoadedOverrides = ({
|
|
5272
5391
|
overrides,
|
5273
5392
|
plugins
|
5274
5393
|
}) => {
|
5275
|
-
return (0,
|
5394
|
+
return (0, import_react35.useMemo)(() => {
|
5276
5395
|
return loadOverrides({ overrides, plugins });
|
5277
5396
|
}, [plugins, overrides]);
|
5278
5397
|
};
|
@@ -5311,7 +5430,7 @@ function Puck({
|
|
5311
5430
|
enabled: true,
|
5312
5431
|
waitForStyles: true
|
5313
5432
|
}, _iframe);
|
5314
|
-
const [generatedAppState] = (0,
|
5433
|
+
const [generatedAppState] = (0, import_react36.useState)(() => {
|
5315
5434
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
|
5316
5435
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
5317
5436
|
let clientUiState = {};
|
@@ -5383,22 +5502,22 @@ function Puck({
|
|
5383
5502
|
histories,
|
5384
5503
|
index: initialHistoryIndex
|
5385
5504
|
});
|
5386
|
-
const [reducer] = (0,
|
5505
|
+
const [reducer] = (0, import_react36.useState)(
|
5387
5506
|
() => createReducer({
|
5388
5507
|
config,
|
5389
5508
|
record: historyStore.record,
|
5390
5509
|
onAction
|
5391
5510
|
})
|
5392
5511
|
);
|
5393
|
-
const [appState, dispatch] = (0,
|
5512
|
+
const [appState, dispatch] = (0, import_react36.useReducer)(
|
5394
5513
|
reducer,
|
5395
5514
|
flushZones(initialAppState)
|
5396
5515
|
);
|
5397
5516
|
const { data, ui } = appState;
|
5398
5517
|
const history = usePuckHistory({ dispatch, initialAppState, historyStore });
|
5399
|
-
const [menuOpen, setMenuOpen] = (0,
|
5518
|
+
const [menuOpen, setMenuOpen] = (0, import_react36.useState)(false);
|
5400
5519
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
5401
|
-
const setItemSelector = (0,
|
5520
|
+
const setItemSelector = (0, import_react36.useCallback)(
|
5402
5521
|
(newItemSelector) => {
|
5403
5522
|
if (newItemSelector === itemSelector) return;
|
5404
5523
|
dispatch({
|
@@ -5410,13 +5529,13 @@ function Puck({
|
|
5410
5529
|
[itemSelector]
|
5411
5530
|
);
|
5412
5531
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
5413
|
-
(0,
|
5532
|
+
(0, import_react36.useEffect)(() => {
|
5414
5533
|
if (onChange) onChange(data);
|
5415
5534
|
}, [data]);
|
5416
5535
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
5417
|
-
const [draggedItem, setDraggedItem] = (0,
|
5536
|
+
const [draggedItem, setDraggedItem] = (0, import_react36.useState)();
|
5418
5537
|
const rootProps = data.root.props || data.root;
|
5419
|
-
const toggleSidebars = (0,
|
5538
|
+
const toggleSidebars = (0, import_react36.useCallback)(
|
5420
5539
|
(sidebar) => {
|
5421
5540
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
5422
5541
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -5430,7 +5549,7 @@ function Puck({
|
|
5430
5549
|
},
|
5431
5550
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
5432
5551
|
);
|
5433
|
-
(0,
|
5552
|
+
(0, import_react36.useEffect)(() => {
|
5434
5553
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
5435
5554
|
dispatch({
|
5436
5555
|
type: "setUi",
|
@@ -5453,7 +5572,7 @@ function Puck({
|
|
5453
5572
|
window.removeEventListener("resize", handleResize);
|
5454
5573
|
};
|
5455
5574
|
}, []);
|
5456
|
-
const defaultHeaderRender = (0,
|
5575
|
+
const defaultHeaderRender = (0, import_react36.useMemo)(() => {
|
5457
5576
|
if (renderHeader) {
|
5458
5577
|
console.warn(
|
5459
5578
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -5467,7 +5586,7 @@ function Puck({
|
|
5467
5586
|
}
|
5468
5587
|
return DefaultOverride;
|
5469
5588
|
}, [renderHeader]);
|
5470
|
-
const defaultHeaderActionsRender = (0,
|
5589
|
+
const defaultHeaderActionsRender = (0, import_react36.useMemo)(() => {
|
5471
5590
|
if (renderHeaderActions) {
|
5472
5591
|
console.warn(
|
5473
5592
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
@@ -5484,20 +5603,20 @@ function Puck({
|
|
5484
5603
|
overrides,
|
5485
5604
|
plugins
|
5486
5605
|
});
|
5487
|
-
const CustomPuck = (0,
|
5606
|
+
const CustomPuck = (0, import_react36.useMemo)(
|
5488
5607
|
() => loadedOverrides.puck || DefaultOverride,
|
5489
5608
|
[loadedOverrides]
|
5490
5609
|
);
|
5491
|
-
const CustomHeader = (0,
|
5610
|
+
const CustomHeader = (0, import_react36.useMemo)(
|
5492
5611
|
() => loadedOverrides.header || defaultHeaderRender,
|
5493
5612
|
[loadedOverrides]
|
5494
5613
|
);
|
5495
|
-
const CustomHeaderActions = (0,
|
5614
|
+
const CustomHeaderActions = (0, import_react36.useMemo)(
|
5496
5615
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
5497
5616
|
[loadedOverrides]
|
5498
5617
|
);
|
5499
|
-
const [mounted, setMounted] = (0,
|
5500
|
-
(0,
|
5618
|
+
const [mounted, setMounted] = (0, import_react36.useState)(false);
|
5619
|
+
(0, import_react36.useEffect)(() => {
|
5501
5620
|
setMounted(true);
|
5502
5621
|
}, []);
|
5503
5622
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|
@@ -5900,6 +6019,11 @@ var usePuck = () => {
|
|
5900
6019
|
getPermissions,
|
5901
6020
|
refreshPermissions
|
5902
6021
|
} = useAppContext();
|
6022
|
+
if (dispatch === defaultContext.dispatch) {
|
6023
|
+
throw new Error(
|
6024
|
+
"usePuck was used outside of the <Puck> component. The usePuck hook must be rendered within the <Puck> context as children, overrides or plugins as described in https://puckeditor.com/docs/api-reference/functions/use-puck."
|
6025
|
+
);
|
6026
|
+
}
|
5903
6027
|
return {
|
5904
6028
|
appState,
|
5905
6029
|
config,
|
@@ -5950,25 +6074,33 @@ classnames/index.js:
|
|
5950
6074
|
http://jedwatson.github.io/classnames
|
5951
6075
|
*)
|
5952
6076
|
|
6077
|
+
lucide-react/dist/esm/shared/src/utils.js:
|
6078
|
+
(**
|
6079
|
+
* @license lucide-react v0.468.0 - ISC
|
6080
|
+
*
|
6081
|
+
* This source code is licensed under the ISC license.
|
6082
|
+
* See the LICENSE file in the root directory of this source tree.
|
6083
|
+
*)
|
6084
|
+
|
5953
6085
|
lucide-react/dist/esm/defaultAttributes.js:
|
5954
6086
|
(**
|
5955
|
-
* @license lucide-react v0.
|
6087
|
+
* @license lucide-react v0.468.0 - ISC
|
5956
6088
|
*
|
5957
6089
|
* This source code is licensed under the ISC license.
|
5958
6090
|
* See the LICENSE file in the root directory of this source tree.
|
5959
6091
|
*)
|
5960
6092
|
|
5961
|
-
lucide-react/dist/esm/
|
6093
|
+
lucide-react/dist/esm/Icon.js:
|
5962
6094
|
(**
|
5963
|
-
* @license lucide-react v0.
|
6095
|
+
* @license lucide-react v0.468.0 - ISC
|
5964
6096
|
*
|
5965
6097
|
* This source code is licensed under the ISC license.
|
5966
6098
|
* See the LICENSE file in the root directory of this source tree.
|
5967
6099
|
*)
|
5968
6100
|
|
5969
|
-
lucide-react/dist/esm/
|
6101
|
+
lucide-react/dist/esm/createLucideIcon.js:
|
5970
6102
|
(**
|
5971
|
-
* @license lucide-react v0.
|
6103
|
+
* @license lucide-react v0.468.0 - ISC
|
5972
6104
|
*
|
5973
6105
|
* This source code is licensed under the ISC license.
|
5974
6106
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -5976,7 +6108,7 @@ lucide-react/dist/esm/icons/check-circle.js:
|
|
5976
6108
|
|
5977
6109
|
lucide-react/dist/esm/icons/chevron-down.js:
|
5978
6110
|
(**
|
5979
|
-
* @license lucide-react v0.
|
6111
|
+
* @license lucide-react v0.468.0 - ISC
|
5980
6112
|
*
|
5981
6113
|
* This source code is licensed under the ISC license.
|
5982
6114
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -5984,7 +6116,7 @@ lucide-react/dist/esm/icons/chevron-down.js:
|
|
5984
6116
|
|
5985
6117
|
lucide-react/dist/esm/icons/chevron-right.js:
|
5986
6118
|
(**
|
5987
|
-
* @license lucide-react v0.
|
6119
|
+
* @license lucide-react v0.468.0 - ISC
|
5988
6120
|
*
|
5989
6121
|
* This source code is licensed under the ISC license.
|
5990
6122
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -5992,7 +6124,15 @@ lucide-react/dist/esm/icons/chevron-right.js:
|
|
5992
6124
|
|
5993
6125
|
lucide-react/dist/esm/icons/chevron-up.js:
|
5994
6126
|
(**
|
5995
|
-
* @license lucide-react v0.
|
6127
|
+
* @license lucide-react v0.468.0 - ISC
|
6128
|
+
*
|
6129
|
+
* This source code is licensed under the ISC license.
|
6130
|
+
* See the LICENSE file in the root directory of this source tree.
|
6131
|
+
*)
|
6132
|
+
|
6133
|
+
lucide-react/dist/esm/icons/circle-check-big.js:
|
6134
|
+
(**
|
6135
|
+
* @license lucide-react v0.468.0 - ISC
|
5996
6136
|
*
|
5997
6137
|
* This source code is licensed under the ISC license.
|
5998
6138
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6000,7 +6140,15 @@ lucide-react/dist/esm/icons/chevron-up.js:
|
|
6000
6140
|
|
6001
6141
|
lucide-react/dist/esm/icons/copy.js:
|
6002
6142
|
(**
|
6003
|
-
* @license lucide-react v0.
|
6143
|
+
* @license lucide-react v0.468.0 - ISC
|
6144
|
+
*
|
6145
|
+
* This source code is licensed under the ISC license.
|
6146
|
+
* See the LICENSE file in the root directory of this source tree.
|
6147
|
+
*)
|
6148
|
+
|
6149
|
+
lucide-react/dist/esm/icons/ellipsis-vertical.js:
|
6150
|
+
(**
|
6151
|
+
* @license lucide-react v0.468.0 - ISC
|
6004
6152
|
*
|
6005
6153
|
* This source code is licensed under the ISC license.
|
6006
6154
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6008,7 +6156,7 @@ lucide-react/dist/esm/icons/copy.js:
|
|
6008
6156
|
|
6009
6157
|
lucide-react/dist/esm/icons/globe.js:
|
6010
6158
|
(**
|
6011
|
-
* @license lucide-react v0.
|
6159
|
+
* @license lucide-react v0.468.0 - ISC
|
6012
6160
|
*
|
6013
6161
|
* This source code is licensed under the ISC license.
|
6014
6162
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6016,7 +6164,7 @@ lucide-react/dist/esm/icons/globe.js:
|
|
6016
6164
|
|
6017
6165
|
lucide-react/dist/esm/icons/hash.js:
|
6018
6166
|
(**
|
6019
|
-
* @license lucide-react v0.
|
6167
|
+
* @license lucide-react v0.468.0 - ISC
|
6020
6168
|
*
|
6021
6169
|
* This source code is licensed under the ISC license.
|
6022
6170
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6024,7 +6172,7 @@ lucide-react/dist/esm/icons/hash.js:
|
|
6024
6172
|
|
6025
6173
|
lucide-react/dist/esm/icons/layers.js:
|
6026
6174
|
(**
|
6027
|
-
* @license lucide-react v0.
|
6175
|
+
* @license lucide-react v0.468.0 - ISC
|
6028
6176
|
*
|
6029
6177
|
* This source code is licensed under the ISC license.
|
6030
6178
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6032,7 +6180,7 @@ lucide-react/dist/esm/icons/layers.js:
|
|
6032
6180
|
|
6033
6181
|
lucide-react/dist/esm/icons/layout-grid.js:
|
6034
6182
|
(**
|
6035
|
-
* @license lucide-react v0.
|
6183
|
+
* @license lucide-react v0.468.0 - ISC
|
6036
6184
|
*
|
6037
6185
|
* This source code is licensed under the ISC license.
|
6038
6186
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6040,7 +6188,7 @@ lucide-react/dist/esm/icons/layout-grid.js:
|
|
6040
6188
|
|
6041
6189
|
lucide-react/dist/esm/icons/link.js:
|
6042
6190
|
(**
|
6043
|
-
* @license lucide-react v0.
|
6191
|
+
* @license lucide-react v0.468.0 - ISC
|
6044
6192
|
*
|
6045
6193
|
* This source code is licensed under the ISC license.
|
6046
6194
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6048,31 +6196,31 @@ lucide-react/dist/esm/icons/link.js:
|
|
6048
6196
|
|
6049
6197
|
lucide-react/dist/esm/icons/list.js:
|
6050
6198
|
(**
|
6051
|
-
* @license lucide-react v0.
|
6199
|
+
* @license lucide-react v0.468.0 - ISC
|
6052
6200
|
*
|
6053
6201
|
* This source code is licensed under the ISC license.
|
6054
6202
|
* See the LICENSE file in the root directory of this source tree.
|
6055
6203
|
*)
|
6056
6204
|
|
6057
|
-
lucide-react/dist/esm/icons/lock.js:
|
6205
|
+
lucide-react/dist/esm/icons/lock-open.js:
|
6058
6206
|
(**
|
6059
|
-
* @license lucide-react v0.
|
6207
|
+
* @license lucide-react v0.468.0 - ISC
|
6060
6208
|
*
|
6061
6209
|
* This source code is licensed under the ISC license.
|
6062
6210
|
* See the LICENSE file in the root directory of this source tree.
|
6063
6211
|
*)
|
6064
6212
|
|
6065
|
-
lucide-react/dist/esm/icons/
|
6213
|
+
lucide-react/dist/esm/icons/lock.js:
|
6066
6214
|
(**
|
6067
|
-
* @license lucide-react v0.
|
6215
|
+
* @license lucide-react v0.468.0 - ISC
|
6068
6216
|
*
|
6069
6217
|
* This source code is licensed under the ISC license.
|
6070
6218
|
* See the LICENSE file in the root directory of this source tree.
|
6071
6219
|
*)
|
6072
6220
|
|
6073
|
-
lucide-react/dist/esm/icons/
|
6221
|
+
lucide-react/dist/esm/icons/monitor.js:
|
6074
6222
|
(**
|
6075
|
-
* @license lucide-react v0.
|
6223
|
+
* @license lucide-react v0.468.0 - ISC
|
6076
6224
|
*
|
6077
6225
|
* This source code is licensed under the ISC license.
|
6078
6226
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6080,7 +6228,7 @@ lucide-react/dist/esm/icons/more-vertical.js:
|
|
6080
6228
|
|
6081
6229
|
lucide-react/dist/esm/icons/panel-left.js:
|
6082
6230
|
(**
|
6083
|
-
* @license lucide-react v0.
|
6231
|
+
* @license lucide-react v0.468.0 - ISC
|
6084
6232
|
*
|
6085
6233
|
* This source code is licensed under the ISC license.
|
6086
6234
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6088,7 +6236,7 @@ lucide-react/dist/esm/icons/panel-left.js:
|
|
6088
6236
|
|
6089
6237
|
lucide-react/dist/esm/icons/panel-right.js:
|
6090
6238
|
(**
|
6091
|
-
* @license lucide-react v0.
|
6239
|
+
* @license lucide-react v0.468.0 - ISC
|
6092
6240
|
*
|
6093
6241
|
* This source code is licensed under the ISC license.
|
6094
6242
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6096,7 +6244,7 @@ lucide-react/dist/esm/icons/panel-right.js:
|
|
6096
6244
|
|
6097
6245
|
lucide-react/dist/esm/icons/plus.js:
|
6098
6246
|
(**
|
6099
|
-
* @license lucide-react v0.
|
6247
|
+
* @license lucide-react v0.468.0 - ISC
|
6100
6248
|
*
|
6101
6249
|
* This source code is licensed under the ISC license.
|
6102
6250
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6104,7 +6252,7 @@ lucide-react/dist/esm/icons/plus.js:
|
|
6104
6252
|
|
6105
6253
|
lucide-react/dist/esm/icons/redo-2.js:
|
6106
6254
|
(**
|
6107
|
-
* @license lucide-react v0.
|
6255
|
+
* @license lucide-react v0.468.0 - ISC
|
6108
6256
|
*
|
6109
6257
|
* This source code is licensed under the ISC license.
|
6110
6258
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6112,7 +6260,7 @@ lucide-react/dist/esm/icons/redo-2.js:
|
|
6112
6260
|
|
6113
6261
|
lucide-react/dist/esm/icons/search.js:
|
6114
6262
|
(**
|
6115
|
-
* @license lucide-react v0.
|
6263
|
+
* @license lucide-react v0.468.0 - ISC
|
6116
6264
|
*
|
6117
6265
|
* This source code is licensed under the ISC license.
|
6118
6266
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6120,7 +6268,7 @@ lucide-react/dist/esm/icons/search.js:
|
|
6120
6268
|
|
6121
6269
|
lucide-react/dist/esm/icons/sliders-horizontal.js:
|
6122
6270
|
(**
|
6123
|
-
* @license lucide-react v0.
|
6271
|
+
* @license lucide-react v0.468.0 - ISC
|
6124
6272
|
*
|
6125
6273
|
* This source code is licensed under the ISC license.
|
6126
6274
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6128,7 +6276,7 @@ lucide-react/dist/esm/icons/sliders-horizontal.js:
|
|
6128
6276
|
|
6129
6277
|
lucide-react/dist/esm/icons/smartphone.js:
|
6130
6278
|
(**
|
6131
|
-
* @license lucide-react v0.
|
6279
|
+
* @license lucide-react v0.468.0 - ISC
|
6132
6280
|
*
|
6133
6281
|
* This source code is licensed under the ISC license.
|
6134
6282
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6136,7 +6284,7 @@ lucide-react/dist/esm/icons/smartphone.js:
|
|
6136
6284
|
|
6137
6285
|
lucide-react/dist/esm/icons/tablet.js:
|
6138
6286
|
(**
|
6139
|
-
* @license lucide-react v0.
|
6287
|
+
* @license lucide-react v0.468.0 - ISC
|
6140
6288
|
*
|
6141
6289
|
* This source code is licensed under the ISC license.
|
6142
6290
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6144,7 +6292,7 @@ lucide-react/dist/esm/icons/tablet.js:
|
|
6144
6292
|
|
6145
6293
|
lucide-react/dist/esm/icons/trash.js:
|
6146
6294
|
(**
|
6147
|
-
* @license lucide-react v0.
|
6295
|
+
* @license lucide-react v0.468.0 - ISC
|
6148
6296
|
*
|
6149
6297
|
* This source code is licensed under the ISC license.
|
6150
6298
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6152,7 +6300,7 @@ lucide-react/dist/esm/icons/trash.js:
|
|
6152
6300
|
|
6153
6301
|
lucide-react/dist/esm/icons/type.js:
|
6154
6302
|
(**
|
6155
|
-
* @license lucide-react v0.
|
6303
|
+
* @license lucide-react v0.468.0 - ISC
|
6156
6304
|
*
|
6157
6305
|
* This source code is licensed under the ISC license.
|
6158
6306
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6160,15 +6308,7 @@ lucide-react/dist/esm/icons/type.js:
|
|
6160
6308
|
|
6161
6309
|
lucide-react/dist/esm/icons/undo-2.js:
|
6162
6310
|
(**
|
6163
|
-
* @license lucide-react v0.
|
6164
|
-
*
|
6165
|
-
* This source code is licensed under the ISC license.
|
6166
|
-
* See the LICENSE file in the root directory of this source tree.
|
6167
|
-
*)
|
6168
|
-
|
6169
|
-
lucide-react/dist/esm/icons/unlock.js:
|
6170
|
-
(**
|
6171
|
-
* @license lucide-react v0.298.0 - ISC
|
6311
|
+
* @license lucide-react v0.468.0 - ISC
|
6172
6312
|
*
|
6173
6313
|
* This source code is licensed under the ISC license.
|
6174
6314
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6176,7 +6316,7 @@ lucide-react/dist/esm/icons/unlock.js:
|
|
6176
6316
|
|
6177
6317
|
lucide-react/dist/esm/icons/zoom-in.js:
|
6178
6318
|
(**
|
6179
|
-
* @license lucide-react v0.
|
6319
|
+
* @license lucide-react v0.468.0 - ISC
|
6180
6320
|
*
|
6181
6321
|
* This source code is licensed under the ISC license.
|
6182
6322
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6184,7 +6324,7 @@ lucide-react/dist/esm/icons/zoom-in.js:
|
|
6184
6324
|
|
6185
6325
|
lucide-react/dist/esm/icons/zoom-out.js:
|
6186
6326
|
(**
|
6187
|
-
* @license lucide-react v0.
|
6327
|
+
* @license lucide-react v0.468.0 - ISC
|
6188
6328
|
*
|
6189
6329
|
* This source code is licensed under the ISC license.
|
6190
6330
|
* See the LICENSE file in the root directory of this source tree.
|
@@ -6192,7 +6332,7 @@ lucide-react/dist/esm/icons/zoom-out.js:
|
|
6192
6332
|
|
6193
6333
|
lucide-react/dist/esm/lucide-react.js:
|
6194
6334
|
(**
|
6195
|
-
* @license lucide-react v0.
|
6335
|
+
* @license lucide-react v0.468.0 - ISC
|
6196
6336
|
*
|
6197
6337
|
* This source code is licensed under the ISC license.
|
6198
6338
|
* See the LICENSE file in the root directory of this source tree.
|