@measured/puck 0.12.0-canary.12cea1e → 0.12.0-canary.13f8cc0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +20 -456
- package/dist/{Config-60a50493.d.ts → Config-a03de579.d.ts} +1 -0
- package/dist/index.css +287 -151
- package/dist/index.d.ts +4 -4
- package/dist/index.js +415 -523
- 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 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_ngdmu_1", "Button--medium": "_Button--medium_ngdmu_21", "Button--large": "_Button--large_ngdmu_28", "Button-icon": "_Button-icon_ngdmu_35", "Button--primary": "_Button--primary_ngdmu_43", "Button--secondary": "_Button--secondary_ngdmu_52", "Button--flush": "_Button--flush_ngdmu_63", "Button--disabled": "_Button--disabled_ngdmu_67", "Button--fullWidth": "_Button--fullWidth_ngdmu_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,17 +33110,19 @@ 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,
|
33105
|
-
const
|
33106
|
-
|
33107
|
-
|
33108
|
-
|
33109
|
-
|
33110
|
-
|
33111
|
-
|
33113
|
+
const [localValue, setLocalValue] = (0, import_react31.useState)(value);
|
33114
|
+
const onChangeDb = (0, import_use_debounce2.useDebouncedCallback)(
|
33115
|
+
(val) => {
|
33116
|
+
onChange(val);
|
33117
|
+
},
|
33118
|
+
50,
|
33119
|
+
{ leading: true }
|
33120
|
+
);
|
33121
|
+
const onChangeLocal = (0, import_react31.useCallback)((val) => {
|
33112
33122
|
setLocalValue(val);
|
33123
|
+
onChangeDb(val);
|
33113
33124
|
}, []);
|
33114
|
-
(0,
|
33125
|
+
(0, import_react31.useEffect)(() => {
|
33115
33126
|
setLocalValue(value);
|
33116
33127
|
}, [value]);
|
33117
33128
|
const localProps = {
|
@@ -33152,7 +33163,7 @@ var import_dnd6 = require("@hello-pangea/dnd");
|
|
33152
33163
|
|
33153
33164
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
33154
33165
|
init_react_import();
|
33155
|
-
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" };
|
33156
33167
|
|
33157
33168
|
// components/ComponentList/index.tsx
|
33158
33169
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
@@ -33172,7 +33183,7 @@ var ComponentListItem = ({
|
|
33172
33183
|
disableAnimations: true,
|
33173
33184
|
className: () => getClassNameItem2("draggable"),
|
33174
33185
|
children: () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
33175
|
-
component,
|
33186
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameItem2("name"), children: component }),
|
33176
33187
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DragIcon, {}) })
|
33177
33188
|
] })
|
33178
33189
|
},
|
@@ -33241,10 +33252,10 @@ ComponentList.Item = ComponentListItem;
|
|
33241
33252
|
|
33242
33253
|
// lib/use-placeholder-style.ts
|
33243
33254
|
init_react_import();
|
33244
|
-
var
|
33255
|
+
var import_react32 = require("react");
|
33245
33256
|
var usePlaceholderStyle = () => {
|
33246
33257
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
33247
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
33258
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react32.useState)();
|
33248
33259
|
const onDragStartOrUpdate = (draggedItem) => {
|
33249
33260
|
var _a;
|
33250
33261
|
const draggableId = draggedItem.draggableId;
|
@@ -33292,11 +33303,11 @@ init_react_import();
|
|
33292
33303
|
|
33293
33304
|
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
33294
33305
|
init_react_import();
|
33295
|
-
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" };
|
33296
33307
|
|
33297
33308
|
// lib/use-breadcrumbs.ts
|
33298
33309
|
init_react_import();
|
33299
|
-
var
|
33310
|
+
var import_react33 = require("react");
|
33300
33311
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
33301
33312
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
33302
33313
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -33346,8 +33357,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
33346
33357
|
state: { data },
|
33347
33358
|
selectedItem
|
33348
33359
|
} = useAppContext();
|
33349
|
-
const dzContext = (0,
|
33350
|
-
return (0,
|
33360
|
+
const dzContext = (0, import_react33.useContext)(dropZoneContext);
|
33361
|
+
return (0, import_react33.useMemo)(() => {
|
33351
33362
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
33352
33363
|
selectedItem,
|
33353
33364
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -33399,15 +33410,15 @@ init_react_import();
|
|
33399
33410
|
|
33400
33411
|
// lib/use-puck-history.ts
|
33401
33412
|
init_react_import();
|
33402
|
-
var
|
33413
|
+
var import_react35 = require("react");
|
33403
33414
|
|
33404
33415
|
// lib/use-action-history.ts
|
33405
33416
|
init_react_import();
|
33406
|
-
var
|
33417
|
+
var import_react34 = require("react");
|
33407
33418
|
var EMPTY_HISTORY_INDEX = -1;
|
33408
33419
|
function useActionHistory() {
|
33409
|
-
const [histories, setHistories] = (0,
|
33410
|
-
const [currentHistoryIndex, setCurrentHistoryIndex] = (0,
|
33420
|
+
const [histories, setHistories] = (0, import_react34.useState)([]);
|
33421
|
+
const [currentHistoryIndex, setCurrentHistoryIndex] = (0, import_react34.useState)(EMPTY_HISTORY_INDEX);
|
33411
33422
|
const currentHistory = histories[currentHistoryIndex];
|
33412
33423
|
const canRewind = currentHistoryIndex > EMPTY_HISTORY_INDEX;
|
33413
33424
|
const canForward = currentHistoryIndex < histories.length - 1;
|
@@ -33486,7 +33497,7 @@ function usePuckHistory({
|
|
33486
33497
|
dispatch
|
33487
33498
|
});
|
33488
33499
|
}, DEBOUNCE_TIME);
|
33489
|
-
(0,
|
33500
|
+
(0, import_react35.useEffect)(() => {
|
33490
33501
|
historyEmitter.on(RECORD_DIFF, handleRecordDiff);
|
33491
33502
|
return () => {
|
33492
33503
|
historyEmitter.off(RECORD_DIFF, handleRecordDiff);
|
@@ -33828,7 +33839,7 @@ init_react_import();
|
|
33828
33839
|
|
33829
33840
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
33830
33841
|
init_react_import();
|
33831
|
-
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" };
|
33832
33843
|
|
33833
33844
|
// lib/scroll-into-view.ts
|
33834
33845
|
init_react_import();
|
@@ -33842,7 +33853,7 @@ var scrollIntoView = (el) => {
|
|
33842
33853
|
};
|
33843
33854
|
|
33844
33855
|
// components/LayerTree/index.tsx
|
33845
|
-
var
|
33856
|
+
var import_react36 = require("react");
|
33846
33857
|
|
33847
33858
|
// lib/find-zones-for-area.ts
|
33848
33859
|
init_react_import();
|
@@ -33880,7 +33891,7 @@ var LayerTree = ({
|
|
33880
33891
|
label
|
33881
33892
|
}) => {
|
33882
33893
|
const zones = data.zones || {};
|
33883
|
-
const ctx = (0,
|
33894
|
+
const ctx = (0, import_react36.useContext)(dropZoneContext);
|
33884
33895
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
33885
33896
|
label && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName17("zoneTitle"), children: [
|
33886
33897
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(layers_default, { size: "16" }) }),
|
@@ -33954,7 +33965,7 @@ var LayerTree = ({
|
|
33954
33965
|
),
|
33955
33966
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
33956
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" }) }),
|
33957
|
-
item.type
|
33968
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("name"), children: item.type })
|
33958
33969
|
] })
|
33959
33970
|
]
|
33960
33971
|
}
|
@@ -34005,11 +34016,11 @@ var flushZones = (appState) => {
|
|
34005
34016
|
|
34006
34017
|
// lib/use-component-list.tsx
|
34007
34018
|
init_react_import();
|
34008
|
-
var
|
34019
|
+
var import_react37 = require("react");
|
34009
34020
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
34010
34021
|
var useComponentList = (config, ui) => {
|
34011
|
-
const [componentList, setComponentList] = (0,
|
34012
|
-
(0,
|
34022
|
+
const [componentList, setComponentList] = (0, import_react37.useState)();
|
34023
|
+
(0, import_react37.useEffect)(() => {
|
34013
34024
|
var _a, _b, _c;
|
34014
34025
|
if (Object.keys(ui.componentList).length > 0) {
|
34015
34026
|
const matchedComponents = [];
|
@@ -34075,7 +34086,7 @@ var useComponentList = (config, ui) => {
|
|
34075
34086
|
|
34076
34087
|
// lib/use-resolved-data.ts
|
34077
34088
|
init_react_import();
|
34078
|
-
var
|
34089
|
+
var import_react38 = require("react");
|
34079
34090
|
|
34080
34091
|
// lib/resolve-component-data.ts
|
34081
34092
|
init_react_import();
|
@@ -34190,19 +34201,19 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
|
|
34190
34201
|
|
34191
34202
|
// lib/use-resolved-data.ts
|
34192
34203
|
var useResolvedData = (data, config, dispatch) => {
|
34193
|
-
const [{ resolverKey, newData }, setResolverState] = (0,
|
34204
|
+
const [{ resolverKey, newData }, setResolverState] = (0, import_react38.useState)({
|
34194
34205
|
resolverKey: 0,
|
34195
34206
|
newData: data
|
34196
34207
|
});
|
34197
|
-
const [componentState, setComponentState] = (0,
|
34208
|
+
const [componentState, setComponentState] = (0, import_react38.useState)({});
|
34198
34209
|
const deferredSetStates = {};
|
34199
|
-
const setComponentLoading = (0,
|
34210
|
+
const setComponentLoading = (0, import_react38.useCallback)(
|
34200
34211
|
(id, loading, defer = 0) => {
|
34201
34212
|
if (deferredSetStates[id]) {
|
34202
34213
|
clearTimeout(deferredSetStates[id]);
|
34203
34214
|
delete deferredSetStates[id];
|
34204
34215
|
}
|
34205
|
-
|
34216
|
+
deferredSetStates[id] = setTimeout(() => {
|
34206
34217
|
setComponentState((prev) => __spreadProps(__spreadValues({}, prev), {
|
34207
34218
|
[id]: __spreadProps(__spreadValues({}, prev[id]), { loading })
|
34208
34219
|
}));
|
@@ -34254,10 +34265,10 @@ var useResolvedData = (data, config, dispatch) => {
|
|
34254
34265
|
});
|
34255
34266
|
yield Promise.all(promises);
|
34256
34267
|
});
|
34257
|
-
(0,
|
34268
|
+
(0, import_react38.useEffect)(() => {
|
34258
34269
|
runResolvers();
|
34259
34270
|
}, [resolverKey]);
|
34260
|
-
const resolveData = (0,
|
34271
|
+
const resolveData = (0, import_react38.useCallback)((newData2 = data) => {
|
34261
34272
|
setResolverState((curr) => ({
|
34262
34273
|
resolverKey: curr.resolverKey + 1,
|
34263
34274
|
newData: newData2
|
@@ -34269,8 +34280,13 @@ var useResolvedData = (data, config, dispatch) => {
|
|
34269
34280
|
};
|
34270
34281
|
};
|
34271
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_vyapj_19", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_vyapj_35", "Puck-header": "_Puck-header_vyapj_71", "Puck-headerInner": "_Puck-headerInner_vyapj_78", "Puck-headerToggle": "_Puck-headerToggle_vyapj_88", "Puck-headerTitle": "_Puck-headerTitle_vyapj_92", "Puck-headerPath": "_Puck-headerPath_vyapj_96", "Puck-headerTools": "_Puck-headerTools_vyapj_103", "Puck-leftSideBar": "_Puck-leftSideBar_vyapj_109", "Puck-frame": "_Puck-frame_vyapj_118", "Puck-root": "_Puck-root_vyapj_126", "Puck-page": "_Puck-page_vyapj_138", "Puck-rightSideBar": "_Puck-rightSideBar_vyapj_142" };
|
34286
|
+
|
34272
34287
|
// components/Puck/index.tsx
|
34273
34288
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
34289
|
+
var getClassName18 = get_class_name_factory_default("Puck", styles_module_default12);
|
34274
34290
|
var defaultPageFields = {
|
34275
34291
|
title: { type: "text" }
|
34276
34292
|
};
|
@@ -34299,8 +34315,8 @@ function Puck({
|
|
34299
34315
|
headerPath
|
34300
34316
|
}) {
|
34301
34317
|
var _a, _b;
|
34302
|
-
const [reducer] = (0,
|
34303
|
-
const initialAppState = __spreadProps(__spreadValues({}, defaultAppState), {
|
34318
|
+
const [reducer] = (0, import_react39.useState)(() => createReducer({ config }));
|
34319
|
+
const [initialAppState] = (0, import_react39.useState)(__spreadProps(__spreadValues({}, defaultAppState), {
|
34304
34320
|
data: initialData,
|
34305
34321
|
ui: __spreadProps(__spreadValues({}, defaultAppState.ui), {
|
34306
34322
|
// Store categories under componentList on state to allow render functions and plugins to modify
|
@@ -34318,8 +34334,8 @@ function Puck({
|
|
34318
34334
|
{}
|
34319
34335
|
) : {}
|
34320
34336
|
})
|
34321
|
-
});
|
34322
|
-
const [appState, dispatch] = (0,
|
34337
|
+
}));
|
34338
|
+
const [appState, dispatch] = (0, import_react39.useReducer)(
|
34323
34339
|
reducer,
|
34324
34340
|
flushZones(initialAppState)
|
34325
34341
|
);
|
@@ -34334,7 +34350,7 @@ function Puck({
|
|
34334
34350
|
dispatch
|
34335
34351
|
});
|
34336
34352
|
const { itemSelector, leftSideBarVisible } = ui;
|
34337
|
-
const setItemSelector = (0,
|
34353
|
+
const setItemSelector = (0, import_react39.useCallback)(
|
34338
34354
|
(newItemSelector) => {
|
34339
34355
|
dispatch({
|
34340
34356
|
type: "setUi",
|
@@ -34344,7 +34360,7 @@ function Puck({
|
|
34344
34360
|
[]
|
34345
34361
|
);
|
34346
34362
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
34347
|
-
const Page = (0,
|
34363
|
+
const Page = (0, import_react39.useCallback)(
|
34348
34364
|
(pageProps) => {
|
34349
34365
|
var _a2, _b2;
|
34350
34366
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
@@ -34360,7 +34376,7 @@ function Puck({
|
|
34360
34376
|
},
|
34361
34377
|
[config.root]
|
34362
34378
|
);
|
34363
|
-
const PageFieldWrapper = (0,
|
34379
|
+
const PageFieldWrapper = (0, import_react39.useCallback)(
|
34364
34380
|
(props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34365
34381
|
PluginRenderer,
|
34366
34382
|
{
|
@@ -34373,7 +34389,7 @@ function Puck({
|
|
34373
34389
|
),
|
34374
34390
|
[]
|
34375
34391
|
);
|
34376
|
-
const ComponentFieldWrapper = (0,
|
34392
|
+
const ComponentFieldWrapper = (0, import_react39.useCallback)(
|
34377
34393
|
(props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34378
34394
|
PluginRenderer,
|
34379
34395
|
{
|
@@ -34386,7 +34402,7 @@ function Puck({
|
|
34386
34402
|
),
|
34387
34403
|
[]
|
34388
34404
|
);
|
34389
|
-
const ComponentListWrapper = (0,
|
34405
|
+
const ComponentListWrapper = (0, import_react39.useCallback)((props) => {
|
34390
34406
|
const children = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34391
34407
|
PluginRenderer,
|
34392
34408
|
{
|
@@ -34406,22 +34422,22 @@ function Puck({
|
|
34406
34422
|
const FieldWrapper = itemSelector ? ComponentFieldWrapper : PageFieldWrapper;
|
34407
34423
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
34408
34424
|
let fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
|
34409
|
-
(0,
|
34425
|
+
(0, import_react39.useEffect)(() => {
|
34410
34426
|
if (onChange)
|
34411
34427
|
onChange(data);
|
34412
34428
|
}, [data]);
|
34413
34429
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
34414
|
-
const [draggedItem, setDraggedItem] = (0,
|
34430
|
+
const [draggedItem, setDraggedItem] = (0, import_react39.useState)();
|
34415
34431
|
const componentList = useComponentList(config, appState.ui);
|
34416
34432
|
const rootProps = data.root.props || data.root;
|
34417
|
-
(0,
|
34433
|
+
(0, import_react39.useEffect)(() => {
|
34418
34434
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
34419
34435
|
console.error(
|
34420
34436
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
34421
34437
|
);
|
34422
34438
|
}
|
34423
34439
|
}, []);
|
34424
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", {
|
34440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
|
34425
34441
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34426
34442
|
AppProvider,
|
34427
34443
|
{
|
@@ -34495,361 +34511,237 @@ function Puck({
|
|
34495
34511
|
},
|
34496
34512
|
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(dropZoneContext.Consumer, { children: (ctx) => {
|
34497
34513
|
var _a2, _b2;
|
34498
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34499
|
-
"
|
34500
|
-
|
34501
|
-
|
34502
|
-
|
34503
|
-
|
34504
|
-
|
34505
|
-
|
34506
|
-
|
34507
|
-
|
34508
|
-
|
34509
|
-
|
34510
|
-
|
34511
|
-
|
34512
|
-
|
34513
|
-
children:
|
34514
|
-
|
34515
|
-
|
34516
|
-
{
|
34517
|
-
|
34518
|
-
|
34519
|
-
|
34520
|
-
|
34521
|
-
|
34522
|
-
|
34523
|
-
|
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,
|
34524
34557
|
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34525
|
-
|
34558
|
+
chevron_left_default,
|
34526
34559
|
{
|
34527
|
-
|
34528
|
-
|
34529
|
-
},
|
34530
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
|
34531
|
-
children: "Publish"
|
34560
|
+
size: 21,
|
34561
|
+
stroke: canRewind ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
|
34532
34562
|
}
|
34533
|
-
)
|
34534
|
-
|
34535
|
-
|
34536
|
-
|
34537
|
-
|
34538
|
-
|
34539
|
-
|
34540
|
-
|
34541
|
-
|
34542
|
-
|
34543
|
-
|
34544
|
-
|
34545
|
-
|
34546
|
-
|
34547
|
-
|
34548
|
-
|
34549
|
-
|
34550
|
-
|
34551
|
-
|
34552
|
-
|
34553
|
-
|
34554
|
-
|
34555
|
-
|
34556
|
-
|
34557
|
-
|
34558
|
-
type: "setUi",
|
34559
|
-
ui: {
|
34560
|
-
leftSideBarVisible: !leftSideBarVisible
|
34561
|
-
}
|
34562
|
-
}),
|
34563
|
-
title: "Toggle left sidebar",
|
34564
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(sidebar_default, {})
|
34565
|
-
}
|
34566
|
-
)
|
34567
|
-
}
|
34568
|
-
),
|
34569
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34570
|
-
"div",
|
34571
|
-
{
|
34572
|
-
style: {
|
34573
|
-
display: "flex",
|
34574
|
-
justifyContent: "center",
|
34575
|
-
alignItems: "center"
|
34576
|
-
},
|
34577
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
34578
|
-
headerTitle || rootProps.title || "Page",
|
34579
|
-
headerPath && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34580
|
-
"small",
|
34581
|
-
{
|
34582
|
-
style: { fontWeight: 400, marginLeft: 4 },
|
34583
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("code", { children: headerPath })
|
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
|
-
]
|
34648
|
-
}
|
34649
|
-
)
|
34650
|
-
}
|
34651
|
-
),
|
34652
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34653
|
-
"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)(import_jsx_runtime22.Fragment, { 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,
|
34654
34588
|
{
|
34655
|
-
|
34656
|
-
|
34657
|
-
background: "var(--puck-color-grey-11)",
|
34658
|
-
borderRight: "1px solid var(--puck-color-grey-8)",
|
34659
|
-
overflowY: "auto",
|
34660
|
-
display: "flex",
|
34661
|
-
flexDirection: "column"
|
34589
|
+
onClick: () => {
|
34590
|
+
onPublish(data);
|
34662
34591
|
},
|
34663
|
-
|
34664
|
-
|
34665
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SidebarSection, { title: "Outline", children: [
|
34666
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34667
|
-
LayerTree,
|
34668
|
-
{
|
34669
|
-
data,
|
34670
|
-
label: areaContainsZones(data, "root") ? rootDroppableId : "",
|
34671
|
-
zoneContent: data.content,
|
34672
|
-
setItemSelector,
|
34673
|
-
itemSelector
|
34674
|
-
}
|
34675
|
-
),
|
34676
|
-
Object.entries(findZonesForArea(data, "root")).map(
|
34677
|
-
([zoneKey, zone]) => {
|
34678
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34679
|
-
LayerTree,
|
34680
|
-
{
|
34681
|
-
data,
|
34682
|
-
label: zoneKey,
|
34683
|
-
zone: zoneKey,
|
34684
|
-
zoneContent: zone,
|
34685
|
-
setItemSelector,
|
34686
|
-
itemSelector
|
34687
|
-
},
|
34688
|
-
zoneKey
|
34689
|
-
);
|
34690
|
-
}
|
34691
|
-
)
|
34692
|
-
] })
|
34693
|
-
]
|
34592
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
|
34593
|
+
children: "Publish"
|
34694
34594
|
}
|
34695
|
-
)
|
34696
|
-
|
34697
|
-
|
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,
|
34698
34603
|
{
|
34699
|
-
|
34700
|
-
|
34701
|
-
|
34702
|
-
|
34703
|
-
|
34704
|
-
flexDirection: "column"
|
34705
|
-
},
|
34706
|
-
onClick: () => setItemSelector(null),
|
34707
|
-
id: "puck-frame",
|
34708
|
-
children: [
|
34709
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34710
|
-
"div",
|
34711
|
-
{
|
34712
|
-
className: "puck-root",
|
34713
|
-
style: {
|
34714
|
-
boxShadow: "0px 0px 0px 32px var(--puck-color-grey-10)",
|
34715
|
-
margin: 32,
|
34716
|
-
zoom: 0.75
|
34717
|
-
},
|
34718
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
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
|
-
"div",
|
34739
|
-
{
|
34740
|
-
style: {
|
34741
|
-
background: "var(--puck-color-grey-10)",
|
34742
|
-
height: "100%",
|
34743
|
-
flexGrow: 1
|
34744
|
-
}
|
34745
|
-
}
|
34746
|
-
)
|
34747
|
-
]
|
34604
|
+
data,
|
34605
|
+
label: areaContainsZones(data, "root") ? rootDroppableId : "",
|
34606
|
+
zoneContent: data.content,
|
34607
|
+
setItemSelector,
|
34608
|
+
itemSelector
|
34748
34609
|
}
|
34749
34610
|
),
|
34750
|
-
|
34751
|
-
|
34752
|
-
|
34753
|
-
|
34754
|
-
borderLeft: "1px solid var(--puck-color-grey-8)",
|
34755
|
-
overflowY: "auto",
|
34756
|
-
gridArea: "right",
|
34757
|
-
fontFamily: "var(--puck-font-stack)",
|
34758
|
-
display: "flex",
|
34759
|
-
flexDirection: "column",
|
34760
|
-
background: "var(--puck-color-white)"
|
34761
|
-
},
|
34762
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldWrapper, { dispatch, state: appState, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34763
|
-
SidebarSection,
|
34611
|
+
Object.entries(findZonesForArea(data, "root")).map(
|
34612
|
+
([zoneKey, zone]) => {
|
34613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34614
|
+
LayerTree,
|
34764
34615
|
{
|
34765
|
-
|
34766
|
-
|
34767
|
-
|
34768
|
-
|
34769
|
-
|
34770
|
-
|
34771
|
-
|
34772
|
-
|
34773
|
-
|
34774
|
-
if (selectedItem) {
|
34775
|
-
currentProps = selectedItem.props;
|
34776
|
-
} else {
|
34777
|
-
currentProps = data.root;
|
34778
|
-
}
|
34779
|
-
const newProps = __spreadProps(__spreadValues({}, currentProps), {
|
34780
|
-
[fieldName]: value
|
34781
|
-
});
|
34782
|
-
if (itemSelector) {
|
34783
|
-
const action = {
|
34784
|
-
type: "replace",
|
34785
|
-
destinationIndex: itemSelector.index,
|
34786
|
-
destinationZone: itemSelector.zone || rootDroppableId,
|
34787
|
-
data: __spreadProps(__spreadValues({}, selectedItem), { props: newProps })
|
34788
|
-
};
|
34789
|
-
if ((_a3 = config.components[selectedItem.type]) == null ? void 0 : _a3.resolveData) {
|
34790
|
-
resolveData(replaceAction(data, action));
|
34791
|
-
} else {
|
34792
|
-
dispatch(action);
|
34793
|
-
}
|
34794
|
-
} else {
|
34795
|
-
if (data.root.props) {
|
34796
|
-
if ((_b3 = config.root) == null ? void 0 : _b3.resolveData) {
|
34797
|
-
resolveData(__spreadProps(__spreadValues({}, data), {
|
34798
|
-
root: { props: { newProps } }
|
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
|
-
}
|
34812
|
-
}
|
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
|
-
} else {
|
34830
|
-
const { readOnly = {} } = data.root;
|
34831
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34832
|
-
InputOrGroup,
|
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
|
-
);
|
34844
|
-
}
|
34845
|
-
})
|
34846
|
-
}
|
34847
|
-
) })
|
34616
|
+
data,
|
34617
|
+
label: zoneKey,
|
34618
|
+
zone: zoneKey,
|
34619
|
+
zoneContent: zone,
|
34620
|
+
setItemSelector,
|
34621
|
+
itemSelector
|
34622
|
+
},
|
34623
|
+
zoneKey
|
34624
|
+
);
|
34848
34625
|
}
|
34849
34626
|
)
|
34850
|
-
]
|
34851
|
-
}
|
34852
|
-
|
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
|
+
] });
|
34853
34745
|
} })
|
34854
34746
|
}
|
34855
34747
|
)
|