@measured/puck 0.12.0-canary.0c4514f → 0.12.0-canary.27e3e7e
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-a03de579.d.ts} +1 -0
- package/dist/index.css +287 -150
- package/dist/index.d.ts +4 -4
- package/dist/index.js +406 -516
- package/dist/rsc.d.ts +1 -1
- package/package.json +8 -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 Fragment13 = 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 = Fragment13;
|
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 = getClassName19(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 getClassName19(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 Fragment13 = 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 Fragment13:
|
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 !== Fragment13) {
|
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 === Fragment13) {
|
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 Fragment13:
|
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 Fragment13:
|
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(Fragment13, 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_zx1c8_1", "Button--medium": "_Button--medium_zx1c8_21", "Button--large": "_Button--large_zx1c8_28", "Button-icon": "_Button-icon_zx1c8_35", "Button--primary": "_Button--primary_zx1c8_43", "Button--secondary": "_Button--secondary_zx1c8_52", "Button--flush": "_Button--flush_zx1c8_63", "Button--disabled": "_Button--disabled_zx1c8_67", "Button--fullWidth": "_Button--fullWidth_zx1c8_77" };
|
30129
30129
|
|
30130
30130
|
// lib/get-class-name-factory.ts
|
30131
30131
|
init_react_import();
|
@@ -32359,7 +32359,7 @@ var IconButton = ({
|
|
32359
32359
|
|
32360
32360
|
// components/Puck/index.tsx
|
32361
32361
|
init_react_import();
|
32362
|
-
var
|
32362
|
+
var import_react39 = require("react");
|
32363
32363
|
var import_dnd7 = require("@hello-pangea/dnd");
|
32364
32364
|
|
32365
32365
|
// components/InputOrGroup/index.tsx
|
@@ -32367,10 +32367,10 @@ init_react_import();
|
|
32367
32367
|
|
32368
32368
|
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css#css-module
|
32369
32369
|
init_react_import();
|
32370
|
-
var styles_module_default3 = { "Input": "
|
32370
|
+
var styles_module_default3 = { "Input": "_Input_199j9_1", "Input-label": "_Input-label_199j9_27", "Input-labelIcon": "_Input-labelIcon_199j9_35", "Input-disabledIcon": "_Input-disabledIcon_199j9_41", "Input-input": "_Input-input_199j9_46", "Input--readOnly": "_Input--readOnly_199j9_68", "Input-radioGroupItems": "_Input-radioGroupItems_199j9_86", "Input-radio": "_Input-radio_199j9_86", "Input-radioInner": "_Input-radioInner_199j9_103", "Input-radioInput": "_Input-radioInput_199j9_125" };
|
32371
32371
|
|
32372
32372
|
// components/InputOrGroup/index.tsx
|
32373
|
-
var
|
32373
|
+
var import_react31 = require("react");
|
32374
32374
|
|
32375
32375
|
// components/InputOrGroup/fields/index.tsx
|
32376
32376
|
init_react_import();
|
@@ -32380,7 +32380,7 @@ init_react_import();
|
|
32380
32380
|
|
32381
32381
|
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ArrayField/styles.module.css#css-module
|
32382
32382
|
init_react_import();
|
32383
|
-
var styles_module_default4 = { "ArrayField": "
|
32383
|
+
var styles_module_default4 = { "ArrayField": "_ArrayField_hsw7n_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_hsw7n_13", "ArrayField-addButton": "_ArrayField-addButton_hsw7n_17", "ArrayField--hasItems": "_ArrayField--hasItems_hsw7n_31", "ArrayFieldItem": "_ArrayFieldItem_hsw7n_45", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_hsw7n_53", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_hsw7n_58", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_hsw7n_73", "ArrayFieldItem--readOnly": "_ArrayFieldItem--readOnly_hsw7n_86", "ArrayFieldItem-body": "_ArrayFieldItem-body_hsw7n_107", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_hsw7n_115", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_hsw7n_122", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_hsw7n_128", "ArrayFieldItem-action": "_ArrayFieldItem-action_hsw7n_128" };
|
32384
32384
|
|
32385
32385
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
32386
32386
|
var import_dnd4 = require("@hello-pangea/dnd");
|
@@ -32469,30 +32469,37 @@ var ArrayField = ({
|
|
32469
32469
|
}) => {
|
32470
32470
|
const [arrayFieldId] = (0, import_react27.useState)(generateId("ArrayField"));
|
32471
32471
|
const { state, setUi } = useAppContext();
|
32472
|
-
const
|
32473
|
-
|
32474
|
-
|
32475
|
-
|
32476
|
-
}
|
32477
|
-
|
32478
|
-
|
32472
|
+
const arrayStateRef = (0, import_react27.useRef)(
|
32473
|
+
state.ui.arrayState[arrayFieldId] || {
|
32474
|
+
items: [],
|
32475
|
+
openId: ""
|
32476
|
+
}
|
32477
|
+
);
|
32478
|
+
const arrayState = arrayStateRef.current;
|
32479
32479
|
const setArrayState = (0, import_react27.useCallback)(
|
32480
|
-
(
|
32480
|
+
(partialArrayState, recordHistory = false) => {
|
32481
32481
|
setUi(
|
32482
32482
|
{
|
32483
32483
|
arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
|
32484
|
-
[arrayFieldId]: __spreadValues(__spreadValues({}, arrayState),
|
32484
|
+
[arrayFieldId]: __spreadValues(__spreadValues({}, arrayState), partialArrayState)
|
32485
32485
|
})
|
32486
32486
|
},
|
32487
32487
|
recordHistory
|
32488
32488
|
);
|
32489
|
+
arrayStateRef.current = __spreadValues(__spreadValues({}, arrayState), partialArrayState);
|
32489
32490
|
},
|
32490
32491
|
[arrayState]
|
32491
32492
|
);
|
32492
32493
|
(0, import_react27.useEffect)(() => {
|
32494
|
+
let highestIndex = arrayState.items.reduce(
|
32495
|
+
(acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
|
32496
|
+
-1
|
32497
|
+
);
|
32493
32498
|
const newItems = Array.from(value || []).map((item, idx) => {
|
32494
32499
|
var _a;
|
32500
|
+
const arrayStateItem = arrayState.items[idx];
|
32495
32501
|
return {
|
32502
|
+
_originalIndex: typeof (arrayStateItem == null ? void 0 : arrayStateItem._originalIndex) !== "undefined" ? arrayStateItem._originalIndex : ++highestIndex,
|
32496
32503
|
_arrayId: ((_a = arrayState.items[idx]) == null ? void 0 : _a._arrayId) || generateId("ArrayItem"),
|
32497
32504
|
data: item
|
32498
32505
|
};
|
@@ -32534,97 +32541,95 @@ var ArrayField = ({
|
|
32534
32541
|
hasItems: Array.isArray(value) && value.length > 0
|
32535
32542
|
}),
|
32536
32543
|
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,
|
32544
|
+
arrayState.items.map(({ data }, i) => {
|
32545
|
+
const { _arrayId, _originalIndex = i } = arrayState.items[i] || {};
|
32546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32547
|
+
Draggable2,
|
32548
|
+
{
|
32549
|
+
id: _arrayId,
|
32550
|
+
index: i,
|
32551
|
+
className: (_, snapshot2) => getClassNameItem({
|
32552
|
+
isExpanded: arrayState.openId === _arrayId,
|
32553
|
+
isDragging: snapshot2.isDragging,
|
32554
|
+
readOnly
|
32555
|
+
}),
|
32556
|
+
isDragDisabled: readOnly,
|
32557
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
32558
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
32559
|
+
"div",
|
32560
|
+
{
|
32561
|
+
onClick: () => {
|
32562
|
+
if (arrayState.openId === _arrayId) {
|
32563
|
+
setArrayState({
|
32564
|
+
openId: ""
|
32565
|
+
});
|
32566
|
+
} else {
|
32567
|
+
setArrayState({
|
32568
|
+
openId: _arrayId
|
32569
|
+
});
|
32570
|
+
}
|
32571
|
+
},
|
32572
|
+
className: getClassNameItem("summary"),
|
32573
|
+
children: [
|
32574
|
+
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
32575
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassNameItem("rhs"), children: [
|
32576
|
+
!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)(
|
32577
|
+
IconButton,
|
32578
|
+
{
|
32579
|
+
onClick: (e) => {
|
32580
|
+
e.stopPropagation();
|
32581
|
+
const existingValue = [
|
32582
|
+
...value || []
|
32583
|
+
];
|
32584
|
+
const existingItems = [
|
32585
|
+
...arrayState.items || []
|
32586
|
+
];
|
32587
|
+
existingValue.splice(i, 1);
|
32588
|
+
existingItems.splice(i, 1);
|
32589
|
+
setArrayState(
|
32590
|
+
{ items: existingItems },
|
32591
|
+
true
|
32592
|
+
);
|
32593
|
+
onChange(existingValue);
|
32594
|
+
},
|
32595
|
+
title: "Delete",
|
32596
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(trash_default, { size: 16 })
|
32597
|
+
}
|
32598
|
+
) }) }),
|
32599
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DragIcon, {}) })
|
32600
|
+
] })
|
32601
|
+
]
|
32602
|
+
}
|
32603
|
+
),
|
32604
|
+
/* @__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(
|
32605
|
+
(fieldName) => {
|
32606
|
+
const subField = field.arrayFields[fieldName];
|
32607
|
+
const subFieldName = `${name}[${i}].${fieldName}`;
|
32608
|
+
const wildcardFieldName = `${name}[*].${fieldName}`;
|
32609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32610
|
+
InputOrGroup,
|
32611
|
+
{
|
32612
|
+
name: subFieldName,
|
32613
|
+
label: subField.label || fieldName,
|
32614
|
+
readOnly: typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName],
|
32615
|
+
readOnlyFields,
|
32616
|
+
field: subField,
|
32617
|
+
value: data[fieldName],
|
32618
|
+
onChange: (val) => onChange(
|
32619
|
+
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
32620
|
+
[fieldName]: val
|
32621
|
+
}))
|
32622
|
+
)
|
32623
|
+
},
|
32624
|
+
subFieldName
|
32625
|
+
);
|
32626
|
+
}
|
32627
|
+
) }) })
|
32628
|
+
] })
|
32629
|
+
},
|
32630
|
+
_arrayId
|
32631
|
+
);
|
32632
|
+
}),
|
32628
32633
|
provided.placeholder,
|
32629
32634
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32630
32635
|
"button",
|
@@ -32692,18 +32697,19 @@ var DefaultField = ({
|
|
32692
32697
|
|
32693
32698
|
// components/InputOrGroup/fields/ExternalField/index.tsx
|
32694
32699
|
init_react_import();
|
32695
|
-
var
|
32700
|
+
var import_react30 = require("react");
|
32696
32701
|
|
32697
32702
|
// components/ExternalInput/index.tsx
|
32698
32703
|
init_react_import();
|
32699
|
-
var
|
32704
|
+
var import_react29 = require("react");
|
32700
32705
|
|
32701
32706
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
32702
32707
|
init_react_import();
|
32703
|
-
var styles_module_default6 = { "ExternalInput": "
|
32708
|
+
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
32709
|
|
32705
32710
|
// components/Modal/index.tsx
|
32706
32711
|
init_react_import();
|
32712
|
+
var import_react28 = require("react");
|
32707
32713
|
|
32708
32714
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
32709
32715
|
init_react_import();
|
@@ -32718,7 +32724,10 @@ var Modal = ({
|
|
32718
32724
|
onClose,
|
32719
32725
|
isOpen
|
32720
32726
|
}) => {
|
32721
|
-
const rootEl =
|
32727
|
+
const [rootEl, setRootEl] = (0, import_react28.useState)(null);
|
32728
|
+
(0, import_react28.useEffect)(() => {
|
32729
|
+
setRootEl(document.getElementById("puck-portal-root"));
|
32730
|
+
}, []);
|
32722
32731
|
if (!rootEl) {
|
32723
32732
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {});
|
32724
32733
|
}
|
@@ -32771,10 +32780,10 @@ var ExternalInput = ({
|
|
32771
32780
|
name
|
32772
32781
|
}) => {
|
32773
32782
|
const { mapProp = (val) => val } = field || {};
|
32774
|
-
const [data, setData] = (0,
|
32775
|
-
const [isOpen, setOpen] = (0,
|
32776
|
-
const [isLoading, setIsLoading] = (0,
|
32777
|
-
const keys = (0,
|
32783
|
+
const [data, setData] = (0, import_react29.useState)([]);
|
32784
|
+
const [isOpen, setOpen] = (0, import_react29.useState)(false);
|
32785
|
+
const [isLoading, setIsLoading] = (0, import_react29.useState)(true);
|
32786
|
+
const keys = (0, import_react29.useMemo)(() => {
|
32778
32787
|
const validKeys = /* @__PURE__ */ new Set();
|
32779
32788
|
for (const item of data) {
|
32780
32789
|
for (const key of Object.keys(item)) {
|
@@ -32785,7 +32794,7 @@ var ExternalInput = ({
|
|
32785
32794
|
}
|
32786
32795
|
return Array.from(validKeys);
|
32787
32796
|
}, [data]);
|
32788
|
-
(0,
|
32797
|
+
(0, import_react29.useEffect)(() => {
|
32789
32798
|
(() => __async(void 0, null, function* () {
|
32790
32799
|
const listData = dataCache[name] || (yield field.fetchList());
|
32791
32800
|
if (listData) {
|
@@ -32884,7 +32893,7 @@ var ExternalField = ({
|
|
32884
32893
|
var _a, _b, _c;
|
32885
32894
|
const validField = field;
|
32886
32895
|
const deprecatedField = field;
|
32887
|
-
(0,
|
32896
|
+
(0, import_react30.useEffect)(() => {
|
32888
32897
|
if (deprecatedField.adaptor) {
|
32889
32898
|
console.error(
|
32890
32899
|
"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 +32915,7 @@ var ExternalField = ({
|
|
32906
32915
|
name,
|
32907
32916
|
field: __spreadProps(__spreadValues({}, validField), {
|
32908
32917
|
// DEPRECATED
|
32909
|
-
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder,
|
32918
|
+
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
|
32910
32919
|
mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
|
32911
32920
|
fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
|
32912
32921
|
return yield deprecatedField.adaptor.fetchList(
|
@@ -33101,7 +33110,7 @@ var FieldLabelInternal = ({
|
|
33101
33110
|
var InputOrGroup = (_a) => {
|
33102
33111
|
var _b = _a, { onChange } = _b, props = __objRest(_b, ["onChange"]);
|
33103
33112
|
const { name, field, value, readOnly } = props;
|
33104
|
-
const [localValue, setLocalValue] = (0,
|
33113
|
+
const [localValue, setLocalValue] = (0, import_react31.useState)(value);
|
33105
33114
|
const onChangeDb = (0, import_use_debounce2.useDebouncedCallback)(
|
33106
33115
|
(val) => {
|
33107
33116
|
onChange(val);
|
@@ -33109,11 +33118,11 @@ var InputOrGroup = (_a) => {
|
|
33109
33118
|
50,
|
33110
33119
|
{ leading: true }
|
33111
33120
|
);
|
33112
|
-
const onChangeLocal = (0,
|
33121
|
+
const onChangeLocal = (0, import_react31.useCallback)((val) => {
|
33113
33122
|
setLocalValue(val);
|
33114
33123
|
onChangeDb(val);
|
33115
33124
|
}, []);
|
33116
|
-
(0,
|
33125
|
+
(0, import_react31.useEffect)(() => {
|
33117
33126
|
setLocalValue(value);
|
33118
33127
|
}, [value]);
|
33119
33128
|
const localProps = {
|
@@ -33154,7 +33163,7 @@ var import_dnd6 = require("@hello-pangea/dnd");
|
|
33154
33163
|
|
33155
33164
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
33156
33165
|
init_react_import();
|
33157
|
-
var styles_module_default9 = { "ComponentList": "
|
33166
|
+
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" };
|
33158
33167
|
|
33159
33168
|
// components/ComponentList/index.tsx
|
33160
33169
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
@@ -33174,7 +33183,7 @@ var ComponentListItem = ({
|
|
33174
33183
|
disableAnimations: true,
|
33175
33184
|
className: () => getClassNameItem2("draggable"),
|
33176
33185
|
children: () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
33177
|
-
component,
|
33186
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameItem2("name"), children: component }),
|
33178
33187
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DragIcon, {}) })
|
33179
33188
|
] })
|
33180
33189
|
},
|
@@ -33243,10 +33252,10 @@ ComponentList.Item = ComponentListItem;
|
|
33243
33252
|
|
33244
33253
|
// lib/use-placeholder-style.ts
|
33245
33254
|
init_react_import();
|
33246
|
-
var
|
33255
|
+
var import_react32 = require("react");
|
33247
33256
|
var usePlaceholderStyle = () => {
|
33248
33257
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
33249
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
33258
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react32.useState)();
|
33250
33259
|
const onDragStartOrUpdate = (draggedItem) => {
|
33251
33260
|
var _a;
|
33252
33261
|
const draggableId = draggedItem.draggableId;
|
@@ -33294,11 +33303,11 @@ init_react_import();
|
|
33294
33303
|
|
33295
33304
|
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
33296
33305
|
init_react_import();
|
33297
|
-
var styles_module_default10 = { "SidebarSection": "
|
33306
|
+
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" };
|
33298
33307
|
|
33299
33308
|
// lib/use-breadcrumbs.ts
|
33300
33309
|
init_react_import();
|
33301
|
-
var
|
33310
|
+
var import_react33 = require("react");
|
33302
33311
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
33303
33312
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
33304
33313
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -33348,8 +33357,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
33348
33357
|
state: { data },
|
33349
33358
|
selectedItem
|
33350
33359
|
} = useAppContext();
|
33351
|
-
const dzContext = (0,
|
33352
|
-
return (0,
|
33360
|
+
const dzContext = (0, import_react33.useContext)(dropZoneContext);
|
33361
|
+
return (0, import_react33.useMemo)(() => {
|
33353
33362
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
33354
33363
|
selectedItem,
|
33355
33364
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -33401,15 +33410,15 @@ init_react_import();
|
|
33401
33410
|
|
33402
33411
|
// lib/use-puck-history.ts
|
33403
33412
|
init_react_import();
|
33404
|
-
var
|
33413
|
+
var import_react35 = require("react");
|
33405
33414
|
|
33406
33415
|
// lib/use-action-history.ts
|
33407
33416
|
init_react_import();
|
33408
|
-
var
|
33417
|
+
var import_react34 = require("react");
|
33409
33418
|
var EMPTY_HISTORY_INDEX = -1;
|
33410
33419
|
function useActionHistory() {
|
33411
|
-
const [histories, setHistories] = (0,
|
33412
|
-
const [currentHistoryIndex, setCurrentHistoryIndex] = (0,
|
33420
|
+
const [histories, setHistories] = (0, import_react34.useState)([]);
|
33421
|
+
const [currentHistoryIndex, setCurrentHistoryIndex] = (0, import_react34.useState)(EMPTY_HISTORY_INDEX);
|
33413
33422
|
const currentHistory = histories[currentHistoryIndex];
|
33414
33423
|
const canRewind = currentHistoryIndex > EMPTY_HISTORY_INDEX;
|
33415
33424
|
const canForward = currentHistoryIndex < histories.length - 1;
|
@@ -33488,7 +33497,7 @@ function usePuckHistory({
|
|
33488
33497
|
dispatch
|
33489
33498
|
});
|
33490
33499
|
}, DEBOUNCE_TIME);
|
33491
|
-
(0,
|
33500
|
+
(0, import_react35.useEffect)(() => {
|
33492
33501
|
historyEmitter.on(RECORD_DIFF, handleRecordDiff);
|
33493
33502
|
return () => {
|
33494
33503
|
historyEmitter.off(RECORD_DIFF, handleRecordDiff);
|
@@ -33830,7 +33839,7 @@ init_react_import();
|
|
33830
33839
|
|
33831
33840
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
33832
33841
|
init_react_import();
|
33833
|
-
var styles_module_default11 = { "LayerTree": "
|
33842
|
+
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" };
|
33834
33843
|
|
33835
33844
|
// lib/scroll-into-view.ts
|
33836
33845
|
init_react_import();
|
@@ -33844,7 +33853,7 @@ var scrollIntoView = (el) => {
|
|
33844
33853
|
};
|
33845
33854
|
|
33846
33855
|
// components/LayerTree/index.tsx
|
33847
|
-
var
|
33856
|
+
var import_react36 = require("react");
|
33848
33857
|
|
33849
33858
|
// lib/find-zones-for-area.ts
|
33850
33859
|
init_react_import();
|
@@ -33882,7 +33891,7 @@ var LayerTree = ({
|
|
33882
33891
|
label
|
33883
33892
|
}) => {
|
33884
33893
|
const zones = data.zones || {};
|
33885
|
-
const ctx = (0,
|
33894
|
+
const ctx = (0, import_react36.useContext)(dropZoneContext);
|
33886
33895
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
33887
33896
|
label && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName17("zoneTitle"), children: [
|
33888
33897
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(layers_default, { size: "16" }) }),
|
@@ -33956,7 +33965,7 @@ var LayerTree = ({
|
|
33956
33965
|
),
|
33957
33966
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
33958
33967
|
/* @__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" }) }),
|
33959
|
-
item.type
|
33968
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("name"), children: item.type })
|
33960
33969
|
] })
|
33961
33970
|
]
|
33962
33971
|
}
|
@@ -34007,11 +34016,11 @@ var flushZones = (appState) => {
|
|
34007
34016
|
|
34008
34017
|
// lib/use-component-list.tsx
|
34009
34018
|
init_react_import();
|
34010
|
-
var
|
34019
|
+
var import_react37 = require("react");
|
34011
34020
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
34012
34021
|
var useComponentList = (config, ui) => {
|
34013
|
-
const [componentList, setComponentList] = (0,
|
34014
|
-
(0,
|
34022
|
+
const [componentList, setComponentList] = (0, import_react37.useState)();
|
34023
|
+
(0, import_react37.useEffect)(() => {
|
34015
34024
|
var _a, _b, _c;
|
34016
34025
|
if (Object.keys(ui.componentList).length > 0) {
|
34017
34026
|
const matchedComponents = [];
|
@@ -34077,7 +34086,7 @@ var useComponentList = (config, ui) => {
|
|
34077
34086
|
|
34078
34087
|
// lib/use-resolved-data.ts
|
34079
34088
|
init_react_import();
|
34080
|
-
var
|
34089
|
+
var import_react38 = require("react");
|
34081
34090
|
|
34082
34091
|
// lib/resolve-component-data.ts
|
34083
34092
|
init_react_import();
|
@@ -34192,19 +34201,19 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
|
|
34192
34201
|
|
34193
34202
|
// lib/use-resolved-data.ts
|
34194
34203
|
var useResolvedData = (data, config, dispatch) => {
|
34195
|
-
const [{ resolverKey, newData }, setResolverState] = (0,
|
34204
|
+
const [{ resolverKey, newData }, setResolverState] = (0, import_react38.useState)({
|
34196
34205
|
resolverKey: 0,
|
34197
34206
|
newData: data
|
34198
34207
|
});
|
34199
|
-
const [componentState, setComponentState] = (0,
|
34208
|
+
const [componentState, setComponentState] = (0, import_react38.useState)({});
|
34200
34209
|
const deferredSetStates = {};
|
34201
|
-
const setComponentLoading = (0,
|
34210
|
+
const setComponentLoading = (0, import_react38.useCallback)(
|
34202
34211
|
(id, loading, defer = 0) => {
|
34203
34212
|
if (deferredSetStates[id]) {
|
34204
34213
|
clearTimeout(deferredSetStates[id]);
|
34205
34214
|
delete deferredSetStates[id];
|
34206
34215
|
}
|
34207
|
-
|
34216
|
+
deferredSetStates[id] = setTimeout(() => {
|
34208
34217
|
setComponentState((prev) => __spreadProps(__spreadValues({}, prev), {
|
34209
34218
|
[id]: __spreadProps(__spreadValues({}, prev[id]), { loading })
|
34210
34219
|
}));
|
@@ -34256,10 +34265,10 @@ var useResolvedData = (data, config, dispatch) => {
|
|
34256
34265
|
});
|
34257
34266
|
yield Promise.all(promises);
|
34258
34267
|
});
|
34259
|
-
(0,
|
34268
|
+
(0, import_react38.useEffect)(() => {
|
34260
34269
|
runResolvers();
|
34261
34270
|
}, [resolverKey]);
|
34262
|
-
const resolveData = (0,
|
34271
|
+
const resolveData = (0, import_react38.useCallback)((newData2 = data) => {
|
34263
34272
|
setResolverState((curr) => ({
|
34264
34273
|
resolverKey: curr.resolverKey + 1,
|
34265
34274
|
newData: newData2
|
@@ -34271,8 +34280,13 @@ var useResolvedData = (data, config, dispatch) => {
|
|
34271
34280
|
};
|
34272
34281
|
};
|
34273
34282
|
|
34283
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
34284
|
+
init_react_import();
|
34285
|
+
var styles_module_default12 = { "Puck": "_Puck_vj9gy_19", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_vj9gy_36", "Puck-header": "_Puck-header_vj9gy_72", "Puck-headerInner": "_Puck-headerInner_vj9gy_79", "Puck-headerToggle": "_Puck-headerToggle_vj9gy_89", "Puck-headerTitle": "_Puck-headerTitle_vj9gy_93", "Puck-headerPath": "_Puck-headerPath_vj9gy_97", "Puck-headerTools": "_Puck-headerTools_vj9gy_104", "Puck-leftSideBar": "_Puck-leftSideBar_vj9gy_110", "Puck-frame": "_Puck-frame_vj9gy_119", "Puck-root": "_Puck-root_vj9gy_127", "Puck-page": "_Puck-page_vj9gy_139", "Puck-rightSideBar": "_Puck-rightSideBar_vj9gy_143" };
|
34286
|
+
|
34274
34287
|
// components/Puck/index.tsx
|
34275
34288
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
34289
|
+
var getClassName18 = get_class_name_factory_default("Puck", styles_module_default12);
|
34276
34290
|
var defaultPageFields = {
|
34277
34291
|
title: { type: "text" }
|
34278
34292
|
};
|
@@ -34301,8 +34315,8 @@ function Puck({
|
|
34301
34315
|
headerPath
|
34302
34316
|
}) {
|
34303
34317
|
var _a, _b;
|
34304
|
-
const [reducer] = (0,
|
34305
|
-
const [initialAppState] = (0,
|
34318
|
+
const [reducer] = (0, import_react39.useState)(() => createReducer({ config }));
|
34319
|
+
const [initialAppState] = (0, import_react39.useState)(__spreadProps(__spreadValues({}, defaultAppState), {
|
34306
34320
|
data: initialData,
|
34307
34321
|
ui: __spreadProps(__spreadValues({}, defaultAppState.ui), {
|
34308
34322
|
// Store categories under componentList on state to allow render functions and plugins to modify
|
@@ -34321,7 +34335,7 @@ function Puck({
|
|
34321
34335
|
) : {}
|
34322
34336
|
})
|
34323
34337
|
}));
|
34324
|
-
const [appState, dispatch] = (0,
|
34338
|
+
const [appState, dispatch] = (0, import_react39.useReducer)(
|
34325
34339
|
reducer,
|
34326
34340
|
flushZones(initialAppState)
|
34327
34341
|
);
|
@@ -34336,7 +34350,7 @@ function Puck({
|
|
34336
34350
|
dispatch
|
34337
34351
|
});
|
34338
34352
|
const { itemSelector, leftSideBarVisible } = ui;
|
34339
|
-
const setItemSelector = (0,
|
34353
|
+
const setItemSelector = (0, import_react39.useCallback)(
|
34340
34354
|
(newItemSelector) => {
|
34341
34355
|
dispatch({
|
34342
34356
|
type: "setUi",
|
@@ -34346,7 +34360,7 @@ function Puck({
|
|
34346
34360
|
[]
|
34347
34361
|
);
|
34348
34362
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
34349
|
-
const Page = (0,
|
34363
|
+
const Page = (0, import_react39.useCallback)(
|
34350
34364
|
(pageProps) => {
|
34351
34365
|
var _a2, _b2;
|
34352
34366
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
@@ -34362,7 +34376,7 @@ function Puck({
|
|
34362
34376
|
},
|
34363
34377
|
[config.root]
|
34364
34378
|
);
|
34365
|
-
const PageFieldWrapper = (0,
|
34379
|
+
const PageFieldWrapper = (0, import_react39.useCallback)(
|
34366
34380
|
(props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34367
34381
|
PluginRenderer,
|
34368
34382
|
{
|
@@ -34375,7 +34389,7 @@ function Puck({
|
|
34375
34389
|
),
|
34376
34390
|
[]
|
34377
34391
|
);
|
34378
|
-
const ComponentFieldWrapper = (0,
|
34392
|
+
const ComponentFieldWrapper = (0, import_react39.useCallback)(
|
34379
34393
|
(props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34380
34394
|
PluginRenderer,
|
34381
34395
|
{
|
@@ -34388,7 +34402,7 @@ function Puck({
|
|
34388
34402
|
),
|
34389
34403
|
[]
|
34390
34404
|
);
|
34391
|
-
const ComponentListWrapper = (0,
|
34405
|
+
const ComponentListWrapper = (0, import_react39.useCallback)((props) => {
|
34392
34406
|
const children = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34393
34407
|
PluginRenderer,
|
34394
34408
|
{
|
@@ -34408,22 +34422,22 @@ function Puck({
|
|
34408
34422
|
const FieldWrapper = itemSelector ? ComponentFieldWrapper : PageFieldWrapper;
|
34409
34423
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
34410
34424
|
let fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
|
34411
|
-
(0,
|
34425
|
+
(0, import_react39.useEffect)(() => {
|
34412
34426
|
if (onChange)
|
34413
34427
|
onChange(data);
|
34414
34428
|
}, [data]);
|
34415
34429
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
34416
|
-
const [draggedItem, setDraggedItem] = (0,
|
34430
|
+
const [draggedItem, setDraggedItem] = (0, import_react39.useState)();
|
34417
34431
|
const componentList = useComponentList(config, appState.ui);
|
34418
34432
|
const rootProps = data.root.props || data.root;
|
34419
|
-
(0,
|
34433
|
+
(0, import_react39.useEffect)(() => {
|
34420
34434
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
34421
34435
|
console.error(
|
34422
34436
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
34423
34437
|
);
|
34424
34438
|
}
|
34425
34439
|
}, []);
|
34426
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", {
|
34440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
|
34427
34441
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34428
34442
|
AppProvider,
|
34429
34443
|
{
|
@@ -34497,361 +34511,237 @@ function Puck({
|
|
34497
34511
|
},
|
34498
34512
|
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(dropZoneContext.Consumer, { children: (ctx) => {
|
34499
34513
|
var _a2, _b2;
|
34500
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34501
|
-
"
|
34502
|
-
|
34503
|
-
|
34504
|
-
|
34505
|
-
|
34506
|
-
|
34507
|
-
|
34508
|
-
|
34509
|
-
|
34510
|
-
|
34511
|
-
|
34512
|
-
|
34513
|
-
|
34514
|
-
|
34515
|
-
children:
|
34516
|
-
|
34517
|
-
|
34518
|
-
{
|
34519
|
-
|
34520
|
-
|
34521
|
-
|
34522
|
-
|
34523
|
-
|
34524
|
-
|
34525
|
-
|
34514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18({ leftSideBarVisible }), children: [
|
34515
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("header", { className: getClassName18("header"), children: renderHeader ? renderHeader({
|
34516
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34517
|
+
Button,
|
34518
|
+
{
|
34519
|
+
onClick: () => {
|
34520
|
+
onPublish(data);
|
34521
|
+
},
|
34522
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
|
34523
|
+
children: "Publish"
|
34524
|
+
}
|
34525
|
+
),
|
34526
|
+
dispatch,
|
34527
|
+
state: appState
|
34528
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18("headerInner"), children: [
|
34529
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("headerToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34530
|
+
IconButton,
|
34531
|
+
{
|
34532
|
+
onClick: () => dispatch({
|
34533
|
+
type: "setUi",
|
34534
|
+
ui: {
|
34535
|
+
leftSideBarVisible: !leftSideBarVisible
|
34536
|
+
}
|
34537
|
+
}),
|
34538
|
+
title: "Toggle left sidebar",
|
34539
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(sidebar_default, {})
|
34540
|
+
}
|
34541
|
+
) }),
|
34542
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
34543
|
+
headerTitle || rootProps.title || "Page",
|
34544
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
34545
|
+
" ",
|
34546
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("code", { className: getClassName18("headerPath"), children: headerPath })
|
34547
|
+
] })
|
34548
|
+
] }) }),
|
34549
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18("headerTools"), children: [
|
34550
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex" }, children: [
|
34551
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34552
|
+
IconButton,
|
34553
|
+
{
|
34554
|
+
title: "undo",
|
34555
|
+
disabled: !canRewind,
|
34556
|
+
onClick: rewind,
|
34526
34557
|
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34527
|
-
|
34558
|
+
chevron_left_default,
|
34528
34559
|
{
|
34529
|
-
|
34530
|
-
|
34531
|
-
},
|
34532
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
|
34533
|
-
children: "Publish"
|
34560
|
+
size: 21,
|
34561
|
+
stroke: canRewind ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
|
34534
34562
|
}
|
34535
|
-
)
|
34536
|
-
|
34537
|
-
|
34538
|
-
|
34539
|
-
|
34540
|
-
|
34541
|
-
|
34542
|
-
|
34543
|
-
|
34544
|
-
|
34545
|
-
|
34546
|
-
|
34547
|
-
|
34548
|
-
|
34549
|
-
|
34550
|
-
|
34551
|
-
|
34552
|
-
|
34553
|
-
|
34554
|
-
|
34555
|
-
|
34556
|
-
|
34557
|
-
|
34558
|
-
|
34559
|
-
|
34560
|
-
type: "setUi",
|
34561
|
-
ui: {
|
34562
|
-
leftSideBarVisible: !leftSideBarVisible
|
34563
|
-
}
|
34564
|
-
}),
|
34565
|
-
title: "Toggle left sidebar",
|
34566
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(sidebar_default, {})
|
34567
|
-
}
|
34568
|
-
)
|
34569
|
-
}
|
34570
|
-
),
|
34571
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34572
|
-
"div",
|
34573
|
-
{
|
34574
|
-
style: {
|
34575
|
-
display: "flex",
|
34576
|
-
justifyContent: "center",
|
34577
|
-
alignItems: "center"
|
34578
|
-
},
|
34579
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
34580
|
-
headerTitle || rootProps.title || "Page",
|
34581
|
-
headerPath && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34582
|
-
"small",
|
34583
|
-
{
|
34584
|
-
style: { fontWeight: 400, marginLeft: 4 },
|
34585
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("code", { children: headerPath })
|
34586
|
-
}
|
34587
|
-
)
|
34588
|
-
] })
|
34589
|
-
}
|
34590
|
-
),
|
34591
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34592
|
-
"div",
|
34593
|
-
{
|
34594
|
-
style: {
|
34595
|
-
display: "flex",
|
34596
|
-
gap: 16,
|
34597
|
-
justifyContent: "flex-end"
|
34598
|
-
},
|
34599
|
-
children: [
|
34600
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex" }, children: [
|
34601
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34602
|
-
IconButton,
|
34603
|
-
{
|
34604
|
-
title: "undo",
|
34605
|
-
disabled: !canRewind,
|
34606
|
-
onClick: rewind,
|
34607
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34608
|
-
chevron_left_default,
|
34609
|
-
{
|
34610
|
-
size: 21,
|
34611
|
-
stroke: canRewind ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
|
34612
|
-
}
|
34613
|
-
)
|
34614
|
-
}
|
34615
|
-
),
|
34616
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34617
|
-
IconButton,
|
34618
|
-
{
|
34619
|
-
title: "redo",
|
34620
|
-
disabled: !canForward,
|
34621
|
-
onClick: forward,
|
34622
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34623
|
-
chevron_right_default,
|
34624
|
-
{
|
34625
|
-
size: 21,
|
34626
|
-
stroke: canForward ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
|
34627
|
-
}
|
34628
|
-
)
|
34629
|
-
}
|
34630
|
-
)
|
34631
|
-
] }),
|
34632
|
-
renderHeaderActions && renderHeaderActions({
|
34633
|
-
state: appState,
|
34634
|
-
dispatch
|
34635
|
-
}),
|
34636
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34637
|
-
Button,
|
34638
|
-
{
|
34639
|
-
onClick: () => {
|
34640
|
-
onPublish(data);
|
34641
|
-
},
|
34642
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
|
34643
|
-
children: "Publish"
|
34644
|
-
}
|
34645
|
-
)
|
34646
|
-
]
|
34647
|
-
}
|
34648
|
-
)
|
34649
|
-
]
|
34650
|
-
}
|
34651
|
-
)
|
34652
|
-
}
|
34653
|
-
),
|
34654
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34655
|
-
"div",
|
34563
|
+
)
|
34564
|
+
}
|
34565
|
+
),
|
34566
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34567
|
+
IconButton,
|
34568
|
+
{
|
34569
|
+
title: "redo",
|
34570
|
+
disabled: !canForward,
|
34571
|
+
onClick: forward,
|
34572
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34573
|
+
chevron_right_default,
|
34574
|
+
{
|
34575
|
+
size: 21,
|
34576
|
+
stroke: canForward ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
|
34577
|
+
}
|
34578
|
+
)
|
34579
|
+
}
|
34580
|
+
)
|
34581
|
+
] }),
|
34582
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { children: renderHeaderActions && renderHeaderActions({
|
34583
|
+
state: appState,
|
34584
|
+
dispatch
|
34585
|
+
}) }),
|
34586
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34587
|
+
Button,
|
34656
34588
|
{
|
34657
|
-
|
34658
|
-
|
34659
|
-
background: "var(--puck-color-grey-11)",
|
34660
|
-
borderRight: "1px solid var(--puck-color-grey-8)",
|
34661
|
-
overflowY: "auto",
|
34662
|
-
display: "flex",
|
34663
|
-
flexDirection: "column"
|
34589
|
+
onClick: () => {
|
34590
|
+
onPublish(data);
|
34664
34591
|
},
|
34665
|
-
|
34666
|
-
|
34667
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SidebarSection, { title: "Outline", children: [
|
34668
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34669
|
-
LayerTree,
|
34670
|
-
{
|
34671
|
-
data,
|
34672
|
-
label: areaContainsZones(data, "root") ? rootDroppableId : "",
|
34673
|
-
zoneContent: data.content,
|
34674
|
-
setItemSelector,
|
34675
|
-
itemSelector
|
34676
|
-
}
|
34677
|
-
),
|
34678
|
-
Object.entries(findZonesForArea(data, "root")).map(
|
34679
|
-
([zoneKey, zone]) => {
|
34680
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34681
|
-
LayerTree,
|
34682
|
-
{
|
34683
|
-
data,
|
34684
|
-
label: zoneKey,
|
34685
|
-
zone: zoneKey,
|
34686
|
-
zoneContent: zone,
|
34687
|
-
setItemSelector,
|
34688
|
-
itemSelector
|
34689
|
-
},
|
34690
|
-
zoneKey
|
34691
|
-
);
|
34692
|
-
}
|
34693
|
-
)
|
34694
|
-
] })
|
34695
|
-
]
|
34592
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
|
34593
|
+
children: "Publish"
|
34696
34594
|
}
|
34697
|
-
)
|
34698
|
-
|
34699
|
-
|
34595
|
+
) })
|
34596
|
+
] })
|
34597
|
+
] }) }),
|
34598
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18("leftSideBar"), children: [
|
34599
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SidebarSection, { title: "Components", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ComponentListWrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ComponentList, { id: "all" }) }) }),
|
34600
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SidebarSection, { title: "Outline", children: [
|
34601
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34602
|
+
LayerTree,
|
34700
34603
|
{
|
34701
|
-
|
34702
|
-
|
34703
|
-
|
34704
|
-
|
34705
|
-
|
34706
|
-
flexDirection: "column"
|
34707
|
-
},
|
34708
|
-
onClick: () => setItemSelector(null),
|
34709
|
-
id: "puck-frame",
|
34710
|
-
children: [
|
34711
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34712
|
-
"div",
|
34713
|
-
{
|
34714
|
-
className: "puck-root",
|
34715
|
-
style: {
|
34716
|
-
boxShadow: "0px 0px 0px 32px var(--puck-color-grey-10)",
|
34717
|
-
margin: 32,
|
34718
|
-
zoom: 0.75
|
34719
|
-
},
|
34720
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34721
|
-
"div",
|
34722
|
-
{
|
34723
|
-
style: {
|
34724
|
-
border: "1px solid var(--puck-color-grey-8)"
|
34725
|
-
},
|
34726
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34727
|
-
Page,
|
34728
|
-
__spreadProps(__spreadValues({
|
34729
|
-
dispatch,
|
34730
|
-
state: appState
|
34731
|
-
}, data.root), {
|
34732
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZone, { zone: rootDroppableId })
|
34733
|
-
})
|
34734
|
-
)
|
34735
|
-
}
|
34736
|
-
)
|
34737
|
-
}
|
34738
|
-
),
|
34739
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34740
|
-
"div",
|
34741
|
-
{
|
34742
|
-
style: {
|
34743
|
-
background: "var(--puck-color-grey-10)",
|
34744
|
-
height: "100%",
|
34745
|
-
flexGrow: 1
|
34746
|
-
}
|
34747
|
-
}
|
34748
|
-
)
|
34749
|
-
]
|
34604
|
+
data,
|
34605
|
+
label: areaContainsZones(data, "root") ? rootDroppableId : "",
|
34606
|
+
zoneContent: data.content,
|
34607
|
+
setItemSelector,
|
34608
|
+
itemSelector
|
34750
34609
|
}
|
34751
34610
|
),
|
34752
|
-
|
34753
|
-
|
34754
|
-
|
34755
|
-
|
34756
|
-
borderLeft: "1px solid var(--puck-color-grey-8)",
|
34757
|
-
overflowY: "auto",
|
34758
|
-
gridArea: "right",
|
34759
|
-
fontFamily: "var(--puck-font-stack)",
|
34760
|
-
display: "flex",
|
34761
|
-
flexDirection: "column",
|
34762
|
-
background: "var(--puck-color-white)"
|
34763
|
-
},
|
34764
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldWrapper, { dispatch, state: appState, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34765
|
-
SidebarSection,
|
34611
|
+
Object.entries(findZonesForArea(data, "root")).map(
|
34612
|
+
([zoneKey, zone]) => {
|
34613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34614
|
+
LayerTree,
|
34766
34615
|
{
|
34767
|
-
|
34768
|
-
|
34769
|
-
|
34770
|
-
|
34771
|
-
|
34772
|
-
|
34773
|
-
|
34774
|
-
|
34775
|
-
|
34776
|
-
if (selectedItem) {
|
34777
|
-
currentProps = selectedItem.props;
|
34778
|
-
} else {
|
34779
|
-
currentProps = data.root;
|
34780
|
-
}
|
34781
|
-
const newProps = __spreadProps(__spreadValues({}, currentProps), {
|
34782
|
-
[fieldName]: value
|
34783
|
-
});
|
34784
|
-
if (itemSelector) {
|
34785
|
-
const action = {
|
34786
|
-
type: "replace",
|
34787
|
-
destinationIndex: itemSelector.index,
|
34788
|
-
destinationZone: itemSelector.zone || rootDroppableId,
|
34789
|
-
data: __spreadProps(__spreadValues({}, selectedItem), { props: newProps })
|
34790
|
-
};
|
34791
|
-
if ((_a3 = config.components[selectedItem.type]) == null ? void 0 : _a3.resolveData) {
|
34792
|
-
resolveData(replaceAction(data, action));
|
34793
|
-
} else {
|
34794
|
-
dispatch(action);
|
34795
|
-
}
|
34796
|
-
} else {
|
34797
|
-
if (data.root.props) {
|
34798
|
-
if ((_b3 = config.root) == null ? void 0 : _b3.resolveData) {
|
34799
|
-
resolveData(__spreadProps(__spreadValues({}, data), {
|
34800
|
-
root: { props: { newProps } }
|
34801
|
-
}));
|
34802
|
-
} else {
|
34803
|
-
dispatch({
|
34804
|
-
type: "setData",
|
34805
|
-
data: { root: { props: { newProps } } }
|
34806
|
-
});
|
34807
|
-
}
|
34808
|
-
} else {
|
34809
|
-
dispatch({
|
34810
|
-
type: "setData",
|
34811
|
-
data: { root: newProps }
|
34812
|
-
});
|
34813
|
-
}
|
34814
|
-
}
|
34815
|
-
};
|
34816
|
-
if (selectedItem && itemSelector) {
|
34817
|
-
const { readOnly = {} } = selectedItem;
|
34818
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34819
|
-
InputOrGroup,
|
34820
|
-
{
|
34821
|
-
field,
|
34822
|
-
name: fieldName,
|
34823
|
-
label: field.label,
|
34824
|
-
readOnly: readOnly[fieldName],
|
34825
|
-
readOnlyFields: readOnly,
|
34826
|
-
value: selectedItem.props[fieldName],
|
34827
|
-
onChange: onChange2
|
34828
|
-
},
|
34829
|
-
`${selectedItem.props.id}_${fieldName}`
|
34830
|
-
);
|
34831
|
-
} else {
|
34832
|
-
const { readOnly = {} } = data.root;
|
34833
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34834
|
-
InputOrGroup,
|
34835
|
-
{
|
34836
|
-
field,
|
34837
|
-
name: fieldName,
|
34838
|
-
label: field.label,
|
34839
|
-
readOnly: readOnly[fieldName],
|
34840
|
-
readOnlyFields: readOnly,
|
34841
|
-
value: rootProps[fieldName],
|
34842
|
-
onChange: onChange2
|
34843
|
-
},
|
34844
|
-
`page_${fieldName}`
|
34845
|
-
);
|
34846
|
-
}
|
34847
|
-
})
|
34848
|
-
}
|
34849
|
-
) })
|
34616
|
+
data,
|
34617
|
+
label: zoneKey,
|
34618
|
+
zone: zoneKey,
|
34619
|
+
zoneContent: zone,
|
34620
|
+
setItemSelector,
|
34621
|
+
itemSelector
|
34622
|
+
},
|
34623
|
+
zoneKey
|
34624
|
+
);
|
34850
34625
|
}
|
34851
34626
|
)
|
34852
|
-
]
|
34853
|
-
}
|
34854
|
-
|
34627
|
+
] })
|
34628
|
+
] }),
|
34629
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34630
|
+
"div",
|
34631
|
+
{
|
34632
|
+
className: getClassName18("frame"),
|
34633
|
+
onClick: () => setItemSelector(null),
|
34634
|
+
id: "puck-frame",
|
34635
|
+
children: [
|
34636
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("root"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("page"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34637
|
+
Page,
|
34638
|
+
__spreadProps(__spreadValues({
|
34639
|
+
dispatch,
|
34640
|
+
state: appState
|
34641
|
+
}, rootProps), {
|
34642
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZone, { zone: rootDroppableId })
|
34643
|
+
})
|
34644
|
+
) }) }),
|
34645
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34646
|
+
"div",
|
34647
|
+
{
|
34648
|
+
style: {
|
34649
|
+
background: "var(--puck-color-grey-10)",
|
34650
|
+
height: "100%",
|
34651
|
+
flexGrow: 1
|
34652
|
+
}
|
34653
|
+
}
|
34654
|
+
)
|
34655
|
+
]
|
34656
|
+
}
|
34657
|
+
),
|
34658
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldWrapper, { dispatch, state: appState, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34659
|
+
SidebarSection,
|
34660
|
+
{
|
34661
|
+
noPadding: true,
|
34662
|
+
showBreadcrumbs: true,
|
34663
|
+
title: selectedItem ? selectedItem.type : "Page",
|
34664
|
+
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,
|
34665
|
+
children: Object.keys(fields).map((fieldName) => {
|
34666
|
+
const field = fields[fieldName];
|
34667
|
+
const onChange2 = (value) => {
|
34668
|
+
var _a3, _b3;
|
34669
|
+
let currentProps;
|
34670
|
+
if (selectedItem) {
|
34671
|
+
currentProps = selectedItem.props;
|
34672
|
+
} else {
|
34673
|
+
currentProps = rootProps;
|
34674
|
+
}
|
34675
|
+
const newProps = __spreadProps(__spreadValues({}, currentProps), {
|
34676
|
+
[fieldName]: value
|
34677
|
+
});
|
34678
|
+
if (itemSelector) {
|
34679
|
+
const action = {
|
34680
|
+
type: "replace",
|
34681
|
+
destinationIndex: itemSelector.index,
|
34682
|
+
destinationZone: itemSelector.zone || rootDroppableId,
|
34683
|
+
data: __spreadProps(__spreadValues({}, selectedItem), { props: newProps })
|
34684
|
+
};
|
34685
|
+
if ((_a3 = config.components[selectedItem.type]) == null ? void 0 : _a3.resolveData) {
|
34686
|
+
resolveData(replaceAction(data, action));
|
34687
|
+
} else {
|
34688
|
+
dispatch(action);
|
34689
|
+
}
|
34690
|
+
} else {
|
34691
|
+
if (data.root.props) {
|
34692
|
+
if ((_b3 = config.root) == null ? void 0 : _b3.resolveData) {
|
34693
|
+
resolveData(__spreadProps(__spreadValues({}, data), {
|
34694
|
+
root: { props: newProps }
|
34695
|
+
}));
|
34696
|
+
} else {
|
34697
|
+
dispatch({
|
34698
|
+
type: "setData",
|
34699
|
+
data: { root: { props: newProps } }
|
34700
|
+
});
|
34701
|
+
}
|
34702
|
+
} else {
|
34703
|
+
dispatch({
|
34704
|
+
type: "setData",
|
34705
|
+
data: { root: newProps }
|
34706
|
+
});
|
34707
|
+
}
|
34708
|
+
}
|
34709
|
+
};
|
34710
|
+
if (selectedItem && itemSelector) {
|
34711
|
+
const { readOnly = {} } = selectedItem;
|
34712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34713
|
+
InputOrGroup,
|
34714
|
+
{
|
34715
|
+
field,
|
34716
|
+
name: fieldName,
|
34717
|
+
label: field.label,
|
34718
|
+
readOnly: readOnly[fieldName],
|
34719
|
+
readOnlyFields: readOnly,
|
34720
|
+
value: selectedItem.props[fieldName],
|
34721
|
+
onChange: onChange2
|
34722
|
+
},
|
34723
|
+
`${selectedItem.props.id}_${fieldName}`
|
34724
|
+
);
|
34725
|
+
} else {
|
34726
|
+
const { readOnly = {} } = data.root;
|
34727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34728
|
+
InputOrGroup,
|
34729
|
+
{
|
34730
|
+
field,
|
34731
|
+
name: fieldName,
|
34732
|
+
label: field.label,
|
34733
|
+
readOnly: readOnly[fieldName],
|
34734
|
+
readOnlyFields: readOnly,
|
34735
|
+
value: rootProps[fieldName],
|
34736
|
+
onChange: onChange2
|
34737
|
+
},
|
34738
|
+
`page_${fieldName}`
|
34739
|
+
);
|
34740
|
+
}
|
34741
|
+
})
|
34742
|
+
}
|
34743
|
+
) }) })
|
34744
|
+
] });
|
34855
34745
|
} })
|
34856
34746
|
}
|
34857
34747
|
)
|