@measured/puck 0.14.0-canary.712fb8e → 0.14.0-canary.83be956
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-487c2755.d.ts → Config-09628f3c.d.ts} +35 -25
- package/dist/index.css +319 -222
- package/dist/index.d.ts +60 -48
- package/dist/index.js +1390 -667
- 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,
|
@@ -29385,15 +29546,15 @@ var DrawerItem = ({
|
|
29385
29546
|
label,
|
29386
29547
|
index
|
29387
29548
|
}) => {
|
29388
|
-
const ctx = (0,
|
29549
|
+
const ctx = (0, import_react4.useContext)(drawerContext);
|
29389
29550
|
const resolvedId = `${ctx.droppableId}::${id || name}`;
|
29390
|
-
const CustomInner = (0,
|
29391
|
-
() => 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 })),
|
29392
29553
|
[children]
|
29393
29554
|
);
|
29394
|
-
return /* @__PURE__ */ (0,
|
29395
|
-
/* @__PURE__ */ (0,
|
29396
|
-
/* @__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, {}) })
|
29397
29558
|
] }) }) }) });
|
29398
29559
|
};
|
29399
29560
|
var Drawer = ({
|
@@ -29401,7 +29562,7 @@ var Drawer = ({
|
|
29401
29562
|
droppableId = "component-list",
|
29402
29563
|
direction = "vertical"
|
29403
29564
|
}) => {
|
29404
|
-
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)(
|
29405
29566
|
"div",
|
29406
29567
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
29407
29568
|
ref: provided.innerRef,
|
@@ -29410,7 +29571,7 @@ var Drawer = ({
|
|
29410
29571
|
}),
|
29411
29572
|
children: [
|
29412
29573
|
children,
|
29413
|
-
/* @__PURE__ */ (0,
|
29574
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
|
29414
29575
|
]
|
29415
29576
|
})
|
29416
29577
|
) }) });
|
@@ -29423,19 +29584,19 @@ var import_react9 = require("react");
|
|
29423
29584
|
|
29424
29585
|
// components/DraggableComponent/index.tsx
|
29425
29586
|
init_react_import();
|
29426
|
-
var
|
29427
|
-
var import_dnd3 = require("@
|
29587
|
+
var import_react7 = require("react");
|
29588
|
+
var import_dnd3 = require("@measured/dnd");
|
29428
29589
|
|
29429
29590
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
29430
29591
|
init_react_import();
|
29431
|
-
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" };
|
29432
29593
|
|
29433
29594
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
29434
29595
|
init_react_import();
|
29435
29596
|
|
29436
29597
|
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
29437
29598
|
init_react_import();
|
29438
|
-
var
|
29599
|
+
var import_react5 = require("react");
|
29439
29600
|
|
29440
29601
|
// ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
|
29441
29602
|
init_react_import();
|
@@ -29454,10 +29615,10 @@ var defaultAttributes = {
|
|
29454
29615
|
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
29455
29616
|
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim();
|
29456
29617
|
var createLucideIcon = (iconName, iconNode) => {
|
29457
|
-
const Component = (0,
|
29618
|
+
const Component = (0, import_react5.forwardRef)(
|
29458
29619
|
(_a, ref) => {
|
29459
29620
|
var _b = _a, { color = "currentColor", size = 24, strokeWidth = 2, absoluteStrokeWidth, className = "", children } = _b, rest = __objRest(_b, ["color", "size", "strokeWidth", "absoluteStrokeWidth", "className", "children"]);
|
29460
|
-
return (0,
|
29621
|
+
return (0, import_react5.createElement)(
|
29461
29622
|
"svg",
|
29462
29623
|
__spreadValues(__spreadProps(__spreadValues({
|
29463
29624
|
ref
|
@@ -29469,7 +29630,7 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
29469
29630
|
className: ["lucide", `lucide-${toKebabCase(iconName)}`, className].join(" ")
|
29470
29631
|
}), rest),
|
29471
29632
|
[
|
29472
|
-
...iconNode.map(([tag, attrs]) => (0,
|
29633
|
+
...iconNode.map(([tag, attrs]) => (0, import_react5.createElement)(tag, attrs)),
|
29473
29634
|
...Array.isArray(children) ? children : [children]
|
29474
29635
|
]
|
29475
29636
|
);
|
@@ -29580,6 +29741,14 @@ var Lock = createLucideIcon("Lock", [
|
|
29580
29741
|
["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
|
29581
29742
|
]);
|
29582
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
|
+
|
29583
29752
|
// ../../node_modules/lucide-react/dist/esm/icons/more-vertical.js
|
29584
29753
|
init_react_import();
|
29585
29754
|
var MoreVertical = createLucideIcon("MoreVertical", [
|
@@ -29630,6 +29799,20 @@ var SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
|
|
29630
29799
|
["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
|
29631
29800
|
]);
|
29632
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
|
+
|
29633
29816
|
// ../../node_modules/lucide-react/dist/esm/icons/trash.js
|
29634
29817
|
init_react_import();
|
29635
29818
|
var Trash = createLucideIcon("Trash", [
|
@@ -29653,12 +29836,29 @@ var Unlock = createLucideIcon("Unlock", [
|
|
29653
29836
|
["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
|
29654
29837
|
]);
|
29655
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
|
+
|
29656
29856
|
// lib/use-modifier-held.ts
|
29657
29857
|
init_react_import();
|
29658
|
-
var
|
29858
|
+
var import_react6 = require("react");
|
29659
29859
|
var useModifierHeld = (modifier) => {
|
29660
|
-
const [modifierHeld, setModifierHeld] = (0,
|
29661
|
-
(0,
|
29860
|
+
const [modifierHeld, setModifierHeld] = (0, import_react6.useState)(false);
|
29861
|
+
(0, import_react6.useEffect)(() => {
|
29662
29862
|
function downHandler({ key }) {
|
29663
29863
|
if (key === modifier) {
|
29664
29864
|
setModifierHeld(true);
|
@@ -29679,10 +29879,26 @@ var useModifierHeld = (modifier) => {
|
|
29679
29879
|
return modifierHeld;
|
29680
29880
|
};
|
29681
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
|
+
|
29682
29894
|
// components/DraggableComponent/index.tsx
|
29683
29895
|
var import_react_spinners2 = require("react-spinners");
|
29684
|
-
var
|
29896
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
29685
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;
|
29686
29902
|
var DraggableComponent = ({
|
29687
29903
|
children,
|
29688
29904
|
id,
|
@@ -29705,15 +29921,25 @@ var DraggableComponent = ({
|
|
29705
29921
|
indicativeHover = false,
|
29706
29922
|
style
|
29707
29923
|
}) => {
|
29924
|
+
const { zoomConfig } = useAppContext();
|
29708
29925
|
const isModifierHeld = useModifierHeld("Alt");
|
29709
|
-
|
29710
|
-
|
29711
|
-
|
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,
|
29712
29937
|
{
|
29713
29938
|
draggableId: id,
|
29714
29939
|
index,
|
29715
29940
|
isDragDisabled,
|
29716
|
-
|
29941
|
+
disableSecondaryAnimation,
|
29942
|
+
children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
29717
29943
|
"div",
|
29718
29944
|
__spreadProps(__spreadValues(__spreadValues({
|
29719
29945
|
ref: provided.innerRef
|
@@ -29736,13 +29962,34 @@ var DraggableComponent = ({
|
|
29736
29962
|
onClick,
|
29737
29963
|
children: [
|
29738
29964
|
debug,
|
29739
|
-
isLoading && /* @__PURE__ */ (0,
|
29740
|
-
/* @__PURE__ */ (0,
|
29741
|
-
|
29742
|
-
|
29743
|
-
|
29744
|
-
|
29745
|
-
|
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 })
|
29746
29993
|
]
|
29747
29994
|
})
|
29748
29995
|
)
|
@@ -29751,45 +29998,13 @@ var DraggableComponent = ({
|
|
29751
29998
|
);
|
29752
29999
|
};
|
29753
30000
|
|
29754
|
-
// components/DropZone/index.tsx
|
29755
|
-
var import_dnd4 = require("@hello-pangea/dnd");
|
29756
|
-
|
29757
|
-
// lib/get-item.ts
|
29758
|
-
init_react_import();
|
29759
|
-
|
29760
|
-
// lib/root-droppable-id.ts
|
29761
|
-
init_react_import();
|
29762
|
-
var rootDroppableId = "default-zone";
|
29763
|
-
|
29764
|
-
// lib/setup-zone.ts
|
29765
|
-
init_react_import();
|
29766
|
-
var setupZone = (data, zoneKey) => {
|
29767
|
-
if (zoneKey === rootDroppableId) {
|
29768
|
-
return data;
|
29769
|
-
}
|
29770
|
-
const newData = __spreadValues({}, data);
|
29771
|
-
newData.zones = data.zones || {};
|
29772
|
-
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
29773
|
-
return newData;
|
29774
|
-
};
|
29775
|
-
|
29776
|
-
// lib/get-item.ts
|
29777
|
-
var getItem = (selector, data, dynamicProps = {}) => {
|
29778
|
-
if (!selector.zone || selector.zone === rootDroppableId) {
|
29779
|
-
const item2 = data.content[selector.index];
|
29780
|
-
return __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props });
|
29781
|
-
}
|
29782
|
-
const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
|
29783
|
-
return __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props });
|
29784
|
-
};
|
29785
|
-
|
29786
30001
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
|
29787
30002
|
init_react_import();
|
29788
|
-
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" };
|
29789
30004
|
|
29790
30005
|
// components/DropZone/context.tsx
|
29791
30006
|
init_react_import();
|
29792
|
-
var
|
30007
|
+
var import_react8 = require("react");
|
29793
30008
|
var import_use_debounce = require("use-debounce");
|
29794
30009
|
|
29795
30010
|
// lib/get-zone-id.ts
|
@@ -29805,30 +30020,30 @@ var getZoneId = (zoneCompound) => {
|
|
29805
30020
|
};
|
29806
30021
|
|
29807
30022
|
// components/DropZone/context.tsx
|
29808
|
-
var
|
29809
|
-
var dropZoneContext = (0,
|
30023
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
30024
|
+
var dropZoneContext = (0, import_react8.createContext)(null);
|
29810
30025
|
var DropZoneProvider = ({
|
29811
30026
|
children,
|
29812
30027
|
value
|
29813
30028
|
}) => {
|
29814
|
-
const [hoveringArea, setHoveringArea] = (0,
|
29815
|
-
const [hoveringZone, setHoveringZone] = (0,
|
30029
|
+
const [hoveringArea, setHoveringArea] = (0, import_react8.useState)(null);
|
30030
|
+
const [hoveringZone, setHoveringZone] = (0, import_react8.useState)(
|
29816
30031
|
rootDroppableId
|
29817
30032
|
);
|
29818
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
30033
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react8.useState)();
|
29819
30034
|
const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
|
29820
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
30035
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react8.useState)(
|
29821
30036
|
{}
|
29822
30037
|
);
|
29823
|
-
const [activeZones, setActiveZones] = (0,
|
30038
|
+
const [activeZones, setActiveZones] = (0, import_react8.useState)({});
|
29824
30039
|
const { dispatch = null } = value ? value : {};
|
29825
|
-
const registerZoneArea = (0,
|
30040
|
+
const registerZoneArea = (0, import_react8.useCallback)(
|
29826
30041
|
(area) => {
|
29827
30042
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
29828
30043
|
},
|
29829
30044
|
[setAreasWithZones]
|
29830
30045
|
);
|
29831
|
-
const registerZone = (0,
|
30046
|
+
const registerZone = (0, import_react8.useCallback)(
|
29832
30047
|
(zoneCompound) => {
|
29833
30048
|
if (!dispatch) {
|
29834
30049
|
return;
|
@@ -29841,7 +30056,7 @@ var DropZoneProvider = ({
|
|
29841
30056
|
},
|
29842
30057
|
[setActiveZones, dispatch]
|
29843
30058
|
);
|
29844
|
-
const unregisterZone = (0,
|
30059
|
+
const unregisterZone = (0, import_react8.useCallback)(
|
29845
30060
|
(zoneCompound) => {
|
29846
30061
|
if (!dispatch) {
|
29847
30062
|
return;
|
@@ -29856,8 +30071,8 @@ var DropZoneProvider = ({
|
|
29856
30071
|
},
|
29857
30072
|
[setActiveZones, dispatch]
|
29858
30073
|
);
|
29859
|
-
const [pathData, setPathData] = (0,
|
29860
|
-
const registerPath = (0,
|
30074
|
+
const [pathData, setPathData] = (0, import_react8.useState)();
|
30075
|
+
const registerPath = (0, import_react8.useCallback)(
|
29861
30076
|
(selector) => {
|
29862
30077
|
if (!(value == null ? void 0 : value.data)) {
|
29863
30078
|
return;
|
@@ -29882,7 +30097,8 @@ var DropZoneProvider = ({
|
|
29882
30097
|
},
|
29883
30098
|
[value, setPathData]
|
29884
30099
|
);
|
29885
|
-
|
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)(
|
29886
30102
|
dropZoneContext.Provider,
|
29887
30103
|
{
|
29888
30104
|
value: __spreadValues({
|
@@ -29898,57 +30114,17 @@ var DropZoneProvider = ({
|
|
29898
30114
|
unregisterZone,
|
29899
30115
|
activeZones,
|
29900
30116
|
registerPath,
|
29901
|
-
pathData
|
30117
|
+
pathData,
|
30118
|
+
zoneWillDrag,
|
30119
|
+
setZoneWillDrag
|
29902
30120
|
}, value),
|
29903
30121
|
children
|
29904
30122
|
}
|
29905
30123
|
) });
|
29906
30124
|
};
|
29907
30125
|
|
29908
|
-
// components/Puck/context.tsx
|
29909
|
-
init_react_import();
|
29910
|
-
var import_react8 = require("react");
|
29911
|
-
var defaultAppState = {
|
29912
|
-
data: { content: [], root: { props: { title: "" } } },
|
29913
|
-
ui: {
|
29914
|
-
leftSideBarVisible: true,
|
29915
|
-
rightSideBarVisible: true,
|
29916
|
-
arrayState: {},
|
29917
|
-
itemSelector: null,
|
29918
|
-
componentList: {},
|
29919
|
-
isDragging: false
|
29920
|
-
}
|
29921
|
-
};
|
29922
|
-
var appContext = (0, import_react8.createContext)({
|
29923
|
-
state: defaultAppState,
|
29924
|
-
dispatch: () => null,
|
29925
|
-
config: { components: {} },
|
29926
|
-
componentState: {},
|
29927
|
-
resolveData: () => {
|
29928
|
-
},
|
29929
|
-
plugins: [],
|
29930
|
-
overrides: {},
|
29931
|
-
history: {}
|
29932
|
-
});
|
29933
|
-
var AppProvider = appContext.Provider;
|
29934
|
-
function useAppContext() {
|
29935
|
-
const mainContext = (0, import_react8.useContext)(appContext);
|
29936
|
-
const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
|
29937
|
-
return __spreadProps(__spreadValues({}, mainContext), {
|
29938
|
-
// Helpers
|
29939
|
-
selectedItem,
|
29940
|
-
setUi: (ui, recordHistory) => {
|
29941
|
-
return mainContext.dispatch({
|
29942
|
-
type: "setUi",
|
29943
|
-
ui,
|
29944
|
-
recordHistory
|
29945
|
-
});
|
29946
|
-
}
|
29947
|
-
});
|
29948
|
-
}
|
29949
|
-
|
29950
30126
|
// components/DropZone/index.tsx
|
29951
|
-
var
|
30127
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
29952
30128
|
var getClassName5 = get_class_name_factory_default("DropZone", styles_module_default4);
|
29953
30129
|
function DropZoneEdit({ zone, allow, disallow, style }) {
|
29954
30130
|
var _a;
|
@@ -29967,7 +30143,8 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
29967
30143
|
registerZoneArea,
|
29968
30144
|
areasWithZones,
|
29969
30145
|
hoveringComponent,
|
29970
|
-
|
30146
|
+
zoneWillDrag,
|
30147
|
+
setZoneWillDrag = () => null
|
29971
30148
|
} = ctx || {};
|
29972
30149
|
let content = data.content || [];
|
29973
30150
|
let zoneCompound = rootDroppableId;
|
@@ -29997,12 +30174,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
29997
30174
|
const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
|
29998
30175
|
const [zoneArea] = getZoneId(zoneCompound);
|
29999
30176
|
const [draggedSourceArea] = getZoneId(draggedSourceId);
|
30000
|
-
const
|
30177
|
+
const userWillDrag = zoneWillDrag === zone;
|
30001
30178
|
const userIsDragging = !!draggedItem;
|
30002
30179
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
30003
30180
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
30004
30181
|
if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
|
30005
|
-
return /* @__PURE__ */ (0,
|
30182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: "DropZone requires context to work." });
|
30006
30183
|
}
|
30007
30184
|
const {
|
30008
30185
|
hoveringArea = "root",
|
@@ -30039,7 +30216,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30039
30216
|
}
|
30040
30217
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
30041
30218
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
30042
|
-
return /* @__PURE__ */ (0,
|
30219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30043
30220
|
"div",
|
30044
30221
|
{
|
30045
30222
|
className: getClassName5({
|
@@ -30051,17 +30228,19 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30051
30228
|
isDestination: draggedDestinationId === zoneCompound,
|
30052
30229
|
isDisabled: !isEnabled,
|
30053
30230
|
isAreaSelected,
|
30054
|
-
hasChildren: content.length > 0
|
30055
|
-
zoomEnabled: !disableZoom
|
30231
|
+
hasChildren: content.length > 0
|
30056
30232
|
}),
|
30057
|
-
|
30058
|
-
|
30233
|
+
onMouseUp: () => {
|
30234
|
+
setZoneWillDrag("");
|
30235
|
+
},
|
30236
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30237
|
+
Droppable,
|
30059
30238
|
{
|
30060
30239
|
droppableId: zoneCompound,
|
30061
30240
|
direction: "vertical",
|
30062
30241
|
isDropDisabled: !isEnabled,
|
30063
30242
|
children: (provided, snapshot) => {
|
30064
|
-
return /* @__PURE__ */ (0,
|
30243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
30065
30244
|
"div",
|
30066
30245
|
__spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
|
30067
30246
|
className: getClassName5("content"),
|
@@ -30086,23 +30265,23 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30086
30265
|
"draggable-"
|
30087
30266
|
)[1] === componentId;
|
30088
30267
|
const containsZone = areasWithZones ? areasWithZones[componentId] : false;
|
30089
|
-
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: [
|
30090
30269
|
"No configuration for ",
|
30091
30270
|
item.type
|
30092
30271
|
] });
|
30093
|
-
return /* @__PURE__ */ (0,
|
30272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
30094
30273
|
"div",
|
30095
30274
|
{
|
30096
30275
|
className: getClassName5("item"),
|
30097
30276
|
style: { zIndex: isDragging ? 1 : void 0 },
|
30098
30277
|
children: [
|
30099
|
-
/* @__PURE__ */ (0,
|
30278
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30100
30279
|
DropZoneProvider,
|
30101
30280
|
{
|
30102
30281
|
value: __spreadProps(__spreadValues({}, ctx), {
|
30103
30282
|
areaId: componentId
|
30104
30283
|
}),
|
30105
|
-
children: /* @__PURE__ */ (0,
|
30284
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30106
30285
|
DraggableComponent,
|
30107
30286
|
{
|
30108
30287
|
label: (_b = config.components[item.type]["label"]) != null ? _b : item.type.toString(),
|
@@ -30128,11 +30307,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30128
30307
|
},
|
30129
30308
|
onMouseDown: (e) => {
|
30130
30309
|
e.stopPropagation();
|
30131
|
-
|
30132
|
-
},
|
30133
|
-
onMouseUp: (e) => {
|
30134
|
-
e.stopPropagation();
|
30135
|
-
setUserWillDrag(false);
|
30310
|
+
setZoneWillDrag(zone);
|
30136
30311
|
},
|
30137
30312
|
onMouseOver: (e) => {
|
30138
30313
|
e.stopPropagation();
|
@@ -30173,12 +30348,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30173
30348
|
style: {
|
30174
30349
|
pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
|
30175
30350
|
},
|
30176
|
-
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)) })
|
30177
30352
|
}
|
30178
30353
|
)
|
30179
30354
|
}
|
30180
30355
|
),
|
30181
|
-
userIsDragging && /* @__PURE__ */ (0,
|
30356
|
+
userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30182
30357
|
"div",
|
30183
30358
|
{
|
30184
30359
|
className: getClassName5("hitbox"),
|
@@ -30195,7 +30370,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30195
30370
|
);
|
30196
30371
|
}),
|
30197
30372
|
provided == null ? void 0 : provided.placeholder,
|
30198
|
-
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0,
|
30373
|
+
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30199
30374
|
"div",
|
30200
30375
|
{
|
30201
30376
|
"data-puck-placeholder": true,
|
@@ -30227,14 +30402,14 @@ function DropZoneRender({ zone }) {
|
|
30227
30402
|
zoneCompound = `${areaId}:${zone}`;
|
30228
30403
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
30229
30404
|
}
|
30230
|
-
return /* @__PURE__ */ (0,
|
30405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: content.map((item) => {
|
30231
30406
|
const Component = config.components[item.type];
|
30232
30407
|
if (Component) {
|
30233
|
-
return /* @__PURE__ */ (0,
|
30408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30234
30409
|
DropZoneProvider,
|
30235
30410
|
{
|
30236
30411
|
value: { data, config, areaId: item.props.id },
|
30237
|
-
children: /* @__PURE__ */ (0,
|
30412
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30238
30413
|
Component.render,
|
30239
30414
|
__spreadProps(__spreadValues({}, item.props), {
|
30240
30415
|
puck: { renderDropZone: DropZone }
|
@@ -30250,9 +30425,9 @@ function DropZoneRender({ zone }) {
|
|
30250
30425
|
function DropZone(props) {
|
30251
30426
|
const ctx = (0, import_react9.useContext)(dropZoneContext);
|
30252
30427
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
30253
|
-
return /* @__PURE__ */ (0,
|
30428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneEdit, __spreadValues({}, props));
|
30254
30429
|
}
|
30255
|
-
return /* @__PURE__ */ (0,
|
30430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneRender, __spreadValues({}, props));
|
30256
30431
|
}
|
30257
30432
|
|
30258
30433
|
// components/IconButton/index.ts
|
@@ -30264,11 +30439,11 @@ var import_react10 = require("react");
|
|
30264
30439
|
|
30265
30440
|
// css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
|
30266
30441
|
init_react_import();
|
30267
|
-
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" };
|
30268
30443
|
|
30269
30444
|
// components/IconButton/IconButton.tsx
|
30270
30445
|
var import_react_spinners3 = require("react-spinners");
|
30271
|
-
var
|
30446
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
30272
30447
|
var getClassName6 = get_class_name_factory_default("IconButton", IconButton_module_default);
|
30273
30448
|
var IconButton = ({
|
30274
30449
|
children,
|
@@ -30284,7 +30459,7 @@ var IconButton = ({
|
|
30284
30459
|
}) => {
|
30285
30460
|
const [loading, setLoading] = (0, import_react10.useState)(false);
|
30286
30461
|
const ElementType = href ? "a" : "button";
|
30287
|
-
const el = /* @__PURE__ */ (0,
|
30462
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
30288
30463
|
ElementType,
|
30289
30464
|
{
|
30290
30465
|
className: getClassName6({
|
@@ -30309,11 +30484,11 @@ var IconButton = ({
|
|
30309
30484
|
href,
|
30310
30485
|
title,
|
30311
30486
|
children: [
|
30312
|
-
/* @__PURE__ */ (0,
|
30487
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: getClassName6("title"), children: title }),
|
30313
30488
|
children,
|
30314
|
-
loading && /* @__PURE__ */ (0,
|
30489
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
30315
30490
|
"\xA0\xA0",
|
30316
|
-
/* @__PURE__ */ (0,
|
30491
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
|
30317
30492
|
] })
|
30318
30493
|
]
|
30319
30494
|
}
|
@@ -30323,26 +30498,38 @@ var IconButton = ({
|
|
30323
30498
|
|
30324
30499
|
// components/Puck/index.tsx
|
30325
30500
|
init_react_import();
|
30326
|
-
var
|
30327
|
-
var import_dnd7 = require("@hello-pangea/dnd");
|
30501
|
+
var import_react28 = require("react");
|
30328
30502
|
|
30329
30503
|
// lib/use-placeholder-style.ts
|
30330
30504
|
init_react_import();
|
30331
30505
|
var import_react11 = require("react");
|
30332
|
-
|
30333
|
-
|
30334
|
-
|
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";
|
30520
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react11.useState)();
|
30335
30521
|
const onDragStartOrUpdate = (draggedItem) => {
|
30336
30522
|
var _a;
|
30337
30523
|
const draggableId = draggedItem.draggableId;
|
30338
30524
|
const destinationIndex = (draggedItem.destination || draggedItem.source).index;
|
30339
30525
|
const droppableId = (draggedItem.destination || draggedItem.source).droppableId;
|
30340
30526
|
const domQuery = `[${queryAttr}='${draggableId}']`;
|
30341
|
-
const
|
30527
|
+
const frame = getFrame();
|
30528
|
+
const draggedDOM = document.querySelector(domQuery) || (frame == null ? void 0 : frame.querySelector(domQuery));
|
30342
30529
|
if (!draggedDOM) {
|
30343
30530
|
return;
|
30344
30531
|
}
|
30345
|
-
const targetListElement =
|
30532
|
+
const targetListElement = frame == null ? void 0 : frame.querySelector(
|
30346
30533
|
`[data-rfd-droppable-id='${droppableId}']`
|
30347
30534
|
);
|
30348
30535
|
const { clientHeight } = draggedDOM;
|
@@ -30389,11 +30576,11 @@ init_react_import();
|
|
30389
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" };
|
30390
30577
|
|
30391
30578
|
// components/Heading/index.tsx
|
30392
|
-
var
|
30579
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
30393
30580
|
var getClassName7 = get_class_name_factory_default("Heading", styles_module_default6);
|
30394
30581
|
var Heading = ({ children, rank, size = "m" }) => {
|
30395
30582
|
const Tag = rank ? `h${rank}` : "span";
|
30396
|
-
return /* @__PURE__ */ (0,
|
30583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
30397
30584
|
Tag,
|
30398
30585
|
{
|
30399
30586
|
className: getClassName7({
|
@@ -30472,7 +30659,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
30472
30659
|
|
30473
30660
|
// components/SidebarSection/index.tsx
|
30474
30661
|
var import_react_spinners4 = require("react-spinners");
|
30475
|
-
var
|
30662
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
30476
30663
|
var getClassName8 = get_class_name_factory_default("SidebarSection", styles_module_default5);
|
30477
30664
|
var SidebarSection = ({
|
30478
30665
|
children,
|
@@ -30485,15 +30672,15 @@ var SidebarSection = ({
|
|
30485
30672
|
}) => {
|
30486
30673
|
const { setUi } = useAppContext();
|
30487
30674
|
const breadcrumbs = useBreadcrumbs(1);
|
30488
|
-
return /* @__PURE__ */ (0,
|
30675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
30489
30676
|
"div",
|
30490
30677
|
{
|
30491
30678
|
className: getClassName8({ noBorderTop, noPadding }),
|
30492
30679
|
style: { background },
|
30493
30680
|
children: [
|
30494
|
-
/* @__PURE__ */ (0,
|
30495
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
30496
|
-
/* @__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)(
|
30497
30684
|
"button",
|
30498
30685
|
{
|
30499
30686
|
className: getClassName8("breadcrumbLabel"),
|
@@ -30501,12 +30688,12 @@ var SidebarSection = ({
|
|
30501
30688
|
children: breadcrumb.label
|
30502
30689
|
}
|
30503
30690
|
),
|
30504
|
-
/* @__PURE__ */ (0,
|
30691
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronRight, { size: 16 })
|
30505
30692
|
] }, i)) : null,
|
30506
|
-
/* @__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 }) })
|
30507
30694
|
] }) }),
|
30508
|
-
/* @__PURE__ */ (0,
|
30509
|
-
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" }) })
|
30510
30697
|
]
|
30511
30698
|
}
|
30512
30699
|
);
|
@@ -31088,7 +31275,7 @@ init_react_import();
|
|
31088
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" };
|
31089
31276
|
|
31090
31277
|
// components/MenuBar/index.tsx
|
31091
|
-
var
|
31278
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
31092
31279
|
var getClassName9 = get_class_name_factory_default("MenuBar", styles_module_default7);
|
31093
31280
|
var MenuBar = ({
|
31094
31281
|
appState,
|
@@ -31103,7 +31290,7 @@ var MenuBar = ({
|
|
31103
31290
|
history: { back, forward, historyStore }
|
31104
31291
|
} = useAppContext();
|
31105
31292
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
31106
|
-
return /* @__PURE__ */ (0,
|
31293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31107
31294
|
"div",
|
31108
31295
|
{
|
31109
31296
|
className: getClassName9({ menuOpen }),
|
@@ -31117,16 +31304,16 @@ var MenuBar = ({
|
|
31117
31304
|
setMenuOpen(false);
|
31118
31305
|
}
|
31119
31306
|
},
|
31120
|
-
children: /* @__PURE__ */ (0,
|
31121
|
-
/* @__PURE__ */ (0,
|
31122
|
-
/* @__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)(
|
31123
31310
|
ChevronLeft,
|
31124
31311
|
{
|
31125
31312
|
size: 21,
|
31126
31313
|
stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
|
31127
31314
|
}
|
31128
31315
|
) }),
|
31129
|
-
/* @__PURE__ */ (0,
|
31316
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31130
31317
|
ChevronRight,
|
31131
31318
|
{
|
31132
31319
|
size: 21,
|
@@ -31134,17 +31321,17 @@ var MenuBar = ({
|
|
31134
31321
|
}
|
31135
31322
|
) })
|
31136
31323
|
] }),
|
31137
|
-
/* @__PURE__ */ (0,
|
31324
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
31138
31325
|
state: appState,
|
31139
31326
|
dispatch
|
31140
31327
|
}) }),
|
31141
|
-
/* @__PURE__ */ (0,
|
31328
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31142
31329
|
Button,
|
31143
31330
|
{
|
31144
31331
|
onClick: () => {
|
31145
31332
|
onPublish && onPublish(data);
|
31146
31333
|
},
|
31147
|
-
icon: /* @__PURE__ */ (0,
|
31334
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Globe, { size: "14px" }),
|
31148
31335
|
children: "Publish"
|
31149
31336
|
}
|
31150
31337
|
) })
|
@@ -31155,7 +31342,7 @@ var MenuBar = ({
|
|
31155
31342
|
|
31156
31343
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
31157
31344
|
init_react_import();
|
31158
|
-
var styles_module_default8 = { "Puck": "
|
31345
|
+
var styles_module_default8 = { "Puck": "_Puck_u70b9_19", "Puck--mounted": "_Puck--mounted_u70b9_36", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_u70b9_40", "Puck--rightSideBarVisible": "_Puck--rightSideBarVisible_u70b9_46", "Puck-mounted": "_Puck-mounted_u70b9_59", "Puck-header": "_Puck-header_u70b9_100", "Puck-headerInner": "_Puck-headerInner_u70b9_109", "Puck-headerToggle": "_Puck-headerToggle_u70b9_119", "Puck-rightSideBarToggle": "_Puck-rightSideBarToggle_u70b9_126", "Puck-leftSideBarToggle": "_Puck-leftSideBarToggle_u70b9_127", "Puck-headerTitle": "_Puck-headerTitle_u70b9_131", "Puck-headerPath": "_Puck-headerPath_u70b9_135", "Puck-headerTools": "_Puck-headerTools_u70b9_142", "Puck-menuButton": "_Puck-menuButton_u70b9_148", "Puck--menuOpen": "_Puck--menuOpen_u70b9_153", "Puck-leftSideBar": "_Puck-leftSideBar_u70b9_127", "Puck-rightSideBar": "_Puck-rightSideBar_u70b9_126", "Puck-portal": "_Puck-portal_u70b9_181" };
|
31159
31346
|
|
31160
31347
|
// components/Puck/components/Fields/index.tsx
|
31161
31348
|
init_react_import();
|
@@ -31179,13 +31366,24 @@ init_react_import();
|
|
31179
31366
|
|
31180
31367
|
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ArrayField/styles.module.css#css-module
|
31181
31368
|
init_react_import();
|
31182
|
-
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" };
|
31183
31370
|
|
31184
31371
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
31185
|
-
var import_dnd5 = require("@hello-pangea/dnd");
|
31186
|
-
var import_dnd6 = require("@hello-pangea/dnd");
|
31187
31372
|
var import_react14 = require("react");
|
31188
|
-
|
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");
|
31189
31387
|
var getClassName10 = get_class_name_factory_default("ArrayField", styles_module_default10);
|
31190
31388
|
var getClassNameItem2 = get_class_name_factory_default("ArrayFieldItem", styles_module_default10);
|
31191
31389
|
var ArrayField = ({
|
@@ -31249,21 +31447,24 @@ var ArrayField = ({
|
|
31249
31447
|
[arrayState]
|
31250
31448
|
);
|
31251
31449
|
(0, import_react14.useEffect)(() => {
|
31252
|
-
|
31450
|
+
if (arrayState.items.length > 0) {
|
31451
|
+
setUi(mapArrayStateToUi(arrayState));
|
31452
|
+
}
|
31253
31453
|
}, []);
|
31254
31454
|
const [hovering, setHovering] = (0, import_react14.useState)(false);
|
31255
31455
|
if (field.type !== "array" || !field.arrayFields) {
|
31256
31456
|
return null;
|
31257
31457
|
}
|
31258
|
-
|
31458
|
+
const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
|
31459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31259
31460
|
FieldLabelInternal,
|
31260
31461
|
{
|
31261
31462
|
label: label || name,
|
31262
|
-
icon: /* @__PURE__ */ (0,
|
31463
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(List, { size: 16 }),
|
31263
31464
|
el: "div",
|
31264
31465
|
readOnly,
|
31265
|
-
children: /* @__PURE__ */ (0,
|
31266
|
-
|
31466
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31467
|
+
DragDropContext,
|
31267
31468
|
{
|
31268
31469
|
onDragEnd: (event) => {
|
31269
31470
|
var _a, _b;
|
@@ -31289,14 +31490,15 @@ var ArrayField = ({
|
|
31289
31490
|
});
|
31290
31491
|
}
|
31291
31492
|
},
|
31292
|
-
children: /* @__PURE__ */ (0,
|
31293
|
-
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)(
|
31294
31495
|
"div",
|
31295
31496
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
31296
31497
|
ref: provided.innerRef,
|
31297
31498
|
className: getClassName10({
|
31298
31499
|
isDraggingFrom: !!snapshot.draggingFromThisWith,
|
31299
|
-
hasItems: Array.isArray(value) && value.length > 0
|
31500
|
+
hasItems: Array.isArray(value) && value.length > 0,
|
31501
|
+
addDisabled
|
31300
31502
|
}),
|
31301
31503
|
onMouseOver: (e) => {
|
31302
31504
|
e.stopPropagation();
|
@@ -31310,7 +31512,7 @@ var ArrayField = ({
|
|
31310
31512
|
localState.arrayState.items.map((item, i) => {
|
31311
31513
|
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
31312
31514
|
const data = Array.from(localState.value || [])[i] || {};
|
31313
|
-
return /* @__PURE__ */ (0,
|
31515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31314
31516
|
Draggable,
|
31315
31517
|
{
|
31316
31518
|
id: _arrayId,
|
@@ -31321,8 +31523,8 @@ var ArrayField = ({
|
|
31321
31523
|
readOnly
|
31322
31524
|
}),
|
31323
31525
|
isDragDisabled: readOnly || !hovering,
|
31324
|
-
children: () => /* @__PURE__ */ (0,
|
31325
|
-
/* @__PURE__ */ (0,
|
31526
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
31527
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
31326
31528
|
"div",
|
31327
31529
|
{
|
31328
31530
|
onClick: () => {
|
@@ -31343,10 +31545,11 @@ var ArrayField = ({
|
|
31343
31545
|
className: getClassNameItem2("summary"),
|
31344
31546
|
children: [
|
31345
31547
|
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
31346
|
-
/* @__PURE__ */ (0,
|
31347
|
-
!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)(
|
31348
31550
|
IconButton,
|
31349
31551
|
{
|
31552
|
+
type: "button",
|
31350
31553
|
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
31351
31554
|
onClick: (e) => {
|
31352
31555
|
e.stopPropagation();
|
@@ -31366,20 +31569,20 @@ var ArrayField = ({
|
|
31366
31569
|
);
|
31367
31570
|
},
|
31368
31571
|
title: "Delete",
|
31369
|
-
children: /* @__PURE__ */ (0,
|
31572
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Trash, { size: 16 })
|
31370
31573
|
}
|
31371
31574
|
) }) }),
|
31372
|
-
/* @__PURE__ */ (0,
|
31575
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DragIcon, {}) })
|
31373
31576
|
] })
|
31374
31577
|
]
|
31375
31578
|
}
|
31376
31579
|
),
|
31377
|
-
/* @__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(
|
31378
31581
|
(fieldName) => {
|
31379
31582
|
const subField = field.arrayFields[fieldName];
|
31380
31583
|
const subFieldName = `${name}[${i}].${fieldName}`;
|
31381
31584
|
const wildcardFieldName = `${name}[*].${fieldName}`;
|
31382
|
-
return /* @__PURE__ */ (0,
|
31585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31383
31586
|
InputOrGroup,
|
31384
31587
|
{
|
31385
31588
|
name: subFieldName,
|
@@ -31408,11 +31611,11 @@ var ArrayField = ({
|
|
31408
31611
|
);
|
31409
31612
|
}),
|
31410
31613
|
provided.placeholder,
|
31411
|
-
/* @__PURE__ */ (0,
|
31614
|
+
!addDisabled && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31412
31615
|
"button",
|
31413
31616
|
{
|
31617
|
+
type: "button",
|
31414
31618
|
className: getClassName10("addButton"),
|
31415
|
-
disabled: field.max !== void 0 && localState.arrayState.items.length >= field.max,
|
31416
31619
|
onClick: () => {
|
31417
31620
|
const existingValue = value || [];
|
31418
31621
|
const newValue = [
|
@@ -31422,7 +31625,7 @@ var ArrayField = ({
|
|
31422
31625
|
const newArrayState = regenerateArrayState(newValue);
|
31423
31626
|
onChange(newValue, mapArrayStateToUi(newArrayState));
|
31424
31627
|
},
|
31425
|
-
children: /* @__PURE__ */ (0,
|
31628
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Plus, { size: 21 })
|
31426
31629
|
}
|
31427
31630
|
)
|
31428
31631
|
]
|
@@ -31437,7 +31640,7 @@ var ArrayField = ({
|
|
31437
31640
|
|
31438
31641
|
// components/InputOrGroup/fields/DefaultField/index.tsx
|
31439
31642
|
init_react_import();
|
31440
|
-
var
|
31643
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
31441
31644
|
var getClassName11 = get_class_name_factory_default("Input", styles_module_default9);
|
31442
31645
|
var DefaultField = ({
|
31443
31646
|
field,
|
@@ -31448,16 +31651,16 @@ var DefaultField = ({
|
|
31448
31651
|
label,
|
31449
31652
|
id
|
31450
31653
|
}) => {
|
31451
|
-
return /* @__PURE__ */ (0,
|
31654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
31452
31655
|
FieldLabelInternal,
|
31453
31656
|
{
|
31454
31657
|
label: label || name,
|
31455
|
-
icon: /* @__PURE__ */ (0,
|
31456
|
-
field.type === "text" && /* @__PURE__ */ (0,
|
31457
|
-
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 })
|
31458
31661
|
] }),
|
31459
31662
|
readOnly,
|
31460
|
-
children: /* @__PURE__ */ (0,
|
31663
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
31461
31664
|
"input",
|
31462
31665
|
{
|
31463
31666
|
className: getClassName11("input"),
|
@@ -31493,7 +31696,7 @@ var import_react16 = require("react");
|
|
31493
31696
|
|
31494
31697
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
31495
31698
|
init_react_import();
|
31496
|
-
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" };
|
31497
31700
|
|
31498
31701
|
// components/Modal/index.tsx
|
31499
31702
|
init_react_import();
|
@@ -31501,11 +31704,11 @@ var import_react15 = require("react");
|
|
31501
31704
|
|
31502
31705
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
31503
31706
|
init_react_import();
|
31504
|
-
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" };
|
31505
31708
|
|
31506
31709
|
// components/Modal/index.tsx
|
31507
31710
|
var import_react_dom = __toESM(require_react_dom());
|
31508
|
-
var
|
31711
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
31509
31712
|
var getClassName12 = get_class_name_factory_default("Modal", styles_module_default12);
|
31510
31713
|
var Modal = ({
|
31511
31714
|
children,
|
@@ -31517,10 +31720,10 @@ var Modal = ({
|
|
31517
31720
|
setRootEl(document.getElementById("puck-portal-root"));
|
31518
31721
|
}, []);
|
31519
31722
|
if (!rootEl) {
|
31520
|
-
return /* @__PURE__ */ (0,
|
31723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", {});
|
31521
31724
|
}
|
31522
31725
|
return (0, import_react_dom.createPortal)(
|
31523
|
-
/* @__PURE__ */ (0,
|
31726
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
31524
31727
|
"div",
|
31525
31728
|
{
|
31526
31729
|
className: getClassName12("inner"),
|
@@ -31534,7 +31737,7 @@ var Modal = ({
|
|
31534
31737
|
|
31535
31738
|
// components/ExternalInput/index.tsx
|
31536
31739
|
var import_react_spinners5 = require("react-spinners");
|
31537
|
-
var
|
31740
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
31538
31741
|
var getClassName13 = get_class_name_factory_default("ExternalInput", styles_module_default11);
|
31539
31742
|
var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default11);
|
31540
31743
|
var dataCache = {};
|
@@ -31574,7 +31777,7 @@ var ExternalInput = ({
|
|
31574
31777
|
const search = (0, import_react16.useCallback)(
|
31575
31778
|
(query, filters2) => __async(void 0, null, function* () {
|
31576
31779
|
setIsLoading(true);
|
31577
|
-
const cacheKey = `${id}-${
|
31780
|
+
const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
|
31578
31781
|
const listData = dataCache[cacheKey] || (yield field.fetchList({ query, filters: filters2 }));
|
31579
31782
|
if (listData) {
|
31580
31783
|
setData(listData);
|
@@ -31587,7 +31790,7 @@ var ExternalInput = ({
|
|
31587
31790
|
(0, import_react16.useEffect)(() => {
|
31588
31791
|
search(searchQuery, filters);
|
31589
31792
|
}, []);
|
31590
|
-
return /* @__PURE__ */ (0,
|
31793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
31591
31794
|
"div",
|
31592
31795
|
{
|
31593
31796
|
className: getClassName13({
|
@@ -31596,30 +31799,31 @@ var ExternalInput = ({
|
|
31596
31799
|
}),
|
31597
31800
|
id,
|
31598
31801
|
children: [
|
31599
|
-
/* @__PURE__ */ (0,
|
31600
|
-
/* @__PURE__ */ (0,
|
31802
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName13("actions"), children: [
|
31803
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31601
31804
|
"button",
|
31602
31805
|
{
|
31806
|
+
type: "button",
|
31603
31807
|
onClick: () => setOpen(true),
|
31604
31808
|
className: getClassName13("button"),
|
31605
|
-
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0,
|
31606
|
-
/* @__PURE__ */ (0,
|
31607
|
-
/* @__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 })
|
31608
31812
|
] })
|
31609
31813
|
}
|
31610
31814
|
),
|
31611
|
-
value && /* @__PURE__ */ (0,
|
31815
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31612
31816
|
"button",
|
31613
31817
|
{
|
31614
31818
|
className: getClassName13("detachButton"),
|
31615
31819
|
onClick: () => {
|
31616
31820
|
onChange(null);
|
31617
31821
|
},
|
31618
|
-
children: /* @__PURE__ */ (0,
|
31822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Unlock, { size: 16 })
|
31619
31823
|
}
|
31620
31824
|
)
|
31621
31825
|
] }),
|
31622
|
-
/* @__PURE__ */ (0,
|
31826
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
31623
31827
|
"form",
|
31624
31828
|
{
|
31625
31829
|
className: getClassNameModal({
|
@@ -31633,11 +31837,11 @@ var ExternalInput = ({
|
|
31633
31837
|
search(searchQuery, filters);
|
31634
31838
|
},
|
31635
31839
|
children: [
|
31636
|
-
/* @__PURE__ */ (0,
|
31637
|
-
/* @__PURE__ */ (0,
|
31638
|
-
/* @__PURE__ */ (0,
|
31639
|
-
/* @__PURE__ */ (0,
|
31640
|
-
/* @__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)(
|
31641
31845
|
"input",
|
31642
31846
|
{
|
31643
31847
|
className: getClassNameModal("searchInput"),
|
@@ -31652,9 +31856,9 @@ var ExternalInput = ({
|
|
31652
31856
|
}
|
31653
31857
|
)
|
31654
31858
|
] }),
|
31655
|
-
/* @__PURE__ */ (0,
|
31656
|
-
/* @__PURE__ */ (0,
|
31657
|
-
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)(
|
31658
31862
|
IconButton,
|
31659
31863
|
{
|
31660
31864
|
title: "Toggle filters",
|
@@ -31663,15 +31867,15 @@ var ExternalInput = ({
|
|
31663
31867
|
e.stopPropagation();
|
31664
31868
|
setFiltersToggled(!filtersToggled);
|
31665
31869
|
},
|
31666
|
-
children: /* @__PURE__ */ (0,
|
31870
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SlidersHorizontal, { size: 20 })
|
31667
31871
|
}
|
31668
31872
|
) })
|
31669
31873
|
] })
|
31670
|
-
] }) : /* @__PURE__ */ (0,
|
31671
|
-
/* @__PURE__ */ (0,
|
31672
|
-
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) => {
|
31673
31877
|
const filterField = filterFields[fieldName];
|
31674
|
-
return /* @__PURE__ */ (0,
|
31878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31675
31879
|
InputOrGroup,
|
31676
31880
|
{
|
31677
31881
|
field: filterField,
|
@@ -31688,9 +31892,9 @@ var ExternalInput = ({
|
|
31688
31892
|
fieldName
|
31689
31893
|
);
|
31690
31894
|
}) }),
|
31691
|
-
/* @__PURE__ */ (0,
|
31692
|
-
/* @__PURE__ */ (0,
|
31693
|
-
/* @__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)(
|
31694
31898
|
"th",
|
31695
31899
|
{
|
31696
31900
|
className: getClassNameModal("th"),
|
@@ -31699,8 +31903,8 @@ var ExternalInput = ({
|
|
31699
31903
|
},
|
31700
31904
|
key
|
31701
31905
|
)) }) }),
|
31702
|
-
/* @__PURE__ */ (0,
|
31703
|
-
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)(
|
31704
31908
|
"tr",
|
31705
31909
|
{
|
31706
31910
|
style: { whiteSpace: "nowrap" },
|
@@ -31709,16 +31913,16 @@ var ExternalInput = ({
|
|
31709
31913
|
onChange(mapProp(data[i]));
|
31710
31914
|
setOpen(false);
|
31711
31915
|
},
|
31712
|
-
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))
|
31713
31917
|
},
|
31714
31918
|
i
|
31715
31919
|
);
|
31716
31920
|
}) })
|
31717
31921
|
] }),
|
31718
|
-
/* @__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" }) })
|
31719
31923
|
] })
|
31720
31924
|
] }),
|
31721
|
-
/* @__PURE__ */ (0,
|
31925
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("footer"), children: [
|
31722
31926
|
mappedData.length,
|
31723
31927
|
" result",
|
31724
31928
|
mappedData.length === 1 ? "" : "s"
|
@@ -31732,7 +31936,7 @@ var ExternalInput = ({
|
|
31732
31936
|
};
|
31733
31937
|
|
31734
31938
|
// components/InputOrGroup/fields/ExternalField/index.tsx
|
31735
|
-
var
|
31939
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
31736
31940
|
var ExternalField = ({
|
31737
31941
|
field,
|
31738
31942
|
onChange,
|
@@ -31754,13 +31958,13 @@ var ExternalField = ({
|
|
31754
31958
|
if (field.type !== "external") {
|
31755
31959
|
return null;
|
31756
31960
|
}
|
31757
|
-
return /* @__PURE__ */ (0,
|
31961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
31758
31962
|
FieldLabelInternal,
|
31759
31963
|
{
|
31760
31964
|
label: label || name,
|
31761
|
-
icon: /* @__PURE__ */ (0,
|
31965
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Link, { size: 16 }),
|
31762
31966
|
el: "div",
|
31763
|
-
children: /* @__PURE__ */ (0,
|
31967
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
31764
31968
|
ExternalInput,
|
31765
31969
|
{
|
31766
31970
|
name,
|
@@ -31786,7 +31990,7 @@ var ExternalField = ({
|
|
31786
31990
|
|
31787
31991
|
// components/InputOrGroup/fields/RadioField/index.tsx
|
31788
31992
|
init_react_import();
|
31789
|
-
var
|
31993
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
31790
31994
|
var getClassName14 = get_class_name_factory_default("Input", styles_module_default9);
|
31791
31995
|
var RadioField = ({
|
31792
31996
|
field,
|
@@ -31800,19 +32004,19 @@ var RadioField = ({
|
|
31800
32004
|
if (field.type !== "radio" || !field.options) {
|
31801
32005
|
return null;
|
31802
32006
|
}
|
31803
|
-
return /* @__PURE__ */ (0,
|
32007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
31804
32008
|
FieldLabelInternal,
|
31805
32009
|
{
|
31806
|
-
icon: /* @__PURE__ */ (0,
|
32010
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CheckCircle, { size: 16 }),
|
31807
32011
|
label: label || name,
|
31808
32012
|
readOnly,
|
31809
32013
|
el: "div",
|
31810
|
-
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)(
|
31811
32015
|
"label",
|
31812
32016
|
{
|
31813
32017
|
className: getClassName14("radio"),
|
31814
32018
|
children: [
|
31815
|
-
/* @__PURE__ */ (0,
|
32019
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
31816
32020
|
"input",
|
31817
32021
|
{
|
31818
32022
|
type: "radio",
|
@@ -31830,7 +32034,7 @@ var RadioField = ({
|
|
31830
32034
|
defaultChecked: value === option.value
|
31831
32035
|
}
|
31832
32036
|
),
|
31833
|
-
/* @__PURE__ */ (0,
|
32037
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
|
31834
32038
|
]
|
31835
32039
|
},
|
31836
32040
|
option.label + option.value
|
@@ -31841,7 +32045,7 @@ var RadioField = ({
|
|
31841
32045
|
|
31842
32046
|
// components/InputOrGroup/fields/SelectField/index.tsx
|
31843
32047
|
init_react_import();
|
31844
|
-
var
|
32048
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
31845
32049
|
var getClassName15 = get_class_name_factory_default("Input", styles_module_default9);
|
31846
32050
|
var SelectField = ({
|
31847
32051
|
field,
|
@@ -31855,13 +32059,13 @@ var SelectField = ({
|
|
31855
32059
|
if (field.type !== "select" || !field.options) {
|
31856
32060
|
return null;
|
31857
32061
|
}
|
31858
|
-
return /* @__PURE__ */ (0,
|
32062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
31859
32063
|
FieldLabelInternal,
|
31860
32064
|
{
|
31861
32065
|
label: label || name,
|
31862
|
-
icon: /* @__PURE__ */ (0,
|
32066
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChevronDown, { size: 16 }),
|
31863
32067
|
readOnly,
|
31864
|
-
children: /* @__PURE__ */ (0,
|
32068
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
31865
32069
|
"select",
|
31866
32070
|
{
|
31867
32071
|
id,
|
@@ -31875,7 +32079,7 @@ var SelectField = ({
|
|
31875
32079
|
onChange(e.currentTarget.value);
|
31876
32080
|
},
|
31877
32081
|
value,
|
31878
|
-
children: field.options.map((option) => /* @__PURE__ */ (0,
|
32082
|
+
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
31879
32083
|
"option",
|
31880
32084
|
{
|
31881
32085
|
label: option.label,
|
@@ -31891,7 +32095,7 @@ var SelectField = ({
|
|
31891
32095
|
|
31892
32096
|
// components/InputOrGroup/fields/TextareaField/index.tsx
|
31893
32097
|
init_react_import();
|
31894
|
-
var
|
32098
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
31895
32099
|
var getClassName16 = get_class_name_factory_default("Input", styles_module_default9);
|
31896
32100
|
var TextareaField = ({
|
31897
32101
|
onChange,
|
@@ -31901,13 +32105,13 @@ var TextareaField = ({
|
|
31901
32105
|
label,
|
31902
32106
|
id
|
31903
32107
|
}) => {
|
31904
|
-
return /* @__PURE__ */ (0,
|
32108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
31905
32109
|
FieldLabelInternal,
|
31906
32110
|
{
|
31907
32111
|
label: label || name,
|
31908
|
-
icon: /* @__PURE__ */ (0,
|
32112
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Type, { size: 16 }),
|
31909
32113
|
readOnly,
|
31910
|
-
children: /* @__PURE__ */ (0,
|
32114
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
31911
32115
|
"textarea",
|
31912
32116
|
{
|
31913
32117
|
id,
|
@@ -31936,7 +32140,7 @@ init_react_import();
|
|
31936
32140
|
var styles_module_default13 = { "ObjectField": "_ObjectField_15j63_5", "ObjectField-fieldset": "_ObjectField-fieldset_15j63_13" };
|
31937
32141
|
|
31938
32142
|
// components/InputOrGroup/fields/ObjectField/index.tsx
|
31939
|
-
var
|
32143
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
31940
32144
|
var getClassName17 = get_class_name_factory_default("ObjectField", styles_module_default13);
|
31941
32145
|
var getClassNameItem3 = get_class_name_factory_default("ObjectFieldItem", styles_module_default13);
|
31942
32146
|
var ObjectField = ({
|
@@ -31953,18 +32157,18 @@ var ObjectField = ({
|
|
31953
32157
|
return null;
|
31954
32158
|
}
|
31955
32159
|
const data = value || {};
|
31956
|
-
return /* @__PURE__ */ (0,
|
32160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
31957
32161
|
FieldLabelInternal,
|
31958
32162
|
{
|
31959
32163
|
label: label || name,
|
31960
|
-
icon: /* @__PURE__ */ (0,
|
32164
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MoreVertical, { size: 16 }),
|
31961
32165
|
el: "div",
|
31962
32166
|
readOnly,
|
31963
|
-
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) => {
|
31964
32168
|
const subField = field.objectFields[fieldName];
|
31965
32169
|
const subFieldName = `${name}.${fieldName}`;
|
31966
32170
|
const wildcardFieldName = `${name}.${fieldName}`;
|
31967
|
-
return /* @__PURE__ */ (0,
|
32171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
31968
32172
|
InputOrGroup,
|
31969
32173
|
{
|
31970
32174
|
name: subFieldName,
|
@@ -31991,7 +32195,7 @@ var ObjectField = ({
|
|
31991
32195
|
};
|
31992
32196
|
|
31993
32197
|
// components/InputOrGroup/index.tsx
|
31994
|
-
var
|
32198
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
31995
32199
|
var getClassName18 = get_class_name_factory_default("Input", styles_module_default9);
|
31996
32200
|
var FieldLabel = ({
|
31997
32201
|
children,
|
@@ -32002,11 +32206,11 @@ var FieldLabel = ({
|
|
32002
32206
|
className
|
32003
32207
|
}) => {
|
32004
32208
|
const El = el;
|
32005
|
-
return /* @__PURE__ */ (0,
|
32006
|
-
/* @__PURE__ */ (0,
|
32007
|
-
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, {}),
|
32008
32212
|
label,
|
32009
|
-
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" }) })
|
32010
32214
|
] }),
|
32011
32215
|
children
|
32012
32216
|
] });
|
@@ -32023,7 +32227,7 @@ var FieldLabelInternal = ({
|
|
32023
32227
|
() => overrides.fieldLabel || FieldLabel,
|
32024
32228
|
[overrides]
|
32025
32229
|
);
|
32026
|
-
return /* @__PURE__ */ (0,
|
32230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
32027
32231
|
Wrapper,
|
32028
32232
|
{
|
32029
32233
|
label,
|
@@ -32063,7 +32267,7 @@ var InputOrGroup = (_a) => {
|
|
32063
32267
|
if (!field.render) {
|
32064
32268
|
return null;
|
32065
32269
|
}
|
32066
|
-
return /* @__PURE__ */ (0,
|
32270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
|
32067
32271
|
field,
|
32068
32272
|
name,
|
32069
32273
|
readOnly
|
@@ -32092,7 +32296,7 @@ var InputOrGroup = (_a) => {
|
|
32092
32296
|
const mergedProps = __spreadProps(__spreadValues(__spreadValues({}, props), localProps), { field });
|
32093
32297
|
const children = defaultFields[field.type](mergedProps);
|
32094
32298
|
const Render2 = render[field.type];
|
32095
|
-
return /* @__PURE__ */ (0,
|
32299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
|
32096
32300
|
};
|
32097
32301
|
|
32098
32302
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
|
@@ -32101,7 +32305,7 @@ var styles_module_default14 = { "PuckFields": "_PuckFields_17k3p_1", "PuckFields
|
|
32101
32305
|
|
32102
32306
|
// components/Puck/components/Fields/index.tsx
|
32103
32307
|
var import_react19 = require("react");
|
32104
|
-
var
|
32308
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
32105
32309
|
var getClassName19 = get_class_name_factory_default("PuckFields", styles_module_default14);
|
32106
32310
|
var defaultPageFields = {
|
32107
32311
|
title: { type: "text" }
|
@@ -32110,9 +32314,9 @@ var DefaultFields = ({
|
|
32110
32314
|
children,
|
32111
32315
|
isLoading
|
32112
32316
|
}) => {
|
32113
|
-
return /* @__PURE__ */ (0,
|
32317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19(), children: [
|
32114
32318
|
children,
|
32115
|
-
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" }) })
|
32116
32320
|
] });
|
32117
32321
|
};
|
32118
32322
|
var Fields = () => {
|
@@ -32133,14 +32337,14 @@ var Fields = () => {
|
|
32133
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;
|
32134
32338
|
const rootProps = data.root.props || data.root;
|
32135
32339
|
const Wrapper = (0, import_react19.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
32136
|
-
return /* @__PURE__ */ (0,
|
32340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
32137
32341
|
"form",
|
32138
32342
|
{
|
32139
32343
|
className: getClassName19(),
|
32140
32344
|
onSubmit: (e) => {
|
32141
32345
|
e.preventDefault();
|
32142
32346
|
},
|
32143
|
-
children: /* @__PURE__ */ (0,
|
32347
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
32144
32348
|
const field = fields[fieldName];
|
32145
32349
|
const onChange = (value, updatedUi) => {
|
32146
32350
|
var _a2, _b2;
|
@@ -32206,7 +32410,7 @@ var Fields = () => {
|
|
32206
32410
|
};
|
32207
32411
|
if (selectedItem && itemSelector) {
|
32208
32412
|
const { readOnly = {} } = selectedItem;
|
32209
|
-
return /* @__PURE__ */ (0,
|
32413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
32210
32414
|
InputOrGroup,
|
32211
32415
|
{
|
32212
32416
|
field,
|
@@ -32222,7 +32426,7 @@ var Fields = () => {
|
|
32222
32426
|
);
|
32223
32427
|
} else {
|
32224
32428
|
const { readOnly = {} } = data.root;
|
32225
|
-
return /* @__PURE__ */ (0,
|
32429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
32226
32430
|
InputOrGroup,
|
32227
32431
|
{
|
32228
32432
|
field,
|
@@ -32257,7 +32461,7 @@ init_react_import();
|
|
32257
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" };
|
32258
32462
|
|
32259
32463
|
// components/ComponentList/index.tsx
|
32260
|
-
var
|
32464
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
32261
32465
|
var getClassName20 = get_class_name_factory_default("ComponentList", styles_module_default15);
|
32262
32466
|
var ComponentListItem = ({
|
32263
32467
|
name,
|
@@ -32265,7 +32469,7 @@ var ComponentListItem = ({
|
|
32265
32469
|
index
|
32266
32470
|
}) => {
|
32267
32471
|
const { overrides } = useAppContext();
|
32268
|
-
return /* @__PURE__ */ (0,
|
32472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Drawer.Item, { label, name, index, children: overrides.componentItem });
|
32269
32473
|
};
|
32270
32474
|
var ComponentList = ({
|
32271
32475
|
children,
|
@@ -32274,8 +32478,8 @@ var ComponentList = ({
|
|
32274
32478
|
}) => {
|
32275
32479
|
const { config, state, setUi } = useAppContext();
|
32276
32480
|
const { expanded = true } = state.ui.componentList[id] || {};
|
32277
|
-
return /* @__PURE__ */ (0,
|
32278
|
-
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)(
|
32279
32483
|
"button",
|
32280
32484
|
{
|
32281
32485
|
className: getClassName20("title"),
|
@@ -32288,14 +32492,14 @@ var ComponentList = ({
|
|
32288
32492
|
}),
|
32289
32493
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
32290
32494
|
children: [
|
32291
|
-
/* @__PURE__ */ (0,
|
32292
|
-
/* @__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 }) })
|
32293
32497
|
]
|
32294
32498
|
}
|
32295
32499
|
),
|
32296
|
-
/* @__PURE__ */ (0,
|
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) => {
|
32297
32501
|
var _a;
|
32298
|
-
return /* @__PURE__ */ (0,
|
32502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
32299
32503
|
ComponentListItem,
|
32300
32504
|
{
|
32301
32505
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
@@ -32310,7 +32514,7 @@ var ComponentList = ({
|
|
32310
32514
|
ComponentList.Item = ComponentListItem;
|
32311
32515
|
|
32312
32516
|
// lib/use-component-list.tsx
|
32313
|
-
var
|
32517
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
32314
32518
|
var useComponentList = (config, ui) => {
|
32315
32519
|
const [componentList, setComponentList] = (0, import_react20.useState)();
|
32316
32520
|
(0, import_react20.useEffect)(() => {
|
@@ -32323,7 +32527,7 @@ var useComponentList = (config, ui) => {
|
|
32323
32527
|
if (category.visible === false || !category.components) {
|
32324
32528
|
return null;
|
32325
32529
|
}
|
32326
|
-
return /* @__PURE__ */ (0,
|
32530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32327
32531
|
ComponentList,
|
32328
32532
|
{
|
32329
32533
|
id: categoryKey,
|
@@ -32331,7 +32535,7 @@ var useComponentList = (config, ui) => {
|
|
32331
32535
|
children: category.components.map((componentName, i) => {
|
32332
32536
|
var _a2;
|
32333
32537
|
matchedComponents.push(componentName);
|
32334
|
-
return /* @__PURE__ */ (0,
|
32538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32335
32539
|
ComponentList.Item,
|
32336
32540
|
{
|
32337
32541
|
label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
|
@@ -32351,14 +32555,14 @@ var useComponentList = (config, ui) => {
|
|
32351
32555
|
);
|
32352
32556
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
32353
32557
|
_componentList.push(
|
32354
|
-
/* @__PURE__ */ (0,
|
32558
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32355
32559
|
ComponentList,
|
32356
32560
|
{
|
32357
32561
|
id: "other",
|
32358
32562
|
title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
|
32359
32563
|
children: remainingComponents.map((componentName, i) => {
|
32360
32564
|
var _a2;
|
32361
|
-
return /* @__PURE__ */ (0,
|
32565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32362
32566
|
ComponentList.Item,
|
32363
32567
|
{
|
32364
32568
|
name: componentName,
|
@@ -32381,38 +32585,63 @@ var useComponentList = (config, ui) => {
|
|
32381
32585
|
|
32382
32586
|
// components/Puck/components/Components/index.tsx
|
32383
32587
|
var import_react21 = require("react");
|
32384
|
-
var
|
32588
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
32385
32589
|
var Components = () => {
|
32386
32590
|
const { config, state, overrides } = useAppContext();
|
32387
32591
|
const componentList = useComponentList(config, state.ui);
|
32388
32592
|
const Wrapper = (0, import_react21.useMemo)(() => overrides.components || "div", [overrides]);
|
32389
|
-
return /* @__PURE__ */ (0,
|
32593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComponentList, { id: "all" }) });
|
32390
32594
|
};
|
32391
32595
|
|
32392
32596
|
// components/Puck/components/Preview/index.tsx
|
32393
32597
|
init_react_import();
|
32394
32598
|
var import_react22 = require("react");
|
32395
|
-
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);
|
32396
32608
|
var Preview = ({ id = "puck-preview" }) => {
|
32397
|
-
const { config, dispatch, state } = useAppContext();
|
32609
|
+
const { config, dispatch, state, setStatus, iframe } = useAppContext();
|
32398
32610
|
const Page = (0, import_react22.useCallback)(
|
32399
32611
|
(pageProps) => {
|
32400
32612
|
var _a, _b;
|
32401
|
-
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 });
|
32402
32619
|
},
|
32403
32620
|
[config.root]
|
32404
32621
|
);
|
32405
32622
|
const rootProps = state.data.root.props || state.data.root;
|
32406
|
-
const
|
32407
|
-
return /* @__PURE__ */ (0,
|
32623
|
+
const ref = (0, import_react22.useRef)(null);
|
32624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
32408
32625
|
"div",
|
32409
32626
|
{
|
32627
|
+
className: getClassName21(),
|
32410
32628
|
id,
|
32411
32629
|
onClick: () => {
|
32412
32630
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
32413
32631
|
},
|
32414
|
-
|
32415
|
-
|
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 }) })) })
|
32416
32645
|
}
|
32417
32646
|
);
|
32418
32647
|
};
|
@@ -32446,7 +32675,7 @@ init_react_import();
|
|
32446
32675
|
|
32447
32676
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
32448
32677
|
init_react_import();
|
32449
|
-
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" };
|
32450
32679
|
|
32451
32680
|
// lib/scroll-into-view.ts
|
32452
32681
|
init_react_import();
|
@@ -32474,9 +32703,9 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
32474
32703
|
};
|
32475
32704
|
|
32476
32705
|
// components/LayerTree/index.tsx
|
32477
|
-
var
|
32478
|
-
var
|
32479
|
-
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);
|
32480
32709
|
var LayerTree = ({
|
32481
32710
|
data,
|
32482
32711
|
config,
|
@@ -32488,14 +32717,14 @@ var LayerTree = ({
|
|
32488
32717
|
}) => {
|
32489
32718
|
const zones = data.zones || {};
|
32490
32719
|
const ctx = (0, import_react23.useContext)(dropZoneContext);
|
32491
|
-
return /* @__PURE__ */ (0,
|
32492
|
-
label && /* @__PURE__ */ (0,
|
32493
|
-
/* @__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" }) }),
|
32494
32723
|
" ",
|
32495
32724
|
label
|
32496
32725
|
] }),
|
32497
|
-
/* @__PURE__ */ (0,
|
32498
|
-
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" }),
|
32499
32728
|
zoneContent.map((item, i) => {
|
32500
32729
|
var _a;
|
32501
32730
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
@@ -32511,7 +32740,7 @@ var LayerTree = ({
|
|
32511
32740
|
const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
|
32512
32741
|
const isHovering = hoveringComponent === item.props.id;
|
32513
32742
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
32514
|
-
return /* @__PURE__ */ (0,
|
32743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
32515
32744
|
"li",
|
32516
32745
|
{
|
32517
32746
|
className: getClassNameLayer({
|
@@ -32521,7 +32750,7 @@ var LayerTree = ({
|
|
32521
32750
|
childIsSelected
|
32522
32751
|
}),
|
32523
32752
|
children: [
|
32524
|
-
/* @__PURE__ */ (0,
|
32753
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
32525
32754
|
"button",
|
32526
32755
|
{
|
32527
32756
|
className: getClassNameLayer("clickable"),
|
@@ -32535,8 +32764,9 @@ var LayerTree = ({
|
|
32535
32764
|
zone
|
32536
32765
|
});
|
32537
32766
|
const id = zoneContent[i].props.id;
|
32767
|
+
const frame = getFrame();
|
32538
32768
|
scrollIntoView(
|
32539
|
-
|
32769
|
+
frame == null ? void 0 : frame.querySelector(
|
32540
32770
|
`[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
|
32541
32771
|
)
|
32542
32772
|
);
|
@@ -32552,22 +32782,22 @@ var LayerTree = ({
|
|
32552
32782
|
setHoveringComponent(null);
|
32553
32783
|
},
|
32554
32784
|
children: [
|
32555
|
-
containsZone && /* @__PURE__ */ (0,
|
32785
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32556
32786
|
"div",
|
32557
32787
|
{
|
32558
32788
|
className: getClassNameLayer("chevron"),
|
32559
32789
|
title: isSelected ? "Collapse" : "Expand",
|
32560
|
-
children: /* @__PURE__ */ (0,
|
32790
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronDown, { size: "12" })
|
32561
32791
|
}
|
32562
32792
|
),
|
32563
|
-
/* @__PURE__ */ (0,
|
32564
|
-
/* @__PURE__ */ (0,
|
32565
|
-
/* @__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 })
|
32566
32796
|
] })
|
32567
32797
|
]
|
32568
32798
|
}
|
32569
32799
|
) }),
|
32570
|
-
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)(
|
32571
32801
|
LayerTree,
|
32572
32802
|
{
|
32573
32803
|
config,
|
@@ -32590,7 +32820,7 @@ var LayerTree = ({
|
|
32590
32820
|
|
32591
32821
|
// components/Puck/components/Outline/index.tsx
|
32592
32822
|
var import_react24 = require("react");
|
32593
|
-
var
|
32823
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
32594
32824
|
var Outline = () => {
|
32595
32825
|
const { dispatch, state, overrides, config } = useAppContext();
|
32596
32826
|
const { data, ui } = state;
|
@@ -32605,8 +32835,8 @@ var Outline = () => {
|
|
32605
32835
|
[]
|
32606
32836
|
);
|
32607
32837
|
const Wrapper = (0, import_react24.useMemo)(() => overrides.outline || "div", [overrides]);
|
32608
|
-
return /* @__PURE__ */ (0,
|
32609
|
-
(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)(
|
32610
32840
|
LayerTree,
|
32611
32841
|
{
|
32612
32842
|
config,
|
@@ -32619,7 +32849,7 @@ var Outline = () => {
|
|
32619
32849
|
),
|
32620
32850
|
Object.entries(findZonesForArea(data, "root")).map(
|
32621
32851
|
([zoneKey, zone]) => {
|
32622
|
-
return /* @__PURE__ */ (0,
|
32852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
32623
32853
|
LayerTree,
|
32624
32854
|
{
|
32625
32855
|
config,
|
@@ -32746,14 +32976,432 @@ function useHistoryStore() {
|
|
32746
32976
|
};
|
32747
32977
|
}
|
32748
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
|
+
suppressHydrationWarning: true,
|
33389
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Preview, {}) })
|
33390
|
+
}
|
33391
|
+
) })
|
33392
|
+
]
|
33393
|
+
}
|
33394
|
+
);
|
33395
|
+
};
|
33396
|
+
|
32749
33397
|
// components/Puck/index.tsx
|
32750
|
-
var
|
32751
|
-
var
|
33398
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
33399
|
+
var getClassName25 = get_class_name_factory_default("Puck", styles_module_default8);
|
32752
33400
|
function Puck({
|
32753
33401
|
children,
|
32754
33402
|
config,
|
32755
33403
|
data: initialData = { content: [], root: { props: { title: "" } } },
|
32756
|
-
ui: initialUi
|
33404
|
+
ui: initialUi,
|
32757
33405
|
onChange,
|
32758
33406
|
onPublish,
|
32759
33407
|
plugins = [],
|
@@ -32761,33 +33409,66 @@ function Puck({
|
|
32761
33409
|
renderHeader,
|
32762
33410
|
renderHeaderActions,
|
32763
33411
|
headerTitle,
|
32764
|
-
headerPath
|
33412
|
+
headerPath,
|
33413
|
+
viewports = defaultViewports,
|
33414
|
+
iframe = {
|
33415
|
+
enabled: true
|
33416
|
+
}
|
32765
33417
|
}) {
|
32766
33418
|
var _a;
|
32767
33419
|
const historyStore = useHistoryStore();
|
32768
|
-
const [reducer] = (0,
|
33420
|
+
const [reducer] = (0, import_react28.useState)(
|
32769
33421
|
() => createReducer({ config, record: historyStore.record })
|
32770
33422
|
);
|
32771
|
-
const [initialAppState] = (0,
|
32772
|
-
|
32773
|
-
|
32774
|
-
|
32775
|
-
|
32776
|
-
|
32777
|
-
|
32778
|
-
|
32779
|
-
|
32780
|
-
|
32781
|
-
|
32782
|
-
|
32783
|
-
|
32784
|
-
|
32785
|
-
|
32786
|
-
|
32787
|
-
|
32788
|
-
|
32789
|
-
|
32790
|
-
|
33423
|
+
const [initialAppState] = (0, import_react28.useState)(() => {
|
33424
|
+
var _a2, _b, _c, _d;
|
33425
|
+
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
33426
|
+
let clientUiState = {};
|
33427
|
+
if (typeof window !== "undefined") {
|
33428
|
+
if (window.matchMedia("(max-width: 638px)").matches) {
|
33429
|
+
clientUiState = __spreadProps(__spreadValues({}, clientUiState), {
|
33430
|
+
leftSideBarVisible: false,
|
33431
|
+
rightSideBarVisible: false
|
33432
|
+
});
|
33433
|
+
}
|
33434
|
+
const viewportWidth = window.innerWidth;
|
33435
|
+
const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
|
33436
|
+
key,
|
33437
|
+
diff: Math.abs(viewportWidth - value.width)
|
33438
|
+
})).sort((a, b) => a.diff > b.diff ? 1 : -1);
|
33439
|
+
const closestViewport = viewportDifferences[0].key;
|
33440
|
+
if (iframe.enabled) {
|
33441
|
+
clientUiState = {
|
33442
|
+
viewports: __spreadProps(__spreadValues({}, initial.viewports), {
|
33443
|
+
current: __spreadProps(__spreadValues({}, initial.viewports.current), {
|
33444
|
+
height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || viewports[closestViewport].height || "auto",
|
33445
|
+
width: ((_d = (_c = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _c.current) == null ? void 0 : _d.width) || viewports[closestViewport].width
|
33446
|
+
})
|
33447
|
+
})
|
33448
|
+
};
|
33449
|
+
}
|
33450
|
+
}
|
33451
|
+
return __spreadProps(__spreadValues({}, defaultAppState), {
|
33452
|
+
data: initialData,
|
33453
|
+
ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
|
33454
|
+
// Store categories under componentList on state to allow render functions and plugins to modify
|
33455
|
+
componentList: config.categories ? Object.entries(config.categories).reduce(
|
33456
|
+
(acc, [categoryName, category]) => {
|
33457
|
+
return __spreadProps(__spreadValues({}, acc), {
|
33458
|
+
[categoryName]: {
|
33459
|
+
title: category.title,
|
33460
|
+
components: category.components,
|
33461
|
+
expanded: category.defaultExpanded,
|
33462
|
+
visible: category.visible
|
33463
|
+
}
|
33464
|
+
});
|
33465
|
+
},
|
33466
|
+
{}
|
33467
|
+
) : {}
|
33468
|
+
})
|
33469
|
+
});
|
33470
|
+
});
|
33471
|
+
const [appState, dispatch] = (0, import_react28.useReducer)(
|
32791
33472
|
reducer,
|
32792
33473
|
flushZones(initialAppState)
|
32793
33474
|
);
|
@@ -32798,9 +33479,9 @@ function Puck({
|
|
32798
33479
|
config,
|
32799
33480
|
dispatch
|
32800
33481
|
);
|
32801
|
-
const [menuOpen, setMenuOpen] = (0,
|
33482
|
+
const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
|
32802
33483
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
32803
|
-
const setItemSelector = (0,
|
33484
|
+
const setItemSelector = (0, import_react28.useCallback)(
|
32804
33485
|
(newItemSelector) => {
|
32805
33486
|
if (newItemSelector === itemSelector)
|
32806
33487
|
return;
|
@@ -32813,21 +33494,21 @@ function Puck({
|
|
32813
33494
|
[itemSelector]
|
32814
33495
|
);
|
32815
33496
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
32816
|
-
(0,
|
33497
|
+
(0, import_react28.useEffect)(() => {
|
32817
33498
|
if (onChange)
|
32818
33499
|
onChange(data);
|
32819
33500
|
}, [data]);
|
32820
33501
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
32821
|
-
const [draggedItem, setDraggedItem] = (0,
|
33502
|
+
const [draggedItem, setDraggedItem] = (0, import_react28.useState)();
|
32822
33503
|
const rootProps = data.root.props || data.root;
|
32823
|
-
(0,
|
33504
|
+
(0, import_react28.useEffect)(() => {
|
32824
33505
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
32825
33506
|
console.error(
|
32826
33507
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
32827
33508
|
);
|
32828
33509
|
}
|
32829
33510
|
}, []);
|
32830
|
-
const toggleSidebars = (0,
|
33511
|
+
const toggleSidebars = (0, import_react28.useCallback)(
|
32831
33512
|
(sidebar) => {
|
32832
33513
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
32833
33514
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -32841,7 +33522,7 @@ function Puck({
|
|
32841
33522
|
},
|
32842
33523
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
32843
33524
|
);
|
32844
|
-
(0,
|
33525
|
+
(0, import_react28.useEffect)(() => {
|
32845
33526
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
32846
33527
|
dispatch({
|
32847
33528
|
type: "setUi",
|
@@ -32864,11 +33545,11 @@ function Puck({
|
|
32864
33545
|
window.removeEventListener("resize", handleResize);
|
32865
33546
|
};
|
32866
33547
|
}, []);
|
32867
|
-
const defaultRender = (0,
|
32868
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0,
|
33548
|
+
const defaultRender = (0, import_react28.useMemo)(() => {
|
33549
|
+
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: children2 });
|
32869
33550
|
return PuckDefault;
|
32870
33551
|
}, []);
|
32871
|
-
const defaultHeaderRender = (0,
|
33552
|
+
const defaultHeaderRender = (0, import_react28.useMemo)(() => {
|
32872
33553
|
if (renderHeader) {
|
32873
33554
|
console.warn(
|
32874
33555
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -32876,257 +33557,242 @@ function Puck({
|
|
32876
33557
|
const RenderHeader = (_a2) => {
|
32877
33558
|
var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
|
32878
33559
|
const Comp = renderHeader;
|
32879
|
-
return /* @__PURE__ */ (0,
|
33560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
32880
33561
|
};
|
32881
33562
|
return RenderHeader;
|
32882
33563
|
}
|
32883
33564
|
return defaultRender;
|
32884
33565
|
}, [renderHeader]);
|
32885
|
-
const defaultHeaderActionsRender = (0,
|
33566
|
+
const defaultHeaderActionsRender = (0, import_react28.useMemo)(() => {
|
32886
33567
|
if (renderHeaderActions) {
|
32887
33568
|
console.warn(
|
32888
33569
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
32889
33570
|
);
|
32890
33571
|
const RenderHeader = (props) => {
|
32891
33572
|
const Comp = renderHeaderActions;
|
32892
|
-
return /* @__PURE__ */ (0,
|
33573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
32893
33574
|
};
|
32894
33575
|
return RenderHeader;
|
32895
33576
|
}
|
32896
33577
|
return defaultRender;
|
32897
33578
|
}, [renderHeader]);
|
32898
|
-
const loadedOverrides = (0,
|
33579
|
+
const loadedOverrides = (0, import_react28.useMemo)(() => {
|
32899
33580
|
return loadOverrides({ overrides, plugins });
|
32900
33581
|
}, [plugins]);
|
32901
|
-
const CustomPuck = (0,
|
33582
|
+
const CustomPuck = (0, import_react28.useMemo)(
|
32902
33583
|
() => loadedOverrides.puck || defaultRender,
|
32903
33584
|
[loadedOverrides]
|
32904
33585
|
);
|
32905
|
-
const
|
32906
|
-
() => loadedOverrides.preview || defaultRender,
|
32907
|
-
[loadedOverrides]
|
32908
|
-
);
|
32909
|
-
const CustomHeader = (0, import_react26.useMemo)(
|
33586
|
+
const CustomHeader = (0, import_react28.useMemo)(
|
32910
33587
|
() => loadedOverrides.header || defaultHeaderRender,
|
32911
33588
|
[loadedOverrides]
|
32912
33589
|
);
|
32913
|
-
const CustomHeaderActions = (0,
|
33590
|
+
const CustomHeaderActions = (0, import_react28.useMemo)(
|
32914
33591
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
32915
33592
|
[loadedOverrides]
|
32916
33593
|
);
|
32917
|
-
const
|
32918
|
-
|
32919
|
-
|
32920
|
-
|
32921
|
-
|
32922
|
-
|
32923
|
-
|
32924
|
-
|
32925
|
-
|
32926
|
-
|
32927
|
-
|
32928
|
-
|
32929
|
-
|
32930
|
-
|
32931
|
-
|
32932
|
-
|
32933
|
-
|
32934
|
-
|
32935
|
-
|
32936
|
-
|
32937
|
-
|
32938
|
-
|
32939
|
-
|
32940
|
-
|
32941
|
-
|
32942
|
-
|
32943
|
-
|
32944
|
-
|
32945
|
-
|
32946
|
-
|
32947
|
-
|
32948
|
-
|
32949
|
-
|
32950
|
-
|
32951
|
-
|
33594
|
+
const [mounted, setMounted] = (0, import_react28.useState)(false);
|
33595
|
+
(0, import_react28.useEffect)(() => {
|
33596
|
+
setMounted(true);
|
33597
|
+
}, []);
|
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) {
|
32952
33647
|
dispatch({
|
32953
|
-
type: "
|
32954
|
-
|
32955
|
-
destinationIndex:
|
32956
|
-
destinationZone:
|
33648
|
+
type: "reorder",
|
33649
|
+
sourceIndex: source.index,
|
33650
|
+
destinationIndex: destination.index,
|
33651
|
+
destinationZone: destination.droppableId
|
32957
33652
|
});
|
32958
|
-
setItemSelector({
|
32959
|
-
index: droppedItem.destination.index,
|
32960
|
-
zone: droppedItem.destination.droppableId
|
32961
|
-
});
|
32962
|
-
return;
|
32963
33653
|
} else {
|
32964
|
-
|
32965
|
-
|
32966
|
-
|
32967
|
-
|
32968
|
-
|
32969
|
-
|
32970
|
-
destinationZone: destination.droppableId
|
32971
|
-
});
|
32972
|
-
} else {
|
32973
|
-
dispatch({
|
32974
|
-
type: "move",
|
32975
|
-
sourceZone: source.droppableId,
|
32976
|
-
sourceIndex: source.index,
|
32977
|
-
destinationIndex: destination.index,
|
32978
|
-
destinationZone: destination.droppableId
|
32979
|
-
});
|
32980
|
-
}
|
32981
|
-
setItemSelector({
|
32982
|
-
index: destination.index,
|
32983
|
-
zone: destination.droppableId
|
33654
|
+
dispatch({
|
33655
|
+
type: "move",
|
33656
|
+
sourceZone: source.droppableId,
|
33657
|
+
sourceIndex: source.index,
|
33658
|
+
destinationIndex: destination.index,
|
33659
|
+
destinationZone: destination.droppableId
|
32984
33660
|
});
|
32985
33661
|
}
|
32986
|
-
|
32987
|
-
|
32988
|
-
|
32989
|
-
|
32990
|
-
|
32991
|
-
|
32992
|
-
|
32993
|
-
|
32994
|
-
|
32995
|
-
|
32996
|
-
|
32997
|
-
|
32998
|
-
|
32999
|
-
|
33000
|
-
|
33001
|
-
|
33002
|
-
|
33003
|
-
|
33004
|
-
|
33005
|
-
|
33006
|
-
|
33007
|
-
|
33008
|
-
|
33009
|
-
|
33010
|
-
|
33011
|
-
|
33012
|
-
|
33013
|
-
|
33014
|
-
|
33015
|
-
|
33016
|
-
|
33017
|
-
|
33018
|
-
|
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
|
+
mounted,
|
33689
|
+
rightSideBarVisible
|
33690
|
+
}),
|
33691
|
+
children: [
|
33692
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33693
|
+
CustomHeader,
|
33694
|
+
{
|
33695
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
33696
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
|
33697
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33698
|
+
Button,
|
33699
|
+
{
|
33700
|
+
onClick: () => {
|
33701
|
+
onPublish && onPublish(data);
|
33702
|
+
},
|
33703
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Globe, { size: "14px" }),
|
33704
|
+
children: "Publish"
|
33705
|
+
}
|
33706
|
+
)
|
33707
|
+
] }),
|
33708
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerInner"), children: [
|
33709
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerToggle"), children: [
|
33710
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33711
|
+
IconButton,
|
33019
33712
|
{
|
33020
33713
|
onClick: () => {
|
33021
|
-
|
33714
|
+
toggleSidebars("left");
|
33022
33715
|
},
|
33023
|
-
|
33024
|
-
children: "
|
33716
|
+
title: "Toggle left sidebar",
|
33717
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelLeft, { focusable: "false" })
|
33025
33718
|
}
|
33026
|
-
)
|
33719
|
+
) }),
|
33720
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33721
|
+
IconButton,
|
33722
|
+
{
|
33723
|
+
onClick: () => {
|
33724
|
+
toggleSidebars("right");
|
33725
|
+
},
|
33726
|
+
title: "Toggle right sidebar",
|
33727
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelRight, { focusable: "false" })
|
33728
|
+
}
|
33729
|
+
) })
|
33027
33730
|
] }),
|
33028
|
-
|
33029
|
-
|
33030
|
-
|
33031
|
-
|
33032
|
-
|
33033
|
-
onClick: () => {
|
33034
|
-
toggleSidebars("left");
|
33035
|
-
},
|
33036
|
-
title: "Toggle left sidebar",
|
33037
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelLeft, { focusable: "false" })
|
33038
|
-
}
|
33039
|
-
) }),
|
33040
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33041
|
-
IconButton,
|
33042
|
-
{
|
33043
|
-
onClick: () => {
|
33044
|
-
toggleSidebars("right");
|
33045
|
-
},
|
33046
|
-
title: "Toggle right sidebar",
|
33047
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelRight, { focusable: "false" })
|
33048
|
-
}
|
33049
|
-
) })
|
33050
|
-
] }),
|
33051
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
33052
|
-
headerTitle || rootProps.title || "Page",
|
33053
|
-
headerPath && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
33054
|
-
" ",
|
33055
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("code", { className: getClassName22("headerPath"), children: headerPath })
|
33056
|
-
] })
|
33057
|
-
] }) }),
|
33058
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerTools"), children: [
|
33059
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33060
|
-
IconButton,
|
33061
|
-
{
|
33062
|
-
onClick: () => {
|
33063
|
-
return setMenuOpen(!menuOpen);
|
33064
|
-
},
|
33065
|
-
title: "Toggle menu bar",
|
33066
|
-
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, { focusable: "false" })
|
33067
|
-
}
|
33068
|
-
) }),
|
33069
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33070
|
-
MenuBar,
|
33071
|
-
{
|
33072
|
-
appState,
|
33073
|
-
data,
|
33074
|
-
dispatch,
|
33075
|
-
onPublish,
|
33076
|
-
menuOpen,
|
33077
|
-
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomHeaderActions, {}),
|
33078
|
-
setMenuOpen
|
33079
|
-
}
|
33080
|
-
)
|
33731
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
33732
|
+
headerTitle || rootProps.title || "Page",
|
33733
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
33734
|
+
" ",
|
33735
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
|
33081
33736
|
] })
|
33082
|
-
] }) })
|
33083
|
-
|
33084
|
-
|
33085
|
-
|
33086
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Components, {}) }),
|
33087
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Outline, {}) })
|
33088
|
-
] }),
|
33089
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
33090
|
-
"div",
|
33091
|
-
{
|
33092
|
-
className: getClassName22("frame"),
|
33093
|
-
onClick: () => setItemSelector(null),
|
33094
|
-
children: [
|
33095
|
-
/* @__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, {}) }) }),
|
33096
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33097
|
-
"div",
|
33737
|
+
] }) }),
|
33738
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerTools"), children: [
|
33739
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33740
|
+
IconButton,
|
33098
33741
|
{
|
33099
|
-
|
33100
|
-
|
33101
|
-
|
33102
|
-
|
33103
|
-
}
|
33742
|
+
onClick: () => {
|
33743
|
+
return setMenuOpen(!menuOpen);
|
33744
|
+
},
|
33745
|
+
title: "Toggle menu bar",
|
33746
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { focusable: "false" })
|
33747
|
+
}
|
33748
|
+
) }),
|
33749
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33750
|
+
MenuBar,
|
33751
|
+
{
|
33752
|
+
appState,
|
33753
|
+
data,
|
33754
|
+
dispatch,
|
33755
|
+
onPublish,
|
33756
|
+
menuOpen,
|
33757
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
|
33758
|
+
setMenuOpen
|
33104
33759
|
}
|
33105
33760
|
)
|
33106
|
-
]
|
33107
|
-
}
|
33108
|
-
|
33109
|
-
|
33110
|
-
|
33111
|
-
|
33112
|
-
|
33113
|
-
|
33114
|
-
|
33115
|
-
|
33116
|
-
|
33117
|
-
|
33118
|
-
|
33119
|
-
|
33120
|
-
|
33121
|
-
|
33122
|
-
|
33123
|
-
|
33124
|
-
|
33125
|
-
|
33126
|
-
|
33127
|
-
|
33128
|
-
|
33129
|
-
|
33761
|
+
] })
|
33762
|
+
] }) })
|
33763
|
+
}
|
33764
|
+
),
|
33765
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
|
33766
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Components, {}) }),
|
33767
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Outline, {}) })
|
33768
|
+
] }),
|
33769
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Canvas, {}),
|
33770
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33771
|
+
SidebarSection,
|
33772
|
+
{
|
33773
|
+
noPadding: true,
|
33774
|
+
noBorderTop: true,
|
33775
|
+
showBreadcrumbs: true,
|
33776
|
+
title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
|
33777
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Fields, {})
|
33778
|
+
}
|
33779
|
+
) }),
|
33780
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33781
|
+
"div",
|
33782
|
+
{
|
33783
|
+
id: "puck-portal-root",
|
33784
|
+
className: getClassName25("portal")
|
33785
|
+
}
|
33786
|
+
)
|
33787
|
+
]
|
33788
|
+
}
|
33789
|
+
) })
|
33790
|
+
}
|
33791
|
+
)
|
33792
|
+
}
|
33793
|
+
)
|
33794
|
+
}
|
33795
|
+
) });
|
33130
33796
|
}
|
33131
33797
|
Puck.Components = Components;
|
33132
33798
|
Puck.Fields = Fields;
|
@@ -33135,13 +33801,16 @@ Puck.Preview = Preview;
|
|
33135
33801
|
|
33136
33802
|
// components/Render/index.tsx
|
33137
33803
|
init_react_import();
|
33138
|
-
var
|
33139
|
-
function Render({
|
33804
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
33805
|
+
function Render({
|
33806
|
+
config,
|
33807
|
+
data
|
33808
|
+
}) {
|
33140
33809
|
var _a;
|
33141
33810
|
const rootProps = data.root.props || data.root;
|
33142
33811
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
33143
33812
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
33144
|
-
return /* @__PURE__ */ (0,
|
33813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33145
33814
|
config.root.render,
|
33146
33815
|
__spreadProps(__spreadValues({}, rootProps), {
|
33147
33816
|
puck: {
|
@@ -33150,11 +33819,11 @@ function Render({ config, data }) {
|
|
33150
33819
|
title,
|
33151
33820
|
editMode: false,
|
33152
33821
|
id: "puck-root",
|
33153
|
-
children: /* @__PURE__ */ (0,
|
33822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId })
|
33154
33823
|
})
|
33155
33824
|
) });
|
33156
33825
|
}
|
33157
|
-
return /* @__PURE__ */ (0,
|
33826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId }) });
|
33158
33827
|
}
|
33159
33828
|
|
33160
33829
|
// lib/migrate.ts
|
@@ -33215,37 +33884,51 @@ function transformProps(data, propTransforms) {
|
|
33215
33884
|
|
33216
33885
|
// lib/resolve-all-data.ts
|
33217
33886
|
init_react_import();
|
33218
|
-
|
33219
|
-
|
33220
|
-
|
33221
|
-
|
33222
|
-
|
33223
|
-
|
33224
|
-
|
33225
|
-
|
33226
|
-
|
33227
|
-
|
33228
|
-
|
33229
|
-
|
33230
|
-
|
33231
|
-
|
33232
|
-
|
33233
|
-
|
33234
|
-
|
33235
|
-
|
33236
|
-
|
33237
|
-
|
33238
|
-
|
33239
|
-
|
33240
|
-
|
33887
|
+
function resolveAllData(data, config, onResolveStart, onResolveEnd) {
|
33888
|
+
return __async(this, null, function* () {
|
33889
|
+
const dynamicRoot = yield resolveRootData(data, config);
|
33890
|
+
const { zones = {} } = data;
|
33891
|
+
const zoneKeys = Object.keys(zones);
|
33892
|
+
const resolvedZones = {};
|
33893
|
+
for (let i = 0; i < zoneKeys.length; i++) {
|
33894
|
+
const zoneKey = zoneKeys[i];
|
33895
|
+
resolvedZones[zoneKey] = yield resolveAllComponentData(
|
33896
|
+
zones[zoneKey],
|
33897
|
+
config,
|
33898
|
+
onResolveStart,
|
33899
|
+
onResolveEnd
|
33900
|
+
);
|
33901
|
+
}
|
33902
|
+
return __spreadProps(__spreadValues({}, data), {
|
33903
|
+
root: dynamicRoot,
|
33904
|
+
content: yield resolveAllComponentData(
|
33905
|
+
data.content,
|
33906
|
+
config,
|
33907
|
+
onResolveStart,
|
33908
|
+
onResolveEnd
|
33909
|
+
),
|
33910
|
+
zones: resolvedZones
|
33911
|
+
});
|
33241
33912
|
});
|
33242
|
-
}
|
33913
|
+
}
|
33243
33914
|
|
33244
33915
|
// lib/use-puck.ts
|
33245
33916
|
init_react_import();
|
33246
33917
|
var usePuck = () => {
|
33247
|
-
const {
|
33248
|
-
|
33918
|
+
const {
|
33919
|
+
state: appState,
|
33920
|
+
config,
|
33921
|
+
history,
|
33922
|
+
dispatch,
|
33923
|
+
selectedItem
|
33924
|
+
} = useAppContext();
|
33925
|
+
return {
|
33926
|
+
appState,
|
33927
|
+
config,
|
33928
|
+
dispatch,
|
33929
|
+
history,
|
33930
|
+
selectedItem: selectedItem || null
|
33931
|
+
};
|
33249
33932
|
};
|
33250
33933
|
// Annotate the CommonJS export names for ESM import in node:
|
33251
33934
|
0 && (module.exports = {
|
@@ -33449,6 +34132,14 @@ lucide-react/dist/esm/icons/lock.js:
|
|
33449
34132
|
* See the LICENSE file in the root directory of this source tree.
|
33450
34133
|
*)
|
33451
34134
|
|
34135
|
+
lucide-react/dist/esm/icons/monitor.js:
|
34136
|
+
(**
|
34137
|
+
* @license lucide-react v0.298.0 - ISC
|
34138
|
+
*
|
34139
|
+
* This source code is licensed under the ISC license.
|
34140
|
+
* See the LICENSE file in the root directory of this source tree.
|
34141
|
+
*)
|
34142
|
+
|
33452
34143
|
lucide-react/dist/esm/icons/more-vertical.js:
|
33453
34144
|
(**
|
33454
34145
|
* @license lucide-react v0.298.0 - ISC
|
@@ -33497,6 +34188,22 @@ lucide-react/dist/esm/icons/sliders-horizontal.js:
|
|
33497
34188
|
* See the LICENSE file in the root directory of this source tree.
|
33498
34189
|
*)
|
33499
34190
|
|
34191
|
+
lucide-react/dist/esm/icons/smartphone.js:
|
34192
|
+
(**
|
34193
|
+
* @license lucide-react v0.298.0 - ISC
|
34194
|
+
*
|
34195
|
+
* This source code is licensed under the ISC license.
|
34196
|
+
* See the LICENSE file in the root directory of this source tree.
|
34197
|
+
*)
|
34198
|
+
|
34199
|
+
lucide-react/dist/esm/icons/tablet.js:
|
34200
|
+
(**
|
34201
|
+
* @license lucide-react v0.298.0 - ISC
|
34202
|
+
*
|
34203
|
+
* This source code is licensed under the ISC license.
|
34204
|
+
* See the LICENSE file in the root directory of this source tree.
|
34205
|
+
*)
|
34206
|
+
|
33500
34207
|
lucide-react/dist/esm/icons/trash.js:
|
33501
34208
|
(**
|
33502
34209
|
* @license lucide-react v0.298.0 - ISC
|
@@ -33521,6 +34228,22 @@ lucide-react/dist/esm/icons/unlock.js:
|
|
33521
34228
|
* See the LICENSE file in the root directory of this source tree.
|
33522
34229
|
*)
|
33523
34230
|
|
34231
|
+
lucide-react/dist/esm/icons/zoom-in.js:
|
34232
|
+
(**
|
34233
|
+
* @license lucide-react v0.298.0 - ISC
|
34234
|
+
*
|
34235
|
+
* This source code is licensed under the ISC license.
|
34236
|
+
* See the LICENSE file in the root directory of this source tree.
|
34237
|
+
*)
|
34238
|
+
|
34239
|
+
lucide-react/dist/esm/icons/zoom-out.js:
|
34240
|
+
(**
|
34241
|
+
* @license lucide-react v0.298.0 - ISC
|
34242
|
+
*
|
34243
|
+
* This source code is licensed under the ISC license.
|
34244
|
+
* See the LICENSE file in the root directory of this source tree.
|
34245
|
+
*)
|
34246
|
+
|
33524
34247
|
lucide-react/dist/esm/lucide-react.js:
|
33525
34248
|
(**
|
33526
34249
|
* @license lucide-react v0.298.0 - ISC
|