@measured/puck 0.13.0-canary.2e1b5ef → 0.13.0-canary.b95050d
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{Config-162394d8.d.ts → Config-b8c102e9.d.ts} +12 -2
- package/dist/index.css +14 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +452 -300
- package/dist/rsc.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -760,7 +760,7 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
760
760
|
function validate(props, propName, componentName, location, propFullName) {
|
761
761
|
if (!(props[propName] instanceof expectedClass)) {
|
762
762
|
var expectedClassName = expectedClass.name || ANONYMOUS;
|
763
|
-
var actualClassName =
|
763
|
+
var actualClassName = getClassName21(props[propName]);
|
764
764
|
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
|
765
765
|
}
|
766
766
|
return null;
|
@@ -1012,7 +1012,7 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
1012
1012
|
return type;
|
1013
1013
|
}
|
1014
1014
|
}
|
1015
|
-
function
|
1015
|
+
function getClassName21(propValue) {
|
1016
1016
|
if (!propValue.constructor || !propValue.constructor.name) {
|
1017
1017
|
return ANONYMOUS;
|
1018
1018
|
}
|
@@ -8989,9 +8989,9 @@ var require_react_dom_development = __commonJS({
|
|
8989
8989
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
8990
8990
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
8991
8991
|
}
|
8992
|
-
var
|
8992
|
+
var React22 = require("react");
|
8993
8993
|
var Scheduler = require_scheduler();
|
8994
|
-
var ReactSharedInternals =
|
8994
|
+
var ReactSharedInternals = React22.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
8995
8995
|
var suppressWarning = false;
|
8996
8996
|
function setSuppressWarning(newSuppressWarning) {
|
8997
8997
|
{
|
@@ -10596,7 +10596,7 @@ var require_react_dom_development = __commonJS({
|
|
10596
10596
|
{
|
10597
10597
|
if (props.value == null) {
|
10598
10598
|
if (typeof props.children === "object" && props.children !== null) {
|
10599
|
-
|
10599
|
+
React22.Children.forEach(props.children, function(child) {
|
10600
10600
|
if (child == null) {
|
10601
10601
|
return;
|
10602
10602
|
}
|
@@ -19043,7 +19043,7 @@ var require_react_dom_development = __commonJS({
|
|
19043
19043
|
}
|
19044
19044
|
}
|
19045
19045
|
var fakeInternalInstance = {};
|
19046
|
-
var emptyRefsObject = new
|
19046
|
+
var emptyRefsObject = new React22.Component().refs;
|
19047
19047
|
var didWarnAboutStateAssignmentForComponent;
|
19048
19048
|
var didWarnAboutUninitializedState;
|
19049
19049
|
var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
|
@@ -30215,11 +30215,11 @@ var Button = ({
|
|
30215
30215
|
|
30216
30216
|
// components/DropZone/index.tsx
|
30217
30217
|
init_react_import();
|
30218
|
-
var
|
30218
|
+
var import_react27 = require("react");
|
30219
30219
|
|
30220
30220
|
// components/DraggableComponent/index.tsx
|
30221
30221
|
init_react_import();
|
30222
|
-
var
|
30222
|
+
var import_react24 = require("react");
|
30223
30223
|
var import_dnd = require("@hello-pangea/dnd");
|
30224
30224
|
|
30225
30225
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
@@ -31286,7 +31286,7 @@ Lock.propTypes = {
|
|
31286
31286
|
Lock.displayName = "Lock";
|
31287
31287
|
var lock_default = Lock;
|
31288
31288
|
|
31289
|
-
// ../../node_modules/react-feather/dist/icons/
|
31289
|
+
// ../../node_modules/react-feather/dist/icons/more-vertical.js
|
31290
31290
|
init_react_import();
|
31291
31291
|
var import_react16 = __toESM(require("react"));
|
31292
31292
|
var import_prop_types14 = __toESM(require_prop_types());
|
@@ -31336,7 +31336,7 @@ function _objectWithoutPropertiesLoose14(source, excluded) {
|
|
31336
31336
|
}
|
31337
31337
|
return target;
|
31338
31338
|
}
|
31339
|
-
var
|
31339
|
+
var MoreVertical = (0, import_react16.forwardRef)(function(_ref, ref) {
|
31340
31340
|
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest = _objectWithoutProperties14(_ref, ["color", "size"]);
|
31341
31341
|
return /* @__PURE__ */ import_react16.default.createElement("svg", _extends14({
|
31342
31342
|
ref,
|
@@ -31349,26 +31349,28 @@ var Plus = (0, import_react16.forwardRef)(function(_ref, ref) {
|
|
31349
31349
|
strokeWidth: "2",
|
31350
31350
|
strokeLinecap: "round",
|
31351
31351
|
strokeLinejoin: "round"
|
31352
|
-
}, rest), /* @__PURE__ */ import_react16.default.createElement("
|
31353
|
-
|
31354
|
-
|
31355
|
-
|
31356
|
-
|
31357
|
-
|
31358
|
-
|
31359
|
-
|
31360
|
-
|
31361
|
-
|
31352
|
+
}, rest), /* @__PURE__ */ import_react16.default.createElement("circle", {
|
31353
|
+
cx: "12",
|
31354
|
+
cy: "12",
|
31355
|
+
r: "1"
|
31356
|
+
}), /* @__PURE__ */ import_react16.default.createElement("circle", {
|
31357
|
+
cx: "12",
|
31358
|
+
cy: "5",
|
31359
|
+
r: "1"
|
31360
|
+
}), /* @__PURE__ */ import_react16.default.createElement("circle", {
|
31361
|
+
cx: "12",
|
31362
|
+
cy: "19",
|
31363
|
+
r: "1"
|
31362
31364
|
}));
|
31363
31365
|
});
|
31364
|
-
|
31366
|
+
MoreVertical.propTypes = {
|
31365
31367
|
color: import_prop_types14.default.string,
|
31366
31368
|
size: import_prop_types14.default.oneOfType([import_prop_types14.default.string, import_prop_types14.default.number])
|
31367
31369
|
};
|
31368
|
-
|
31369
|
-
var
|
31370
|
+
MoreVertical.displayName = "MoreVertical";
|
31371
|
+
var more_vertical_default = MoreVertical;
|
31370
31372
|
|
31371
|
-
// ../../node_modules/react-feather/dist/icons/
|
31373
|
+
// ../../node_modules/react-feather/dist/icons/plus.js
|
31372
31374
|
init_react_import();
|
31373
31375
|
var import_react17 = __toESM(require("react"));
|
31374
31376
|
var import_prop_types15 = __toESM(require_prop_types());
|
@@ -31418,7 +31420,7 @@ function _objectWithoutPropertiesLoose15(source, excluded) {
|
|
31418
31420
|
}
|
31419
31421
|
return target;
|
31420
31422
|
}
|
31421
|
-
var
|
31423
|
+
var Plus = (0, import_react17.forwardRef)(function(_ref, ref) {
|
31422
31424
|
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest = _objectWithoutProperties15(_ref, ["color", "size"]);
|
31423
31425
|
return /* @__PURE__ */ import_react17.default.createElement("svg", _extends15({
|
31424
31426
|
ref,
|
@@ -31431,25 +31433,26 @@ var Search = (0, import_react17.forwardRef)(function(_ref, ref) {
|
|
31431
31433
|
strokeWidth: "2",
|
31432
31434
|
strokeLinecap: "round",
|
31433
31435
|
strokeLinejoin: "round"
|
31434
|
-
}, rest), /* @__PURE__ */ import_react17.default.createElement("
|
31435
|
-
|
31436
|
-
|
31437
|
-
|
31436
|
+
}, rest), /* @__PURE__ */ import_react17.default.createElement("line", {
|
31437
|
+
x1: "12",
|
31438
|
+
y1: "5",
|
31439
|
+
x2: "12",
|
31440
|
+
y2: "19"
|
31438
31441
|
}), /* @__PURE__ */ import_react17.default.createElement("line", {
|
31439
|
-
x1: "
|
31440
|
-
y1: "
|
31441
|
-
x2: "
|
31442
|
-
y2: "
|
31442
|
+
x1: "5",
|
31443
|
+
y1: "12",
|
31444
|
+
x2: "19",
|
31445
|
+
y2: "12"
|
31443
31446
|
}));
|
31444
31447
|
});
|
31445
|
-
|
31448
|
+
Plus.propTypes = {
|
31446
31449
|
color: import_prop_types15.default.string,
|
31447
31450
|
size: import_prop_types15.default.oneOfType([import_prop_types15.default.string, import_prop_types15.default.number])
|
31448
31451
|
};
|
31449
|
-
|
31450
|
-
var
|
31452
|
+
Plus.displayName = "Plus";
|
31453
|
+
var plus_default = Plus;
|
31451
31454
|
|
31452
|
-
// ../../node_modules/react-feather/dist/icons/
|
31455
|
+
// ../../node_modules/react-feather/dist/icons/search.js
|
31453
31456
|
init_react_import();
|
31454
31457
|
var import_react18 = __toESM(require("react"));
|
31455
31458
|
var import_prop_types16 = __toESM(require_prop_types());
|
@@ -31499,7 +31502,7 @@ function _objectWithoutPropertiesLoose16(source, excluded) {
|
|
31499
31502
|
}
|
31500
31503
|
return target;
|
31501
31504
|
}
|
31502
|
-
var
|
31505
|
+
var Search = (0, import_react18.forwardRef)(function(_ref, ref) {
|
31503
31506
|
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest = _objectWithoutProperties16(_ref, ["color", "size"]);
|
31504
31507
|
return /* @__PURE__ */ import_react18.default.createElement("svg", _extends16({
|
31505
31508
|
ref,
|
@@ -31512,28 +31515,25 @@ var Sidebar = (0, import_react18.forwardRef)(function(_ref, ref) {
|
|
31512
31515
|
strokeWidth: "2",
|
31513
31516
|
strokeLinecap: "round",
|
31514
31517
|
strokeLinejoin: "round"
|
31515
|
-
}, rest), /* @__PURE__ */ import_react18.default.createElement("
|
31516
|
-
|
31517
|
-
|
31518
|
-
|
31519
|
-
height: "18",
|
31520
|
-
rx: "2",
|
31521
|
-
ry: "2"
|
31518
|
+
}, rest), /* @__PURE__ */ import_react18.default.createElement("circle", {
|
31519
|
+
cx: "11",
|
31520
|
+
cy: "11",
|
31521
|
+
r: "8"
|
31522
31522
|
}), /* @__PURE__ */ import_react18.default.createElement("line", {
|
31523
|
-
x1: "
|
31524
|
-
y1: "
|
31525
|
-
x2: "
|
31526
|
-
y2: "
|
31523
|
+
x1: "21",
|
31524
|
+
y1: "21",
|
31525
|
+
x2: "16.65",
|
31526
|
+
y2: "16.65"
|
31527
31527
|
}));
|
31528
31528
|
});
|
31529
|
-
|
31529
|
+
Search.propTypes = {
|
31530
31530
|
color: import_prop_types16.default.string,
|
31531
31531
|
size: import_prop_types16.default.oneOfType([import_prop_types16.default.string, import_prop_types16.default.number])
|
31532
31532
|
};
|
31533
|
-
|
31534
|
-
var
|
31533
|
+
Search.displayName = "Search";
|
31534
|
+
var search_default = Search;
|
31535
31535
|
|
31536
|
-
// ../../node_modules/react-feather/dist/icons/
|
31536
|
+
// ../../node_modules/react-feather/dist/icons/sidebar.js
|
31537
31537
|
init_react_import();
|
31538
31538
|
var import_react19 = __toESM(require("react"));
|
31539
31539
|
var import_prop_types17 = __toESM(require_prop_types());
|
@@ -31583,7 +31583,7 @@ function _objectWithoutPropertiesLoose17(source, excluded) {
|
|
31583
31583
|
}
|
31584
31584
|
return target;
|
31585
31585
|
}
|
31586
|
-
var
|
31586
|
+
var Sidebar = (0, import_react19.forwardRef)(function(_ref, ref) {
|
31587
31587
|
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest = _objectWithoutProperties17(_ref, ["color", "size"]);
|
31588
31588
|
return /* @__PURE__ */ import_react19.default.createElement("svg", _extends17({
|
31589
31589
|
ref,
|
@@ -31596,20 +31596,28 @@ var Trash = (0, import_react19.forwardRef)(function(_ref, ref) {
|
|
31596
31596
|
strokeWidth: "2",
|
31597
31597
|
strokeLinecap: "round",
|
31598
31598
|
strokeLinejoin: "round"
|
31599
|
-
}, rest), /* @__PURE__ */ import_react19.default.createElement("
|
31600
|
-
|
31601
|
-
|
31602
|
-
|
31599
|
+
}, rest), /* @__PURE__ */ import_react19.default.createElement("rect", {
|
31600
|
+
x: "3",
|
31601
|
+
y: "3",
|
31602
|
+
width: "18",
|
31603
|
+
height: "18",
|
31604
|
+
rx: "2",
|
31605
|
+
ry: "2"
|
31606
|
+
}), /* @__PURE__ */ import_react19.default.createElement("line", {
|
31607
|
+
x1: "9",
|
31608
|
+
y1: "3",
|
31609
|
+
x2: "9",
|
31610
|
+
y2: "21"
|
31603
31611
|
}));
|
31604
31612
|
});
|
31605
|
-
|
31613
|
+
Sidebar.propTypes = {
|
31606
31614
|
color: import_prop_types17.default.string,
|
31607
31615
|
size: import_prop_types17.default.oneOfType([import_prop_types17.default.string, import_prop_types17.default.number])
|
31608
31616
|
};
|
31609
|
-
|
31610
|
-
var
|
31617
|
+
Sidebar.displayName = "Sidebar";
|
31618
|
+
var sidebar_default = Sidebar;
|
31611
31619
|
|
31612
|
-
// ../../node_modules/react-feather/dist/icons/
|
31620
|
+
// ../../node_modules/react-feather/dist/icons/trash.js
|
31613
31621
|
init_react_import();
|
31614
31622
|
var import_react20 = __toESM(require("react"));
|
31615
31623
|
var import_prop_types18 = __toESM(require_prop_types());
|
@@ -31659,7 +31667,7 @@ function _objectWithoutPropertiesLoose18(source, excluded) {
|
|
31659
31667
|
}
|
31660
31668
|
return target;
|
31661
31669
|
}
|
31662
|
-
var
|
31670
|
+
var Trash = (0, import_react20.forwardRef)(function(_ref, ref) {
|
31663
31671
|
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest = _objectWithoutProperties18(_ref, ["color", "size"]);
|
31664
31672
|
return /* @__PURE__ */ import_react20.default.createElement("svg", _extends18({
|
31665
31673
|
ref,
|
@@ -31673,13 +31681,89 @@ var Type = (0, import_react20.forwardRef)(function(_ref, ref) {
|
|
31673
31681
|
strokeLinecap: "round",
|
31674
31682
|
strokeLinejoin: "round"
|
31675
31683
|
}, rest), /* @__PURE__ */ import_react20.default.createElement("polyline", {
|
31684
|
+
points: "3 6 5 6 21 6"
|
31685
|
+
}), /* @__PURE__ */ import_react20.default.createElement("path", {
|
31686
|
+
d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"
|
31687
|
+
}));
|
31688
|
+
});
|
31689
|
+
Trash.propTypes = {
|
31690
|
+
color: import_prop_types18.default.string,
|
31691
|
+
size: import_prop_types18.default.oneOfType([import_prop_types18.default.string, import_prop_types18.default.number])
|
31692
|
+
};
|
31693
|
+
Trash.displayName = "Trash";
|
31694
|
+
var trash_default = Trash;
|
31695
|
+
|
31696
|
+
// ../../node_modules/react-feather/dist/icons/type.js
|
31697
|
+
init_react_import();
|
31698
|
+
var import_react21 = __toESM(require("react"));
|
31699
|
+
var import_prop_types19 = __toESM(require_prop_types());
|
31700
|
+
function _extends19() {
|
31701
|
+
_extends19 = Object.assign || function(target) {
|
31702
|
+
for (var i = 1; i < arguments.length; i++) {
|
31703
|
+
var source = arguments[i];
|
31704
|
+
for (var key in source) {
|
31705
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
31706
|
+
target[key] = source[key];
|
31707
|
+
}
|
31708
|
+
}
|
31709
|
+
}
|
31710
|
+
return target;
|
31711
|
+
};
|
31712
|
+
return _extends19.apply(this, arguments);
|
31713
|
+
}
|
31714
|
+
function _objectWithoutProperties19(source, excluded) {
|
31715
|
+
if (source == null)
|
31716
|
+
return {};
|
31717
|
+
var target = _objectWithoutPropertiesLoose19(source, excluded);
|
31718
|
+
var key, i;
|
31719
|
+
if (Object.getOwnPropertySymbols) {
|
31720
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
31721
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
31722
|
+
key = sourceSymbolKeys[i];
|
31723
|
+
if (excluded.indexOf(key) >= 0)
|
31724
|
+
continue;
|
31725
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
31726
|
+
continue;
|
31727
|
+
target[key] = source[key];
|
31728
|
+
}
|
31729
|
+
}
|
31730
|
+
return target;
|
31731
|
+
}
|
31732
|
+
function _objectWithoutPropertiesLoose19(source, excluded) {
|
31733
|
+
if (source == null)
|
31734
|
+
return {};
|
31735
|
+
var target = {};
|
31736
|
+
var sourceKeys = Object.keys(source);
|
31737
|
+
var key, i;
|
31738
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
31739
|
+
key = sourceKeys[i];
|
31740
|
+
if (excluded.indexOf(key) >= 0)
|
31741
|
+
continue;
|
31742
|
+
target[key] = source[key];
|
31743
|
+
}
|
31744
|
+
return target;
|
31745
|
+
}
|
31746
|
+
var Type = (0, import_react21.forwardRef)(function(_ref, ref) {
|
31747
|
+
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest = _objectWithoutProperties19(_ref, ["color", "size"]);
|
31748
|
+
return /* @__PURE__ */ import_react21.default.createElement("svg", _extends19({
|
31749
|
+
ref,
|
31750
|
+
xmlns: "http://www.w3.org/2000/svg",
|
31751
|
+
width: size,
|
31752
|
+
height: size,
|
31753
|
+
viewBox: "0 0 24 24",
|
31754
|
+
fill: "none",
|
31755
|
+
stroke: color,
|
31756
|
+
strokeWidth: "2",
|
31757
|
+
strokeLinecap: "round",
|
31758
|
+
strokeLinejoin: "round"
|
31759
|
+
}, rest), /* @__PURE__ */ import_react21.default.createElement("polyline", {
|
31676
31760
|
points: "4 7 4 4 20 4 20 7"
|
31677
|
-
}), /* @__PURE__ */
|
31761
|
+
}), /* @__PURE__ */ import_react21.default.createElement("line", {
|
31678
31762
|
x1: "9",
|
31679
31763
|
y1: "20",
|
31680
31764
|
x2: "15",
|
31681
31765
|
y2: "20"
|
31682
|
-
}), /* @__PURE__ */
|
31766
|
+
}), /* @__PURE__ */ import_react21.default.createElement("line", {
|
31683
31767
|
x1: "12",
|
31684
31768
|
y1: "4",
|
31685
31769
|
x2: "12",
|
@@ -31687,18 +31771,18 @@ var Type = (0, import_react20.forwardRef)(function(_ref, ref) {
|
|
31687
31771
|
}));
|
31688
31772
|
});
|
31689
31773
|
Type.propTypes = {
|
31690
|
-
color:
|
31691
|
-
size:
|
31774
|
+
color: import_prop_types19.default.string,
|
31775
|
+
size: import_prop_types19.default.oneOfType([import_prop_types19.default.string, import_prop_types19.default.number])
|
31692
31776
|
};
|
31693
31777
|
Type.displayName = "Type";
|
31694
31778
|
var type_default = Type;
|
31695
31779
|
|
31696
31780
|
// ../../node_modules/react-feather/dist/icons/unlock.js
|
31697
31781
|
init_react_import();
|
31698
|
-
var
|
31699
|
-
var
|
31700
|
-
function
|
31701
|
-
|
31782
|
+
var import_react22 = __toESM(require("react"));
|
31783
|
+
var import_prop_types20 = __toESM(require_prop_types());
|
31784
|
+
function _extends20() {
|
31785
|
+
_extends20 = Object.assign || function(target) {
|
31702
31786
|
for (var i = 1; i < arguments.length; i++) {
|
31703
31787
|
var source = arguments[i];
|
31704
31788
|
for (var key in source) {
|
@@ -31709,12 +31793,12 @@ function _extends19() {
|
|
31709
31793
|
}
|
31710
31794
|
return target;
|
31711
31795
|
};
|
31712
|
-
return
|
31796
|
+
return _extends20.apply(this, arguments);
|
31713
31797
|
}
|
31714
|
-
function
|
31798
|
+
function _objectWithoutProperties20(source, excluded) {
|
31715
31799
|
if (source == null)
|
31716
31800
|
return {};
|
31717
|
-
var target =
|
31801
|
+
var target = _objectWithoutPropertiesLoose20(source, excluded);
|
31718
31802
|
var key, i;
|
31719
31803
|
if (Object.getOwnPropertySymbols) {
|
31720
31804
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
@@ -31729,7 +31813,7 @@ function _objectWithoutProperties19(source, excluded) {
|
|
31729
31813
|
}
|
31730
31814
|
return target;
|
31731
31815
|
}
|
31732
|
-
function
|
31816
|
+
function _objectWithoutPropertiesLoose20(source, excluded) {
|
31733
31817
|
if (source == null)
|
31734
31818
|
return {};
|
31735
31819
|
var target = {};
|
@@ -31743,9 +31827,9 @@ function _objectWithoutPropertiesLoose19(source, excluded) {
|
|
31743
31827
|
}
|
31744
31828
|
return target;
|
31745
31829
|
}
|
31746
|
-
var Unlock = (0,
|
31747
|
-
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest =
|
31748
|
-
return /* @__PURE__ */
|
31830
|
+
var Unlock = (0, import_react22.forwardRef)(function(_ref, ref) {
|
31831
|
+
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest = _objectWithoutProperties20(_ref, ["color", "size"]);
|
31832
|
+
return /* @__PURE__ */ import_react22.default.createElement("svg", _extends20({
|
31749
31833
|
ref,
|
31750
31834
|
xmlns: "http://www.w3.org/2000/svg",
|
31751
31835
|
width: size,
|
@@ -31756,30 +31840,30 @@ var Unlock = (0, import_react21.forwardRef)(function(_ref, ref) {
|
|
31756
31840
|
strokeWidth: "2",
|
31757
31841
|
strokeLinecap: "round",
|
31758
31842
|
strokeLinejoin: "round"
|
31759
|
-
}, rest), /* @__PURE__ */
|
31843
|
+
}, rest), /* @__PURE__ */ import_react22.default.createElement("rect", {
|
31760
31844
|
x: "3",
|
31761
31845
|
y: "11",
|
31762
31846
|
width: "18",
|
31763
31847
|
height: "11",
|
31764
31848
|
rx: "2",
|
31765
31849
|
ry: "2"
|
31766
|
-
}), /* @__PURE__ */
|
31850
|
+
}), /* @__PURE__ */ import_react22.default.createElement("path", {
|
31767
31851
|
d: "M7 11V7a5 5 0 0 1 9.9-1"
|
31768
31852
|
}));
|
31769
31853
|
});
|
31770
31854
|
Unlock.propTypes = {
|
31771
|
-
color:
|
31772
|
-
size:
|
31855
|
+
color: import_prop_types20.default.string,
|
31856
|
+
size: import_prop_types20.default.oneOfType([import_prop_types20.default.string, import_prop_types20.default.number])
|
31773
31857
|
};
|
31774
31858
|
Unlock.displayName = "Unlock";
|
31775
31859
|
var unlock_default = Unlock;
|
31776
31860
|
|
31777
31861
|
// lib/use-modifier-held.ts
|
31778
31862
|
init_react_import();
|
31779
|
-
var
|
31863
|
+
var import_react23 = require("react");
|
31780
31864
|
var useModifierHeld = (modifier) => {
|
31781
|
-
const [modifierHeld, setModifierHeld] = (0,
|
31782
|
-
(0,
|
31865
|
+
const [modifierHeld, setModifierHeld] = (0, import_react23.useState)(false);
|
31866
|
+
(0, import_react23.useEffect)(() => {
|
31783
31867
|
function downHandler({ key }) {
|
31784
31868
|
if (key === modifier) {
|
31785
31869
|
setModifierHeld(true);
|
@@ -31827,7 +31911,7 @@ var DraggableComponent = ({
|
|
31827
31911
|
style
|
31828
31912
|
}) => {
|
31829
31913
|
const isModifierHeld = useModifierHeld("Alt");
|
31830
|
-
(0,
|
31914
|
+
(0, import_react24.useEffect)(onMount, []);
|
31831
31915
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
31832
31916
|
import_dnd.Draggable,
|
31833
31917
|
{
|
@@ -31934,7 +32018,7 @@ var styles_module_default2 = { "DropZone": "_DropZone_1akqa_1", "DropZone-conten
|
|
31934
32018
|
|
31935
32019
|
// components/DropZone/context.tsx
|
31936
32020
|
init_react_import();
|
31937
|
-
var
|
32021
|
+
var import_react25 = require("react");
|
31938
32022
|
var import_use_debounce = require("use-debounce");
|
31939
32023
|
|
31940
32024
|
// lib/get-zone-id.ts
|
@@ -31951,29 +32035,29 @@ var getZoneId = (zoneCompound) => {
|
|
31951
32035
|
|
31952
32036
|
// components/DropZone/context.tsx
|
31953
32037
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
31954
|
-
var dropZoneContext = (0,
|
32038
|
+
var dropZoneContext = (0, import_react25.createContext)(null);
|
31955
32039
|
var DropZoneProvider = ({
|
31956
32040
|
children,
|
31957
32041
|
value
|
31958
32042
|
}) => {
|
31959
|
-
const [hoveringArea, setHoveringArea] = (0,
|
31960
|
-
const [hoveringZone, setHoveringZone] = (0,
|
32043
|
+
const [hoveringArea, setHoveringArea] = (0, import_react25.useState)(null);
|
32044
|
+
const [hoveringZone, setHoveringZone] = (0, import_react25.useState)(
|
31961
32045
|
rootDroppableId
|
31962
32046
|
);
|
31963
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
32047
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react25.useState)();
|
31964
32048
|
const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
|
31965
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
32049
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react25.useState)(
|
31966
32050
|
{}
|
31967
32051
|
);
|
31968
|
-
const [activeZones, setActiveZones] = (0,
|
32052
|
+
const [activeZones, setActiveZones] = (0, import_react25.useState)({});
|
31969
32053
|
const { dispatch = null } = value ? value : {};
|
31970
|
-
const registerZoneArea = (0,
|
32054
|
+
const registerZoneArea = (0, import_react25.useCallback)(
|
31971
32055
|
(area) => {
|
31972
32056
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
31973
32057
|
},
|
31974
32058
|
[setAreasWithZones]
|
31975
32059
|
);
|
31976
|
-
const registerZone = (0,
|
32060
|
+
const registerZone = (0, import_react25.useCallback)(
|
31977
32061
|
(zoneCompound) => {
|
31978
32062
|
if (!dispatch) {
|
31979
32063
|
return;
|
@@ -31986,7 +32070,7 @@ var DropZoneProvider = ({
|
|
31986
32070
|
},
|
31987
32071
|
[setActiveZones, dispatch]
|
31988
32072
|
);
|
31989
|
-
const unregisterZone = (0,
|
32073
|
+
const unregisterZone = (0, import_react25.useCallback)(
|
31990
32074
|
(zoneCompound) => {
|
31991
32075
|
if (!dispatch) {
|
31992
32076
|
return;
|
@@ -32001,8 +32085,8 @@ var DropZoneProvider = ({
|
|
32001
32085
|
},
|
32002
32086
|
[setActiveZones, dispatch]
|
32003
32087
|
);
|
32004
|
-
const [pathData, setPathData] = (0,
|
32005
|
-
const registerPath = (0,
|
32088
|
+
const [pathData, setPathData] = (0, import_react25.useState)();
|
32089
|
+
const registerPath = (0, import_react25.useCallback)(
|
32006
32090
|
(selector) => {
|
32007
32091
|
if (!(value == null ? void 0 : value.data)) {
|
32008
32092
|
return;
|
@@ -32052,7 +32136,7 @@ var DropZoneProvider = ({
|
|
32052
32136
|
|
32053
32137
|
// components/Puck/context.tsx
|
32054
32138
|
init_react_import();
|
32055
|
-
var
|
32139
|
+
var import_react26 = require("react");
|
32056
32140
|
var defaultAppState = {
|
32057
32141
|
data: { content: [], root: { title: "" } },
|
32058
32142
|
ui: {
|
@@ -32063,7 +32147,7 @@ var defaultAppState = {
|
|
32063
32147
|
componentList: {}
|
32064
32148
|
}
|
32065
32149
|
};
|
32066
|
-
var appContext = (0,
|
32150
|
+
var appContext = (0, import_react26.createContext)({
|
32067
32151
|
state: defaultAppState,
|
32068
32152
|
dispatch: () => null,
|
32069
32153
|
config: { components: {} },
|
@@ -32071,7 +32155,7 @@ var appContext = (0, import_react25.createContext)({
|
|
32071
32155
|
});
|
32072
32156
|
var AppProvider = appContext.Provider;
|
32073
32157
|
var useAppContext = () => {
|
32074
|
-
const mainContext = (0,
|
32158
|
+
const mainContext = (0, import_react26.useContext)(appContext);
|
32075
32159
|
const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
|
32076
32160
|
return __spreadProps(__spreadValues({}, mainContext), {
|
32077
32161
|
// Helpers
|
@@ -32092,7 +32176,7 @@ var getClassName3 = get_class_name_factory_default("DropZone", styles_module_def
|
|
32092
32176
|
function DropZoneEdit({ zone, allow, disallow, style }) {
|
32093
32177
|
var _a;
|
32094
32178
|
const appContext2 = useAppContext();
|
32095
|
-
const ctx = (0,
|
32179
|
+
const ctx = (0, import_react27.useContext)(dropZoneContext);
|
32096
32180
|
const {
|
32097
32181
|
// These all need setting via context
|
32098
32182
|
data,
|
@@ -32109,12 +32193,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
32109
32193
|
} = ctx || {};
|
32110
32194
|
let content = data.content || [];
|
32111
32195
|
let zoneCompound = rootDroppableId;
|
32112
|
-
(0,
|
32196
|
+
(0, import_react27.useEffect)(() => {
|
32113
32197
|
if (areaId && registerZoneArea) {
|
32114
32198
|
registerZoneArea(areaId);
|
32115
32199
|
}
|
32116
32200
|
}, [areaId]);
|
32117
|
-
(0,
|
32201
|
+
(0, import_react27.useEffect)(() => {
|
32118
32202
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
32119
32203
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
32120
32204
|
}
|
@@ -32135,7 +32219,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
32135
32219
|
const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
|
32136
32220
|
const [zoneArea] = getZoneId(zoneCompound);
|
32137
32221
|
const [draggedSourceArea] = getZoneId(draggedSourceId);
|
32138
|
-
const [userWillDrag, setUserWillDrag] = (0,
|
32222
|
+
const [userWillDrag, setUserWillDrag] = (0, import_react27.useState)(false);
|
32139
32223
|
const userIsDragging = !!draggedItem;
|
32140
32224
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
32141
32225
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
@@ -32353,7 +32437,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
32353
32437
|
);
|
32354
32438
|
}
|
32355
32439
|
function DropZoneRender({ zone }) {
|
32356
|
-
const ctx = (0,
|
32440
|
+
const ctx = (0, import_react27.useContext)(dropZoneContext);
|
32357
32441
|
const { data, areaId = "root", config } = ctx || {};
|
32358
32442
|
let zoneCompound = rootDroppableId;
|
32359
32443
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -32385,7 +32469,7 @@ function DropZoneRender({ zone }) {
|
|
32385
32469
|
}) });
|
32386
32470
|
}
|
32387
32471
|
function DropZone(props) {
|
32388
|
-
const ctx = (0,
|
32472
|
+
const ctx = (0, import_react27.useContext)(dropZoneContext);
|
32389
32473
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
32390
32474
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DropZoneEdit, __spreadValues({}, props));
|
32391
32475
|
}
|
@@ -32397,7 +32481,7 @@ init_react_import();
|
|
32397
32481
|
|
32398
32482
|
// components/IconButton/IconButton.tsx
|
32399
32483
|
init_react_import();
|
32400
|
-
var
|
32484
|
+
var import_react28 = require("react");
|
32401
32485
|
|
32402
32486
|
// css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
|
32403
32487
|
init_react_import();
|
@@ -32419,7 +32503,7 @@ var IconButton = ({
|
|
32419
32503
|
fullWidth,
|
32420
32504
|
title
|
32421
32505
|
}) => {
|
32422
|
-
const [loading, setLoading] = (0,
|
32506
|
+
const [loading, setLoading] = (0, import_react28.useState)(false);
|
32423
32507
|
const ElementType = href ? "a" : "button";
|
32424
32508
|
const el = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
32425
32509
|
ElementType,
|
@@ -32460,7 +32544,7 @@ var IconButton = ({
|
|
32460
32544
|
|
32461
32545
|
// components/Puck/index.tsx
|
32462
32546
|
init_react_import();
|
32463
|
-
var
|
32547
|
+
var import_react41 = require("react");
|
32464
32548
|
var import_dnd7 = require("@hello-pangea/dnd");
|
32465
32549
|
|
32466
32550
|
// components/InputOrGroup/index.tsx
|
@@ -32471,7 +32555,7 @@ init_react_import();
|
|
32471
32555
|
var styles_module_default3 = { "Input": "_Input_1jyrm_1", "Input-label": "_Input-label_1jyrm_27", "Input-labelIcon": "_Input-labelIcon_1jyrm_35", "Input-disabledIcon": "_Input-disabledIcon_1jyrm_41", "Input-input": "_Input-input_1jyrm_46", "Input--readOnly": "_Input--readOnly_1jyrm_69", "Input-radioGroupItems": "_Input-radioGroupItems_1jyrm_87", "Input-radio": "_Input-radio_1jyrm_87", "Input-radioInner": "_Input-radioInner_1jyrm_104", "Input-radioInput": "_Input-radioInput_1jyrm_126" };
|
32472
32556
|
|
32473
32557
|
// components/InputOrGroup/index.tsx
|
32474
|
-
var
|
32558
|
+
var import_react33 = require("react");
|
32475
32559
|
|
32476
32560
|
// components/InputOrGroup/fields/index.tsx
|
32477
32561
|
init_react_import();
|
@@ -32536,7 +32620,7 @@ var Draggable2 = ({
|
|
32536
32620
|
};
|
32537
32621
|
|
32538
32622
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
32539
|
-
var
|
32623
|
+
var import_react29 = require("react");
|
32540
32624
|
|
32541
32625
|
// components/DragIcon/index.tsx
|
32542
32626
|
init_react_import();
|
@@ -32574,11 +32658,11 @@ var ArrayField = ({
|
|
32574
32658
|
}),
|
32575
32659
|
openId: ""
|
32576
32660
|
};
|
32577
|
-
const [localState, setLocalState] = (0,
|
32578
|
-
(0,
|
32661
|
+
const [localState, setLocalState] = (0, import_react29.useState)({ arrayState, value });
|
32662
|
+
(0, import_react29.useEffect)(() => {
|
32579
32663
|
setLocalState({ arrayState, value });
|
32580
32664
|
}, [value, state.ui.arrayState[id]]);
|
32581
|
-
const mapArrayStateToUi = (0,
|
32665
|
+
const mapArrayStateToUi = (0, import_react29.useCallback)(
|
32582
32666
|
(partialArrayState) => {
|
32583
32667
|
return {
|
32584
32668
|
arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
|
@@ -32588,13 +32672,13 @@ var ArrayField = ({
|
|
32588
32672
|
},
|
32589
32673
|
[arrayState]
|
32590
32674
|
);
|
32591
|
-
const getHighestIndex = (0,
|
32675
|
+
const getHighestIndex = (0, import_react29.useCallback)(() => {
|
32592
32676
|
return arrayState.items.reduce(
|
32593
32677
|
(acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
|
32594
32678
|
-1
|
32595
32679
|
);
|
32596
32680
|
}, [arrayState]);
|
32597
|
-
const regenerateArrayState = (0,
|
32681
|
+
const regenerateArrayState = (0, import_react29.useCallback)(
|
32598
32682
|
(value2) => {
|
32599
32683
|
let highestIndex = getHighestIndex();
|
32600
32684
|
const newItems = Array.from(value2 || []).map((item, idx) => {
|
@@ -32613,10 +32697,10 @@ var ArrayField = ({
|
|
32613
32697
|
},
|
32614
32698
|
[arrayState]
|
32615
32699
|
);
|
32616
|
-
(0,
|
32700
|
+
(0, import_react29.useEffect)(() => {
|
32617
32701
|
setUi(mapArrayStateToUi(arrayState));
|
32618
32702
|
}, []);
|
32619
|
-
const [hovering, setHovering] = (0,
|
32703
|
+
const [hovering, setHovering] = (0, import_react29.useState)(false);
|
32620
32704
|
if (field.type !== "array" || !field.arrayFields) {
|
32621
32705
|
return null;
|
32622
32706
|
}
|
@@ -32845,11 +32929,11 @@ var DefaultField = ({
|
|
32845
32929
|
|
32846
32930
|
// components/InputOrGroup/fields/ExternalField/index.tsx
|
32847
32931
|
init_react_import();
|
32848
|
-
var
|
32932
|
+
var import_react32 = require("react");
|
32849
32933
|
|
32850
32934
|
// components/ExternalInput/index.tsx
|
32851
32935
|
init_react_import();
|
32852
|
-
var
|
32936
|
+
var import_react31 = require("react");
|
32853
32937
|
|
32854
32938
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
32855
32939
|
init_react_import();
|
@@ -32857,7 +32941,7 @@ var styles_module_default6 = { "ExternalInput": "_ExternalInput_s6fxy_1", "Exter
|
|
32857
32941
|
|
32858
32942
|
// components/Modal/index.tsx
|
32859
32943
|
init_react_import();
|
32860
|
-
var
|
32944
|
+
var import_react30 = require("react");
|
32861
32945
|
|
32862
32946
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
32863
32947
|
init_react_import();
|
@@ -32872,8 +32956,8 @@ var Modal = ({
|
|
32872
32956
|
onClose,
|
32873
32957
|
isOpen
|
32874
32958
|
}) => {
|
32875
|
-
const [rootEl, setRootEl] = (0,
|
32876
|
-
(0,
|
32959
|
+
const [rootEl, setRootEl] = (0, import_react30.useState)(null);
|
32960
|
+
(0, import_react30.useEffect)(() => {
|
32877
32961
|
setRootEl(document.getElementById("puck-portal-root"));
|
32878
32962
|
}, []);
|
32879
32963
|
if (!rootEl) {
|
@@ -32929,10 +33013,10 @@ var ExternalInput = ({
|
|
32929
33013
|
id
|
32930
33014
|
}) => {
|
32931
33015
|
const { mapProp = (val) => val } = field || {};
|
32932
|
-
const [data, setData] = (0,
|
32933
|
-
const [isOpen, setOpen] = (0,
|
32934
|
-
const [isLoading, setIsLoading] = (0,
|
32935
|
-
const keys = (0,
|
33016
|
+
const [data, setData] = (0, import_react31.useState)([]);
|
33017
|
+
const [isOpen, setOpen] = (0, import_react31.useState)(false);
|
33018
|
+
const [isLoading, setIsLoading] = (0, import_react31.useState)(true);
|
33019
|
+
const keys = (0, import_react31.useMemo)(() => {
|
32936
33020
|
const validKeys = /* @__PURE__ */ new Set();
|
32937
33021
|
for (const item of data) {
|
32938
33022
|
for (const key of Object.keys(item)) {
|
@@ -32943,8 +33027,8 @@ var ExternalInput = ({
|
|
32943
33027
|
}
|
32944
33028
|
return Array.from(validKeys);
|
32945
33029
|
}, [data]);
|
32946
|
-
const [searchQuery, setSearchQuery] = (0,
|
32947
|
-
const search = (0,
|
33030
|
+
const [searchQuery, setSearchQuery] = (0, import_react31.useState)(field.initialQuery || "");
|
33031
|
+
const search = (0, import_react31.useCallback)(
|
32948
33032
|
(query) => __async(void 0, null, function* () {
|
32949
33033
|
setIsLoading(true);
|
32950
33034
|
const cacheKey = `${id}-${name}-${query}`;
|
@@ -32957,7 +33041,7 @@ var ExternalInput = ({
|
|
32957
33041
|
}),
|
32958
33042
|
[name, field]
|
32959
33043
|
);
|
32960
|
-
(0,
|
33044
|
+
(0, import_react31.useEffect)(() => {
|
32961
33045
|
search(searchQuery);
|
32962
33046
|
}, []);
|
32963
33047
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
@@ -33086,7 +33170,7 @@ var ExternalField = ({
|
|
33086
33170
|
var _a, _b, _c;
|
33087
33171
|
const validField = field;
|
33088
33172
|
const deprecatedField = field;
|
33089
|
-
(0,
|
33173
|
+
(0, import_react32.useEffect)(() => {
|
33090
33174
|
if (deprecatedField.adaptor) {
|
33091
33175
|
console.error(
|
33092
33176
|
"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."
|
@@ -33135,7 +33219,8 @@ var RadioField = ({
|
|
33135
33219
|
readOnly,
|
33136
33220
|
value,
|
33137
33221
|
name,
|
33138
|
-
id
|
33222
|
+
id,
|
33223
|
+
label
|
33139
33224
|
}) => {
|
33140
33225
|
if (field.type !== "radio" || !field.options) {
|
33141
33226
|
return null;
|
@@ -33144,7 +33229,7 @@ var RadioField = ({
|
|
33144
33229
|
FieldLabelInternal,
|
33145
33230
|
{
|
33146
33231
|
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(check_circle_default, { size: 16 }),
|
33147
|
-
label:
|
33232
|
+
label: label || name,
|
33148
33233
|
readOnly,
|
33149
33234
|
el: "div",
|
33150
33235
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
@@ -33266,8 +33351,72 @@ var TextareaField = ({
|
|
33266
33351
|
|
33267
33352
|
// components/InputOrGroup/index.tsx
|
33268
33353
|
var import_use_debounce2 = require("use-debounce");
|
33354
|
+
|
33355
|
+
// components/InputOrGroup/fields/ObjectField/index.tsx
|
33356
|
+
init_react_import();
|
33357
|
+
|
33358
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ObjectField/styles.module.css#css-module
|
33359
|
+
init_react_import();
|
33360
|
+
var styles_module_default9 = { "ObjectField": "_ObjectField_56z4t_5", "ObjectField-fieldset": "_ObjectField-fieldset_56z4t_13" };
|
33361
|
+
|
33362
|
+
// components/InputOrGroup/fields/ObjectField/index.tsx
|
33269
33363
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
33270
|
-
var getClassName14 = get_class_name_factory_default("
|
33364
|
+
var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
|
33365
|
+
var getClassNameItem2 = get_class_name_factory_default("ObjectFieldItem", styles_module_default9);
|
33366
|
+
var ObjectField = ({
|
33367
|
+
field,
|
33368
|
+
onChange,
|
33369
|
+
value,
|
33370
|
+
name,
|
33371
|
+
label,
|
33372
|
+
readOnly,
|
33373
|
+
readOnlyFields = {},
|
33374
|
+
id
|
33375
|
+
}) => {
|
33376
|
+
if (field.type !== "object" || !field.objectFields) {
|
33377
|
+
return null;
|
33378
|
+
}
|
33379
|
+
const data = value || {};
|
33380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
33381
|
+
FieldLabelInternal,
|
33382
|
+
{
|
33383
|
+
label: label || name,
|
33384
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(more_vertical_default, { size: 16 }),
|
33385
|
+
el: "div",
|
33386
|
+
readOnly,
|
33387
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14(), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
|
33388
|
+
const subField = field.objectFields[fieldName];
|
33389
|
+
const subFieldName = `${name}.${fieldName}`;
|
33390
|
+
const wildcardFieldName = `${name}.${fieldName}`;
|
33391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
33392
|
+
InputOrGroup,
|
33393
|
+
{
|
33394
|
+
name: subFieldName,
|
33395
|
+
label: subField.label || fieldName,
|
33396
|
+
id: `${id}_${fieldName}`,
|
33397
|
+
readOnly: typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName],
|
33398
|
+
readOnlyFields,
|
33399
|
+
field: subField,
|
33400
|
+
value: data[fieldName],
|
33401
|
+
onChange: (val, ui) => {
|
33402
|
+
onChange(
|
33403
|
+
__spreadProps(__spreadValues({}, data), {
|
33404
|
+
[fieldName]: val
|
33405
|
+
}),
|
33406
|
+
ui
|
33407
|
+
);
|
33408
|
+
}
|
33409
|
+
},
|
33410
|
+
subFieldName
|
33411
|
+
);
|
33412
|
+
}) }) })
|
33413
|
+
}
|
33414
|
+
);
|
33415
|
+
};
|
33416
|
+
|
33417
|
+
// components/InputOrGroup/index.tsx
|
33418
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
33419
|
+
var getClassName15 = get_class_name_factory_default("Input", styles_module_default3);
|
33271
33420
|
var FieldLabel = ({
|
33272
33421
|
children,
|
33273
33422
|
icon,
|
@@ -33277,11 +33426,11 @@ var FieldLabel = ({
|
|
33277
33426
|
className
|
33278
33427
|
}) => {
|
33279
33428
|
const El = el;
|
33280
|
-
return /* @__PURE__ */ (0,
|
33281
|
-
/* @__PURE__ */ (0,
|
33282
|
-
icon ? /* @__PURE__ */ (0,
|
33429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(El, { className, children: [
|
33430
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName15("label"), children: [
|
33431
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, {}),
|
33283
33432
|
label,
|
33284
|
-
readOnly && /* @__PURE__ */ (0,
|
33433
|
+
readOnly && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(lock_default, { size: "12" }) })
|
33285
33434
|
] }),
|
33286
33435
|
children
|
33287
33436
|
] });
|
@@ -33293,12 +33442,12 @@ var FieldLabelInternal = ({
|
|
33293
33442
|
el = "label",
|
33294
33443
|
readOnly
|
33295
33444
|
}) => {
|
33296
|
-
return /* @__PURE__ */ (0,
|
33445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
33297
33446
|
FieldLabel,
|
33298
33447
|
{
|
33299
33448
|
label,
|
33300
33449
|
icon,
|
33301
|
-
className:
|
33450
|
+
className: getClassName15({ readOnly }),
|
33302
33451
|
readOnly,
|
33303
33452
|
el,
|
33304
33453
|
children
|
@@ -33308,7 +33457,7 @@ var FieldLabelInternal = ({
|
|
33308
33457
|
var InputOrGroup = (_a) => {
|
33309
33458
|
var _b = _a, { onChange } = _b, props = __objRest(_b, ["onChange"]);
|
33310
33459
|
const { name, field, value, readOnly } = props;
|
33311
|
-
const [localValue, setLocalValue] = (0,
|
33460
|
+
const [localValue, setLocalValue] = (0, import_react33.useState)(value);
|
33312
33461
|
const onChangeDb = (0, import_use_debounce2.useDebouncedCallback)(
|
33313
33462
|
(val, ui) => {
|
33314
33463
|
onChange(val, ui);
|
@@ -33316,11 +33465,11 @@ var InputOrGroup = (_a) => {
|
|
33316
33465
|
50,
|
33317
33466
|
{ leading: true }
|
33318
33467
|
);
|
33319
|
-
const onChangeLocal = (0,
|
33468
|
+
const onChangeLocal = (0, import_react33.useCallback)((val, ui) => {
|
33320
33469
|
setLocalValue(val);
|
33321
33470
|
onChangeDb(val, ui);
|
33322
33471
|
}, []);
|
33323
|
-
(0,
|
33472
|
+
(0, import_react33.useEffect)(() => {
|
33324
33473
|
setLocalValue(value);
|
33325
33474
|
}, [value]);
|
33326
33475
|
const localProps = {
|
@@ -33328,31 +33477,34 @@ var InputOrGroup = (_a) => {
|
|
33328
33477
|
onChange: onChangeLocal
|
33329
33478
|
};
|
33330
33479
|
if (field.type === "array") {
|
33331
|
-
return /* @__PURE__ */ (0,
|
33480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ArrayField, __spreadValues(__spreadValues({}, props), localProps));
|
33332
33481
|
}
|
33333
33482
|
if (field.type === "external") {
|
33334
|
-
return /* @__PURE__ */ (0,
|
33483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ExternalField, __spreadValues(__spreadValues({}, props), localProps));
|
33484
|
+
}
|
33485
|
+
if (field.type === "object") {
|
33486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ObjectField, __spreadValues(__spreadValues({}, props), localProps));
|
33335
33487
|
}
|
33336
33488
|
if (field.type === "select") {
|
33337
|
-
return /* @__PURE__ */ (0,
|
33489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectField, __spreadValues(__spreadValues({}, props), localProps));
|
33338
33490
|
}
|
33339
33491
|
if (field.type === "textarea") {
|
33340
|
-
return /* @__PURE__ */ (0,
|
33492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TextareaField, __spreadValues(__spreadValues({}, props), localProps));
|
33341
33493
|
}
|
33342
33494
|
if (field.type === "radio") {
|
33343
|
-
return /* @__PURE__ */ (0,
|
33495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RadioField, __spreadValues(__spreadValues({}, props), localProps));
|
33344
33496
|
}
|
33345
33497
|
if (field.type === "custom") {
|
33346
33498
|
if (!field.render) {
|
33347
33499
|
return null;
|
33348
33500
|
}
|
33349
|
-
return /* @__PURE__ */ (0,
|
33501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15(), children: field.render(__spreadValues({
|
33350
33502
|
field,
|
33351
33503
|
name,
|
33352
33504
|
readOnly
|
33353
33505
|
}, localProps)) });
|
33354
33506
|
}
|
33355
|
-
return /* @__PURE__ */ (0,
|
33507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DefaultField, __spreadValues(__spreadValues({}, props), localProps));
|
33356
33508
|
};
|
33357
33509
|
|
33358
33510
|
// components/ComponentList/index.tsx
|
@@ -33361,28 +33513,28 @@ var import_dnd6 = require("@hello-pangea/dnd");
|
|
33361
33513
|
|
33362
33514
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
33363
33515
|
init_react_import();
|
33364
|
-
var
|
33516
|
+
var styles_module_default10 = { "ComponentList": "_ComponentList_1m8r5_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_1m8r5_6", "ComponentList-content": "_ComponentList-content_1m8r5_10", "ComponentList-title": "_ComponentList-title_1m8r5_18", "ComponentList-titleIcon": "_ComponentList-titleIcon_1m8r5_39", "ComponentListItem": "_ComponentListItem_1m8r5_43", "ComponentListItem-draggable": "_ComponentListItem-draggable_1m8r5_43", "ComponentListItem-name": "_ComponentListItem-name_1m8r5_60", "ComponentList--isDraggingFrom": "_ComponentList--isDraggingFrom_1m8r5_66" };
|
33365
33517
|
|
33366
33518
|
// components/ComponentList/index.tsx
|
33367
|
-
var
|
33368
|
-
var
|
33369
|
-
var
|
33519
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
33520
|
+
var getClassName16 = get_class_name_factory_default("ComponentList", styles_module_default10);
|
33521
|
+
var getClassNameItem3 = get_class_name_factory_default("ComponentListItem", styles_module_default10);
|
33370
33522
|
var ComponentListItem = ({
|
33371
33523
|
component,
|
33372
33524
|
index,
|
33373
33525
|
id
|
33374
33526
|
}) => {
|
33375
|
-
return /* @__PURE__ */ (0,
|
33527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassNameItem3(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
33376
33528
|
Draggable2,
|
33377
33529
|
{
|
33378
33530
|
id,
|
33379
33531
|
index,
|
33380
33532
|
showShadow: true,
|
33381
33533
|
disableAnimations: true,
|
33382
|
-
className: () =>
|
33383
|
-
children: () => /* @__PURE__ */ (0,
|
33384
|
-
/* @__PURE__ */ (0,
|
33385
|
-
/* @__PURE__ */ (0,
|
33534
|
+
className: () => getClassNameItem3("draggable"),
|
33535
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
33536
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassNameItem3("name"), children: component }),
|
33537
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassNameItem3("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DragIcon, {}) })
|
33386
33538
|
] })
|
33387
33539
|
},
|
33388
33540
|
component
|
@@ -33395,11 +33547,11 @@ var ComponentList = ({
|
|
33395
33547
|
}) => {
|
33396
33548
|
const { config, state, setUi } = useAppContext();
|
33397
33549
|
const { expanded = true } = state.ui.componentList[id] || {};
|
33398
|
-
return /* @__PURE__ */ (0,
|
33399
|
-
title && /* @__PURE__ */ (0,
|
33550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName16({ isExpanded: expanded }), children: [
|
33551
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
33400
33552
|
"div",
|
33401
33553
|
{
|
33402
|
-
className:
|
33554
|
+
className: getClassName16("title"),
|
33403
33555
|
onClick: () => setUi({
|
33404
33556
|
componentList: __spreadProps(__spreadValues({}, state.ui.componentList), {
|
33405
33557
|
[id]: __spreadProps(__spreadValues({}, state.ui.componentList[id]), {
|
@@ -33409,26 +33561,26 @@ var ComponentList = ({
|
|
33409
33561
|
}),
|
33410
33562
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
33411
33563
|
children: [
|
33412
|
-
/* @__PURE__ */ (0,
|
33413
|
-
/* @__PURE__ */ (0,
|
33564
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: title }),
|
33565
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(chevron_up_default, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(chevron_down_default, { size: 12 }) })
|
33414
33566
|
]
|
33415
33567
|
}
|
33416
33568
|
),
|
33417
|
-
/* @__PURE__ */ (0,
|
33569
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("content"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
33418
33570
|
import_dnd6.Droppable,
|
33419
33571
|
{
|
33420
33572
|
droppableId: `component-list${title ? `:${title}` : ""}`,
|
33421
33573
|
isDropDisabled: true,
|
33422
|
-
children: (provided, snapshot) => /* @__PURE__ */ (0,
|
33574
|
+
children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
33423
33575
|
"div",
|
33424
33576
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
33425
33577
|
ref: provided.innerRef,
|
33426
|
-
className:
|
33578
|
+
className: getClassName16({
|
33427
33579
|
isDraggingFrom: !!snapshot.draggingFromThisWith
|
33428
33580
|
}),
|
33429
33581
|
children: [
|
33430
33582
|
children || Object.keys(config.components).map((componentKey, i) => {
|
33431
|
-
return /* @__PURE__ */ (0,
|
33583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
33432
33584
|
ComponentListItem,
|
33433
33585
|
{
|
33434
33586
|
component: componentKey,
|
@@ -33438,7 +33590,7 @@ var ComponentList = ({
|
|
33438
33590
|
componentKey
|
33439
33591
|
);
|
33440
33592
|
}),
|
33441
|
-
/* @__PURE__ */ (0,
|
33593
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
|
33442
33594
|
]
|
33443
33595
|
})
|
33444
33596
|
)
|
@@ -33450,10 +33602,10 @@ ComponentList.Item = ComponentListItem;
|
|
33450
33602
|
|
33451
33603
|
// lib/use-placeholder-style.ts
|
33452
33604
|
init_react_import();
|
33453
|
-
var
|
33605
|
+
var import_react34 = require("react");
|
33454
33606
|
var usePlaceholderStyle = () => {
|
33455
33607
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
33456
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
33608
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react34.useState)();
|
33457
33609
|
const onDragStartOrUpdate = (draggedItem) => {
|
33458
33610
|
var _a;
|
33459
33611
|
const draggableId = draggedItem.draggableId;
|
@@ -33501,11 +33653,11 @@ init_react_import();
|
|
33501
33653
|
|
33502
33654
|
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
33503
33655
|
init_react_import();
|
33504
|
-
var
|
33656
|
+
var styles_module_default11 = { "SidebarSection": "_SidebarSection_1uyg2_1", "SidebarSection-title": "_SidebarSection-title_1uyg2_12", "SidebarSection-content": "_SidebarSection-content_1uyg2_19", "SidebarSection--noPadding": "_SidebarSection--noPadding_1uyg2_24", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_1uyg2_37", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_1uyg2_48", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_1uyg2_37", "SidebarSection-heading": "_SidebarSection-heading_1uyg2_60", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_1uyg2_64" };
|
33505
33657
|
|
33506
33658
|
// lib/use-breadcrumbs.ts
|
33507
33659
|
init_react_import();
|
33508
|
-
var
|
33660
|
+
var import_react35 = require("react");
|
33509
33661
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
33510
33662
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
33511
33663
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -33555,8 +33707,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
33555
33707
|
state: { data },
|
33556
33708
|
selectedItem
|
33557
33709
|
} = useAppContext();
|
33558
|
-
const dzContext = (0,
|
33559
|
-
return (0,
|
33710
|
+
const dzContext = (0, import_react35.useContext)(dropZoneContext);
|
33711
|
+
return (0, import_react35.useMemo)(() => {
|
33560
33712
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
33561
33713
|
selectedItem,
|
33562
33714
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -33571,8 +33723,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
33571
33723
|
|
33572
33724
|
// components/SidebarSection/index.tsx
|
33573
33725
|
var import_react_spinners5 = require("react-spinners");
|
33574
|
-
var
|
33575
|
-
var
|
33726
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
33727
|
+
var getClassName17 = get_class_name_factory_default("SidebarSection", styles_module_default11);
|
33576
33728
|
var SidebarSection = ({
|
33577
33729
|
children,
|
33578
33730
|
title,
|
@@ -33583,23 +33735,23 @@ var SidebarSection = ({
|
|
33583
33735
|
}) => {
|
33584
33736
|
const { setUi } = useAppContext();
|
33585
33737
|
const breadcrumbs = useBreadcrumbs(1);
|
33586
|
-
return /* @__PURE__ */ (0,
|
33587
|
-
/* @__PURE__ */ (0,
|
33588
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
33589
|
-
/* @__PURE__ */ (0,
|
33738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName17({ noPadding }), style: { background }, children: [
|
33739
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("title"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName17("breadcrumbs"), children: [
|
33740
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName17("breadcrumb"), children: [
|
33741
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
33590
33742
|
"div",
|
33591
33743
|
{
|
33592
|
-
className:
|
33744
|
+
className: getClassName17("breadcrumbLabel"),
|
33593
33745
|
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
33594
33746
|
children: breadcrumb.label
|
33595
33747
|
}
|
33596
33748
|
),
|
33597
|
-
/* @__PURE__ */ (0,
|
33749
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(chevron_right_default, { size: 16 })
|
33598
33750
|
] }, i)) : null,
|
33599
|
-
/* @__PURE__ */ (0,
|
33751
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
|
33600
33752
|
] }) }),
|
33601
|
-
/* @__PURE__ */ (0,
|
33602
|
-
isLoading && /* @__PURE__ */ (0,
|
33753
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("content"), children }),
|
33754
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_spinners5.ClipLoader, {}) })
|
33603
33755
|
] });
|
33604
33756
|
};
|
33605
33757
|
|
@@ -33608,11 +33760,11 @@ init_react_import();
|
|
33608
33760
|
|
33609
33761
|
// lib/use-puck-history.ts
|
33610
33762
|
init_react_import();
|
33611
|
-
var
|
33763
|
+
var import_react37 = require("react");
|
33612
33764
|
|
33613
33765
|
// lib/use-action-history.ts
|
33614
33766
|
init_react_import();
|
33615
|
-
var
|
33767
|
+
var import_react36 = require("react");
|
33616
33768
|
|
33617
33769
|
// lib/generate-id.ts
|
33618
33770
|
init_react_import();
|
@@ -33622,8 +33774,8 @@ var generateId = (type) => `${type}-${(0, import_crypto.randomBytes)(20).toStrin
|
|
33622
33774
|
// lib/use-action-history.ts
|
33623
33775
|
var EMPTY_HISTORY_INDEX = -1;
|
33624
33776
|
function useActionHistory() {
|
33625
|
-
const [histories, setHistories] = (0,
|
33626
|
-
const [currentHistoryIndex, setCurrentHistoryIndex] = (0,
|
33777
|
+
const [histories, setHistories] = (0, import_react36.useState)([]);
|
33778
|
+
const [currentHistoryIndex, setCurrentHistoryIndex] = (0, import_react36.useState)(EMPTY_HISTORY_INDEX);
|
33627
33779
|
const currentHistory = histories[currentHistoryIndex];
|
33628
33780
|
const canRewind = currentHistoryIndex > EMPTY_HISTORY_INDEX;
|
33629
33781
|
const canForward = currentHistoryIndex < histories.length - 1;
|
@@ -33702,7 +33854,7 @@ function usePuckHistory({
|
|
33702
33854
|
dispatch
|
33703
33855
|
});
|
33704
33856
|
}, DEBOUNCE_TIME);
|
33705
|
-
(0,
|
33857
|
+
(0, import_react37.useEffect)(() => {
|
33706
33858
|
historyEmitter.on(RECORD_DIFF, handleRecordDiff);
|
33707
33859
|
return () => {
|
33708
33860
|
historyEmitter.off(RECORD_DIFF, handleRecordDiff);
|
@@ -34050,7 +34202,7 @@ init_react_import();
|
|
34050
34202
|
|
34051
34203
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
34052
34204
|
init_react_import();
|
34053
|
-
var
|
34205
|
+
var styles_module_default12 = { "LayerTree": "_LayerTree_o89yt_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_o89yt_11", "LayerTree-helper": "_LayerTree-helper_o89yt_17", "Layer": "_Layer_o89yt_1", "Layer-inner": "_Layer-inner_o89yt_29", "Layer--containsZone": "_Layer--containsZone_o89yt_35", "Layer-clickable": "_Layer-clickable_o89yt_39", "Layer--isSelected": "_Layer--isSelected_o89yt_48", "Layer--isHovering": "_Layer--isHovering_o89yt_49", "Layer-chevron": "_Layer-chevron_o89yt_65", "Layer--childIsSelected": "_Layer--childIsSelected_o89yt_66", "Layer-zones": "_Layer-zones_o89yt_70", "Layer-title": "_Layer-title_o89yt_84", "Layer-name": "_Layer-name_o89yt_93", "Layer-icon": "_Layer-icon_o89yt_99", "Layer-zoneIcon": "_Layer-zoneIcon_o89yt_104" };
|
34054
34206
|
|
34055
34207
|
// lib/scroll-into-view.ts
|
34056
34208
|
init_react_import();
|
@@ -34064,7 +34216,7 @@ var scrollIntoView = (el) => {
|
|
34064
34216
|
};
|
34065
34217
|
|
34066
34218
|
// components/LayerTree/index.tsx
|
34067
|
-
var
|
34219
|
+
var import_react38 = require("react");
|
34068
34220
|
|
34069
34221
|
// lib/find-zones-for-area.ts
|
34070
34222
|
init_react_import();
|
@@ -34090,9 +34242,9 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
34090
34242
|
};
|
34091
34243
|
|
34092
34244
|
// components/LayerTree/index.tsx
|
34093
|
-
var
|
34094
|
-
var
|
34095
|
-
var getClassNameLayer = get_class_name_factory_default("Layer",
|
34245
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
34246
|
+
var getClassName18 = get_class_name_factory_default("LayerTree", styles_module_default12);
|
34247
|
+
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default12);
|
34096
34248
|
var LayerTree = ({
|
34097
34249
|
data,
|
34098
34250
|
zoneContent,
|
@@ -34102,15 +34254,15 @@ var LayerTree = ({
|
|
34102
34254
|
label
|
34103
34255
|
}) => {
|
34104
34256
|
const zones = data.zones || {};
|
34105
|
-
const ctx = (0,
|
34106
|
-
return /* @__PURE__ */ (0,
|
34107
|
-
label && /* @__PURE__ */ (0,
|
34108
|
-
/* @__PURE__ */ (0,
|
34257
|
+
const ctx = (0, import_react38.useContext)(dropZoneContext);
|
34258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
34259
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: getClassName18("zoneTitle"), children: [
|
34260
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(layers_default, { size: "16" }) }),
|
34109
34261
|
" ",
|
34110
34262
|
label
|
34111
34263
|
] }),
|
34112
|
-
/* @__PURE__ */ (0,
|
34113
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
34264
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("ul", { className: getClassName18(), children: [
|
34265
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("helper"), children: "No items" }),
|
34114
34266
|
zoneContent.map((item, i) => {
|
34115
34267
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
34116
34268
|
const zonesForItem = findZonesForArea(data, item.props.id);
|
@@ -34125,7 +34277,7 @@ var LayerTree = ({
|
|
34125
34277
|
const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
|
34126
34278
|
const isHovering = hoveringComponent === item.props.id;
|
34127
34279
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
34128
|
-
return /* @__PURE__ */ (0,
|
34280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
34129
34281
|
"li",
|
34130
34282
|
{
|
34131
34283
|
className: getClassNameLayer({
|
@@ -34135,7 +34287,7 @@ var LayerTree = ({
|
|
34135
34287
|
childIsSelected
|
34136
34288
|
}),
|
34137
34289
|
children: [
|
34138
|
-
/* @__PURE__ */ (0,
|
34290
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
34139
34291
|
"div",
|
34140
34292
|
{
|
34141
34293
|
className: getClassNameLayer("clickable"),
|
@@ -34166,22 +34318,22 @@ var LayerTree = ({
|
|
34166
34318
|
setHoveringComponent(null);
|
34167
34319
|
},
|
34168
34320
|
children: [
|
34169
|
-
containsZone && /* @__PURE__ */ (0,
|
34321
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34170
34322
|
"div",
|
34171
34323
|
{
|
34172
34324
|
className: getClassNameLayer("chevron"),
|
34173
34325
|
title: isSelected ? "Collapse" : "Expand",
|
34174
|
-
children: /* @__PURE__ */ (0,
|
34326
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(chevron_down_default, { size: "12" })
|
34175
34327
|
}
|
34176
34328
|
),
|
34177
|
-
/* @__PURE__ */ (0,
|
34178
|
-
/* @__PURE__ */ (0,
|
34179
|
-
/* @__PURE__ */ (0,
|
34329
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
34330
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(type_default, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(grid_default, { size: "16" }) }),
|
34331
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameLayer("name"), children: item.type })
|
34180
34332
|
] })
|
34181
34333
|
]
|
34182
34334
|
}
|
34183
34335
|
) }),
|
34184
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
34336
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34185
34337
|
LayerTree,
|
34186
34338
|
{
|
34187
34339
|
data,
|
@@ -34227,11 +34379,11 @@ var flushZones = (appState) => {
|
|
34227
34379
|
|
34228
34380
|
// lib/use-component-list.tsx
|
34229
34381
|
init_react_import();
|
34230
|
-
var
|
34231
|
-
var
|
34382
|
+
var import_react39 = require("react");
|
34383
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
34232
34384
|
var useComponentList = (config, ui) => {
|
34233
|
-
const [componentList, setComponentList] = (0,
|
34234
|
-
(0,
|
34385
|
+
const [componentList, setComponentList] = (0, import_react39.useState)();
|
34386
|
+
(0, import_react39.useEffect)(() => {
|
34235
34387
|
var _a, _b, _c;
|
34236
34388
|
if (Object.keys(ui.componentList).length > 0) {
|
34237
34389
|
const matchedComponents = [];
|
@@ -34241,14 +34393,14 @@ var useComponentList = (config, ui) => {
|
|
34241
34393
|
if (category.visible === false || !category.components) {
|
34242
34394
|
return null;
|
34243
34395
|
}
|
34244
|
-
return /* @__PURE__ */ (0,
|
34396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34245
34397
|
ComponentList,
|
34246
34398
|
{
|
34247
34399
|
id: categoryKey,
|
34248
34400
|
title: category.title || categoryKey,
|
34249
34401
|
children: category.components.map((componentName, i) => {
|
34250
34402
|
matchedComponents.push(componentName);
|
34251
|
-
return /* @__PURE__ */ (0,
|
34403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34252
34404
|
ComponentList.Item,
|
34253
34405
|
{
|
34254
34406
|
component: componentName,
|
@@ -34268,13 +34420,13 @@ var useComponentList = (config, ui) => {
|
|
34268
34420
|
);
|
34269
34421
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
34270
34422
|
_componentList.push(
|
34271
|
-
/* @__PURE__ */ (0,
|
34423
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34272
34424
|
ComponentList,
|
34273
34425
|
{
|
34274
34426
|
id: "other",
|
34275
34427
|
title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
|
34276
34428
|
children: remainingComponents.map((componentName, i) => {
|
34277
|
-
return /* @__PURE__ */ (0,
|
34429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34278
34430
|
ComponentList.Item,
|
34279
34431
|
{
|
34280
34432
|
component: componentName,
|
@@ -34297,7 +34449,7 @@ var useComponentList = (config, ui) => {
|
|
34297
34449
|
|
34298
34450
|
// lib/use-resolved-data.ts
|
34299
34451
|
init_react_import();
|
34300
|
-
var
|
34452
|
+
var import_react40 = require("react");
|
34301
34453
|
|
34302
34454
|
// lib/resolve-component-data.ts
|
34303
34455
|
init_react_import();
|
@@ -34412,13 +34564,13 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
|
|
34412
34564
|
|
34413
34565
|
// lib/use-resolved-data.ts
|
34414
34566
|
var useResolvedData = (appState, config, dispatch) => {
|
34415
|
-
const [{ resolverKey, newAppState }, setResolverState] = (0,
|
34567
|
+
const [{ resolverKey, newAppState }, setResolverState] = (0, import_react40.useState)({
|
34416
34568
|
resolverKey: 0,
|
34417
34569
|
newAppState: appState
|
34418
34570
|
});
|
34419
|
-
const [componentState, setComponentState] = (0,
|
34571
|
+
const [componentState, setComponentState] = (0, import_react40.useState)({});
|
34420
34572
|
const deferredSetStates = {};
|
34421
|
-
const setComponentLoading = (0,
|
34573
|
+
const setComponentLoading = (0, import_react40.useCallback)(
|
34422
34574
|
(id, loading, defer = 0) => {
|
34423
34575
|
if (deferredSetStates[id]) {
|
34424
34576
|
clearTimeout(deferredSetStates[id]);
|
@@ -34485,10 +34637,10 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
34485
34637
|
});
|
34486
34638
|
yield Promise.all(promises);
|
34487
34639
|
});
|
34488
|
-
(0,
|
34640
|
+
(0, import_react40.useEffect)(() => {
|
34489
34641
|
runResolvers();
|
34490
34642
|
}, [resolverKey]);
|
34491
|
-
const resolveData = (0,
|
34643
|
+
const resolveData = (0, import_react40.useCallback)((newAppState2 = appState) => {
|
34492
34644
|
setResolverState((curr) => ({
|
34493
34645
|
resolverKey: curr.resolverKey + 1,
|
34494
34646
|
newAppState: newAppState2
|
@@ -34505,11 +34657,11 @@ init_react_import();
|
|
34505
34657
|
|
34506
34658
|
// css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
|
34507
34659
|
init_react_import();
|
34508
|
-
var
|
34660
|
+
var styles_module_default13 = { "MenuBar": "_MenuBar_12sp7_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_12sp7_14", "MenuBar-inner": "_MenuBar-inner_12sp7_29", "MenuBar-history": "_MenuBar-history_12sp7_45" };
|
34509
34661
|
|
34510
34662
|
// components/MenuBar/index.tsx
|
34511
|
-
var
|
34512
|
-
var
|
34663
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
34664
|
+
var getClassName19 = get_class_name_factory_default("MenuBar", styles_module_default13);
|
34513
34665
|
var MenuBar = ({
|
34514
34666
|
appState,
|
34515
34667
|
data = { content: [], root: { props: { title: "" } } },
|
@@ -34523,10 +34675,10 @@ var MenuBar = ({
|
|
34523
34675
|
appState,
|
34524
34676
|
dispatch
|
34525
34677
|
});
|
34526
|
-
return /* @__PURE__ */ (0,
|
34678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34527
34679
|
"div",
|
34528
34680
|
{
|
34529
|
-
className:
|
34681
|
+
className: getClassName19({ menuOpen }),
|
34530
34682
|
onClick: (event) => {
|
34531
34683
|
var _a;
|
34532
34684
|
const element = event.target;
|
@@ -34537,16 +34689,16 @@ var MenuBar = ({
|
|
34537
34689
|
setMenuOpen(false);
|
34538
34690
|
}
|
34539
34691
|
},
|
34540
|
-
children: /* @__PURE__ */ (0,
|
34541
|
-
/* @__PURE__ */ (0,
|
34542
|
-
/* @__PURE__ */ (0,
|
34692
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName19("inner"), children: [
|
34693
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName19("history"), children: [
|
34694
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IconButton, { title: "undo", disabled: !canRewind, onClick: rewind, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34543
34695
|
chevron_left_default,
|
34544
34696
|
{
|
34545
34697
|
size: 21,
|
34546
34698
|
stroke: canRewind ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
|
34547
34699
|
}
|
34548
34700
|
) }),
|
34549
|
-
/* @__PURE__ */ (0,
|
34701
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IconButton, { title: "redo", disabled: !canForward, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34550
34702
|
chevron_right_default,
|
34551
34703
|
{
|
34552
34704
|
size: 21,
|
@@ -34554,17 +34706,17 @@ var MenuBar = ({
|
|
34554
34706
|
}
|
34555
34707
|
) })
|
34556
34708
|
] }),
|
34557
|
-
/* @__PURE__ */ (0,
|
34709
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
34558
34710
|
state: appState,
|
34559
34711
|
dispatch
|
34560
34712
|
}) }),
|
34561
|
-
/* @__PURE__ */ (0,
|
34713
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34562
34714
|
Button,
|
34563
34715
|
{
|
34564
34716
|
onClick: () => {
|
34565
34717
|
onPublish(data);
|
34566
34718
|
},
|
34567
|
-
icon: /* @__PURE__ */ (0,
|
34719
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(globe_default, { size: "14px" }),
|
34568
34720
|
children: "Publish"
|
34569
34721
|
}
|
34570
34722
|
) })
|
@@ -34575,11 +34727,11 @@ var MenuBar = ({
|
|
34575
34727
|
|
34576
34728
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
34577
34729
|
init_react_import();
|
34578
|
-
var
|
34730
|
+
var styles_module_default14 = { "Puck": "_Puck_103k9_19", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_103k9_35", "Puck--rightSideBarVisible": "_Puck--rightSideBarVisible_103k9_41", "Puck-header": "_Puck-header_103k9_95", "Puck-headerInner": "_Puck-headerInner_103k9_104", "Puck-headerToggle": "_Puck-headerToggle_103k9_114", "Puck-rightSideBarToggle": "_Puck-rightSideBarToggle_103k9_121", "Puck-leftSideBarToggle": "_Puck-leftSideBarToggle_103k9_126", "Puck-headerTitle": "_Puck-headerTitle_103k9_130", "Puck-headerPath": "_Puck-headerPath_103k9_134", "Puck-headerTools": "_Puck-headerTools_103k9_141", "Puck-menuButton": "_Puck-menuButton_103k9_147", "Puck--menuOpen": "_Puck--menuOpen_103k9_152", "Puck-leftSideBar": "_Puck-leftSideBar_103k9_126", "Puck-frame": "_Puck-frame_103k9_171", "Puck-root": "_Puck-root_103k9_179", "Puck-page": "_Puck-page_103k9_192", "Puck-rightSideBar": "_Puck-rightSideBar_103k9_121" };
|
34579
34731
|
|
34580
34732
|
// components/Puck/index.tsx
|
34581
|
-
var
|
34582
|
-
var
|
34733
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
34734
|
+
var getClassName20 = get_class_name_factory_default("Puck", styles_module_default14);
|
34583
34735
|
var defaultPageFields = {
|
34584
34736
|
title: { type: "text" }
|
34585
34737
|
};
|
@@ -34591,7 +34743,7 @@ var PluginRenderer = ({
|
|
34591
34743
|
renderMethod
|
34592
34744
|
}) => {
|
34593
34745
|
return plugins.filter((item) => item[renderMethod]).map((item) => item[renderMethod]).reduce(
|
34594
|
-
(accChildren, Item) => /* @__PURE__ */ (0,
|
34746
|
+
(accChildren, Item) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Item, { dispatch, state, children: accChildren }),
|
34595
34747
|
children
|
34596
34748
|
);
|
34597
34749
|
};
|
@@ -34608,8 +34760,8 @@ function Puck({
|
|
34608
34760
|
headerPath
|
34609
34761
|
}) {
|
34610
34762
|
var _a, _b;
|
34611
|
-
const [reducer] = (0,
|
34612
|
-
const [initialAppState] = (0,
|
34763
|
+
const [reducer] = (0, import_react41.useState)(() => createReducer({ config }));
|
34764
|
+
const [initialAppState] = (0, import_react41.useState)(__spreadProps(__spreadValues({}, defaultAppState), {
|
34613
34765
|
data: initialData,
|
34614
34766
|
ui: __spreadProps(__spreadValues({}, defaultAppState.ui), {
|
34615
34767
|
// Store categories under componentList on state to allow render functions and plugins to modify
|
@@ -34628,7 +34780,7 @@ function Puck({
|
|
34628
34780
|
) : {}
|
34629
34781
|
})
|
34630
34782
|
}));
|
34631
|
-
const [appState, dispatch] = (0,
|
34783
|
+
const [appState, dispatch] = (0, import_react41.useReducer)(
|
34632
34784
|
reducer,
|
34633
34785
|
flushZones(initialAppState)
|
34634
34786
|
);
|
@@ -34638,9 +34790,9 @@ function Puck({
|
|
34638
34790
|
config,
|
34639
34791
|
dispatch
|
34640
34792
|
);
|
34641
|
-
const [menuOpen, setMenuOpen] = (0,
|
34793
|
+
const [menuOpen, setMenuOpen] = (0, import_react41.useState)(false);
|
34642
34794
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
34643
|
-
const setItemSelector = (0,
|
34795
|
+
const setItemSelector = (0, import_react41.useCallback)(
|
34644
34796
|
(newItemSelector) => {
|
34645
34797
|
dispatch({
|
34646
34798
|
type: "setUi",
|
@@ -34650,10 +34802,10 @@ function Puck({
|
|
34650
34802
|
[]
|
34651
34803
|
);
|
34652
34804
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
34653
|
-
const Page = (0,
|
34805
|
+
const Page = (0, import_react41.useCallback)(
|
34654
34806
|
(pageProps) => {
|
34655
34807
|
var _a2, _b2;
|
34656
|
-
return /* @__PURE__ */ (0,
|
34808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34657
34809
|
PluginRenderer,
|
34658
34810
|
{
|
34659
34811
|
plugins,
|
@@ -34666,8 +34818,8 @@ function Puck({
|
|
34666
34818
|
},
|
34667
34819
|
[config.root]
|
34668
34820
|
);
|
34669
|
-
const PageFieldWrapper = (0,
|
34670
|
-
(props) => /* @__PURE__ */ (0,
|
34821
|
+
const PageFieldWrapper = (0, import_react41.useCallback)(
|
34822
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34671
34823
|
PluginRenderer,
|
34672
34824
|
{
|
34673
34825
|
plugins,
|
@@ -34679,8 +34831,8 @@ function Puck({
|
|
34679
34831
|
),
|
34680
34832
|
[]
|
34681
34833
|
);
|
34682
|
-
const ComponentFieldWrapper = (0,
|
34683
|
-
(props) => /* @__PURE__ */ (0,
|
34834
|
+
const ComponentFieldWrapper = (0, import_react41.useCallback)(
|
34835
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34684
34836
|
PluginRenderer,
|
34685
34837
|
{
|
34686
34838
|
plugins,
|
@@ -34692,8 +34844,8 @@ function Puck({
|
|
34692
34844
|
),
|
34693
34845
|
[]
|
34694
34846
|
);
|
34695
|
-
const ComponentListWrapper = (0,
|
34696
|
-
const children = /* @__PURE__ */ (0,
|
34847
|
+
const ComponentListWrapper = (0, import_react41.useCallback)((props) => {
|
34848
|
+
const children = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34697
34849
|
PluginRenderer,
|
34698
34850
|
{
|
34699
34851
|
plugins,
|
@@ -34712,22 +34864,22 @@ function Puck({
|
|
34712
34864
|
const FieldWrapper = itemSelector ? ComponentFieldWrapper : PageFieldWrapper;
|
34713
34865
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
34714
34866
|
let fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
|
34715
|
-
(0,
|
34867
|
+
(0, import_react41.useEffect)(() => {
|
34716
34868
|
if (onChange)
|
34717
34869
|
onChange(data);
|
34718
34870
|
}, [data]);
|
34719
34871
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
34720
|
-
const [draggedItem, setDraggedItem] = (0,
|
34872
|
+
const [draggedItem, setDraggedItem] = (0, import_react41.useState)();
|
34721
34873
|
const componentList = useComponentList(config, appState.ui);
|
34722
34874
|
const rootProps = data.root.props || data.root;
|
34723
|
-
(0,
|
34875
|
+
(0, import_react41.useEffect)(() => {
|
34724
34876
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
34725
34877
|
console.error(
|
34726
34878
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
34727
34879
|
);
|
34728
34880
|
}
|
34729
34881
|
}, []);
|
34730
|
-
const toggleSidebars = (0,
|
34882
|
+
const toggleSidebars = (0, import_react41.useCallback)(
|
34731
34883
|
(sidebar) => {
|
34732
34884
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
34733
34885
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -34741,7 +34893,7 @@ function Puck({
|
|
34741
34893
|
},
|
34742
34894
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
34743
34895
|
);
|
34744
|
-
(0,
|
34896
|
+
(0, import_react41.useEffect)(() => {
|
34745
34897
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
34746
34898
|
dispatch({
|
34747
34899
|
type: "setUi",
|
@@ -34764,12 +34916,12 @@ function Puck({
|
|
34764
34916
|
window.removeEventListener("resize", handleResize);
|
34765
34917
|
};
|
34766
34918
|
}, []);
|
34767
|
-
return /* @__PURE__ */ (0,
|
34768
|
-
/* @__PURE__ */ (0,
|
34919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
|
34920
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34769
34921
|
AppProvider,
|
34770
34922
|
{
|
34771
34923
|
value: { state: appState, dispatch, config, componentState },
|
34772
|
-
children: /* @__PURE__ */ (0,
|
34924
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34773
34925
|
import_dnd7.DragDropContext,
|
34774
34926
|
{
|
34775
34927
|
onDragUpdate: (update) => {
|
@@ -34822,7 +34974,7 @@ function Puck({
|
|
34822
34974
|
});
|
34823
34975
|
}
|
34824
34976
|
},
|
34825
|
-
children: /* @__PURE__ */ (0,
|
34977
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34826
34978
|
DropZoneProvider,
|
34827
34979
|
{
|
34828
34980
|
value: {
|
@@ -34836,72 +34988,72 @@ function Puck({
|
|
34836
34988
|
mode: "edit",
|
34837
34989
|
areaId: "root"
|
34838
34990
|
},
|
34839
|
-
children: /* @__PURE__ */ (0,
|
34991
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(dropZoneContext.Consumer, { children: (ctx) => {
|
34840
34992
|
var _a2, _b2;
|
34841
|
-
return /* @__PURE__ */ (0,
|
34993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
34842
34994
|
"div",
|
34843
34995
|
{
|
34844
|
-
className:
|
34996
|
+
className: getClassName20({
|
34845
34997
|
leftSideBarVisible,
|
34846
34998
|
menuOpen,
|
34847
34999
|
rightSideBarVisible
|
34848
35000
|
}),
|
34849
35001
|
children: [
|
34850
|
-
/* @__PURE__ */ (0,
|
34851
|
-
children: /* @__PURE__ */ (0,
|
35002
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("header", { className: getClassName20("header"), children: renderHeader ? renderHeader({
|
35003
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34852
35004
|
Button,
|
34853
35005
|
{
|
34854
35006
|
onClick: () => {
|
34855
35007
|
onPublish(data);
|
34856
35008
|
},
|
34857
|
-
icon: /* @__PURE__ */ (0,
|
35009
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(globe_default, { size: "14px" }),
|
34858
35010
|
children: "Publish"
|
34859
35011
|
}
|
34860
35012
|
),
|
34861
35013
|
dispatch,
|
34862
35014
|
state: appState
|
34863
|
-
}) : /* @__PURE__ */ (0,
|
34864
|
-
/* @__PURE__ */ (0,
|
34865
|
-
/* @__PURE__ */ (0,
|
35015
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName20("headerInner"), children: [
|
35016
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName20("headerToggle"), children: [
|
35017
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName20("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34866
35018
|
IconButton,
|
34867
35019
|
{
|
34868
35020
|
onClick: () => {
|
34869
35021
|
toggleSidebars("left");
|
34870
35022
|
},
|
34871
35023
|
title: "Toggle left sidebar",
|
34872
|
-
children: /* @__PURE__ */ (0,
|
35024
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(sidebar_default, { focusable: "false" })
|
34873
35025
|
}
|
34874
35026
|
) }),
|
34875
|
-
/* @__PURE__ */ (0,
|
35027
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName20("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34876
35028
|
IconButton,
|
34877
35029
|
{
|
34878
35030
|
onClick: () => {
|
34879
35031
|
toggleSidebars("right");
|
34880
35032
|
},
|
34881
35033
|
title: "Toggle right sidebar",
|
34882
|
-
children: /* @__PURE__ */ (0,
|
35034
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(sidebar_default, { focusable: "false" })
|
34883
35035
|
}
|
34884
35036
|
) })
|
34885
35037
|
] }),
|
34886
|
-
/* @__PURE__ */ (0,
|
35038
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName20("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
34887
35039
|
headerTitle || rootProps.title || "Page",
|
34888
|
-
headerPath && /* @__PURE__ */ (0,
|
35040
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
34889
35041
|
" ",
|
34890
|
-
/* @__PURE__ */ (0,
|
35042
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { className: getClassName20("headerPath"), children: headerPath })
|
34891
35043
|
] })
|
34892
35044
|
] }) }),
|
34893
|
-
/* @__PURE__ */ (0,
|
34894
|
-
/* @__PURE__ */ (0,
|
35045
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName20("headerTools"), children: [
|
35046
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName20("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34895
35047
|
IconButton,
|
34896
35048
|
{
|
34897
35049
|
onClick: () => {
|
34898
35050
|
return setMenuOpen(!menuOpen);
|
34899
35051
|
},
|
34900
35052
|
title: "Toggle menu bar",
|
34901
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
35053
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(chevron_up_default, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(chevron_down_default, { focusable: "false" })
|
34902
35054
|
}
|
34903
35055
|
) }),
|
34904
|
-
/* @__PURE__ */ (0,
|
35056
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34905
35057
|
MenuBar,
|
34906
35058
|
{
|
34907
35059
|
appState,
|
@@ -34915,10 +35067,10 @@ function Puck({
|
|
34915
35067
|
)
|
34916
35068
|
] })
|
34917
35069
|
] }) }),
|
34918
|
-
/* @__PURE__ */ (0,
|
34919
|
-
/* @__PURE__ */ (0,
|
34920
|
-
/* @__PURE__ */ (0,
|
34921
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0,
|
35070
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName20("leftSideBar"), children: [
|
35071
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SidebarSection, { title: "Components", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ComponentListWrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ComponentList, { id: "all" }) }) }),
|
35072
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(SidebarSection, { title: "Outline", children: [
|
35073
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34922
35074
|
LayerTree,
|
34923
35075
|
{
|
34924
35076
|
data,
|
@@ -34930,7 +35082,7 @@ function Puck({
|
|
34930
35082
|
),
|
34931
35083
|
Object.entries(findZonesForArea(data, "root")).map(
|
34932
35084
|
([zoneKey, zone]) => {
|
34933
|
-
return /* @__PURE__ */ (0,
|
35085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34934
35086
|
LayerTree,
|
34935
35087
|
{
|
34936
35088
|
data,
|
@@ -34946,23 +35098,23 @@ function Puck({
|
|
34946
35098
|
)
|
34947
35099
|
] })
|
34948
35100
|
] }),
|
34949
|
-
/* @__PURE__ */ (0,
|
35101
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
34950
35102
|
"div",
|
34951
35103
|
{
|
34952
|
-
className:
|
35104
|
+
className: getClassName20("frame"),
|
34953
35105
|
onClick: () => setItemSelector(null),
|
34954
35106
|
id: "puck-frame",
|
34955
35107
|
children: [
|
34956
|
-
/* @__PURE__ */ (0,
|
35108
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName20("root"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName20("page"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34957
35109
|
Page,
|
34958
35110
|
__spreadProps(__spreadValues({
|
34959
35111
|
dispatch,
|
34960
35112
|
state: appState
|
34961
35113
|
}, rootProps), {
|
34962
|
-
children: /* @__PURE__ */ (0,
|
35114
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZone, { zone: rootDroppableId })
|
34963
35115
|
})
|
34964
35116
|
) }) }),
|
34965
|
-
/* @__PURE__ */ (0,
|
35117
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34966
35118
|
"div",
|
34967
35119
|
{
|
34968
35120
|
style: {
|
@@ -34975,7 +35127,7 @@ function Puck({
|
|
34975
35127
|
]
|
34976
35128
|
}
|
34977
35129
|
),
|
34978
|
-
/* @__PURE__ */ (0,
|
35130
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName20("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FieldWrapper, { dispatch, state: appState, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34979
35131
|
SidebarSection,
|
34980
35132
|
{
|
34981
35133
|
noPadding: true,
|
@@ -35053,7 +35205,7 @@ function Puck({
|
|
35053
35205
|
};
|
35054
35206
|
if (selectedItem && itemSelector) {
|
35055
35207
|
const { readOnly = {} } = selectedItem;
|
35056
|
-
return /* @__PURE__ */ (0,
|
35208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
35057
35209
|
InputOrGroup,
|
35058
35210
|
{
|
35059
35211
|
field,
|
@@ -35069,7 +35221,7 @@ function Puck({
|
|
35069
35221
|
);
|
35070
35222
|
} else {
|
35071
35223
|
const { readOnly = {} } = data.root;
|
35072
|
-
return /* @__PURE__ */ (0,
|
35224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
35073
35225
|
InputOrGroup,
|
35074
35226
|
{
|
35075
35227
|
field,
|
@@ -35097,13 +35249,13 @@ function Puck({
|
|
35097
35249
|
)
|
35098
35250
|
}
|
35099
35251
|
),
|
35100
|
-
/* @__PURE__ */ (0,
|
35252
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { id: "puck-portal-root" })
|
35101
35253
|
] });
|
35102
35254
|
}
|
35103
35255
|
|
35104
35256
|
// components/Render/index.tsx
|
35105
35257
|
init_react_import();
|
35106
|
-
var
|
35258
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
35107
35259
|
function Render({
|
35108
35260
|
config,
|
35109
35261
|
data
|
@@ -35112,7 +35264,7 @@ function Render({
|
|
35112
35264
|
const rootProps = data.root.props || data.root;
|
35113
35265
|
const title = rootProps.title || "";
|
35114
35266
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
35115
|
-
return /* @__PURE__ */ (0,
|
35267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
35116
35268
|
config.root.render,
|
35117
35269
|
__spreadProps(__spreadValues({}, rootProps), {
|
35118
35270
|
puck: {
|
@@ -35121,11 +35273,11 @@ function Render({
|
|
35121
35273
|
title,
|
35122
35274
|
editMode: false,
|
35123
35275
|
id: "puck-root",
|
35124
|
-
children: /* @__PURE__ */ (0,
|
35276
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZone, { zone: rootDroppableId })
|
35125
35277
|
})
|
35126
35278
|
) });
|
35127
35279
|
}
|
35128
|
-
return /* @__PURE__ */ (0,
|
35280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZone, { zone: rootDroppableId }) });
|
35129
35281
|
}
|
35130
35282
|
|
35131
35283
|
// lib/resolve-all-data.ts
|