@measured/puck 0.12.1-canary.1c3372b → 0.13.0-canary.194c4e5
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/{Config-35e6eaae.d.ts → Config-0331e026.d.ts} +19 -3
- package/dist/index.css +107 -27
- package/dist/index.d.ts +22 -8
- package/dist/index.js +705 -337
- package/dist/rsc.d.ts +3 -3
- package/dist/rsc.js +4 -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;
|
@@ -30108,7 +30108,9 @@ __export(core_exports, {
|
|
30108
30108
|
Puck: () => Puck,
|
30109
30109
|
Render: () => Render,
|
30110
30110
|
dropZoneContext: () => dropZoneContext,
|
30111
|
-
|
30111
|
+
migrate: () => migrate,
|
30112
|
+
resolveAllData: () => resolveAllData,
|
30113
|
+
transformProps: () => transformProps
|
30112
30114
|
});
|
30113
30115
|
module.exports = __toCommonJS(core_exports);
|
30114
30116
|
init_react_import();
|
@@ -30170,9 +30172,11 @@ var Button = ({
|
|
30170
30172
|
newTab,
|
30171
30173
|
fullWidth,
|
30172
30174
|
icon,
|
30173
|
-
size = "medium"
|
30175
|
+
size = "medium",
|
30176
|
+
loading: loadingProp = false
|
30174
30177
|
}) => {
|
30175
|
-
const [loading, setLoading] = (0, import_react2.useState)(
|
30178
|
+
const [loading, setLoading] = (0, import_react2.useState)(loadingProp);
|
30179
|
+
(0, import_react2.useEffect)(() => setLoading(loadingProp), [loadingProp]);
|
30176
30180
|
const ElementType = href ? "a" : "button";
|
30177
30181
|
const el = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
30178
30182
|
ElementType,
|
@@ -30213,11 +30217,11 @@ var Button = ({
|
|
30213
30217
|
|
30214
30218
|
// components/DropZone/index.tsx
|
30215
30219
|
init_react_import();
|
30216
|
-
var
|
30220
|
+
var import_react27 = require("react");
|
30217
30221
|
|
30218
30222
|
// components/DraggableComponent/index.tsx
|
30219
30223
|
init_react_import();
|
30220
|
-
var
|
30224
|
+
var import_react24 = require("react");
|
30221
30225
|
var import_dnd = require("@hello-pangea/dnd");
|
30222
30226
|
|
30223
30227
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
@@ -31284,7 +31288,7 @@ Lock.propTypes = {
|
|
31284
31288
|
Lock.displayName = "Lock";
|
31285
31289
|
var lock_default = Lock;
|
31286
31290
|
|
31287
|
-
// ../../node_modules/react-feather/dist/icons/
|
31291
|
+
// ../../node_modules/react-feather/dist/icons/more-vertical.js
|
31288
31292
|
init_react_import();
|
31289
31293
|
var import_react16 = __toESM(require("react"));
|
31290
31294
|
var import_prop_types14 = __toESM(require_prop_types());
|
@@ -31334,7 +31338,7 @@ function _objectWithoutPropertiesLoose14(source, excluded) {
|
|
31334
31338
|
}
|
31335
31339
|
return target;
|
31336
31340
|
}
|
31337
|
-
var
|
31341
|
+
var MoreVertical = (0, import_react16.forwardRef)(function(_ref, ref) {
|
31338
31342
|
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"]);
|
31339
31343
|
return /* @__PURE__ */ import_react16.default.createElement("svg", _extends14({
|
31340
31344
|
ref,
|
@@ -31347,26 +31351,28 @@ var Plus = (0, import_react16.forwardRef)(function(_ref, ref) {
|
|
31347
31351
|
strokeWidth: "2",
|
31348
31352
|
strokeLinecap: "round",
|
31349
31353
|
strokeLinejoin: "round"
|
31350
|
-
}, rest), /* @__PURE__ */ import_react16.default.createElement("
|
31351
|
-
|
31352
|
-
|
31353
|
-
|
31354
|
-
|
31355
|
-
|
31356
|
-
|
31357
|
-
|
31358
|
-
|
31359
|
-
|
31354
|
+
}, rest), /* @__PURE__ */ import_react16.default.createElement("circle", {
|
31355
|
+
cx: "12",
|
31356
|
+
cy: "12",
|
31357
|
+
r: "1"
|
31358
|
+
}), /* @__PURE__ */ import_react16.default.createElement("circle", {
|
31359
|
+
cx: "12",
|
31360
|
+
cy: "5",
|
31361
|
+
r: "1"
|
31362
|
+
}), /* @__PURE__ */ import_react16.default.createElement("circle", {
|
31363
|
+
cx: "12",
|
31364
|
+
cy: "19",
|
31365
|
+
r: "1"
|
31360
31366
|
}));
|
31361
31367
|
});
|
31362
|
-
|
31368
|
+
MoreVertical.propTypes = {
|
31363
31369
|
color: import_prop_types14.default.string,
|
31364
31370
|
size: import_prop_types14.default.oneOfType([import_prop_types14.default.string, import_prop_types14.default.number])
|
31365
31371
|
};
|
31366
|
-
|
31367
|
-
var
|
31372
|
+
MoreVertical.displayName = "MoreVertical";
|
31373
|
+
var more_vertical_default = MoreVertical;
|
31368
31374
|
|
31369
|
-
// ../../node_modules/react-feather/dist/icons/
|
31375
|
+
// ../../node_modules/react-feather/dist/icons/plus.js
|
31370
31376
|
init_react_import();
|
31371
31377
|
var import_react17 = __toESM(require("react"));
|
31372
31378
|
var import_prop_types15 = __toESM(require_prop_types());
|
@@ -31416,7 +31422,7 @@ function _objectWithoutPropertiesLoose15(source, excluded) {
|
|
31416
31422
|
}
|
31417
31423
|
return target;
|
31418
31424
|
}
|
31419
|
-
var
|
31425
|
+
var Plus = (0, import_react17.forwardRef)(function(_ref, ref) {
|
31420
31426
|
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"]);
|
31421
31427
|
return /* @__PURE__ */ import_react17.default.createElement("svg", _extends15({
|
31422
31428
|
ref,
|
@@ -31429,28 +31435,26 @@ var Sidebar = (0, import_react17.forwardRef)(function(_ref, ref) {
|
|
31429
31435
|
strokeWidth: "2",
|
31430
31436
|
strokeLinecap: "round",
|
31431
31437
|
strokeLinejoin: "round"
|
31432
|
-
}, rest), /* @__PURE__ */ import_react17.default.createElement("
|
31433
|
-
|
31434
|
-
|
31435
|
-
|
31436
|
-
|
31437
|
-
rx: "2",
|
31438
|
-
ry: "2"
|
31438
|
+
}, rest), /* @__PURE__ */ import_react17.default.createElement("line", {
|
31439
|
+
x1: "12",
|
31440
|
+
y1: "5",
|
31441
|
+
x2: "12",
|
31442
|
+
y2: "19"
|
31439
31443
|
}), /* @__PURE__ */ import_react17.default.createElement("line", {
|
31440
|
-
x1: "
|
31441
|
-
y1: "
|
31442
|
-
x2: "
|
31443
|
-
y2: "
|
31444
|
+
x1: "5",
|
31445
|
+
y1: "12",
|
31446
|
+
x2: "19",
|
31447
|
+
y2: "12"
|
31444
31448
|
}));
|
31445
31449
|
});
|
31446
|
-
|
31450
|
+
Plus.propTypes = {
|
31447
31451
|
color: import_prop_types15.default.string,
|
31448
31452
|
size: import_prop_types15.default.oneOfType([import_prop_types15.default.string, import_prop_types15.default.number])
|
31449
31453
|
};
|
31450
|
-
|
31451
|
-
var
|
31454
|
+
Plus.displayName = "Plus";
|
31455
|
+
var plus_default = Plus;
|
31452
31456
|
|
31453
|
-
// ../../node_modules/react-feather/dist/icons/
|
31457
|
+
// ../../node_modules/react-feather/dist/icons/search.js
|
31454
31458
|
init_react_import();
|
31455
31459
|
var import_react18 = __toESM(require("react"));
|
31456
31460
|
var import_prop_types16 = __toESM(require_prop_types());
|
@@ -31500,7 +31504,7 @@ function _objectWithoutPropertiesLoose16(source, excluded) {
|
|
31500
31504
|
}
|
31501
31505
|
return target;
|
31502
31506
|
}
|
31503
|
-
var
|
31507
|
+
var Search = (0, import_react18.forwardRef)(function(_ref, ref) {
|
31504
31508
|
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"]);
|
31505
31509
|
return /* @__PURE__ */ import_react18.default.createElement("svg", _extends16({
|
31506
31510
|
ref,
|
@@ -31513,20 +31517,25 @@ var Trash = (0, import_react18.forwardRef)(function(_ref, ref) {
|
|
31513
31517
|
strokeWidth: "2",
|
31514
31518
|
strokeLinecap: "round",
|
31515
31519
|
strokeLinejoin: "round"
|
31516
|
-
}, rest), /* @__PURE__ */ import_react18.default.createElement("
|
31517
|
-
|
31518
|
-
|
31519
|
-
|
31520
|
+
}, rest), /* @__PURE__ */ import_react18.default.createElement("circle", {
|
31521
|
+
cx: "11",
|
31522
|
+
cy: "11",
|
31523
|
+
r: "8"
|
31524
|
+
}), /* @__PURE__ */ import_react18.default.createElement("line", {
|
31525
|
+
x1: "21",
|
31526
|
+
y1: "21",
|
31527
|
+
x2: "16.65",
|
31528
|
+
y2: "16.65"
|
31520
31529
|
}));
|
31521
31530
|
});
|
31522
|
-
|
31531
|
+
Search.propTypes = {
|
31523
31532
|
color: import_prop_types16.default.string,
|
31524
31533
|
size: import_prop_types16.default.oneOfType([import_prop_types16.default.string, import_prop_types16.default.number])
|
31525
31534
|
};
|
31526
|
-
|
31527
|
-
var
|
31535
|
+
Search.displayName = "Search";
|
31536
|
+
var search_default = Search;
|
31528
31537
|
|
31529
|
-
// ../../node_modules/react-feather/dist/icons/
|
31538
|
+
// ../../node_modules/react-feather/dist/icons/sidebar.js
|
31530
31539
|
init_react_import();
|
31531
31540
|
var import_react19 = __toESM(require("react"));
|
31532
31541
|
var import_prop_types17 = __toESM(require_prop_types());
|
@@ -31576,7 +31585,7 @@ function _objectWithoutPropertiesLoose17(source, excluded) {
|
|
31576
31585
|
}
|
31577
31586
|
return target;
|
31578
31587
|
}
|
31579
|
-
var
|
31588
|
+
var Sidebar = (0, import_react19.forwardRef)(function(_ref, ref) {
|
31580
31589
|
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"]);
|
31581
31590
|
return /* @__PURE__ */ import_react19.default.createElement("svg", _extends17({
|
31582
31591
|
ref,
|
@@ -31589,28 +31598,28 @@ var Type = (0, import_react19.forwardRef)(function(_ref, ref) {
|
|
31589
31598
|
strokeWidth: "2",
|
31590
31599
|
strokeLinecap: "round",
|
31591
31600
|
strokeLinejoin: "round"
|
31592
|
-
}, rest), /* @__PURE__ */ import_react19.default.createElement("
|
31593
|
-
|
31601
|
+
}, rest), /* @__PURE__ */ import_react19.default.createElement("rect", {
|
31602
|
+
x: "3",
|
31603
|
+
y: "3",
|
31604
|
+
width: "18",
|
31605
|
+
height: "18",
|
31606
|
+
rx: "2",
|
31607
|
+
ry: "2"
|
31594
31608
|
}), /* @__PURE__ */ import_react19.default.createElement("line", {
|
31595
31609
|
x1: "9",
|
31596
|
-
y1: "
|
31597
|
-
x2: "
|
31598
|
-
y2: "
|
31599
|
-
}), /* @__PURE__ */ import_react19.default.createElement("line", {
|
31600
|
-
x1: "12",
|
31601
|
-
y1: "4",
|
31602
|
-
x2: "12",
|
31603
|
-
y2: "20"
|
31610
|
+
y1: "3",
|
31611
|
+
x2: "9",
|
31612
|
+
y2: "21"
|
31604
31613
|
}));
|
31605
31614
|
});
|
31606
|
-
|
31615
|
+
Sidebar.propTypes = {
|
31607
31616
|
color: import_prop_types17.default.string,
|
31608
31617
|
size: import_prop_types17.default.oneOfType([import_prop_types17.default.string, import_prop_types17.default.number])
|
31609
31618
|
};
|
31610
|
-
|
31611
|
-
var
|
31619
|
+
Sidebar.displayName = "Sidebar";
|
31620
|
+
var sidebar_default = Sidebar;
|
31612
31621
|
|
31613
|
-
// ../../node_modules/react-feather/dist/icons/
|
31622
|
+
// ../../node_modules/react-feather/dist/icons/trash.js
|
31614
31623
|
init_react_import();
|
31615
31624
|
var import_react20 = __toESM(require("react"));
|
31616
31625
|
var import_prop_types18 = __toESM(require_prop_types());
|
@@ -31660,7 +31669,7 @@ function _objectWithoutPropertiesLoose18(source, excluded) {
|
|
31660
31669
|
}
|
31661
31670
|
return target;
|
31662
31671
|
}
|
31663
|
-
var
|
31672
|
+
var Trash = (0, import_react20.forwardRef)(function(_ref, ref) {
|
31664
31673
|
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"]);
|
31665
31674
|
return /* @__PURE__ */ import_react20.default.createElement("svg", _extends18({
|
31666
31675
|
ref,
|
@@ -31673,30 +31682,190 @@ var Unlock = (0, import_react20.forwardRef)(function(_ref, ref) {
|
|
31673
31682
|
strokeWidth: "2",
|
31674
31683
|
strokeLinecap: "round",
|
31675
31684
|
strokeLinejoin: "round"
|
31676
|
-
}, rest), /* @__PURE__ */ import_react20.default.createElement("
|
31685
|
+
}, rest), /* @__PURE__ */ import_react20.default.createElement("polyline", {
|
31686
|
+
points: "3 6 5 6 21 6"
|
31687
|
+
}), /* @__PURE__ */ import_react20.default.createElement("path", {
|
31688
|
+
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"
|
31689
|
+
}));
|
31690
|
+
});
|
31691
|
+
Trash.propTypes = {
|
31692
|
+
color: import_prop_types18.default.string,
|
31693
|
+
size: import_prop_types18.default.oneOfType([import_prop_types18.default.string, import_prop_types18.default.number])
|
31694
|
+
};
|
31695
|
+
Trash.displayName = "Trash";
|
31696
|
+
var trash_default = Trash;
|
31697
|
+
|
31698
|
+
// ../../node_modules/react-feather/dist/icons/type.js
|
31699
|
+
init_react_import();
|
31700
|
+
var import_react21 = __toESM(require("react"));
|
31701
|
+
var import_prop_types19 = __toESM(require_prop_types());
|
31702
|
+
function _extends19() {
|
31703
|
+
_extends19 = Object.assign || function(target) {
|
31704
|
+
for (var i = 1; i < arguments.length; i++) {
|
31705
|
+
var source = arguments[i];
|
31706
|
+
for (var key in source) {
|
31707
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
31708
|
+
target[key] = source[key];
|
31709
|
+
}
|
31710
|
+
}
|
31711
|
+
}
|
31712
|
+
return target;
|
31713
|
+
};
|
31714
|
+
return _extends19.apply(this, arguments);
|
31715
|
+
}
|
31716
|
+
function _objectWithoutProperties19(source, excluded) {
|
31717
|
+
if (source == null)
|
31718
|
+
return {};
|
31719
|
+
var target = _objectWithoutPropertiesLoose19(source, excluded);
|
31720
|
+
var key, i;
|
31721
|
+
if (Object.getOwnPropertySymbols) {
|
31722
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
31723
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
31724
|
+
key = sourceSymbolKeys[i];
|
31725
|
+
if (excluded.indexOf(key) >= 0)
|
31726
|
+
continue;
|
31727
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
31728
|
+
continue;
|
31729
|
+
target[key] = source[key];
|
31730
|
+
}
|
31731
|
+
}
|
31732
|
+
return target;
|
31733
|
+
}
|
31734
|
+
function _objectWithoutPropertiesLoose19(source, excluded) {
|
31735
|
+
if (source == null)
|
31736
|
+
return {};
|
31737
|
+
var target = {};
|
31738
|
+
var sourceKeys = Object.keys(source);
|
31739
|
+
var key, i;
|
31740
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
31741
|
+
key = sourceKeys[i];
|
31742
|
+
if (excluded.indexOf(key) >= 0)
|
31743
|
+
continue;
|
31744
|
+
target[key] = source[key];
|
31745
|
+
}
|
31746
|
+
return target;
|
31747
|
+
}
|
31748
|
+
var Type = (0, import_react21.forwardRef)(function(_ref, ref) {
|
31749
|
+
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"]);
|
31750
|
+
return /* @__PURE__ */ import_react21.default.createElement("svg", _extends19({
|
31751
|
+
ref,
|
31752
|
+
xmlns: "http://www.w3.org/2000/svg",
|
31753
|
+
width: size,
|
31754
|
+
height: size,
|
31755
|
+
viewBox: "0 0 24 24",
|
31756
|
+
fill: "none",
|
31757
|
+
stroke: color,
|
31758
|
+
strokeWidth: "2",
|
31759
|
+
strokeLinecap: "round",
|
31760
|
+
strokeLinejoin: "round"
|
31761
|
+
}, rest), /* @__PURE__ */ import_react21.default.createElement("polyline", {
|
31762
|
+
points: "4 7 4 4 20 4 20 7"
|
31763
|
+
}), /* @__PURE__ */ import_react21.default.createElement("line", {
|
31764
|
+
x1: "9",
|
31765
|
+
y1: "20",
|
31766
|
+
x2: "15",
|
31767
|
+
y2: "20"
|
31768
|
+
}), /* @__PURE__ */ import_react21.default.createElement("line", {
|
31769
|
+
x1: "12",
|
31770
|
+
y1: "4",
|
31771
|
+
x2: "12",
|
31772
|
+
y2: "20"
|
31773
|
+
}));
|
31774
|
+
});
|
31775
|
+
Type.propTypes = {
|
31776
|
+
color: import_prop_types19.default.string,
|
31777
|
+
size: import_prop_types19.default.oneOfType([import_prop_types19.default.string, import_prop_types19.default.number])
|
31778
|
+
};
|
31779
|
+
Type.displayName = "Type";
|
31780
|
+
var type_default = Type;
|
31781
|
+
|
31782
|
+
// ../../node_modules/react-feather/dist/icons/unlock.js
|
31783
|
+
init_react_import();
|
31784
|
+
var import_react22 = __toESM(require("react"));
|
31785
|
+
var import_prop_types20 = __toESM(require_prop_types());
|
31786
|
+
function _extends20() {
|
31787
|
+
_extends20 = Object.assign || function(target) {
|
31788
|
+
for (var i = 1; i < arguments.length; i++) {
|
31789
|
+
var source = arguments[i];
|
31790
|
+
for (var key in source) {
|
31791
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
31792
|
+
target[key] = source[key];
|
31793
|
+
}
|
31794
|
+
}
|
31795
|
+
}
|
31796
|
+
return target;
|
31797
|
+
};
|
31798
|
+
return _extends20.apply(this, arguments);
|
31799
|
+
}
|
31800
|
+
function _objectWithoutProperties20(source, excluded) {
|
31801
|
+
if (source == null)
|
31802
|
+
return {};
|
31803
|
+
var target = _objectWithoutPropertiesLoose20(source, excluded);
|
31804
|
+
var key, i;
|
31805
|
+
if (Object.getOwnPropertySymbols) {
|
31806
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
31807
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
31808
|
+
key = sourceSymbolKeys[i];
|
31809
|
+
if (excluded.indexOf(key) >= 0)
|
31810
|
+
continue;
|
31811
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
31812
|
+
continue;
|
31813
|
+
target[key] = source[key];
|
31814
|
+
}
|
31815
|
+
}
|
31816
|
+
return target;
|
31817
|
+
}
|
31818
|
+
function _objectWithoutPropertiesLoose20(source, excluded) {
|
31819
|
+
if (source == null)
|
31820
|
+
return {};
|
31821
|
+
var target = {};
|
31822
|
+
var sourceKeys = Object.keys(source);
|
31823
|
+
var key, i;
|
31824
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
31825
|
+
key = sourceKeys[i];
|
31826
|
+
if (excluded.indexOf(key) >= 0)
|
31827
|
+
continue;
|
31828
|
+
target[key] = source[key];
|
31829
|
+
}
|
31830
|
+
return target;
|
31831
|
+
}
|
31832
|
+
var Unlock = (0, import_react22.forwardRef)(function(_ref, ref) {
|
31833
|
+
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"]);
|
31834
|
+
return /* @__PURE__ */ import_react22.default.createElement("svg", _extends20({
|
31835
|
+
ref,
|
31836
|
+
xmlns: "http://www.w3.org/2000/svg",
|
31837
|
+
width: size,
|
31838
|
+
height: size,
|
31839
|
+
viewBox: "0 0 24 24",
|
31840
|
+
fill: "none",
|
31841
|
+
stroke: color,
|
31842
|
+
strokeWidth: "2",
|
31843
|
+
strokeLinecap: "round",
|
31844
|
+
strokeLinejoin: "round"
|
31845
|
+
}, rest), /* @__PURE__ */ import_react22.default.createElement("rect", {
|
31677
31846
|
x: "3",
|
31678
31847
|
y: "11",
|
31679
31848
|
width: "18",
|
31680
31849
|
height: "11",
|
31681
31850
|
rx: "2",
|
31682
31851
|
ry: "2"
|
31683
|
-
}), /* @__PURE__ */
|
31852
|
+
}), /* @__PURE__ */ import_react22.default.createElement("path", {
|
31684
31853
|
d: "M7 11V7a5 5 0 0 1 9.9-1"
|
31685
31854
|
}));
|
31686
31855
|
});
|
31687
31856
|
Unlock.propTypes = {
|
31688
|
-
color:
|
31689
|
-
size:
|
31857
|
+
color: import_prop_types20.default.string,
|
31858
|
+
size: import_prop_types20.default.oneOfType([import_prop_types20.default.string, import_prop_types20.default.number])
|
31690
31859
|
};
|
31691
31860
|
Unlock.displayName = "Unlock";
|
31692
31861
|
var unlock_default = Unlock;
|
31693
31862
|
|
31694
31863
|
// lib/use-modifier-held.ts
|
31695
31864
|
init_react_import();
|
31696
|
-
var
|
31865
|
+
var import_react23 = require("react");
|
31697
31866
|
var useModifierHeld = (modifier) => {
|
31698
|
-
const [modifierHeld, setModifierHeld] = (0,
|
31699
|
-
(0,
|
31867
|
+
const [modifierHeld, setModifierHeld] = (0, import_react23.useState)(false);
|
31868
|
+
(0, import_react23.useEffect)(() => {
|
31700
31869
|
function downHandler({ key }) {
|
31701
31870
|
if (key === modifier) {
|
31702
31871
|
setModifierHeld(true);
|
@@ -31744,7 +31913,7 @@ var DraggableComponent = ({
|
|
31744
31913
|
style
|
31745
31914
|
}) => {
|
31746
31915
|
const isModifierHeld = useModifierHeld("Alt");
|
31747
|
-
(0,
|
31916
|
+
(0, import_react24.useEffect)(onMount, []);
|
31748
31917
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
31749
31918
|
import_dnd.Draggable,
|
31750
31919
|
{
|
@@ -31851,7 +32020,7 @@ var styles_module_default2 = { "DropZone": "_DropZone_1akqa_1", "DropZone-conten
|
|
31851
32020
|
|
31852
32021
|
// components/DropZone/context.tsx
|
31853
32022
|
init_react_import();
|
31854
|
-
var
|
32023
|
+
var import_react25 = require("react");
|
31855
32024
|
var import_use_debounce = require("use-debounce");
|
31856
32025
|
|
31857
32026
|
// lib/get-zone-id.ts
|
@@ -31868,29 +32037,29 @@ var getZoneId = (zoneCompound) => {
|
|
31868
32037
|
|
31869
32038
|
// components/DropZone/context.tsx
|
31870
32039
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
31871
|
-
var dropZoneContext = (0,
|
32040
|
+
var dropZoneContext = (0, import_react25.createContext)(null);
|
31872
32041
|
var DropZoneProvider = ({
|
31873
32042
|
children,
|
31874
32043
|
value
|
31875
32044
|
}) => {
|
31876
|
-
const [hoveringArea, setHoveringArea] = (0,
|
31877
|
-
const [hoveringZone, setHoveringZone] = (0,
|
32045
|
+
const [hoveringArea, setHoveringArea] = (0, import_react25.useState)(null);
|
32046
|
+
const [hoveringZone, setHoveringZone] = (0, import_react25.useState)(
|
31878
32047
|
rootDroppableId
|
31879
32048
|
);
|
31880
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
32049
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react25.useState)();
|
31881
32050
|
const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
|
31882
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
32051
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react25.useState)(
|
31883
32052
|
{}
|
31884
32053
|
);
|
31885
|
-
const [activeZones, setActiveZones] = (0,
|
32054
|
+
const [activeZones, setActiveZones] = (0, import_react25.useState)({});
|
31886
32055
|
const { dispatch = null } = value ? value : {};
|
31887
|
-
const registerZoneArea = (0,
|
32056
|
+
const registerZoneArea = (0, import_react25.useCallback)(
|
31888
32057
|
(area) => {
|
31889
32058
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
31890
32059
|
},
|
31891
32060
|
[setAreasWithZones]
|
31892
32061
|
);
|
31893
|
-
const registerZone = (0,
|
32062
|
+
const registerZone = (0, import_react25.useCallback)(
|
31894
32063
|
(zoneCompound) => {
|
31895
32064
|
if (!dispatch) {
|
31896
32065
|
return;
|
@@ -31903,7 +32072,7 @@ var DropZoneProvider = ({
|
|
31903
32072
|
},
|
31904
32073
|
[setActiveZones, dispatch]
|
31905
32074
|
);
|
31906
|
-
const unregisterZone = (0,
|
32075
|
+
const unregisterZone = (0, import_react25.useCallback)(
|
31907
32076
|
(zoneCompound) => {
|
31908
32077
|
if (!dispatch) {
|
31909
32078
|
return;
|
@@ -31918,8 +32087,8 @@ var DropZoneProvider = ({
|
|
31918
32087
|
},
|
31919
32088
|
[setActiveZones, dispatch]
|
31920
32089
|
);
|
31921
|
-
const [pathData, setPathData] = (0,
|
31922
|
-
const registerPath = (0,
|
32090
|
+
const [pathData, setPathData] = (0, import_react25.useState)();
|
32091
|
+
const registerPath = (0, import_react25.useCallback)(
|
31923
32092
|
(selector) => {
|
31924
32093
|
if (!(value == null ? void 0 : value.data)) {
|
31925
32094
|
return;
|
@@ -31969,9 +32138,9 @@ var DropZoneProvider = ({
|
|
31969
32138
|
|
31970
32139
|
// components/Puck/context.tsx
|
31971
32140
|
init_react_import();
|
31972
|
-
var
|
32141
|
+
var import_react26 = require("react");
|
31973
32142
|
var defaultAppState = {
|
31974
|
-
data: { content: [], root: { title: "" } },
|
32143
|
+
data: { content: [], root: { props: { title: "" } } },
|
31975
32144
|
ui: {
|
31976
32145
|
leftSideBarVisible: true,
|
31977
32146
|
rightSideBarVisible: true,
|
@@ -31980,7 +32149,7 @@ var defaultAppState = {
|
|
31980
32149
|
componentList: {}
|
31981
32150
|
}
|
31982
32151
|
};
|
31983
|
-
var appContext = (0,
|
32152
|
+
var appContext = (0, import_react26.createContext)({
|
31984
32153
|
state: defaultAppState,
|
31985
32154
|
dispatch: () => null,
|
31986
32155
|
config: { components: {} },
|
@@ -31988,7 +32157,7 @@ var appContext = (0, import_react24.createContext)({
|
|
31988
32157
|
});
|
31989
32158
|
var AppProvider = appContext.Provider;
|
31990
32159
|
var useAppContext = () => {
|
31991
|
-
const mainContext = (0,
|
32160
|
+
const mainContext = (0, import_react26.useContext)(appContext);
|
31992
32161
|
const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
|
31993
32162
|
return __spreadProps(__spreadValues({}, mainContext), {
|
31994
32163
|
// Helpers
|
@@ -32006,10 +32175,10 @@ var useAppContext = () => {
|
|
32006
32175
|
// components/DropZone/index.tsx
|
32007
32176
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
32008
32177
|
var getClassName3 = get_class_name_factory_default("DropZone", styles_module_default2);
|
32009
|
-
function DropZoneEdit({ zone, style }) {
|
32178
|
+
function DropZoneEdit({ zone, allow, disallow, style }) {
|
32010
32179
|
var _a;
|
32011
32180
|
const appContext2 = useAppContext();
|
32012
|
-
const ctx = (0,
|
32181
|
+
const ctx = (0, import_react27.useContext)(dropZoneContext);
|
32013
32182
|
const {
|
32014
32183
|
// These all need setting via context
|
32015
32184
|
data,
|
@@ -32026,12 +32195,12 @@ function DropZoneEdit({ zone, style }) {
|
|
32026
32195
|
} = ctx || {};
|
32027
32196
|
let content = data.content || [];
|
32028
32197
|
let zoneCompound = rootDroppableId;
|
32029
|
-
(0,
|
32198
|
+
(0, import_react27.useEffect)(() => {
|
32030
32199
|
if (areaId && registerZoneArea) {
|
32031
32200
|
registerZoneArea(areaId);
|
32032
32201
|
}
|
32033
32202
|
}, [areaId]);
|
32034
|
-
(0,
|
32203
|
+
(0, import_react27.useEffect)(() => {
|
32035
32204
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
32036
32205
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
32037
32206
|
}
|
@@ -32052,7 +32221,7 @@ function DropZoneEdit({ zone, style }) {
|
|
32052
32221
|
const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
|
32053
32222
|
const [zoneArea] = getZoneId(zoneCompound);
|
32054
32223
|
const [draggedSourceArea] = getZoneId(draggedSourceId);
|
32055
|
-
const [userWillDrag, setUserWillDrag] = (0,
|
32224
|
+
const [userWillDrag, setUserWillDrag] = (0, import_react27.useState)(false);
|
32056
32225
|
const userIsDragging = !!draggedItem;
|
32057
32226
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
32058
32227
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
@@ -32076,6 +32245,22 @@ function DropZoneEdit({ zone, style }) {
|
|
32076
32245
|
isEnabled = draggingOverArea && hoveringOverZone;
|
32077
32246
|
}
|
32078
32247
|
}
|
32248
|
+
if (isEnabled && userIsDragging && (allow || disallow)) {
|
32249
|
+
const [_, componentType] = draggedItem.draggableId.split("::");
|
32250
|
+
if (disallow) {
|
32251
|
+
const defaultedAllow = allow || [];
|
32252
|
+
const filteredDisallow = (disallow || []).filter(
|
32253
|
+
(item) => defaultedAllow.indexOf(item) === -1
|
32254
|
+
);
|
32255
|
+
if (filteredDisallow.indexOf(componentType) !== -1) {
|
32256
|
+
isEnabled = false;
|
32257
|
+
}
|
32258
|
+
} else if (allow) {
|
32259
|
+
if (allow.indexOf(componentType) === -1) {
|
32260
|
+
isEnabled = false;
|
32261
|
+
}
|
32262
|
+
}
|
32263
|
+
}
|
32079
32264
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
32080
32265
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
32081
32266
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
@@ -32254,7 +32439,7 @@ function DropZoneEdit({ zone, style }) {
|
|
32254
32439
|
);
|
32255
32440
|
}
|
32256
32441
|
function DropZoneRender({ zone }) {
|
32257
|
-
const ctx = (0,
|
32442
|
+
const ctx = (0, import_react27.useContext)(dropZoneContext);
|
32258
32443
|
const { data, areaId = "root", config } = ctx || {};
|
32259
32444
|
let zoneCompound = rootDroppableId;
|
32260
32445
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -32286,7 +32471,7 @@ function DropZoneRender({ zone }) {
|
|
32286
32471
|
}) });
|
32287
32472
|
}
|
32288
32473
|
function DropZone(props) {
|
32289
|
-
const ctx = (0,
|
32474
|
+
const ctx = (0, import_react27.useContext)(dropZoneContext);
|
32290
32475
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
32291
32476
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DropZoneEdit, __spreadValues({}, props));
|
32292
32477
|
}
|
@@ -32298,7 +32483,7 @@ init_react_import();
|
|
32298
32483
|
|
32299
32484
|
// components/IconButton/IconButton.tsx
|
32300
32485
|
init_react_import();
|
32301
|
-
var
|
32486
|
+
var import_react28 = require("react");
|
32302
32487
|
|
32303
32488
|
// css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
|
32304
32489
|
init_react_import();
|
@@ -32320,7 +32505,7 @@ var IconButton = ({
|
|
32320
32505
|
fullWidth,
|
32321
32506
|
title
|
32322
32507
|
}) => {
|
32323
|
-
const [loading, setLoading] = (0,
|
32508
|
+
const [loading, setLoading] = (0, import_react28.useState)(false);
|
32324
32509
|
const ElementType = href ? "a" : "button";
|
32325
32510
|
const el = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
32326
32511
|
ElementType,
|
@@ -32361,7 +32546,7 @@ var IconButton = ({
|
|
32361
32546
|
|
32362
32547
|
// components/Puck/index.tsx
|
32363
32548
|
init_react_import();
|
32364
|
-
var
|
32549
|
+
var import_react41 = require("react");
|
32365
32550
|
var import_dnd7 = require("@hello-pangea/dnd");
|
32366
32551
|
|
32367
32552
|
// components/InputOrGroup/index.tsx
|
@@ -32372,7 +32557,7 @@ init_react_import();
|
|
32372
32557
|
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" };
|
32373
32558
|
|
32374
32559
|
// components/InputOrGroup/index.tsx
|
32375
|
-
var
|
32560
|
+
var import_react33 = require("react");
|
32376
32561
|
|
32377
32562
|
// components/InputOrGroup/fields/index.tsx
|
32378
32563
|
init_react_import();
|
@@ -32437,7 +32622,7 @@ var Draggable2 = ({
|
|
32437
32622
|
};
|
32438
32623
|
|
32439
32624
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
32440
|
-
var
|
32625
|
+
var import_react29 = require("react");
|
32441
32626
|
|
32442
32627
|
// components/DragIcon/index.tsx
|
32443
32628
|
init_react_import();
|
@@ -32470,17 +32655,16 @@ var ArrayField = ({
|
|
32470
32655
|
items: Array.from(value || []).map((item, idx) => {
|
32471
32656
|
return {
|
32472
32657
|
_originalIndex: idx,
|
32473
|
-
_arrayId: `${id}-${idx}
|
32474
|
-
data: item
|
32658
|
+
_arrayId: `${id}-${idx}`
|
32475
32659
|
};
|
32476
32660
|
}),
|
32477
32661
|
openId: ""
|
32478
32662
|
};
|
32479
|
-
const [localState, setLocalState] = (0,
|
32480
|
-
(0,
|
32663
|
+
const [localState, setLocalState] = (0, import_react29.useState)({ arrayState, value });
|
32664
|
+
(0, import_react29.useEffect)(() => {
|
32481
32665
|
setLocalState({ arrayState, value });
|
32482
32666
|
}, [value, state.ui.arrayState[id]]);
|
32483
|
-
const mapArrayStateToUi = (0,
|
32667
|
+
const mapArrayStateToUi = (0, import_react29.useCallback)(
|
32484
32668
|
(partialArrayState) => {
|
32485
32669
|
return {
|
32486
32670
|
arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
|
@@ -32490,31 +32674,35 @@ var ArrayField = ({
|
|
32490
32674
|
},
|
32491
32675
|
[arrayState]
|
32492
32676
|
);
|
32493
|
-
const getHighestIndex = (0,
|
32677
|
+
const getHighestIndex = (0, import_react29.useCallback)(() => {
|
32494
32678
|
return arrayState.items.reduce(
|
32495
32679
|
(acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
|
32496
32680
|
-1
|
32497
32681
|
);
|
32498
32682
|
}, [arrayState]);
|
32499
|
-
const regenerateArrayState = (0,
|
32683
|
+
const regenerateArrayState = (0, import_react29.useCallback)(
|
32500
32684
|
(value2) => {
|
32501
32685
|
let highestIndex = getHighestIndex();
|
32502
32686
|
const newItems = Array.from(value2 || []).map((item, idx) => {
|
32503
32687
|
var _a;
|
32504
32688
|
const arrayStateItem = arrayState.items[idx];
|
32505
|
-
|
32506
|
-
_originalIndex: typeof (arrayStateItem == null ? void 0 : arrayStateItem._originalIndex) !== "undefined" ? arrayStateItem._originalIndex :
|
32507
|
-
_arrayId: ((_a = arrayState.items[idx]) == null ? void 0 : _a._arrayId) || `${id}-${highestIndex}
|
32508
|
-
data: item
|
32689
|
+
const newItem = {
|
32690
|
+
_originalIndex: typeof (arrayStateItem == null ? void 0 : arrayStateItem._originalIndex) !== "undefined" ? arrayStateItem._originalIndex : highestIndex + 1,
|
32691
|
+
_arrayId: ((_a = arrayState.items[idx]) == null ? void 0 : _a._arrayId) || `${id}-${highestIndex + 1}`
|
32509
32692
|
};
|
32693
|
+
if (newItem._originalIndex > highestIndex) {
|
32694
|
+
highestIndex = newItem._originalIndex;
|
32695
|
+
}
|
32696
|
+
return newItem;
|
32510
32697
|
});
|
32511
32698
|
return __spreadProps(__spreadValues({}, arrayState), { items: newItems });
|
32512
32699
|
},
|
32513
32700
|
[arrayState]
|
32514
32701
|
);
|
32515
|
-
(0,
|
32702
|
+
(0, import_react29.useEffect)(() => {
|
32516
32703
|
setUi(mapArrayStateToUi(arrayState));
|
32517
32704
|
}, []);
|
32705
|
+
const [hovering, setHovering] = (0, import_react29.useState)(false);
|
32518
32706
|
if (field.type !== "array" || !field.arrayFields) {
|
32519
32707
|
return null;
|
32520
32708
|
}
|
@@ -32561,6 +32749,14 @@ var ArrayField = ({
|
|
32561
32749
|
isDraggingFrom: !!snapshot.draggingFromThisWith,
|
32562
32750
|
hasItems: Array.isArray(value) && value.length > 0
|
32563
32751
|
}),
|
32752
|
+
onMouseOver: (e) => {
|
32753
|
+
e.stopPropagation();
|
32754
|
+
setHovering(true);
|
32755
|
+
},
|
32756
|
+
onMouseOut: (e) => {
|
32757
|
+
e.stopPropagation();
|
32758
|
+
setHovering(false);
|
32759
|
+
},
|
32564
32760
|
children: [
|
32565
32761
|
localState.arrayState.items.map((item, i) => {
|
32566
32762
|
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
@@ -32575,7 +32771,7 @@ var ArrayField = ({
|
|
32575
32771
|
isDragging: snapshot2 == null ? void 0 : snapshot2.isDragging,
|
32576
32772
|
readOnly
|
32577
32773
|
}),
|
32578
|
-
isDragDisabled: readOnly,
|
32774
|
+
isDragDisabled: readOnly || !hovering,
|
32579
32775
|
children: () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
32580
32776
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
32581
32777
|
"div",
|
@@ -32638,16 +32834,17 @@ var ArrayField = ({
|
|
32638
32834
|
{
|
32639
32835
|
name: subFieldName,
|
32640
32836
|
label: subField.label || fieldName,
|
32641
|
-
id: `${
|
32837
|
+
id: `${_arrayId}_${fieldName}`,
|
32642
32838
|
readOnly: typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName],
|
32643
32839
|
readOnlyFields,
|
32644
32840
|
field: subField,
|
32645
32841
|
value: data[fieldName],
|
32646
|
-
onChange: (val) => {
|
32842
|
+
onChange: (val, ui) => {
|
32647
32843
|
onChange(
|
32648
32844
|
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
32649
32845
|
[fieldName]: val
|
32650
|
-
}))
|
32846
|
+
})),
|
32847
|
+
ui
|
32651
32848
|
);
|
32652
32849
|
}
|
32653
32850
|
},
|
@@ -32734,19 +32931,19 @@ var DefaultField = ({
|
|
32734
32931
|
|
32735
32932
|
// components/InputOrGroup/fields/ExternalField/index.tsx
|
32736
32933
|
init_react_import();
|
32737
|
-
var
|
32934
|
+
var import_react32 = require("react");
|
32738
32935
|
|
32739
32936
|
// components/ExternalInput/index.tsx
|
32740
32937
|
init_react_import();
|
32741
|
-
var
|
32938
|
+
var import_react31 = require("react");
|
32742
32939
|
|
32743
32940
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
32744
32941
|
init_react_import();
|
32745
|
-
var styles_module_default6 = { "ExternalInput": "
|
32942
|
+
var styles_module_default6 = { "ExternalInput": "_ExternalInput_s6fxy_1", "ExternalInput-actions": "_ExternalInput-actions_s6fxy_5", "ExternalInput-button": "_ExternalInput-button_s6fxy_9", "ExternalInput-detachButton": "_ExternalInput-detachButton_s6fxy_28", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_s6fxy_35", "ExternalInputModal": "_ExternalInputModal_s6fxy_56", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_s6fxy_64", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_s6fxy_72", "ExternalInputModal-table": "_ExternalInputModal-table_s6fxy_72", "ExternalInputModal-thead": "_ExternalInputModal-thead_s6fxy_88", "ExternalInputModal-th": "_ExternalInputModal-th_s6fxy_88", "ExternalInputModal-td": "_ExternalInputModal-td_s6fxy_102", "ExternalInputModal-tr": "_ExternalInputModal-tr_s6fxy_107", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_s6fxy_119", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_s6fxy_138", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_s6fxy_142", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_s6fxy_155", "ExternalInputModal-noContentBanner": "_ExternalInputModal-noContentBanner_s6fxy_159", "ExternalInputModal--loaded": "_ExternalInputModal--loaded_s6fxy_166", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_s6fxy_171", "ExternalInputModal-search": "_ExternalInputModal-search_s6fxy_171", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_s6fxy_194", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_s6fxy_206", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_s6fxy_216" };
|
32746
32943
|
|
32747
32944
|
// components/Modal/index.tsx
|
32748
32945
|
init_react_import();
|
32749
|
-
var
|
32946
|
+
var import_react30 = require("react");
|
32750
32947
|
|
32751
32948
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
32752
32949
|
init_react_import();
|
@@ -32761,8 +32958,8 @@ var Modal = ({
|
|
32761
32958
|
onClose,
|
32762
32959
|
isOpen
|
32763
32960
|
}) => {
|
32764
|
-
const [rootEl, setRootEl] = (0,
|
32765
|
-
(0,
|
32961
|
+
const [rootEl, setRootEl] = (0, import_react30.useState)(null);
|
32962
|
+
(0, import_react30.useEffect)(() => {
|
32766
32963
|
setRootEl(document.getElementById("puck-portal-root"));
|
32767
32964
|
}, []);
|
32768
32965
|
if (!rootEl) {
|
@@ -32818,10 +33015,10 @@ var ExternalInput = ({
|
|
32818
33015
|
id
|
32819
33016
|
}) => {
|
32820
33017
|
const { mapProp = (val) => val } = field || {};
|
32821
|
-
const [data, setData] = (0,
|
32822
|
-
const [isOpen, setOpen] = (0,
|
32823
|
-
const [isLoading, setIsLoading] = (0,
|
32824
|
-
const keys = (0,
|
33018
|
+
const [data, setData] = (0, import_react31.useState)([]);
|
33019
|
+
const [isOpen, setOpen] = (0, import_react31.useState)(false);
|
33020
|
+
const [isLoading, setIsLoading] = (0, import_react31.useState)(true);
|
33021
|
+
const keys = (0, import_react31.useMemo)(() => {
|
32825
33022
|
const validKeys = /* @__PURE__ */ new Set();
|
32826
33023
|
for (const item of data) {
|
32827
33024
|
for (const key of Object.keys(item)) {
|
@@ -32832,15 +33029,22 @@ var ExternalInput = ({
|
|
32832
33029
|
}
|
32833
33030
|
return Array.from(validKeys);
|
32834
33031
|
}, [data]);
|
32835
|
-
(0,
|
32836
|
-
|
32837
|
-
|
33032
|
+
const [searchQuery, setSearchQuery] = (0, import_react31.useState)(field.initialQuery || "");
|
33033
|
+
const search = (0, import_react31.useCallback)(
|
33034
|
+
(query) => __async(void 0, null, function* () {
|
33035
|
+
setIsLoading(true);
|
33036
|
+
const cacheKey = `${id}-${name}-${query}`;
|
33037
|
+
const listData = dataCache[cacheKey] || (yield field.fetchList({ query }));
|
32838
33038
|
if (listData) {
|
32839
33039
|
setData(listData);
|
32840
33040
|
setIsLoading(false);
|
32841
|
-
dataCache[
|
33041
|
+
dataCache[cacheKey] = listData;
|
32842
33042
|
}
|
32843
|
-
})
|
33043
|
+
}),
|
33044
|
+
[name, field]
|
33045
|
+
);
|
33046
|
+
(0, import_react31.useEffect)(() => {
|
33047
|
+
search(searchQuery);
|
32844
33048
|
}, []);
|
32845
33049
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
32846
33050
|
"div",
|
@@ -32880,38 +33084,73 @@ var ExternalInput = ({
|
|
32880
33084
|
className: getClassNameModal({
|
32881
33085
|
isLoading,
|
32882
33086
|
loaded: !isLoading,
|
32883
|
-
hasData:
|
33087
|
+
hasData: data.length > 0
|
32884
33088
|
}),
|
32885
33089
|
children: [
|
32886
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.
|
32887
|
-
|
32888
|
-
|
32889
|
-
"
|
33090
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("masthead"), children: [
|
33091
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Heading, { rank: 2, size: "xxl", children: "Select content" }),
|
33092
|
+
field.showSearch && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
33093
|
+
"form",
|
32890
33094
|
{
|
32891
|
-
className: getClassNameModal("
|
32892
|
-
|
32893
|
-
|
32894
|
-
|
32895
|
-
|
32896
|
-
|
32897
|
-
|
32898
|
-
|
32899
|
-
|
33095
|
+
className: getClassNameModal("searchForm"),
|
33096
|
+
onSubmit: (e) => {
|
33097
|
+
e.preventDefault();
|
33098
|
+
search(searchQuery);
|
33099
|
+
},
|
33100
|
+
children: [
|
33101
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: getClassNameModal("search"), children: [
|
33102
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
|
33103
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(search_default, { size: "18" }) }),
|
33104
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
33105
|
+
"input",
|
33106
|
+
{
|
33107
|
+
className: getClassNameModal("searchInput"),
|
33108
|
+
name: "q",
|
33109
|
+
type: "search",
|
33110
|
+
placeholder: "Search",
|
33111
|
+
onChange: (e) => {
|
33112
|
+
setSearchQuery(e.currentTarget.value);
|
33113
|
+
},
|
33114
|
+
autoComplete: "off",
|
33115
|
+
value: searchQuery
|
33116
|
+
}
|
33117
|
+
)
|
33118
|
+
] }),
|
33119
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { type: "submit", loading: isLoading, disabled: isLoading, children: "Search" })
|
33120
|
+
]
|
33121
|
+
}
|
33122
|
+
)
|
33123
|
+
] }),
|
33124
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
|
33125
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", { className: getClassNameModal("table"), children: [
|
33126
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
33127
|
+
"th",
|
32900
33128
|
{
|
32901
|
-
|
32902
|
-
|
32903
|
-
|
32904
|
-
onChange(mapProp(item));
|
32905
|
-
setOpen(false);
|
32906
|
-
},
|
32907
|
-
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
33129
|
+
className: getClassNameModal("th"),
|
33130
|
+
style: { textAlign: "left" },
|
33131
|
+
children: key
|
32908
33132
|
},
|
32909
|
-
|
32910
|
-
)
|
32911
|
-
|
32912
|
-
|
32913
|
-
|
32914
|
-
|
33133
|
+
key
|
33134
|
+
)) }) }),
|
33135
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: getClassNameModal("tbody"), children: data.map((item, i) => {
|
33136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
33137
|
+
"tr",
|
33138
|
+
{
|
33139
|
+
style: { whiteSpace: "nowrap" },
|
33140
|
+
className: getClassNameModal("tr"),
|
33141
|
+
onClick: (e) => {
|
33142
|
+
onChange(mapProp(item));
|
33143
|
+
setOpen(false);
|
33144
|
+
},
|
33145
|
+
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
33146
|
+
},
|
33147
|
+
i
|
33148
|
+
);
|
33149
|
+
}) })
|
33150
|
+
] }),
|
33151
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_spinners4.ClipLoader, { size: 24, "aria-label": "Loading" }) })
|
33152
|
+
] }),
|
33153
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("noContentBanner"), children: "No results." })
|
32915
33154
|
]
|
32916
33155
|
}
|
32917
33156
|
) })
|
@@ -32933,7 +33172,7 @@ var ExternalField = ({
|
|
32933
33172
|
var _a, _b, _c;
|
32934
33173
|
const validField = field;
|
32935
33174
|
const deprecatedField = field;
|
32936
|
-
(0,
|
33175
|
+
(0, import_react32.useEffect)(() => {
|
32937
33176
|
if (deprecatedField.adaptor) {
|
32938
33177
|
console.error(
|
32939
33178
|
"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."
|
@@ -32982,7 +33221,8 @@ var RadioField = ({
|
|
32982
33221
|
readOnly,
|
32983
33222
|
value,
|
32984
33223
|
name,
|
32985
|
-
id
|
33224
|
+
id,
|
33225
|
+
label
|
32986
33226
|
}) => {
|
32987
33227
|
if (field.type !== "radio" || !field.options) {
|
32988
33228
|
return null;
|
@@ -32991,7 +33231,7 @@ var RadioField = ({
|
|
32991
33231
|
FieldLabelInternal,
|
32992
33232
|
{
|
32993
33233
|
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(check_circle_default, { size: 16 }),
|
32994
|
-
label:
|
33234
|
+
label: label || name,
|
32995
33235
|
readOnly,
|
32996
33236
|
el: "div",
|
32997
33237
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
@@ -33113,8 +33353,72 @@ var TextareaField = ({
|
|
33113
33353
|
|
33114
33354
|
// components/InputOrGroup/index.tsx
|
33115
33355
|
var import_use_debounce2 = require("use-debounce");
|
33356
|
+
|
33357
|
+
// components/InputOrGroup/fields/ObjectField/index.tsx
|
33358
|
+
init_react_import();
|
33359
|
+
|
33360
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ObjectField/styles.module.css#css-module
|
33361
|
+
init_react_import();
|
33362
|
+
var styles_module_default9 = { "ObjectField": "_ObjectField_56z4t_5", "ObjectField-fieldset": "_ObjectField-fieldset_56z4t_13" };
|
33363
|
+
|
33364
|
+
// components/InputOrGroup/fields/ObjectField/index.tsx
|
33116
33365
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
33117
|
-
var getClassName14 = get_class_name_factory_default("
|
33366
|
+
var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
|
33367
|
+
var getClassNameItem2 = get_class_name_factory_default("ObjectFieldItem", styles_module_default9);
|
33368
|
+
var ObjectField = ({
|
33369
|
+
field,
|
33370
|
+
onChange,
|
33371
|
+
value,
|
33372
|
+
name,
|
33373
|
+
label,
|
33374
|
+
readOnly,
|
33375
|
+
readOnlyFields = {},
|
33376
|
+
id
|
33377
|
+
}) => {
|
33378
|
+
if (field.type !== "object" || !field.objectFields) {
|
33379
|
+
return null;
|
33380
|
+
}
|
33381
|
+
const data = value || {};
|
33382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
33383
|
+
FieldLabelInternal,
|
33384
|
+
{
|
33385
|
+
label: label || name,
|
33386
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(more_vertical_default, { size: 16 }),
|
33387
|
+
el: "div",
|
33388
|
+
readOnly,
|
33389
|
+
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) => {
|
33390
|
+
const subField = field.objectFields[fieldName];
|
33391
|
+
const subFieldName = `${name}.${fieldName}`;
|
33392
|
+
const wildcardFieldName = `${name}.${fieldName}`;
|
33393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
33394
|
+
InputOrGroup,
|
33395
|
+
{
|
33396
|
+
name: subFieldName,
|
33397
|
+
label: subField.label || fieldName,
|
33398
|
+
id: `${id}_${fieldName}`,
|
33399
|
+
readOnly: typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName],
|
33400
|
+
readOnlyFields,
|
33401
|
+
field: subField,
|
33402
|
+
value: data[fieldName],
|
33403
|
+
onChange: (val, ui) => {
|
33404
|
+
onChange(
|
33405
|
+
__spreadProps(__spreadValues({}, data), {
|
33406
|
+
[fieldName]: val
|
33407
|
+
}),
|
33408
|
+
ui
|
33409
|
+
);
|
33410
|
+
}
|
33411
|
+
},
|
33412
|
+
subFieldName
|
33413
|
+
);
|
33414
|
+
}) }) })
|
33415
|
+
}
|
33416
|
+
);
|
33417
|
+
};
|
33418
|
+
|
33419
|
+
// components/InputOrGroup/index.tsx
|
33420
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
33421
|
+
var getClassName15 = get_class_name_factory_default("Input", styles_module_default3);
|
33118
33422
|
var FieldLabel = ({
|
33119
33423
|
children,
|
33120
33424
|
icon,
|
@@ -33124,11 +33428,11 @@ var FieldLabel = ({
|
|
33124
33428
|
className
|
33125
33429
|
}) => {
|
33126
33430
|
const El = el;
|
33127
|
-
return /* @__PURE__ */ (0,
|
33128
|
-
/* @__PURE__ */ (0,
|
33129
|
-
icon ? /* @__PURE__ */ (0,
|
33431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(El, { className, children: [
|
33432
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName15("label"), children: [
|
33433
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, {}),
|
33130
33434
|
label,
|
33131
|
-
readOnly && /* @__PURE__ */ (0,
|
33435
|
+
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" }) })
|
33132
33436
|
] }),
|
33133
33437
|
children
|
33134
33438
|
] });
|
@@ -33140,12 +33444,12 @@ var FieldLabelInternal = ({
|
|
33140
33444
|
el = "label",
|
33141
33445
|
readOnly
|
33142
33446
|
}) => {
|
33143
|
-
return /* @__PURE__ */ (0,
|
33447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
33144
33448
|
FieldLabel,
|
33145
33449
|
{
|
33146
33450
|
label,
|
33147
33451
|
icon,
|
33148
|
-
className:
|
33452
|
+
className: getClassName15({ readOnly }),
|
33149
33453
|
readOnly,
|
33150
33454
|
el,
|
33151
33455
|
children
|
@@ -33155,7 +33459,7 @@ var FieldLabelInternal = ({
|
|
33155
33459
|
var InputOrGroup = (_a) => {
|
33156
33460
|
var _b = _a, { onChange } = _b, props = __objRest(_b, ["onChange"]);
|
33157
33461
|
const { name, field, value, readOnly } = props;
|
33158
|
-
const [localValue, setLocalValue] = (0,
|
33462
|
+
const [localValue, setLocalValue] = (0, import_react33.useState)(value);
|
33159
33463
|
const onChangeDb = (0, import_use_debounce2.useDebouncedCallback)(
|
33160
33464
|
(val, ui) => {
|
33161
33465
|
onChange(val, ui);
|
@@ -33163,11 +33467,11 @@ var InputOrGroup = (_a) => {
|
|
33163
33467
|
50,
|
33164
33468
|
{ leading: true }
|
33165
33469
|
);
|
33166
|
-
const onChangeLocal = (0,
|
33470
|
+
const onChangeLocal = (0, import_react33.useCallback)((val, ui) => {
|
33167
33471
|
setLocalValue(val);
|
33168
33472
|
onChangeDb(val, ui);
|
33169
33473
|
}, []);
|
33170
|
-
(0,
|
33474
|
+
(0, import_react33.useEffect)(() => {
|
33171
33475
|
setLocalValue(value);
|
33172
33476
|
}, [value]);
|
33173
33477
|
const localProps = {
|
@@ -33175,31 +33479,34 @@ var InputOrGroup = (_a) => {
|
|
33175
33479
|
onChange: onChangeLocal
|
33176
33480
|
};
|
33177
33481
|
if (field.type === "array") {
|
33178
|
-
return /* @__PURE__ */ (0,
|
33482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ArrayField, __spreadValues(__spreadValues({}, props), localProps));
|
33179
33483
|
}
|
33180
33484
|
if (field.type === "external") {
|
33181
|
-
return /* @__PURE__ */ (0,
|
33485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ExternalField, __spreadValues(__spreadValues({}, props), localProps));
|
33486
|
+
}
|
33487
|
+
if (field.type === "object") {
|
33488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ObjectField, __spreadValues(__spreadValues({}, props), localProps));
|
33182
33489
|
}
|
33183
33490
|
if (field.type === "select") {
|
33184
|
-
return /* @__PURE__ */ (0,
|
33491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectField, __spreadValues(__spreadValues({}, props), localProps));
|
33185
33492
|
}
|
33186
33493
|
if (field.type === "textarea") {
|
33187
|
-
return /* @__PURE__ */ (0,
|
33494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TextareaField, __spreadValues(__spreadValues({}, props), localProps));
|
33188
33495
|
}
|
33189
33496
|
if (field.type === "radio") {
|
33190
|
-
return /* @__PURE__ */ (0,
|
33497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RadioField, __spreadValues(__spreadValues({}, props), localProps));
|
33191
33498
|
}
|
33192
33499
|
if (field.type === "custom") {
|
33193
33500
|
if (!field.render) {
|
33194
33501
|
return null;
|
33195
33502
|
}
|
33196
|
-
return /* @__PURE__ */ (0,
|
33503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15(), children: field.render(__spreadValues({
|
33197
33504
|
field,
|
33198
33505
|
name,
|
33199
33506
|
readOnly
|
33200
33507
|
}, localProps)) });
|
33201
33508
|
}
|
33202
|
-
return /* @__PURE__ */ (0,
|
33509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DefaultField, __spreadValues(__spreadValues({}, props), localProps));
|
33203
33510
|
};
|
33204
33511
|
|
33205
33512
|
// components/ComponentList/index.tsx
|
@@ -33208,28 +33515,28 @@ var import_dnd6 = require("@hello-pangea/dnd");
|
|
33208
33515
|
|
33209
33516
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
33210
33517
|
init_react_import();
|
33211
|
-
var
|
33518
|
+
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" };
|
33212
33519
|
|
33213
33520
|
// components/ComponentList/index.tsx
|
33214
|
-
var
|
33215
|
-
var
|
33216
|
-
var
|
33521
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
33522
|
+
var getClassName16 = get_class_name_factory_default("ComponentList", styles_module_default10);
|
33523
|
+
var getClassNameItem3 = get_class_name_factory_default("ComponentListItem", styles_module_default10);
|
33217
33524
|
var ComponentListItem = ({
|
33218
33525
|
component,
|
33219
33526
|
index,
|
33220
33527
|
id
|
33221
33528
|
}) => {
|
33222
|
-
return /* @__PURE__ */ (0,
|
33529
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassNameItem3(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
33223
33530
|
Draggable2,
|
33224
33531
|
{
|
33225
33532
|
id,
|
33226
33533
|
index,
|
33227
33534
|
showShadow: true,
|
33228
33535
|
disableAnimations: true,
|
33229
|
-
className: () =>
|
33230
|
-
children: () => /* @__PURE__ */ (0,
|
33231
|
-
/* @__PURE__ */ (0,
|
33232
|
-
/* @__PURE__ */ (0,
|
33536
|
+
className: () => getClassNameItem3("draggable"),
|
33537
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
33538
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassNameItem3("name"), children: component }),
|
33539
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassNameItem3("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DragIcon, {}) })
|
33233
33540
|
] })
|
33234
33541
|
},
|
33235
33542
|
component
|
@@ -33242,11 +33549,11 @@ var ComponentList = ({
|
|
33242
33549
|
}) => {
|
33243
33550
|
const { config, state, setUi } = useAppContext();
|
33244
33551
|
const { expanded = true } = state.ui.componentList[id] || {};
|
33245
|
-
return /* @__PURE__ */ (0,
|
33246
|
-
title && /* @__PURE__ */ (0,
|
33552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName16({ isExpanded: expanded }), children: [
|
33553
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
33247
33554
|
"div",
|
33248
33555
|
{
|
33249
|
-
className:
|
33556
|
+
className: getClassName16("title"),
|
33250
33557
|
onClick: () => setUi({
|
33251
33558
|
componentList: __spreadProps(__spreadValues({}, state.ui.componentList), {
|
33252
33559
|
[id]: __spreadProps(__spreadValues({}, state.ui.componentList[id]), {
|
@@ -33256,26 +33563,26 @@ var ComponentList = ({
|
|
33256
33563
|
}),
|
33257
33564
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
33258
33565
|
children: [
|
33259
|
-
/* @__PURE__ */ (0,
|
33260
|
-
/* @__PURE__ */ (0,
|
33566
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: title }),
|
33567
|
+
/* @__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 }) })
|
33261
33568
|
]
|
33262
33569
|
}
|
33263
33570
|
),
|
33264
|
-
/* @__PURE__ */ (0,
|
33571
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("content"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
33265
33572
|
import_dnd6.Droppable,
|
33266
33573
|
{
|
33267
33574
|
droppableId: `component-list${title ? `:${title}` : ""}`,
|
33268
33575
|
isDropDisabled: true,
|
33269
|
-
children: (provided, snapshot) => /* @__PURE__ */ (0,
|
33576
|
+
children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
33270
33577
|
"div",
|
33271
33578
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
33272
33579
|
ref: provided.innerRef,
|
33273
|
-
className:
|
33580
|
+
className: getClassName16({
|
33274
33581
|
isDraggingFrom: !!snapshot.draggingFromThisWith
|
33275
33582
|
}),
|
33276
33583
|
children: [
|
33277
33584
|
children || Object.keys(config.components).map((componentKey, i) => {
|
33278
|
-
return /* @__PURE__ */ (0,
|
33585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
33279
33586
|
ComponentListItem,
|
33280
33587
|
{
|
33281
33588
|
component: componentKey,
|
@@ -33285,7 +33592,7 @@ var ComponentList = ({
|
|
33285
33592
|
componentKey
|
33286
33593
|
);
|
33287
33594
|
}),
|
33288
|
-
/* @__PURE__ */ (0,
|
33595
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
|
33289
33596
|
]
|
33290
33597
|
})
|
33291
33598
|
)
|
@@ -33297,10 +33604,10 @@ ComponentList.Item = ComponentListItem;
|
|
33297
33604
|
|
33298
33605
|
// lib/use-placeholder-style.ts
|
33299
33606
|
init_react_import();
|
33300
|
-
var
|
33607
|
+
var import_react34 = require("react");
|
33301
33608
|
var usePlaceholderStyle = () => {
|
33302
33609
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
33303
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
33610
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react34.useState)();
|
33304
33611
|
const onDragStartOrUpdate = (draggedItem) => {
|
33305
33612
|
var _a;
|
33306
33613
|
const draggableId = draggedItem.draggableId;
|
@@ -33348,11 +33655,11 @@ init_react_import();
|
|
33348
33655
|
|
33349
33656
|
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
33350
33657
|
init_react_import();
|
33351
|
-
var
|
33658
|
+
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" };
|
33352
33659
|
|
33353
33660
|
// lib/use-breadcrumbs.ts
|
33354
33661
|
init_react_import();
|
33355
|
-
var
|
33662
|
+
var import_react35 = require("react");
|
33356
33663
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
33357
33664
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
33358
33665
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -33402,8 +33709,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
33402
33709
|
state: { data },
|
33403
33710
|
selectedItem
|
33404
33711
|
} = useAppContext();
|
33405
|
-
const dzContext = (0,
|
33406
|
-
return (0,
|
33712
|
+
const dzContext = (0, import_react35.useContext)(dropZoneContext);
|
33713
|
+
return (0, import_react35.useMemo)(() => {
|
33407
33714
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
33408
33715
|
selectedItem,
|
33409
33716
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -33418,8 +33725,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
33418
33725
|
|
33419
33726
|
// components/SidebarSection/index.tsx
|
33420
33727
|
var import_react_spinners5 = require("react-spinners");
|
33421
|
-
var
|
33422
|
-
var
|
33728
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
33729
|
+
var getClassName17 = get_class_name_factory_default("SidebarSection", styles_module_default11);
|
33423
33730
|
var SidebarSection = ({
|
33424
33731
|
children,
|
33425
33732
|
title,
|
@@ -33430,23 +33737,23 @@ var SidebarSection = ({
|
|
33430
33737
|
}) => {
|
33431
33738
|
const { setUi } = useAppContext();
|
33432
33739
|
const breadcrumbs = useBreadcrumbs(1);
|
33433
|
-
return /* @__PURE__ */ (0,
|
33434
|
-
/* @__PURE__ */ (0,
|
33435
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
33436
|
-
/* @__PURE__ */ (0,
|
33740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName17({ noPadding }), style: { background }, children: [
|
33741
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("title"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName17("breadcrumbs"), children: [
|
33742
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName17("breadcrumb"), children: [
|
33743
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
33437
33744
|
"div",
|
33438
33745
|
{
|
33439
|
-
className:
|
33746
|
+
className: getClassName17("breadcrumbLabel"),
|
33440
33747
|
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
33441
33748
|
children: breadcrumb.label
|
33442
33749
|
}
|
33443
33750
|
),
|
33444
|
-
/* @__PURE__ */ (0,
|
33751
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(chevron_right_default, { size: 16 })
|
33445
33752
|
] }, i)) : null,
|
33446
|
-
/* @__PURE__ */ (0,
|
33753
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
|
33447
33754
|
] }) }),
|
33448
|
-
/* @__PURE__ */ (0,
|
33449
|
-
isLoading && /* @__PURE__ */ (0,
|
33755
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("content"), children }),
|
33756
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_spinners5.ClipLoader, {}) })
|
33450
33757
|
] });
|
33451
33758
|
};
|
33452
33759
|
|
@@ -33455,11 +33762,11 @@ init_react_import();
|
|
33455
33762
|
|
33456
33763
|
// lib/use-puck-history.ts
|
33457
33764
|
init_react_import();
|
33458
|
-
var
|
33765
|
+
var import_react37 = require("react");
|
33459
33766
|
|
33460
33767
|
// lib/use-action-history.ts
|
33461
33768
|
init_react_import();
|
33462
|
-
var
|
33769
|
+
var import_react36 = require("react");
|
33463
33770
|
|
33464
33771
|
// lib/generate-id.ts
|
33465
33772
|
init_react_import();
|
@@ -33469,8 +33776,8 @@ var generateId = (type) => `${type}-${(0, import_crypto.randomBytes)(20).toStrin
|
|
33469
33776
|
// lib/use-action-history.ts
|
33470
33777
|
var EMPTY_HISTORY_INDEX = -1;
|
33471
33778
|
function useActionHistory() {
|
33472
|
-
const [histories, setHistories] = (0,
|
33473
|
-
const [currentHistoryIndex, setCurrentHistoryIndex] = (0,
|
33779
|
+
const [histories, setHistories] = (0, import_react36.useState)([]);
|
33780
|
+
const [currentHistoryIndex, setCurrentHistoryIndex] = (0, import_react36.useState)(EMPTY_HISTORY_INDEX);
|
33474
33781
|
const currentHistory = histories[currentHistoryIndex];
|
33475
33782
|
const canRewind = currentHistoryIndex > EMPTY_HISTORY_INDEX;
|
33476
33783
|
const canForward = currentHistoryIndex < histories.length - 1;
|
@@ -33549,7 +33856,7 @@ function usePuckHistory({
|
|
33549
33856
|
dispatch
|
33550
33857
|
});
|
33551
33858
|
}, DEBOUNCE_TIME);
|
33552
|
-
(0,
|
33859
|
+
(0, import_react37.useEffect)(() => {
|
33553
33860
|
historyEmitter.on(RECORD_DIFF, handleRecordDiff);
|
33554
33861
|
return () => {
|
33555
33862
|
historyEmitter.off(RECORD_DIFF, handleRecordDiff);
|
@@ -33897,7 +34204,7 @@ init_react_import();
|
|
33897
34204
|
|
33898
34205
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
33899
34206
|
init_react_import();
|
33900
|
-
var
|
34207
|
+
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" };
|
33901
34208
|
|
33902
34209
|
// lib/scroll-into-view.ts
|
33903
34210
|
init_react_import();
|
@@ -33911,7 +34218,7 @@ var scrollIntoView = (el) => {
|
|
33911
34218
|
};
|
33912
34219
|
|
33913
34220
|
// components/LayerTree/index.tsx
|
33914
|
-
var
|
34221
|
+
var import_react38 = require("react");
|
33915
34222
|
|
33916
34223
|
// lib/find-zones-for-area.ts
|
33917
34224
|
init_react_import();
|
@@ -33937,9 +34244,9 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
33937
34244
|
};
|
33938
34245
|
|
33939
34246
|
// components/LayerTree/index.tsx
|
33940
|
-
var
|
33941
|
-
var
|
33942
|
-
var getClassNameLayer = get_class_name_factory_default("Layer",
|
34247
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
34248
|
+
var getClassName18 = get_class_name_factory_default("LayerTree", styles_module_default12);
|
34249
|
+
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default12);
|
33943
34250
|
var LayerTree = ({
|
33944
34251
|
data,
|
33945
34252
|
zoneContent,
|
@@ -33949,15 +34256,15 @@ var LayerTree = ({
|
|
33949
34256
|
label
|
33950
34257
|
}) => {
|
33951
34258
|
const zones = data.zones || {};
|
33952
|
-
const ctx = (0,
|
33953
|
-
return /* @__PURE__ */ (0,
|
33954
|
-
label && /* @__PURE__ */ (0,
|
33955
|
-
/* @__PURE__ */ (0,
|
34259
|
+
const ctx = (0, import_react38.useContext)(dropZoneContext);
|
34260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
34261
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: getClassName18("zoneTitle"), children: [
|
34262
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(layers_default, { size: "16" }) }),
|
33956
34263
|
" ",
|
33957
34264
|
label
|
33958
34265
|
] }),
|
33959
|
-
/* @__PURE__ */ (0,
|
33960
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
34266
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("ul", { className: getClassName18(), children: [
|
34267
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("helper"), children: "No items" }),
|
33961
34268
|
zoneContent.map((item, i) => {
|
33962
34269
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
33963
34270
|
const zonesForItem = findZonesForArea(data, item.props.id);
|
@@ -33972,7 +34279,7 @@ var LayerTree = ({
|
|
33972
34279
|
const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
|
33973
34280
|
const isHovering = hoveringComponent === item.props.id;
|
33974
34281
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
33975
|
-
return /* @__PURE__ */ (0,
|
34282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
33976
34283
|
"li",
|
33977
34284
|
{
|
33978
34285
|
className: getClassNameLayer({
|
@@ -33982,7 +34289,7 @@ var LayerTree = ({
|
|
33982
34289
|
childIsSelected
|
33983
34290
|
}),
|
33984
34291
|
children: [
|
33985
|
-
/* @__PURE__ */ (0,
|
34292
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
33986
34293
|
"div",
|
33987
34294
|
{
|
33988
34295
|
className: getClassNameLayer("clickable"),
|
@@ -34013,22 +34320,22 @@ var LayerTree = ({
|
|
34013
34320
|
setHoveringComponent(null);
|
34014
34321
|
},
|
34015
34322
|
children: [
|
34016
|
-
containsZone && /* @__PURE__ */ (0,
|
34323
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34017
34324
|
"div",
|
34018
34325
|
{
|
34019
34326
|
className: getClassNameLayer("chevron"),
|
34020
34327
|
title: isSelected ? "Collapse" : "Expand",
|
34021
|
-
children: /* @__PURE__ */ (0,
|
34328
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(chevron_down_default, { size: "12" })
|
34022
34329
|
}
|
34023
34330
|
),
|
34024
|
-
/* @__PURE__ */ (0,
|
34025
|
-
/* @__PURE__ */ (0,
|
34026
|
-
/* @__PURE__ */ (0,
|
34331
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
34332
|
+
/* @__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" }) }),
|
34333
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameLayer("name"), children: item.type })
|
34027
34334
|
] })
|
34028
34335
|
]
|
34029
34336
|
}
|
34030
34337
|
) }),
|
34031
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
34338
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34032
34339
|
LayerTree,
|
34033
34340
|
{
|
34034
34341
|
data,
|
@@ -34074,11 +34381,11 @@ var flushZones = (appState) => {
|
|
34074
34381
|
|
34075
34382
|
// lib/use-component-list.tsx
|
34076
34383
|
init_react_import();
|
34077
|
-
var
|
34078
|
-
var
|
34384
|
+
var import_react39 = require("react");
|
34385
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
34079
34386
|
var useComponentList = (config, ui) => {
|
34080
|
-
const [componentList, setComponentList] = (0,
|
34081
|
-
(0,
|
34387
|
+
const [componentList, setComponentList] = (0, import_react39.useState)();
|
34388
|
+
(0, import_react39.useEffect)(() => {
|
34082
34389
|
var _a, _b, _c;
|
34083
34390
|
if (Object.keys(ui.componentList).length > 0) {
|
34084
34391
|
const matchedComponents = [];
|
@@ -34088,14 +34395,14 @@ var useComponentList = (config, ui) => {
|
|
34088
34395
|
if (category.visible === false || !category.components) {
|
34089
34396
|
return null;
|
34090
34397
|
}
|
34091
|
-
return /* @__PURE__ */ (0,
|
34398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34092
34399
|
ComponentList,
|
34093
34400
|
{
|
34094
34401
|
id: categoryKey,
|
34095
34402
|
title: category.title || categoryKey,
|
34096
34403
|
children: category.components.map((componentName, i) => {
|
34097
34404
|
matchedComponents.push(componentName);
|
34098
|
-
return /* @__PURE__ */ (0,
|
34405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34099
34406
|
ComponentList.Item,
|
34100
34407
|
{
|
34101
34408
|
component: componentName,
|
@@ -34115,13 +34422,13 @@ var useComponentList = (config, ui) => {
|
|
34115
34422
|
);
|
34116
34423
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
34117
34424
|
_componentList.push(
|
34118
|
-
/* @__PURE__ */ (0,
|
34425
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34119
34426
|
ComponentList,
|
34120
34427
|
{
|
34121
34428
|
id: "other",
|
34122
34429
|
title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
|
34123
34430
|
children: remainingComponents.map((componentName, i) => {
|
34124
|
-
return /* @__PURE__ */ (0,
|
34431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34125
34432
|
ComponentList.Item,
|
34126
34433
|
{
|
34127
34434
|
component: componentName,
|
@@ -34144,7 +34451,7 @@ var useComponentList = (config, ui) => {
|
|
34144
34451
|
|
34145
34452
|
// lib/use-resolved-data.ts
|
34146
34453
|
init_react_import();
|
34147
|
-
var
|
34454
|
+
var import_react40 = require("react");
|
34148
34455
|
|
34149
34456
|
// lib/resolve-component-data.ts
|
34150
34457
|
init_react_import();
|
@@ -34259,13 +34566,13 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
|
|
34259
34566
|
|
34260
34567
|
// lib/use-resolved-data.ts
|
34261
34568
|
var useResolvedData = (appState, config, dispatch) => {
|
34262
|
-
const [{ resolverKey, newAppState }, setResolverState] = (0,
|
34569
|
+
const [{ resolverKey, newAppState }, setResolverState] = (0, import_react40.useState)({
|
34263
34570
|
resolverKey: 0,
|
34264
34571
|
newAppState: appState
|
34265
34572
|
});
|
34266
|
-
const [componentState, setComponentState] = (0,
|
34573
|
+
const [componentState, setComponentState] = (0, import_react40.useState)({});
|
34267
34574
|
const deferredSetStates = {};
|
34268
|
-
const setComponentLoading = (0,
|
34575
|
+
const setComponentLoading = (0, import_react40.useCallback)(
|
34269
34576
|
(id, loading, defer = 0) => {
|
34270
34577
|
if (deferredSetStates[id]) {
|
34271
34578
|
clearTimeout(deferredSetStates[id]);
|
@@ -34296,7 +34603,7 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
34296
34603
|
type: "set",
|
34297
34604
|
state: (prev) => __spreadProps(__spreadValues({}, prev), {
|
34298
34605
|
data: applyDynamicProps(prev.data, dynamicDataMap, dynamicRoot),
|
34299
|
-
ui: __spreadValues(__spreadValues({}, prev.ui), newAppState.ui)
|
34606
|
+
ui: resolverKey > 0 ? __spreadValues(__spreadValues({}, prev.ui), newAppState.ui) : prev.ui
|
34300
34607
|
}),
|
34301
34608
|
recordHistory: resolverKey > 0
|
34302
34609
|
});
|
@@ -34332,10 +34639,10 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
34332
34639
|
});
|
34333
34640
|
yield Promise.all(promises);
|
34334
34641
|
});
|
34335
|
-
(0,
|
34642
|
+
(0, import_react40.useEffect)(() => {
|
34336
34643
|
runResolvers();
|
34337
34644
|
}, [resolverKey]);
|
34338
|
-
const resolveData = (0,
|
34645
|
+
const resolveData = (0, import_react40.useCallback)((newAppState2 = appState) => {
|
34339
34646
|
setResolverState((curr) => ({
|
34340
34647
|
resolverKey: curr.resolverKey + 1,
|
34341
34648
|
newAppState: newAppState2
|
@@ -34352,11 +34659,11 @@ init_react_import();
|
|
34352
34659
|
|
34353
34660
|
// css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
|
34354
34661
|
init_react_import();
|
34355
|
-
var
|
34662
|
+
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" };
|
34356
34663
|
|
34357
34664
|
// components/MenuBar/index.tsx
|
34358
|
-
var
|
34359
|
-
var
|
34665
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
34666
|
+
var getClassName19 = get_class_name_factory_default("MenuBar", styles_module_default13);
|
34360
34667
|
var MenuBar = ({
|
34361
34668
|
appState,
|
34362
34669
|
data = { content: [], root: { props: { title: "" } } },
|
@@ -34370,10 +34677,10 @@ var MenuBar = ({
|
|
34370
34677
|
appState,
|
34371
34678
|
dispatch
|
34372
34679
|
});
|
34373
|
-
return /* @__PURE__ */ (0,
|
34680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34374
34681
|
"div",
|
34375
34682
|
{
|
34376
|
-
className:
|
34683
|
+
className: getClassName19({ menuOpen }),
|
34377
34684
|
onClick: (event) => {
|
34378
34685
|
var _a;
|
34379
34686
|
const element = event.target;
|
@@ -34384,16 +34691,16 @@ var MenuBar = ({
|
|
34384
34691
|
setMenuOpen(false);
|
34385
34692
|
}
|
34386
34693
|
},
|
34387
|
-
children: /* @__PURE__ */ (0,
|
34388
|
-
/* @__PURE__ */ (0,
|
34389
|
-
/* @__PURE__ */ (0,
|
34694
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName19("inner"), children: [
|
34695
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName19("history"), children: [
|
34696
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IconButton, { title: "undo", disabled: !canRewind, onClick: rewind, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34390
34697
|
chevron_left_default,
|
34391
34698
|
{
|
34392
34699
|
size: 21,
|
34393
34700
|
stroke: canRewind ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
|
34394
34701
|
}
|
34395
34702
|
) }),
|
34396
|
-
/* @__PURE__ */ (0,
|
34703
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IconButton, { title: "redo", disabled: !canForward, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34397
34704
|
chevron_right_default,
|
34398
34705
|
{
|
34399
34706
|
size: 21,
|
@@ -34401,17 +34708,17 @@ var MenuBar = ({
|
|
34401
34708
|
}
|
34402
34709
|
) })
|
34403
34710
|
] }),
|
34404
|
-
/* @__PURE__ */ (0,
|
34711
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
34405
34712
|
state: appState,
|
34406
34713
|
dispatch
|
34407
34714
|
}) }),
|
34408
|
-
/* @__PURE__ */ (0,
|
34715
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34409
34716
|
Button,
|
34410
34717
|
{
|
34411
34718
|
onClick: () => {
|
34412
34719
|
onPublish(data);
|
34413
34720
|
},
|
34414
|
-
icon: /* @__PURE__ */ (0,
|
34721
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(globe_default, { size: "14px" }),
|
34415
34722
|
children: "Publish"
|
34416
34723
|
}
|
34417
34724
|
) })
|
@@ -34422,11 +34729,11 @@ var MenuBar = ({
|
|
34422
34729
|
|
34423
34730
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
34424
34731
|
init_react_import();
|
34425
|
-
var
|
34732
|
+
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" };
|
34426
34733
|
|
34427
34734
|
// components/Puck/index.tsx
|
34428
|
-
var
|
34429
|
-
var
|
34735
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
34736
|
+
var getClassName20 = get_class_name_factory_default("Puck", styles_module_default14);
|
34430
34737
|
var defaultPageFields = {
|
34431
34738
|
title: { type: "text" }
|
34432
34739
|
};
|
@@ -34438,7 +34745,7 @@ var PluginRenderer = ({
|
|
34438
34745
|
renderMethod
|
34439
34746
|
}) => {
|
34440
34747
|
return plugins.filter((item) => item[renderMethod]).map((item) => item[renderMethod]).reduce(
|
34441
|
-
(accChildren, Item) => /* @__PURE__ */ (0,
|
34748
|
+
(accChildren, Item) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Item, { dispatch, state, children: accChildren }),
|
34442
34749
|
children
|
34443
34750
|
);
|
34444
34751
|
};
|
@@ -34455,8 +34762,8 @@ function Puck({
|
|
34455
34762
|
headerPath
|
34456
34763
|
}) {
|
34457
34764
|
var _a, _b;
|
34458
|
-
const [reducer] = (0,
|
34459
|
-
const [initialAppState] = (0,
|
34765
|
+
const [reducer] = (0, import_react41.useState)(() => createReducer({ config }));
|
34766
|
+
const [initialAppState] = (0, import_react41.useState)(() => __spreadProps(__spreadValues({}, defaultAppState), {
|
34460
34767
|
data: initialData,
|
34461
34768
|
ui: __spreadProps(__spreadValues({}, defaultAppState.ui), {
|
34462
34769
|
// Store categories under componentList on state to allow render functions and plugins to modify
|
@@ -34475,7 +34782,7 @@ function Puck({
|
|
34475
34782
|
) : {}
|
34476
34783
|
})
|
34477
34784
|
}));
|
34478
|
-
const [appState, dispatch] = (0,
|
34785
|
+
const [appState, dispatch] = (0, import_react41.useReducer)(
|
34479
34786
|
reducer,
|
34480
34787
|
flushZones(initialAppState)
|
34481
34788
|
);
|
@@ -34485,9 +34792,9 @@ function Puck({
|
|
34485
34792
|
config,
|
34486
34793
|
dispatch
|
34487
34794
|
);
|
34488
|
-
const [menuOpen, setMenuOpen] = (0,
|
34795
|
+
const [menuOpen, setMenuOpen] = (0, import_react41.useState)(false);
|
34489
34796
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
34490
|
-
const setItemSelector = (0,
|
34797
|
+
const setItemSelector = (0, import_react41.useCallback)(
|
34491
34798
|
(newItemSelector) => {
|
34492
34799
|
dispatch({
|
34493
34800
|
type: "setUi",
|
@@ -34497,10 +34804,10 @@ function Puck({
|
|
34497
34804
|
[]
|
34498
34805
|
);
|
34499
34806
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
34500
|
-
const Page = (0,
|
34807
|
+
const Page = (0, import_react41.useCallback)(
|
34501
34808
|
(pageProps) => {
|
34502
34809
|
var _a2, _b2;
|
34503
|
-
return /* @__PURE__ */ (0,
|
34810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34504
34811
|
PluginRenderer,
|
34505
34812
|
{
|
34506
34813
|
plugins,
|
@@ -34513,8 +34820,8 @@ function Puck({
|
|
34513
34820
|
},
|
34514
34821
|
[config.root]
|
34515
34822
|
);
|
34516
|
-
const PageFieldWrapper = (0,
|
34517
|
-
(props) => /* @__PURE__ */ (0,
|
34823
|
+
const PageFieldWrapper = (0, import_react41.useCallback)(
|
34824
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34518
34825
|
PluginRenderer,
|
34519
34826
|
{
|
34520
34827
|
plugins,
|
@@ -34526,8 +34833,8 @@ function Puck({
|
|
34526
34833
|
),
|
34527
34834
|
[]
|
34528
34835
|
);
|
34529
|
-
const ComponentFieldWrapper = (0,
|
34530
|
-
(props) => /* @__PURE__ */ (0,
|
34836
|
+
const ComponentFieldWrapper = (0, import_react41.useCallback)(
|
34837
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34531
34838
|
PluginRenderer,
|
34532
34839
|
{
|
34533
34840
|
plugins,
|
@@ -34539,8 +34846,8 @@ function Puck({
|
|
34539
34846
|
),
|
34540
34847
|
[]
|
34541
34848
|
);
|
34542
|
-
const ComponentListWrapper = (0,
|
34543
|
-
const children = /* @__PURE__ */ (0,
|
34849
|
+
const ComponentListWrapper = (0, import_react41.useCallback)((props) => {
|
34850
|
+
const children = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34544
34851
|
PluginRenderer,
|
34545
34852
|
{
|
34546
34853
|
plugins,
|
@@ -34559,22 +34866,22 @@ function Puck({
|
|
34559
34866
|
const FieldWrapper = itemSelector ? ComponentFieldWrapper : PageFieldWrapper;
|
34560
34867
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
34561
34868
|
let fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
|
34562
|
-
(0,
|
34869
|
+
(0, import_react41.useEffect)(() => {
|
34563
34870
|
if (onChange)
|
34564
34871
|
onChange(data);
|
34565
34872
|
}, [data]);
|
34566
34873
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
34567
|
-
const [draggedItem, setDraggedItem] = (0,
|
34874
|
+
const [draggedItem, setDraggedItem] = (0, import_react41.useState)();
|
34568
34875
|
const componentList = useComponentList(config, appState.ui);
|
34569
34876
|
const rootProps = data.root.props || data.root;
|
34570
|
-
(0,
|
34877
|
+
(0, import_react41.useEffect)(() => {
|
34571
34878
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
34572
34879
|
console.error(
|
34573
34880
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
34574
34881
|
);
|
34575
34882
|
}
|
34576
34883
|
}, []);
|
34577
|
-
const toggleSidebars = (0,
|
34884
|
+
const toggleSidebars = (0, import_react41.useCallback)(
|
34578
34885
|
(sidebar) => {
|
34579
34886
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
34580
34887
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -34588,7 +34895,7 @@ function Puck({
|
|
34588
34895
|
},
|
34589
34896
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
34590
34897
|
);
|
34591
|
-
(0,
|
34898
|
+
(0, import_react41.useEffect)(() => {
|
34592
34899
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
34593
34900
|
dispatch({
|
34594
34901
|
type: "setUi",
|
@@ -34611,12 +34918,12 @@ function Puck({
|
|
34611
34918
|
window.removeEventListener("resize", handleResize);
|
34612
34919
|
};
|
34613
34920
|
}, []);
|
34614
|
-
return /* @__PURE__ */ (0,
|
34615
|
-
/* @__PURE__ */ (0,
|
34921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
|
34922
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34616
34923
|
AppProvider,
|
34617
34924
|
{
|
34618
34925
|
value: { state: appState, dispatch, config, componentState },
|
34619
|
-
children: /* @__PURE__ */ (0,
|
34926
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34620
34927
|
import_dnd7.DragDropContext,
|
34621
34928
|
{
|
34622
34929
|
onDragUpdate: (update) => {
|
@@ -34633,10 +34940,10 @@ function Puck({
|
|
34633
34940
|
return;
|
34634
34941
|
}
|
34635
34942
|
if (droppedItem.source.droppableId.startsWith("component-list") && droppedItem.destination) {
|
34636
|
-
const [_,
|
34943
|
+
const [_, componentType] = droppedItem.draggableId.split("::");
|
34637
34944
|
dispatch({
|
34638
34945
|
type: "insert",
|
34639
|
-
componentType:
|
34946
|
+
componentType: componentType || droppedItem.draggableId,
|
34640
34947
|
destinationIndex: droppedItem.destination.index,
|
34641
34948
|
destinationZone: droppedItem.destination.droppableId
|
34642
34949
|
});
|
@@ -34669,7 +34976,7 @@ function Puck({
|
|
34669
34976
|
});
|
34670
34977
|
}
|
34671
34978
|
},
|
34672
|
-
children: /* @__PURE__ */ (0,
|
34979
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34673
34980
|
DropZoneProvider,
|
34674
34981
|
{
|
34675
34982
|
value: {
|
@@ -34683,72 +34990,72 @@ function Puck({
|
|
34683
34990
|
mode: "edit",
|
34684
34991
|
areaId: "root"
|
34685
34992
|
},
|
34686
|
-
children: /* @__PURE__ */ (0,
|
34993
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(dropZoneContext.Consumer, { children: (ctx) => {
|
34687
34994
|
var _a2, _b2;
|
34688
|
-
return /* @__PURE__ */ (0,
|
34995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
34689
34996
|
"div",
|
34690
34997
|
{
|
34691
|
-
className:
|
34998
|
+
className: getClassName20({
|
34692
34999
|
leftSideBarVisible,
|
34693
35000
|
menuOpen,
|
34694
35001
|
rightSideBarVisible
|
34695
35002
|
}),
|
34696
35003
|
children: [
|
34697
|
-
/* @__PURE__ */ (0,
|
34698
|
-
children: /* @__PURE__ */ (0,
|
35004
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("header", { className: getClassName20("header"), children: renderHeader ? renderHeader({
|
35005
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34699
35006
|
Button,
|
34700
35007
|
{
|
34701
35008
|
onClick: () => {
|
34702
35009
|
onPublish(data);
|
34703
35010
|
},
|
34704
|
-
icon: /* @__PURE__ */ (0,
|
35011
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(globe_default, { size: "14px" }),
|
34705
35012
|
children: "Publish"
|
34706
35013
|
}
|
34707
35014
|
),
|
34708
35015
|
dispatch,
|
34709
35016
|
state: appState
|
34710
|
-
}) : /* @__PURE__ */ (0,
|
34711
|
-
/* @__PURE__ */ (0,
|
34712
|
-
/* @__PURE__ */ (0,
|
35017
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName20("headerInner"), children: [
|
35018
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName20("headerToggle"), children: [
|
35019
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName20("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34713
35020
|
IconButton,
|
34714
35021
|
{
|
34715
35022
|
onClick: () => {
|
34716
35023
|
toggleSidebars("left");
|
34717
35024
|
},
|
34718
35025
|
title: "Toggle left sidebar",
|
34719
|
-
children: /* @__PURE__ */ (0,
|
35026
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(sidebar_default, { focusable: "false" })
|
34720
35027
|
}
|
34721
35028
|
) }),
|
34722
|
-
/* @__PURE__ */ (0,
|
35029
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName20("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34723
35030
|
IconButton,
|
34724
35031
|
{
|
34725
35032
|
onClick: () => {
|
34726
35033
|
toggleSidebars("right");
|
34727
35034
|
},
|
34728
35035
|
title: "Toggle right sidebar",
|
34729
|
-
children: /* @__PURE__ */ (0,
|
35036
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(sidebar_default, { focusable: "false" })
|
34730
35037
|
}
|
34731
35038
|
) })
|
34732
35039
|
] }),
|
34733
|
-
/* @__PURE__ */ (0,
|
35040
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName20("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
34734
35041
|
headerTitle || rootProps.title || "Page",
|
34735
|
-
headerPath && /* @__PURE__ */ (0,
|
35042
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
34736
35043
|
" ",
|
34737
|
-
/* @__PURE__ */ (0,
|
35044
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { className: getClassName20("headerPath"), children: headerPath })
|
34738
35045
|
] })
|
34739
35046
|
] }) }),
|
34740
|
-
/* @__PURE__ */ (0,
|
34741
|
-
/* @__PURE__ */ (0,
|
35047
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName20("headerTools"), children: [
|
35048
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName20("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34742
35049
|
IconButton,
|
34743
35050
|
{
|
34744
35051
|
onClick: () => {
|
34745
35052
|
return setMenuOpen(!menuOpen);
|
34746
35053
|
},
|
34747
35054
|
title: "Toggle menu bar",
|
34748
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
35055
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(chevron_up_default, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(chevron_down_default, { focusable: "false" })
|
34749
35056
|
}
|
34750
35057
|
) }),
|
34751
|
-
/* @__PURE__ */ (0,
|
35058
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34752
35059
|
MenuBar,
|
34753
35060
|
{
|
34754
35061
|
appState,
|
@@ -34762,10 +35069,10 @@ function Puck({
|
|
34762
35069
|
)
|
34763
35070
|
] })
|
34764
35071
|
] }) }),
|
34765
|
-
/* @__PURE__ */ (0,
|
34766
|
-
/* @__PURE__ */ (0,
|
34767
|
-
/* @__PURE__ */ (0,
|
34768
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0,
|
35072
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName20("leftSideBar"), children: [
|
35073
|
+
/* @__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" }) }) }),
|
35074
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(SidebarSection, { title: "Outline", children: [
|
35075
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34769
35076
|
LayerTree,
|
34770
35077
|
{
|
34771
35078
|
data,
|
@@ -34777,7 +35084,7 @@ function Puck({
|
|
34777
35084
|
),
|
34778
35085
|
Object.entries(findZonesForArea(data, "root")).map(
|
34779
35086
|
([zoneKey, zone]) => {
|
34780
|
-
return /* @__PURE__ */ (0,
|
35087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34781
35088
|
LayerTree,
|
34782
35089
|
{
|
34783
35090
|
data,
|
@@ -34793,23 +35100,23 @@ function Puck({
|
|
34793
35100
|
)
|
34794
35101
|
] })
|
34795
35102
|
] }),
|
34796
|
-
/* @__PURE__ */ (0,
|
35103
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
34797
35104
|
"div",
|
34798
35105
|
{
|
34799
|
-
className:
|
35106
|
+
className: getClassName20("frame"),
|
34800
35107
|
onClick: () => setItemSelector(null),
|
34801
35108
|
id: "puck-frame",
|
34802
35109
|
children: [
|
34803
|
-
/* @__PURE__ */ (0,
|
35110
|
+
/* @__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)(
|
34804
35111
|
Page,
|
34805
35112
|
__spreadProps(__spreadValues({
|
34806
35113
|
dispatch,
|
34807
35114
|
state: appState
|
34808
35115
|
}, rootProps), {
|
34809
|
-
children: /* @__PURE__ */ (0,
|
35116
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZone, { zone: rootDroppableId })
|
34810
35117
|
})
|
34811
35118
|
) }) }),
|
34812
|
-
/* @__PURE__ */ (0,
|
35119
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34813
35120
|
"div",
|
34814
35121
|
{
|
34815
35122
|
style: {
|
@@ -34822,7 +35129,7 @@ function Puck({
|
|
34822
35129
|
]
|
34823
35130
|
}
|
34824
35131
|
),
|
34825
|
-
/* @__PURE__ */ (0,
|
35132
|
+
/* @__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)(
|
34826
35133
|
SidebarSection,
|
34827
35134
|
{
|
34828
35135
|
noPadding: true,
|
@@ -34900,7 +35207,7 @@ function Puck({
|
|
34900
35207
|
};
|
34901
35208
|
if (selectedItem && itemSelector) {
|
34902
35209
|
const { readOnly = {} } = selectedItem;
|
34903
|
-
return /* @__PURE__ */ (0,
|
35210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34904
35211
|
InputOrGroup,
|
34905
35212
|
{
|
34906
35213
|
field,
|
@@ -34916,7 +35223,7 @@ function Puck({
|
|
34916
35223
|
);
|
34917
35224
|
} else {
|
34918
35225
|
const { readOnly = {} } = data.root;
|
34919
|
-
return /* @__PURE__ */ (0,
|
35226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34920
35227
|
InputOrGroup,
|
34921
35228
|
{
|
34922
35229
|
field,
|
@@ -34944,19 +35251,22 @@ function Puck({
|
|
34944
35251
|
)
|
34945
35252
|
}
|
34946
35253
|
),
|
34947
|
-
/* @__PURE__ */ (0,
|
35254
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { id: "puck-portal-root" })
|
34948
35255
|
] });
|
34949
35256
|
}
|
34950
35257
|
|
34951
35258
|
// components/Render/index.tsx
|
34952
35259
|
init_react_import();
|
34953
|
-
var
|
34954
|
-
function Render({
|
35260
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
35261
|
+
function Render({
|
35262
|
+
config,
|
35263
|
+
data
|
35264
|
+
}) {
|
34955
35265
|
var _a;
|
34956
35266
|
const rootProps = data.root.props || data.root;
|
34957
|
-
const title = rootProps.title || "";
|
35267
|
+
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
34958
35268
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
34959
|
-
return /* @__PURE__ */ (0,
|
35269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
34960
35270
|
config.root.render,
|
34961
35271
|
__spreadProps(__spreadValues({}, rootProps), {
|
34962
35272
|
puck: {
|
@@ -34965,11 +35275,67 @@ function Render({ config, data }) {
|
|
34965
35275
|
title,
|
34966
35276
|
editMode: false,
|
34967
35277
|
id: "puck-root",
|
34968
|
-
children: /* @__PURE__ */ (0,
|
35278
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZone, { zone: rootDroppableId })
|
34969
35279
|
})
|
34970
35280
|
) });
|
34971
35281
|
}
|
34972
|
-
return /* @__PURE__ */ (0,
|
35282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZone, { zone: rootDroppableId }) });
|
35283
|
+
}
|
35284
|
+
|
35285
|
+
// lib/migrate.ts
|
35286
|
+
init_react_import();
|
35287
|
+
var migrations = [
|
35288
|
+
// Migrate root to root.props
|
35289
|
+
(data) => {
|
35290
|
+
const rootProps = data.root.props || data.root;
|
35291
|
+
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
35292
|
+
console.warn(
|
35293
|
+
"Migration applied: Root props moved from `root` to `root.props`."
|
35294
|
+
);
|
35295
|
+
return __spreadProps(__spreadValues({}, data), {
|
35296
|
+
root: {
|
35297
|
+
props: __spreadValues({}, rootProps)
|
35298
|
+
}
|
35299
|
+
});
|
35300
|
+
}
|
35301
|
+
return data;
|
35302
|
+
}
|
35303
|
+
];
|
35304
|
+
function migrate(data) {
|
35305
|
+
return migrations == null ? void 0 : migrations.reduce((acc, migration) => migration(acc), data);
|
35306
|
+
}
|
35307
|
+
|
35308
|
+
// lib/transform-props.ts
|
35309
|
+
init_react_import();
|
35310
|
+
function transformProps(data, propTransforms) {
|
35311
|
+
const mapItem = (item) => {
|
35312
|
+
if (propTransforms[item.type]) {
|
35313
|
+
return __spreadProps(__spreadValues({}, item), {
|
35314
|
+
props: propTransforms[item.type](item.props)
|
35315
|
+
});
|
35316
|
+
}
|
35317
|
+
return item;
|
35318
|
+
};
|
35319
|
+
const rootProps = data.root.props || data.root;
|
35320
|
+
let newRoot = __spreadValues({}, data.root);
|
35321
|
+
if (propTransforms["root"]) {
|
35322
|
+
if (data.root.props) {
|
35323
|
+
newRoot.props = propTransforms["root"](rootProps);
|
35324
|
+
} else {
|
35325
|
+
newRoot = propTransforms["root"](rootProps);
|
35326
|
+
}
|
35327
|
+
}
|
35328
|
+
const afterPropTransforms = __spreadProps(__spreadValues({}, data), {
|
35329
|
+
root: newRoot,
|
35330
|
+
content: data.content.map(mapItem),
|
35331
|
+
zones: Object.keys(data.zones || {}).reduce(
|
35332
|
+
(acc, zoneKey) => __spreadProps(__spreadValues({}, acc), {
|
35333
|
+
[zoneKey]: data.zones[zoneKey].map(mapItem)
|
35334
|
+
}),
|
35335
|
+
{}
|
35336
|
+
)
|
35337
|
+
});
|
35338
|
+
return afterPropTransforms;
|
34973
35339
|
}
|
34974
35340
|
|
34975
35341
|
// lib/resolve-all-data.ts
|
@@ -35009,7 +35375,9 @@ var resolveAllData = (data, config, onResolveStart, onResolveEnd) => __async(voi
|
|
35009
35375
|
Puck,
|
35010
35376
|
Render,
|
35011
35377
|
dropZoneContext,
|
35012
|
-
|
35378
|
+
migrate,
|
35379
|
+
resolveAllData,
|
35380
|
+
transformProps
|
35013
35381
|
});
|
35014
35382
|
/*! Bundled license information:
|
35015
35383
|
|