@measured/puck 0.14.0-canary.712fb8e → 0.14.0-canary.924c85a
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{Config-487c2755.d.ts → Config-29dc2731.d.ts} +19 -2
- package/dist/index.css +227 -153
- package/dist/index.d.ts +7 -5
- package/dist/index.js +1154 -522
- package/dist/rsc.d.ts +1 -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 Fragment16 = 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 Fragment16:
|
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 !== Fragment16) {
|
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 === Fragment16) {
|
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 Fragment16:
|
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 Fragment16:
|
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(Fragment16, elements, key, mode);
|
28025
28025
|
fiber.lanes = lanes;
|
28026
28026
|
return fiber;
|
28027
28027
|
}
|
@@ -29264,7 +29264,148 @@ 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: 0,
|
29347
|
+
rootHeight: 0,
|
29348
|
+
zoom: 1
|
29349
|
+
},
|
29350
|
+
setZoomConfig: () => null,
|
29351
|
+
status: "LOADING"
|
29352
|
+
};
|
29353
|
+
var appContext = (0, import_react3.createContext)(defaultContext);
|
29354
|
+
var AppProvider = ({
|
29355
|
+
children,
|
29356
|
+
value
|
29357
|
+
}) => {
|
29358
|
+
const [zoomConfig, setZoomConfig] = (0, import_react3.useState)(defaultContext.zoomConfig);
|
29359
|
+
const [status, setStatus] = (0, import_react3.useState)("LOADING");
|
29360
|
+
(0, import_react3.useEffect)(() => {
|
29361
|
+
setStatus("READY");
|
29362
|
+
}, []);
|
29363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
29364
|
+
appContext.Provider,
|
29365
|
+
{
|
29366
|
+
value: __spreadProps(__spreadValues({}, value), { zoomConfig, setZoomConfig, status }),
|
29367
|
+
children
|
29368
|
+
}
|
29369
|
+
);
|
29370
|
+
};
|
29371
|
+
function useAppContext() {
|
29372
|
+
const mainContext = (0, import_react3.useContext)(appContext);
|
29373
|
+
const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
|
29374
|
+
return __spreadProps(__spreadValues({}, mainContext), {
|
29375
|
+
// Helpers
|
29376
|
+
selectedItem,
|
29377
|
+
setUi: (ui, recordHistory) => {
|
29378
|
+
return mainContext.dispatch({
|
29379
|
+
type: "setUi",
|
29380
|
+
ui,
|
29381
|
+
recordHistory
|
29382
|
+
});
|
29383
|
+
}
|
29384
|
+
});
|
29385
|
+
}
|
29386
|
+
|
29387
|
+
// components/Droppable/index.tsx
|
29388
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
29389
|
+
var defaultProvided = {
|
29390
|
+
droppableProps: {
|
29391
|
+
"data-rfd-droppable-context-id": "",
|
29392
|
+
"data-rfd-droppable-id": ""
|
29393
|
+
},
|
29394
|
+
placeholder: null,
|
29395
|
+
innerRef: () => null
|
29396
|
+
};
|
29397
|
+
var defaultSnapshot = {
|
29398
|
+
isDraggingOver: false,
|
29399
|
+
draggingOverWith: null,
|
29400
|
+
draggingFromThisWith: null,
|
29401
|
+
isUsingPlaceholder: false
|
29402
|
+
};
|
29403
|
+
var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: children(defaultProvided, defaultSnapshot) });
|
29404
|
+
var Droppable = (props) => {
|
29405
|
+
const { status } = useAppContext();
|
29406
|
+
const El = status === "READY" ? import_dnd.Droppable : DefaultDroppable;
|
29407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(El, __spreadValues({}, props));
|
29408
|
+
};
|
29268
29409
|
|
29269
29410
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
|
29270
29411
|
init_react_import();
|
@@ -29272,8 +29413,32 @@ var styles_module_default = { "Drawer": "_Drawer_6zh0b_1", "DrawerItem-default":
|
|
29272
29413
|
|
29273
29414
|
// components/Draggable/index.tsx
|
29274
29415
|
init_react_import();
|
29275
|
-
var
|
29276
|
-
var
|
29416
|
+
var import_dnd2 = require("@measured/dnd");
|
29417
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
29418
|
+
var defaultProvided2 = {
|
29419
|
+
draggableProps: {
|
29420
|
+
"data-rfd-draggable-context-id": "",
|
29421
|
+
"data-rfd-draggable-id": ""
|
29422
|
+
},
|
29423
|
+
dragHandleProps: null,
|
29424
|
+
innerRef: () => null
|
29425
|
+
};
|
29426
|
+
var defaultSnapshot2 = {
|
29427
|
+
isDragging: false,
|
29428
|
+
isDropAnimating: false,
|
29429
|
+
isClone: false,
|
29430
|
+
dropAnimation: null,
|
29431
|
+
draggingOver: null,
|
29432
|
+
combineWith: null,
|
29433
|
+
combineTargetFor: null,
|
29434
|
+
mode: null
|
29435
|
+
};
|
29436
|
+
var defaultRubric = {
|
29437
|
+
draggableId: "",
|
29438
|
+
type: "",
|
29439
|
+
source: { droppableId: "", index: 0 }
|
29440
|
+
};
|
29441
|
+
var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: children(defaultProvided2, defaultSnapshot2, defaultRubric) });
|
29277
29442
|
var Draggable = ({
|
29278
29443
|
className,
|
29279
29444
|
children,
|
@@ -29283,39 +29448,33 @@ var Draggable = ({
|
|
29283
29448
|
disableAnimations = false,
|
29284
29449
|
isDragDisabled = false
|
29285
29450
|
}) => {
|
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
|
-
);
|
29451
|
+
const { status } = useAppContext();
|
29452
|
+
const El = status === "READY" ? import_dnd2.Draggable : DefaultDraggable;
|
29453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => {
|
29454
|
+
var _a;
|
29455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
29456
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
29457
|
+
"div",
|
29458
|
+
__spreadProps(__spreadValues(__spreadValues({
|
29459
|
+
className: className && className(provided, snapshot),
|
29460
|
+
ref: provided.innerRef
|
29461
|
+
}, provided.draggableProps), provided.dragHandleProps), {
|
29462
|
+
style: __spreadProps(__spreadValues({}, provided.draggableProps.style), {
|
29463
|
+
transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
|
29464
|
+
}),
|
29465
|
+
children: children(provided, snapshot)
|
29466
|
+
})
|
29467
|
+
),
|
29468
|
+
showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
29469
|
+
"div",
|
29470
|
+
{
|
29471
|
+
className: className && className(provided, snapshot),
|
29472
|
+
style: { transform: "none !important" },
|
29473
|
+
children: children(provided, snapshot)
|
29474
|
+
}
|
29475
|
+
)
|
29476
|
+
] });
|
29477
|
+
} });
|
29319
29478
|
};
|
29320
29479
|
|
29321
29480
|
// components/DragIcon/index.tsx
|
@@ -29350,23 +29509,23 @@ init_react_import();
|
|
29350
29509
|
var styles_module_default2 = { "DragIcon": "_DragIcon_1p5wn_1" };
|
29351
29510
|
|
29352
29511
|
// components/DragIcon/index.tsx
|
29353
|
-
var
|
29512
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
29354
29513
|
var getClassName2 = get_class_name_factory_default("DragIcon", styles_module_default2);
|
29355
|
-
var DragIcon = () => /* @__PURE__ */ (0,
|
29514
|
+
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
29515
|
|
29357
29516
|
// components/Drawer/index.tsx
|
29358
|
-
var
|
29359
|
-
var
|
29517
|
+
var import_react4 = require("react");
|
29518
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
29360
29519
|
var getClassName3 = get_class_name_factory_default("Drawer", styles_module_default);
|
29361
29520
|
var getClassNameItem = get_class_name_factory_default("DrawerItem", styles_module_default);
|
29362
|
-
var drawerContext = (0,
|
29521
|
+
var drawerContext = (0, import_react4.createContext)({
|
29363
29522
|
droppableId: ""
|
29364
29523
|
});
|
29365
29524
|
var DrawerDraggable = ({
|
29366
29525
|
children,
|
29367
29526
|
id,
|
29368
29527
|
index
|
29369
|
-
}) => /* @__PURE__ */ (0,
|
29528
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
29370
29529
|
Draggable,
|
29371
29530
|
{
|
29372
29531
|
id,
|
@@ -29385,15 +29544,15 @@ var DrawerItem = ({
|
|
29385
29544
|
label,
|
29386
29545
|
index
|
29387
29546
|
}) => {
|
29388
|
-
const ctx = (0,
|
29547
|
+
const ctx = (0, import_react4.useContext)(drawerContext);
|
29389
29548
|
const resolvedId = `${ctx.droppableId}::${id || name}`;
|
29390
|
-
const CustomInner = (0,
|
29391
|
-
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0,
|
29549
|
+
const CustomInner = (0, import_react4.useMemo)(
|
29550
|
+
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("default"), children: children2 })),
|
29392
29551
|
[children]
|
29393
29552
|
);
|
29394
|
-
return /* @__PURE__ */ (0,
|
29395
|
-
/* @__PURE__ */ (0,
|
29396
|
-
/* @__PURE__ */ (0,
|
29553
|
+
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: [
|
29554
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("name"), children: label != null ? label : name }),
|
29555
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DragIcon, {}) })
|
29397
29556
|
] }) }) }) });
|
29398
29557
|
};
|
29399
29558
|
var Drawer = ({
|
@@ -29401,7 +29560,7 @@ var Drawer = ({
|
|
29401
29560
|
droppableId = "component-list",
|
29402
29561
|
direction = "vertical"
|
29403
29562
|
}) => {
|
29404
|
-
return /* @__PURE__ */ (0,
|
29563
|
+
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
29564
|
"div",
|
29406
29565
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
29407
29566
|
ref: provided.innerRef,
|
@@ -29410,7 +29569,7 @@ var Drawer = ({
|
|
29410
29569
|
}),
|
29411
29570
|
children: [
|
29412
29571
|
children,
|
29413
|
-
/* @__PURE__ */ (0,
|
29572
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
|
29414
29573
|
]
|
29415
29574
|
})
|
29416
29575
|
) }) });
|
@@ -29423,19 +29582,19 @@ var import_react9 = require("react");
|
|
29423
29582
|
|
29424
29583
|
// components/DraggableComponent/index.tsx
|
29425
29584
|
init_react_import();
|
29426
|
-
var
|
29427
|
-
var import_dnd3 = require("@
|
29585
|
+
var import_react7 = require("react");
|
29586
|
+
var import_dnd3 = require("@measured/dnd");
|
29428
29587
|
|
29429
29588
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
29430
29589
|
init_react_import();
|
29431
|
-
var styles_module_default3 = { "DraggableComponent": "
|
29590
|
+
var styles_module_default3 = { "DraggableComponent": "_DraggableComponent_17mte_1", "DraggableComponent--isDragging": "_DraggableComponent--isDragging_17mte_11", "DraggableComponent-contents": "_DraggableComponent-contents_17mte_16", "DraggableComponent-overlay": "_DraggableComponent-overlay_17mte_29", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_17mte_49", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_17mte_65", "DraggableComponent--forceHover": "_DraggableComponent--forceHover_17mte_71", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_17mte_76", "DraggableComponent--indicativeHover": "_DraggableComponent--indicativeHover_17mte_81", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_17mte_97", "DraggableComponent-actions": "_DraggableComponent-actions_17mte_97", "DraggableComponent-actionsLabel": "_DraggableComponent-actionsLabel_17mte_127", "DraggableComponent-action": "_DraggableComponent-action_17mte_97" };
|
29432
29591
|
|
29433
29592
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
29434
29593
|
init_react_import();
|
29435
29594
|
|
29436
29595
|
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
29437
29596
|
init_react_import();
|
29438
|
-
var
|
29597
|
+
var import_react5 = require("react");
|
29439
29598
|
|
29440
29599
|
// ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
|
29441
29600
|
init_react_import();
|
@@ -29454,10 +29613,10 @@ var defaultAttributes = {
|
|
29454
29613
|
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
29455
29614
|
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim();
|
29456
29615
|
var createLucideIcon = (iconName, iconNode) => {
|
29457
|
-
const Component = (0,
|
29616
|
+
const Component = (0, import_react5.forwardRef)(
|
29458
29617
|
(_a, ref) => {
|
29459
29618
|
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,
|
29619
|
+
return (0, import_react5.createElement)(
|
29461
29620
|
"svg",
|
29462
29621
|
__spreadValues(__spreadProps(__spreadValues({
|
29463
29622
|
ref
|
@@ -29469,7 +29628,7 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
29469
29628
|
className: ["lucide", `lucide-${toKebabCase(iconName)}`, className].join(" ")
|
29470
29629
|
}), rest),
|
29471
29630
|
[
|
29472
|
-
...iconNode.map(([tag, attrs]) => (0,
|
29631
|
+
...iconNode.map(([tag, attrs]) => (0, import_react5.createElement)(tag, attrs)),
|
29473
29632
|
...Array.isArray(children) ? children : [children]
|
29474
29633
|
]
|
29475
29634
|
);
|
@@ -29580,6 +29739,14 @@ var Lock = createLucideIcon("Lock", [
|
|
29580
29739
|
["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
|
29581
29740
|
]);
|
29582
29741
|
|
29742
|
+
// ../../node_modules/lucide-react/dist/esm/icons/monitor.js
|
29743
|
+
init_react_import();
|
29744
|
+
var Monitor = createLucideIcon("Monitor", [
|
29745
|
+
["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
|
29746
|
+
["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
|
29747
|
+
["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
|
29748
|
+
]);
|
29749
|
+
|
29583
29750
|
// ../../node_modules/lucide-react/dist/esm/icons/more-vertical.js
|
29584
29751
|
init_react_import();
|
29585
29752
|
var MoreVertical = createLucideIcon("MoreVertical", [
|
@@ -29630,6 +29797,20 @@ var SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
|
|
29630
29797
|
["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
|
29631
29798
|
]);
|
29632
29799
|
|
29800
|
+
// ../../node_modules/lucide-react/dist/esm/icons/smartphone.js
|
29801
|
+
init_react_import();
|
29802
|
+
var Smartphone = createLucideIcon("Smartphone", [
|
29803
|
+
["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
|
29804
|
+
["path", { d: "M12 18h.01", key: "mhygvu" }]
|
29805
|
+
]);
|
29806
|
+
|
29807
|
+
// ../../node_modules/lucide-react/dist/esm/icons/tablet.js
|
29808
|
+
init_react_import();
|
29809
|
+
var Tablet = createLucideIcon("Tablet", [
|
29810
|
+
["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
|
29811
|
+
["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
|
29812
|
+
]);
|
29813
|
+
|
29633
29814
|
// ../../node_modules/lucide-react/dist/esm/icons/trash.js
|
29634
29815
|
init_react_import();
|
29635
29816
|
var Trash = createLucideIcon("Trash", [
|
@@ -29653,12 +29834,29 @@ var Unlock = createLucideIcon("Unlock", [
|
|
29653
29834
|
["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
|
29654
29835
|
]);
|
29655
29836
|
|
29837
|
+
// ../../node_modules/lucide-react/dist/esm/icons/zoom-in.js
|
29838
|
+
init_react_import();
|
29839
|
+
var ZoomIn = createLucideIcon("ZoomIn", [
|
29840
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
29841
|
+
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
29842
|
+
["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
|
29843
|
+
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
|
29844
|
+
]);
|
29845
|
+
|
29846
|
+
// ../../node_modules/lucide-react/dist/esm/icons/zoom-out.js
|
29847
|
+
init_react_import();
|
29848
|
+
var ZoomOut = createLucideIcon("ZoomOut", [
|
29849
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
29850
|
+
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
29851
|
+
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
|
29852
|
+
]);
|
29853
|
+
|
29656
29854
|
// lib/use-modifier-held.ts
|
29657
29855
|
init_react_import();
|
29658
|
-
var
|
29856
|
+
var import_react6 = require("react");
|
29659
29857
|
var useModifierHeld = (modifier) => {
|
29660
|
-
const [modifierHeld, setModifierHeld] = (0,
|
29661
|
-
(0,
|
29858
|
+
const [modifierHeld, setModifierHeld] = (0, import_react6.useState)(false);
|
29859
|
+
(0, import_react6.useEffect)(() => {
|
29662
29860
|
function downHandler({ key }) {
|
29663
29861
|
if (key === modifier) {
|
29664
29862
|
setModifierHeld(true);
|
@@ -29681,8 +29879,12 @@ var useModifierHeld = (modifier) => {
|
|
29681
29879
|
|
29682
29880
|
// components/DraggableComponent/index.tsx
|
29683
29881
|
var import_react_spinners2 = require("react-spinners");
|
29684
|
-
var
|
29882
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
29685
29883
|
var getClassName4 = get_class_name_factory_default("DraggableComponent", styles_module_default3);
|
29884
|
+
var space = 8;
|
29885
|
+
var actionsOverlayTop = space * 6.5;
|
29886
|
+
var actionsTop = -(actionsOverlayTop - 8);
|
29887
|
+
var actionsRight = space;
|
29686
29888
|
var DraggableComponent = ({
|
29687
29889
|
children,
|
29688
29890
|
id,
|
@@ -29705,91 +29907,74 @@ var DraggableComponent = ({
|
|
29705
29907
|
indicativeHover = false,
|
29706
29908
|
style
|
29707
29909
|
}) => {
|
29910
|
+
const { zoomConfig } = useAppContext();
|
29708
29911
|
const isModifierHeld = useModifierHeld("Alt");
|
29709
|
-
|
29710
|
-
|
29711
|
-
|
29712
|
-
|
29713
|
-
|
29714
|
-
|
29715
|
-
|
29716
|
-
|
29717
|
-
|
29718
|
-
|
29719
|
-
|
29720
|
-
|
29721
|
-
|
29722
|
-
|
29723
|
-
|
29724
|
-
|
29725
|
-
|
29726
|
-
|
29727
|
-
|
29728
|
-
|
29729
|
-
|
29730
|
-
|
29731
|
-
|
29732
|
-
|
29733
|
-
|
29734
|
-
|
29735
|
-
|
29736
|
-
|
29737
|
-
|
29738
|
-
|
29739
|
-
|
29740
|
-
|
29741
|
-
|
29742
|
-
|
29743
|
-
|
29744
|
-
|
29745
|
-
|
29746
|
-
|
29747
|
-
|
29748
|
-
|
29749
|
-
|
29750
|
-
|
29751
|
-
|
29752
|
-
|
29753
|
-
|
29754
|
-
|
29755
|
-
|
29756
|
-
|
29757
|
-
|
29758
|
-
|
29759
|
-
|
29760
|
-
|
29761
|
-
|
29762
|
-
|
29763
|
-
|
29764
|
-
|
29765
|
-
|
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 });
|
29912
|
+
const { status } = useAppContext();
|
29913
|
+
const El = status === "READY" ? import_dnd3.Draggable : DefaultDraggable;
|
29914
|
+
(0, import_react7.useEffect)(onMount, []);
|
29915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
29916
|
+
"div",
|
29917
|
+
__spreadProps(__spreadValues(__spreadValues({
|
29918
|
+
ref: provided.innerRef
|
29919
|
+
}, provided.draggableProps), provided.dragHandleProps), {
|
29920
|
+
className: getClassName4({
|
29921
|
+
isSelected,
|
29922
|
+
isModifierHeld,
|
29923
|
+
isDragging: snapshot.isDragging,
|
29924
|
+
isLocked,
|
29925
|
+
forceHover,
|
29926
|
+
indicativeHover
|
29927
|
+
}),
|
29928
|
+
style: __spreadProps(__spreadValues(__spreadValues({}, style), provided.draggableProps.style), {
|
29929
|
+
cursor: isModifierHeld ? "initial" : "grab"
|
29930
|
+
}),
|
29931
|
+
onMouseOver,
|
29932
|
+
onMouseOut,
|
29933
|
+
onMouseDown,
|
29934
|
+
onMouseUp,
|
29935
|
+
onClick,
|
29936
|
+
children: [
|
29937
|
+
debug,
|
29938
|
+
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" }) }),
|
29939
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
29940
|
+
"div",
|
29941
|
+
{
|
29942
|
+
className: getClassName4("actionsOverlay"),
|
29943
|
+
style: {
|
29944
|
+
top: actionsOverlayTop / zoomConfig.zoom
|
29945
|
+
},
|
29946
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
29947
|
+
"div",
|
29948
|
+
{
|
29949
|
+
className: getClassName4("actions"),
|
29950
|
+
style: {
|
29951
|
+
transform: `scale(${1 / zoomConfig.zoom}`,
|
29952
|
+
top: actionsTop / zoomConfig.zoom,
|
29953
|
+
right: actionsRight / zoomConfig.zoom
|
29954
|
+
},
|
29955
|
+
children: [
|
29956
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("actionsLabel"), children: label }),
|
29957
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDuplicate, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Copy, { size: 16 }) }),
|
29958
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDelete, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Trash, { size: 16 }) })
|
29959
|
+
]
|
29960
|
+
}
|
29961
|
+
)
|
29962
|
+
}
|
29963
|
+
),
|
29964
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("overlay") }),
|
29965
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("contents"), children })
|
29966
|
+
]
|
29967
|
+
})
|
29968
|
+
) }, id);
|
29784
29969
|
};
|
29785
29970
|
|
29786
29971
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
|
29787
29972
|
init_react_import();
|
29788
|
-
var styles_module_default4 = { "DropZone": "
|
29973
|
+
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
29974
|
|
29790
29975
|
// components/DropZone/context.tsx
|
29791
29976
|
init_react_import();
|
29792
|
-
var
|
29977
|
+
var import_react8 = require("react");
|
29793
29978
|
var import_use_debounce = require("use-debounce");
|
29794
29979
|
|
29795
29980
|
// lib/get-zone-id.ts
|
@@ -29805,30 +29990,30 @@ var getZoneId = (zoneCompound) => {
|
|
29805
29990
|
};
|
29806
29991
|
|
29807
29992
|
// components/DropZone/context.tsx
|
29808
|
-
var
|
29809
|
-
var dropZoneContext = (0,
|
29993
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
29994
|
+
var dropZoneContext = (0, import_react8.createContext)(null);
|
29810
29995
|
var DropZoneProvider = ({
|
29811
29996
|
children,
|
29812
29997
|
value
|
29813
29998
|
}) => {
|
29814
|
-
const [hoveringArea, setHoveringArea] = (0,
|
29815
|
-
const [hoveringZone, setHoveringZone] = (0,
|
29999
|
+
const [hoveringArea, setHoveringArea] = (0, import_react8.useState)(null);
|
30000
|
+
const [hoveringZone, setHoveringZone] = (0, import_react8.useState)(
|
29816
30001
|
rootDroppableId
|
29817
30002
|
);
|
29818
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
30003
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react8.useState)();
|
29819
30004
|
const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
|
29820
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
30005
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react8.useState)(
|
29821
30006
|
{}
|
29822
30007
|
);
|
29823
|
-
const [activeZones, setActiveZones] = (0,
|
30008
|
+
const [activeZones, setActiveZones] = (0, import_react8.useState)({});
|
29824
30009
|
const { dispatch = null } = value ? value : {};
|
29825
|
-
const registerZoneArea = (0,
|
30010
|
+
const registerZoneArea = (0, import_react8.useCallback)(
|
29826
30011
|
(area) => {
|
29827
30012
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
29828
30013
|
},
|
29829
30014
|
[setAreasWithZones]
|
29830
30015
|
);
|
29831
|
-
const registerZone = (0,
|
30016
|
+
const registerZone = (0, import_react8.useCallback)(
|
29832
30017
|
(zoneCompound) => {
|
29833
30018
|
if (!dispatch) {
|
29834
30019
|
return;
|
@@ -29841,7 +30026,7 @@ var DropZoneProvider = ({
|
|
29841
30026
|
},
|
29842
30027
|
[setActiveZones, dispatch]
|
29843
30028
|
);
|
29844
|
-
const unregisterZone = (0,
|
30029
|
+
const unregisterZone = (0, import_react8.useCallback)(
|
29845
30030
|
(zoneCompound) => {
|
29846
30031
|
if (!dispatch) {
|
29847
30032
|
return;
|
@@ -29856,8 +30041,8 @@ var DropZoneProvider = ({
|
|
29856
30041
|
},
|
29857
30042
|
[setActiveZones, dispatch]
|
29858
30043
|
);
|
29859
|
-
const [pathData, setPathData] = (0,
|
29860
|
-
const registerPath = (0,
|
30044
|
+
const [pathData, setPathData] = (0, import_react8.useState)();
|
30045
|
+
const registerPath = (0, import_react8.useCallback)(
|
29861
30046
|
(selector) => {
|
29862
30047
|
if (!(value == null ? void 0 : value.data)) {
|
29863
30048
|
return;
|
@@ -29882,7 +30067,8 @@ var DropZoneProvider = ({
|
|
29882
30067
|
},
|
29883
30068
|
[value, setPathData]
|
29884
30069
|
);
|
29885
|
-
|
30070
|
+
const [zoneWillDrag, setZoneWillDrag] = (0, import_react8.useState)("");
|
30071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
29886
30072
|
dropZoneContext.Provider,
|
29887
30073
|
{
|
29888
30074
|
value: __spreadValues({
|
@@ -29898,57 +30084,17 @@ var DropZoneProvider = ({
|
|
29898
30084
|
unregisterZone,
|
29899
30085
|
activeZones,
|
29900
30086
|
registerPath,
|
29901
|
-
pathData
|
30087
|
+
pathData,
|
30088
|
+
zoneWillDrag,
|
30089
|
+
setZoneWillDrag
|
29902
30090
|
}, value),
|
29903
30091
|
children
|
29904
30092
|
}
|
29905
30093
|
) });
|
29906
30094
|
};
|
29907
30095
|
|
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
30096
|
// components/DropZone/index.tsx
|
29951
|
-
var
|
30097
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
29952
30098
|
var getClassName5 = get_class_name_factory_default("DropZone", styles_module_default4);
|
29953
30099
|
function DropZoneEdit({ zone, allow, disallow, style }) {
|
29954
30100
|
var _a;
|
@@ -29967,7 +30113,8 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
29967
30113
|
registerZoneArea,
|
29968
30114
|
areasWithZones,
|
29969
30115
|
hoveringComponent,
|
29970
|
-
|
30116
|
+
zoneWillDrag,
|
30117
|
+
setZoneWillDrag = () => null
|
29971
30118
|
} = ctx || {};
|
29972
30119
|
let content = data.content || [];
|
29973
30120
|
let zoneCompound = rootDroppableId;
|
@@ -29997,12 +30144,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
29997
30144
|
const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
|
29998
30145
|
const [zoneArea] = getZoneId(zoneCompound);
|
29999
30146
|
const [draggedSourceArea] = getZoneId(draggedSourceId);
|
30000
|
-
const
|
30147
|
+
const userWillDrag = zoneWillDrag === zone;
|
30001
30148
|
const userIsDragging = !!draggedItem;
|
30002
30149
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
30003
30150
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
30004
30151
|
if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
|
30005
|
-
return /* @__PURE__ */ (0,
|
30152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: "DropZone requires context to work." });
|
30006
30153
|
}
|
30007
30154
|
const {
|
30008
30155
|
hoveringArea = "root",
|
@@ -30039,7 +30186,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30039
30186
|
}
|
30040
30187
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
30041
30188
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
30042
|
-
return /* @__PURE__ */ (0,
|
30189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30043
30190
|
"div",
|
30044
30191
|
{
|
30045
30192
|
className: getClassName5({
|
@@ -30051,17 +30198,19 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30051
30198
|
isDestination: draggedDestinationId === zoneCompound,
|
30052
30199
|
isDisabled: !isEnabled,
|
30053
30200
|
isAreaSelected,
|
30054
|
-
hasChildren: content.length > 0
|
30055
|
-
zoomEnabled: !disableZoom
|
30201
|
+
hasChildren: content.length > 0
|
30056
30202
|
}),
|
30057
|
-
|
30058
|
-
|
30203
|
+
onMouseUp: () => {
|
30204
|
+
setZoneWillDrag("");
|
30205
|
+
},
|
30206
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30207
|
+
Droppable,
|
30059
30208
|
{
|
30060
30209
|
droppableId: zoneCompound,
|
30061
30210
|
direction: "vertical",
|
30062
30211
|
isDropDisabled: !isEnabled,
|
30063
30212
|
children: (provided, snapshot) => {
|
30064
|
-
return /* @__PURE__ */ (0,
|
30213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
30065
30214
|
"div",
|
30066
30215
|
__spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
|
30067
30216
|
className: getClassName5("content"),
|
@@ -30086,23 +30235,23 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30086
30235
|
"draggable-"
|
30087
30236
|
)[1] === componentId;
|
30088
30237
|
const containsZone = areasWithZones ? areasWithZones[componentId] : false;
|
30089
|
-
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0,
|
30238
|
+
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
30239
|
"No configuration for ",
|
30091
30240
|
item.type
|
30092
30241
|
] });
|
30093
|
-
return /* @__PURE__ */ (0,
|
30242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
30094
30243
|
"div",
|
30095
30244
|
{
|
30096
30245
|
className: getClassName5("item"),
|
30097
30246
|
style: { zIndex: isDragging ? 1 : void 0 },
|
30098
30247
|
children: [
|
30099
|
-
/* @__PURE__ */ (0,
|
30248
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30100
30249
|
DropZoneProvider,
|
30101
30250
|
{
|
30102
30251
|
value: __spreadProps(__spreadValues({}, ctx), {
|
30103
30252
|
areaId: componentId
|
30104
30253
|
}),
|
30105
|
-
children: /* @__PURE__ */ (0,
|
30254
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30106
30255
|
DraggableComponent,
|
30107
30256
|
{
|
30108
30257
|
label: (_b = config.components[item.type]["label"]) != null ? _b : item.type.toString(),
|
@@ -30128,11 +30277,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30128
30277
|
},
|
30129
30278
|
onMouseDown: (e) => {
|
30130
30279
|
e.stopPropagation();
|
30131
|
-
|
30132
|
-
},
|
30133
|
-
onMouseUp: (e) => {
|
30134
|
-
e.stopPropagation();
|
30135
|
-
setUserWillDrag(false);
|
30280
|
+
setZoneWillDrag(zone);
|
30136
30281
|
},
|
30137
30282
|
onMouseOver: (e) => {
|
30138
30283
|
e.stopPropagation();
|
@@ -30173,12 +30318,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30173
30318
|
style: {
|
30174
30319
|
pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
|
30175
30320
|
},
|
30176
|
-
children: /* @__PURE__ */ (0,
|
30321
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName5("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Render2, __spreadValues({}, defaultedProps)) })
|
30177
30322
|
}
|
30178
30323
|
)
|
30179
30324
|
}
|
30180
30325
|
),
|
30181
|
-
userIsDragging && /* @__PURE__ */ (0,
|
30326
|
+
userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30182
30327
|
"div",
|
30183
30328
|
{
|
30184
30329
|
className: getClassName5("hitbox"),
|
@@ -30195,7 +30340,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30195
30340
|
);
|
30196
30341
|
}),
|
30197
30342
|
provided == null ? void 0 : provided.placeholder,
|
30198
|
-
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0,
|
30343
|
+
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30199
30344
|
"div",
|
30200
30345
|
{
|
30201
30346
|
"data-puck-placeholder": true,
|
@@ -30227,14 +30372,14 @@ function DropZoneRender({ zone }) {
|
|
30227
30372
|
zoneCompound = `${areaId}:${zone}`;
|
30228
30373
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
30229
30374
|
}
|
30230
|
-
return /* @__PURE__ */ (0,
|
30375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: content.map((item) => {
|
30231
30376
|
const Component = config.components[item.type];
|
30232
30377
|
if (Component) {
|
30233
|
-
return /* @__PURE__ */ (0,
|
30378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30234
30379
|
DropZoneProvider,
|
30235
30380
|
{
|
30236
30381
|
value: { data, config, areaId: item.props.id },
|
30237
|
-
children: /* @__PURE__ */ (0,
|
30382
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30238
30383
|
Component.render,
|
30239
30384
|
__spreadProps(__spreadValues({}, item.props), {
|
30240
30385
|
puck: { renderDropZone: DropZone }
|
@@ -30250,9 +30395,9 @@ function DropZoneRender({ zone }) {
|
|
30250
30395
|
function DropZone(props) {
|
30251
30396
|
const ctx = (0, import_react9.useContext)(dropZoneContext);
|
30252
30397
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
30253
|
-
return /* @__PURE__ */ (0,
|
30398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneEdit, __spreadValues({}, props));
|
30254
30399
|
}
|
30255
|
-
return /* @__PURE__ */ (0,
|
30400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneRender, __spreadValues({}, props));
|
30256
30401
|
}
|
30257
30402
|
|
30258
30403
|
// components/IconButton/index.ts
|
@@ -30264,11 +30409,11 @@ var import_react10 = require("react");
|
|
30264
30409
|
|
30265
30410
|
// css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
|
30266
30411
|
init_react_import();
|
30267
|
-
var IconButton_module_default = { "IconButton": "
|
30412
|
+
var IconButton_module_default = { "IconButton": "_IconButton_swpni_1", "IconButton--disabled": "_IconButton--disabled_swpni_20", "IconButton-title": "_IconButton-title_swpni_33" };
|
30268
30413
|
|
30269
30414
|
// components/IconButton/IconButton.tsx
|
30270
30415
|
var import_react_spinners3 = require("react-spinners");
|
30271
|
-
var
|
30416
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
30272
30417
|
var getClassName6 = get_class_name_factory_default("IconButton", IconButton_module_default);
|
30273
30418
|
var IconButton = ({
|
30274
30419
|
children,
|
@@ -30284,7 +30429,7 @@ var IconButton = ({
|
|
30284
30429
|
}) => {
|
30285
30430
|
const [loading, setLoading] = (0, import_react10.useState)(false);
|
30286
30431
|
const ElementType = href ? "a" : "button";
|
30287
|
-
const el = /* @__PURE__ */ (0,
|
30432
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
30288
30433
|
ElementType,
|
30289
30434
|
{
|
30290
30435
|
className: getClassName6({
|
@@ -30309,11 +30454,11 @@ var IconButton = ({
|
|
30309
30454
|
href,
|
30310
30455
|
title,
|
30311
30456
|
children: [
|
30312
|
-
/* @__PURE__ */ (0,
|
30457
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: getClassName6("title"), children: title }),
|
30313
30458
|
children,
|
30314
|
-
loading && /* @__PURE__ */ (0,
|
30459
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
30315
30460
|
"\xA0\xA0",
|
30316
|
-
/* @__PURE__ */ (0,
|
30461
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
|
30317
30462
|
] })
|
30318
30463
|
]
|
30319
30464
|
}
|
@@ -30323,8 +30468,7 @@ var IconButton = ({
|
|
30323
30468
|
|
30324
30469
|
// components/Puck/index.tsx
|
30325
30470
|
init_react_import();
|
30326
|
-
var
|
30327
|
-
var import_dnd7 = require("@hello-pangea/dnd");
|
30471
|
+
var import_react28 = require("react");
|
30328
30472
|
|
30329
30473
|
// lib/use-placeholder-style.ts
|
30330
30474
|
init_react_import();
|
@@ -30333,16 +30477,17 @@ var usePlaceholderStyle = () => {
|
|
30333
30477
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
30334
30478
|
const [placeholderStyle, setPlaceholderStyle] = (0, import_react11.useState)();
|
30335
30479
|
const onDragStartOrUpdate = (draggedItem) => {
|
30336
|
-
var _a;
|
30480
|
+
var _a, _b, _c;
|
30337
30481
|
const draggableId = draggedItem.draggableId;
|
30338
30482
|
const destinationIndex = (draggedItem.destination || draggedItem.source).index;
|
30339
30483
|
const droppableId = (draggedItem.destination || draggedItem.source).droppableId;
|
30340
30484
|
const domQuery = `[${queryAttr}='${draggableId}']`;
|
30341
|
-
const
|
30485
|
+
const iframe = document.querySelector(`#preview-iframe`);
|
30486
|
+
const draggedDOM = document.querySelector(domQuery) || ((_a = iframe == null ? void 0 : iframe.contentWindow) == null ? void 0 : _a.document.querySelector(domQuery));
|
30342
30487
|
if (!draggedDOM) {
|
30343
30488
|
return;
|
30344
30489
|
}
|
30345
|
-
const targetListElement = document.querySelector(
|
30490
|
+
const targetListElement = (_b = iframe == null ? void 0 : iframe.contentWindow) == null ? void 0 : _b.document.querySelector(
|
30346
30491
|
`[data-rfd-droppable-id='${droppableId}']`
|
30347
30492
|
);
|
30348
30493
|
const { clientHeight } = draggedDOM;
|
@@ -30350,7 +30495,7 @@ var usePlaceholderStyle = () => {
|
|
30350
30495
|
return;
|
30351
30496
|
}
|
30352
30497
|
let clientY = 0;
|
30353
|
-
const isSameDroppable = draggedItem.source.droppableId === ((
|
30498
|
+
const isSameDroppable = draggedItem.source.droppableId === ((_c = draggedItem.destination) == null ? void 0 : _c.droppableId);
|
30354
30499
|
if (destinationIndex > 0) {
|
30355
30500
|
const end = destinationIndex > draggedItem.source.index && isSameDroppable ? destinationIndex + 1 : destinationIndex;
|
30356
30501
|
const children = Array.from(targetListElement.children).filter(
|
@@ -30389,11 +30534,11 @@ init_react_import();
|
|
30389
30534
|
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
30535
|
|
30391
30536
|
// components/Heading/index.tsx
|
30392
|
-
var
|
30537
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
30393
30538
|
var getClassName7 = get_class_name_factory_default("Heading", styles_module_default6);
|
30394
30539
|
var Heading = ({ children, rank, size = "m" }) => {
|
30395
30540
|
const Tag = rank ? `h${rank}` : "span";
|
30396
|
-
return /* @__PURE__ */ (0,
|
30541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
30397
30542
|
Tag,
|
30398
30543
|
{
|
30399
30544
|
className: getClassName7({
|
@@ -30472,7 +30617,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
30472
30617
|
|
30473
30618
|
// components/SidebarSection/index.tsx
|
30474
30619
|
var import_react_spinners4 = require("react-spinners");
|
30475
|
-
var
|
30620
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
30476
30621
|
var getClassName8 = get_class_name_factory_default("SidebarSection", styles_module_default5);
|
30477
30622
|
var SidebarSection = ({
|
30478
30623
|
children,
|
@@ -30485,15 +30630,15 @@ var SidebarSection = ({
|
|
30485
30630
|
}) => {
|
30486
30631
|
const { setUi } = useAppContext();
|
30487
30632
|
const breadcrumbs = useBreadcrumbs(1);
|
30488
|
-
return /* @__PURE__ */ (0,
|
30633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
30489
30634
|
"div",
|
30490
30635
|
{
|
30491
30636
|
className: getClassName8({ noBorderTop, noPadding }),
|
30492
30637
|
style: { background },
|
30493
30638
|
children: [
|
30494
|
-
/* @__PURE__ */ (0,
|
30495
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
30496
|
-
/* @__PURE__ */ (0,
|
30639
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("title"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName8("breadcrumbs"), children: [
|
30640
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName8("breadcrumb"), children: [
|
30641
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
30497
30642
|
"button",
|
30498
30643
|
{
|
30499
30644
|
className: getClassName8("breadcrumbLabel"),
|
@@ -30501,12 +30646,12 @@ var SidebarSection = ({
|
|
30501
30646
|
children: breadcrumb.label
|
30502
30647
|
}
|
30503
30648
|
),
|
30504
|
-
/* @__PURE__ */ (0,
|
30649
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronRight, { size: 16 })
|
30505
30650
|
] }, i)) : null,
|
30506
|
-
/* @__PURE__ */ (0,
|
30651
|
+
/* @__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
30652
|
] }) }),
|
30508
|
-
/* @__PURE__ */ (0,
|
30509
|
-
isLoading && /* @__PURE__ */ (0,
|
30653
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("content"), children }),
|
30654
|
+
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
30655
|
]
|
30511
30656
|
}
|
30512
30657
|
);
|
@@ -31088,7 +31233,7 @@ init_react_import();
|
|
31088
31233
|
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
31234
|
|
31090
31235
|
// components/MenuBar/index.tsx
|
31091
|
-
var
|
31236
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
31092
31237
|
var getClassName9 = get_class_name_factory_default("MenuBar", styles_module_default7);
|
31093
31238
|
var MenuBar = ({
|
31094
31239
|
appState,
|
@@ -31103,7 +31248,7 @@ var MenuBar = ({
|
|
31103
31248
|
history: { back, forward, historyStore }
|
31104
31249
|
} = useAppContext();
|
31105
31250
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
31106
|
-
return /* @__PURE__ */ (0,
|
31251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31107
31252
|
"div",
|
31108
31253
|
{
|
31109
31254
|
className: getClassName9({ menuOpen }),
|
@@ -31117,16 +31262,16 @@ var MenuBar = ({
|
|
31117
31262
|
setMenuOpen(false);
|
31118
31263
|
}
|
31119
31264
|
},
|
31120
|
-
children: /* @__PURE__ */ (0,
|
31121
|
-
/* @__PURE__ */ (0,
|
31122
|
-
/* @__PURE__ */ (0,
|
31265
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName9("inner"), children: [
|
31266
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName9("history"), children: [
|
31267
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31123
31268
|
ChevronLeft,
|
31124
31269
|
{
|
31125
31270
|
size: 21,
|
31126
31271
|
stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
|
31127
31272
|
}
|
31128
31273
|
) }),
|
31129
|
-
/* @__PURE__ */ (0,
|
31274
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31130
31275
|
ChevronRight,
|
31131
31276
|
{
|
31132
31277
|
size: 21,
|
@@ -31134,17 +31279,17 @@ var MenuBar = ({
|
|
31134
31279
|
}
|
31135
31280
|
) })
|
31136
31281
|
] }),
|
31137
|
-
/* @__PURE__ */ (0,
|
31282
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
31138
31283
|
state: appState,
|
31139
31284
|
dispatch
|
31140
31285
|
}) }),
|
31141
|
-
/* @__PURE__ */ (0,
|
31286
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31142
31287
|
Button,
|
31143
31288
|
{
|
31144
31289
|
onClick: () => {
|
31145
31290
|
onPublish && onPublish(data);
|
31146
31291
|
},
|
31147
|
-
icon: /* @__PURE__ */ (0,
|
31292
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Globe, { size: "14px" }),
|
31148
31293
|
children: "Publish"
|
31149
31294
|
}
|
31150
31295
|
) })
|
@@ -31155,7 +31300,7 @@ var MenuBar = ({
|
|
31155
31300
|
|
31156
31301
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
31157
31302
|
init_react_import();
|
31158
|
-
var styles_module_default8 = { "Puck": "
|
31303
|
+
var styles_module_default8 = { "Puck": "_Puck_3qn7l_19", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_3qn7l_36", "Puck--rightSideBarVisible": "_Puck--rightSideBarVisible_3qn7l_42", "Puck-header": "_Puck-header_3qn7l_96", "Puck-headerInner": "_Puck-headerInner_3qn7l_105", "Puck-headerToggle": "_Puck-headerToggle_3qn7l_115", "Puck-rightSideBarToggle": "_Puck-rightSideBarToggle_3qn7l_122", "Puck-leftSideBarToggle": "_Puck-leftSideBarToggle_3qn7l_123", "Puck-headerTitle": "_Puck-headerTitle_3qn7l_127", "Puck-headerPath": "_Puck-headerPath_3qn7l_131", "Puck-headerTools": "_Puck-headerTools_3qn7l_138", "Puck-menuButton": "_Puck-menuButton_3qn7l_144", "Puck--menuOpen": "_Puck--menuOpen_3qn7l_149", "Puck-leftSideBar": "_Puck-leftSideBar_3qn7l_123", "Puck-frame": "_Puck-frame_3qn7l_168", "Puck-root": "_Puck-root_3qn7l_179", "Puck-rightSideBar": "_Puck-rightSideBar_3qn7l_122", "Puck-canvas": "_Puck-canvas_3qn7l_211", "Puck-canvasControls": "_Puck-canvasControls_3qn7l_226" };
|
31159
31304
|
|
31160
31305
|
// components/Puck/components/Fields/index.tsx
|
31161
31306
|
init_react_import();
|
@@ -31182,10 +31327,21 @@ init_react_import();
|
|
31182
31327
|
var styles_module_default10 = { "ArrayField": "_ArrayField_1txra_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1txra_13", "ArrayField-addButton": "_ArrayField-addButton_1txra_17", "ArrayField--hasItems": "_ArrayField--hasItems_1txra_32", "ArrayFieldItem": "_ArrayFieldItem_1txra_61", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1txra_69", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1txra_74", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1txra_84", "ArrayFieldItem--readOnly": "_ArrayFieldItem--readOnly_1txra_108", "ArrayFieldItem-body": "_ArrayFieldItem-body_1txra_142", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1txra_150", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1txra_157", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1txra_163" };
|
31183
31328
|
|
31184
31329
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
31185
|
-
var import_dnd5 = require("@hello-pangea/dnd");
|
31186
|
-
var import_dnd6 = require("@hello-pangea/dnd");
|
31187
31330
|
var import_react14 = require("react");
|
31188
|
-
|
31331
|
+
|
31332
|
+
// components/DragDropContext/index.tsx
|
31333
|
+
init_react_import();
|
31334
|
+
var import_dnd4 = require("@measured/dnd");
|
31335
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
31336
|
+
var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children });
|
31337
|
+
var DragDropContext = (props) => {
|
31338
|
+
const { status } = useAppContext();
|
31339
|
+
const El = status === "READY" ? import_dnd4.DragDropContext : DefaultDragDropContext;
|
31340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(El, __spreadValues({}, props));
|
31341
|
+
};
|
31342
|
+
|
31343
|
+
// components/InputOrGroup/fields/ArrayField/index.tsx
|
31344
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
31189
31345
|
var getClassName10 = get_class_name_factory_default("ArrayField", styles_module_default10);
|
31190
31346
|
var getClassNameItem2 = get_class_name_factory_default("ArrayFieldItem", styles_module_default10);
|
31191
31347
|
var ArrayField = ({
|
@@ -31255,15 +31411,15 @@ var ArrayField = ({
|
|
31255
31411
|
if (field.type !== "array" || !field.arrayFields) {
|
31256
31412
|
return null;
|
31257
31413
|
}
|
31258
|
-
return /* @__PURE__ */ (0,
|
31414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31259
31415
|
FieldLabelInternal,
|
31260
31416
|
{
|
31261
31417
|
label: label || name,
|
31262
|
-
icon: /* @__PURE__ */ (0,
|
31418
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(List, { size: 16 }),
|
31263
31419
|
el: "div",
|
31264
31420
|
readOnly,
|
31265
|
-
children: /* @__PURE__ */ (0,
|
31266
|
-
|
31421
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31422
|
+
DragDropContext,
|
31267
31423
|
{
|
31268
31424
|
onDragEnd: (event) => {
|
31269
31425
|
var _a, _b;
|
@@ -31289,8 +31445,8 @@ var ArrayField = ({
|
|
31289
31445
|
});
|
31290
31446
|
}
|
31291
31447
|
},
|
31292
|
-
children: /* @__PURE__ */ (0,
|
31293
|
-
return /* @__PURE__ */ (0,
|
31448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
|
31449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
31294
31450
|
"div",
|
31295
31451
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
31296
31452
|
ref: provided.innerRef,
|
@@ -31310,7 +31466,7 @@ var ArrayField = ({
|
|
31310
31466
|
localState.arrayState.items.map((item, i) => {
|
31311
31467
|
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
31312
31468
|
const data = Array.from(localState.value || [])[i] || {};
|
31313
|
-
return /* @__PURE__ */ (0,
|
31469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31314
31470
|
Draggable,
|
31315
31471
|
{
|
31316
31472
|
id: _arrayId,
|
@@ -31321,8 +31477,8 @@ var ArrayField = ({
|
|
31321
31477
|
readOnly
|
31322
31478
|
}),
|
31323
31479
|
isDragDisabled: readOnly || !hovering,
|
31324
|
-
children: () => /* @__PURE__ */ (0,
|
31325
|
-
/* @__PURE__ */ (0,
|
31480
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
31481
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
31326
31482
|
"div",
|
31327
31483
|
{
|
31328
31484
|
onClick: () => {
|
@@ -31343,8 +31499,8 @@ var ArrayField = ({
|
|
31343
31499
|
className: getClassNameItem2("summary"),
|
31344
31500
|
children: [
|
31345
31501
|
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
31346
|
-
/* @__PURE__ */ (0,
|
31347
|
-
!readOnly && /* @__PURE__ */ (0,
|
31502
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameItem2("rhs"), children: [
|
31503
|
+
!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
31504
|
IconButton,
|
31349
31505
|
{
|
31350
31506
|
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
@@ -31366,20 +31522,20 @@ var ArrayField = ({
|
|
31366
31522
|
);
|
31367
31523
|
},
|
31368
31524
|
title: "Delete",
|
31369
|
-
children: /* @__PURE__ */ (0,
|
31525
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Trash, { size: 16 })
|
31370
31526
|
}
|
31371
31527
|
) }) }),
|
31372
|
-
/* @__PURE__ */ (0,
|
31528
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DragIcon, {}) })
|
31373
31529
|
] })
|
31374
31530
|
]
|
31375
31531
|
}
|
31376
31532
|
),
|
31377
|
-
/* @__PURE__ */ (0,
|
31533
|
+
/* @__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
31534
|
(fieldName) => {
|
31379
31535
|
const subField = field.arrayFields[fieldName];
|
31380
31536
|
const subFieldName = `${name}[${i}].${fieldName}`;
|
31381
31537
|
const wildcardFieldName = `${name}[*].${fieldName}`;
|
31382
|
-
return /* @__PURE__ */ (0,
|
31538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31383
31539
|
InputOrGroup,
|
31384
31540
|
{
|
31385
31541
|
name: subFieldName,
|
@@ -31408,7 +31564,7 @@ var ArrayField = ({
|
|
31408
31564
|
);
|
31409
31565
|
}),
|
31410
31566
|
provided.placeholder,
|
31411
|
-
/* @__PURE__ */ (0,
|
31567
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31412
31568
|
"button",
|
31413
31569
|
{
|
31414
31570
|
className: getClassName10("addButton"),
|
@@ -31422,7 +31578,7 @@ var ArrayField = ({
|
|
31422
31578
|
const newArrayState = regenerateArrayState(newValue);
|
31423
31579
|
onChange(newValue, mapArrayStateToUi(newArrayState));
|
31424
31580
|
},
|
31425
|
-
children: /* @__PURE__ */ (0,
|
31581
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Plus, { size: 21 })
|
31426
31582
|
}
|
31427
31583
|
)
|
31428
31584
|
]
|
@@ -31437,7 +31593,7 @@ var ArrayField = ({
|
|
31437
31593
|
|
31438
31594
|
// components/InputOrGroup/fields/DefaultField/index.tsx
|
31439
31595
|
init_react_import();
|
31440
|
-
var
|
31596
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
31441
31597
|
var getClassName11 = get_class_name_factory_default("Input", styles_module_default9);
|
31442
31598
|
var DefaultField = ({
|
31443
31599
|
field,
|
@@ -31448,16 +31604,16 @@ var DefaultField = ({
|
|
31448
31604
|
label,
|
31449
31605
|
id
|
31450
31606
|
}) => {
|
31451
|
-
return /* @__PURE__ */ (0,
|
31607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
31452
31608
|
FieldLabelInternal,
|
31453
31609
|
{
|
31454
31610
|
label: label || name,
|
31455
|
-
icon: /* @__PURE__ */ (0,
|
31456
|
-
field.type === "text" && /* @__PURE__ */ (0,
|
31457
|
-
field.type === "number" && /* @__PURE__ */ (0,
|
31611
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
31612
|
+
field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Type, { size: 16 }),
|
31613
|
+
field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Hash, { size: 16 })
|
31458
31614
|
] }),
|
31459
31615
|
readOnly,
|
31460
|
-
children: /* @__PURE__ */ (0,
|
31616
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
31461
31617
|
"input",
|
31462
31618
|
{
|
31463
31619
|
className: getClassName11("input"),
|
@@ -31493,7 +31649,7 @@ var import_react16 = require("react");
|
|
31493
31649
|
|
31494
31650
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
31495
31651
|
init_react_import();
|
31496
|
-
var styles_module_default11 = { "ExternalInput-actions": "_ExternalInput-
|
31652
|
+
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
31653
|
|
31498
31654
|
// components/Modal/index.tsx
|
31499
31655
|
init_react_import();
|
@@ -31501,11 +31657,11 @@ var import_react15 = require("react");
|
|
31501
31657
|
|
31502
31658
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
31503
31659
|
init_react_import();
|
31504
|
-
var styles_module_default12 = { "Modal": "
|
31660
|
+
var styles_module_default12 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Modal--isOpen_ikbaj_15", "Modal-inner": "_Modal-inner_ikbaj_19" };
|
31505
31661
|
|
31506
31662
|
// components/Modal/index.tsx
|
31507
31663
|
var import_react_dom = __toESM(require_react_dom());
|
31508
|
-
var
|
31664
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
31509
31665
|
var getClassName12 = get_class_name_factory_default("Modal", styles_module_default12);
|
31510
31666
|
var Modal = ({
|
31511
31667
|
children,
|
@@ -31517,10 +31673,10 @@ var Modal = ({
|
|
31517
31673
|
setRootEl(document.getElementById("puck-portal-root"));
|
31518
31674
|
}, []);
|
31519
31675
|
if (!rootEl) {
|
31520
|
-
return /* @__PURE__ */ (0,
|
31676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", {});
|
31521
31677
|
}
|
31522
31678
|
return (0, import_react_dom.createPortal)(
|
31523
|
-
/* @__PURE__ */ (0,
|
31679
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
31524
31680
|
"div",
|
31525
31681
|
{
|
31526
31682
|
className: getClassName12("inner"),
|
@@ -31534,7 +31690,7 @@ var Modal = ({
|
|
31534
31690
|
|
31535
31691
|
// components/ExternalInput/index.tsx
|
31536
31692
|
var import_react_spinners5 = require("react-spinners");
|
31537
|
-
var
|
31693
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
31538
31694
|
var getClassName13 = get_class_name_factory_default("ExternalInput", styles_module_default11);
|
31539
31695
|
var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default11);
|
31540
31696
|
var dataCache = {};
|
@@ -31587,7 +31743,7 @@ var ExternalInput = ({
|
|
31587
31743
|
(0, import_react16.useEffect)(() => {
|
31588
31744
|
search(searchQuery, filters);
|
31589
31745
|
}, []);
|
31590
|
-
return /* @__PURE__ */ (0,
|
31746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
31591
31747
|
"div",
|
31592
31748
|
{
|
31593
31749
|
className: getClassName13({
|
@@ -31596,30 +31752,30 @@ var ExternalInput = ({
|
|
31596
31752
|
}),
|
31597
31753
|
id,
|
31598
31754
|
children: [
|
31599
|
-
/* @__PURE__ */ (0,
|
31600
|
-
/* @__PURE__ */ (0,
|
31755
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName13("actions"), children: [
|
31756
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31601
31757
|
"button",
|
31602
31758
|
{
|
31603
31759
|
onClick: () => setOpen(true),
|
31604
31760
|
className: getClassName13("button"),
|
31605
|
-
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0,
|
31606
|
-
/* @__PURE__ */ (0,
|
31607
|
-
/* @__PURE__ */ (0,
|
31761
|
+
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
31762
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Link, { size: "16" }),
|
31763
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: field.placeholder })
|
31608
31764
|
] })
|
31609
31765
|
}
|
31610
31766
|
),
|
31611
|
-
value && /* @__PURE__ */ (0,
|
31767
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31612
31768
|
"button",
|
31613
31769
|
{
|
31614
31770
|
className: getClassName13("detachButton"),
|
31615
31771
|
onClick: () => {
|
31616
31772
|
onChange(null);
|
31617
31773
|
},
|
31618
|
-
children: /* @__PURE__ */ (0,
|
31774
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Unlock, { size: 16 })
|
31619
31775
|
}
|
31620
31776
|
)
|
31621
31777
|
] }),
|
31622
|
-
/* @__PURE__ */ (0,
|
31778
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
31623
31779
|
"form",
|
31624
31780
|
{
|
31625
31781
|
className: getClassNameModal({
|
@@ -31633,11 +31789,11 @@ var ExternalInput = ({
|
|
31633
31789
|
search(searchQuery, filters);
|
31634
31790
|
},
|
31635
31791
|
children: [
|
31636
|
-
/* @__PURE__ */ (0,
|
31637
|
-
/* @__PURE__ */ (0,
|
31638
|
-
/* @__PURE__ */ (0,
|
31639
|
-
/* @__PURE__ */ (0,
|
31640
|
-
/* @__PURE__ */ (0,
|
31792
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
|
31793
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: getClassNameModal("search"), children: [
|
31794
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
|
31795
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Search, { size: "18" }) }),
|
31796
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31641
31797
|
"input",
|
31642
31798
|
{
|
31643
31799
|
className: getClassNameModal("searchInput"),
|
@@ -31652,9 +31808,9 @@ var ExternalInput = ({
|
|
31652
31808
|
}
|
31653
31809
|
)
|
31654
31810
|
] }),
|
31655
|
-
/* @__PURE__ */ (0,
|
31656
|
-
/* @__PURE__ */ (0,
|
31657
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
31811
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
|
31812
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
|
31813
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31658
31814
|
IconButton,
|
31659
31815
|
{
|
31660
31816
|
title: "Toggle filters",
|
@@ -31663,15 +31819,15 @@ var ExternalInput = ({
|
|
31663
31819
|
e.stopPropagation();
|
31664
31820
|
setFiltersToggled(!filtersToggled);
|
31665
31821
|
},
|
31666
|
-
children: /* @__PURE__ */ (0,
|
31822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SlidersHorizontal, { size: 20 })
|
31667
31823
|
}
|
31668
31824
|
) })
|
31669
31825
|
] })
|
31670
|
-
] }) : /* @__PURE__ */ (0,
|
31671
|
-
/* @__PURE__ */ (0,
|
31672
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
31826
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
|
31827
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("grid"), children: [
|
31828
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
|
31673
31829
|
const filterField = filterFields[fieldName];
|
31674
|
-
return /* @__PURE__ */ (0,
|
31830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31675
31831
|
InputOrGroup,
|
31676
31832
|
{
|
31677
31833
|
field: filterField,
|
@@ -31688,9 +31844,9 @@ var ExternalInput = ({
|
|
31688
31844
|
fieldName
|
31689
31845
|
);
|
31690
31846
|
}) }),
|
31691
|
-
/* @__PURE__ */ (0,
|
31692
|
-
/* @__PURE__ */ (0,
|
31693
|
-
/* @__PURE__ */ (0,
|
31847
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
|
31848
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("table", { className: getClassNameModal("table"), children: [
|
31849
|
+
/* @__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
31850
|
"th",
|
31695
31851
|
{
|
31696
31852
|
className: getClassNameModal("th"),
|
@@ -31699,8 +31855,8 @@ var ExternalInput = ({
|
|
31699
31855
|
},
|
31700
31856
|
key
|
31701
31857
|
)) }) }),
|
31702
|
-
/* @__PURE__ */ (0,
|
31703
|
-
return /* @__PURE__ */ (0,
|
31858
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
|
31859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31704
31860
|
"tr",
|
31705
31861
|
{
|
31706
31862
|
style: { whiteSpace: "nowrap" },
|
@@ -31709,16 +31865,16 @@ var ExternalInput = ({
|
|
31709
31865
|
onChange(mapProp(data[i]));
|
31710
31866
|
setOpen(false);
|
31711
31867
|
},
|
31712
|
-
children: keys.map((key) => /* @__PURE__ */ (0,
|
31868
|
+
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
31713
31869
|
},
|
31714
31870
|
i
|
31715
31871
|
);
|
31716
31872
|
}) })
|
31717
31873
|
] }),
|
31718
|
-
/* @__PURE__ */ (0,
|
31874
|
+
/* @__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
31875
|
] })
|
31720
31876
|
] }),
|
31721
|
-
/* @__PURE__ */ (0,
|
31877
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("footer"), children: [
|
31722
31878
|
mappedData.length,
|
31723
31879
|
" result",
|
31724
31880
|
mappedData.length === 1 ? "" : "s"
|
@@ -31732,7 +31888,7 @@ var ExternalInput = ({
|
|
31732
31888
|
};
|
31733
31889
|
|
31734
31890
|
// components/InputOrGroup/fields/ExternalField/index.tsx
|
31735
|
-
var
|
31891
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
31736
31892
|
var ExternalField = ({
|
31737
31893
|
field,
|
31738
31894
|
onChange,
|
@@ -31754,13 +31910,13 @@ var ExternalField = ({
|
|
31754
31910
|
if (field.type !== "external") {
|
31755
31911
|
return null;
|
31756
31912
|
}
|
31757
|
-
return /* @__PURE__ */ (0,
|
31913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
31758
31914
|
FieldLabelInternal,
|
31759
31915
|
{
|
31760
31916
|
label: label || name,
|
31761
|
-
icon: /* @__PURE__ */ (0,
|
31917
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Link, { size: 16 }),
|
31762
31918
|
el: "div",
|
31763
|
-
children: /* @__PURE__ */ (0,
|
31919
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
31764
31920
|
ExternalInput,
|
31765
31921
|
{
|
31766
31922
|
name,
|
@@ -31786,7 +31942,7 @@ var ExternalField = ({
|
|
31786
31942
|
|
31787
31943
|
// components/InputOrGroup/fields/RadioField/index.tsx
|
31788
31944
|
init_react_import();
|
31789
|
-
var
|
31945
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
31790
31946
|
var getClassName14 = get_class_name_factory_default("Input", styles_module_default9);
|
31791
31947
|
var RadioField = ({
|
31792
31948
|
field,
|
@@ -31800,19 +31956,19 @@ var RadioField = ({
|
|
31800
31956
|
if (field.type !== "radio" || !field.options) {
|
31801
31957
|
return null;
|
31802
31958
|
}
|
31803
|
-
return /* @__PURE__ */ (0,
|
31959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
31804
31960
|
FieldLabelInternal,
|
31805
31961
|
{
|
31806
|
-
icon: /* @__PURE__ */ (0,
|
31962
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CheckCircle, { size: 16 }),
|
31807
31963
|
label: label || name,
|
31808
31964
|
readOnly,
|
31809
31965
|
el: "div",
|
31810
|
-
children: /* @__PURE__ */ (0,
|
31966
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
31811
31967
|
"label",
|
31812
31968
|
{
|
31813
31969
|
className: getClassName14("radio"),
|
31814
31970
|
children: [
|
31815
|
-
/* @__PURE__ */ (0,
|
31971
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
31816
31972
|
"input",
|
31817
31973
|
{
|
31818
31974
|
type: "radio",
|
@@ -31830,7 +31986,7 @@ var RadioField = ({
|
|
31830
31986
|
defaultChecked: value === option.value
|
31831
31987
|
}
|
31832
31988
|
),
|
31833
|
-
/* @__PURE__ */ (0,
|
31989
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
|
31834
31990
|
]
|
31835
31991
|
},
|
31836
31992
|
option.label + option.value
|
@@ -31841,7 +31997,7 @@ var RadioField = ({
|
|
31841
31997
|
|
31842
31998
|
// components/InputOrGroup/fields/SelectField/index.tsx
|
31843
31999
|
init_react_import();
|
31844
|
-
var
|
32000
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
31845
32001
|
var getClassName15 = get_class_name_factory_default("Input", styles_module_default9);
|
31846
32002
|
var SelectField = ({
|
31847
32003
|
field,
|
@@ -31855,13 +32011,13 @@ var SelectField = ({
|
|
31855
32011
|
if (field.type !== "select" || !field.options) {
|
31856
32012
|
return null;
|
31857
32013
|
}
|
31858
|
-
return /* @__PURE__ */ (0,
|
32014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
31859
32015
|
FieldLabelInternal,
|
31860
32016
|
{
|
31861
32017
|
label: label || name,
|
31862
|
-
icon: /* @__PURE__ */ (0,
|
32018
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChevronDown, { size: 16 }),
|
31863
32019
|
readOnly,
|
31864
|
-
children: /* @__PURE__ */ (0,
|
32020
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
31865
32021
|
"select",
|
31866
32022
|
{
|
31867
32023
|
id,
|
@@ -31875,7 +32031,7 @@ var SelectField = ({
|
|
31875
32031
|
onChange(e.currentTarget.value);
|
31876
32032
|
},
|
31877
32033
|
value,
|
31878
|
-
children: field.options.map((option) => /* @__PURE__ */ (0,
|
32034
|
+
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
31879
32035
|
"option",
|
31880
32036
|
{
|
31881
32037
|
label: option.label,
|
@@ -31891,7 +32047,7 @@ var SelectField = ({
|
|
31891
32047
|
|
31892
32048
|
// components/InputOrGroup/fields/TextareaField/index.tsx
|
31893
32049
|
init_react_import();
|
31894
|
-
var
|
32050
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
31895
32051
|
var getClassName16 = get_class_name_factory_default("Input", styles_module_default9);
|
31896
32052
|
var TextareaField = ({
|
31897
32053
|
onChange,
|
@@ -31901,13 +32057,13 @@ var TextareaField = ({
|
|
31901
32057
|
label,
|
31902
32058
|
id
|
31903
32059
|
}) => {
|
31904
|
-
return /* @__PURE__ */ (0,
|
32060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
31905
32061
|
FieldLabelInternal,
|
31906
32062
|
{
|
31907
32063
|
label: label || name,
|
31908
|
-
icon: /* @__PURE__ */ (0,
|
32064
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Type, { size: 16 }),
|
31909
32065
|
readOnly,
|
31910
|
-
children: /* @__PURE__ */ (0,
|
32066
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
31911
32067
|
"textarea",
|
31912
32068
|
{
|
31913
32069
|
id,
|
@@ -31936,7 +32092,7 @@ init_react_import();
|
|
31936
32092
|
var styles_module_default13 = { "ObjectField": "_ObjectField_15j63_5", "ObjectField-fieldset": "_ObjectField-fieldset_15j63_13" };
|
31937
32093
|
|
31938
32094
|
// components/InputOrGroup/fields/ObjectField/index.tsx
|
31939
|
-
var
|
32095
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
31940
32096
|
var getClassName17 = get_class_name_factory_default("ObjectField", styles_module_default13);
|
31941
32097
|
var getClassNameItem3 = get_class_name_factory_default("ObjectFieldItem", styles_module_default13);
|
31942
32098
|
var ObjectField = ({
|
@@ -31953,18 +32109,18 @@ var ObjectField = ({
|
|
31953
32109
|
return null;
|
31954
32110
|
}
|
31955
32111
|
const data = value || {};
|
31956
|
-
return /* @__PURE__ */ (0,
|
32112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
31957
32113
|
FieldLabelInternal,
|
31958
32114
|
{
|
31959
32115
|
label: label || name,
|
31960
|
-
icon: /* @__PURE__ */ (0,
|
32116
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MoreVertical, { size: 16 }),
|
31961
32117
|
el: "div",
|
31962
32118
|
readOnly,
|
31963
|
-
children: /* @__PURE__ */ (0,
|
32119
|
+
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
32120
|
const subField = field.objectFields[fieldName];
|
31965
32121
|
const subFieldName = `${name}.${fieldName}`;
|
31966
32122
|
const wildcardFieldName = `${name}.${fieldName}`;
|
31967
|
-
return /* @__PURE__ */ (0,
|
32123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
31968
32124
|
InputOrGroup,
|
31969
32125
|
{
|
31970
32126
|
name: subFieldName,
|
@@ -31991,7 +32147,7 @@ var ObjectField = ({
|
|
31991
32147
|
};
|
31992
32148
|
|
31993
32149
|
// components/InputOrGroup/index.tsx
|
31994
|
-
var
|
32150
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
31995
32151
|
var getClassName18 = get_class_name_factory_default("Input", styles_module_default9);
|
31996
32152
|
var FieldLabel = ({
|
31997
32153
|
children,
|
@@ -32002,11 +32158,11 @@ var FieldLabel = ({
|
|
32002
32158
|
className
|
32003
32159
|
}) => {
|
32004
32160
|
const El = el;
|
32005
|
-
return /* @__PURE__ */ (0,
|
32006
|
-
/* @__PURE__ */ (0,
|
32007
|
-
icon ? /* @__PURE__ */ (0,
|
32161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(El, { className, children: [
|
32162
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName18("label"), children: [
|
32163
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, {}),
|
32008
32164
|
label,
|
32009
|
-
readOnly && /* @__PURE__ */ (0,
|
32165
|
+
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
32166
|
] }),
|
32011
32167
|
children
|
32012
32168
|
] });
|
@@ -32023,7 +32179,7 @@ var FieldLabelInternal = ({
|
|
32023
32179
|
() => overrides.fieldLabel || FieldLabel,
|
32024
32180
|
[overrides]
|
32025
32181
|
);
|
32026
|
-
return /* @__PURE__ */ (0,
|
32182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
32027
32183
|
Wrapper,
|
32028
32184
|
{
|
32029
32185
|
label,
|
@@ -32063,7 +32219,7 @@ var InputOrGroup = (_a) => {
|
|
32063
32219
|
if (!field.render) {
|
32064
32220
|
return null;
|
32065
32221
|
}
|
32066
|
-
return /* @__PURE__ */ (0,
|
32222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
|
32067
32223
|
field,
|
32068
32224
|
name,
|
32069
32225
|
readOnly
|
@@ -32092,7 +32248,7 @@ var InputOrGroup = (_a) => {
|
|
32092
32248
|
const mergedProps = __spreadProps(__spreadValues(__spreadValues({}, props), localProps), { field });
|
32093
32249
|
const children = defaultFields[field.type](mergedProps);
|
32094
32250
|
const Render2 = render[field.type];
|
32095
|
-
return /* @__PURE__ */ (0,
|
32251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
|
32096
32252
|
};
|
32097
32253
|
|
32098
32254
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
|
@@ -32101,7 +32257,7 @@ var styles_module_default14 = { "PuckFields": "_PuckFields_17k3p_1", "PuckFields
|
|
32101
32257
|
|
32102
32258
|
// components/Puck/components/Fields/index.tsx
|
32103
32259
|
var import_react19 = require("react");
|
32104
|
-
var
|
32260
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
32105
32261
|
var getClassName19 = get_class_name_factory_default("PuckFields", styles_module_default14);
|
32106
32262
|
var defaultPageFields = {
|
32107
32263
|
title: { type: "text" }
|
@@ -32110,9 +32266,9 @@ var DefaultFields = ({
|
|
32110
32266
|
children,
|
32111
32267
|
isLoading
|
32112
32268
|
}) => {
|
32113
|
-
return /* @__PURE__ */ (0,
|
32269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19(), children: [
|
32114
32270
|
children,
|
32115
|
-
isLoading && /* @__PURE__ */ (0,
|
32271
|
+
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
32272
|
] });
|
32117
32273
|
};
|
32118
32274
|
var Fields = () => {
|
@@ -32133,14 +32289,14 @@ var Fields = () => {
|
|
32133
32289
|
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
32290
|
const rootProps = data.root.props || data.root;
|
32135
32291
|
const Wrapper = (0, import_react19.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
32136
|
-
return /* @__PURE__ */ (0,
|
32292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
32137
32293
|
"form",
|
32138
32294
|
{
|
32139
32295
|
className: getClassName19(),
|
32140
32296
|
onSubmit: (e) => {
|
32141
32297
|
e.preventDefault();
|
32142
32298
|
},
|
32143
|
-
children: /* @__PURE__ */ (0,
|
32299
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
32144
32300
|
const field = fields[fieldName];
|
32145
32301
|
const onChange = (value, updatedUi) => {
|
32146
32302
|
var _a2, _b2;
|
@@ -32206,7 +32362,7 @@ var Fields = () => {
|
|
32206
32362
|
};
|
32207
32363
|
if (selectedItem && itemSelector) {
|
32208
32364
|
const { readOnly = {} } = selectedItem;
|
32209
|
-
return /* @__PURE__ */ (0,
|
32365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
32210
32366
|
InputOrGroup,
|
32211
32367
|
{
|
32212
32368
|
field,
|
@@ -32222,7 +32378,7 @@ var Fields = () => {
|
|
32222
32378
|
);
|
32223
32379
|
} else {
|
32224
32380
|
const { readOnly = {} } = data.root;
|
32225
|
-
return /* @__PURE__ */ (0,
|
32381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
32226
32382
|
InputOrGroup,
|
32227
32383
|
{
|
32228
32384
|
field,
|
@@ -32257,7 +32413,7 @@ init_react_import();
|
|
32257
32413
|
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
32414
|
|
32259
32415
|
// components/ComponentList/index.tsx
|
32260
|
-
var
|
32416
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
32261
32417
|
var getClassName20 = get_class_name_factory_default("ComponentList", styles_module_default15);
|
32262
32418
|
var ComponentListItem = ({
|
32263
32419
|
name,
|
@@ -32265,7 +32421,7 @@ var ComponentListItem = ({
|
|
32265
32421
|
index
|
32266
32422
|
}) => {
|
32267
32423
|
const { overrides } = useAppContext();
|
32268
|
-
return /* @__PURE__ */ (0,
|
32424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Drawer.Item, { label, name, index, children: overrides.componentItem });
|
32269
32425
|
};
|
32270
32426
|
var ComponentList = ({
|
32271
32427
|
children,
|
@@ -32274,8 +32430,8 @@ var ComponentList = ({
|
|
32274
32430
|
}) => {
|
32275
32431
|
const { config, state, setUi } = useAppContext();
|
32276
32432
|
const { expanded = true } = state.ui.componentList[id] || {};
|
32277
|
-
return /* @__PURE__ */ (0,
|
32278
|
-
title && /* @__PURE__ */ (0,
|
32433
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
|
32434
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
32279
32435
|
"button",
|
32280
32436
|
{
|
32281
32437
|
className: getClassName20("title"),
|
@@ -32288,14 +32444,14 @@ var ComponentList = ({
|
|
32288
32444
|
}),
|
32289
32445
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
32290
32446
|
children: [
|
32291
|
-
/* @__PURE__ */ (0,
|
32292
|
-
/* @__PURE__ */ (0,
|
32447
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { children: title }),
|
32448
|
+
/* @__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
32449
|
]
|
32294
32450
|
}
|
32295
32451
|
),
|
32296
|
-
/* @__PURE__ */ (0,
|
32452
|
+
/* @__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
32453
|
var _a;
|
32298
|
-
return /* @__PURE__ */ (0,
|
32454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
32299
32455
|
ComponentListItem,
|
32300
32456
|
{
|
32301
32457
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
@@ -32310,7 +32466,7 @@ var ComponentList = ({
|
|
32310
32466
|
ComponentList.Item = ComponentListItem;
|
32311
32467
|
|
32312
32468
|
// lib/use-component-list.tsx
|
32313
|
-
var
|
32469
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
32314
32470
|
var useComponentList = (config, ui) => {
|
32315
32471
|
const [componentList, setComponentList] = (0, import_react20.useState)();
|
32316
32472
|
(0, import_react20.useEffect)(() => {
|
@@ -32323,7 +32479,7 @@ var useComponentList = (config, ui) => {
|
|
32323
32479
|
if (category.visible === false || !category.components) {
|
32324
32480
|
return null;
|
32325
32481
|
}
|
32326
|
-
return /* @__PURE__ */ (0,
|
32482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32327
32483
|
ComponentList,
|
32328
32484
|
{
|
32329
32485
|
id: categoryKey,
|
@@ -32331,7 +32487,7 @@ var useComponentList = (config, ui) => {
|
|
32331
32487
|
children: category.components.map((componentName, i) => {
|
32332
32488
|
var _a2;
|
32333
32489
|
matchedComponents.push(componentName);
|
32334
|
-
return /* @__PURE__ */ (0,
|
32490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32335
32491
|
ComponentList.Item,
|
32336
32492
|
{
|
32337
32493
|
label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
|
@@ -32351,14 +32507,14 @@ var useComponentList = (config, ui) => {
|
|
32351
32507
|
);
|
32352
32508
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
32353
32509
|
_componentList.push(
|
32354
|
-
/* @__PURE__ */ (0,
|
32510
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32355
32511
|
ComponentList,
|
32356
32512
|
{
|
32357
32513
|
id: "other",
|
32358
32514
|
title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
|
32359
32515
|
children: remainingComponents.map((componentName, i) => {
|
32360
32516
|
var _a2;
|
32361
|
-
return /* @__PURE__ */ (0,
|
32517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32362
32518
|
ComponentList.Item,
|
32363
32519
|
{
|
32364
32520
|
name: componentName,
|
@@ -32381,18 +32537,26 @@ var useComponentList = (config, ui) => {
|
|
32381
32537
|
|
32382
32538
|
// components/Puck/components/Components/index.tsx
|
32383
32539
|
var import_react21 = require("react");
|
32384
|
-
var
|
32540
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
32385
32541
|
var Components = () => {
|
32386
32542
|
const { config, state, overrides } = useAppContext();
|
32387
32543
|
const componentList = useComponentList(config, state.ui);
|
32388
32544
|
const Wrapper = (0, import_react21.useMemo)(() => overrides.components || "div", [overrides]);
|
32389
|
-
return /* @__PURE__ */ (0,
|
32545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComponentList, { id: "all" }) });
|
32390
32546
|
};
|
32391
32547
|
|
32392
32548
|
// components/Puck/components/Preview/index.tsx
|
32393
32549
|
init_react_import();
|
32394
32550
|
var import_react22 = require("react");
|
32395
|
-
var
|
32551
|
+
var import_auto_frame_component = __toESM(require("@measured/auto-frame-component"));
|
32552
|
+
|
32553
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
|
32554
|
+
init_react_import();
|
32555
|
+
var styles_module_default16 = { "PuckPreview": "_PuckPreview_379hm_1", "PuckPreview-iframe": "_PuckPreview-iframe_379hm_5", "PuckPreview-content": "_PuckPreview-content_379hm_11", "PuckPreview--stylesLoaded": "_PuckPreview--stylesLoaded_379hm_18" };
|
32556
|
+
|
32557
|
+
// components/Puck/components/Preview/index.tsx
|
32558
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
32559
|
+
var getClassName21 = get_class_name_factory_default("PuckPreview", styles_module_default16);
|
32396
32560
|
var Preview = ({ id = "puck-preview" }) => {
|
32397
32561
|
const { config, dispatch, state } = useAppContext();
|
32398
32562
|
const Page = (0, import_react22.useCallback)(
|
@@ -32403,16 +32567,31 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
32403
32567
|
[config.root]
|
32404
32568
|
);
|
32405
32569
|
const rootProps = state.data.root.props || state.data.root;
|
32406
|
-
const
|
32407
|
-
|
32570
|
+
const ref = (0, import_react22.useRef)(null);
|
32571
|
+
const [stylesLoaded, setStylesLoaded] = (0, import_react22.useState)(false);
|
32572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
32408
32573
|
"div",
|
32409
32574
|
{
|
32575
|
+
className: getClassName21({ stylesLoaded }),
|
32410
32576
|
id,
|
32411
32577
|
onClick: () => {
|
32412
32578
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
32413
32579
|
},
|
32414
|
-
|
32415
|
-
|
32580
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName21("content"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
32581
|
+
import_auto_frame_component.default,
|
32582
|
+
{
|
32583
|
+
id: "preview-iframe",
|
32584
|
+
className: getClassName21("iframe"),
|
32585
|
+
"data-rfd-iframe": true,
|
32586
|
+
ref,
|
32587
|
+
debug: true,
|
32588
|
+
onStylesLoaded: () => {
|
32589
|
+
console.log("callback");
|
32590
|
+
setStylesLoaded(true);
|
32591
|
+
},
|
32592
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId }) }))
|
32593
|
+
}
|
32594
|
+
) })
|
32416
32595
|
}
|
32417
32596
|
);
|
32418
32597
|
};
|
@@ -32446,7 +32625,7 @@ init_react_import();
|
|
32446
32625
|
|
32447
32626
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
32448
32627
|
init_react_import();
|
32449
|
-
var
|
32628
|
+
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
32629
|
|
32451
32630
|
// lib/scroll-into-view.ts
|
32452
32631
|
init_react_import();
|
@@ -32474,9 +32653,9 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
32474
32653
|
};
|
32475
32654
|
|
32476
32655
|
// components/LayerTree/index.tsx
|
32477
|
-
var
|
32478
|
-
var
|
32479
|
-
var getClassNameLayer = get_class_name_factory_default("Layer",
|
32656
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
32657
|
+
var getClassName22 = get_class_name_factory_default("LayerTree", styles_module_default17);
|
32658
|
+
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default17);
|
32480
32659
|
var LayerTree = ({
|
32481
32660
|
data,
|
32482
32661
|
config,
|
@@ -32488,14 +32667,14 @@ var LayerTree = ({
|
|
32488
32667
|
}) => {
|
32489
32668
|
const zones = data.zones || {};
|
32490
32669
|
const ctx = (0, import_react23.useContext)(dropZoneContext);
|
32491
|
-
return /* @__PURE__ */ (0,
|
32492
|
-
label && /* @__PURE__ */ (0,
|
32493
|
-
/* @__PURE__ */ (0,
|
32670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
32671
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName22("zoneTitle"), children: [
|
32672
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Layers, { size: "16" }) }),
|
32494
32673
|
" ",
|
32495
32674
|
label
|
32496
32675
|
] }),
|
32497
|
-
/* @__PURE__ */ (0,
|
32498
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
32676
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("ul", { className: getClassName22(), children: [
|
32677
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("helper"), children: "No items" }),
|
32499
32678
|
zoneContent.map((item, i) => {
|
32500
32679
|
var _a;
|
32501
32680
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
@@ -32511,7 +32690,7 @@ var LayerTree = ({
|
|
32511
32690
|
const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
|
32512
32691
|
const isHovering = hoveringComponent === item.props.id;
|
32513
32692
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
32514
|
-
return /* @__PURE__ */ (0,
|
32693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
32515
32694
|
"li",
|
32516
32695
|
{
|
32517
32696
|
className: getClassNameLayer({
|
@@ -32521,7 +32700,7 @@ var LayerTree = ({
|
|
32521
32700
|
childIsSelected
|
32522
32701
|
}),
|
32523
32702
|
children: [
|
32524
|
-
/* @__PURE__ */ (0,
|
32703
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
32525
32704
|
"button",
|
32526
32705
|
{
|
32527
32706
|
className: getClassNameLayer("clickable"),
|
@@ -32535,8 +32714,14 @@ var LayerTree = ({
|
|
32535
32714
|
zone
|
32536
32715
|
});
|
32537
32716
|
const id = zoneContent[i].props.id;
|
32717
|
+
const iframe = document.querySelector("#preview-iframe");
|
32718
|
+
if (!(iframe == null ? void 0 : iframe.contentDocument)) {
|
32719
|
+
throw new Error(
|
32720
|
+
`Preview iframe could not be found when trying to scroll to item ${id}`
|
32721
|
+
);
|
32722
|
+
}
|
32538
32723
|
scrollIntoView(
|
32539
|
-
|
32724
|
+
iframe.contentDocument.querySelector(
|
32540
32725
|
`[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
|
32541
32726
|
)
|
32542
32727
|
);
|
@@ -32552,22 +32737,22 @@ var LayerTree = ({
|
|
32552
32737
|
setHoveringComponent(null);
|
32553
32738
|
},
|
32554
32739
|
children: [
|
32555
|
-
containsZone && /* @__PURE__ */ (0,
|
32740
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32556
32741
|
"div",
|
32557
32742
|
{
|
32558
32743
|
className: getClassNameLayer("chevron"),
|
32559
32744
|
title: isSelected ? "Collapse" : "Expand",
|
32560
|
-
children: /* @__PURE__ */ (0,
|
32745
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronDown, { size: "12" })
|
32561
32746
|
}
|
32562
32747
|
),
|
32563
|
-
/* @__PURE__ */ (0,
|
32564
|
-
/* @__PURE__ */ (0,
|
32565
|
-
/* @__PURE__ */ (0,
|
32748
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
32749
|
+
/* @__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" }) }),
|
32750
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("name"), children: (_a = config.components[item.type]["label"]) != null ? _a : item.type })
|
32566
32751
|
] })
|
32567
32752
|
]
|
32568
32753
|
}
|
32569
32754
|
) }),
|
32570
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
32755
|
+
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
32756
|
LayerTree,
|
32572
32757
|
{
|
32573
32758
|
config,
|
@@ -32590,7 +32775,7 @@ var LayerTree = ({
|
|
32590
32775
|
|
32591
32776
|
// components/Puck/components/Outline/index.tsx
|
32592
32777
|
var import_react24 = require("react");
|
32593
|
-
var
|
32778
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
32594
32779
|
var Outline = () => {
|
32595
32780
|
const { dispatch, state, overrides, config } = useAppContext();
|
32596
32781
|
const { data, ui } = state;
|
@@ -32605,8 +32790,8 @@ var Outline = () => {
|
|
32605
32790
|
[]
|
32606
32791
|
);
|
32607
32792
|
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,
|
32793
|
+
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: [
|
32794
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
32610
32795
|
LayerTree,
|
32611
32796
|
{
|
32612
32797
|
config,
|
@@ -32619,7 +32804,7 @@ var Outline = () => {
|
|
32619
32804
|
),
|
32620
32805
|
Object.entries(findZonesForArea(data, "root")).map(
|
32621
32806
|
([zoneKey, zone]) => {
|
32622
|
-
return /* @__PURE__ */ (0,
|
32807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
32623
32808
|
LayerTree,
|
32624
32809
|
{
|
32625
32810
|
config,
|
@@ -32746,14 +32931,421 @@ function useHistoryStore() {
|
|
32746
32931
|
};
|
32747
32932
|
}
|
32748
32933
|
|
32934
|
+
// components/Puck/components/Canvas/index.tsx
|
32935
|
+
init_react_import();
|
32936
|
+
|
32937
|
+
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
32938
|
+
init_react_import();
|
32939
|
+
|
32940
|
+
// ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
32941
|
+
init_react_import();
|
32942
|
+
var isProduction = process.env.NODE_ENV === "production";
|
32943
|
+
var prefix = "Invariant failed";
|
32944
|
+
function invariant(condition, message) {
|
32945
|
+
if (condition) {
|
32946
|
+
return;
|
32947
|
+
}
|
32948
|
+
if (isProduction) {
|
32949
|
+
throw new Error(prefix);
|
32950
|
+
}
|
32951
|
+
var provided = typeof message === "function" ? message() : message;
|
32952
|
+
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
32953
|
+
throw new Error(value);
|
32954
|
+
}
|
32955
|
+
|
32956
|
+
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
32957
|
+
var getRect = function getRect2(_ref) {
|
32958
|
+
var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
|
32959
|
+
var width = right - left;
|
32960
|
+
var height = bottom - top;
|
32961
|
+
var rect = {
|
32962
|
+
top,
|
32963
|
+
right,
|
32964
|
+
bottom,
|
32965
|
+
left,
|
32966
|
+
width,
|
32967
|
+
height,
|
32968
|
+
x: left,
|
32969
|
+
y: top,
|
32970
|
+
center: {
|
32971
|
+
x: (right + left) / 2,
|
32972
|
+
y: (bottom + top) / 2
|
32973
|
+
}
|
32974
|
+
};
|
32975
|
+
return rect;
|
32976
|
+
};
|
32977
|
+
var expand = function expand2(target, expandBy) {
|
32978
|
+
return {
|
32979
|
+
top: target.top - expandBy.top,
|
32980
|
+
left: target.left - expandBy.left,
|
32981
|
+
bottom: target.bottom + expandBy.bottom,
|
32982
|
+
right: target.right + expandBy.right
|
32983
|
+
};
|
32984
|
+
};
|
32985
|
+
var shrink = function shrink2(target, shrinkBy) {
|
32986
|
+
return {
|
32987
|
+
top: target.top + shrinkBy.top,
|
32988
|
+
left: target.left + shrinkBy.left,
|
32989
|
+
bottom: target.bottom - shrinkBy.bottom,
|
32990
|
+
right: target.right - shrinkBy.right
|
32991
|
+
};
|
32992
|
+
};
|
32993
|
+
var noSpacing = {
|
32994
|
+
top: 0,
|
32995
|
+
right: 0,
|
32996
|
+
bottom: 0,
|
32997
|
+
left: 0
|
32998
|
+
};
|
32999
|
+
var createBox = function createBox2(_ref2) {
|
33000
|
+
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;
|
33001
|
+
var marginBox = getRect(expand(borderBox, margin));
|
33002
|
+
var paddingBox = getRect(shrink(borderBox, border));
|
33003
|
+
var contentBox = getRect(shrink(paddingBox, padding));
|
33004
|
+
return {
|
33005
|
+
marginBox,
|
33006
|
+
borderBox: getRect(borderBox),
|
33007
|
+
paddingBox,
|
33008
|
+
contentBox,
|
33009
|
+
margin,
|
33010
|
+
border,
|
33011
|
+
padding
|
33012
|
+
};
|
33013
|
+
};
|
33014
|
+
var parse = function parse2(raw) {
|
33015
|
+
var value = raw.slice(0, -2);
|
33016
|
+
var suffix = raw.slice(-2);
|
33017
|
+
if (suffix !== "px") {
|
33018
|
+
return 0;
|
33019
|
+
}
|
33020
|
+
var result = Number(value);
|
33021
|
+
!!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
|
33022
|
+
return result;
|
33023
|
+
};
|
33024
|
+
var calculateBox = function calculateBox2(borderBox, styles) {
|
33025
|
+
var margin = {
|
33026
|
+
top: parse(styles.marginTop),
|
33027
|
+
right: parse(styles.marginRight),
|
33028
|
+
bottom: parse(styles.marginBottom),
|
33029
|
+
left: parse(styles.marginLeft)
|
33030
|
+
};
|
33031
|
+
var padding = {
|
33032
|
+
top: parse(styles.paddingTop),
|
33033
|
+
right: parse(styles.paddingRight),
|
33034
|
+
bottom: parse(styles.paddingBottom),
|
33035
|
+
left: parse(styles.paddingLeft)
|
33036
|
+
};
|
33037
|
+
var border = {
|
33038
|
+
top: parse(styles.borderTopWidth),
|
33039
|
+
right: parse(styles.borderRightWidth),
|
33040
|
+
bottom: parse(styles.borderBottomWidth),
|
33041
|
+
left: parse(styles.borderLeftWidth)
|
33042
|
+
};
|
33043
|
+
return createBox({
|
33044
|
+
borderBox,
|
33045
|
+
margin,
|
33046
|
+
padding,
|
33047
|
+
border
|
33048
|
+
});
|
33049
|
+
};
|
33050
|
+
var getBox = function getBox2(el) {
|
33051
|
+
var borderBox = el.getBoundingClientRect();
|
33052
|
+
var styles = window.getComputedStyle(el);
|
33053
|
+
return calculateBox(borderBox, styles);
|
33054
|
+
};
|
33055
|
+
|
33056
|
+
// components/Puck/components/Canvas/index.tsx
|
33057
|
+
var import_react27 = require("react");
|
33058
|
+
|
33059
|
+
// components/ViewportControls/index.tsx
|
33060
|
+
init_react_import();
|
33061
|
+
var import_react26 = require("react");
|
33062
|
+
|
33063
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
33064
|
+
init_react_import();
|
33065
|
+
var styles_module_default18 = { "ViewportControls": "_ViewportControls_14bhf_1", "ViewportControls-divider": "_ViewportControls-divider_14bhf_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_14bhf_21", "ViewportButton--isActive": "_ViewportButton--isActive_14bhf_33", "ViewportButton-inner": "_ViewportButton-inner_14bhf_33" };
|
33066
|
+
|
33067
|
+
// components/ViewportControls/index.tsx
|
33068
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
33069
|
+
var icons = {
|
33070
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Smartphone, { size: 16 }),
|
33071
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Tablet, { size: 16 }),
|
33072
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Monitor, { size: 16 })
|
33073
|
+
};
|
33074
|
+
var getClassName23 = get_class_name_factory_default("ViewportControls", styles_module_default18);
|
33075
|
+
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default18);
|
33076
|
+
var ViewportButton = ({
|
33077
|
+
children,
|
33078
|
+
height = "auto",
|
33079
|
+
title,
|
33080
|
+
width,
|
33081
|
+
onClick
|
33082
|
+
}) => {
|
33083
|
+
const { state } = useAppContext();
|
33084
|
+
const isActive = width === state.ui.viewports.current.width;
|
33085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33086
|
+
IconButton,
|
33087
|
+
{
|
33088
|
+
title,
|
33089
|
+
disabled: isActive,
|
33090
|
+
onClick: (e) => {
|
33091
|
+
e.stopPropagation();
|
33092
|
+
onClick({ width, height });
|
33093
|
+
},
|
33094
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton("inner"), children })
|
33095
|
+
}
|
33096
|
+
) });
|
33097
|
+
};
|
33098
|
+
var defaultZoomOptions = [
|
33099
|
+
{ label: "25%", value: 0.25 },
|
33100
|
+
{ label: "50%", value: 0.5 },
|
33101
|
+
{ label: "75%", value: 0.75 },
|
33102
|
+
{ label: "100%", value: 1 },
|
33103
|
+
{ label: "125%", value: 1.25 },
|
33104
|
+
{ label: "150%", value: 1.5 },
|
33105
|
+
{ label: "200%", value: 2 }
|
33106
|
+
];
|
33107
|
+
var ViewportControls = ({
|
33108
|
+
autoZoom,
|
33109
|
+
zoom,
|
33110
|
+
onViewportChange,
|
33111
|
+
onZoom
|
33112
|
+
}) => {
|
33113
|
+
const { state, viewports } = useAppContext();
|
33114
|
+
const viewport = state.ui.viewports.current;
|
33115
|
+
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
33116
|
+
(option) => option.value === autoZoom
|
33117
|
+
);
|
33118
|
+
const zoomOptions = (0, import_react26.useMemo)(
|
33119
|
+
() => [
|
33120
|
+
...defaultZoomOptions,
|
33121
|
+
...defaultsContainAutoZoom ? [] : [
|
33122
|
+
{
|
33123
|
+
value: autoZoom,
|
33124
|
+
label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
|
33125
|
+
}
|
33126
|
+
]
|
33127
|
+
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
33128
|
+
[autoZoom]
|
33129
|
+
);
|
33130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName23(), children: [
|
33131
|
+
viewports.map((viewport2, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33132
|
+
ViewportButton,
|
33133
|
+
{
|
33134
|
+
height: viewport2.height,
|
33135
|
+
width: viewport2.width,
|
33136
|
+
title: viewport2.label ? `Switch to ${viewport2.label} viewport` : "Switch viewport",
|
33137
|
+
onClick: onViewportChange,
|
33138
|
+
children: typeof viewport2.icon === "string" ? icons[viewport2.icon] || viewport2.icon : viewport2.icon || icons.Smartphone
|
33139
|
+
},
|
33140
|
+
i
|
33141
|
+
)),
|
33142
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
|
33143
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33144
|
+
IconButton,
|
33145
|
+
{
|
33146
|
+
title: "Zoom viewport out",
|
33147
|
+
disabled: zoom <= zoomOptions[0].value,
|
33148
|
+
onClick: (e) => {
|
33149
|
+
e.stopPropagation();
|
33150
|
+
onZoom(
|
33151
|
+
zoomOptions[Math.max(
|
33152
|
+
zoomOptions.findIndex((option) => option.value === zoom) - 1,
|
33153
|
+
0
|
33154
|
+
)].value
|
33155
|
+
);
|
33156
|
+
},
|
33157
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomOut, { size: 16 })
|
33158
|
+
}
|
33159
|
+
),
|
33160
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33161
|
+
IconButton,
|
33162
|
+
{
|
33163
|
+
title: "Zoom viewport in",
|
33164
|
+
disabled: zoom >= zoomOptions[zoomOptions.length - 1].value,
|
33165
|
+
onClick: (e) => {
|
33166
|
+
e.stopPropagation();
|
33167
|
+
onZoom(
|
33168
|
+
zoomOptions[Math.min(
|
33169
|
+
zoomOptions.findIndex((option) => option.value === zoom) + 1,
|
33170
|
+
zoomOptions.length - 1
|
33171
|
+
)].value
|
33172
|
+
);
|
33173
|
+
},
|
33174
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomIn, { size: 16 })
|
33175
|
+
}
|
33176
|
+
),
|
33177
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
|
33178
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33179
|
+
"select",
|
33180
|
+
{
|
33181
|
+
className: getClassName23("zoomSelect"),
|
33182
|
+
value: zoom.toString(),
|
33183
|
+
onChange: (e) => {
|
33184
|
+
onZoom(parseFloat(e.currentTarget.value));
|
33185
|
+
},
|
33186
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33187
|
+
"option",
|
33188
|
+
{
|
33189
|
+
value: option.value,
|
33190
|
+
label: option.label
|
33191
|
+
},
|
33192
|
+
option.label
|
33193
|
+
))
|
33194
|
+
}
|
33195
|
+
)
|
33196
|
+
] });
|
33197
|
+
};
|
33198
|
+
|
33199
|
+
// lib/get-zoom-config.ts
|
33200
|
+
init_react_import();
|
33201
|
+
var RESET_ZOOM_SMALLER_THAN_FRAME = true;
|
33202
|
+
var getZoomConfig = (uiViewport, frame, zoom) => {
|
33203
|
+
const box = getBox(frame);
|
33204
|
+
const { width: frameWidth, height: frameHeight } = box.contentBox;
|
33205
|
+
const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
|
33206
|
+
let rootHeight = 0;
|
33207
|
+
let autoZoom = 1;
|
33208
|
+
if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
|
33209
|
+
const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
|
33210
|
+
const heightZoom = Math.min(frameHeight / viewportHeight, 1);
|
33211
|
+
zoom = widthZoom;
|
33212
|
+
if (widthZoom < heightZoom) {
|
33213
|
+
rootHeight = viewportHeight / zoom;
|
33214
|
+
} else {
|
33215
|
+
rootHeight = viewportHeight;
|
33216
|
+
zoom = heightZoom;
|
33217
|
+
}
|
33218
|
+
autoZoom = zoom;
|
33219
|
+
} else {
|
33220
|
+
if (RESET_ZOOM_SMALLER_THAN_FRAME) {
|
33221
|
+
autoZoom = 1;
|
33222
|
+
zoom = 1;
|
33223
|
+
rootHeight = viewportHeight;
|
33224
|
+
}
|
33225
|
+
}
|
33226
|
+
return { autoZoom, rootHeight, zoom };
|
33227
|
+
};
|
33228
|
+
|
33229
|
+
// components/Puck/components/Canvas/index.tsx
|
33230
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
33231
|
+
var getClassName24 = get_class_name_factory_default("Puck", styles_module_default8);
|
33232
|
+
var ZOOM_ON_CHANGE = true;
|
33233
|
+
var Canvas = () => {
|
33234
|
+
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
33235
|
+
const { ui } = state;
|
33236
|
+
const frameRef = (0, import_react27.useRef)(null);
|
33237
|
+
const [showTransition, setShowTransition] = (0, import_react27.useState)(false);
|
33238
|
+
const defaultRender = (0, import_react27.useMemo)(() => {
|
33239
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
|
33240
|
+
return PuckDefault;
|
33241
|
+
}, []);
|
33242
|
+
const CustomPreview = (0, import_react27.useMemo)(
|
33243
|
+
() => overrides.preview || defaultRender,
|
33244
|
+
[overrides]
|
33245
|
+
);
|
33246
|
+
const getFrameDimensions = (0, import_react27.useCallback)(() => {
|
33247
|
+
if (frameRef.current) {
|
33248
|
+
const frame = frameRef.current;
|
33249
|
+
const box = getBox(frame);
|
33250
|
+
return { width: box.contentBox.width, height: box.contentBox.height };
|
33251
|
+
}
|
33252
|
+
return { width: 0, height: 0 };
|
33253
|
+
}, [frameRef]);
|
33254
|
+
const resetAutoZoom = (0, import_react27.useCallback)(
|
33255
|
+
(ui2 = state.ui) => {
|
33256
|
+
if (frameRef.current) {
|
33257
|
+
setZoomConfig(
|
33258
|
+
getZoomConfig(ui2.viewports.current, frameRef.current, zoomConfig.zoom)
|
33259
|
+
);
|
33260
|
+
}
|
33261
|
+
},
|
33262
|
+
[frameRef, zoomConfig, state.ui]
|
33263
|
+
);
|
33264
|
+
(0, import_react27.useEffect)(() => {
|
33265
|
+
setShowTransition(false);
|
33266
|
+
resetAutoZoom();
|
33267
|
+
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
33268
|
+
(0, import_react27.useEffect)(() => {
|
33269
|
+
const { height: frameHeight } = getFrameDimensions();
|
33270
|
+
if (ui.viewports.current.height === "auto") {
|
33271
|
+
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
33272
|
+
rootHeight: frameHeight / zoomConfig.zoom
|
33273
|
+
}));
|
33274
|
+
}
|
33275
|
+
}, [zoomConfig.zoom]);
|
33276
|
+
(0, import_react27.useEffect)(() => {
|
33277
|
+
const observer = new ResizeObserver(() => {
|
33278
|
+
setShowTransition(false);
|
33279
|
+
resetAutoZoom();
|
33280
|
+
});
|
33281
|
+
if (document.body) {
|
33282
|
+
observer.observe(document.body);
|
33283
|
+
}
|
33284
|
+
return () => {
|
33285
|
+
observer.disconnect();
|
33286
|
+
};
|
33287
|
+
}, []);
|
33288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
33289
|
+
"div",
|
33290
|
+
{
|
33291
|
+
className: getClassName24("canvas"),
|
33292
|
+
onClick: () => dispatch({
|
33293
|
+
type: "setUi",
|
33294
|
+
ui: { itemSelector: null },
|
33295
|
+
recordHistory: true
|
33296
|
+
}),
|
33297
|
+
children: [
|
33298
|
+
ui.viewports.controlsVisible && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("canvasControls"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33299
|
+
ViewportControls,
|
33300
|
+
{
|
33301
|
+
autoZoom: zoomConfig.autoZoom,
|
33302
|
+
zoom: zoomConfig.zoom,
|
33303
|
+
onViewportChange: (viewport) => {
|
33304
|
+
setShowTransition(true);
|
33305
|
+
const uiViewport = __spreadProps(__spreadValues({}, viewport), {
|
33306
|
+
height: viewport.height || "auto",
|
33307
|
+
zoom: zoomConfig.zoom
|
33308
|
+
});
|
33309
|
+
const newUi = __spreadProps(__spreadValues({}, ui), {
|
33310
|
+
viewports: __spreadProps(__spreadValues({}, ui.viewports), { current: uiViewport })
|
33311
|
+
});
|
33312
|
+
setUi(newUi);
|
33313
|
+
if (ZOOM_ON_CHANGE) {
|
33314
|
+
resetAutoZoom(newUi);
|
33315
|
+
}
|
33316
|
+
},
|
33317
|
+
onZoom: (zoom) => {
|
33318
|
+
setShowTransition(true);
|
33319
|
+
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
|
33320
|
+
}
|
33321
|
+
}
|
33322
|
+
) }),
|
33323
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("frame"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33324
|
+
"div",
|
33325
|
+
{
|
33326
|
+
className: getClassName24("root"),
|
33327
|
+
style: {
|
33328
|
+
width: ui.viewports.current.width,
|
33329
|
+
height: zoomConfig.rootHeight,
|
33330
|
+
transform: `scale(${zoomConfig.zoom})`,
|
33331
|
+
transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : ""
|
33332
|
+
},
|
33333
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Preview, {}) })
|
33334
|
+
}
|
33335
|
+
) })
|
33336
|
+
]
|
33337
|
+
}
|
33338
|
+
);
|
33339
|
+
};
|
33340
|
+
|
32749
33341
|
// components/Puck/index.tsx
|
32750
|
-
var
|
32751
|
-
var
|
33342
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
33343
|
+
var getClassName25 = get_class_name_factory_default("Puck", styles_module_default8);
|
32752
33344
|
function Puck({
|
32753
33345
|
children,
|
32754
33346
|
config,
|
32755
33347
|
data: initialData = { content: [], root: { props: { title: "" } } },
|
32756
|
-
ui: initialUi
|
33348
|
+
ui: initialUi,
|
32757
33349
|
onChange,
|
32758
33350
|
onPublish,
|
32759
33351
|
plugins = [],
|
@@ -32761,33 +33353,58 @@ function Puck({
|
|
32761
33353
|
renderHeader,
|
32762
33354
|
renderHeaderActions,
|
32763
33355
|
headerTitle,
|
32764
|
-
headerPath
|
33356
|
+
headerPath,
|
33357
|
+
viewports = defaultViewports
|
32765
33358
|
}) {
|
32766
33359
|
var _a;
|
32767
33360
|
const historyStore = useHistoryStore();
|
32768
|
-
const [reducer] = (0,
|
33361
|
+
const [reducer] = (0, import_react28.useState)(
|
32769
33362
|
() => createReducer({ config, record: historyStore.record })
|
32770
33363
|
);
|
32771
|
-
const [initialAppState] = (0,
|
32772
|
-
|
32773
|
-
|
32774
|
-
|
32775
|
-
|
32776
|
-
|
32777
|
-
|
32778
|
-
|
32779
|
-
|
32780
|
-
|
32781
|
-
|
32782
|
-
|
32783
|
-
|
32784
|
-
|
32785
|
-
|
32786
|
-
{}
|
32787
|
-
|
32788
|
-
|
32789
|
-
|
32790
|
-
|
33364
|
+
const [initialAppState] = (0, import_react28.useState)(() => {
|
33365
|
+
var _a2, _b, _c, _d;
|
33366
|
+
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
33367
|
+
let clientUiState = {};
|
33368
|
+
if (typeof window !== "undefined") {
|
33369
|
+
const viewportWidth = window.innerWidth;
|
33370
|
+
const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
|
33371
|
+
key,
|
33372
|
+
diff: Math.abs(viewportWidth - value.width)
|
33373
|
+
})).sort((a, b) => a.diff > b.diff ? 1 : -1);
|
33374
|
+
const closestViewport = viewportDifferences[0].key;
|
33375
|
+
clientUiState = __spreadProps(__spreadValues({}, window.matchMedia("(min-width: 638px)").matches ? {} : {
|
33376
|
+
leftSideBarVisible: false,
|
33377
|
+
rightSideBarVisible: false
|
33378
|
+
}), {
|
33379
|
+
viewports: __spreadProps(__spreadValues({}, initial.viewports), {
|
33380
|
+
current: __spreadProps(__spreadValues({}, initial.viewports.current), {
|
33381
|
+
height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || viewports[closestViewport].height || "auto",
|
33382
|
+
width: ((_d = (_c = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _c.current) == null ? void 0 : _d.width) || viewports[closestViewport].width
|
33383
|
+
})
|
33384
|
+
})
|
33385
|
+
});
|
33386
|
+
}
|
33387
|
+
return __spreadProps(__spreadValues({}, defaultAppState), {
|
33388
|
+
data: initialData,
|
33389
|
+
ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
|
33390
|
+
// Store categories under componentList on state to allow render functions and plugins to modify
|
33391
|
+
componentList: config.categories ? Object.entries(config.categories).reduce(
|
33392
|
+
(acc, [categoryName, category]) => {
|
33393
|
+
return __spreadProps(__spreadValues({}, acc), {
|
33394
|
+
[categoryName]: {
|
33395
|
+
title: category.title,
|
33396
|
+
components: category.components,
|
33397
|
+
expanded: category.defaultExpanded,
|
33398
|
+
visible: category.visible
|
33399
|
+
}
|
33400
|
+
});
|
33401
|
+
},
|
33402
|
+
{}
|
33403
|
+
) : {}
|
33404
|
+
})
|
33405
|
+
});
|
33406
|
+
});
|
33407
|
+
const [appState, dispatch] = (0, import_react28.useReducer)(
|
32791
33408
|
reducer,
|
32792
33409
|
flushZones(initialAppState)
|
32793
33410
|
);
|
@@ -32798,9 +33415,9 @@ function Puck({
|
|
32798
33415
|
config,
|
32799
33416
|
dispatch
|
32800
33417
|
);
|
32801
|
-
const [menuOpen, setMenuOpen] = (0,
|
33418
|
+
const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
|
32802
33419
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
32803
|
-
const setItemSelector = (0,
|
33420
|
+
const setItemSelector = (0, import_react28.useCallback)(
|
32804
33421
|
(newItemSelector) => {
|
32805
33422
|
if (newItemSelector === itemSelector)
|
32806
33423
|
return;
|
@@ -32813,21 +33430,21 @@ function Puck({
|
|
32813
33430
|
[itemSelector]
|
32814
33431
|
);
|
32815
33432
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
32816
|
-
(0,
|
33433
|
+
(0, import_react28.useEffect)(() => {
|
32817
33434
|
if (onChange)
|
32818
33435
|
onChange(data);
|
32819
33436
|
}, [data]);
|
32820
33437
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
32821
|
-
const [draggedItem, setDraggedItem] = (0,
|
33438
|
+
const [draggedItem, setDraggedItem] = (0, import_react28.useState)();
|
32822
33439
|
const rootProps = data.root.props || data.root;
|
32823
|
-
(0,
|
33440
|
+
(0, import_react28.useEffect)(() => {
|
32824
33441
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
32825
33442
|
console.error(
|
32826
33443
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
32827
33444
|
);
|
32828
33445
|
}
|
32829
33446
|
}, []);
|
32830
|
-
const toggleSidebars = (0,
|
33447
|
+
const toggleSidebars = (0, import_react28.useCallback)(
|
32831
33448
|
(sidebar) => {
|
32832
33449
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
32833
33450
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -32841,7 +33458,7 @@ function Puck({
|
|
32841
33458
|
},
|
32842
33459
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
32843
33460
|
);
|
32844
|
-
(0,
|
33461
|
+
(0, import_react28.useEffect)(() => {
|
32845
33462
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
32846
33463
|
dispatch({
|
32847
33464
|
type: "setUi",
|
@@ -32864,11 +33481,11 @@ function Puck({
|
|
32864
33481
|
window.removeEventListener("resize", handleResize);
|
32865
33482
|
};
|
32866
33483
|
}, []);
|
32867
|
-
const defaultRender = (0,
|
32868
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0,
|
33484
|
+
const defaultRender = (0, import_react28.useMemo)(() => {
|
33485
|
+
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: children2 });
|
32869
33486
|
return PuckDefault;
|
32870
33487
|
}, []);
|
32871
|
-
const defaultHeaderRender = (0,
|
33488
|
+
const defaultHeaderRender = (0, import_react28.useMemo)(() => {
|
32872
33489
|
if (renderHeader) {
|
32873
33490
|
console.warn(
|
32874
33491
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -32876,47 +33493,42 @@ function Puck({
|
|
32876
33493
|
const RenderHeader = (_a2) => {
|
32877
33494
|
var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
|
32878
33495
|
const Comp = renderHeader;
|
32879
|
-
return /* @__PURE__ */ (0,
|
33496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
32880
33497
|
};
|
32881
33498
|
return RenderHeader;
|
32882
33499
|
}
|
32883
33500
|
return defaultRender;
|
32884
33501
|
}, [renderHeader]);
|
32885
|
-
const defaultHeaderActionsRender = (0,
|
33502
|
+
const defaultHeaderActionsRender = (0, import_react28.useMemo)(() => {
|
32886
33503
|
if (renderHeaderActions) {
|
32887
33504
|
console.warn(
|
32888
33505
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
32889
33506
|
);
|
32890
33507
|
const RenderHeader = (props) => {
|
32891
33508
|
const Comp = renderHeaderActions;
|
32892
|
-
return /* @__PURE__ */ (0,
|
33509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
32893
33510
|
};
|
32894
33511
|
return RenderHeader;
|
32895
33512
|
}
|
32896
33513
|
return defaultRender;
|
32897
33514
|
}, [renderHeader]);
|
32898
|
-
const loadedOverrides = (0,
|
33515
|
+
const loadedOverrides = (0, import_react28.useMemo)(() => {
|
32899
33516
|
return loadOverrides({ overrides, plugins });
|
32900
33517
|
}, [plugins]);
|
32901
|
-
const CustomPuck = (0,
|
33518
|
+
const CustomPuck = (0, import_react28.useMemo)(
|
32902
33519
|
() => loadedOverrides.puck || defaultRender,
|
32903
33520
|
[loadedOverrides]
|
32904
33521
|
);
|
32905
|
-
const
|
32906
|
-
() => loadedOverrides.preview || defaultRender,
|
32907
|
-
[loadedOverrides]
|
32908
|
-
);
|
32909
|
-
const CustomHeader = (0, import_react26.useMemo)(
|
33522
|
+
const CustomHeader = (0, import_react28.useMemo)(
|
32910
33523
|
() => loadedOverrides.header || defaultHeaderRender,
|
32911
33524
|
[loadedOverrides]
|
32912
33525
|
);
|
32913
|
-
const CustomHeaderActions = (0,
|
33526
|
+
const CustomHeaderActions = (0, import_react28.useMemo)(
|
32914
33527
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
32915
33528
|
[loadedOverrides]
|
32916
33529
|
);
|
32917
|
-
|
32918
|
-
|
32919
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "Puck", children: [
|
33531
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32920
33532
|
AppProvider,
|
32921
33533
|
{
|
32922
33534
|
value: {
|
@@ -32927,10 +33539,11 @@ function Puck({
|
|
32927
33539
|
resolveData,
|
32928
33540
|
plugins,
|
32929
33541
|
overrides: loadedOverrides,
|
32930
|
-
history
|
33542
|
+
history,
|
33543
|
+
viewports
|
32931
33544
|
},
|
32932
|
-
children: /* @__PURE__ */ (0,
|
32933
|
-
|
33545
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33546
|
+
DragDropContext,
|
32934
33547
|
{
|
32935
33548
|
onDragUpdate: (update) => {
|
32936
33549
|
setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
|
@@ -32984,7 +33597,7 @@ function Puck({
|
|
32984
33597
|
});
|
32985
33598
|
}
|
32986
33599
|
},
|
32987
|
-
children: /* @__PURE__ */ (0,
|
33600
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32988
33601
|
DropZoneProvider,
|
32989
33602
|
{
|
32990
33603
|
value: {
|
@@ -32996,77 +33609,75 @@ function Puck({
|
|
32996
33609
|
draggedItem,
|
32997
33610
|
placeholderStyle,
|
32998
33611
|
mode: "edit",
|
32999
|
-
areaId: "root"
|
33000
|
-
disableZoom
|
33612
|
+
areaId: "root"
|
33001
33613
|
},
|
33002
|
-
children: /* @__PURE__ */ (0,
|
33614
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
33003
33615
|
"div",
|
33004
33616
|
{
|
33005
|
-
className:
|
33617
|
+
className: getClassName25({
|
33006
33618
|
leftSideBarVisible,
|
33007
33619
|
menuOpen,
|
33008
|
-
rightSideBarVisible
|
33009
|
-
disableZoom
|
33620
|
+
rightSideBarVisible
|
33010
33621
|
}),
|
33011
33622
|
children: [
|
33012
|
-
/* @__PURE__ */ (0,
|
33623
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33013
33624
|
CustomHeader,
|
33014
33625
|
{
|
33015
|
-
actions: /* @__PURE__ */ (0,
|
33016
|
-
/* @__PURE__ */ (0,
|
33017
|
-
/* @__PURE__ */ (0,
|
33626
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
33627
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
|
33628
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33018
33629
|
Button,
|
33019
33630
|
{
|
33020
33631
|
onClick: () => {
|
33021
33632
|
onPublish && onPublish(data);
|
33022
33633
|
},
|
33023
|
-
icon: /* @__PURE__ */ (0,
|
33634
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Globe, { size: "14px" }),
|
33024
33635
|
children: "Publish"
|
33025
33636
|
}
|
33026
33637
|
)
|
33027
33638
|
] }),
|
33028
|
-
children: /* @__PURE__ */ (0,
|
33029
|
-
/* @__PURE__ */ (0,
|
33030
|
-
/* @__PURE__ */ (0,
|
33639
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerInner"), children: [
|
33640
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerToggle"), children: [
|
33641
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33031
33642
|
IconButton,
|
33032
33643
|
{
|
33033
33644
|
onClick: () => {
|
33034
33645
|
toggleSidebars("left");
|
33035
33646
|
},
|
33036
33647
|
title: "Toggle left sidebar",
|
33037
|
-
children: /* @__PURE__ */ (0,
|
33648
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelLeft, { focusable: "false" })
|
33038
33649
|
}
|
33039
33650
|
) }),
|
33040
|
-
/* @__PURE__ */ (0,
|
33651
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33041
33652
|
IconButton,
|
33042
33653
|
{
|
33043
33654
|
onClick: () => {
|
33044
33655
|
toggleSidebars("right");
|
33045
33656
|
},
|
33046
33657
|
title: "Toggle right sidebar",
|
33047
|
-
children: /* @__PURE__ */ (0,
|
33658
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelRight, { focusable: "false" })
|
33048
33659
|
}
|
33049
33660
|
) })
|
33050
33661
|
] }),
|
33051
|
-
/* @__PURE__ */ (0,
|
33662
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
33052
33663
|
headerTitle || rootProps.title || "Page",
|
33053
|
-
headerPath && /* @__PURE__ */ (0,
|
33664
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
33054
33665
|
" ",
|
33055
|
-
/* @__PURE__ */ (0,
|
33666
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
|
33056
33667
|
] })
|
33057
33668
|
] }) }),
|
33058
|
-
/* @__PURE__ */ (0,
|
33059
|
-
/* @__PURE__ */ (0,
|
33669
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerTools"), children: [
|
33670
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33060
33671
|
IconButton,
|
33061
33672
|
{
|
33062
33673
|
onClick: () => {
|
33063
33674
|
return setMenuOpen(!menuOpen);
|
33064
33675
|
},
|
33065
33676
|
title: "Toggle menu bar",
|
33066
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
33677
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { focusable: "false" })
|
33067
33678
|
}
|
33068
33679
|
) }),
|
33069
|
-
/* @__PURE__ */ (0,
|
33680
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33070
33681
|
MenuBar,
|
33071
33682
|
{
|
33072
33683
|
appState,
|
@@ -33074,7 +33685,7 @@ function Puck({
|
|
33074
33685
|
dispatch,
|
33075
33686
|
onPublish,
|
33076
33687
|
menuOpen,
|
33077
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
33688
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
|
33078
33689
|
setMenuOpen
|
33079
33690
|
}
|
33080
33691
|
)
|
@@ -33082,38 +33693,19 @@ function Puck({
|
|
33082
33693
|
] }) })
|
33083
33694
|
}
|
33084
33695
|
),
|
33085
|
-
/* @__PURE__ */ (0,
|
33086
|
-
/* @__PURE__ */ (0,
|
33087
|
-
/* @__PURE__ */ (0,
|
33696
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
|
33697
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Components, {}) }),
|
33698
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Outline, {}) })
|
33088
33699
|
] }),
|
33089
|
-
/* @__PURE__ */ (0,
|
33090
|
-
|
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",
|
33098
|
-
{
|
33099
|
-
style: {
|
33100
|
-
background: "var(--puck-color-grey-11)",
|
33101
|
-
height: "100%",
|
33102
|
-
flexGrow: 1
|
33103
|
-
}
|
33104
|
-
}
|
33105
|
-
)
|
33106
|
-
]
|
33107
|
-
}
|
33108
|
-
),
|
33109
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33700
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Canvas, {}),
|
33701
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33110
33702
|
SidebarSection,
|
33111
33703
|
{
|
33112
33704
|
noPadding: true,
|
33113
33705
|
noBorderTop: true,
|
33114
33706
|
showBreadcrumbs: true,
|
33115
33707
|
title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
|
33116
|
-
children: /* @__PURE__ */ (0,
|
33708
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Fields, {})
|
33117
33709
|
}
|
33118
33710
|
) })
|
33119
33711
|
]
|
@@ -33125,7 +33717,7 @@ function Puck({
|
|
33125
33717
|
)
|
33126
33718
|
}
|
33127
33719
|
),
|
33128
|
-
/* @__PURE__ */ (0,
|
33720
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { id: "puck-portal-root" })
|
33129
33721
|
] });
|
33130
33722
|
}
|
33131
33723
|
Puck.Components = Components;
|
@@ -33135,13 +33727,13 @@ Puck.Preview = Preview;
|
|
33135
33727
|
|
33136
33728
|
// components/Render/index.tsx
|
33137
33729
|
init_react_import();
|
33138
|
-
var
|
33730
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
33139
33731
|
function Render({ config, data }) {
|
33140
33732
|
var _a;
|
33141
33733
|
const rootProps = data.root.props || data.root;
|
33142
33734
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
33143
33735
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
33144
|
-
return /* @__PURE__ */ (0,
|
33736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33145
33737
|
config.root.render,
|
33146
33738
|
__spreadProps(__spreadValues({}, rootProps), {
|
33147
33739
|
puck: {
|
@@ -33150,11 +33742,11 @@ function Render({ config, data }) {
|
|
33150
33742
|
title,
|
33151
33743
|
editMode: false,
|
33152
33744
|
id: "puck-root",
|
33153
|
-
children: /* @__PURE__ */ (0,
|
33745
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId })
|
33154
33746
|
})
|
33155
33747
|
) });
|
33156
33748
|
}
|
33157
|
-
return /* @__PURE__ */ (0,
|
33749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId }) });
|
33158
33750
|
}
|
33159
33751
|
|
33160
33752
|
// lib/migrate.ts
|
@@ -33449,6 +34041,14 @@ lucide-react/dist/esm/icons/lock.js:
|
|
33449
34041
|
* See the LICENSE file in the root directory of this source tree.
|
33450
34042
|
*)
|
33451
34043
|
|
34044
|
+
lucide-react/dist/esm/icons/monitor.js:
|
34045
|
+
(**
|
34046
|
+
* @license lucide-react v0.298.0 - ISC
|
34047
|
+
*
|
34048
|
+
* This source code is licensed under the ISC license.
|
34049
|
+
* See the LICENSE file in the root directory of this source tree.
|
34050
|
+
*)
|
34051
|
+
|
33452
34052
|
lucide-react/dist/esm/icons/more-vertical.js:
|
33453
34053
|
(**
|
33454
34054
|
* @license lucide-react v0.298.0 - ISC
|
@@ -33497,6 +34097,22 @@ lucide-react/dist/esm/icons/sliders-horizontal.js:
|
|
33497
34097
|
* See the LICENSE file in the root directory of this source tree.
|
33498
34098
|
*)
|
33499
34099
|
|
34100
|
+
lucide-react/dist/esm/icons/smartphone.js:
|
34101
|
+
(**
|
34102
|
+
* @license lucide-react v0.298.0 - ISC
|
34103
|
+
*
|
34104
|
+
* This source code is licensed under the ISC license.
|
34105
|
+
* See the LICENSE file in the root directory of this source tree.
|
34106
|
+
*)
|
34107
|
+
|
34108
|
+
lucide-react/dist/esm/icons/tablet.js:
|
34109
|
+
(**
|
34110
|
+
* @license lucide-react v0.298.0 - ISC
|
34111
|
+
*
|
34112
|
+
* This source code is licensed under the ISC license.
|
34113
|
+
* See the LICENSE file in the root directory of this source tree.
|
34114
|
+
*)
|
34115
|
+
|
33500
34116
|
lucide-react/dist/esm/icons/trash.js:
|
33501
34117
|
(**
|
33502
34118
|
* @license lucide-react v0.298.0 - ISC
|
@@ -33521,6 +34137,22 @@ lucide-react/dist/esm/icons/unlock.js:
|
|
33521
34137
|
* See the LICENSE file in the root directory of this source tree.
|
33522
34138
|
*)
|
33523
34139
|
|
34140
|
+
lucide-react/dist/esm/icons/zoom-in.js:
|
34141
|
+
(**
|
34142
|
+
* @license lucide-react v0.298.0 - ISC
|
34143
|
+
*
|
34144
|
+
* This source code is licensed under the ISC license.
|
34145
|
+
* See the LICENSE file in the root directory of this source tree.
|
34146
|
+
*)
|
34147
|
+
|
34148
|
+
lucide-react/dist/esm/icons/zoom-out.js:
|
34149
|
+
(**
|
34150
|
+
* @license lucide-react v0.298.0 - ISC
|
34151
|
+
*
|
34152
|
+
* This source code is licensed under the ISC license.
|
34153
|
+
* See the LICENSE file in the root directory of this source tree.
|
34154
|
+
*)
|
34155
|
+
|
33524
34156
|
lucide-react/dist/esm/lucide-react.js:
|
33525
34157
|
(**
|
33526
34158
|
* @license lucide-react v0.298.0 - ISC
|