@measured/puck 0.12.0-canary.2e931bc → 0.12.0-canary.349f44d
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/README.md +20 -486
- package/dist/{Config-60a50493.d.ts → Config-e71a51c7.d.ts} +2 -0
- package/dist/index.css +390 -158
- package/dist/index.d.ts +4 -4
- package/dist/index.js +514 -518
- package/dist/rsc.d.ts +1 -1
- package/package.json +22 -1
package/dist/index.js
CHANGED
@@ -327,7 +327,7 @@ var require_react_is_development = __commonJS({
|
|
327
327
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
328
328
|
var Element = REACT_ELEMENT_TYPE;
|
329
329
|
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
330
|
-
var
|
330
|
+
var Fragment14 = REACT_FRAGMENT_TYPE;
|
331
331
|
var Lazy = REACT_LAZY_TYPE;
|
332
332
|
var Memo = REACT_MEMO_TYPE;
|
333
333
|
var Portal = REACT_PORTAL_TYPE;
|
@@ -386,7 +386,7 @@ var require_react_is_development = __commonJS({
|
|
386
386
|
exports.ContextProvider = ContextProvider;
|
387
387
|
exports.Element = Element;
|
388
388
|
exports.ForwardRef = ForwardRef;
|
389
|
-
exports.Fragment =
|
389
|
+
exports.Fragment = Fragment14;
|
390
390
|
exports.Lazy = Lazy;
|
391
391
|
exports.Memo = Memo;
|
392
392
|
exports.Portal = Portal;
|
@@ -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 = getClassName20(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 getClassName20(propValue) {
|
1016
1016
|
if (!propValue.constructor || !propValue.constructor.name) {
|
1017
1017
|
return ANONYMOUS;
|
1018
1018
|
}
|
@@ -9040,7 +9040,7 @@ var require_react_dom_development = __commonJS({
|
|
9040
9040
|
var HostPortal = 4;
|
9041
9041
|
var HostComponent = 5;
|
9042
9042
|
var HostText = 6;
|
9043
|
-
var
|
9043
|
+
var Fragment14 = 7;
|
9044
9044
|
var Mode = 8;
|
9045
9045
|
var ContextConsumer = 9;
|
9046
9046
|
var ContextProvider = 10;
|
@@ -10196,7 +10196,7 @@ var require_react_dom_development = __commonJS({
|
|
10196
10196
|
return "DehydratedFragment";
|
10197
10197
|
case ForwardRef:
|
10198
10198
|
return getWrappedName$1(type, type.render, "ForwardRef");
|
10199
|
-
case
|
10199
|
+
case Fragment14:
|
10200
10200
|
return "Fragment";
|
10201
10201
|
case HostComponent:
|
10202
10202
|
return type;
|
@@ -14313,7 +14313,7 @@ var require_react_dom_development = __commonJS({
|
|
14313
14313
|
defaultPrevented: 0,
|
14314
14314
|
isTrusted: 0
|
14315
14315
|
};
|
14316
|
-
var
|
14316
|
+
var SyntheticEvent3 = createSyntheticEvent(EventInterface);
|
14317
14317
|
var UIEventInterface = assign({}, EventInterface, {
|
14318
14318
|
view: 0,
|
14319
14319
|
detail: 0
|
@@ -14789,7 +14789,7 @@ var require_react_dom_development = __commonJS({
|
|
14789
14789
|
enqueueStateRestore(target);
|
14790
14790
|
var listeners = accumulateTwoPhaseListeners(inst, "onChange");
|
14791
14791
|
if (listeners.length > 0) {
|
14792
|
-
var event = new
|
14792
|
+
var event = new SyntheticEvent3("onChange", "change", null, nativeEvent, target);
|
14793
14793
|
dispatchQueue.push({
|
14794
14794
|
event,
|
14795
14795
|
listeners
|
@@ -15293,7 +15293,7 @@ var require_react_dom_development = __commonJS({
|
|
15293
15293
|
lastSelection = currentSelection;
|
15294
15294
|
var listeners = accumulateTwoPhaseListeners(activeElementInst$1, "onSelect");
|
15295
15295
|
if (listeners.length > 0) {
|
15296
|
-
var event = new
|
15296
|
+
var event = new SyntheticEvent3("onSelect", "select", null, nativeEvent, nativeEventTarget);
|
15297
15297
|
dispatchQueue.push({
|
15298
15298
|
event,
|
15299
15299
|
listeners
|
@@ -15405,7 +15405,7 @@ var require_react_dom_development = __commonJS({
|
|
15405
15405
|
if (reactName === void 0) {
|
15406
15406
|
return;
|
15407
15407
|
}
|
15408
|
-
var SyntheticEventCtor =
|
15408
|
+
var SyntheticEventCtor = SyntheticEvent3;
|
15409
15409
|
var reactEventType = domEventName;
|
15410
15410
|
switch (domEventName) {
|
15411
15411
|
case "keypress":
|
@@ -19867,7 +19867,7 @@ var require_react_dom_development = __commonJS({
|
|
19867
19867
|
}
|
19868
19868
|
}
|
19869
19869
|
function updateFragment2(returnFiber, current2, fragment, lanes, key) {
|
19870
|
-
if (current2 === null || current2.tag !==
|
19870
|
+
if (current2 === null || current2.tag !== Fragment14) {
|
19871
19871
|
var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
|
19872
19872
|
created.return = returnFiber;
|
19873
19873
|
return created;
|
@@ -20270,7 +20270,7 @@ var require_react_dom_development = __commonJS({
|
|
20270
20270
|
if (child.key === key) {
|
20271
20271
|
var elementType = element.type;
|
20272
20272
|
if (elementType === REACT_FRAGMENT_TYPE) {
|
20273
|
-
if (child.tag ===
|
20273
|
+
if (child.tag === Fragment14) {
|
20274
20274
|
deleteRemainingChildren(returnFiber, child.sibling);
|
20275
20275
|
var existing = useFiber(child, element.props.children);
|
20276
20276
|
existing.return = returnFiber;
|
@@ -24445,7 +24445,7 @@ var require_react_dom_development = __commonJS({
|
|
24445
24445
|
var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
24446
24446
|
return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
|
24447
24447
|
}
|
24448
|
-
case
|
24448
|
+
case Fragment14:
|
24449
24449
|
return updateFragment(current2, workInProgress2, renderLanes2);
|
24450
24450
|
case Mode:
|
24451
24451
|
return updateMode(current2, workInProgress2, renderLanes2);
|
@@ -24718,7 +24718,7 @@ var require_react_dom_development = __commonJS({
|
|
24718
24718
|
case SimpleMemoComponent:
|
24719
24719
|
case FunctionComponent:
|
24720
24720
|
case ForwardRef:
|
24721
|
-
case
|
24721
|
+
case Fragment14:
|
24722
24722
|
case Mode:
|
24723
24723
|
case Profiler:
|
24724
24724
|
case ContextConsumer:
|
@@ -28977,7 +28977,7 @@ var require_react_dom_development = __commonJS({
|
|
28977
28977
|
return fiber;
|
28978
28978
|
}
|
28979
28979
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
28980
|
-
var fiber = createFiber(
|
28980
|
+
var fiber = createFiber(Fragment14, elements, key, mode);
|
28981
28981
|
fiber.lanes = lanes;
|
28982
28982
|
return fiber;
|
28983
28983
|
}
|
@@ -30125,7 +30125,7 @@ var import_react2 = require("react");
|
|
30125
30125
|
|
30126
30126
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
|
30127
30127
|
init_react_import();
|
30128
|
-
var Button_module_default = { "Button": "
|
30128
|
+
var Button_module_default = { "Button": "_Button_1brfa_1", "Button--medium": "_Button--medium_1brfa_22", "Button--large": "_Button--large_1brfa_29", "Button-icon": "_Button-icon_1brfa_36", "Button--primary": "_Button--primary_1brfa_44", "Button--secondary": "_Button--secondary_1brfa_53", "Button--flush": "_Button--flush_1brfa_64", "Button--disabled": "_Button--disabled_1brfa_68", "Button--fullWidth": "_Button--fullWidth_1brfa_78" };
|
30129
30129
|
|
30130
30130
|
// lib/get-class-name-factory.ts
|
30131
30131
|
init_react_import();
|
@@ -31974,6 +31974,7 @@ var defaultAppState = {
|
|
31974
31974
|
data: { content: [], root: { title: "" } },
|
31975
31975
|
ui: {
|
31976
31976
|
leftSideBarVisible: true,
|
31977
|
+
rightSideBarVisible: true,
|
31977
31978
|
arrayState: {},
|
31978
31979
|
itemSelector: null,
|
31979
31980
|
componentList: {}
|
@@ -32301,7 +32302,7 @@ var import_react26 = require("react");
|
|
32301
32302
|
|
32302
32303
|
// css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
|
32303
32304
|
init_react_import();
|
32304
|
-
var IconButton_module_default = { "IconButton": "
|
32305
|
+
var IconButton_module_default = { "IconButton": "_IconButton_38xdr_1", "IconButton-title": "_IconButton-title_38xdr_18" };
|
32305
32306
|
|
32306
32307
|
// components/IconButton/IconButton.tsx
|
32307
32308
|
var import_react_spinners3 = require("react-spinners");
|
@@ -32346,10 +32347,11 @@ var IconButton = ({
|
|
32346
32347
|
href,
|
32347
32348
|
title,
|
32348
32349
|
children: [
|
32350
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: getClassName4("title"), children: title }),
|
32349
32351
|
children,
|
32350
32352
|
loading && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
32351
32353
|
"\xA0\xA0",
|
32352
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_spinners3.ClipLoader, { color: "inherit", size: "14px" })
|
32354
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
|
32353
32355
|
] })
|
32354
32356
|
]
|
32355
32357
|
}
|
@@ -32359,7 +32361,7 @@ var IconButton = ({
|
|
32359
32361
|
|
32360
32362
|
// components/Puck/index.tsx
|
32361
32363
|
init_react_import();
|
32362
|
-
var
|
32364
|
+
var import_react39 = require("react");
|
32363
32365
|
var import_dnd7 = require("@hello-pangea/dnd");
|
32364
32366
|
|
32365
32367
|
// components/InputOrGroup/index.tsx
|
@@ -32367,10 +32369,10 @@ init_react_import();
|
|
32367
32369
|
|
32368
32370
|
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css#css-module
|
32369
32371
|
init_react_import();
|
32370
|
-
var styles_module_default3 = { "Input": "
|
32372
|
+
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" };
|
32371
32373
|
|
32372
32374
|
// components/InputOrGroup/index.tsx
|
32373
|
-
var
|
32375
|
+
var import_react31 = require("react");
|
32374
32376
|
|
32375
32377
|
// components/InputOrGroup/fields/index.tsx
|
32376
32378
|
init_react_import();
|
@@ -32380,7 +32382,7 @@ init_react_import();
|
|
32380
32382
|
|
32381
32383
|
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ArrayField/styles.module.css#css-module
|
32382
32384
|
init_react_import();
|
32383
|
-
var styles_module_default4 = { "ArrayField": "
|
32385
|
+
var styles_module_default4 = { "ArrayField": "_ArrayField_1auyc_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1auyc_13", "ArrayField-addButton": "_ArrayField-addButton_1auyc_17", "ArrayField--hasItems": "_ArrayField--hasItems_1auyc_31", "ArrayFieldItem": "_ArrayFieldItem_1auyc_45", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1auyc_53", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1auyc_58", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1auyc_73", "ArrayFieldItem--readOnly": "_ArrayFieldItem--readOnly_1auyc_86", "ArrayFieldItem-body": "_ArrayFieldItem-body_1auyc_107", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1auyc_115", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1auyc_122", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1auyc_128", "ArrayFieldItem-action": "_ArrayFieldItem-action_1auyc_128" };
|
32384
32386
|
|
32385
32387
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
32386
32388
|
var import_dnd4 = require("@hello-pangea/dnd");
|
@@ -32469,30 +32471,37 @@ var ArrayField = ({
|
|
32469
32471
|
}) => {
|
32470
32472
|
const [arrayFieldId] = (0, import_react27.useState)(generateId("ArrayField"));
|
32471
32473
|
const { state, setUi } = useAppContext();
|
32472
|
-
const
|
32473
|
-
|
32474
|
-
|
32475
|
-
|
32476
|
-
}
|
32477
|
-
|
32478
|
-
|
32474
|
+
const arrayStateRef = (0, import_react27.useRef)(
|
32475
|
+
state.ui.arrayState[arrayFieldId] || {
|
32476
|
+
items: [],
|
32477
|
+
openId: ""
|
32478
|
+
}
|
32479
|
+
);
|
32480
|
+
const arrayState = arrayStateRef.current;
|
32479
32481
|
const setArrayState = (0, import_react27.useCallback)(
|
32480
|
-
(
|
32482
|
+
(partialArrayState, recordHistory = false) => {
|
32481
32483
|
setUi(
|
32482
32484
|
{
|
32483
32485
|
arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
|
32484
|
-
[arrayFieldId]: __spreadValues(__spreadValues({}, arrayState),
|
32486
|
+
[arrayFieldId]: __spreadValues(__spreadValues({}, arrayState), partialArrayState)
|
32485
32487
|
})
|
32486
32488
|
},
|
32487
32489
|
recordHistory
|
32488
32490
|
);
|
32491
|
+
arrayStateRef.current = __spreadValues(__spreadValues({}, arrayState), partialArrayState);
|
32489
32492
|
},
|
32490
32493
|
[arrayState]
|
32491
32494
|
);
|
32492
32495
|
(0, import_react27.useEffect)(() => {
|
32496
|
+
let highestIndex = arrayState.items.reduce(
|
32497
|
+
(acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
|
32498
|
+
-1
|
32499
|
+
);
|
32493
32500
|
const newItems = Array.from(value || []).map((item, idx) => {
|
32494
32501
|
var _a;
|
32502
|
+
const arrayStateItem = arrayState.items[idx];
|
32495
32503
|
return {
|
32504
|
+
_originalIndex: typeof (arrayStateItem == null ? void 0 : arrayStateItem._originalIndex) !== "undefined" ? arrayStateItem._originalIndex : ++highestIndex,
|
32496
32505
|
_arrayId: ((_a = arrayState.items[idx]) == null ? void 0 : _a._arrayId) || generateId("ArrayItem"),
|
32497
32506
|
data: item
|
32498
32507
|
};
|
@@ -32534,97 +32543,95 @@ var ArrayField = ({
|
|
32534
32543
|
hasItems: Array.isArray(value) && value.length > 0
|
32535
32544
|
}),
|
32536
32545
|
children: [
|
32537
|
-
|
32538
|
-
|
32539
|
-
|
32540
|
-
|
32541
|
-
|
32542
|
-
|
32543
|
-
|
32544
|
-
|
32545
|
-
|
32546
|
-
|
32547
|
-
|
32548
|
-
|
32549
|
-
|
32550
|
-
|
32551
|
-
|
32552
|
-
|
32553
|
-
|
32554
|
-
|
32555
|
-
|
32556
|
-
|
32557
|
-
|
32558
|
-
|
32559
|
-
|
32560
|
-
|
32561
|
-
|
32562
|
-
|
32563
|
-
|
32564
|
-
|
32565
|
-
|
32566
|
-
|
32567
|
-
|
32568
|
-
|
32569
|
-
{
|
32570
|
-
|
32571
|
-
|
32572
|
-
|
32573
|
-
|
32574
|
-
|
32575
|
-
|
32576
|
-
|
32577
|
-
|
32578
|
-
|
32579
|
-
|
32580
|
-
|
32581
|
-
|
32582
|
-
|
32583
|
-
|
32584
|
-
|
32585
|
-
|
32586
|
-
|
32587
|
-
|
32588
|
-
|
32589
|
-
|
32590
|
-
|
32591
|
-
|
32592
|
-
|
32593
|
-
|
32594
|
-
|
32595
|
-
|
32596
|
-
|
32597
|
-
|
32598
|
-
|
32599
|
-
|
32600
|
-
|
32601
|
-
|
32602
|
-
|
32603
|
-
|
32604
|
-
|
32605
|
-
|
32606
|
-
|
32607
|
-
|
32608
|
-
|
32609
|
-
|
32610
|
-
|
32611
|
-
|
32612
|
-
|
32613
|
-
|
32614
|
-
|
32615
|
-
|
32616
|
-
|
32617
|
-
|
32618
|
-
|
32619
|
-
|
32620
|
-
|
32621
|
-
|
32622
|
-
|
32623
|
-
|
32624
|
-
|
32625
|
-
|
32626
|
-
_arrayId
|
32627
|
-
)) : null,
|
32546
|
+
arrayState.items.map(({ data }, i) => {
|
32547
|
+
const { _arrayId, _originalIndex = i } = arrayState.items[i] || {};
|
32548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32549
|
+
Draggable2,
|
32550
|
+
{
|
32551
|
+
id: _arrayId,
|
32552
|
+
index: i,
|
32553
|
+
className: (_, snapshot2) => getClassNameItem({
|
32554
|
+
isExpanded: arrayState.openId === _arrayId,
|
32555
|
+
isDragging: snapshot2.isDragging,
|
32556
|
+
readOnly
|
32557
|
+
}),
|
32558
|
+
isDragDisabled: readOnly,
|
32559
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
32560
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
32561
|
+
"div",
|
32562
|
+
{
|
32563
|
+
onClick: () => {
|
32564
|
+
if (arrayState.openId === _arrayId) {
|
32565
|
+
setArrayState({
|
32566
|
+
openId: ""
|
32567
|
+
});
|
32568
|
+
} else {
|
32569
|
+
setArrayState({
|
32570
|
+
openId: _arrayId
|
32571
|
+
});
|
32572
|
+
}
|
32573
|
+
},
|
32574
|
+
className: getClassNameItem("summary"),
|
32575
|
+
children: [
|
32576
|
+
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
32577
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassNameItem("rhs"), children: [
|
32578
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32579
|
+
IconButton,
|
32580
|
+
{
|
32581
|
+
onClick: (e) => {
|
32582
|
+
e.stopPropagation();
|
32583
|
+
const existingValue = [
|
32584
|
+
...value || []
|
32585
|
+
];
|
32586
|
+
const existingItems = [
|
32587
|
+
...arrayState.items || []
|
32588
|
+
];
|
32589
|
+
existingValue.splice(i, 1);
|
32590
|
+
existingItems.splice(i, 1);
|
32591
|
+
setArrayState(
|
32592
|
+
{ items: existingItems },
|
32593
|
+
true
|
32594
|
+
);
|
32595
|
+
onChange(existingValue);
|
32596
|
+
},
|
32597
|
+
title: "Delete",
|
32598
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(trash_default, { size: 16 })
|
32599
|
+
}
|
32600
|
+
) }) }),
|
32601
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DragIcon, {}) })
|
32602
|
+
] })
|
32603
|
+
]
|
32604
|
+
}
|
32605
|
+
),
|
32606
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map(
|
32607
|
+
(fieldName) => {
|
32608
|
+
const subField = field.arrayFields[fieldName];
|
32609
|
+
const subFieldName = `${name}[${i}].${fieldName}`;
|
32610
|
+
const wildcardFieldName = `${name}[*].${fieldName}`;
|
32611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32612
|
+
InputOrGroup,
|
32613
|
+
{
|
32614
|
+
name: subFieldName,
|
32615
|
+
label: subField.label || fieldName,
|
32616
|
+
readOnly: typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName],
|
32617
|
+
readOnlyFields,
|
32618
|
+
field: subField,
|
32619
|
+
value: data[fieldName],
|
32620
|
+
onChange: (val) => onChange(
|
32621
|
+
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
32622
|
+
[fieldName]: val
|
32623
|
+
}))
|
32624
|
+
)
|
32625
|
+
},
|
32626
|
+
subFieldName
|
32627
|
+
);
|
32628
|
+
}
|
32629
|
+
) }) })
|
32630
|
+
] })
|
32631
|
+
},
|
32632
|
+
_arrayId
|
32633
|
+
);
|
32634
|
+
}),
|
32628
32635
|
provided.placeholder,
|
32629
32636
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32630
32637
|
"button",
|
@@ -32692,18 +32699,19 @@ var DefaultField = ({
|
|
32692
32699
|
|
32693
32700
|
// components/InputOrGroup/fields/ExternalField/index.tsx
|
32694
32701
|
init_react_import();
|
32695
|
-
var
|
32702
|
+
var import_react30 = require("react");
|
32696
32703
|
|
32697
32704
|
// components/ExternalInput/index.tsx
|
32698
32705
|
init_react_import();
|
32699
|
-
var
|
32706
|
+
var import_react29 = require("react");
|
32700
32707
|
|
32701
32708
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
32702
32709
|
init_react_import();
|
32703
|
-
var styles_module_default6 = { "ExternalInput": "
|
32710
|
+
var styles_module_default6 = { "ExternalInput": "_ExternalInput_157li_1", "ExternalInput-actions": "_ExternalInput-actions_157li_5", "ExternalInput-button": "_ExternalInput-button_157li_9", "ExternalInput-detachButton": "_ExternalInput-detachButton_157li_28", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_157li_35", "ExternalInputModal": "_ExternalInputModal_157li_56", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_157li_63", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_157li_68", "ExternalInputModal-table": "_ExternalInputModal-table_157li_68", "ExternalInputModal-thead": "_ExternalInputModal-thead_157li_83", "ExternalInputModal-th": "_ExternalInputModal-th_157li_83", "ExternalInputModal-td": "_ExternalInputModal-td_157li_97", "ExternalInputModal-tr": "_ExternalInputModal-tr_157li_102", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_157li_114", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_157li_133", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_157li_137", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_157li_145", "ExternalInputModal-noContentBanner": "_ExternalInputModal-noContentBanner_157li_149", "ExternalInputModal--loaded": "_ExternalInputModal--loaded_157li_153" };
|
32704
32711
|
|
32705
32712
|
// components/Modal/index.tsx
|
32706
32713
|
init_react_import();
|
32714
|
+
var import_react28 = require("react");
|
32707
32715
|
|
32708
32716
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
32709
32717
|
init_react_import();
|
@@ -32718,7 +32726,10 @@ var Modal = ({
|
|
32718
32726
|
onClose,
|
32719
32727
|
isOpen
|
32720
32728
|
}) => {
|
32721
|
-
const rootEl =
|
32729
|
+
const [rootEl, setRootEl] = (0, import_react28.useState)(null);
|
32730
|
+
(0, import_react28.useEffect)(() => {
|
32731
|
+
setRootEl(document.getElementById("puck-portal-root"));
|
32732
|
+
}, []);
|
32722
32733
|
if (!rootEl) {
|
32723
32734
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {});
|
32724
32735
|
}
|
@@ -32771,10 +32782,10 @@ var ExternalInput = ({
|
|
32771
32782
|
name
|
32772
32783
|
}) => {
|
32773
32784
|
const { mapProp = (val) => val } = field || {};
|
32774
|
-
const [data, setData] = (0,
|
32775
|
-
const [isOpen, setOpen] = (0,
|
32776
|
-
const [isLoading, setIsLoading] = (0,
|
32777
|
-
const keys = (0,
|
32785
|
+
const [data, setData] = (0, import_react29.useState)([]);
|
32786
|
+
const [isOpen, setOpen] = (0, import_react29.useState)(false);
|
32787
|
+
const [isLoading, setIsLoading] = (0, import_react29.useState)(true);
|
32788
|
+
const keys = (0, import_react29.useMemo)(() => {
|
32778
32789
|
const validKeys = /* @__PURE__ */ new Set();
|
32779
32790
|
for (const item of data) {
|
32780
32791
|
for (const key of Object.keys(item)) {
|
@@ -32785,7 +32796,7 @@ var ExternalInput = ({
|
|
32785
32796
|
}
|
32786
32797
|
return Array.from(validKeys);
|
32787
32798
|
}, [data]);
|
32788
|
-
(0,
|
32799
|
+
(0, import_react29.useEffect)(() => {
|
32789
32800
|
(() => __async(void 0, null, function* () {
|
32790
32801
|
const listData = dataCache[name] || (yield field.fetchList());
|
32791
32802
|
if (listData) {
|
@@ -32884,7 +32895,7 @@ var ExternalField = ({
|
|
32884
32895
|
var _a, _b, _c;
|
32885
32896
|
const validField = field;
|
32886
32897
|
const deprecatedField = field;
|
32887
|
-
(0,
|
32898
|
+
(0, import_react30.useEffect)(() => {
|
32888
32899
|
if (deprecatedField.adaptor) {
|
32889
32900
|
console.error(
|
32890
32901
|
"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."
|
@@ -32906,7 +32917,7 @@ var ExternalField = ({
|
|
32906
32917
|
name,
|
32907
32918
|
field: __spreadProps(__spreadValues({}, validField), {
|
32908
32919
|
// DEPRECATED
|
32909
|
-
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder,
|
32920
|
+
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
|
32910
32921
|
mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
|
32911
32922
|
fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
|
32912
32923
|
return yield deprecatedField.adaptor.fetchList(
|
@@ -33101,17 +33112,19 @@ var FieldLabelInternal = ({
|
|
33101
33112
|
var InputOrGroup = (_a) => {
|
33102
33113
|
var _b = _a, { onChange } = _b, props = __objRest(_b, ["onChange"]);
|
33103
33114
|
const { name, field, value, readOnly } = props;
|
33104
|
-
const [localValue, setLocalValue] = (0,
|
33105
|
-
const
|
33106
|
-
|
33107
|
-
|
33108
|
-
|
33109
|
-
|
33110
|
-
|
33111
|
-
|
33115
|
+
const [localValue, setLocalValue] = (0, import_react31.useState)(value);
|
33116
|
+
const onChangeDb = (0, import_use_debounce2.useDebouncedCallback)(
|
33117
|
+
(val) => {
|
33118
|
+
onChange(val);
|
33119
|
+
},
|
33120
|
+
50,
|
33121
|
+
{ leading: true }
|
33122
|
+
);
|
33123
|
+
const onChangeLocal = (0, import_react31.useCallback)((val) => {
|
33112
33124
|
setLocalValue(val);
|
33125
|
+
onChangeDb(val);
|
33113
33126
|
}, []);
|
33114
|
-
(0,
|
33127
|
+
(0, import_react31.useEffect)(() => {
|
33115
33128
|
setLocalValue(value);
|
33116
33129
|
}, [value]);
|
33117
33130
|
const localProps = {
|
@@ -33152,7 +33165,7 @@ var import_dnd6 = require("@hello-pangea/dnd");
|
|
33152
33165
|
|
33153
33166
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
33154
33167
|
init_react_import();
|
33155
|
-
var styles_module_default9 = { "ComponentList": "
|
33168
|
+
var styles_module_default9 = { "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" };
|
33156
33169
|
|
33157
33170
|
// components/ComponentList/index.tsx
|
33158
33171
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
@@ -33172,7 +33185,7 @@ var ComponentListItem = ({
|
|
33172
33185
|
disableAnimations: true,
|
33173
33186
|
className: () => getClassNameItem2("draggable"),
|
33174
33187
|
children: () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
33175
|
-
component,
|
33188
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameItem2("name"), children: component }),
|
33176
33189
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DragIcon, {}) })
|
33177
33190
|
] })
|
33178
33191
|
},
|
@@ -33241,10 +33254,10 @@ ComponentList.Item = ComponentListItem;
|
|
33241
33254
|
|
33242
33255
|
// lib/use-placeholder-style.ts
|
33243
33256
|
init_react_import();
|
33244
|
-
var
|
33257
|
+
var import_react32 = require("react");
|
33245
33258
|
var usePlaceholderStyle = () => {
|
33246
33259
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
33247
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
33260
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react32.useState)();
|
33248
33261
|
const onDragStartOrUpdate = (draggedItem) => {
|
33249
33262
|
var _a;
|
33250
33263
|
const draggableId = draggedItem.draggableId;
|
@@ -33292,11 +33305,11 @@ init_react_import();
|
|
33292
33305
|
|
33293
33306
|
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
33294
33307
|
init_react_import();
|
33295
|
-
var styles_module_default10 = { "SidebarSection": "
|
33308
|
+
var styles_module_default10 = { "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" };
|
33296
33309
|
|
33297
33310
|
// lib/use-breadcrumbs.ts
|
33298
33311
|
init_react_import();
|
33299
|
-
var
|
33312
|
+
var import_react33 = require("react");
|
33300
33313
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
33301
33314
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
33302
33315
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -33346,8 +33359,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
33346
33359
|
state: { data },
|
33347
33360
|
selectedItem
|
33348
33361
|
} = useAppContext();
|
33349
|
-
const dzContext = (0,
|
33350
|
-
return (0,
|
33362
|
+
const dzContext = (0, import_react33.useContext)(dropZoneContext);
|
33363
|
+
return (0, import_react33.useMemo)(() => {
|
33351
33364
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
33352
33365
|
selectedItem,
|
33353
33366
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -33399,15 +33412,15 @@ init_react_import();
|
|
33399
33412
|
|
33400
33413
|
// lib/use-puck-history.ts
|
33401
33414
|
init_react_import();
|
33402
|
-
var
|
33415
|
+
var import_react35 = require("react");
|
33403
33416
|
|
33404
33417
|
// lib/use-action-history.ts
|
33405
33418
|
init_react_import();
|
33406
|
-
var
|
33419
|
+
var import_react34 = require("react");
|
33407
33420
|
var EMPTY_HISTORY_INDEX = -1;
|
33408
33421
|
function useActionHistory() {
|
33409
|
-
const [histories, setHistories] = (0,
|
33410
|
-
const [currentHistoryIndex, setCurrentHistoryIndex] = (0,
|
33422
|
+
const [histories, setHistories] = (0, import_react34.useState)([]);
|
33423
|
+
const [currentHistoryIndex, setCurrentHistoryIndex] = (0, import_react34.useState)(EMPTY_HISTORY_INDEX);
|
33411
33424
|
const currentHistory = histories[currentHistoryIndex];
|
33412
33425
|
const canRewind = currentHistoryIndex > EMPTY_HISTORY_INDEX;
|
33413
33426
|
const canForward = currentHistoryIndex < histories.length - 1;
|
@@ -33486,7 +33499,7 @@ function usePuckHistory({
|
|
33486
33499
|
dispatch
|
33487
33500
|
});
|
33488
33501
|
}, DEBOUNCE_TIME);
|
33489
|
-
(0,
|
33502
|
+
(0, import_react35.useEffect)(() => {
|
33490
33503
|
historyEmitter.on(RECORD_DIFF, handleRecordDiff);
|
33491
33504
|
return () => {
|
33492
33505
|
historyEmitter.off(RECORD_DIFF, handleRecordDiff);
|
@@ -33828,7 +33841,7 @@ init_react_import();
|
|
33828
33841
|
|
33829
33842
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
33830
33843
|
init_react_import();
|
33831
|
-
var styles_module_default11 = { "LayerTree": "
|
33844
|
+
var styles_module_default11 = { "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" };
|
33832
33845
|
|
33833
33846
|
// lib/scroll-into-view.ts
|
33834
33847
|
init_react_import();
|
@@ -33842,7 +33855,7 @@ var scrollIntoView = (el) => {
|
|
33842
33855
|
};
|
33843
33856
|
|
33844
33857
|
// components/LayerTree/index.tsx
|
33845
|
-
var
|
33858
|
+
var import_react36 = require("react");
|
33846
33859
|
|
33847
33860
|
// lib/find-zones-for-area.ts
|
33848
33861
|
init_react_import();
|
@@ -33880,7 +33893,7 @@ var LayerTree = ({
|
|
33880
33893
|
label
|
33881
33894
|
}) => {
|
33882
33895
|
const zones = data.zones || {};
|
33883
|
-
const ctx = (0,
|
33896
|
+
const ctx = (0, import_react36.useContext)(dropZoneContext);
|
33884
33897
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
33885
33898
|
label && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName17("zoneTitle"), children: [
|
33886
33899
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(layers_default, { size: "16" }) }),
|
@@ -33954,7 +33967,7 @@ var LayerTree = ({
|
|
33954
33967
|
),
|
33955
33968
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
33956
33969
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(type_default, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(grid_default, { size: "16" }) }),
|
33957
|
-
item.type
|
33970
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("name"), children: item.type })
|
33958
33971
|
] })
|
33959
33972
|
]
|
33960
33973
|
}
|
@@ -34005,11 +34018,11 @@ var flushZones = (appState) => {
|
|
34005
34018
|
|
34006
34019
|
// lib/use-component-list.tsx
|
34007
34020
|
init_react_import();
|
34008
|
-
var
|
34021
|
+
var import_react37 = require("react");
|
34009
34022
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
34010
34023
|
var useComponentList = (config, ui) => {
|
34011
|
-
const [componentList, setComponentList] = (0,
|
34012
|
-
(0,
|
34024
|
+
const [componentList, setComponentList] = (0, import_react37.useState)();
|
34025
|
+
(0, import_react37.useEffect)(() => {
|
34013
34026
|
var _a, _b, _c;
|
34014
34027
|
if (Object.keys(ui.componentList).length > 0) {
|
34015
34028
|
const matchedComponents = [];
|
@@ -34075,7 +34088,7 @@ var useComponentList = (config, ui) => {
|
|
34075
34088
|
|
34076
34089
|
// lib/use-resolved-data.ts
|
34077
34090
|
init_react_import();
|
34078
|
-
var
|
34091
|
+
var import_react38 = require("react");
|
34079
34092
|
|
34080
34093
|
// lib/resolve-component-data.ts
|
34081
34094
|
init_react_import();
|
@@ -34190,19 +34203,19 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
|
|
34190
34203
|
|
34191
34204
|
// lib/use-resolved-data.ts
|
34192
34205
|
var useResolvedData = (data, config, dispatch) => {
|
34193
|
-
const [{ resolverKey, newData }, setResolverState] = (0,
|
34206
|
+
const [{ resolverKey, newData }, setResolverState] = (0, import_react38.useState)({
|
34194
34207
|
resolverKey: 0,
|
34195
34208
|
newData: data
|
34196
34209
|
});
|
34197
|
-
const [componentState, setComponentState] = (0,
|
34210
|
+
const [componentState, setComponentState] = (0, import_react38.useState)({});
|
34198
34211
|
const deferredSetStates = {};
|
34199
|
-
const setComponentLoading = (0,
|
34212
|
+
const setComponentLoading = (0, import_react38.useCallback)(
|
34200
34213
|
(id, loading, defer = 0) => {
|
34201
34214
|
if (deferredSetStates[id]) {
|
34202
34215
|
clearTimeout(deferredSetStates[id]);
|
34203
34216
|
delete deferredSetStates[id];
|
34204
34217
|
}
|
34205
|
-
|
34218
|
+
deferredSetStates[id] = setTimeout(() => {
|
34206
34219
|
setComponentState((prev) => __spreadProps(__spreadValues({}, prev), {
|
34207
34220
|
[id]: __spreadProps(__spreadValues({}, prev[id]), { loading })
|
34208
34221
|
}));
|
@@ -34254,10 +34267,10 @@ var useResolvedData = (data, config, dispatch) => {
|
|
34254
34267
|
});
|
34255
34268
|
yield Promise.all(promises);
|
34256
34269
|
});
|
34257
|
-
(0,
|
34270
|
+
(0, import_react38.useEffect)(() => {
|
34258
34271
|
runResolvers();
|
34259
34272
|
}, [resolverKey]);
|
34260
|
-
const resolveData = (0,
|
34273
|
+
const resolveData = (0, import_react38.useCallback)((newData2 = data) => {
|
34261
34274
|
setResolverState((curr) => ({
|
34262
34275
|
resolverKey: curr.resolverKey + 1,
|
34263
34276
|
newData: newData2
|
@@ -34269,8 +34282,86 @@ var useResolvedData = (data, config, dispatch) => {
|
|
34269
34282
|
};
|
34270
34283
|
};
|
34271
34284
|
|
34272
|
-
// components/
|
34285
|
+
// components/MenuBar/index.tsx
|
34286
|
+
init_react_import();
|
34287
|
+
|
34288
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
|
34289
|
+
init_react_import();
|
34290
|
+
var styles_module_default12 = { "MenuBar": "_MenuBar_12sp7_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_12sp7_14", "MenuBar-inner": "_MenuBar-inner_12sp7_29", "MenuBar-history": "_MenuBar-history_12sp7_45" };
|
34291
|
+
|
34292
|
+
// components/MenuBar/index.tsx
|
34273
34293
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
34294
|
+
var getClassName18 = get_class_name_factory_default("MenuBar", styles_module_default12);
|
34295
|
+
var MenuBar = ({
|
34296
|
+
appState,
|
34297
|
+
data = { content: [], root: { props: { title: "" } } },
|
34298
|
+
dispatch,
|
34299
|
+
menuOpen = false,
|
34300
|
+
onPublish,
|
34301
|
+
renderHeaderActions,
|
34302
|
+
setMenuOpen
|
34303
|
+
}) => {
|
34304
|
+
const { canForward, canRewind, rewind, forward } = usePuckHistory({
|
34305
|
+
appState,
|
34306
|
+
dispatch
|
34307
|
+
});
|
34308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34309
|
+
"div",
|
34310
|
+
{
|
34311
|
+
className: getClassName18({ menuOpen }),
|
34312
|
+
onClick: (event) => {
|
34313
|
+
var _a;
|
34314
|
+
const element = event.target;
|
34315
|
+
if (window.matchMedia("(min-width: 638px)").matches) {
|
34316
|
+
return;
|
34317
|
+
}
|
34318
|
+
if (element.tagName === "A" && ((_a = element.getAttribute("href")) == null ? void 0 : _a.startsWith("#"))) {
|
34319
|
+
setMenuOpen(false);
|
34320
|
+
}
|
34321
|
+
},
|
34322
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18("inner"), children: [
|
34323
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18("history"), children: [
|
34324
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(IconButton, { title: "undo", disabled: !canRewind, onClick: rewind, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34325
|
+
chevron_left_default,
|
34326
|
+
{
|
34327
|
+
size: 21,
|
34328
|
+
stroke: canRewind ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
|
34329
|
+
}
|
34330
|
+
) }),
|
34331
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(IconButton, { title: "redo", disabled: !canForward, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34332
|
+
chevron_right_default,
|
34333
|
+
{
|
34334
|
+
size: 21,
|
34335
|
+
stroke: canForward ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
|
34336
|
+
}
|
34337
|
+
) })
|
34338
|
+
] }),
|
34339
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
34340
|
+
state: appState,
|
34341
|
+
dispatch
|
34342
|
+
}) }),
|
34343
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34344
|
+
Button,
|
34345
|
+
{
|
34346
|
+
onClick: () => {
|
34347
|
+
onPublish(data);
|
34348
|
+
},
|
34349
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
|
34350
|
+
children: "Publish"
|
34351
|
+
}
|
34352
|
+
) })
|
34353
|
+
] })
|
34354
|
+
}
|
34355
|
+
);
|
34356
|
+
};
|
34357
|
+
|
34358
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
34359
|
+
init_react_import();
|
34360
|
+
var styles_module_default13 = { "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" };
|
34361
|
+
|
34362
|
+
// components/Puck/index.tsx
|
34363
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
34364
|
+
var getClassName19 = get_class_name_factory_default("Puck", styles_module_default13);
|
34274
34365
|
var defaultPageFields = {
|
34275
34366
|
title: { type: "text" }
|
34276
34367
|
};
|
@@ -34282,7 +34373,7 @@ var PluginRenderer = ({
|
|
34282
34373
|
renderMethod
|
34283
34374
|
}) => {
|
34284
34375
|
return plugins.filter((item) => item[renderMethod]).map((item) => item[renderMethod]).reduce(
|
34285
|
-
(accChildren, Item) => /* @__PURE__ */ (0,
|
34376
|
+
(accChildren, Item) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Item, { dispatch, state, children: accChildren }),
|
34286
34377
|
children
|
34287
34378
|
);
|
34288
34379
|
};
|
@@ -34299,8 +34390,8 @@ function Puck({
|
|
34299
34390
|
headerPath
|
34300
34391
|
}) {
|
34301
34392
|
var _a, _b;
|
34302
|
-
const [reducer] = (0,
|
34303
|
-
const initialAppState = __spreadProps(__spreadValues({}, defaultAppState), {
|
34393
|
+
const [reducer] = (0, import_react39.useState)(() => createReducer({ config }));
|
34394
|
+
const [initialAppState] = (0, import_react39.useState)(__spreadProps(__spreadValues({}, defaultAppState), {
|
34304
34395
|
data: initialData,
|
34305
34396
|
ui: __spreadProps(__spreadValues({}, defaultAppState.ui), {
|
34306
34397
|
// Store categories under componentList on state to allow render functions and plugins to modify
|
@@ -34318,8 +34409,8 @@ function Puck({
|
|
34318
34409
|
{}
|
34319
34410
|
) : {}
|
34320
34411
|
})
|
34321
|
-
});
|
34322
|
-
const [appState, dispatch] = (0,
|
34412
|
+
}));
|
34413
|
+
const [appState, dispatch] = (0, import_react39.useReducer)(
|
34323
34414
|
reducer,
|
34324
34415
|
flushZones(initialAppState)
|
34325
34416
|
);
|
@@ -34329,12 +34420,9 @@ function Puck({
|
|
34329
34420
|
config,
|
34330
34421
|
dispatch
|
34331
34422
|
);
|
34332
|
-
const
|
34333
|
-
|
34334
|
-
|
34335
|
-
});
|
34336
|
-
const { itemSelector, leftSideBarVisible } = ui;
|
34337
|
-
const setItemSelector = (0, import_react38.useCallback)(
|
34423
|
+
const [menuOpen, setMenuOpen] = (0, import_react39.useState)(false);
|
34424
|
+
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
34425
|
+
const setItemSelector = (0, import_react39.useCallback)(
|
34338
34426
|
(newItemSelector) => {
|
34339
34427
|
dispatch({
|
34340
34428
|
type: "setUi",
|
@@ -34344,10 +34432,10 @@ function Puck({
|
|
34344
34432
|
[]
|
34345
34433
|
);
|
34346
34434
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
34347
|
-
const Page = (0,
|
34435
|
+
const Page = (0, import_react39.useCallback)(
|
34348
34436
|
(pageProps) => {
|
34349
34437
|
var _a2, _b2;
|
34350
|
-
return /* @__PURE__ */ (0,
|
34438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34351
34439
|
PluginRenderer,
|
34352
34440
|
{
|
34353
34441
|
plugins,
|
@@ -34360,8 +34448,8 @@ function Puck({
|
|
34360
34448
|
},
|
34361
34449
|
[config.root]
|
34362
34450
|
);
|
34363
|
-
const PageFieldWrapper = (0,
|
34364
|
-
(props) => /* @__PURE__ */ (0,
|
34451
|
+
const PageFieldWrapper = (0, import_react39.useCallback)(
|
34452
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34365
34453
|
PluginRenderer,
|
34366
34454
|
{
|
34367
34455
|
plugins,
|
@@ -34373,8 +34461,8 @@ function Puck({
|
|
34373
34461
|
),
|
34374
34462
|
[]
|
34375
34463
|
);
|
34376
|
-
const ComponentFieldWrapper = (0,
|
34377
|
-
(props) => /* @__PURE__ */ (0,
|
34464
|
+
const ComponentFieldWrapper = (0, import_react39.useCallback)(
|
34465
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34378
34466
|
PluginRenderer,
|
34379
34467
|
{
|
34380
34468
|
plugins,
|
@@ -34386,8 +34474,8 @@ function Puck({
|
|
34386
34474
|
),
|
34387
34475
|
[]
|
34388
34476
|
);
|
34389
|
-
const ComponentListWrapper = (0,
|
34390
|
-
const children = /* @__PURE__ */ (0,
|
34477
|
+
const ComponentListWrapper = (0, import_react39.useCallback)((props) => {
|
34478
|
+
const children = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34391
34479
|
PluginRenderer,
|
34392
34480
|
{
|
34393
34481
|
plugins,
|
@@ -34406,27 +34494,64 @@ function Puck({
|
|
34406
34494
|
const FieldWrapper = itemSelector ? ComponentFieldWrapper : PageFieldWrapper;
|
34407
34495
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
34408
34496
|
let fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
|
34409
|
-
(0,
|
34497
|
+
(0, import_react39.useEffect)(() => {
|
34410
34498
|
if (onChange)
|
34411
34499
|
onChange(data);
|
34412
34500
|
}, [data]);
|
34413
34501
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
34414
|
-
const [draggedItem, setDraggedItem] = (0,
|
34502
|
+
const [draggedItem, setDraggedItem] = (0, import_react39.useState)();
|
34415
34503
|
const componentList = useComponentList(config, appState.ui);
|
34416
34504
|
const rootProps = data.root.props || data.root;
|
34417
|
-
(0,
|
34505
|
+
(0, import_react39.useEffect)(() => {
|
34418
34506
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
34419
34507
|
console.error(
|
34420
34508
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
34421
34509
|
);
|
34422
34510
|
}
|
34423
34511
|
}, []);
|
34424
|
-
|
34425
|
-
|
34512
|
+
const toggleSidebars = (0, import_react39.useCallback)(
|
34513
|
+
(sidebar) => {
|
34514
|
+
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
34515
|
+
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
34516
|
+
const oppositeSideBar = sidebar === "left" ? "rightSideBarVisible" : "leftSideBarVisible";
|
34517
|
+
dispatch({
|
34518
|
+
type: "setUi",
|
34519
|
+
ui: __spreadValues({
|
34520
|
+
[`${sidebar}SideBarVisible`]: !sideBarVisible
|
34521
|
+
}, !widerViewport ? { [oppositeSideBar]: false } : {})
|
34522
|
+
});
|
34523
|
+
},
|
34524
|
+
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
34525
|
+
);
|
34526
|
+
(0, import_react39.useEffect)(() => {
|
34527
|
+
if (!window.matchMedia("(min-width: 638px)").matches) {
|
34528
|
+
dispatch({
|
34529
|
+
type: "setUi",
|
34530
|
+
ui: {
|
34531
|
+
leftSideBarVisible: false,
|
34532
|
+
rightSideBarVisible: false
|
34533
|
+
}
|
34534
|
+
});
|
34535
|
+
}
|
34536
|
+
const handleResize = () => {
|
34537
|
+
if (!window.matchMedia("(min-width: 638px)").matches) {
|
34538
|
+
dispatch({
|
34539
|
+
type: "setUi",
|
34540
|
+
ui: (ui2) => __spreadValues(__spreadValues({}, ui2), ui2.rightSideBarVisible ? { leftSideBarVisible: false } : {})
|
34541
|
+
});
|
34542
|
+
}
|
34543
|
+
};
|
34544
|
+
window.addEventListener("resize", handleResize);
|
34545
|
+
return () => {
|
34546
|
+
window.removeEventListener("resize", handleResize);
|
34547
|
+
};
|
34548
|
+
}, []);
|
34549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
|
34550
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34426
34551
|
AppProvider,
|
34427
34552
|
{
|
34428
34553
|
value: { state: appState, dispatch, config, componentState },
|
34429
|
-
children: /* @__PURE__ */ (0,
|
34554
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34430
34555
|
import_dnd7.DragDropContext,
|
34431
34556
|
{
|
34432
34557
|
onDragUpdate: (update) => {
|
@@ -34479,7 +34604,7 @@ function Puck({
|
|
34479
34604
|
});
|
34480
34605
|
}
|
34481
34606
|
},
|
34482
|
-
children: /* @__PURE__ */ (0,
|
34607
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34483
34608
|
DropZoneProvider,
|
34484
34609
|
{
|
34485
34610
|
value: {
|
@@ -34493,248 +34618,133 @@ function Puck({
|
|
34493
34618
|
mode: "edit",
|
34494
34619
|
areaId: "root"
|
34495
34620
|
},
|
34496
|
-
children: /* @__PURE__ */ (0,
|
34621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(dropZoneContext.Consumer, { children: (ctx) => {
|
34497
34622
|
var _a2, _b2;
|
34498
|
-
return /* @__PURE__ */ (0,
|
34623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
34499
34624
|
"div",
|
34500
34625
|
{
|
34501
|
-
|
34502
|
-
|
34503
|
-
|
34504
|
-
|
34505
|
-
|
34506
|
-
height: "100vh",
|
34507
|
-
position: "fixed",
|
34508
|
-
top: 0,
|
34509
|
-
bottom: 0,
|
34510
|
-
left: 0,
|
34511
|
-
right: 0
|
34512
|
-
},
|
34626
|
+
className: getClassName19({
|
34627
|
+
leftSideBarVisible,
|
34628
|
+
menuOpen,
|
34629
|
+
rightSideBarVisible
|
34630
|
+
}),
|
34513
34631
|
children: [
|
34514
|
-
/* @__PURE__ */ (0,
|
34515
|
-
|
34516
|
-
|
34517
|
-
|
34518
|
-
|
34519
|
-
|
34520
|
-
|
34521
|
-
|
34522
|
-
|
34523
|
-
|
34524
|
-
|
34525
|
-
|
34526
|
-
|
34527
|
-
|
34528
|
-
|
34529
|
-
|
34530
|
-
|
34531
|
-
children: "Publish"
|
34532
|
-
}
|
34533
|
-
),
|
34534
|
-
dispatch,
|
34535
|
-
state: appState
|
34536
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34537
|
-
"div",
|
34632
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("header", { className: getClassName19("header"), children: renderHeader ? renderHeader({
|
34633
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34634
|
+
Button,
|
34635
|
+
{
|
34636
|
+
onClick: () => {
|
34637
|
+
onPublish(data);
|
34638
|
+
},
|
34639
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(globe_default, { size: "14px" }),
|
34640
|
+
children: "Publish"
|
34641
|
+
}
|
34642
|
+
),
|
34643
|
+
dispatch,
|
34644
|
+
state: appState
|
34645
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName19("headerInner"), children: [
|
34646
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName19("headerToggle"), children: [
|
34647
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName19("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34648
|
+
IconButton,
|
34538
34649
|
{
|
34539
|
-
|
34540
|
-
|
34541
|
-
padding: 16,
|
34542
|
-
gridTemplateAreas: '"left middle right"',
|
34543
|
-
gridTemplateColumns: "344px auto 344px",
|
34544
|
-
gridTemplateRows: "auto"
|
34650
|
+
onClick: () => {
|
34651
|
+
toggleSidebars("left");
|
34545
34652
|
},
|
34546
|
-
|
34547
|
-
|
34548
|
-
|
34549
|
-
|
34550
|
-
|
34551
|
-
|
34552
|
-
|
34553
|
-
|
34554
|
-
|
34555
|
-
|
34556
|
-
|
34557
|
-
|
34558
|
-
|
34559
|
-
|
34560
|
-
|
34561
|
-
|
34562
|
-
|
34563
|
-
|
34564
|
-
|
34565
|
-
|
34566
|
-
|
34567
|
-
|
34568
|
-
|
34569
|
-
|
34570
|
-
|
34571
|
-
|
34572
|
-
|
34573
|
-
|
34574
|
-
|
34575
|
-
|
34576
|
-
|
34577
|
-
|
34578
|
-
|
34579
|
-
|
34580
|
-
|
34581
|
-
|
34582
|
-
|
34583
|
-
|
34584
|
-
|
34585
|
-
|
34586
|
-
|
34587
|
-
|
34588
|
-
|
34589
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34590
|
-
"div",
|
34591
|
-
{
|
34592
|
-
style: {
|
34593
|
-
display: "flex",
|
34594
|
-
gap: 16,
|
34595
|
-
justifyContent: "flex-end"
|
34596
|
-
},
|
34597
|
-
children: [
|
34598
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex" }, children: [
|
34599
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34600
|
-
IconButton,
|
34601
|
-
{
|
34602
|
-
title: "undo",
|
34603
|
-
disabled: !canRewind,
|
34604
|
-
onClick: rewind,
|
34605
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34606
|
-
chevron_left_default,
|
34607
|
-
{
|
34608
|
-
size: 21,
|
34609
|
-
stroke: canRewind ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
|
34610
|
-
}
|
34611
|
-
)
|
34612
|
-
}
|
34613
|
-
),
|
34614
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34615
|
-
IconButton,
|
34616
|
-
{
|
34617
|
-
title: "redo",
|
34618
|
-
disabled: !canForward,
|
34619
|
-
onClick: forward,
|
34620
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34621
|
-
chevron_right_default,
|
34622
|
-
{
|
34623
|
-
size: 21,
|
34624
|
-
stroke: canForward ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
|
34625
|
-
}
|
34626
|
-
)
|
34627
|
-
}
|
34628
|
-
)
|
34629
|
-
] }),
|
34630
|
-
renderHeaderActions && renderHeaderActions({
|
34631
|
-
state: appState,
|
34632
|
-
dispatch
|
34633
|
-
}),
|
34634
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34635
|
-
Button,
|
34636
|
-
{
|
34637
|
-
onClick: () => {
|
34638
|
-
onPublish(data);
|
34639
|
-
},
|
34640
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
|
34641
|
-
children: "Publish"
|
34642
|
-
}
|
34643
|
-
)
|
34644
|
-
]
|
34645
|
-
}
|
34646
|
-
)
|
34647
|
-
]
|
34653
|
+
title: "Toggle left sidebar",
|
34654
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(sidebar_default, { focusable: "false" })
|
34655
|
+
}
|
34656
|
+
) }),
|
34657
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName19("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34658
|
+
IconButton,
|
34659
|
+
{
|
34660
|
+
onClick: () => {
|
34661
|
+
toggleSidebars("right");
|
34662
|
+
},
|
34663
|
+
title: "Toggle right sidebar",
|
34664
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(sidebar_default, { focusable: "false" })
|
34665
|
+
}
|
34666
|
+
) })
|
34667
|
+
] }),
|
34668
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName19("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
34669
|
+
headerTitle || rootProps.title || "Page",
|
34670
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
34671
|
+
" ",
|
34672
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("code", { className: getClassName19("headerPath"), children: headerPath })
|
34673
|
+
] })
|
34674
|
+
] }) }),
|
34675
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName19("headerTools"), children: [
|
34676
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName19("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34677
|
+
IconButton,
|
34678
|
+
{
|
34679
|
+
onClick: () => {
|
34680
|
+
return setMenuOpen(!menuOpen);
|
34681
|
+
},
|
34682
|
+
title: "Toggle menu bar",
|
34683
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(chevron_up_default, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(chevron_down_default, { focusable: "false" })
|
34684
|
+
}
|
34685
|
+
) }),
|
34686
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34687
|
+
MenuBar,
|
34688
|
+
{
|
34689
|
+
appState,
|
34690
|
+
data,
|
34691
|
+
dispatch,
|
34692
|
+
onPublish,
|
34693
|
+
menuOpen,
|
34694
|
+
renderHeaderActions,
|
34695
|
+
setMenuOpen
|
34648
34696
|
}
|
34649
34697
|
)
|
34650
|
-
}
|
34651
|
-
),
|
34652
|
-
/* @__PURE__ */ (0,
|
34653
|
-
"
|
34654
|
-
{
|
34655
|
-
|
34656
|
-
|
34657
|
-
|
34658
|
-
|
34659
|
-
|
34660
|
-
|
34661
|
-
|
34662
|
-
|
34663
|
-
|
34664
|
-
|
34665
|
-
|
34666
|
-
|
34698
|
+
] })
|
34699
|
+
] }) }),
|
34700
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName19("leftSideBar"), children: [
|
34701
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SidebarSection, { title: "Components", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ComponentListWrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ComponentList, { id: "all" }) }) }),
|
34702
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(SidebarSection, { title: "Outline", children: [
|
34703
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34704
|
+
LayerTree,
|
34705
|
+
{
|
34706
|
+
data,
|
34707
|
+
label: areaContainsZones(data, "root") ? rootDroppableId : "",
|
34708
|
+
zoneContent: data.content,
|
34709
|
+
setItemSelector,
|
34710
|
+
itemSelector
|
34711
|
+
}
|
34712
|
+
),
|
34713
|
+
Object.entries(findZonesForArea(data, "root")).map(
|
34714
|
+
([zoneKey, zone]) => {
|
34715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34667
34716
|
LayerTree,
|
34668
34717
|
{
|
34669
34718
|
data,
|
34670
|
-
label:
|
34671
|
-
|
34719
|
+
label: zoneKey,
|
34720
|
+
zone: zoneKey,
|
34721
|
+
zoneContent: zone,
|
34672
34722
|
setItemSelector,
|
34673
34723
|
itemSelector
|
34674
|
-
}
|
34675
|
-
|
34676
|
-
|
34677
|
-
|
34678
|
-
|
34679
|
-
|
34680
|
-
|
34681
|
-
|
34682
|
-
label: zoneKey,
|
34683
|
-
zone: zoneKey,
|
34684
|
-
zoneContent: zone,
|
34685
|
-
setItemSelector,
|
34686
|
-
itemSelector
|
34687
|
-
},
|
34688
|
-
zoneKey
|
34689
|
-
);
|
34690
|
-
}
|
34691
|
-
)
|
34692
|
-
] })
|
34693
|
-
]
|
34694
|
-
}
|
34695
|
-
),
|
34696
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34724
|
+
},
|
34725
|
+
zoneKey
|
34726
|
+
);
|
34727
|
+
}
|
34728
|
+
)
|
34729
|
+
] })
|
34730
|
+
] }),
|
34731
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
34697
34732
|
"div",
|
34698
34733
|
{
|
34699
|
-
|
34700
|
-
overflowY: "auto",
|
34701
|
-
gridArea: "editor",
|
34702
|
-
position: "relative",
|
34703
|
-
display: "flex",
|
34704
|
-
flexDirection: "column"
|
34705
|
-
},
|
34734
|
+
className: getClassName19("frame"),
|
34706
34735
|
onClick: () => setItemSelector(null),
|
34707
34736
|
id: "puck-frame",
|
34708
34737
|
children: [
|
34709
|
-
/* @__PURE__ */ (0,
|
34710
|
-
|
34711
|
-
{
|
34712
|
-
|
34713
|
-
|
34714
|
-
|
34715
|
-
|
34716
|
-
|
34717
|
-
|
34718
|
-
|
34719
|
-
"div",
|
34720
|
-
{
|
34721
|
-
style: {
|
34722
|
-
border: "1px solid var(--puck-color-grey-8)"
|
34723
|
-
},
|
34724
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34725
|
-
Page,
|
34726
|
-
__spreadProps(__spreadValues({
|
34727
|
-
dispatch,
|
34728
|
-
state: appState
|
34729
|
-
}, data.root), {
|
34730
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZone, { zone: rootDroppableId })
|
34731
|
-
})
|
34732
|
-
)
|
34733
|
-
}
|
34734
|
-
)
|
34735
|
-
}
|
34736
|
-
),
|
34737
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34738
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName19("root"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName19("page"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34739
|
+
Page,
|
34740
|
+
__spreadProps(__spreadValues({
|
34741
|
+
dispatch,
|
34742
|
+
state: appState
|
34743
|
+
}, rootProps), {
|
34744
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZone, { zone: rootDroppableId })
|
34745
|
+
})
|
34746
|
+
) }) }),
|
34747
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34738
34748
|
"div",
|
34739
34749
|
{
|
34740
34750
|
style: {
|
@@ -34747,106 +34757,92 @@ function Puck({
|
|
34747
34757
|
]
|
34748
34758
|
}
|
34749
34759
|
),
|
34750
|
-
/* @__PURE__ */ (0,
|
34751
|
-
|
34760
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName19("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FieldWrapper, { dispatch, state: appState, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34761
|
+
SidebarSection,
|
34752
34762
|
{
|
34753
|
-
|
34754
|
-
|
34755
|
-
|
34756
|
-
|
34757
|
-
|
34758
|
-
|
34759
|
-
|
34760
|
-
|
34761
|
-
|
34762
|
-
|
34763
|
-
|
34764
|
-
|
34765
|
-
|
34766
|
-
|
34767
|
-
|
34768
|
-
|
34769
|
-
|
34770
|
-
|
34771
|
-
const
|
34772
|
-
|
34773
|
-
|
34774
|
-
|
34775
|
-
|
34776
|
-
|
34777
|
-
|
34778
|
-
|
34779
|
-
|
34780
|
-
|
34781
|
-
|
34782
|
-
|
34783
|
-
|
34784
|
-
|
34785
|
-
|
34786
|
-
|
34787
|
-
|
34788
|
-
};
|
34789
|
-
if ((_a3 = config.components[selectedItem.type]) == null ? void 0 : _a3.resolveData) {
|
34790
|
-
resolveData(replaceAction(data, action));
|
34791
|
-
} else {
|
34792
|
-
dispatch(action);
|
34793
|
-
}
|
34763
|
+
noPadding: true,
|
34764
|
+
showBreadcrumbs: true,
|
34765
|
+
title: selectedItem ? selectedItem.type : "Page",
|
34766
|
+
isLoading: selectedItem ? (_a2 = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a2.loading : (_b2 = componentState["puck-root"]) == null ? void 0 : _b2.loading,
|
34767
|
+
children: Object.keys(fields).map((fieldName) => {
|
34768
|
+
const field = fields[fieldName];
|
34769
|
+
const onChange2 = (value) => {
|
34770
|
+
var _a3, _b3;
|
34771
|
+
let currentProps;
|
34772
|
+
if (selectedItem) {
|
34773
|
+
currentProps = selectedItem.props;
|
34774
|
+
} else {
|
34775
|
+
currentProps = rootProps;
|
34776
|
+
}
|
34777
|
+
const newProps = __spreadProps(__spreadValues({}, currentProps), {
|
34778
|
+
[fieldName]: value
|
34779
|
+
});
|
34780
|
+
if (itemSelector) {
|
34781
|
+
const action = {
|
34782
|
+
type: "replace",
|
34783
|
+
destinationIndex: itemSelector.index,
|
34784
|
+
destinationZone: itemSelector.zone || rootDroppableId,
|
34785
|
+
data: __spreadProps(__spreadValues({}, selectedItem), { props: newProps })
|
34786
|
+
};
|
34787
|
+
if ((_a3 = config.components[selectedItem.type]) == null ? void 0 : _a3.resolveData) {
|
34788
|
+
resolveData(replaceAction(data, action));
|
34789
|
+
} else {
|
34790
|
+
dispatch(action);
|
34791
|
+
}
|
34792
|
+
} else {
|
34793
|
+
if (data.root.props) {
|
34794
|
+
if ((_b3 = config.root) == null ? void 0 : _b3.resolveData) {
|
34795
|
+
resolveData(__spreadProps(__spreadValues({}, data), {
|
34796
|
+
root: { props: newProps }
|
34797
|
+
}));
|
34794
34798
|
} else {
|
34795
|
-
|
34796
|
-
|
34797
|
-
|
34798
|
-
|
34799
|
-
}));
|
34800
|
-
} else {
|
34801
|
-
dispatch({
|
34802
|
-
type: "setData",
|
34803
|
-
data: { root: { props: { newProps } } }
|
34804
|
-
});
|
34805
|
-
}
|
34806
|
-
} else {
|
34807
|
-
dispatch({
|
34808
|
-
type: "setData",
|
34809
|
-
data: { root: newProps }
|
34810
|
-
});
|
34811
|
-
}
|
34799
|
+
dispatch({
|
34800
|
+
type: "setData",
|
34801
|
+
data: { root: { props: newProps } }
|
34802
|
+
});
|
34812
34803
|
}
|
34813
|
-
};
|
34814
|
-
if (selectedItem && itemSelector) {
|
34815
|
-
const { readOnly = {} } = selectedItem;
|
34816
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34817
|
-
InputOrGroup,
|
34818
|
-
{
|
34819
|
-
field,
|
34820
|
-
name: fieldName,
|
34821
|
-
label: field.label,
|
34822
|
-
readOnly: readOnly[fieldName],
|
34823
|
-
readOnlyFields: readOnly,
|
34824
|
-
value: selectedItem.props[fieldName],
|
34825
|
-
onChange: onChange2
|
34826
|
-
},
|
34827
|
-
`${selectedItem.props.id}_${fieldName}`
|
34828
|
-
);
|
34829
34804
|
} else {
|
34830
|
-
|
34831
|
-
|
34832
|
-
|
34833
|
-
|
34834
|
-
field,
|
34835
|
-
name: fieldName,
|
34836
|
-
label: field.label,
|
34837
|
-
readOnly: readOnly[fieldName],
|
34838
|
-
readOnlyFields: readOnly,
|
34839
|
-
value: rootProps[fieldName],
|
34840
|
-
onChange: onChange2
|
34841
|
-
},
|
34842
|
-
`page_${fieldName}`
|
34843
|
-
);
|
34805
|
+
dispatch({
|
34806
|
+
type: "setData",
|
34807
|
+
data: { root: newProps }
|
34808
|
+
});
|
34844
34809
|
}
|
34845
|
-
}
|
34810
|
+
}
|
34811
|
+
};
|
34812
|
+
if (selectedItem && itemSelector) {
|
34813
|
+
const { readOnly = {} } = selectedItem;
|
34814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34815
|
+
InputOrGroup,
|
34816
|
+
{
|
34817
|
+
field,
|
34818
|
+
name: fieldName,
|
34819
|
+
label: field.label,
|
34820
|
+
readOnly: readOnly[fieldName],
|
34821
|
+
readOnlyFields: readOnly,
|
34822
|
+
value: selectedItem.props[fieldName],
|
34823
|
+
onChange: onChange2
|
34824
|
+
},
|
34825
|
+
`${selectedItem.props.id}_${fieldName}`
|
34826
|
+
);
|
34827
|
+
} else {
|
34828
|
+
const { readOnly = {} } = data.root;
|
34829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34830
|
+
InputOrGroup,
|
34831
|
+
{
|
34832
|
+
field,
|
34833
|
+
name: fieldName,
|
34834
|
+
label: field.label,
|
34835
|
+
readOnly: readOnly[fieldName],
|
34836
|
+
readOnlyFields: readOnly,
|
34837
|
+
value: rootProps[fieldName],
|
34838
|
+
onChange: onChange2
|
34839
|
+
},
|
34840
|
+
`page_${fieldName}`
|
34841
|
+
);
|
34846
34842
|
}
|
34847
|
-
|
34843
|
+
})
|
34848
34844
|
}
|
34849
|
-
)
|
34845
|
+
) }) })
|
34850
34846
|
]
|
34851
34847
|
}
|
34852
34848
|
);
|
@@ -34857,19 +34853,19 @@ function Puck({
|
|
34857
34853
|
)
|
34858
34854
|
}
|
34859
34855
|
),
|
34860
|
-
/* @__PURE__ */ (0,
|
34856
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { id: "puck-portal-root" })
|
34861
34857
|
] });
|
34862
34858
|
}
|
34863
34859
|
|
34864
34860
|
// components/Render/index.tsx
|
34865
34861
|
init_react_import();
|
34866
|
-
var
|
34862
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
34867
34863
|
function Render({ config, data }) {
|
34868
34864
|
var _a;
|
34869
34865
|
const rootProps = data.root.props || data.root;
|
34870
34866
|
const title = rootProps.title || "";
|
34871
34867
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
34872
|
-
return /* @__PURE__ */ (0,
|
34868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
34873
34869
|
config.root.render,
|
34874
34870
|
__spreadProps(__spreadValues({}, rootProps), {
|
34875
34871
|
puck: {
|
@@ -34878,11 +34874,11 @@ function Render({ config, data }) {
|
|
34878
34874
|
title,
|
34879
34875
|
editMode: false,
|
34880
34876
|
id: "puck-root",
|
34881
|
-
children: /* @__PURE__ */ (0,
|
34877
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZone, { zone: rootDroppableId })
|
34882
34878
|
})
|
34883
34879
|
) });
|
34884
34880
|
}
|
34885
|
-
return /* @__PURE__ */ (0,
|
34881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZone, { zone: rootDroppableId }) });
|
34886
34882
|
}
|
34887
34883
|
|
34888
34884
|
// lib/resolve-all-data.ts
|