@measured/puck 0.14.0-canary.1c4c076 → 0.14.0-canary.26bc4ff
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +8 -0
- package/dist/{Config-ab049d49.d.ts → Config-09628f3c.d.ts} +39 -26
- package/dist/index.css +315 -221
- package/dist/index.d.ts +86 -49
- package/dist/index.js +1414 -673
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +4 -1
- package/package.json +4 -2
package/dist/index.js
CHANGED
@@ -8084,7 +8084,7 @@ var require_react_dom_development = __commonJS({
|
|
8084
8084
|
var HostPortal = 4;
|
8085
8085
|
var HostComponent = 5;
|
8086
8086
|
var HostText = 6;
|
8087
|
-
var
|
8087
|
+
var Fragment17 = 7;
|
8088
8088
|
var Mode = 8;
|
8089
8089
|
var ContextConsumer = 9;
|
8090
8090
|
var ContextProvider = 10;
|
@@ -8264,8 +8264,8 @@ var require_react_dom_development = __commonJS({
|
|
8264
8264
|
if (propertyInfo !== null) {
|
8265
8265
|
return !propertyInfo.acceptsBooleans;
|
8266
8266
|
} else {
|
8267
|
-
var
|
8268
|
-
return
|
8267
|
+
var prefix3 = name.toLowerCase().slice(0, 5);
|
8268
|
+
return prefix3 !== "data-" && prefix3 !== "aria-";
|
8269
8269
|
}
|
8270
8270
|
}
|
8271
8271
|
default:
|
@@ -8937,18 +8937,18 @@ var require_react_dom_development = __commonJS({
|
|
8937
8937
|
}
|
8938
8938
|
}
|
8939
8939
|
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
8940
|
-
var
|
8940
|
+
var prefix2;
|
8941
8941
|
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
8942
8942
|
{
|
8943
|
-
if (
|
8943
|
+
if (prefix2 === void 0) {
|
8944
8944
|
try {
|
8945
8945
|
throw Error();
|
8946
8946
|
} catch (x) {
|
8947
8947
|
var match = x.stack.trim().match(/\n( *(at )?)/);
|
8948
|
-
|
8948
|
+
prefix2 = match && match[1] || "";
|
8949
8949
|
}
|
8950
8950
|
}
|
8951
|
-
return "\n" +
|
8951
|
+
return "\n" + prefix2 + name;
|
8952
8952
|
}
|
8953
8953
|
}
|
8954
8954
|
var reentry = false;
|
@@ -9240,7 +9240,7 @@ var require_react_dom_development = __commonJS({
|
|
9240
9240
|
return "DehydratedFragment";
|
9241
9241
|
case ForwardRef:
|
9242
9242
|
return getWrappedName$1(type, type.render, "ForwardRef");
|
9243
|
-
case
|
9243
|
+
case Fragment17:
|
9244
9244
|
return "Fragment";
|
9245
9245
|
case HostComponent:
|
9246
9246
|
return type;
|
@@ -10033,13 +10033,13 @@ var require_react_dom_development = __commonJS({
|
|
10033
10033
|
strokeOpacity: true,
|
10034
10034
|
strokeWidth: true
|
10035
10035
|
};
|
10036
|
-
function prefixKey(
|
10037
|
-
return
|
10036
|
+
function prefixKey(prefix3, key) {
|
10037
|
+
return prefix3 + key.charAt(0).toUpperCase() + key.substring(1);
|
10038
10038
|
}
|
10039
10039
|
var prefixes = ["Webkit", "ms", "Moz", "O"];
|
10040
10040
|
Object.keys(isUnitlessNumber).forEach(function(prop) {
|
10041
|
-
prefixes.forEach(function(
|
10042
|
-
isUnitlessNumber[prefixKey(
|
10041
|
+
prefixes.forEach(function(prefix3) {
|
10042
|
+
isUnitlessNumber[prefixKey(prefix3, prop)] = isUnitlessNumber[prop];
|
10043
10043
|
});
|
10044
10044
|
});
|
10045
10045
|
function dangerousStyleValue(name, value, isCustomProperty) {
|
@@ -18911,7 +18911,7 @@ var require_react_dom_development = __commonJS({
|
|
18911
18911
|
}
|
18912
18912
|
}
|
18913
18913
|
function updateFragment2(returnFiber, current2, fragment, lanes, key) {
|
18914
|
-
if (current2 === null || current2.tag !==
|
18914
|
+
if (current2 === null || current2.tag !== Fragment17) {
|
18915
18915
|
var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
|
18916
18916
|
created.return = returnFiber;
|
18917
18917
|
return created;
|
@@ -19314,7 +19314,7 @@ var require_react_dom_development = __commonJS({
|
|
19314
19314
|
if (child.key === key) {
|
19315
19315
|
var elementType = element.type;
|
19316
19316
|
if (elementType === REACT_FRAGMENT_TYPE) {
|
19317
|
-
if (child.tag ===
|
19317
|
+
if (child.tag === Fragment17) {
|
19318
19318
|
deleteRemainingChildren(returnFiber, child.sibling);
|
19319
19319
|
var existing = useFiber(child, element.props.children);
|
19320
19320
|
existing.return = returnFiber;
|
@@ -23489,7 +23489,7 @@ var require_react_dom_development = __commonJS({
|
|
23489
23489
|
var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
23490
23490
|
return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
|
23491
23491
|
}
|
23492
|
-
case
|
23492
|
+
case Fragment17:
|
23493
23493
|
return updateFragment(current2, workInProgress2, renderLanes2);
|
23494
23494
|
case Mode:
|
23495
23495
|
return updateMode(current2, workInProgress2, renderLanes2);
|
@@ -23762,7 +23762,7 @@ var require_react_dom_development = __commonJS({
|
|
23762
23762
|
case SimpleMemoComponent:
|
23763
23763
|
case FunctionComponent:
|
23764
23764
|
case ForwardRef:
|
23765
|
-
case
|
23765
|
+
case Fragment17:
|
23766
23766
|
case Mode:
|
23767
23767
|
case Profiler:
|
23768
23768
|
case ContextConsumer:
|
@@ -28021,7 +28021,7 @@ var require_react_dom_development = __commonJS({
|
|
28021
28021
|
return fiber;
|
28022
28022
|
}
|
28023
28023
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
28024
|
-
var fiber = createFiber(
|
28024
|
+
var fiber = createFiber(Fragment17, elements, key, mode);
|
28025
28025
|
fiber.lanes = lanes;
|
28026
28026
|
return fiber;
|
28027
28027
|
}
|
@@ -29173,7 +29173,7 @@ var import_react2 = require("react");
|
|
29173
29173
|
|
29174
29174
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
|
29175
29175
|
init_react_import();
|
29176
|
-
var Button_module_default = { "Button": "
|
29176
|
+
var Button_module_default = { "Button": "_Button_1t64k_1", "Button--medium": "_Button--medium_1t64k_29", "Button--large": "_Button--large_1t64k_37", "Button-icon": "_Button-icon_1t64k_44", "Button--primary": "_Button--primary_1t64k_48", "Button--secondary": "_Button--secondary_1t64k_67", "Button--flush": "_Button--flush_1t64k_84", "Button--disabled": "_Button--disabled_1t64k_88", "Button--fullWidth": "_Button--fullWidth_1t64k_95", "Button-spinner": "_Button-spinner_1t64k_100" };
|
29177
29177
|
|
29178
29178
|
// lib/get-class-name-factory.ts
|
29179
29179
|
init_react_import();
|
@@ -29264,7 +29264,150 @@ var Button = ({
|
|
29264
29264
|
|
29265
29265
|
// components/Drawer/index.tsx
|
29266
29266
|
init_react_import();
|
29267
|
-
|
29267
|
+
|
29268
|
+
// components/Droppable/index.tsx
|
29269
|
+
init_react_import();
|
29270
|
+
var import_dnd = require("@measured/dnd");
|
29271
|
+
|
29272
|
+
// components/Puck/context.tsx
|
29273
|
+
init_react_import();
|
29274
|
+
var import_react3 = require("react");
|
29275
|
+
|
29276
|
+
// lib/get-item.ts
|
29277
|
+
init_react_import();
|
29278
|
+
|
29279
|
+
// lib/root-droppable-id.ts
|
29280
|
+
init_react_import();
|
29281
|
+
var rootDroppableId = "default-zone";
|
29282
|
+
|
29283
|
+
// lib/setup-zone.ts
|
29284
|
+
init_react_import();
|
29285
|
+
var setupZone = (data, zoneKey) => {
|
29286
|
+
if (zoneKey === rootDroppableId) {
|
29287
|
+
return data;
|
29288
|
+
}
|
29289
|
+
const newData = __spreadValues({}, data);
|
29290
|
+
newData.zones = data.zones || {};
|
29291
|
+
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
29292
|
+
return newData;
|
29293
|
+
};
|
29294
|
+
|
29295
|
+
// lib/get-item.ts
|
29296
|
+
var getItem = (selector, data, dynamicProps = {}) => {
|
29297
|
+
if (!selector.zone || selector.zone === rootDroppableId) {
|
29298
|
+
const item2 = data.content[selector.index];
|
29299
|
+
return __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props });
|
29300
|
+
}
|
29301
|
+
const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
|
29302
|
+
return __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props });
|
29303
|
+
};
|
29304
|
+
|
29305
|
+
// components/ViewportControls/default-viewports.ts
|
29306
|
+
init_react_import();
|
29307
|
+
var defaultViewports = [
|
29308
|
+
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
29309
|
+
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
29310
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
29311
|
+
];
|
29312
|
+
|
29313
|
+
// components/Puck/context.tsx
|
29314
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
29315
|
+
var defaultAppState = {
|
29316
|
+
data: { content: [], root: { props: { title: "" } } },
|
29317
|
+
ui: {
|
29318
|
+
leftSideBarVisible: true,
|
29319
|
+
rightSideBarVisible: true,
|
29320
|
+
arrayState: {},
|
29321
|
+
itemSelector: null,
|
29322
|
+
componentList: {},
|
29323
|
+
isDragging: false,
|
29324
|
+
viewports: {
|
29325
|
+
current: {
|
29326
|
+
width: defaultViewports[0].width,
|
29327
|
+
height: defaultViewports[0].height || "auto"
|
29328
|
+
},
|
29329
|
+
options: [],
|
29330
|
+
controlsVisible: true
|
29331
|
+
}
|
29332
|
+
}
|
29333
|
+
};
|
29334
|
+
var defaultContext = {
|
29335
|
+
state: defaultAppState,
|
29336
|
+
dispatch: () => null,
|
29337
|
+
config: { components: {} },
|
29338
|
+
componentState: {},
|
29339
|
+
resolveData: () => {
|
29340
|
+
},
|
29341
|
+
plugins: [],
|
29342
|
+
overrides: {},
|
29343
|
+
history: {},
|
29344
|
+
viewports: defaultViewports,
|
29345
|
+
zoomConfig: {
|
29346
|
+
autoZoom: 1,
|
29347
|
+
rootHeight: 0,
|
29348
|
+
zoom: 1
|
29349
|
+
},
|
29350
|
+
setZoomConfig: () => null,
|
29351
|
+
status: "LOADING",
|
29352
|
+
setStatus: () => null,
|
29353
|
+
iframe: {}
|
29354
|
+
};
|
29355
|
+
var appContext = (0, import_react3.createContext)(defaultContext);
|
29356
|
+
var AppProvider = ({
|
29357
|
+
children,
|
29358
|
+
value
|
29359
|
+
}) => {
|
29360
|
+
const [zoomConfig, setZoomConfig] = (0, import_react3.useState)(defaultContext.zoomConfig);
|
29361
|
+
const [status, setStatus] = (0, import_react3.useState)("LOADING");
|
29362
|
+
(0, import_react3.useEffect)(() => {
|
29363
|
+
setStatus("MOUNTED");
|
29364
|
+
}, []);
|
29365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
29366
|
+
appContext.Provider,
|
29367
|
+
{
|
29368
|
+
value: __spreadProps(__spreadValues({}, value), { zoomConfig, setZoomConfig, status, setStatus }),
|
29369
|
+
children
|
29370
|
+
}
|
29371
|
+
);
|
29372
|
+
};
|
29373
|
+
function useAppContext() {
|
29374
|
+
const mainContext = (0, import_react3.useContext)(appContext);
|
29375
|
+
const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
|
29376
|
+
return __spreadProps(__spreadValues({}, mainContext), {
|
29377
|
+
// Helpers
|
29378
|
+
selectedItem,
|
29379
|
+
setUi: (ui, recordHistory) => {
|
29380
|
+
return mainContext.dispatch({
|
29381
|
+
type: "setUi",
|
29382
|
+
ui,
|
29383
|
+
recordHistory
|
29384
|
+
});
|
29385
|
+
}
|
29386
|
+
});
|
29387
|
+
}
|
29388
|
+
|
29389
|
+
// components/Droppable/index.tsx
|
29390
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
29391
|
+
var defaultProvided = {
|
29392
|
+
droppableProps: {
|
29393
|
+
"data-rfd-droppable-context-id": "",
|
29394
|
+
"data-rfd-droppable-id": ""
|
29395
|
+
},
|
29396
|
+
placeholder: null,
|
29397
|
+
innerRef: () => null
|
29398
|
+
};
|
29399
|
+
var defaultSnapshot = {
|
29400
|
+
isDraggingOver: false,
|
29401
|
+
draggingOverWith: null,
|
29402
|
+
draggingFromThisWith: null,
|
29403
|
+
isUsingPlaceholder: false
|
29404
|
+
};
|
29405
|
+
var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: children(defaultProvided, defaultSnapshot) });
|
29406
|
+
var Droppable = (props) => {
|
29407
|
+
const { status } = useAppContext();
|
29408
|
+
const El = status !== "LOADING" ? import_dnd.Droppable : DefaultDroppable;
|
29409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(El, __spreadValues({}, props));
|
29410
|
+
};
|
29268
29411
|
|
29269
29412
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
|
29270
29413
|
init_react_import();
|
@@ -29272,8 +29415,32 @@ var styles_module_default = { "Drawer": "_Drawer_6zh0b_1", "DrawerItem-default":
|
|
29272
29415
|
|
29273
29416
|
// components/Draggable/index.tsx
|
29274
29417
|
init_react_import();
|
29275
|
-
var
|
29276
|
-
var
|
29418
|
+
var import_dnd2 = require("@measured/dnd");
|
29419
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
29420
|
+
var defaultProvided2 = {
|
29421
|
+
draggableProps: {
|
29422
|
+
"data-rfd-draggable-context-id": "",
|
29423
|
+
"data-rfd-draggable-id": ""
|
29424
|
+
},
|
29425
|
+
dragHandleProps: null,
|
29426
|
+
innerRef: () => null
|
29427
|
+
};
|
29428
|
+
var defaultSnapshot2 = {
|
29429
|
+
isDragging: false,
|
29430
|
+
isDropAnimating: false,
|
29431
|
+
isClone: false,
|
29432
|
+
dropAnimation: null,
|
29433
|
+
draggingOver: null,
|
29434
|
+
combineWith: null,
|
29435
|
+
combineTargetFor: null,
|
29436
|
+
mode: null
|
29437
|
+
};
|
29438
|
+
var defaultRubric = {
|
29439
|
+
draggableId: "",
|
29440
|
+
type: "",
|
29441
|
+
source: { droppableId: "", index: 0 }
|
29442
|
+
};
|
29443
|
+
var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: children(defaultProvided2, defaultSnapshot2, defaultRubric) });
|
29277
29444
|
var Draggable = ({
|
29278
29445
|
className,
|
29279
29446
|
children,
|
@@ -29283,39 +29450,33 @@ var Draggable = ({
|
|
29283
29450
|
disableAnimations = false,
|
29284
29451
|
isDragDisabled = false
|
29285
29452
|
}) => {
|
29286
|
-
|
29287
|
-
|
29288
|
-
|
29289
|
-
|
29290
|
-
|
29291
|
-
|
29292
|
-
|
29293
|
-
|
29294
|
-
|
29295
|
-
|
29296
|
-
|
29297
|
-
|
29298
|
-
|
29299
|
-
|
29300
|
-
|
29301
|
-
|
29302
|
-
|
29303
|
-
|
29304
|
-
|
29305
|
-
|
29306
|
-
),
|
29307
|
-
|
29308
|
-
|
29309
|
-
|
29310
|
-
|
29311
|
-
|
29312
|
-
|
29313
|
-
}
|
29314
|
-
)
|
29315
|
-
] });
|
29316
|
-
}
|
29317
|
-
}
|
29318
|
-
);
|
29453
|
+
const { status } = useAppContext();
|
29454
|
+
const El = status !== "LOADING" ? import_dnd2.Draggable : DefaultDraggable;
|
29455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => {
|
29456
|
+
var _a;
|
29457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
29458
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
29459
|
+
"div",
|
29460
|
+
__spreadProps(__spreadValues(__spreadValues({
|
29461
|
+
className: className && className(provided, snapshot),
|
29462
|
+
ref: provided.innerRef
|
29463
|
+
}, provided.draggableProps), provided.dragHandleProps), {
|
29464
|
+
style: __spreadProps(__spreadValues({}, provided.draggableProps.style), {
|
29465
|
+
transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
|
29466
|
+
}),
|
29467
|
+
children: children(provided, snapshot)
|
29468
|
+
})
|
29469
|
+
),
|
29470
|
+
showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
29471
|
+
"div",
|
29472
|
+
{
|
29473
|
+
className: className && className(provided, snapshot),
|
29474
|
+
style: { transform: "none !important" },
|
29475
|
+
children: children(provided, snapshot)
|
29476
|
+
}
|
29477
|
+
)
|
29478
|
+
] });
|
29479
|
+
} });
|
29319
29480
|
};
|
29320
29481
|
|
29321
29482
|
// components/DragIcon/index.tsx
|
@@ -29350,23 +29511,23 @@ init_react_import();
|
|
29350
29511
|
var styles_module_default2 = { "DragIcon": "_DragIcon_1p5wn_1" };
|
29351
29512
|
|
29352
29513
|
// components/DragIcon/index.tsx
|
29353
|
-
var
|
29514
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
29354
29515
|
var getClassName2 = get_class_name_factory_default("DragIcon", styles_module_default2);
|
29355
|
-
var DragIcon = () => /* @__PURE__ */ (0,
|
29516
|
+
var DragIcon = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName2(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
|
29356
29517
|
|
29357
29518
|
// components/Drawer/index.tsx
|
29358
|
-
var
|
29359
|
-
var
|
29519
|
+
var import_react4 = require("react");
|
29520
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
29360
29521
|
var getClassName3 = get_class_name_factory_default("Drawer", styles_module_default);
|
29361
29522
|
var getClassNameItem = get_class_name_factory_default("DrawerItem", styles_module_default);
|
29362
|
-
var drawerContext = (0,
|
29523
|
+
var drawerContext = (0, import_react4.createContext)({
|
29363
29524
|
droppableId: ""
|
29364
29525
|
});
|
29365
29526
|
var DrawerDraggable = ({
|
29366
29527
|
children,
|
29367
29528
|
id,
|
29368
29529
|
index
|
29369
|
-
}) => /* @__PURE__ */ (0,
|
29530
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
29370
29531
|
Draggable,
|
29371
29532
|
{
|
29372
29533
|
id,
|
@@ -29382,17 +29543,18 @@ var DrawerItem = ({
|
|
29382
29543
|
name,
|
29383
29544
|
children,
|
29384
29545
|
id,
|
29546
|
+
label,
|
29385
29547
|
index
|
29386
29548
|
}) => {
|
29387
|
-
const ctx = (0,
|
29549
|
+
const ctx = (0, import_react4.useContext)(drawerContext);
|
29388
29550
|
const resolvedId = `${ctx.droppableId}::${id || name}`;
|
29389
|
-
const CustomInner = (0,
|
29390
|
-
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0,
|
29551
|
+
const CustomInner = (0, import_react4.useMemo)(
|
29552
|
+
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("default"), children: children2 })),
|
29391
29553
|
[children]
|
29392
29554
|
);
|
29393
|
-
return /* @__PURE__ */ (0,
|
29394
|
-
/* @__PURE__ */ (0,
|
29395
|
-
/* @__PURE__ */ (0,
|
29555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DrawerDraggable, { id: resolvedId, index, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: getClassNameItem("draggable"), children: [
|
29556
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("name"), children: label != null ? label : name }),
|
29557
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DragIcon, {}) })
|
29396
29558
|
] }) }) }) });
|
29397
29559
|
};
|
29398
29560
|
var Drawer = ({
|
@@ -29400,7 +29562,7 @@ var Drawer = ({
|
|
29400
29562
|
droppableId = "component-list",
|
29401
29563
|
direction = "vertical"
|
29402
29564
|
}) => {
|
29403
|
-
return /* @__PURE__ */ (0,
|
29565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Droppable, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
29404
29566
|
"div",
|
29405
29567
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
29406
29568
|
ref: provided.innerRef,
|
@@ -29409,7 +29571,7 @@ var Drawer = ({
|
|
29409
29571
|
}),
|
29410
29572
|
children: [
|
29411
29573
|
children,
|
29412
|
-
/* @__PURE__ */ (0,
|
29574
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
|
29413
29575
|
]
|
29414
29576
|
})
|
29415
29577
|
) }) });
|
@@ -29422,19 +29584,19 @@ var import_react9 = require("react");
|
|
29422
29584
|
|
29423
29585
|
// components/DraggableComponent/index.tsx
|
29424
29586
|
init_react_import();
|
29425
|
-
var
|
29426
|
-
var import_dnd3 = require("@
|
29587
|
+
var import_react7 = require("react");
|
29588
|
+
var import_dnd3 = require("@measured/dnd");
|
29427
29589
|
|
29428
29590
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
29429
29591
|
init_react_import();
|
29430
|
-
var styles_module_default3 = { "DraggableComponent": "
|
29592
|
+
var styles_module_default3 = { "DraggableComponent": "_DraggableComponent_1542z_1", "DraggableComponent--isDragging": "_DraggableComponent--isDragging_1542z_11", "DraggableComponent-contents": "_DraggableComponent-contents_1542z_16", "DraggableComponent-overlay": "_DraggableComponent-overlay_1542z_29", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_1542z_49", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_1542z_65", "DraggableComponent--forceHover": "_DraggableComponent--forceHover_1542z_71", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_1542z_76", "DraggableComponent--indicativeHover": "_DraggableComponent--indicativeHover_1542z_81", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_1542z_97", "DraggableComponent-actions": "_DraggableComponent-actions_1542z_97", "DraggableComponent-actionsLabel": "_DraggableComponent-actionsLabel_1542z_127", "DraggableComponent-action": "_DraggableComponent-action_1542z_97" };
|
29431
29593
|
|
29432
29594
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
29433
29595
|
init_react_import();
|
29434
29596
|
|
29435
29597
|
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
29436
29598
|
init_react_import();
|
29437
|
-
var
|
29599
|
+
var import_react5 = require("react");
|
29438
29600
|
|
29439
29601
|
// ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
|
29440
29602
|
init_react_import();
|
@@ -29453,10 +29615,10 @@ var defaultAttributes = {
|
|
29453
29615
|
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
29454
29616
|
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim();
|
29455
29617
|
var createLucideIcon = (iconName, iconNode) => {
|
29456
|
-
const Component = (0,
|
29618
|
+
const Component = (0, import_react5.forwardRef)(
|
29457
29619
|
(_a, ref) => {
|
29458
29620
|
var _b = _a, { color = "currentColor", size = 24, strokeWidth = 2, absoluteStrokeWidth, className = "", children } = _b, rest = __objRest(_b, ["color", "size", "strokeWidth", "absoluteStrokeWidth", "className", "children"]);
|
29459
|
-
return (0,
|
29621
|
+
return (0, import_react5.createElement)(
|
29460
29622
|
"svg",
|
29461
29623
|
__spreadValues(__spreadProps(__spreadValues({
|
29462
29624
|
ref
|
@@ -29468,7 +29630,7 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
29468
29630
|
className: ["lucide", `lucide-${toKebabCase(iconName)}`, className].join(" ")
|
29469
29631
|
}), rest),
|
29470
29632
|
[
|
29471
|
-
...iconNode.map(([tag, attrs]) => (0,
|
29633
|
+
...iconNode.map(([tag, attrs]) => (0, import_react5.createElement)(tag, attrs)),
|
29472
29634
|
...Array.isArray(children) ? children : [children]
|
29473
29635
|
]
|
29474
29636
|
);
|
@@ -29579,6 +29741,14 @@ var Lock = createLucideIcon("Lock", [
|
|
29579
29741
|
["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
|
29580
29742
|
]);
|
29581
29743
|
|
29744
|
+
// ../../node_modules/lucide-react/dist/esm/icons/monitor.js
|
29745
|
+
init_react_import();
|
29746
|
+
var Monitor = createLucideIcon("Monitor", [
|
29747
|
+
["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
|
29748
|
+
["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
|
29749
|
+
["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
|
29750
|
+
]);
|
29751
|
+
|
29582
29752
|
// ../../node_modules/lucide-react/dist/esm/icons/more-vertical.js
|
29583
29753
|
init_react_import();
|
29584
29754
|
var MoreVertical = createLucideIcon("MoreVertical", [
|
@@ -29629,6 +29799,20 @@ var SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
|
|
29629
29799
|
["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
|
29630
29800
|
]);
|
29631
29801
|
|
29802
|
+
// ../../node_modules/lucide-react/dist/esm/icons/smartphone.js
|
29803
|
+
init_react_import();
|
29804
|
+
var Smartphone = createLucideIcon("Smartphone", [
|
29805
|
+
["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
|
29806
|
+
["path", { d: "M12 18h.01", key: "mhygvu" }]
|
29807
|
+
]);
|
29808
|
+
|
29809
|
+
// ../../node_modules/lucide-react/dist/esm/icons/tablet.js
|
29810
|
+
init_react_import();
|
29811
|
+
var Tablet = createLucideIcon("Tablet", [
|
29812
|
+
["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
|
29813
|
+
["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
|
29814
|
+
]);
|
29815
|
+
|
29632
29816
|
// ../../node_modules/lucide-react/dist/esm/icons/trash.js
|
29633
29817
|
init_react_import();
|
29634
29818
|
var Trash = createLucideIcon("Trash", [
|
@@ -29652,12 +29836,29 @@ var Unlock = createLucideIcon("Unlock", [
|
|
29652
29836
|
["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
|
29653
29837
|
]);
|
29654
29838
|
|
29839
|
+
// ../../node_modules/lucide-react/dist/esm/icons/zoom-in.js
|
29840
|
+
init_react_import();
|
29841
|
+
var ZoomIn = createLucideIcon("ZoomIn", [
|
29842
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
29843
|
+
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
29844
|
+
["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
|
29845
|
+
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
|
29846
|
+
]);
|
29847
|
+
|
29848
|
+
// ../../node_modules/lucide-react/dist/esm/icons/zoom-out.js
|
29849
|
+
init_react_import();
|
29850
|
+
var ZoomOut = createLucideIcon("ZoomOut", [
|
29851
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
29852
|
+
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
29853
|
+
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
|
29854
|
+
]);
|
29855
|
+
|
29655
29856
|
// lib/use-modifier-held.ts
|
29656
29857
|
init_react_import();
|
29657
|
-
var
|
29858
|
+
var import_react6 = require("react");
|
29658
29859
|
var useModifierHeld = (modifier) => {
|
29659
|
-
const [modifierHeld, setModifierHeld] = (0,
|
29660
|
-
(0,
|
29860
|
+
const [modifierHeld, setModifierHeld] = (0, import_react6.useState)(false);
|
29861
|
+
(0, import_react6.useEffect)(() => {
|
29661
29862
|
function downHandler({ key }) {
|
29662
29863
|
if (key === modifier) {
|
29663
29864
|
setModifierHeld(true);
|
@@ -29678,10 +29879,26 @@ var useModifierHeld = (modifier) => {
|
|
29678
29879
|
return modifierHeld;
|
29679
29880
|
};
|
29680
29881
|
|
29882
|
+
// lib/is-ios.ts
|
29883
|
+
init_react_import();
|
29884
|
+
var isIos = () => [
|
29885
|
+
"iPad Simulator",
|
29886
|
+
"iPhone Simulator",
|
29887
|
+
"iPod Simulator",
|
29888
|
+
"iPad",
|
29889
|
+
"iPhone",
|
29890
|
+
"iPod"
|
29891
|
+
].includes(navigator.platform) || // iPad on iOS 13 detection
|
29892
|
+
navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
29893
|
+
|
29681
29894
|
// components/DraggableComponent/index.tsx
|
29682
29895
|
var import_react_spinners2 = require("react-spinners");
|
29683
|
-
var
|
29896
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
29684
29897
|
var getClassName4 = get_class_name_factory_default("DraggableComponent", styles_module_default3);
|
29898
|
+
var space = 8;
|
29899
|
+
var actionsOverlayTop = space * 6.5;
|
29900
|
+
var actionsTop = -(actionsOverlayTop - 8);
|
29901
|
+
var actionsRight = space;
|
29685
29902
|
var DraggableComponent = ({
|
29686
29903
|
children,
|
29687
29904
|
id,
|
@@ -29704,15 +29921,25 @@ var DraggableComponent = ({
|
|
29704
29921
|
indicativeHover = false,
|
29705
29922
|
style
|
29706
29923
|
}) => {
|
29924
|
+
const { zoomConfig } = useAppContext();
|
29707
29925
|
const isModifierHeld = useModifierHeld("Alt");
|
29708
|
-
|
29709
|
-
|
29710
|
-
|
29926
|
+
const { status } = useAppContext();
|
29927
|
+
const El = status !== "LOADING" ? import_dnd3.Draggable : DefaultDraggable;
|
29928
|
+
(0, import_react7.useEffect)(onMount, []);
|
29929
|
+
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0, import_react7.useState)(false);
|
29930
|
+
(0, import_react7.useEffect)(() => {
|
29931
|
+
if (isIos()) {
|
29932
|
+
setDisableSecondaryAnimation(true);
|
29933
|
+
}
|
29934
|
+
}, []);
|
29935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
29936
|
+
El,
|
29711
29937
|
{
|
29712
29938
|
draggableId: id,
|
29713
29939
|
index,
|
29714
29940
|
isDragDisabled,
|
29715
|
-
|
29941
|
+
disableSecondaryAnimation,
|
29942
|
+
children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
29716
29943
|
"div",
|
29717
29944
|
__spreadProps(__spreadValues(__spreadValues({
|
29718
29945
|
ref: provided.innerRef
|
@@ -29735,13 +29962,34 @@ var DraggableComponent = ({
|
|
29735
29962
|
onClick,
|
29736
29963
|
children: [
|
29737
29964
|
debug,
|
29738
|
-
isLoading && /* @__PURE__ */ (0,
|
29739
|
-
/* @__PURE__ */ (0,
|
29740
|
-
|
29741
|
-
|
29742
|
-
|
29743
|
-
|
29744
|
-
|
29965
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_spinners2.ClipLoader, { "aria-label": "loading", size: 16, color: "inherit" }) }),
|
29966
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
29967
|
+
"div",
|
29968
|
+
{
|
29969
|
+
className: getClassName4("actionsOverlay"),
|
29970
|
+
style: {
|
29971
|
+
top: actionsOverlayTop / zoomConfig.zoom
|
29972
|
+
},
|
29973
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
29974
|
+
"div",
|
29975
|
+
{
|
29976
|
+
className: getClassName4("actions"),
|
29977
|
+
style: {
|
29978
|
+
transform: `scale(${1 / zoomConfig.zoom}`,
|
29979
|
+
top: actionsTop / zoomConfig.zoom,
|
29980
|
+
right: actionsRight / zoomConfig.zoom
|
29981
|
+
},
|
29982
|
+
children: [
|
29983
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("actionsLabel"), children: label }),
|
29984
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDuplicate, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Copy, { size: 16 }) }),
|
29985
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDelete, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Trash, { size: 16 }) })
|
29986
|
+
]
|
29987
|
+
}
|
29988
|
+
)
|
29989
|
+
}
|
29990
|
+
),
|
29991
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("overlay") }),
|
29992
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("contents"), children })
|
29745
29993
|
]
|
29746
29994
|
})
|
29747
29995
|
)
|
@@ -29750,45 +29998,13 @@ var DraggableComponent = ({
|
|
29750
29998
|
);
|
29751
29999
|
};
|
29752
30000
|
|
29753
|
-
// components/DropZone/index.tsx
|
29754
|
-
var import_dnd4 = require("@hello-pangea/dnd");
|
29755
|
-
|
29756
|
-
// lib/get-item.ts
|
29757
|
-
init_react_import();
|
29758
|
-
|
29759
|
-
// lib/root-droppable-id.ts
|
29760
|
-
init_react_import();
|
29761
|
-
var rootDroppableId = "default-zone";
|
29762
|
-
|
29763
|
-
// lib/setup-zone.ts
|
29764
|
-
init_react_import();
|
29765
|
-
var setupZone = (data, zoneKey) => {
|
29766
|
-
if (zoneKey === rootDroppableId) {
|
29767
|
-
return data;
|
29768
|
-
}
|
29769
|
-
const newData = __spreadValues({}, data);
|
29770
|
-
newData.zones = data.zones || {};
|
29771
|
-
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
29772
|
-
return newData;
|
29773
|
-
};
|
29774
|
-
|
29775
|
-
// lib/get-item.ts
|
29776
|
-
var getItem = (selector, data, dynamicProps = {}) => {
|
29777
|
-
if (!selector.zone || selector.zone === rootDroppableId) {
|
29778
|
-
const item2 = data.content[selector.index];
|
29779
|
-
return __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props });
|
29780
|
-
}
|
29781
|
-
const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
|
29782
|
-
return __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props });
|
29783
|
-
};
|
29784
|
-
|
29785
30001
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
|
29786
30002
|
init_react_import();
|
29787
|
-
var styles_module_default4 = { "DropZone": "
|
30003
|
+
var styles_module_default4 = { "DropZone": "_DropZone_jtf9d_1", "DropZone-content": "_DropZone-content_jtf9d_10", "DropZone--userIsDragging": "_DropZone--userIsDragging_jtf9d_15", "DropZone--draggingOverArea": "_DropZone--draggingOverArea_jtf9d_19", "DropZone--draggingNewComponent": "_DropZone--draggingNewComponent_jtf9d_20", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_jtf9d_26", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_jtf9d_27", "DropZone--isDisabled": "_DropZone--isDisabled_jtf9d_28", "DropZone--isRootZone": "_DropZone--isRootZone_jtf9d_29", "DropZone--hasChildren": "_DropZone--hasChildren_jtf9d_30", "DropZone--isDestination": "_DropZone--isDestination_jtf9d_40", "DropZone-item": "_DropZone-item_jtf9d_48", "DropZone-hitbox": "_DropZone-hitbox_jtf9d_52" };
|
29788
30004
|
|
29789
30005
|
// components/DropZone/context.tsx
|
29790
30006
|
init_react_import();
|
29791
|
-
var
|
30007
|
+
var import_react8 = require("react");
|
29792
30008
|
var import_use_debounce = require("use-debounce");
|
29793
30009
|
|
29794
30010
|
// lib/get-zone-id.ts
|
@@ -29804,30 +30020,30 @@ var getZoneId = (zoneCompound) => {
|
|
29804
30020
|
};
|
29805
30021
|
|
29806
30022
|
// components/DropZone/context.tsx
|
29807
|
-
var
|
29808
|
-
var dropZoneContext = (0,
|
30023
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
30024
|
+
var dropZoneContext = (0, import_react8.createContext)(null);
|
29809
30025
|
var DropZoneProvider = ({
|
29810
30026
|
children,
|
29811
30027
|
value
|
29812
30028
|
}) => {
|
29813
|
-
const [hoveringArea, setHoveringArea] = (0,
|
29814
|
-
const [hoveringZone, setHoveringZone] = (0,
|
30029
|
+
const [hoveringArea, setHoveringArea] = (0, import_react8.useState)(null);
|
30030
|
+
const [hoveringZone, setHoveringZone] = (0, import_react8.useState)(
|
29815
30031
|
rootDroppableId
|
29816
30032
|
);
|
29817
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
30033
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react8.useState)();
|
29818
30034
|
const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
|
29819
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
30035
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react8.useState)(
|
29820
30036
|
{}
|
29821
30037
|
);
|
29822
|
-
const [activeZones, setActiveZones] = (0,
|
30038
|
+
const [activeZones, setActiveZones] = (0, import_react8.useState)({});
|
29823
30039
|
const { dispatch = null } = value ? value : {};
|
29824
|
-
const registerZoneArea = (0,
|
30040
|
+
const registerZoneArea = (0, import_react8.useCallback)(
|
29825
30041
|
(area) => {
|
29826
30042
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
29827
30043
|
},
|
29828
30044
|
[setAreasWithZones]
|
29829
30045
|
);
|
29830
|
-
const registerZone = (0,
|
30046
|
+
const registerZone = (0, import_react8.useCallback)(
|
29831
30047
|
(zoneCompound) => {
|
29832
30048
|
if (!dispatch) {
|
29833
30049
|
return;
|
@@ -29840,7 +30056,7 @@ var DropZoneProvider = ({
|
|
29840
30056
|
},
|
29841
30057
|
[setActiveZones, dispatch]
|
29842
30058
|
);
|
29843
|
-
const unregisterZone = (0,
|
30059
|
+
const unregisterZone = (0, import_react8.useCallback)(
|
29844
30060
|
(zoneCompound) => {
|
29845
30061
|
if (!dispatch) {
|
29846
30062
|
return;
|
@@ -29855,8 +30071,8 @@ var DropZoneProvider = ({
|
|
29855
30071
|
},
|
29856
30072
|
[setActiveZones, dispatch]
|
29857
30073
|
);
|
29858
|
-
const [pathData, setPathData] = (0,
|
29859
|
-
const registerPath = (0,
|
30074
|
+
const [pathData, setPathData] = (0, import_react8.useState)();
|
30075
|
+
const registerPath = (0, import_react8.useCallback)(
|
29860
30076
|
(selector) => {
|
29861
30077
|
if (!(value == null ? void 0 : value.data)) {
|
29862
30078
|
return;
|
@@ -29881,7 +30097,8 @@ var DropZoneProvider = ({
|
|
29881
30097
|
},
|
29882
30098
|
[value, setPathData]
|
29883
30099
|
);
|
29884
|
-
|
30100
|
+
const [zoneWillDrag, setZoneWillDrag] = (0, import_react8.useState)("");
|
30101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
29885
30102
|
dropZoneContext.Provider,
|
29886
30103
|
{
|
29887
30104
|
value: __spreadValues({
|
@@ -29897,57 +30114,17 @@ var DropZoneProvider = ({
|
|
29897
30114
|
unregisterZone,
|
29898
30115
|
activeZones,
|
29899
30116
|
registerPath,
|
29900
|
-
pathData
|
30117
|
+
pathData,
|
30118
|
+
zoneWillDrag,
|
30119
|
+
setZoneWillDrag
|
29901
30120
|
}, value),
|
29902
30121
|
children
|
29903
30122
|
}
|
29904
30123
|
) });
|
29905
30124
|
};
|
29906
30125
|
|
29907
|
-
// components/Puck/context.tsx
|
29908
|
-
init_react_import();
|
29909
|
-
var import_react8 = require("react");
|
29910
|
-
var defaultAppState = {
|
29911
|
-
data: { content: [], root: { props: { title: "" } } },
|
29912
|
-
ui: {
|
29913
|
-
leftSideBarVisible: true,
|
29914
|
-
rightSideBarVisible: true,
|
29915
|
-
arrayState: {},
|
29916
|
-
itemSelector: null,
|
29917
|
-
componentList: {},
|
29918
|
-
isDragging: false
|
29919
|
-
}
|
29920
|
-
};
|
29921
|
-
var appContext = (0, import_react8.createContext)({
|
29922
|
-
state: defaultAppState,
|
29923
|
-
dispatch: () => null,
|
29924
|
-
config: { components: {} },
|
29925
|
-
componentState: {},
|
29926
|
-
resolveData: () => {
|
29927
|
-
},
|
29928
|
-
plugins: [],
|
29929
|
-
overrides: {},
|
29930
|
-
history: {}
|
29931
|
-
});
|
29932
|
-
var AppProvider = appContext.Provider;
|
29933
|
-
function useAppContext() {
|
29934
|
-
const mainContext = (0, import_react8.useContext)(appContext);
|
29935
|
-
const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
|
29936
|
-
return __spreadProps(__spreadValues({}, mainContext), {
|
29937
|
-
// Helpers
|
29938
|
-
selectedItem,
|
29939
|
-
setUi: (ui, recordHistory) => {
|
29940
|
-
return mainContext.dispatch({
|
29941
|
-
type: "setUi",
|
29942
|
-
ui,
|
29943
|
-
recordHistory
|
29944
|
-
});
|
29945
|
-
}
|
29946
|
-
});
|
29947
|
-
}
|
29948
|
-
|
29949
30126
|
// components/DropZone/index.tsx
|
29950
|
-
var
|
30127
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
29951
30128
|
var getClassName5 = get_class_name_factory_default("DropZone", styles_module_default4);
|
29952
30129
|
function DropZoneEdit({ zone, allow, disallow, style }) {
|
29953
30130
|
var _a;
|
@@ -29966,7 +30143,8 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
29966
30143
|
registerZoneArea,
|
29967
30144
|
areasWithZones,
|
29968
30145
|
hoveringComponent,
|
29969
|
-
|
30146
|
+
zoneWillDrag,
|
30147
|
+
setZoneWillDrag = () => null
|
29970
30148
|
} = ctx || {};
|
29971
30149
|
let content = data.content || [];
|
29972
30150
|
let zoneCompound = rootDroppableId;
|
@@ -29996,12 +30174,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
29996
30174
|
const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
|
29997
30175
|
const [zoneArea] = getZoneId(zoneCompound);
|
29998
30176
|
const [draggedSourceArea] = getZoneId(draggedSourceId);
|
29999
|
-
const
|
30177
|
+
const userWillDrag = zoneWillDrag === zone;
|
30000
30178
|
const userIsDragging = !!draggedItem;
|
30001
30179
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
30002
30180
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
30003
30181
|
if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
|
30004
|
-
return /* @__PURE__ */ (0,
|
30182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: "DropZone requires context to work." });
|
30005
30183
|
}
|
30006
30184
|
const {
|
30007
30185
|
hoveringArea = "root",
|
@@ -30038,7 +30216,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30038
30216
|
}
|
30039
30217
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
30040
30218
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
30041
|
-
return /* @__PURE__ */ (0,
|
30219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30042
30220
|
"div",
|
30043
30221
|
{
|
30044
30222
|
className: getClassName5({
|
@@ -30050,17 +30228,19 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30050
30228
|
isDestination: draggedDestinationId === zoneCompound,
|
30051
30229
|
isDisabled: !isEnabled,
|
30052
30230
|
isAreaSelected,
|
30053
|
-
hasChildren: content.length > 0
|
30054
|
-
zoomEnabled: !disableZoom
|
30231
|
+
hasChildren: content.length > 0
|
30055
30232
|
}),
|
30056
|
-
|
30057
|
-
|
30233
|
+
onMouseUp: () => {
|
30234
|
+
setZoneWillDrag("");
|
30235
|
+
},
|
30236
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30237
|
+
Droppable,
|
30058
30238
|
{
|
30059
30239
|
droppableId: zoneCompound,
|
30060
30240
|
direction: "vertical",
|
30061
30241
|
isDropDisabled: !isEnabled,
|
30062
30242
|
children: (provided, snapshot) => {
|
30063
|
-
return /* @__PURE__ */ (0,
|
30243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
30064
30244
|
"div",
|
30065
30245
|
__spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
|
30066
30246
|
className: getClassName5("content"),
|
@@ -30074,7 +30254,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30074
30254
|
},
|
30075
30255
|
children: [
|
30076
30256
|
content.map((item, i) => {
|
30077
|
-
var _a2, _b;
|
30257
|
+
var _a2, _b, _c;
|
30078
30258
|
const componentId = item.props.id;
|
30079
30259
|
const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a2 = config.components[item.type]) == null ? void 0 : _a2.defaultProps), item.props), {
|
30080
30260
|
puck: { renderDropZone: DropZone },
|
@@ -30085,33 +30265,33 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30085
30265
|
"draggable-"
|
30086
30266
|
)[1] === componentId;
|
30087
30267
|
const containsZone = areasWithZones ? areasWithZones[componentId] : false;
|
30088
|
-
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0,
|
30268
|
+
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
30089
30269
|
"No configuration for ",
|
30090
30270
|
item.type
|
30091
30271
|
] });
|
30092
|
-
return /* @__PURE__ */ (0,
|
30272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
30093
30273
|
"div",
|
30094
30274
|
{
|
30095
30275
|
className: getClassName5("item"),
|
30096
30276
|
style: { zIndex: isDragging ? 1 : void 0 },
|
30097
30277
|
children: [
|
30098
|
-
/* @__PURE__ */ (0,
|
30278
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30099
30279
|
DropZoneProvider,
|
30100
30280
|
{
|
30101
30281
|
value: __spreadProps(__spreadValues({}, ctx), {
|
30102
30282
|
areaId: componentId
|
30103
30283
|
}),
|
30104
|
-
children: /* @__PURE__ */ (0,
|
30284
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30105
30285
|
DraggableComponent,
|
30106
30286
|
{
|
30107
|
-
label: item.type.toString(),
|
30287
|
+
label: (_b = config.components[item.type]["label"]) != null ? _b : item.type.toString(),
|
30108
30288
|
id: `draggable-${componentId}`,
|
30109
30289
|
index: i,
|
30110
30290
|
isSelected,
|
30111
30291
|
isLocked: userIsDragging,
|
30112
30292
|
forceHover: hoveringComponent === componentId && !userIsDragging,
|
30113
30293
|
indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
|
30114
|
-
isLoading: (
|
30294
|
+
isLoading: (_c = appContext2.componentState[componentId]) == null ? void 0 : _c.loading,
|
30115
30295
|
onMount: () => {
|
30116
30296
|
ctx.registerPath({
|
30117
30297
|
index: i,
|
@@ -30127,11 +30307,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30127
30307
|
},
|
30128
30308
|
onMouseDown: (e) => {
|
30129
30309
|
e.stopPropagation();
|
30130
|
-
|
30131
|
-
},
|
30132
|
-
onMouseUp: (e) => {
|
30133
|
-
e.stopPropagation();
|
30134
|
-
setUserWillDrag(false);
|
30310
|
+
setZoneWillDrag(zone);
|
30135
30311
|
},
|
30136
30312
|
onMouseOver: (e) => {
|
30137
30313
|
e.stopPropagation();
|
@@ -30172,12 +30348,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30172
30348
|
style: {
|
30173
30349
|
pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
|
30174
30350
|
},
|
30175
|
-
children: /* @__PURE__ */ (0,
|
30351
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName5("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Render2, __spreadValues({}, defaultedProps)) })
|
30176
30352
|
}
|
30177
30353
|
)
|
30178
30354
|
}
|
30179
30355
|
),
|
30180
|
-
userIsDragging && /* @__PURE__ */ (0,
|
30356
|
+
userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30181
30357
|
"div",
|
30182
30358
|
{
|
30183
30359
|
className: getClassName5("hitbox"),
|
@@ -30194,7 +30370,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30194
30370
|
);
|
30195
30371
|
}),
|
30196
30372
|
provided == null ? void 0 : provided.placeholder,
|
30197
|
-
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0,
|
30373
|
+
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30198
30374
|
"div",
|
30199
30375
|
{
|
30200
30376
|
"data-puck-placeholder": true,
|
@@ -30226,14 +30402,14 @@ function DropZoneRender({ zone }) {
|
|
30226
30402
|
zoneCompound = `${areaId}:${zone}`;
|
30227
30403
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
30228
30404
|
}
|
30229
|
-
return /* @__PURE__ */ (0,
|
30405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: content.map((item) => {
|
30230
30406
|
const Component = config.components[item.type];
|
30231
30407
|
if (Component) {
|
30232
|
-
return /* @__PURE__ */ (0,
|
30408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30233
30409
|
DropZoneProvider,
|
30234
30410
|
{
|
30235
30411
|
value: { data, config, areaId: item.props.id },
|
30236
|
-
children: /* @__PURE__ */ (0,
|
30412
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30237
30413
|
Component.render,
|
30238
30414
|
__spreadProps(__spreadValues({}, item.props), {
|
30239
30415
|
puck: { renderDropZone: DropZone }
|
@@ -30249,9 +30425,9 @@ function DropZoneRender({ zone }) {
|
|
30249
30425
|
function DropZone(props) {
|
30250
30426
|
const ctx = (0, import_react9.useContext)(dropZoneContext);
|
30251
30427
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
30252
|
-
return /* @__PURE__ */ (0,
|
30428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneEdit, __spreadValues({}, props));
|
30253
30429
|
}
|
30254
|
-
return /* @__PURE__ */ (0,
|
30430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneRender, __spreadValues({}, props));
|
30255
30431
|
}
|
30256
30432
|
|
30257
30433
|
// components/IconButton/index.ts
|
@@ -30263,11 +30439,11 @@ var import_react10 = require("react");
|
|
30263
30439
|
|
30264
30440
|
// css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
|
30265
30441
|
init_react_import();
|
30266
|
-
var IconButton_module_default = { "IconButton": "
|
30442
|
+
var IconButton_module_default = { "IconButton": "_IconButton_swpni_1", "IconButton--disabled": "_IconButton--disabled_swpni_20", "IconButton-title": "_IconButton-title_swpni_33" };
|
30267
30443
|
|
30268
30444
|
// components/IconButton/IconButton.tsx
|
30269
30445
|
var import_react_spinners3 = require("react-spinners");
|
30270
|
-
var
|
30446
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
30271
30447
|
var getClassName6 = get_class_name_factory_default("IconButton", IconButton_module_default);
|
30272
30448
|
var IconButton = ({
|
30273
30449
|
children,
|
@@ -30283,7 +30459,7 @@ var IconButton = ({
|
|
30283
30459
|
}) => {
|
30284
30460
|
const [loading, setLoading] = (0, import_react10.useState)(false);
|
30285
30461
|
const ElementType = href ? "a" : "button";
|
30286
|
-
const el = /* @__PURE__ */ (0,
|
30462
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
30287
30463
|
ElementType,
|
30288
30464
|
{
|
30289
30465
|
className: getClassName6({
|
@@ -30308,11 +30484,11 @@ var IconButton = ({
|
|
30308
30484
|
href,
|
30309
30485
|
title,
|
30310
30486
|
children: [
|
30311
|
-
/* @__PURE__ */ (0,
|
30487
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: getClassName6("title"), children: title }),
|
30312
30488
|
children,
|
30313
|
-
loading && /* @__PURE__ */ (0,
|
30489
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
30314
30490
|
"\xA0\xA0",
|
30315
|
-
/* @__PURE__ */ (0,
|
30491
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
|
30316
30492
|
] })
|
30317
30493
|
]
|
30318
30494
|
}
|
@@ -30322,14 +30498,25 @@ var IconButton = ({
|
|
30322
30498
|
|
30323
30499
|
// components/Puck/index.tsx
|
30324
30500
|
init_react_import();
|
30325
|
-
var
|
30326
|
-
var import_dnd7 = require("@hello-pangea/dnd");
|
30501
|
+
var import_react28 = require("react");
|
30327
30502
|
|
30328
30503
|
// lib/use-placeholder-style.ts
|
30329
30504
|
init_react_import();
|
30330
30505
|
var import_react11 = require("react");
|
30331
|
-
|
30332
|
-
|
30506
|
+
|
30507
|
+
// lib/get-frame.ts
|
30508
|
+
init_react_import();
|
30509
|
+
var getFrame = () => {
|
30510
|
+
let frame = document.querySelector("#preview-frame");
|
30511
|
+
if ((frame == null ? void 0 : frame.tagName) === "IFRAME") {
|
30512
|
+
frame = frame.contentDocument;
|
30513
|
+
}
|
30514
|
+
return frame;
|
30515
|
+
};
|
30516
|
+
|
30517
|
+
// lib/use-placeholder-style.ts
|
30518
|
+
var usePlaceholderStyle = () => {
|
30519
|
+
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
30333
30520
|
const [placeholderStyle, setPlaceholderStyle] = (0, import_react11.useState)();
|
30334
30521
|
const onDragStartOrUpdate = (draggedItem) => {
|
30335
30522
|
var _a;
|
@@ -30337,11 +30524,12 @@ var usePlaceholderStyle = () => {
|
|
30337
30524
|
const destinationIndex = (draggedItem.destination || draggedItem.source).index;
|
30338
30525
|
const droppableId = (draggedItem.destination || draggedItem.source).droppableId;
|
30339
30526
|
const domQuery = `[${queryAttr}='${draggableId}']`;
|
30340
|
-
const
|
30527
|
+
const frame = getFrame();
|
30528
|
+
const draggedDOM = document.querySelector(domQuery) || (frame == null ? void 0 : frame.querySelector(domQuery));
|
30341
30529
|
if (!draggedDOM) {
|
30342
30530
|
return;
|
30343
30531
|
}
|
30344
|
-
const targetListElement =
|
30532
|
+
const targetListElement = frame == null ? void 0 : frame.querySelector(
|
30345
30533
|
`[data-rfd-droppable-id='${droppableId}']`
|
30346
30534
|
);
|
30347
30535
|
const { clientHeight } = draggedDOM;
|
@@ -30388,11 +30576,11 @@ init_react_import();
|
|
30388
30576
|
var styles_module_default6 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
|
30389
30577
|
|
30390
30578
|
// components/Heading/index.tsx
|
30391
|
-
var
|
30579
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
30392
30580
|
var getClassName7 = get_class_name_factory_default("Heading", styles_module_default6);
|
30393
30581
|
var Heading = ({ children, rank, size = "m" }) => {
|
30394
30582
|
const Tag = rank ? `h${rank}` : "span";
|
30395
|
-
return /* @__PURE__ */ (0,
|
30583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
30396
30584
|
Tag,
|
30397
30585
|
{
|
30398
30586
|
className: getClassName7({
|
@@ -30471,7 +30659,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
30471
30659
|
|
30472
30660
|
// components/SidebarSection/index.tsx
|
30473
30661
|
var import_react_spinners4 = require("react-spinners");
|
30474
|
-
var
|
30662
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
30475
30663
|
var getClassName8 = get_class_name_factory_default("SidebarSection", styles_module_default5);
|
30476
30664
|
var SidebarSection = ({
|
30477
30665
|
children,
|
@@ -30484,15 +30672,15 @@ var SidebarSection = ({
|
|
30484
30672
|
}) => {
|
30485
30673
|
const { setUi } = useAppContext();
|
30486
30674
|
const breadcrumbs = useBreadcrumbs(1);
|
30487
|
-
return /* @__PURE__ */ (0,
|
30675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
30488
30676
|
"div",
|
30489
30677
|
{
|
30490
30678
|
className: getClassName8({ noBorderTop, noPadding }),
|
30491
30679
|
style: { background },
|
30492
30680
|
children: [
|
30493
|
-
/* @__PURE__ */ (0,
|
30494
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
30495
|
-
/* @__PURE__ */ (0,
|
30681
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("title"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName8("breadcrumbs"), children: [
|
30682
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName8("breadcrumb"), children: [
|
30683
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
30496
30684
|
"button",
|
30497
30685
|
{
|
30498
30686
|
className: getClassName8("breadcrumbLabel"),
|
@@ -30500,12 +30688,12 @@ var SidebarSection = ({
|
|
30500
30688
|
children: breadcrumb.label
|
30501
30689
|
}
|
30502
30690
|
),
|
30503
|
-
/* @__PURE__ */ (0,
|
30691
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronRight, { size: 16 })
|
30504
30692
|
] }, i)) : null,
|
30505
|
-
/* @__PURE__ */ (0,
|
30693
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
|
30506
30694
|
] }) }),
|
30507
|
-
/* @__PURE__ */ (0,
|
30508
|
-
isLoading && /* @__PURE__ */ (0,
|
30695
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("content"), children }),
|
30696
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_spinners4.ClipLoader, { "aria-label": "loading" }) })
|
30509
30697
|
]
|
30510
30698
|
}
|
30511
30699
|
);
|
@@ -31011,7 +31199,10 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
31011
31199
|
);
|
31012
31200
|
const runResolvers = () => __async(void 0, null, function* () {
|
31013
31201
|
const newData = newAppState.data;
|
31014
|
-
const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) =>
|
31202
|
+
const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) => {
|
31203
|
+
var _a;
|
31204
|
+
return !!((_a = config.components[item.type]) == null ? void 0 : _a.resolveData);
|
31205
|
+
});
|
31015
31206
|
const applyIfChange = (dynamicDataMap, dynamicRoot) => {
|
31016
31207
|
const processed = applyDynamicProps(
|
31017
31208
|
appState.data,
|
@@ -31084,7 +31275,7 @@ init_react_import();
|
|
31084
31275
|
var styles_module_default7 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
|
31085
31276
|
|
31086
31277
|
// components/MenuBar/index.tsx
|
31087
|
-
var
|
31278
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
31088
31279
|
var getClassName9 = get_class_name_factory_default("MenuBar", styles_module_default7);
|
31089
31280
|
var MenuBar = ({
|
31090
31281
|
appState,
|
@@ -31099,7 +31290,7 @@ var MenuBar = ({
|
|
31099
31290
|
history: { back, forward, historyStore }
|
31100
31291
|
} = useAppContext();
|
31101
31292
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
31102
|
-
return /* @__PURE__ */ (0,
|
31293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31103
31294
|
"div",
|
31104
31295
|
{
|
31105
31296
|
className: getClassName9({ menuOpen }),
|
@@ -31113,16 +31304,16 @@ var MenuBar = ({
|
|
31113
31304
|
setMenuOpen(false);
|
31114
31305
|
}
|
31115
31306
|
},
|
31116
|
-
children: /* @__PURE__ */ (0,
|
31117
|
-
/* @__PURE__ */ (0,
|
31118
|
-
/* @__PURE__ */ (0,
|
31307
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName9("inner"), children: [
|
31308
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName9("history"), children: [
|
31309
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31119
31310
|
ChevronLeft,
|
31120
31311
|
{
|
31121
31312
|
size: 21,
|
31122
31313
|
stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
|
31123
31314
|
}
|
31124
31315
|
) }),
|
31125
|
-
/* @__PURE__ */ (0,
|
31316
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31126
31317
|
ChevronRight,
|
31127
31318
|
{
|
31128
31319
|
size: 21,
|
@@ -31130,17 +31321,17 @@ var MenuBar = ({
|
|
31130
31321
|
}
|
31131
31322
|
) })
|
31132
31323
|
] }),
|
31133
|
-
/* @__PURE__ */ (0,
|
31324
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
31134
31325
|
state: appState,
|
31135
31326
|
dispatch
|
31136
31327
|
}) }),
|
31137
|
-
/* @__PURE__ */ (0,
|
31328
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31138
31329
|
Button,
|
31139
31330
|
{
|
31140
31331
|
onClick: () => {
|
31141
31332
|
onPublish && onPublish(data);
|
31142
31333
|
},
|
31143
|
-
icon: /* @__PURE__ */ (0,
|
31334
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Globe, { size: "14px" }),
|
31144
31335
|
children: "Publish"
|
31145
31336
|
}
|
31146
31337
|
) })
|
@@ -31151,7 +31342,7 @@ var MenuBar = ({
|
|
31151
31342
|
|
31152
31343
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
31153
31344
|
init_react_import();
|
31154
|
-
var styles_module_default8 = { "Puck": "
|
31345
|
+
var styles_module_default8 = { "Puck": "_Puck_1d0ul_19", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_1d0ul_36", "Puck--rightSideBarVisible": "_Puck--rightSideBarVisible_1d0ul_42", "Puck-header": "_Puck-header_1d0ul_96", "Puck-headerInner": "_Puck-headerInner_1d0ul_105", "Puck-headerToggle": "_Puck-headerToggle_1d0ul_115", "Puck-rightSideBarToggle": "_Puck-rightSideBarToggle_1d0ul_122", "Puck-leftSideBarToggle": "_Puck-leftSideBarToggle_1d0ul_123", "Puck-headerTitle": "_Puck-headerTitle_1d0ul_127", "Puck-headerPath": "_Puck-headerPath_1d0ul_131", "Puck-headerTools": "_Puck-headerTools_1d0ul_138", "Puck-menuButton": "_Puck-menuButton_1d0ul_144", "Puck--menuOpen": "_Puck--menuOpen_1d0ul_149", "Puck-leftSideBar": "_Puck-leftSideBar_1d0ul_123", "Puck-rightSideBar": "_Puck-rightSideBar_1d0ul_122", "Puck-portal": "_Puck-portal_1d0ul_177" };
|
31155
31346
|
|
31156
31347
|
// components/Puck/components/Fields/index.tsx
|
31157
31348
|
init_react_import();
|
@@ -31175,13 +31366,24 @@ init_react_import();
|
|
31175
31366
|
|
31176
31367
|
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ArrayField/styles.module.css#css-module
|
31177
31368
|
init_react_import();
|
31178
|
-
var styles_module_default10 = { "ArrayField": "
|
31369
|
+
var styles_module_default10 = { "ArrayField": "_ArrayField_1lr58_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1lr58_13", "ArrayField-addButton": "_ArrayField-addButton_1lr58_18", "ArrayField--hasItems": "_ArrayField--hasItems_1lr58_33", "ArrayFieldItem": "_ArrayFieldItem_1lr58_63", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1lr58_71", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1lr58_81", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1lr58_97", "ArrayField--addDisabled": "_ArrayField--addDisabled_1lr58_128", "ArrayFieldItem-body": "_ArrayFieldItem-body_1lr58_164", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1lr58_173", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1lr58_180", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1lr58_186" };
|
31179
31370
|
|
31180
31371
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
31181
|
-
var import_dnd5 = require("@hello-pangea/dnd");
|
31182
|
-
var import_dnd6 = require("@hello-pangea/dnd");
|
31183
31372
|
var import_react14 = require("react");
|
31184
|
-
|
31373
|
+
|
31374
|
+
// components/DragDropContext/index.tsx
|
31375
|
+
init_react_import();
|
31376
|
+
var import_dnd4 = require("@measured/dnd");
|
31377
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
31378
|
+
var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children });
|
31379
|
+
var DragDropContext = (props) => {
|
31380
|
+
const { status } = useAppContext();
|
31381
|
+
const El = status !== "LOADING" ? import_dnd4.DragDropContext : DefaultDragDropContext;
|
31382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(El, __spreadValues({}, props));
|
31383
|
+
};
|
31384
|
+
|
31385
|
+
// components/InputOrGroup/fields/ArrayField/index.tsx
|
31386
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
31185
31387
|
var getClassName10 = get_class_name_factory_default("ArrayField", styles_module_default10);
|
31186
31388
|
var getClassNameItem2 = get_class_name_factory_default("ArrayFieldItem", styles_module_default10);
|
31187
31389
|
var ArrayField = ({
|
@@ -31245,21 +31447,24 @@ var ArrayField = ({
|
|
31245
31447
|
[arrayState]
|
31246
31448
|
);
|
31247
31449
|
(0, import_react14.useEffect)(() => {
|
31248
|
-
|
31450
|
+
if (arrayState.items.length > 0) {
|
31451
|
+
setUi(mapArrayStateToUi(arrayState));
|
31452
|
+
}
|
31249
31453
|
}, []);
|
31250
31454
|
const [hovering, setHovering] = (0, import_react14.useState)(false);
|
31251
31455
|
if (field.type !== "array" || !field.arrayFields) {
|
31252
31456
|
return null;
|
31253
31457
|
}
|
31254
|
-
|
31458
|
+
const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
|
31459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31255
31460
|
FieldLabelInternal,
|
31256
31461
|
{
|
31257
31462
|
label: label || name,
|
31258
|
-
icon: /* @__PURE__ */ (0,
|
31463
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(List, { size: 16 }),
|
31259
31464
|
el: "div",
|
31260
31465
|
readOnly,
|
31261
|
-
children: /* @__PURE__ */ (0,
|
31262
|
-
|
31466
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31467
|
+
DragDropContext,
|
31263
31468
|
{
|
31264
31469
|
onDragEnd: (event) => {
|
31265
31470
|
var _a, _b;
|
@@ -31285,14 +31490,15 @@ var ArrayField = ({
|
|
31285
31490
|
});
|
31286
31491
|
}
|
31287
31492
|
},
|
31288
|
-
children: /* @__PURE__ */ (0,
|
31289
|
-
return /* @__PURE__ */ (0,
|
31493
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
|
31494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
31290
31495
|
"div",
|
31291
31496
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
31292
31497
|
ref: provided.innerRef,
|
31293
31498
|
className: getClassName10({
|
31294
31499
|
isDraggingFrom: !!snapshot.draggingFromThisWith,
|
31295
|
-
hasItems: Array.isArray(value) && value.length > 0
|
31500
|
+
hasItems: Array.isArray(value) && value.length > 0,
|
31501
|
+
addDisabled
|
31296
31502
|
}),
|
31297
31503
|
onMouseOver: (e) => {
|
31298
31504
|
e.stopPropagation();
|
@@ -31306,7 +31512,7 @@ var ArrayField = ({
|
|
31306
31512
|
localState.arrayState.items.map((item, i) => {
|
31307
31513
|
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
31308
31514
|
const data = Array.from(localState.value || [])[i] || {};
|
31309
|
-
return /* @__PURE__ */ (0,
|
31515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31310
31516
|
Draggable,
|
31311
31517
|
{
|
31312
31518
|
id: _arrayId,
|
@@ -31317,8 +31523,8 @@ var ArrayField = ({
|
|
31317
31523
|
readOnly
|
31318
31524
|
}),
|
31319
31525
|
isDragDisabled: readOnly || !hovering,
|
31320
|
-
children: () => /* @__PURE__ */ (0,
|
31321
|
-
/* @__PURE__ */ (0,
|
31526
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
31527
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
31322
31528
|
"div",
|
31323
31529
|
{
|
31324
31530
|
onClick: () => {
|
@@ -31339,10 +31545,12 @@ var ArrayField = ({
|
|
31339
31545
|
className: getClassNameItem2("summary"),
|
31340
31546
|
children: [
|
31341
31547
|
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
31342
|
-
/* @__PURE__ */ (0,
|
31343
|
-
!readOnly && /* @__PURE__ */ (0,
|
31548
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameItem2("rhs"), children: [
|
31549
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("action"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31344
31550
|
IconButton,
|
31345
31551
|
{
|
31552
|
+
type: "button",
|
31553
|
+
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
31346
31554
|
onClick: (e) => {
|
31347
31555
|
e.stopPropagation();
|
31348
31556
|
const existingValue = [
|
@@ -31361,20 +31569,20 @@ var ArrayField = ({
|
|
31361
31569
|
);
|
31362
31570
|
},
|
31363
31571
|
title: "Delete",
|
31364
|
-
children: /* @__PURE__ */ (0,
|
31572
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Trash, { size: 16 })
|
31365
31573
|
}
|
31366
31574
|
) }) }),
|
31367
|
-
/* @__PURE__ */ (0,
|
31575
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DragIcon, {}) })
|
31368
31576
|
] })
|
31369
31577
|
]
|
31370
31578
|
}
|
31371
31579
|
),
|
31372
|
-
/* @__PURE__ */ (0,
|
31580
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("body"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("fieldset", { className: getClassNameItem2("fieldset"), children: Object.keys(field.arrayFields).map(
|
31373
31581
|
(fieldName) => {
|
31374
31582
|
const subField = field.arrayFields[fieldName];
|
31375
31583
|
const subFieldName = `${name}[${i}].${fieldName}`;
|
31376
31584
|
const wildcardFieldName = `${name}[*].${fieldName}`;
|
31377
|
-
return /* @__PURE__ */ (0,
|
31585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31378
31586
|
InputOrGroup,
|
31379
31587
|
{
|
31380
31588
|
name: subFieldName,
|
@@ -31403,9 +31611,10 @@ var ArrayField = ({
|
|
31403
31611
|
);
|
31404
31612
|
}),
|
31405
31613
|
provided.placeholder,
|
31406
|
-
/* @__PURE__ */ (0,
|
31614
|
+
!addDisabled && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31407
31615
|
"button",
|
31408
31616
|
{
|
31617
|
+
type: "button",
|
31409
31618
|
className: getClassName10("addButton"),
|
31410
31619
|
onClick: () => {
|
31411
31620
|
const existingValue = value || [];
|
@@ -31416,7 +31625,7 @@ var ArrayField = ({
|
|
31416
31625
|
const newArrayState = regenerateArrayState(newValue);
|
31417
31626
|
onChange(newValue, mapArrayStateToUi(newArrayState));
|
31418
31627
|
},
|
31419
|
-
children: /* @__PURE__ */ (0,
|
31628
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Plus, { size: 21 })
|
31420
31629
|
}
|
31421
31630
|
)
|
31422
31631
|
]
|
@@ -31431,7 +31640,7 @@ var ArrayField = ({
|
|
31431
31640
|
|
31432
31641
|
// components/InputOrGroup/fields/DefaultField/index.tsx
|
31433
31642
|
init_react_import();
|
31434
|
-
var
|
31643
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
31435
31644
|
var getClassName11 = get_class_name_factory_default("Input", styles_module_default9);
|
31436
31645
|
var DefaultField = ({
|
31437
31646
|
field,
|
@@ -31442,16 +31651,16 @@ var DefaultField = ({
|
|
31442
31651
|
label,
|
31443
31652
|
id
|
31444
31653
|
}) => {
|
31445
|
-
return /* @__PURE__ */ (0,
|
31654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
31446
31655
|
FieldLabelInternal,
|
31447
31656
|
{
|
31448
31657
|
label: label || name,
|
31449
|
-
icon: /* @__PURE__ */ (0,
|
31450
|
-
field.type === "text" && /* @__PURE__ */ (0,
|
31451
|
-
field.type === "number" && /* @__PURE__ */ (0,
|
31658
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
31659
|
+
field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Type, { size: 16 }),
|
31660
|
+
field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Hash, { size: 16 })
|
31452
31661
|
] }),
|
31453
31662
|
readOnly,
|
31454
|
-
children: /* @__PURE__ */ (0,
|
31663
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
31455
31664
|
"input",
|
31456
31665
|
{
|
31457
31666
|
className: getClassName11("input"),
|
@@ -31487,7 +31696,7 @@ var import_react16 = require("react");
|
|
31487
31696
|
|
31488
31697
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
31489
31698
|
init_react_import();
|
31490
|
-
var styles_module_default11 = { "ExternalInput-actions": "_ExternalInput-
|
31699
|
+
var styles_module_default11 = { "ExternalInput-actions": "_ExternalInput-actions_19obq_1", "ExternalInput-button": "_ExternalInput-button_19obq_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_19obq_25", "ExternalInput-detachButton": "_ExternalInput-detachButton_19obq_32", "ExternalInputModal": "_ExternalInputModal_19obq_74", "ExternalInputModal-grid": "_ExternalInputModal-grid_19obq_84", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_19obq_95", "ExternalInputModal-filters": "_ExternalInputModal-filters_19obq_100", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_19obq_119", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_19obq_128", "ExternalInputModal-table": "_ExternalInputModal-table_19obq_128", "ExternalInputModal-thead": "_ExternalInputModal-thead_19obq_144", "ExternalInputModal-th": "_ExternalInputModal-th_19obq_144", "ExternalInputModal-td": "_ExternalInputModal-td_19obq_159", "ExternalInputModal-tr": "_ExternalInputModal-tr_19obq_164", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_19obq_171", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_19obq_197", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_19obq_201", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_19obq_218", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_19obq_222", "ExternalInputModal-search": "_ExternalInputModal-search_19obq_222", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_19obq_259", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_19obq_284", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_19obq_294", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_19obq_308", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_19obq_321", "ExternalInputModal-footer": "_ExternalInputModal-footer_19obq_325" };
|
31491
31700
|
|
31492
31701
|
// components/Modal/index.tsx
|
31493
31702
|
init_react_import();
|
@@ -31495,11 +31704,11 @@ var import_react15 = require("react");
|
|
31495
31704
|
|
31496
31705
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
31497
31706
|
init_react_import();
|
31498
|
-
var styles_module_default12 = { "Modal": "
|
31707
|
+
var styles_module_default12 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Modal--isOpen_ikbaj_15", "Modal-inner": "_Modal-inner_ikbaj_19" };
|
31499
31708
|
|
31500
31709
|
// components/Modal/index.tsx
|
31501
31710
|
var import_react_dom = __toESM(require_react_dom());
|
31502
|
-
var
|
31711
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
31503
31712
|
var getClassName12 = get_class_name_factory_default("Modal", styles_module_default12);
|
31504
31713
|
var Modal = ({
|
31505
31714
|
children,
|
@@ -31511,10 +31720,10 @@ var Modal = ({
|
|
31511
31720
|
setRootEl(document.getElementById("puck-portal-root"));
|
31512
31721
|
}, []);
|
31513
31722
|
if (!rootEl) {
|
31514
|
-
return /* @__PURE__ */ (0,
|
31723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", {});
|
31515
31724
|
}
|
31516
31725
|
return (0, import_react_dom.createPortal)(
|
31517
|
-
/* @__PURE__ */ (0,
|
31726
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
31518
31727
|
"div",
|
31519
31728
|
{
|
31520
31729
|
className: getClassName12("inner"),
|
@@ -31528,7 +31737,7 @@ var Modal = ({
|
|
31528
31737
|
|
31529
31738
|
// components/ExternalInput/index.tsx
|
31530
31739
|
var import_react_spinners5 = require("react-spinners");
|
31531
|
-
var
|
31740
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
31532
31741
|
var getClassName13 = get_class_name_factory_default("ExternalInput", styles_module_default11);
|
31533
31742
|
var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default11);
|
31534
31743
|
var dataCache = {};
|
@@ -31568,7 +31777,7 @@ var ExternalInput = ({
|
|
31568
31777
|
const search = (0, import_react16.useCallback)(
|
31569
31778
|
(query, filters2) => __async(void 0, null, function* () {
|
31570
31779
|
setIsLoading(true);
|
31571
|
-
const cacheKey = `${id}-${
|
31780
|
+
const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
|
31572
31781
|
const listData = dataCache[cacheKey] || (yield field.fetchList({ query, filters: filters2 }));
|
31573
31782
|
if (listData) {
|
31574
31783
|
setData(listData);
|
@@ -31581,7 +31790,7 @@ var ExternalInput = ({
|
|
31581
31790
|
(0, import_react16.useEffect)(() => {
|
31582
31791
|
search(searchQuery, filters);
|
31583
31792
|
}, []);
|
31584
|
-
return /* @__PURE__ */ (0,
|
31793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
31585
31794
|
"div",
|
31586
31795
|
{
|
31587
31796
|
className: getClassName13({
|
@@ -31590,30 +31799,31 @@ var ExternalInput = ({
|
|
31590
31799
|
}),
|
31591
31800
|
id,
|
31592
31801
|
children: [
|
31593
|
-
/* @__PURE__ */ (0,
|
31594
|
-
/* @__PURE__ */ (0,
|
31802
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName13("actions"), children: [
|
31803
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31595
31804
|
"button",
|
31596
31805
|
{
|
31806
|
+
type: "button",
|
31597
31807
|
onClick: () => setOpen(true),
|
31598
31808
|
className: getClassName13("button"),
|
31599
|
-
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0,
|
31600
|
-
/* @__PURE__ */ (0,
|
31601
|
-
/* @__PURE__ */ (0,
|
31809
|
+
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
31810
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Link, { size: "16" }),
|
31811
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: field.placeholder })
|
31602
31812
|
] })
|
31603
31813
|
}
|
31604
31814
|
),
|
31605
|
-
value && /* @__PURE__ */ (0,
|
31815
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31606
31816
|
"button",
|
31607
31817
|
{
|
31608
31818
|
className: getClassName13("detachButton"),
|
31609
31819
|
onClick: () => {
|
31610
31820
|
onChange(null);
|
31611
31821
|
},
|
31612
|
-
children: /* @__PURE__ */ (0,
|
31822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Unlock, { size: 16 })
|
31613
31823
|
}
|
31614
31824
|
)
|
31615
31825
|
] }),
|
31616
|
-
/* @__PURE__ */ (0,
|
31826
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
31617
31827
|
"form",
|
31618
31828
|
{
|
31619
31829
|
className: getClassNameModal({
|
@@ -31627,11 +31837,11 @@ var ExternalInput = ({
|
|
31627
31837
|
search(searchQuery, filters);
|
31628
31838
|
},
|
31629
31839
|
children: [
|
31630
|
-
/* @__PURE__ */ (0,
|
31631
|
-
/* @__PURE__ */ (0,
|
31632
|
-
/* @__PURE__ */ (0,
|
31633
|
-
/* @__PURE__ */ (0,
|
31634
|
-
/* @__PURE__ */ (0,
|
31840
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
|
31841
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: getClassNameModal("search"), children: [
|
31842
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
|
31843
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Search, { size: "18" }) }),
|
31844
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31635
31845
|
"input",
|
31636
31846
|
{
|
31637
31847
|
className: getClassNameModal("searchInput"),
|
@@ -31646,9 +31856,9 @@ var ExternalInput = ({
|
|
31646
31856
|
}
|
31647
31857
|
)
|
31648
31858
|
] }),
|
31649
|
-
/* @__PURE__ */ (0,
|
31650
|
-
/* @__PURE__ */ (0,
|
31651
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
31859
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
|
31860
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
|
31861
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31652
31862
|
IconButton,
|
31653
31863
|
{
|
31654
31864
|
title: "Toggle filters",
|
@@ -31657,15 +31867,15 @@ var ExternalInput = ({
|
|
31657
31867
|
e.stopPropagation();
|
31658
31868
|
setFiltersToggled(!filtersToggled);
|
31659
31869
|
},
|
31660
|
-
children: /* @__PURE__ */ (0,
|
31870
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SlidersHorizontal, { size: 20 })
|
31661
31871
|
}
|
31662
31872
|
) })
|
31663
31873
|
] })
|
31664
|
-
] }) : /* @__PURE__ */ (0,
|
31665
|
-
/* @__PURE__ */ (0,
|
31666
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
31874
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
|
31875
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("grid"), children: [
|
31876
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
|
31667
31877
|
const filterField = filterFields[fieldName];
|
31668
|
-
return /* @__PURE__ */ (0,
|
31878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31669
31879
|
InputOrGroup,
|
31670
31880
|
{
|
31671
31881
|
field: filterField,
|
@@ -31682,9 +31892,9 @@ var ExternalInput = ({
|
|
31682
31892
|
fieldName
|
31683
31893
|
);
|
31684
31894
|
}) }),
|
31685
|
-
/* @__PURE__ */ (0,
|
31686
|
-
/* @__PURE__ */ (0,
|
31687
|
-
/* @__PURE__ */ (0,
|
31895
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
|
31896
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("table", { className: getClassNameModal("table"), children: [
|
31897
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31688
31898
|
"th",
|
31689
31899
|
{
|
31690
31900
|
className: getClassNameModal("th"),
|
@@ -31693,8 +31903,8 @@ var ExternalInput = ({
|
|
31693
31903
|
},
|
31694
31904
|
key
|
31695
31905
|
)) }) }),
|
31696
|
-
/* @__PURE__ */ (0,
|
31697
|
-
return /* @__PURE__ */ (0,
|
31906
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
|
31907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31698
31908
|
"tr",
|
31699
31909
|
{
|
31700
31910
|
style: { whiteSpace: "nowrap" },
|
@@ -31703,16 +31913,16 @@ var ExternalInput = ({
|
|
31703
31913
|
onChange(mapProp(data[i]));
|
31704
31914
|
setOpen(false);
|
31705
31915
|
},
|
31706
|
-
children: keys.map((key) => /* @__PURE__ */ (0,
|
31916
|
+
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
31707
31917
|
},
|
31708
31918
|
i
|
31709
31919
|
);
|
31710
31920
|
}) })
|
31711
31921
|
] }),
|
31712
|
-
/* @__PURE__ */ (0,
|
31922
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_spinners5.ClipLoader, { size: 24, "aria-label": "Loading" }) })
|
31713
31923
|
] })
|
31714
31924
|
] }),
|
31715
|
-
/* @__PURE__ */ (0,
|
31925
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("footer"), children: [
|
31716
31926
|
mappedData.length,
|
31717
31927
|
" result",
|
31718
31928
|
mappedData.length === 1 ? "" : "s"
|
@@ -31726,7 +31936,7 @@ var ExternalInput = ({
|
|
31726
31936
|
};
|
31727
31937
|
|
31728
31938
|
// components/InputOrGroup/fields/ExternalField/index.tsx
|
31729
|
-
var
|
31939
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
31730
31940
|
var ExternalField = ({
|
31731
31941
|
field,
|
31732
31942
|
onChange,
|
@@ -31748,13 +31958,13 @@ var ExternalField = ({
|
|
31748
31958
|
if (field.type !== "external") {
|
31749
31959
|
return null;
|
31750
31960
|
}
|
31751
|
-
return /* @__PURE__ */ (0,
|
31961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
31752
31962
|
FieldLabelInternal,
|
31753
31963
|
{
|
31754
31964
|
label: label || name,
|
31755
|
-
icon: /* @__PURE__ */ (0,
|
31965
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Link, { size: 16 }),
|
31756
31966
|
el: "div",
|
31757
|
-
children: /* @__PURE__ */ (0,
|
31967
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
31758
31968
|
ExternalInput,
|
31759
31969
|
{
|
31760
31970
|
name,
|
@@ -31780,7 +31990,7 @@ var ExternalField = ({
|
|
31780
31990
|
|
31781
31991
|
// components/InputOrGroup/fields/RadioField/index.tsx
|
31782
31992
|
init_react_import();
|
31783
|
-
var
|
31993
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
31784
31994
|
var getClassName14 = get_class_name_factory_default("Input", styles_module_default9);
|
31785
31995
|
var RadioField = ({
|
31786
31996
|
field,
|
@@ -31794,19 +32004,19 @@ var RadioField = ({
|
|
31794
32004
|
if (field.type !== "radio" || !field.options) {
|
31795
32005
|
return null;
|
31796
32006
|
}
|
31797
|
-
return /* @__PURE__ */ (0,
|
32007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
31798
32008
|
FieldLabelInternal,
|
31799
32009
|
{
|
31800
|
-
icon: /* @__PURE__ */ (0,
|
32010
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CheckCircle, { size: 16 }),
|
31801
32011
|
label: label || name,
|
31802
32012
|
readOnly,
|
31803
32013
|
el: "div",
|
31804
|
-
children: /* @__PURE__ */ (0,
|
32014
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
31805
32015
|
"label",
|
31806
32016
|
{
|
31807
32017
|
className: getClassName14("radio"),
|
31808
32018
|
children: [
|
31809
|
-
/* @__PURE__ */ (0,
|
32019
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
31810
32020
|
"input",
|
31811
32021
|
{
|
31812
32022
|
type: "radio",
|
@@ -31824,7 +32034,7 @@ var RadioField = ({
|
|
31824
32034
|
defaultChecked: value === option.value
|
31825
32035
|
}
|
31826
32036
|
),
|
31827
|
-
/* @__PURE__ */ (0,
|
32037
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
|
31828
32038
|
]
|
31829
32039
|
},
|
31830
32040
|
option.label + option.value
|
@@ -31835,7 +32045,7 @@ var RadioField = ({
|
|
31835
32045
|
|
31836
32046
|
// components/InputOrGroup/fields/SelectField/index.tsx
|
31837
32047
|
init_react_import();
|
31838
|
-
var
|
32048
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
31839
32049
|
var getClassName15 = get_class_name_factory_default("Input", styles_module_default9);
|
31840
32050
|
var SelectField = ({
|
31841
32051
|
field,
|
@@ -31849,13 +32059,13 @@ var SelectField = ({
|
|
31849
32059
|
if (field.type !== "select" || !field.options) {
|
31850
32060
|
return null;
|
31851
32061
|
}
|
31852
|
-
return /* @__PURE__ */ (0,
|
32062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
31853
32063
|
FieldLabelInternal,
|
31854
32064
|
{
|
31855
32065
|
label: label || name,
|
31856
|
-
icon: /* @__PURE__ */ (0,
|
32066
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChevronDown, { size: 16 }),
|
31857
32067
|
readOnly,
|
31858
|
-
children: /* @__PURE__ */ (0,
|
32068
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
31859
32069
|
"select",
|
31860
32070
|
{
|
31861
32071
|
id,
|
@@ -31869,7 +32079,7 @@ var SelectField = ({
|
|
31869
32079
|
onChange(e.currentTarget.value);
|
31870
32080
|
},
|
31871
32081
|
value,
|
31872
|
-
children: field.options.map((option) => /* @__PURE__ */ (0,
|
32082
|
+
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
31873
32083
|
"option",
|
31874
32084
|
{
|
31875
32085
|
label: option.label,
|
@@ -31885,7 +32095,7 @@ var SelectField = ({
|
|
31885
32095
|
|
31886
32096
|
// components/InputOrGroup/fields/TextareaField/index.tsx
|
31887
32097
|
init_react_import();
|
31888
|
-
var
|
32098
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
31889
32099
|
var getClassName16 = get_class_name_factory_default("Input", styles_module_default9);
|
31890
32100
|
var TextareaField = ({
|
31891
32101
|
onChange,
|
@@ -31895,13 +32105,13 @@ var TextareaField = ({
|
|
31895
32105
|
label,
|
31896
32106
|
id
|
31897
32107
|
}) => {
|
31898
|
-
return /* @__PURE__ */ (0,
|
32108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
31899
32109
|
FieldLabelInternal,
|
31900
32110
|
{
|
31901
32111
|
label: label || name,
|
31902
|
-
icon: /* @__PURE__ */ (0,
|
32112
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Type, { size: 16 }),
|
31903
32113
|
readOnly,
|
31904
|
-
children: /* @__PURE__ */ (0,
|
32114
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
31905
32115
|
"textarea",
|
31906
32116
|
{
|
31907
32117
|
id,
|
@@ -31930,7 +32140,7 @@ init_react_import();
|
|
31930
32140
|
var styles_module_default13 = { "ObjectField": "_ObjectField_15j63_5", "ObjectField-fieldset": "_ObjectField-fieldset_15j63_13" };
|
31931
32141
|
|
31932
32142
|
// components/InputOrGroup/fields/ObjectField/index.tsx
|
31933
|
-
var
|
32143
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
31934
32144
|
var getClassName17 = get_class_name_factory_default("ObjectField", styles_module_default13);
|
31935
32145
|
var getClassNameItem3 = get_class_name_factory_default("ObjectFieldItem", styles_module_default13);
|
31936
32146
|
var ObjectField = ({
|
@@ -31947,18 +32157,18 @@ var ObjectField = ({
|
|
31947
32157
|
return null;
|
31948
32158
|
}
|
31949
32159
|
const data = value || {};
|
31950
|
-
return /* @__PURE__ */ (0,
|
32160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
31951
32161
|
FieldLabelInternal,
|
31952
32162
|
{
|
31953
32163
|
label: label || name,
|
31954
|
-
icon: /* @__PURE__ */ (0,
|
32164
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MoreVertical, { size: 16 }),
|
31955
32165
|
el: "div",
|
31956
32166
|
readOnly,
|
31957
|
-
children: /* @__PURE__ */ (0,
|
32167
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17(), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("fieldset", { className: getClassName17("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
|
31958
32168
|
const subField = field.objectFields[fieldName];
|
31959
32169
|
const subFieldName = `${name}.${fieldName}`;
|
31960
32170
|
const wildcardFieldName = `${name}.${fieldName}`;
|
31961
|
-
return /* @__PURE__ */ (0,
|
32171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
31962
32172
|
InputOrGroup,
|
31963
32173
|
{
|
31964
32174
|
name: subFieldName,
|
@@ -31985,7 +32195,7 @@ var ObjectField = ({
|
|
31985
32195
|
};
|
31986
32196
|
|
31987
32197
|
// components/InputOrGroup/index.tsx
|
31988
|
-
var
|
32198
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
31989
32199
|
var getClassName18 = get_class_name_factory_default("Input", styles_module_default9);
|
31990
32200
|
var FieldLabel = ({
|
31991
32201
|
children,
|
@@ -31996,11 +32206,11 @@ var FieldLabel = ({
|
|
31996
32206
|
className
|
31997
32207
|
}) => {
|
31998
32208
|
const El = el;
|
31999
|
-
return /* @__PURE__ */ (0,
|
32000
|
-
/* @__PURE__ */ (0,
|
32001
|
-
icon ? /* @__PURE__ */ (0,
|
32209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(El, { className, children: [
|
32210
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName18("label"), children: [
|
32211
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, {}),
|
32002
32212
|
label,
|
32003
|
-
readOnly && /* @__PURE__ */ (0,
|
32213
|
+
readOnly && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Lock, { size: "12" }) })
|
32004
32214
|
] }),
|
32005
32215
|
children
|
32006
32216
|
] });
|
@@ -32017,7 +32227,7 @@ var FieldLabelInternal = ({
|
|
32017
32227
|
() => overrides.fieldLabel || FieldLabel,
|
32018
32228
|
[overrides]
|
32019
32229
|
);
|
32020
|
-
return /* @__PURE__ */ (0,
|
32230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
32021
32231
|
Wrapper,
|
32022
32232
|
{
|
32023
32233
|
label,
|
@@ -32057,7 +32267,7 @@ var InputOrGroup = (_a) => {
|
|
32057
32267
|
if (!field.render) {
|
32058
32268
|
return null;
|
32059
32269
|
}
|
32060
|
-
return /* @__PURE__ */ (0,
|
32270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
|
32061
32271
|
field,
|
32062
32272
|
name,
|
32063
32273
|
readOnly
|
@@ -32086,7 +32296,7 @@ var InputOrGroup = (_a) => {
|
|
32086
32296
|
const mergedProps = __spreadProps(__spreadValues(__spreadValues({}, props), localProps), { field });
|
32087
32297
|
const children = defaultFields[field.type](mergedProps);
|
32088
32298
|
const Render2 = render[field.type];
|
32089
|
-
return /* @__PURE__ */ (0,
|
32299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
|
32090
32300
|
};
|
32091
32301
|
|
32092
32302
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
|
@@ -32095,7 +32305,7 @@ var styles_module_default14 = { "PuckFields": "_PuckFields_17k3p_1", "PuckFields
|
|
32095
32305
|
|
32096
32306
|
// components/Puck/components/Fields/index.tsx
|
32097
32307
|
var import_react19 = require("react");
|
32098
|
-
var
|
32308
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
32099
32309
|
var getClassName19 = get_class_name_factory_default("PuckFields", styles_module_default14);
|
32100
32310
|
var defaultPageFields = {
|
32101
32311
|
title: { type: "text" }
|
@@ -32104,9 +32314,9 @@ var DefaultFields = ({
|
|
32104
32314
|
children,
|
32105
32315
|
isLoading
|
32106
32316
|
}) => {
|
32107
|
-
return /* @__PURE__ */ (0,
|
32317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19(), children: [
|
32108
32318
|
children,
|
32109
|
-
isLoading && /* @__PURE__ */ (0,
|
32319
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_spinners6.ClipLoader, { "aria-label": "loading" }) })
|
32110
32320
|
] });
|
32111
32321
|
};
|
32112
32322
|
var Fields = () => {
|
@@ -32127,14 +32337,14 @@ var Fields = () => {
|
|
32127
32337
|
const isLoading = selectedItem ? (_c = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _c.loading : (_d = componentState["puck-root"]) == null ? void 0 : _d.loading;
|
32128
32338
|
const rootProps = data.root.props || data.root;
|
32129
32339
|
const Wrapper = (0, import_react19.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
32130
|
-
return /* @__PURE__ */ (0,
|
32340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
32131
32341
|
"form",
|
32132
32342
|
{
|
32133
32343
|
className: getClassName19(),
|
32134
32344
|
onSubmit: (e) => {
|
32135
32345
|
e.preventDefault();
|
32136
32346
|
},
|
32137
|
-
children: /* @__PURE__ */ (0,
|
32347
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
32138
32348
|
const field = fields[fieldName];
|
32139
32349
|
const onChange = (value, updatedUi) => {
|
32140
32350
|
var _a2, _b2;
|
@@ -32200,7 +32410,7 @@ var Fields = () => {
|
|
32200
32410
|
};
|
32201
32411
|
if (selectedItem && itemSelector) {
|
32202
32412
|
const { readOnly = {} } = selectedItem;
|
32203
|
-
return /* @__PURE__ */ (0,
|
32413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
32204
32414
|
InputOrGroup,
|
32205
32415
|
{
|
32206
32416
|
field,
|
@@ -32216,7 +32426,7 @@ var Fields = () => {
|
|
32216
32426
|
);
|
32217
32427
|
} else {
|
32218
32428
|
const { readOnly = {} } = data.root;
|
32219
|
-
return /* @__PURE__ */ (0,
|
32429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
32220
32430
|
InputOrGroup,
|
32221
32431
|
{
|
32222
32432
|
field,
|
@@ -32251,14 +32461,15 @@ init_react_import();
|
|
32251
32461
|
var styles_module_default15 = { "ComponentList": "_ComponentList_odh9d_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_odh9d_5", "ComponentList-content": "_ComponentList-content_odh9d_9", "ComponentList-title": "_ComponentList-title_odh9d_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_odh9d_53" };
|
32252
32462
|
|
32253
32463
|
// components/ComponentList/index.tsx
|
32254
|
-
var
|
32464
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
32255
32465
|
var getClassName20 = get_class_name_factory_default("ComponentList", styles_module_default15);
|
32256
32466
|
var ComponentListItem = ({
|
32257
32467
|
name,
|
32468
|
+
label,
|
32258
32469
|
index
|
32259
32470
|
}) => {
|
32260
32471
|
const { overrides } = useAppContext();
|
32261
|
-
return /* @__PURE__ */ (0,
|
32472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Drawer.Item, { label, name, index, children: overrides.componentItem });
|
32262
32473
|
};
|
32263
32474
|
var ComponentList = ({
|
32264
32475
|
children,
|
@@ -32267,8 +32478,8 @@ var ComponentList = ({
|
|
32267
32478
|
}) => {
|
32268
32479
|
const { config, state, setUi } = useAppContext();
|
32269
32480
|
const { expanded = true } = state.ui.componentList[id] || {};
|
32270
|
-
return /* @__PURE__ */ (0,
|
32271
|
-
title && /* @__PURE__ */ (0,
|
32481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
|
32482
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
32272
32483
|
"button",
|
32273
32484
|
{
|
32274
32485
|
className: getClassName20("title"),
|
@@ -32281,15 +32492,17 @@ var ComponentList = ({
|
|
32281
32492
|
}),
|
32282
32493
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
32283
32494
|
children: [
|
32284
|
-
/* @__PURE__ */ (0,
|
32285
|
-
/* @__PURE__ */ (0,
|
32495
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { children: title }),
|
32496
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName20("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronDown, { size: 12 }) })
|
32286
32497
|
]
|
32287
32498
|
}
|
32288
32499
|
),
|
32289
|
-
/* @__PURE__ */ (0,
|
32290
|
-
|
32500
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName20("content"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Drawer, { droppableId: `component-list${title ? `:${title}` : ""}`, children: children || Object.keys(config.components).map((componentKey, i) => {
|
32501
|
+
var _a;
|
32502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
32291
32503
|
ComponentListItem,
|
32292
32504
|
{
|
32505
|
+
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
32293
32506
|
name: componentKey,
|
32294
32507
|
index: i
|
32295
32508
|
},
|
@@ -32301,7 +32514,7 @@ var ComponentList = ({
|
|
32301
32514
|
ComponentList.Item = ComponentListItem;
|
32302
32515
|
|
32303
32516
|
// lib/use-component-list.tsx
|
32304
|
-
var
|
32517
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
32305
32518
|
var useComponentList = (config, ui) => {
|
32306
32519
|
const [componentList, setComponentList] = (0, import_react20.useState)();
|
32307
32520
|
(0, import_react20.useEffect)(() => {
|
@@ -32314,16 +32527,18 @@ var useComponentList = (config, ui) => {
|
|
32314
32527
|
if (category.visible === false || !category.components) {
|
32315
32528
|
return null;
|
32316
32529
|
}
|
32317
|
-
return /* @__PURE__ */ (0,
|
32530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32318
32531
|
ComponentList,
|
32319
32532
|
{
|
32320
32533
|
id: categoryKey,
|
32321
32534
|
title: category.title || categoryKey,
|
32322
32535
|
children: category.components.map((componentName, i) => {
|
32536
|
+
var _a2;
|
32323
32537
|
matchedComponents.push(componentName);
|
32324
|
-
return /* @__PURE__ */ (0,
|
32538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32325
32539
|
ComponentList.Item,
|
32326
32540
|
{
|
32541
|
+
label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
|
32327
32542
|
name: componentName,
|
32328
32543
|
index: i
|
32329
32544
|
},
|
@@ -32340,16 +32555,18 @@ var useComponentList = (config, ui) => {
|
|
32340
32555
|
);
|
32341
32556
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
32342
32557
|
_componentList.push(
|
32343
|
-
/* @__PURE__ */ (0,
|
32558
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32344
32559
|
ComponentList,
|
32345
32560
|
{
|
32346
32561
|
id: "other",
|
32347
32562
|
title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
|
32348
32563
|
children: remainingComponents.map((componentName, i) => {
|
32349
|
-
|
32564
|
+
var _a2;
|
32565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32350
32566
|
ComponentList.Item,
|
32351
32567
|
{
|
32352
32568
|
name: componentName,
|
32569
|
+
label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
|
32353
32570
|
index: i
|
32354
32571
|
},
|
32355
32572
|
componentName
|
@@ -32362,44 +32579,69 @@ var useComponentList = (config, ui) => {
|
|
32362
32579
|
}
|
32363
32580
|
setComponentList(_componentList);
|
32364
32581
|
}
|
32365
|
-
}, [config.categories, ui.componentList]);
|
32582
|
+
}, [config.categories, config.components, ui.componentList]);
|
32366
32583
|
return componentList;
|
32367
32584
|
};
|
32368
32585
|
|
32369
32586
|
// components/Puck/components/Components/index.tsx
|
32370
32587
|
var import_react21 = require("react");
|
32371
|
-
var
|
32588
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
32372
32589
|
var Components = () => {
|
32373
32590
|
const { config, state, overrides } = useAppContext();
|
32374
32591
|
const componentList = useComponentList(config, state.ui);
|
32375
32592
|
const Wrapper = (0, import_react21.useMemo)(() => overrides.components || "div", [overrides]);
|
32376
|
-
return /* @__PURE__ */ (0,
|
32593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComponentList, { id: "all" }) });
|
32377
32594
|
};
|
32378
32595
|
|
32379
32596
|
// components/Puck/components/Preview/index.tsx
|
32380
32597
|
init_react_import();
|
32381
32598
|
var import_react22 = require("react");
|
32382
|
-
var
|
32599
|
+
var import_auto_frame_component = __toESM(require("@measured/auto-frame-component"));
|
32600
|
+
|
32601
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
|
32602
|
+
init_react_import();
|
32603
|
+
var styles_module_default16 = { "PuckPreview": "_PuckPreview_1mia0_1", "PuckPreview-frame": "_PuckPreview-frame_1mia0_5" };
|
32604
|
+
|
32605
|
+
// components/Puck/components/Preview/index.tsx
|
32606
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
32607
|
+
var getClassName21 = get_class_name_factory_default("PuckPreview", styles_module_default16);
|
32383
32608
|
var Preview = ({ id = "puck-preview" }) => {
|
32384
|
-
const { config, dispatch, state } = useAppContext();
|
32609
|
+
const { config, dispatch, state, setStatus, iframe } = useAppContext();
|
32385
32610
|
const Page = (0, import_react22.useCallback)(
|
32386
32611
|
(pageProps) => {
|
32387
32612
|
var _a, _b;
|
32388
|
-
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({
|
32613
|
+
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({
|
32614
|
+
id: "puck-root"
|
32615
|
+
}, pageProps), {
|
32616
|
+
editMode: true,
|
32617
|
+
puck: { renderDropZone: DropZone }
|
32618
|
+
})) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: pageProps.children });
|
32389
32619
|
},
|
32390
32620
|
[config.root]
|
32391
32621
|
);
|
32392
32622
|
const rootProps = state.data.root.props || state.data.root;
|
32393
|
-
const
|
32394
|
-
return /* @__PURE__ */ (0,
|
32623
|
+
const ref = (0, import_react22.useRef)(null);
|
32624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
32395
32625
|
"div",
|
32396
32626
|
{
|
32627
|
+
className: getClassName21(),
|
32397
32628
|
id,
|
32398
32629
|
onClick: () => {
|
32399
32630
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
32400
32631
|
},
|
32401
|
-
|
32402
|
-
|
32632
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
32633
|
+
import_auto_frame_component.default,
|
32634
|
+
{
|
32635
|
+
id: "preview-frame",
|
32636
|
+
className: getClassName21("frame"),
|
32637
|
+
"data-rfd-iframe": true,
|
32638
|
+
ref,
|
32639
|
+
onStylesLoaded: () => {
|
32640
|
+
setStatus("READY");
|
32641
|
+
},
|
32642
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId }) }))
|
32643
|
+
}
|
32644
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { id: "preview-frame", className: getClassName21("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId }) })) })
|
32403
32645
|
}
|
32404
32646
|
);
|
32405
32647
|
};
|
@@ -32433,7 +32675,7 @@ init_react_import();
|
|
32433
32675
|
|
32434
32676
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
32435
32677
|
init_react_import();
|
32436
|
-
var
|
32678
|
+
var styles_module_default17 = { "LayerTree": "_LayerTree_1pgw8_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_1pgw8_11", "LayerTree-helper": "_LayerTree-helper_1pgw8_17", "Layer": "_Layer_1pgw8_1", "Layer-inner": "_Layer-inner_1pgw8_29", "Layer--containsZone": "_Layer--containsZone_1pgw8_35", "Layer-clickable": "_Layer-clickable_1pgw8_39", "Layer--isSelected": "_Layer--isSelected_1pgw8_61", "Layer-chevron": "_Layer-chevron_1pgw8_77", "Layer--childIsSelected": "_Layer--childIsSelected_1pgw8_78", "Layer-zones": "_Layer-zones_1pgw8_82", "Layer-title": "_Layer-title_1pgw8_96", "Layer-name": "_Layer-name_1pgw8_105", "Layer-icon": "_Layer-icon_1pgw8_111", "Layer-zoneIcon": "_Layer-zoneIcon_1pgw8_116" };
|
32437
32679
|
|
32438
32680
|
// lib/scroll-into-view.ts
|
32439
32681
|
init_react_import();
|
@@ -32461,11 +32703,12 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
32461
32703
|
};
|
32462
32704
|
|
32463
32705
|
// components/LayerTree/index.tsx
|
32464
|
-
var
|
32465
|
-
var
|
32466
|
-
var getClassNameLayer = get_class_name_factory_default("Layer",
|
32706
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
32707
|
+
var getClassName22 = get_class_name_factory_default("LayerTree", styles_module_default17);
|
32708
|
+
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default17);
|
32467
32709
|
var LayerTree = ({
|
32468
32710
|
data,
|
32711
|
+
config,
|
32469
32712
|
zoneContent,
|
32470
32713
|
itemSelector,
|
32471
32714
|
setItemSelector,
|
@@ -32474,15 +32717,16 @@ var LayerTree = ({
|
|
32474
32717
|
}) => {
|
32475
32718
|
const zones = data.zones || {};
|
32476
32719
|
const ctx = (0, import_react23.useContext)(dropZoneContext);
|
32477
|
-
return /* @__PURE__ */ (0,
|
32478
|
-
label && /* @__PURE__ */ (0,
|
32479
|
-
/* @__PURE__ */ (0,
|
32720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
32721
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName22("zoneTitle"), children: [
|
32722
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Layers, { size: "16" }) }),
|
32480
32723
|
" ",
|
32481
32724
|
label
|
32482
32725
|
] }),
|
32483
|
-
/* @__PURE__ */ (0,
|
32484
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
32726
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("ul", { className: getClassName22(), children: [
|
32727
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("helper"), children: "No items" }),
|
32485
32728
|
zoneContent.map((item, i) => {
|
32729
|
+
var _a;
|
32486
32730
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
32487
32731
|
const zonesForItem = findZonesForArea(data, item.props.id);
|
32488
32732
|
const containsZone = Object.keys(zonesForItem).length > 0;
|
@@ -32496,7 +32740,7 @@ var LayerTree = ({
|
|
32496
32740
|
const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
|
32497
32741
|
const isHovering = hoveringComponent === item.props.id;
|
32498
32742
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
32499
|
-
return /* @__PURE__ */ (0,
|
32743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
32500
32744
|
"li",
|
32501
32745
|
{
|
32502
32746
|
className: getClassNameLayer({
|
@@ -32506,7 +32750,7 @@ var LayerTree = ({
|
|
32506
32750
|
childIsSelected
|
32507
32751
|
}),
|
32508
32752
|
children: [
|
32509
|
-
/* @__PURE__ */ (0,
|
32753
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
32510
32754
|
"button",
|
32511
32755
|
{
|
32512
32756
|
className: getClassNameLayer("clickable"),
|
@@ -32520,8 +32764,9 @@ var LayerTree = ({
|
|
32520
32764
|
zone
|
32521
32765
|
});
|
32522
32766
|
const id = zoneContent[i].props.id;
|
32767
|
+
const frame = getFrame();
|
32523
32768
|
scrollIntoView(
|
32524
|
-
|
32769
|
+
frame == null ? void 0 : frame.querySelector(
|
32525
32770
|
`[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
|
32526
32771
|
)
|
32527
32772
|
);
|
@@ -32537,24 +32782,25 @@ var LayerTree = ({
|
|
32537
32782
|
setHoveringComponent(null);
|
32538
32783
|
},
|
32539
32784
|
children: [
|
32540
|
-
containsZone && /* @__PURE__ */ (0,
|
32785
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32541
32786
|
"div",
|
32542
32787
|
{
|
32543
32788
|
className: getClassNameLayer("chevron"),
|
32544
32789
|
title: isSelected ? "Collapse" : "Expand",
|
32545
|
-
children: /* @__PURE__ */ (0,
|
32790
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronDown, { size: "12" })
|
32546
32791
|
}
|
32547
32792
|
),
|
32548
|
-
/* @__PURE__ */ (0,
|
32549
|
-
/* @__PURE__ */ (0,
|
32550
|
-
/* @__PURE__ */ (0,
|
32793
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
32794
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(LayoutGrid, { size: "16" }) }),
|
32795
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("name"), children: (_a = config.components[item.type]["label"]) != null ? _a : item.type })
|
32551
32796
|
] })
|
32552
32797
|
]
|
32553
32798
|
}
|
32554
32799
|
) }),
|
32555
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
32800
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32556
32801
|
LayerTree,
|
32557
32802
|
{
|
32803
|
+
config,
|
32558
32804
|
data,
|
32559
32805
|
zoneContent: zones[zoneKey],
|
32560
32806
|
setItemSelector,
|
@@ -32574,9 +32820,9 @@ var LayerTree = ({
|
|
32574
32820
|
|
32575
32821
|
// components/Puck/components/Outline/index.tsx
|
32576
32822
|
var import_react24 = require("react");
|
32577
|
-
var
|
32823
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
32578
32824
|
var Outline = () => {
|
32579
|
-
const { dispatch, state, overrides } = useAppContext();
|
32825
|
+
const { dispatch, state, overrides, config } = useAppContext();
|
32580
32826
|
const { data, ui } = state;
|
32581
32827
|
const { itemSelector } = ui;
|
32582
32828
|
const setItemSelector = (0, import_react24.useCallback)(
|
@@ -32589,10 +32835,11 @@ var Outline = () => {
|
|
32589
32835
|
[]
|
32590
32836
|
);
|
32591
32837
|
const Wrapper = (0, import_react24.useMemo)(() => overrides.outline || "div", [overrides]);
|
32592
|
-
return /* @__PURE__ */ (0,
|
32593
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0,
|
32838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
32839
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
32594
32840
|
LayerTree,
|
32595
32841
|
{
|
32842
|
+
config,
|
32596
32843
|
data,
|
32597
32844
|
label: areaContainsZones(data, "root") ? rootDroppableId : "",
|
32598
32845
|
zoneContent: data.content,
|
@@ -32602,9 +32849,10 @@ var Outline = () => {
|
|
32602
32849
|
),
|
32603
32850
|
Object.entries(findZonesForArea(data, "root")).map(
|
32604
32851
|
([zoneKey, zone]) => {
|
32605
|
-
return /* @__PURE__ */ (0,
|
32852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
32606
32853
|
LayerTree,
|
32607
32854
|
{
|
32855
|
+
config,
|
32608
32856
|
data,
|
32609
32857
|
label: zoneKey,
|
32610
32858
|
zone: zoneKey,
|
@@ -32728,14 +32976,431 @@ function useHistoryStore() {
|
|
32728
32976
|
};
|
32729
32977
|
}
|
32730
32978
|
|
32979
|
+
// components/Puck/components/Canvas/index.tsx
|
32980
|
+
init_react_import();
|
32981
|
+
|
32982
|
+
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
32983
|
+
init_react_import();
|
32984
|
+
|
32985
|
+
// ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
32986
|
+
init_react_import();
|
32987
|
+
var isProduction = process.env.NODE_ENV === "production";
|
32988
|
+
var prefix = "Invariant failed";
|
32989
|
+
function invariant(condition, message) {
|
32990
|
+
if (condition) {
|
32991
|
+
return;
|
32992
|
+
}
|
32993
|
+
if (isProduction) {
|
32994
|
+
throw new Error(prefix);
|
32995
|
+
}
|
32996
|
+
var provided = typeof message === "function" ? message() : message;
|
32997
|
+
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
32998
|
+
throw new Error(value);
|
32999
|
+
}
|
33000
|
+
|
33001
|
+
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
33002
|
+
var getRect = function getRect2(_ref) {
|
33003
|
+
var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
|
33004
|
+
var width = right - left;
|
33005
|
+
var height = bottom - top;
|
33006
|
+
var rect = {
|
33007
|
+
top,
|
33008
|
+
right,
|
33009
|
+
bottom,
|
33010
|
+
left,
|
33011
|
+
width,
|
33012
|
+
height,
|
33013
|
+
x: left,
|
33014
|
+
y: top,
|
33015
|
+
center: {
|
33016
|
+
x: (right + left) / 2,
|
33017
|
+
y: (bottom + top) / 2
|
33018
|
+
}
|
33019
|
+
};
|
33020
|
+
return rect;
|
33021
|
+
};
|
33022
|
+
var expand = function expand2(target, expandBy) {
|
33023
|
+
return {
|
33024
|
+
top: target.top - expandBy.top,
|
33025
|
+
left: target.left - expandBy.left,
|
33026
|
+
bottom: target.bottom + expandBy.bottom,
|
33027
|
+
right: target.right + expandBy.right
|
33028
|
+
};
|
33029
|
+
};
|
33030
|
+
var shrink = function shrink2(target, shrinkBy) {
|
33031
|
+
return {
|
33032
|
+
top: target.top + shrinkBy.top,
|
33033
|
+
left: target.left + shrinkBy.left,
|
33034
|
+
bottom: target.bottom - shrinkBy.bottom,
|
33035
|
+
right: target.right - shrinkBy.right
|
33036
|
+
};
|
33037
|
+
};
|
33038
|
+
var noSpacing = {
|
33039
|
+
top: 0,
|
33040
|
+
right: 0,
|
33041
|
+
bottom: 0,
|
33042
|
+
left: 0
|
33043
|
+
};
|
33044
|
+
var createBox = function createBox2(_ref2) {
|
33045
|
+
var borderBox = _ref2.borderBox, _ref2$margin = _ref2.margin, margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin, _ref2$border = _ref2.border, border = _ref2$border === void 0 ? noSpacing : _ref2$border, _ref2$padding = _ref2.padding, padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
|
33046
|
+
var marginBox = getRect(expand(borderBox, margin));
|
33047
|
+
var paddingBox = getRect(shrink(borderBox, border));
|
33048
|
+
var contentBox = getRect(shrink(paddingBox, padding));
|
33049
|
+
return {
|
33050
|
+
marginBox,
|
33051
|
+
borderBox: getRect(borderBox),
|
33052
|
+
paddingBox,
|
33053
|
+
contentBox,
|
33054
|
+
margin,
|
33055
|
+
border,
|
33056
|
+
padding
|
33057
|
+
};
|
33058
|
+
};
|
33059
|
+
var parse = function parse2(raw) {
|
33060
|
+
var value = raw.slice(0, -2);
|
33061
|
+
var suffix = raw.slice(-2);
|
33062
|
+
if (suffix !== "px") {
|
33063
|
+
return 0;
|
33064
|
+
}
|
33065
|
+
var result = Number(value);
|
33066
|
+
!!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
|
33067
|
+
return result;
|
33068
|
+
};
|
33069
|
+
var calculateBox = function calculateBox2(borderBox, styles) {
|
33070
|
+
var margin = {
|
33071
|
+
top: parse(styles.marginTop),
|
33072
|
+
right: parse(styles.marginRight),
|
33073
|
+
bottom: parse(styles.marginBottom),
|
33074
|
+
left: parse(styles.marginLeft)
|
33075
|
+
};
|
33076
|
+
var padding = {
|
33077
|
+
top: parse(styles.paddingTop),
|
33078
|
+
right: parse(styles.paddingRight),
|
33079
|
+
bottom: parse(styles.paddingBottom),
|
33080
|
+
left: parse(styles.paddingLeft)
|
33081
|
+
};
|
33082
|
+
var border = {
|
33083
|
+
top: parse(styles.borderTopWidth),
|
33084
|
+
right: parse(styles.borderRightWidth),
|
33085
|
+
bottom: parse(styles.borderBottomWidth),
|
33086
|
+
left: parse(styles.borderLeftWidth)
|
33087
|
+
};
|
33088
|
+
return createBox({
|
33089
|
+
borderBox,
|
33090
|
+
margin,
|
33091
|
+
padding,
|
33092
|
+
border
|
33093
|
+
});
|
33094
|
+
};
|
33095
|
+
var getBox = function getBox2(el) {
|
33096
|
+
var borderBox = el.getBoundingClientRect();
|
33097
|
+
var styles = window.getComputedStyle(el);
|
33098
|
+
return calculateBox(borderBox, styles);
|
33099
|
+
};
|
33100
|
+
|
33101
|
+
// components/Puck/components/Canvas/index.tsx
|
33102
|
+
var import_react27 = require("react");
|
33103
|
+
|
33104
|
+
// components/ViewportControls/index.tsx
|
33105
|
+
init_react_import();
|
33106
|
+
var import_react26 = require("react");
|
33107
|
+
|
33108
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
33109
|
+
init_react_import();
|
33110
|
+
var styles_module_default18 = { "ViewportControls": "_ViewportControls_3zdvn_1", "ViewportControls-divider": "_ViewportControls-divider_3zdvn_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_3zdvn_21", "ViewportButton--isActive": "_ViewportButton--isActive_3zdvn_33", "ViewportButton-inner": "_ViewportButton-inner_3zdvn_33" };
|
33111
|
+
|
33112
|
+
// components/ViewportControls/index.tsx
|
33113
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
33114
|
+
var icons = {
|
33115
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Smartphone, { size: 16 }),
|
33116
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Tablet, { size: 16 }),
|
33117
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Monitor, { size: 16 })
|
33118
|
+
};
|
33119
|
+
var getClassName23 = get_class_name_factory_default("ViewportControls", styles_module_default18);
|
33120
|
+
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default18);
|
33121
|
+
var ViewportButton = ({
|
33122
|
+
children,
|
33123
|
+
height = "auto",
|
33124
|
+
title,
|
33125
|
+
width,
|
33126
|
+
onClick
|
33127
|
+
}) => {
|
33128
|
+
const { state } = useAppContext();
|
33129
|
+
const [isActive, setIsActive] = (0, import_react26.useState)(false);
|
33130
|
+
(0, import_react26.useEffect)(() => {
|
33131
|
+
setIsActive(width === state.ui.viewports.current.width);
|
33132
|
+
}, [width, state.ui.viewports.current.width]);
|
33133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33134
|
+
IconButton,
|
33135
|
+
{
|
33136
|
+
title,
|
33137
|
+
disabled: isActive,
|
33138
|
+
onClick: (e) => {
|
33139
|
+
e.stopPropagation();
|
33140
|
+
onClick({ width, height });
|
33141
|
+
},
|
33142
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton("inner"), children })
|
33143
|
+
}
|
33144
|
+
) });
|
33145
|
+
};
|
33146
|
+
var defaultZoomOptions = [
|
33147
|
+
{ label: "25%", value: 0.25 },
|
33148
|
+
{ label: "50%", value: 0.5 },
|
33149
|
+
{ label: "75%", value: 0.75 },
|
33150
|
+
{ label: "100%", value: 1 },
|
33151
|
+
{ label: "125%", value: 1.25 },
|
33152
|
+
{ label: "150%", value: 1.5 },
|
33153
|
+
{ label: "200%", value: 2 }
|
33154
|
+
];
|
33155
|
+
var ViewportControls = ({
|
33156
|
+
autoZoom,
|
33157
|
+
zoom,
|
33158
|
+
onViewportChange,
|
33159
|
+
onZoom
|
33160
|
+
}) => {
|
33161
|
+
const { viewports } = useAppContext();
|
33162
|
+
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
33163
|
+
(option) => option.value === autoZoom
|
33164
|
+
);
|
33165
|
+
const zoomOptions = (0, import_react26.useMemo)(
|
33166
|
+
() => [
|
33167
|
+
...defaultZoomOptions,
|
33168
|
+
...defaultsContainAutoZoom ? [] : [
|
33169
|
+
{
|
33170
|
+
value: autoZoom,
|
33171
|
+
label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
|
33172
|
+
}
|
33173
|
+
]
|
33174
|
+
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
33175
|
+
[autoZoom]
|
33176
|
+
);
|
33177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName23(), children: [
|
33178
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33179
|
+
ViewportButton,
|
33180
|
+
{
|
33181
|
+
height: viewport.height,
|
33182
|
+
width: viewport.width,
|
33183
|
+
title: viewport.label ? `Switch to ${viewport.label} viewport` : "Switch viewport",
|
33184
|
+
onClick: onViewportChange,
|
33185
|
+
children: typeof viewport.icon === "string" ? icons[viewport.icon] || viewport.icon : viewport.icon || icons.Smartphone
|
33186
|
+
},
|
33187
|
+
i
|
33188
|
+
)),
|
33189
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
|
33190
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33191
|
+
IconButton,
|
33192
|
+
{
|
33193
|
+
title: "Zoom viewport out",
|
33194
|
+
disabled: zoom <= zoomOptions[0].value,
|
33195
|
+
onClick: (e) => {
|
33196
|
+
e.stopPropagation();
|
33197
|
+
onZoom(
|
33198
|
+
zoomOptions[Math.max(
|
33199
|
+
zoomOptions.findIndex((option) => option.value === zoom) - 1,
|
33200
|
+
0
|
33201
|
+
)].value
|
33202
|
+
);
|
33203
|
+
},
|
33204
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomOut, { size: 16 })
|
33205
|
+
}
|
33206
|
+
),
|
33207
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33208
|
+
IconButton,
|
33209
|
+
{
|
33210
|
+
title: "Zoom viewport in",
|
33211
|
+
disabled: zoom >= zoomOptions[zoomOptions.length - 1].value,
|
33212
|
+
onClick: (e) => {
|
33213
|
+
e.stopPropagation();
|
33214
|
+
onZoom(
|
33215
|
+
zoomOptions[Math.min(
|
33216
|
+
zoomOptions.findIndex((option) => option.value === zoom) + 1,
|
33217
|
+
zoomOptions.length - 1
|
33218
|
+
)].value
|
33219
|
+
);
|
33220
|
+
},
|
33221
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomIn, { size: 16 })
|
33222
|
+
}
|
33223
|
+
),
|
33224
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
|
33225
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33226
|
+
"select",
|
33227
|
+
{
|
33228
|
+
className: getClassName23("zoomSelect"),
|
33229
|
+
value: zoom.toString(),
|
33230
|
+
onChange: (e) => {
|
33231
|
+
onZoom(parseFloat(e.currentTarget.value));
|
33232
|
+
},
|
33233
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33234
|
+
"option",
|
33235
|
+
{
|
33236
|
+
value: option.value,
|
33237
|
+
label: option.label
|
33238
|
+
},
|
33239
|
+
option.label
|
33240
|
+
))
|
33241
|
+
}
|
33242
|
+
)
|
33243
|
+
] });
|
33244
|
+
};
|
33245
|
+
|
33246
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
|
33247
|
+
init_react_import();
|
33248
|
+
var styles_module_default19 = { "PuckCanvas": "_PuckCanvas_6zd4y_1", "PuckCanvas-controls": "_PuckCanvas-controls_6zd4y_16", "PuckCanvas-inner": "_PuckCanvas-inner_6zd4y_21", "PuckCanvas-root": "_PuckCanvas-root_6zd4y_32", "PuckCanvas--ready": "_PuckCanvas--ready_6zd4y_56" };
|
33249
|
+
|
33250
|
+
// lib/get-zoom-config.ts
|
33251
|
+
init_react_import();
|
33252
|
+
var RESET_ZOOM_SMALLER_THAN_FRAME = true;
|
33253
|
+
var getZoomConfig = (uiViewport, frame, zoom) => {
|
33254
|
+
const box = getBox(frame);
|
33255
|
+
const { width: frameWidth, height: frameHeight } = box.contentBox;
|
33256
|
+
const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
|
33257
|
+
let rootHeight = 0;
|
33258
|
+
let autoZoom = 1;
|
33259
|
+
if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
|
33260
|
+
const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
|
33261
|
+
const heightZoom = Math.min(frameHeight / viewportHeight, 1);
|
33262
|
+
zoom = widthZoom;
|
33263
|
+
if (widthZoom < heightZoom) {
|
33264
|
+
rootHeight = viewportHeight / zoom;
|
33265
|
+
} else {
|
33266
|
+
rootHeight = viewportHeight;
|
33267
|
+
zoom = heightZoom;
|
33268
|
+
}
|
33269
|
+
autoZoom = zoom;
|
33270
|
+
} else {
|
33271
|
+
if (RESET_ZOOM_SMALLER_THAN_FRAME) {
|
33272
|
+
autoZoom = 1;
|
33273
|
+
zoom = 1;
|
33274
|
+
rootHeight = viewportHeight;
|
33275
|
+
}
|
33276
|
+
}
|
33277
|
+
return { autoZoom, rootHeight, zoom };
|
33278
|
+
};
|
33279
|
+
|
33280
|
+
// components/Puck/components/Canvas/index.tsx
|
33281
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
33282
|
+
var getClassName24 = get_class_name_factory_default("PuckCanvas", styles_module_default19);
|
33283
|
+
var ZOOM_ON_CHANGE = true;
|
33284
|
+
var Canvas = () => {
|
33285
|
+
const { status, iframe } = useAppContext();
|
33286
|
+
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
33287
|
+
const { ui } = state;
|
33288
|
+
const frameRef = (0, import_react27.useRef)(null);
|
33289
|
+
const [showTransition, setShowTransition] = (0, import_react27.useState)(false);
|
33290
|
+
const defaultRender = (0, import_react27.useMemo)(() => {
|
33291
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
|
33292
|
+
return PuckDefault;
|
33293
|
+
}, []);
|
33294
|
+
const CustomPreview = (0, import_react27.useMemo)(
|
33295
|
+
() => overrides.preview || defaultRender,
|
33296
|
+
[overrides]
|
33297
|
+
);
|
33298
|
+
const getFrameDimensions = (0, import_react27.useCallback)(() => {
|
33299
|
+
if (frameRef.current) {
|
33300
|
+
const frame = frameRef.current;
|
33301
|
+
const box = getBox(frame);
|
33302
|
+
return { width: box.contentBox.width, height: box.contentBox.height };
|
33303
|
+
}
|
33304
|
+
return { width: 0, height: 0 };
|
33305
|
+
}, [frameRef]);
|
33306
|
+
const resetAutoZoom = (0, import_react27.useCallback)(
|
33307
|
+
(ui2 = state.ui) => {
|
33308
|
+
if (frameRef.current) {
|
33309
|
+
setZoomConfig(
|
33310
|
+
getZoomConfig(ui2.viewports.current, frameRef.current, zoomConfig.zoom)
|
33311
|
+
);
|
33312
|
+
}
|
33313
|
+
},
|
33314
|
+
[frameRef, zoomConfig, state.ui]
|
33315
|
+
);
|
33316
|
+
(0, import_react27.useEffect)(() => {
|
33317
|
+
setShowTransition(false);
|
33318
|
+
resetAutoZoom();
|
33319
|
+
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
33320
|
+
(0, import_react27.useEffect)(() => {
|
33321
|
+
const { height: frameHeight } = getFrameDimensions();
|
33322
|
+
if (ui.viewports.current.height === "auto") {
|
33323
|
+
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
33324
|
+
rootHeight: frameHeight / zoomConfig.zoom
|
33325
|
+
}));
|
33326
|
+
}
|
33327
|
+
}, [zoomConfig.zoom]);
|
33328
|
+
(0, import_react27.useEffect)(() => {
|
33329
|
+
const observer = new ResizeObserver(() => {
|
33330
|
+
setShowTransition(false);
|
33331
|
+
resetAutoZoom();
|
33332
|
+
});
|
33333
|
+
if (document.body) {
|
33334
|
+
observer.observe(document.body);
|
33335
|
+
}
|
33336
|
+
return () => {
|
33337
|
+
observer.disconnect();
|
33338
|
+
};
|
33339
|
+
}, []);
|
33340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
33341
|
+
"div",
|
33342
|
+
{
|
33343
|
+
className: getClassName24({
|
33344
|
+
ready: status === "READY" || !iframe.enabled
|
33345
|
+
}),
|
33346
|
+
onClick: () => dispatch({
|
33347
|
+
type: "setUi",
|
33348
|
+
ui: { itemSelector: null },
|
33349
|
+
recordHistory: true
|
33350
|
+
}),
|
33351
|
+
children: [
|
33352
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33353
|
+
ViewportControls,
|
33354
|
+
{
|
33355
|
+
autoZoom: zoomConfig.autoZoom,
|
33356
|
+
zoom: zoomConfig.zoom,
|
33357
|
+
onViewportChange: (viewport) => {
|
33358
|
+
setShowTransition(true);
|
33359
|
+
const uiViewport = __spreadProps(__spreadValues({}, viewport), {
|
33360
|
+
height: viewport.height || "auto",
|
33361
|
+
zoom: zoomConfig.zoom
|
33362
|
+
});
|
33363
|
+
const newUi = __spreadProps(__spreadValues({}, ui), {
|
33364
|
+
viewports: __spreadProps(__spreadValues({}, ui.viewports), { current: uiViewport })
|
33365
|
+
});
|
33366
|
+
setUi(newUi);
|
33367
|
+
if (ZOOM_ON_CHANGE) {
|
33368
|
+
resetAutoZoom(newUi);
|
33369
|
+
}
|
33370
|
+
},
|
33371
|
+
onZoom: (zoom) => {
|
33372
|
+
setShowTransition(true);
|
33373
|
+
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
|
33374
|
+
}
|
33375
|
+
}
|
33376
|
+
) }),
|
33377
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33378
|
+
"div",
|
33379
|
+
{
|
33380
|
+
className: getClassName24("root"),
|
33381
|
+
style: {
|
33382
|
+
width: iframe.enabled ? ui.viewports.current.width : void 0,
|
33383
|
+
height: zoomConfig.rootHeight,
|
33384
|
+
transform: iframe.enabled ? `scale(${zoomConfig.zoom})` : void 0,
|
33385
|
+
transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
|
33386
|
+
overflow: iframe.enabled ? void 0 : "auto"
|
33387
|
+
},
|
33388
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Preview, {}) })
|
33389
|
+
}
|
33390
|
+
) })
|
33391
|
+
]
|
33392
|
+
}
|
33393
|
+
);
|
33394
|
+
};
|
33395
|
+
|
32731
33396
|
// components/Puck/index.tsx
|
32732
|
-
var
|
32733
|
-
var
|
33397
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
33398
|
+
var getClassName25 = get_class_name_factory_default("Puck", styles_module_default8);
|
32734
33399
|
function Puck({
|
32735
33400
|
children,
|
32736
33401
|
config,
|
32737
33402
|
data: initialData = { content: [], root: { props: { title: "" } } },
|
32738
|
-
ui: initialUi
|
33403
|
+
ui: initialUi,
|
32739
33404
|
onChange,
|
32740
33405
|
onPublish,
|
32741
33406
|
plugins = [],
|
@@ -32743,32 +33408,71 @@ function Puck({
|
|
32743
33408
|
renderHeader,
|
32744
33409
|
renderHeaderActions,
|
32745
33410
|
headerTitle,
|
32746
|
-
headerPath
|
33411
|
+
headerPath,
|
33412
|
+
viewports = defaultViewports,
|
33413
|
+
iframe = {
|
33414
|
+
enabled: true
|
33415
|
+
}
|
32747
33416
|
}) {
|
33417
|
+
var _a;
|
32748
33418
|
const historyStore = useHistoryStore();
|
32749
|
-
const [reducer] = (0,
|
33419
|
+
const [reducer] = (0, import_react28.useState)(
|
32750
33420
|
() => createReducer({ config, record: historyStore.record })
|
32751
33421
|
);
|
32752
|
-
const [initialAppState] = (0,
|
32753
|
-
|
32754
|
-
|
32755
|
-
|
32756
|
-
|
32757
|
-
|
32758
|
-
|
32759
|
-
|
32760
|
-
|
32761
|
-
|
32762
|
-
|
32763
|
-
|
32764
|
-
|
32765
|
-
|
32766
|
-
|
32767
|
-
|
32768
|
-
|
32769
|
-
|
32770
|
-
|
32771
|
-
|
33422
|
+
const [initialAppState] = (0, import_react28.useState)(() => {
|
33423
|
+
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
33424
|
+
return __spreadProps(__spreadValues({}, defaultAppState), {
|
33425
|
+
data: initialData,
|
33426
|
+
ui: __spreadProps(__spreadValues({}, initial), {
|
33427
|
+
// Store categories under componentList on state to allow render functions and plugins to modify
|
33428
|
+
componentList: config.categories ? Object.entries(config.categories).reduce(
|
33429
|
+
(acc, [categoryName, category]) => {
|
33430
|
+
return __spreadProps(__spreadValues({}, acc), {
|
33431
|
+
[categoryName]: {
|
33432
|
+
title: category.title,
|
33433
|
+
components: category.components,
|
33434
|
+
expanded: category.defaultExpanded,
|
33435
|
+
visible: category.visible
|
33436
|
+
}
|
33437
|
+
});
|
33438
|
+
},
|
33439
|
+
{}
|
33440
|
+
) : {}
|
33441
|
+
})
|
33442
|
+
});
|
33443
|
+
});
|
33444
|
+
(0, import_react28.useEffect)(() => {
|
33445
|
+
var _a2, _b, _c, _d;
|
33446
|
+
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
33447
|
+
let clientUiState = {};
|
33448
|
+
if (window.matchMedia("(max-width: 638px)").matches) {
|
33449
|
+
clientUiState = __spreadProps(__spreadValues({}, clientUiState), {
|
33450
|
+
leftSideBarVisible: false,
|
33451
|
+
rightSideBarVisible: false
|
33452
|
+
});
|
33453
|
+
}
|
33454
|
+
const viewportWidth = window.innerWidth;
|
33455
|
+
const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
|
33456
|
+
key,
|
33457
|
+
diff: Math.abs(viewportWidth - value.width)
|
33458
|
+
})).sort((a, b) => a.diff > b.diff ? 1 : -1);
|
33459
|
+
const closestViewport = viewportDifferences[0].key;
|
33460
|
+
if (iframe.enabled) {
|
33461
|
+
clientUiState = __spreadProps(__spreadValues({}, clientUiState), {
|
33462
|
+
viewports: __spreadProps(__spreadValues({}, initial.viewports), {
|
33463
|
+
current: __spreadProps(__spreadValues({}, initial.viewports.current), {
|
33464
|
+
height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || viewports[closestViewport].height || "auto",
|
33465
|
+
width: ((_d = (_c = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _c.current) == null ? void 0 : _d.width) || viewports[closestViewport].width
|
33466
|
+
})
|
33467
|
+
})
|
33468
|
+
});
|
33469
|
+
}
|
33470
|
+
dispatch({
|
33471
|
+
type: "setUi",
|
33472
|
+
ui: clientUiState
|
33473
|
+
});
|
33474
|
+
}, []);
|
33475
|
+
const [appState, dispatch] = (0, import_react28.useReducer)(
|
32772
33476
|
reducer,
|
32773
33477
|
flushZones(initialAppState)
|
32774
33478
|
);
|
@@ -32779,9 +33483,9 @@ function Puck({
|
|
32779
33483
|
config,
|
32780
33484
|
dispatch
|
32781
33485
|
);
|
32782
|
-
const [menuOpen, setMenuOpen] = (0,
|
33486
|
+
const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
|
32783
33487
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
32784
|
-
const setItemSelector = (0,
|
33488
|
+
const setItemSelector = (0, import_react28.useCallback)(
|
32785
33489
|
(newItemSelector) => {
|
32786
33490
|
if (newItemSelector === itemSelector)
|
32787
33491
|
return;
|
@@ -32794,21 +33498,21 @@ function Puck({
|
|
32794
33498
|
[itemSelector]
|
32795
33499
|
);
|
32796
33500
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
32797
|
-
(0,
|
33501
|
+
(0, import_react28.useEffect)(() => {
|
32798
33502
|
if (onChange)
|
32799
33503
|
onChange(data);
|
32800
33504
|
}, [data]);
|
32801
33505
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
32802
|
-
const [draggedItem, setDraggedItem] = (0,
|
33506
|
+
const [draggedItem, setDraggedItem] = (0, import_react28.useState)();
|
32803
33507
|
const rootProps = data.root.props || data.root;
|
32804
|
-
(0,
|
33508
|
+
(0, import_react28.useEffect)(() => {
|
32805
33509
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
32806
33510
|
console.error(
|
32807
33511
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
32808
33512
|
);
|
32809
33513
|
}
|
32810
33514
|
}, []);
|
32811
|
-
const toggleSidebars = (0,
|
33515
|
+
const toggleSidebars = (0, import_react28.useCallback)(
|
32812
33516
|
(sidebar) => {
|
32813
33517
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
32814
33518
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -32822,7 +33526,7 @@ function Puck({
|
|
32822
33526
|
},
|
32823
33527
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
32824
33528
|
);
|
32825
|
-
(0,
|
33529
|
+
(0, import_react28.useEffect)(() => {
|
32826
33530
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
32827
33531
|
dispatch({
|
32828
33532
|
type: "setUi",
|
@@ -32845,269 +33549,249 @@ function Puck({
|
|
32845
33549
|
window.removeEventListener("resize", handleResize);
|
32846
33550
|
};
|
32847
33551
|
}, []);
|
32848
|
-
const defaultRender = (0,
|
32849
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0,
|
33552
|
+
const defaultRender = (0, import_react28.useMemo)(() => {
|
33553
|
+
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: children2 });
|
32850
33554
|
return PuckDefault;
|
32851
33555
|
}, []);
|
32852
|
-
const defaultHeaderRender = (0,
|
33556
|
+
const defaultHeaderRender = (0, import_react28.useMemo)(() => {
|
32853
33557
|
if (renderHeader) {
|
32854
33558
|
console.warn(
|
32855
33559
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
32856
33560
|
);
|
32857
|
-
const RenderHeader = (
|
32858
|
-
var _b =
|
33561
|
+
const RenderHeader = (_a2) => {
|
33562
|
+
var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
|
32859
33563
|
const Comp = renderHeader;
|
32860
|
-
return /* @__PURE__ */ (0,
|
33564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
32861
33565
|
};
|
32862
33566
|
return RenderHeader;
|
32863
33567
|
}
|
32864
33568
|
return defaultRender;
|
32865
33569
|
}, [renderHeader]);
|
32866
|
-
const defaultHeaderActionsRender = (0,
|
33570
|
+
const defaultHeaderActionsRender = (0, import_react28.useMemo)(() => {
|
32867
33571
|
if (renderHeaderActions) {
|
32868
33572
|
console.warn(
|
32869
33573
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
32870
33574
|
);
|
32871
33575
|
const RenderHeader = (props) => {
|
32872
33576
|
const Comp = renderHeaderActions;
|
32873
|
-
return /* @__PURE__ */ (0,
|
33577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
32874
33578
|
};
|
32875
33579
|
return RenderHeader;
|
32876
33580
|
}
|
32877
33581
|
return defaultRender;
|
32878
33582
|
}, [renderHeader]);
|
32879
|
-
const loadedOverrides = (0,
|
33583
|
+
const loadedOverrides = (0, import_react28.useMemo)(() => {
|
32880
33584
|
return loadOverrides({ overrides, plugins });
|
32881
33585
|
}, [plugins]);
|
32882
|
-
const CustomPuck = (0,
|
33586
|
+
const CustomPuck = (0, import_react28.useMemo)(
|
32883
33587
|
() => loadedOverrides.puck || defaultRender,
|
32884
33588
|
[loadedOverrides]
|
32885
33589
|
);
|
32886
|
-
const
|
32887
|
-
() => loadedOverrides.preview || defaultRender,
|
32888
|
-
[loadedOverrides]
|
32889
|
-
);
|
32890
|
-
const CustomHeader = (0, import_react26.useMemo)(
|
33590
|
+
const CustomHeader = (0, import_react28.useMemo)(
|
32891
33591
|
() => loadedOverrides.header || defaultHeaderRender,
|
32892
33592
|
[loadedOverrides]
|
32893
33593
|
);
|
32894
|
-
const CustomHeaderActions = (0,
|
33594
|
+
const CustomHeaderActions = (0, import_react28.useMemo)(
|
32895
33595
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
32896
33596
|
[loadedOverrides]
|
32897
33597
|
);
|
32898
|
-
|
32899
|
-
|
32900
|
-
|
32901
|
-
|
32902
|
-
|
32903
|
-
|
32904
|
-
|
32905
|
-
|
32906
|
-
|
32907
|
-
|
32908
|
-
|
32909
|
-
|
32910
|
-
|
32911
|
-
|
32912
|
-
|
32913
|
-
|
32914
|
-
|
32915
|
-
|
32916
|
-
|
32917
|
-
|
32918
|
-
|
32919
|
-
|
32920
|
-
|
32921
|
-
|
32922
|
-
|
32923
|
-
|
32924
|
-
|
32925
|
-
|
32926
|
-
|
32927
|
-
|
32928
|
-
|
32929
|
-
|
32930
|
-
|
32931
|
-
|
32932
|
-
|
33598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "Puck", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33599
|
+
AppProvider,
|
33600
|
+
{
|
33601
|
+
value: {
|
33602
|
+
state: appState,
|
33603
|
+
dispatch,
|
33604
|
+
config,
|
33605
|
+
componentState,
|
33606
|
+
resolveData,
|
33607
|
+
plugins,
|
33608
|
+
overrides: loadedOverrides,
|
33609
|
+
history,
|
33610
|
+
viewports,
|
33611
|
+
iframe
|
33612
|
+
},
|
33613
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33614
|
+
DragDropContext,
|
33615
|
+
{
|
33616
|
+
onDragUpdate: (update) => {
|
33617
|
+
setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
|
33618
|
+
onDragStartOrUpdate(update);
|
33619
|
+
},
|
33620
|
+
onBeforeDragStart: (start) => {
|
33621
|
+
onDragStartOrUpdate(start);
|
33622
|
+
setItemSelector(null);
|
33623
|
+
dispatch({ type: "setUi", ui: { isDragging: true } });
|
33624
|
+
},
|
33625
|
+
onDragEnd: (droppedItem) => {
|
33626
|
+
setDraggedItem(void 0);
|
33627
|
+
dispatch({ type: "setUi", ui: { isDragging: false } });
|
33628
|
+
if (!droppedItem.destination) {
|
33629
|
+
return;
|
33630
|
+
}
|
33631
|
+
if (droppedItem.source.droppableId.startsWith("component-list") && droppedItem.destination) {
|
33632
|
+
const [_, componentType] = droppedItem.draggableId.split("::");
|
33633
|
+
dispatch({
|
33634
|
+
type: "insert",
|
33635
|
+
componentType: componentType || droppedItem.draggableId,
|
33636
|
+
destinationIndex: droppedItem.destination.index,
|
33637
|
+
destinationZone: droppedItem.destination.droppableId
|
33638
|
+
});
|
33639
|
+
setItemSelector({
|
33640
|
+
index: droppedItem.destination.index,
|
33641
|
+
zone: droppedItem.destination.droppableId
|
33642
|
+
});
|
33643
|
+
return;
|
33644
|
+
} else {
|
33645
|
+
const { source, destination } = droppedItem;
|
33646
|
+
if (source.droppableId === destination.droppableId) {
|
32933
33647
|
dispatch({
|
32934
|
-
type: "
|
32935
|
-
|
32936
|
-
destinationIndex:
|
32937
|
-
destinationZone:
|
32938
|
-
});
|
32939
|
-
setItemSelector({
|
32940
|
-
index: droppedItem.destination.index,
|
32941
|
-
zone: droppedItem.destination.droppableId
|
33648
|
+
type: "reorder",
|
33649
|
+
sourceIndex: source.index,
|
33650
|
+
destinationIndex: destination.index,
|
33651
|
+
destinationZone: destination.droppableId
|
32942
33652
|
});
|
32943
|
-
return;
|
32944
33653
|
} else {
|
32945
|
-
|
32946
|
-
|
32947
|
-
|
32948
|
-
|
32949
|
-
|
32950
|
-
|
32951
|
-
destinationZone: destination.droppableId
|
32952
|
-
});
|
32953
|
-
} else {
|
32954
|
-
dispatch({
|
32955
|
-
type: "move",
|
32956
|
-
sourceZone: source.droppableId,
|
32957
|
-
sourceIndex: source.index,
|
32958
|
-
destinationIndex: destination.index,
|
32959
|
-
destinationZone: destination.droppableId
|
32960
|
-
});
|
32961
|
-
}
|
32962
|
-
setItemSelector({
|
32963
|
-
index: destination.index,
|
32964
|
-
zone: destination.droppableId
|
33654
|
+
dispatch({
|
33655
|
+
type: "move",
|
33656
|
+
sourceZone: source.droppableId,
|
33657
|
+
sourceIndex: source.index,
|
33658
|
+
destinationIndex: destination.index,
|
33659
|
+
destinationZone: destination.droppableId
|
32965
33660
|
});
|
32966
33661
|
}
|
32967
|
-
|
32968
|
-
|
32969
|
-
|
32970
|
-
|
32971
|
-
|
32972
|
-
|
32973
|
-
|
32974
|
-
|
32975
|
-
|
32976
|
-
|
32977
|
-
|
32978
|
-
|
32979
|
-
|
32980
|
-
|
32981
|
-
|
32982
|
-
|
32983
|
-
|
32984
|
-
|
32985
|
-
|
32986
|
-
|
32987
|
-
|
32988
|
-
|
32989
|
-
|
32990
|
-
|
32991
|
-
|
32992
|
-
|
32993
|
-
|
32994
|
-
|
32995
|
-
|
32996
|
-
|
32997
|
-
|
32998
|
-
|
32999
|
-
|
33662
|
+
setItemSelector({
|
33663
|
+
index: destination.index,
|
33664
|
+
zone: destination.droppableId
|
33665
|
+
});
|
33666
|
+
}
|
33667
|
+
},
|
33668
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33669
|
+
DropZoneProvider,
|
33670
|
+
{
|
33671
|
+
value: {
|
33672
|
+
data,
|
33673
|
+
itemSelector,
|
33674
|
+
setItemSelector,
|
33675
|
+
config,
|
33676
|
+
dispatch,
|
33677
|
+
draggedItem,
|
33678
|
+
placeholderStyle,
|
33679
|
+
mode: "edit",
|
33680
|
+
areaId: "root"
|
33681
|
+
},
|
33682
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
33683
|
+
"div",
|
33684
|
+
{
|
33685
|
+
className: getClassName25({
|
33686
|
+
leftSideBarVisible,
|
33687
|
+
menuOpen,
|
33688
|
+
rightSideBarVisible
|
33689
|
+
}),
|
33690
|
+
children: [
|
33691
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33692
|
+
CustomHeader,
|
33693
|
+
{
|
33694
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
33695
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
|
33696
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33697
|
+
Button,
|
33698
|
+
{
|
33699
|
+
onClick: () => {
|
33700
|
+
onPublish && onPublish(data);
|
33701
|
+
},
|
33702
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Globe, { size: "14px" }),
|
33703
|
+
children: "Publish"
|
33704
|
+
}
|
33705
|
+
)
|
33706
|
+
] }),
|
33707
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerInner"), children: [
|
33708
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerToggle"), children: [
|
33709
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33710
|
+
IconButton,
|
33000
33711
|
{
|
33001
33712
|
onClick: () => {
|
33002
|
-
|
33713
|
+
toggleSidebars("left");
|
33003
33714
|
},
|
33004
|
-
|
33005
|
-
children: "
|
33715
|
+
title: "Toggle left sidebar",
|
33716
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelLeft, { focusable: "false" })
|
33006
33717
|
}
|
33007
|
-
)
|
33718
|
+
) }),
|
33719
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33720
|
+
IconButton,
|
33721
|
+
{
|
33722
|
+
onClick: () => {
|
33723
|
+
toggleSidebars("right");
|
33724
|
+
},
|
33725
|
+
title: "Toggle right sidebar",
|
33726
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelRight, { focusable: "false" })
|
33727
|
+
}
|
33728
|
+
) })
|
33008
33729
|
] }),
|
33009
|
-
|
33010
|
-
|
33011
|
-
|
33012
|
-
|
33013
|
-
|
33014
|
-
onClick: () => {
|
33015
|
-
toggleSidebars("left");
|
33016
|
-
},
|
33017
|
-
title: "Toggle left sidebar",
|
33018
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelLeft, { focusable: "false" })
|
33019
|
-
}
|
33020
|
-
) }),
|
33021
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33022
|
-
IconButton,
|
33023
|
-
{
|
33024
|
-
onClick: () => {
|
33025
|
-
toggleSidebars("right");
|
33026
|
-
},
|
33027
|
-
title: "Toggle right sidebar",
|
33028
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelRight, { focusable: "false" })
|
33029
|
-
}
|
33030
|
-
) })
|
33031
|
-
] }),
|
33032
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
33033
|
-
headerTitle || rootProps.title || "Page",
|
33034
|
-
headerPath && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
33035
|
-
" ",
|
33036
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("code", { className: getClassName22("headerPath"), children: headerPath })
|
33037
|
-
] })
|
33038
|
-
] }) }),
|
33039
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerTools"), children: [
|
33040
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33041
|
-
IconButton,
|
33042
|
-
{
|
33043
|
-
onClick: () => {
|
33044
|
-
return setMenuOpen(!menuOpen);
|
33045
|
-
},
|
33046
|
-
title: "Toggle menu bar",
|
33047
|
-
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, { focusable: "false" })
|
33048
|
-
}
|
33049
|
-
) }),
|
33050
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33051
|
-
MenuBar,
|
33052
|
-
{
|
33053
|
-
appState,
|
33054
|
-
data,
|
33055
|
-
dispatch,
|
33056
|
-
onPublish,
|
33057
|
-
menuOpen,
|
33058
|
-
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomHeaderActions, {}),
|
33059
|
-
setMenuOpen
|
33060
|
-
}
|
33061
|
-
)
|
33730
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
33731
|
+
headerTitle || rootProps.title || "Page",
|
33732
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
33733
|
+
" ",
|
33734
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
|
33062
33735
|
] })
|
33063
|
-
] }) })
|
33064
|
-
|
33065
|
-
|
33066
|
-
|
33067
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Components, {}) }),
|
33068
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Outline, {}) })
|
33069
|
-
] }),
|
33070
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
33071
|
-
"div",
|
33072
|
-
{
|
33073
|
-
className: getClassName22("frame"),
|
33074
|
-
onClick: () => setItemSelector(null),
|
33075
|
-
children: [
|
33076
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("root"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Preview, {}) }) }),
|
33077
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33078
|
-
"div",
|
33736
|
+
] }) }),
|
33737
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerTools"), children: [
|
33738
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33739
|
+
IconButton,
|
33079
33740
|
{
|
33080
|
-
|
33081
|
-
|
33082
|
-
|
33083
|
-
|
33084
|
-
}
|
33741
|
+
onClick: () => {
|
33742
|
+
return setMenuOpen(!menuOpen);
|
33743
|
+
},
|
33744
|
+
title: "Toggle menu bar",
|
33745
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { focusable: "false" })
|
33746
|
+
}
|
33747
|
+
) }),
|
33748
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33749
|
+
MenuBar,
|
33750
|
+
{
|
33751
|
+
appState,
|
33752
|
+
data,
|
33753
|
+
dispatch,
|
33754
|
+
onPublish,
|
33755
|
+
menuOpen,
|
33756
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
|
33757
|
+
setMenuOpen
|
33085
33758
|
}
|
33086
33759
|
)
|
33087
|
-
]
|
33088
|
-
}
|
33089
|
-
|
33090
|
-
|
33091
|
-
|
33092
|
-
|
33093
|
-
|
33094
|
-
|
33095
|
-
|
33096
|
-
|
33097
|
-
|
33098
|
-
|
33099
|
-
|
33100
|
-
|
33101
|
-
|
33102
|
-
|
33103
|
-
|
33104
|
-
|
33105
|
-
|
33106
|
-
|
33107
|
-
|
33108
|
-
|
33109
|
-
|
33110
|
-
|
33760
|
+
] })
|
33761
|
+
] }) })
|
33762
|
+
}
|
33763
|
+
),
|
33764
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
|
33765
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Components, {}) }),
|
33766
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Outline, {}) })
|
33767
|
+
] }),
|
33768
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Canvas, {}),
|
33769
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33770
|
+
SidebarSection,
|
33771
|
+
{
|
33772
|
+
noPadding: true,
|
33773
|
+
noBorderTop: true,
|
33774
|
+
showBreadcrumbs: true,
|
33775
|
+
title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
|
33776
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Fields, {})
|
33777
|
+
}
|
33778
|
+
) }),
|
33779
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33780
|
+
"div",
|
33781
|
+
{
|
33782
|
+
id: "puck-portal-root",
|
33783
|
+
className: getClassName25("portal")
|
33784
|
+
}
|
33785
|
+
)
|
33786
|
+
]
|
33787
|
+
}
|
33788
|
+
) })
|
33789
|
+
}
|
33790
|
+
)
|
33791
|
+
}
|
33792
|
+
)
|
33793
|
+
}
|
33794
|
+
) });
|
33111
33795
|
}
|
33112
33796
|
Puck.Components = Components;
|
33113
33797
|
Puck.Fields = Fields;
|
@@ -33116,13 +33800,16 @@ Puck.Preview = Preview;
|
|
33116
33800
|
|
33117
33801
|
// components/Render/index.tsx
|
33118
33802
|
init_react_import();
|
33119
|
-
var
|
33120
|
-
function Render({
|
33803
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
33804
|
+
function Render({
|
33805
|
+
config,
|
33806
|
+
data
|
33807
|
+
}) {
|
33121
33808
|
var _a;
|
33122
33809
|
const rootProps = data.root.props || data.root;
|
33123
33810
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
33124
33811
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
33125
|
-
return /* @__PURE__ */ (0,
|
33812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33126
33813
|
config.root.render,
|
33127
33814
|
__spreadProps(__spreadValues({}, rootProps), {
|
33128
33815
|
puck: {
|
@@ -33131,11 +33818,11 @@ function Render({ config, data }) {
|
|
33131
33818
|
title,
|
33132
33819
|
editMode: false,
|
33133
33820
|
id: "puck-root",
|
33134
|
-
children: /* @__PURE__ */ (0,
|
33821
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId })
|
33135
33822
|
})
|
33136
33823
|
) });
|
33137
33824
|
}
|
33138
|
-
return /* @__PURE__ */ (0,
|
33825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId }) });
|
33139
33826
|
}
|
33140
33827
|
|
33141
33828
|
// lib/migrate.ts
|
@@ -33196,37 +33883,51 @@ function transformProps(data, propTransforms) {
|
|
33196
33883
|
|
33197
33884
|
// lib/resolve-all-data.ts
|
33198
33885
|
init_react_import();
|
33199
|
-
|
33200
|
-
|
33201
|
-
|
33202
|
-
|
33203
|
-
|
33204
|
-
|
33205
|
-
|
33206
|
-
|
33207
|
-
|
33208
|
-
|
33209
|
-
|
33210
|
-
|
33211
|
-
|
33212
|
-
|
33213
|
-
|
33214
|
-
|
33215
|
-
|
33216
|
-
|
33217
|
-
|
33218
|
-
|
33219
|
-
|
33220
|
-
|
33221
|
-
|
33886
|
+
function resolveAllData(data, config, onResolveStart, onResolveEnd) {
|
33887
|
+
return __async(this, null, function* () {
|
33888
|
+
const dynamicRoot = yield resolveRootData(data, config);
|
33889
|
+
const { zones = {} } = data;
|
33890
|
+
const zoneKeys = Object.keys(zones);
|
33891
|
+
const resolvedZones = {};
|
33892
|
+
for (let i = 0; i < zoneKeys.length; i++) {
|
33893
|
+
const zoneKey = zoneKeys[i];
|
33894
|
+
resolvedZones[zoneKey] = yield resolveAllComponentData(
|
33895
|
+
zones[zoneKey],
|
33896
|
+
config,
|
33897
|
+
onResolveStart,
|
33898
|
+
onResolveEnd
|
33899
|
+
);
|
33900
|
+
}
|
33901
|
+
return __spreadProps(__spreadValues({}, data), {
|
33902
|
+
root: dynamicRoot,
|
33903
|
+
content: yield resolveAllComponentData(
|
33904
|
+
data.content,
|
33905
|
+
config,
|
33906
|
+
onResolveStart,
|
33907
|
+
onResolveEnd
|
33908
|
+
),
|
33909
|
+
zones: resolvedZones
|
33910
|
+
});
|
33222
33911
|
});
|
33223
|
-
}
|
33912
|
+
}
|
33224
33913
|
|
33225
33914
|
// lib/use-puck.ts
|
33226
33915
|
init_react_import();
|
33227
33916
|
var usePuck = () => {
|
33228
|
-
const {
|
33229
|
-
|
33917
|
+
const {
|
33918
|
+
state: appState,
|
33919
|
+
config,
|
33920
|
+
history,
|
33921
|
+
dispatch,
|
33922
|
+
selectedItem
|
33923
|
+
} = useAppContext();
|
33924
|
+
return {
|
33925
|
+
appState,
|
33926
|
+
config,
|
33927
|
+
dispatch,
|
33928
|
+
history,
|
33929
|
+
selectedItem: selectedItem || null
|
33930
|
+
};
|
33230
33931
|
};
|
33231
33932
|
// Annotate the CommonJS export names for ESM import in node:
|
33232
33933
|
0 && (module.exports = {
|
@@ -33430,6 +34131,14 @@ lucide-react/dist/esm/icons/lock.js:
|
|
33430
34131
|
* See the LICENSE file in the root directory of this source tree.
|
33431
34132
|
*)
|
33432
34133
|
|
34134
|
+
lucide-react/dist/esm/icons/monitor.js:
|
34135
|
+
(**
|
34136
|
+
* @license lucide-react v0.298.0 - ISC
|
34137
|
+
*
|
34138
|
+
* This source code is licensed under the ISC license.
|
34139
|
+
* See the LICENSE file in the root directory of this source tree.
|
34140
|
+
*)
|
34141
|
+
|
33433
34142
|
lucide-react/dist/esm/icons/more-vertical.js:
|
33434
34143
|
(**
|
33435
34144
|
* @license lucide-react v0.298.0 - ISC
|
@@ -33478,6 +34187,22 @@ lucide-react/dist/esm/icons/sliders-horizontal.js:
|
|
33478
34187
|
* See the LICENSE file in the root directory of this source tree.
|
33479
34188
|
*)
|
33480
34189
|
|
34190
|
+
lucide-react/dist/esm/icons/smartphone.js:
|
34191
|
+
(**
|
34192
|
+
* @license lucide-react v0.298.0 - ISC
|
34193
|
+
*
|
34194
|
+
* This source code is licensed under the ISC license.
|
34195
|
+
* See the LICENSE file in the root directory of this source tree.
|
34196
|
+
*)
|
34197
|
+
|
34198
|
+
lucide-react/dist/esm/icons/tablet.js:
|
34199
|
+
(**
|
34200
|
+
* @license lucide-react v0.298.0 - ISC
|
34201
|
+
*
|
34202
|
+
* This source code is licensed under the ISC license.
|
34203
|
+
* See the LICENSE file in the root directory of this source tree.
|
34204
|
+
*)
|
34205
|
+
|
33481
34206
|
lucide-react/dist/esm/icons/trash.js:
|
33482
34207
|
(**
|
33483
34208
|
* @license lucide-react v0.298.0 - ISC
|
@@ -33502,6 +34227,22 @@ lucide-react/dist/esm/icons/unlock.js:
|
|
33502
34227
|
* See the LICENSE file in the root directory of this source tree.
|
33503
34228
|
*)
|
33504
34229
|
|
34230
|
+
lucide-react/dist/esm/icons/zoom-in.js:
|
34231
|
+
(**
|
34232
|
+
* @license lucide-react v0.298.0 - ISC
|
34233
|
+
*
|
34234
|
+
* This source code is licensed under the ISC license.
|
34235
|
+
* See the LICENSE file in the root directory of this source tree.
|
34236
|
+
*)
|
34237
|
+
|
34238
|
+
lucide-react/dist/esm/icons/zoom-out.js:
|
34239
|
+
(**
|
34240
|
+
* @license lucide-react v0.298.0 - ISC
|
34241
|
+
*
|
34242
|
+
* This source code is licensed under the ISC license.
|
34243
|
+
* See the LICENSE file in the root directory of this source tree.
|
34244
|
+
*)
|
34245
|
+
|
33505
34246
|
lucide-react/dist/esm/lucide-react.js:
|
33506
34247
|
(**
|
33507
34248
|
* @license lucide-react v0.298.0 - ISC
|