@measured/puck 0.14.0-canary.55740c4 → 0.14.0-canary.70cf177
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{Config-1444273f.d.ts → Config-29dc2731.d.ts} +27 -3
- package/dist/index.css +879 -562
- package/dist/index.d.ts +39 -8
- package/dist/index.js +1303 -595
- package/dist/rsc.d.ts +1 -1
- package/package.json +4 -2
package/dist/index.js
CHANGED
@@ -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;
|
@@ -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) {
|
@@ -29173,7 +29173,7 @@ var import_react2 = require("react");
|
|
29173
29173
|
|
29174
29174
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
|
29175
29175
|
init_react_import();
|
29176
|
-
var Button_module_default = { "Button": "
|
29176
|
+
var Button_module_default = { "Button": "_Button_8fn3a_1", "Button--medium": "_Button--medium_8fn3a_29", "Button--large": "_Button--large_8fn3a_37", "Button-icon": "_Button-icon_8fn3a_44", "Button--primary": "_Button--primary_8fn3a_48", "Button--secondary": "_Button--secondary_8fn3a_67", "Button--flush": "_Button--flush_8fn3a_82", "Button--disabled": "_Button--disabled_8fn3a_86", "Button--fullWidth": "_Button--fullWidth_8fn3a_93", "Button-spinner": "_Button-spinner_8fn3a_98" };
|
29177
29177
|
|
29178
29178
|
// lib/get-class-name-factory.ts
|
29179
29179
|
init_react_import();
|
@@ -29227,7 +29227,7 @@ var Button = ({
|
|
29227
29227
|
}) => {
|
29228
29228
|
const [loading, setLoading] = (0, import_react2.useState)(loadingProp);
|
29229
29229
|
(0, import_react2.useEffect)(() => setLoading(loadingProp), [loadingProp]);
|
29230
|
-
const ElementType = href ? "a" :
|
29230
|
+
const ElementType = href ? "a" : type ? "button" : "span";
|
29231
29231
|
const el = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
29232
29232
|
ElementType,
|
29233
29233
|
{
|
@@ -29255,10 +29255,7 @@ var Button = ({
|
|
29255
29255
|
children: [
|
29256
29256
|
icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName("icon"), children: icon }),
|
29257
29257
|
children,
|
29258
|
-
loading && /* @__PURE__ */ (0, import_jsx_runtime.
|
29259
|
-
"\xA0\xA0",
|
29260
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_spinners.ClipLoader, { "aria-label": "loading", color: "inherit", size: "14px" })
|
29261
|
-
] })
|
29258
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_spinners.ClipLoader, { "aria-label": "loading", color: "inherit", size: "14px" }) })
|
29262
29259
|
]
|
29263
29260
|
}
|
29264
29261
|
);
|
@@ -29267,16 +29264,181 @@ var Button = ({
|
|
29267
29264
|
|
29268
29265
|
// components/Drawer/index.tsx
|
29269
29266
|
init_react_import();
|
29270
|
-
|
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 }) => 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
|
+
};
|
29271
29409
|
|
29272
29410
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
|
29273
29411
|
init_react_import();
|
29274
|
-
var styles_module_default = { "
|
29412
|
+
var styles_module_default = { "Drawer": "_Drawer_6zh0b_1", "DrawerItem-default": "_DrawerItem-default_6zh0b_5", "DrawerItem-draggableWrapper": "_DrawerItem-draggableWrapper_6zh0b_5", "DrawerItem": "_DrawerItem_6zh0b_5", "DrawerItem-draggable": "_DrawerItem-draggable_6zh0b_5", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_6zh0b_31", "DrawerItem-name": "_DrawerItem-name_6zh0b_47" };
|
29275
29413
|
|
29276
29414
|
// components/Draggable/index.tsx
|
29277
29415
|
init_react_import();
|
29278
|
-
var
|
29279
|
-
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 }) => children(defaultProvided2, defaultSnapshot2, defaultRubric);
|
29280
29442
|
var Draggable = ({
|
29281
29443
|
className,
|
29282
29444
|
children,
|
@@ -29286,39 +29448,33 @@ var Draggable = ({
|
|
29286
29448
|
disableAnimations = false,
|
29287
29449
|
isDragDisabled = false
|
29288
29450
|
}) => {
|
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
|
-
] });
|
29319
|
-
}
|
29320
|
-
}
|
29321
|
-
);
|
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
|
+
} });
|
29322
29478
|
};
|
29323
29479
|
|
29324
29480
|
// components/DragIcon/index.tsx
|
@@ -29350,26 +29506,26 @@ var replace = (list, index, newItem) => {
|
|
29350
29506
|
|
29351
29507
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DragIcon/styles.module.css#css-module
|
29352
29508
|
init_react_import();
|
29353
|
-
var styles_module_default2 = { "DragIcon": "
|
29509
|
+
var styles_module_default2 = { "DragIcon": "_DragIcon_1p5wn_1" };
|
29354
29510
|
|
29355
29511
|
// components/DragIcon/index.tsx
|
29356
|
-
var
|
29512
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
29357
29513
|
var getClassName2 = get_class_name_factory_default("DragIcon", styles_module_default2);
|
29358
|
-
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" }) }) });
|
29359
29515
|
|
29360
29516
|
// components/Drawer/index.tsx
|
29361
|
-
var
|
29362
|
-
var
|
29517
|
+
var import_react4 = require("react");
|
29518
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
29363
29519
|
var getClassName3 = get_class_name_factory_default("Drawer", styles_module_default);
|
29364
29520
|
var getClassNameItem = get_class_name_factory_default("DrawerItem", styles_module_default);
|
29365
|
-
var drawerContext = (0,
|
29521
|
+
var drawerContext = (0, import_react4.createContext)({
|
29366
29522
|
droppableId: ""
|
29367
29523
|
});
|
29368
29524
|
var DrawerDraggable = ({
|
29369
29525
|
children,
|
29370
29526
|
id,
|
29371
29527
|
index
|
29372
|
-
}) => /* @__PURE__ */ (0,
|
29528
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
29373
29529
|
Draggable,
|
29374
29530
|
{
|
29375
29531
|
id,
|
@@ -29385,17 +29541,18 @@ var DrawerItem = ({
|
|
29385
29541
|
name,
|
29386
29542
|
children,
|
29387
29543
|
id,
|
29544
|
+
label,
|
29388
29545
|
index
|
29389
29546
|
}) => {
|
29390
|
-
const ctx = (0,
|
29547
|
+
const ctx = (0, import_react4.useContext)(drawerContext);
|
29391
29548
|
const resolvedId = `${ctx.droppableId}::${id || name}`;
|
29392
|
-
const CustomInner = (0,
|
29393
|
-
() => children || (({ children: children2 }) => /* @__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 })),
|
29394
29551
|
[children]
|
29395
29552
|
);
|
29396
|
-
return /* @__PURE__ */ (0,
|
29397
|
-
/* @__PURE__ */ (0,
|
29398
|
-
/* @__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, {}) })
|
29399
29556
|
] }) }) }) });
|
29400
29557
|
};
|
29401
29558
|
var Drawer = ({
|
@@ -29403,7 +29560,7 @@ var Drawer = ({
|
|
29403
29560
|
droppableId = "component-list",
|
29404
29561
|
direction = "vertical"
|
29405
29562
|
}) => {
|
29406
|
-
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)(
|
29407
29564
|
"div",
|
29408
29565
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
29409
29566
|
ref: provided.innerRef,
|
@@ -29412,7 +29569,7 @@ var Drawer = ({
|
|
29412
29569
|
}),
|
29413
29570
|
children: [
|
29414
29571
|
children,
|
29415
|
-
/* @__PURE__ */ (0,
|
29572
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
|
29416
29573
|
]
|
29417
29574
|
})
|
29418
29575
|
) }) });
|
@@ -29425,19 +29582,19 @@ var import_react9 = require("react");
|
|
29425
29582
|
|
29426
29583
|
// components/DraggableComponent/index.tsx
|
29427
29584
|
init_react_import();
|
29428
|
-
var
|
29429
|
-
var import_dnd3 = require("@
|
29585
|
+
var import_react7 = require("react");
|
29586
|
+
var import_dnd3 = require("@measured/dnd");
|
29430
29587
|
|
29431
29588
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
29432
29589
|
init_react_import();
|
29433
|
-
var styles_module_default3 = { "DraggableComponent": "
|
29590
|
+
var styles_module_default3 = { "DraggableComponent": "_DraggableComponent_175tf_1", "DraggableComponent--isDragging": "_DraggableComponent--isDragging_175tf_11", "DraggableComponent-contents": "_DraggableComponent-contents_175tf_16", "DraggableComponent-overlay": "_DraggableComponent-overlay_175tf_29", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_175tf_49", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_175tf_65", "DraggableComponent--forceHover": "_DraggableComponent--forceHover_175tf_71", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_175tf_76", "DraggableComponent--indicativeHover": "_DraggableComponent--indicativeHover_175tf_81", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_175tf_97", "DraggableComponent-actions": "_DraggableComponent-actions_175tf_97", "DraggableComponent-actionsLabel": "_DraggableComponent-actionsLabel_175tf_127", "DraggableComponent-action": "_DraggableComponent-action_175tf_97" };
|
29434
29591
|
|
29435
29592
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
29436
29593
|
init_react_import();
|
29437
29594
|
|
29438
29595
|
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
29439
29596
|
init_react_import();
|
29440
|
-
var
|
29597
|
+
var import_react5 = require("react");
|
29441
29598
|
|
29442
29599
|
// ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
|
29443
29600
|
init_react_import();
|
@@ -29456,10 +29613,10 @@ var defaultAttributes = {
|
|
29456
29613
|
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
29457
29614
|
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim();
|
29458
29615
|
var createLucideIcon = (iconName, iconNode) => {
|
29459
|
-
const Component = (0,
|
29616
|
+
const Component = (0, import_react5.forwardRef)(
|
29460
29617
|
(_a, ref) => {
|
29461
29618
|
var _b = _a, { color = "currentColor", size = 24, strokeWidth = 2, absoluteStrokeWidth, className = "", children } = _b, rest = __objRest(_b, ["color", "size", "strokeWidth", "absoluteStrokeWidth", "className", "children"]);
|
29462
|
-
return (0,
|
29619
|
+
return (0, import_react5.createElement)(
|
29463
29620
|
"svg",
|
29464
29621
|
__spreadValues(__spreadProps(__spreadValues({
|
29465
29622
|
ref
|
@@ -29471,7 +29628,7 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
29471
29628
|
className: ["lucide", `lucide-${toKebabCase(iconName)}`, className].join(" ")
|
29472
29629
|
}), rest),
|
29473
29630
|
[
|
29474
|
-
...iconNode.map(([tag, attrs]) => (0,
|
29631
|
+
...iconNode.map(([tag, attrs]) => (0, import_react5.createElement)(tag, attrs)),
|
29475
29632
|
...Array.isArray(children) ? children : [children]
|
29476
29633
|
]
|
29477
29634
|
);
|
@@ -29582,6 +29739,14 @@ var Lock = createLucideIcon("Lock", [
|
|
29582
29739
|
["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
|
29583
29740
|
]);
|
29584
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
|
+
|
29585
29750
|
// ../../node_modules/lucide-react/dist/esm/icons/more-vertical.js
|
29586
29751
|
init_react_import();
|
29587
29752
|
var MoreVertical = createLucideIcon("MoreVertical", [
|
@@ -29618,6 +29783,34 @@ var Search = createLucideIcon("Search", [
|
|
29618
29783
|
["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
|
29619
29784
|
]);
|
29620
29785
|
|
29786
|
+
// ../../node_modules/lucide-react/dist/esm/icons/sliders-horizontal.js
|
29787
|
+
init_react_import();
|
29788
|
+
var SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
|
29789
|
+
["line", { x1: "21", x2: "14", y1: "4", y2: "4", key: "obuewd" }],
|
29790
|
+
["line", { x1: "10", x2: "3", y1: "4", y2: "4", key: "1q6298" }],
|
29791
|
+
["line", { x1: "21", x2: "12", y1: "12", y2: "12", key: "1iu8h1" }],
|
29792
|
+
["line", { x1: "8", x2: "3", y1: "12", y2: "12", key: "ntss68" }],
|
29793
|
+
["line", { x1: "21", x2: "16", y1: "20", y2: "20", key: "14d8ph" }],
|
29794
|
+
["line", { x1: "12", x2: "3", y1: "20", y2: "20", key: "m0wm8r" }],
|
29795
|
+
["line", { x1: "14", x2: "14", y1: "2", y2: "6", key: "14e1ph" }],
|
29796
|
+
["line", { x1: "8", x2: "8", y1: "10", y2: "14", key: "1i6ji0" }],
|
29797
|
+
["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
|
29798
|
+
]);
|
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
|
+
|
29621
29814
|
// ../../node_modules/lucide-react/dist/esm/icons/trash.js
|
29622
29815
|
init_react_import();
|
29623
29816
|
var Trash = createLucideIcon("Trash", [
|
@@ -29641,12 +29834,29 @@ var Unlock = createLucideIcon("Unlock", [
|
|
29641
29834
|
["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
|
29642
29835
|
]);
|
29643
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
|
+
|
29644
29854
|
// lib/use-modifier-held.ts
|
29645
29855
|
init_react_import();
|
29646
|
-
var
|
29856
|
+
var import_react6 = require("react");
|
29647
29857
|
var useModifierHeld = (modifier) => {
|
29648
|
-
const [modifierHeld, setModifierHeld] = (0,
|
29649
|
-
(0,
|
29858
|
+
const [modifierHeld, setModifierHeld] = (0, import_react6.useState)(false);
|
29859
|
+
(0, import_react6.useEffect)(() => {
|
29650
29860
|
function downHandler({ key }) {
|
29651
29861
|
if (key === modifier) {
|
29652
29862
|
setModifierHeld(true);
|
@@ -29669,8 +29879,12 @@ var useModifierHeld = (modifier) => {
|
|
29669
29879
|
|
29670
29880
|
// components/DraggableComponent/index.tsx
|
29671
29881
|
var import_react_spinners2 = require("react-spinners");
|
29672
|
-
var
|
29882
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
29673
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;
|
29674
29888
|
var DraggableComponent = ({
|
29675
29889
|
children,
|
29676
29890
|
id,
|
@@ -29693,91 +29907,74 @@ var DraggableComponent = ({
|
|
29693
29907
|
indicativeHover = false,
|
29694
29908
|
style
|
29695
29909
|
}) => {
|
29910
|
+
const { zoomConfig } = useAppContext();
|
29696
29911
|
const isModifierHeld = useModifierHeld("Alt");
|
29697
|
-
|
29698
|
-
|
29699
|
-
|
29700
|
-
|
29701
|
-
|
29702
|
-
|
29703
|
-
|
29704
|
-
|
29705
|
-
|
29706
|
-
|
29707
|
-
|
29708
|
-
|
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
|
-
var setupZone = (data, zoneKey) => {
|
29755
|
-
if (zoneKey === rootDroppableId) {
|
29756
|
-
return data;
|
29757
|
-
}
|
29758
|
-
const newData = __spreadValues({}, data);
|
29759
|
-
newData.zones = data.zones || {};
|
29760
|
-
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
29761
|
-
return newData;
|
29762
|
-
};
|
29763
|
-
|
29764
|
-
// lib/get-item.ts
|
29765
|
-
var getItem = (selector, data, dynamicProps = {}) => {
|
29766
|
-
if (!selector.zone || selector.zone === rootDroppableId) {
|
29767
|
-
const item2 = data.content[selector.index];
|
29768
|
-
return __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props });
|
29769
|
-
}
|
29770
|
-
const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
|
29771
|
-
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);
|
29772
29969
|
};
|
29773
29970
|
|
29774
29971
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
|
29775
29972
|
init_react_import();
|
29776
|
-
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" };
|
29777
29974
|
|
29778
29975
|
// components/DropZone/context.tsx
|
29779
29976
|
init_react_import();
|
29780
|
-
var
|
29977
|
+
var import_react8 = require("react");
|
29781
29978
|
var import_use_debounce = require("use-debounce");
|
29782
29979
|
|
29783
29980
|
// lib/get-zone-id.ts
|
@@ -29793,30 +29990,30 @@ var getZoneId = (zoneCompound) => {
|
|
29793
29990
|
};
|
29794
29991
|
|
29795
29992
|
// components/DropZone/context.tsx
|
29796
|
-
var
|
29797
|
-
var dropZoneContext = (0,
|
29993
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
29994
|
+
var dropZoneContext = (0, import_react8.createContext)(null);
|
29798
29995
|
var DropZoneProvider = ({
|
29799
29996
|
children,
|
29800
29997
|
value
|
29801
29998
|
}) => {
|
29802
|
-
const [hoveringArea, setHoveringArea] = (0,
|
29803
|
-
const [hoveringZone, setHoveringZone] = (0,
|
29999
|
+
const [hoveringArea, setHoveringArea] = (0, import_react8.useState)(null);
|
30000
|
+
const [hoveringZone, setHoveringZone] = (0, import_react8.useState)(
|
29804
30001
|
rootDroppableId
|
29805
30002
|
);
|
29806
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
30003
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react8.useState)();
|
29807
30004
|
const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
|
29808
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
30005
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react8.useState)(
|
29809
30006
|
{}
|
29810
30007
|
);
|
29811
|
-
const [activeZones, setActiveZones] = (0,
|
30008
|
+
const [activeZones, setActiveZones] = (0, import_react8.useState)({});
|
29812
30009
|
const { dispatch = null } = value ? value : {};
|
29813
|
-
const registerZoneArea = (0,
|
30010
|
+
const registerZoneArea = (0, import_react8.useCallback)(
|
29814
30011
|
(area) => {
|
29815
30012
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
29816
30013
|
},
|
29817
30014
|
[setAreasWithZones]
|
29818
30015
|
);
|
29819
|
-
const registerZone = (0,
|
30016
|
+
const registerZone = (0, import_react8.useCallback)(
|
29820
30017
|
(zoneCompound) => {
|
29821
30018
|
if (!dispatch) {
|
29822
30019
|
return;
|
@@ -29829,7 +30026,7 @@ var DropZoneProvider = ({
|
|
29829
30026
|
},
|
29830
30027
|
[setActiveZones, dispatch]
|
29831
30028
|
);
|
29832
|
-
const unregisterZone = (0,
|
30029
|
+
const unregisterZone = (0, import_react8.useCallback)(
|
29833
30030
|
(zoneCompound) => {
|
29834
30031
|
if (!dispatch) {
|
29835
30032
|
return;
|
@@ -29844,8 +30041,8 @@ var DropZoneProvider = ({
|
|
29844
30041
|
},
|
29845
30042
|
[setActiveZones, dispatch]
|
29846
30043
|
);
|
29847
|
-
const [pathData, setPathData] = (0,
|
29848
|
-
const registerPath = (0,
|
30044
|
+
const [pathData, setPathData] = (0, import_react8.useState)();
|
30045
|
+
const registerPath = (0, import_react8.useCallback)(
|
29849
30046
|
(selector) => {
|
29850
30047
|
if (!(value == null ? void 0 : value.data)) {
|
29851
30048
|
return;
|
@@ -29870,7 +30067,8 @@ var DropZoneProvider = ({
|
|
29870
30067
|
},
|
29871
30068
|
[value, setPathData]
|
29872
30069
|
);
|
29873
|
-
|
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)(
|
29874
30072
|
dropZoneContext.Provider,
|
29875
30073
|
{
|
29876
30074
|
value: __spreadValues({
|
@@ -29886,57 +30084,17 @@ var DropZoneProvider = ({
|
|
29886
30084
|
unregisterZone,
|
29887
30085
|
activeZones,
|
29888
30086
|
registerPath,
|
29889
|
-
pathData
|
30087
|
+
pathData,
|
30088
|
+
zoneWillDrag,
|
30089
|
+
setZoneWillDrag
|
29890
30090
|
}, value),
|
29891
30091
|
children
|
29892
30092
|
}
|
29893
30093
|
) });
|
29894
30094
|
};
|
29895
30095
|
|
29896
|
-
// components/Puck/context.tsx
|
29897
|
-
init_react_import();
|
29898
|
-
var import_react8 = require("react");
|
29899
|
-
var defaultAppState = {
|
29900
|
-
data: { content: [], root: { props: { title: "" } } },
|
29901
|
-
ui: {
|
29902
|
-
leftSideBarVisible: true,
|
29903
|
-
rightSideBarVisible: true,
|
29904
|
-
arrayState: {},
|
29905
|
-
itemSelector: null,
|
29906
|
-
componentList: {},
|
29907
|
-
isDragging: false
|
29908
|
-
}
|
29909
|
-
};
|
29910
|
-
var appContext = (0, import_react8.createContext)({
|
29911
|
-
state: defaultAppState,
|
29912
|
-
dispatch: () => null,
|
29913
|
-
config: { components: {} },
|
29914
|
-
componentState: {},
|
29915
|
-
resolveData: () => {
|
29916
|
-
},
|
29917
|
-
plugins: [],
|
29918
|
-
overrides: {},
|
29919
|
-
history: {}
|
29920
|
-
});
|
29921
|
-
var AppProvider = appContext.Provider;
|
29922
|
-
function useAppContext() {
|
29923
|
-
const mainContext = (0, import_react8.useContext)(appContext);
|
29924
|
-
const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
|
29925
|
-
return __spreadProps(__spreadValues({}, mainContext), {
|
29926
|
-
// Helpers
|
29927
|
-
selectedItem,
|
29928
|
-
setUi: (ui, recordHistory) => {
|
29929
|
-
return mainContext.dispatch({
|
29930
|
-
type: "setUi",
|
29931
|
-
ui,
|
29932
|
-
recordHistory
|
29933
|
-
});
|
29934
|
-
}
|
29935
|
-
});
|
29936
|
-
}
|
29937
|
-
|
29938
30096
|
// components/DropZone/index.tsx
|
29939
|
-
var
|
30097
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
29940
30098
|
var getClassName5 = get_class_name_factory_default("DropZone", styles_module_default4);
|
29941
30099
|
function DropZoneEdit({ zone, allow, disallow, style }) {
|
29942
30100
|
var _a;
|
@@ -29955,7 +30113,8 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
29955
30113
|
registerZoneArea,
|
29956
30114
|
areasWithZones,
|
29957
30115
|
hoveringComponent,
|
29958
|
-
|
30116
|
+
zoneWillDrag,
|
30117
|
+
setZoneWillDrag = () => null
|
29959
30118
|
} = ctx || {};
|
29960
30119
|
let content = data.content || [];
|
29961
30120
|
let zoneCompound = rootDroppableId;
|
@@ -29985,12 +30144,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
29985
30144
|
const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
|
29986
30145
|
const [zoneArea] = getZoneId(zoneCompound);
|
29987
30146
|
const [draggedSourceArea] = getZoneId(draggedSourceId);
|
29988
|
-
const
|
30147
|
+
const userWillDrag = zoneWillDrag === zone;
|
29989
30148
|
const userIsDragging = !!draggedItem;
|
29990
30149
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
29991
30150
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
29992
30151
|
if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
|
29993
|
-
return /* @__PURE__ */ (0,
|
30152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: "DropZone requires context to work." });
|
29994
30153
|
}
|
29995
30154
|
const {
|
29996
30155
|
hoveringArea = "root",
|
@@ -30027,7 +30186,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30027
30186
|
}
|
30028
30187
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
30029
30188
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
30030
|
-
return /* @__PURE__ */ (0,
|
30189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30031
30190
|
"div",
|
30032
30191
|
{
|
30033
30192
|
className: getClassName5({
|
@@ -30039,17 +30198,19 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30039
30198
|
isDestination: draggedDestinationId === zoneCompound,
|
30040
30199
|
isDisabled: !isEnabled,
|
30041
30200
|
isAreaSelected,
|
30042
|
-
hasChildren: content.length > 0
|
30043
|
-
zoomEnabled: !disableZoom
|
30201
|
+
hasChildren: content.length > 0
|
30044
30202
|
}),
|
30045
|
-
|
30046
|
-
|
30203
|
+
onMouseUp: () => {
|
30204
|
+
setZoneWillDrag("");
|
30205
|
+
},
|
30206
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30207
|
+
Droppable,
|
30047
30208
|
{
|
30048
30209
|
droppableId: zoneCompound,
|
30049
30210
|
direction: "vertical",
|
30050
30211
|
isDropDisabled: !isEnabled,
|
30051
30212
|
children: (provided, snapshot) => {
|
30052
|
-
return /* @__PURE__ */ (0,
|
30213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
30053
30214
|
"div",
|
30054
30215
|
__spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
|
30055
30216
|
className: getClassName5("content"),
|
@@ -30063,7 +30224,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30063
30224
|
},
|
30064
30225
|
children: [
|
30065
30226
|
content.map((item, i) => {
|
30066
|
-
var _a2, _b;
|
30227
|
+
var _a2, _b, _c;
|
30067
30228
|
const componentId = item.props.id;
|
30068
30229
|
const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a2 = config.components[item.type]) == null ? void 0 : _a2.defaultProps), item.props), {
|
30069
30230
|
puck: { renderDropZone: DropZone },
|
@@ -30074,33 +30235,33 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30074
30235
|
"draggable-"
|
30075
30236
|
)[1] === componentId;
|
30076
30237
|
const containsZone = areasWithZones ? areasWithZones[componentId] : false;
|
30077
|
-
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: [
|
30078
30239
|
"No configuration for ",
|
30079
30240
|
item.type
|
30080
30241
|
] });
|
30081
|
-
return /* @__PURE__ */ (0,
|
30242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
30082
30243
|
"div",
|
30083
30244
|
{
|
30084
30245
|
className: getClassName5("item"),
|
30085
30246
|
style: { zIndex: isDragging ? 1 : void 0 },
|
30086
30247
|
children: [
|
30087
|
-
/* @__PURE__ */ (0,
|
30248
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30088
30249
|
DropZoneProvider,
|
30089
30250
|
{
|
30090
30251
|
value: __spreadProps(__spreadValues({}, ctx), {
|
30091
30252
|
areaId: componentId
|
30092
30253
|
}),
|
30093
|
-
children: /* @__PURE__ */ (0,
|
30254
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30094
30255
|
DraggableComponent,
|
30095
30256
|
{
|
30096
|
-
label: item.type.toString(),
|
30257
|
+
label: (_b = config.components[item.type]["label"]) != null ? _b : item.type.toString(),
|
30097
30258
|
id: `draggable-${componentId}`,
|
30098
30259
|
index: i,
|
30099
30260
|
isSelected,
|
30100
30261
|
isLocked: userIsDragging,
|
30101
30262
|
forceHover: hoveringComponent === componentId && !userIsDragging,
|
30102
30263
|
indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
|
30103
|
-
isLoading: (
|
30264
|
+
isLoading: (_c = appContext2.componentState[componentId]) == null ? void 0 : _c.loading,
|
30104
30265
|
onMount: () => {
|
30105
30266
|
ctx.registerPath({
|
30106
30267
|
index: i,
|
@@ -30116,11 +30277,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30116
30277
|
},
|
30117
30278
|
onMouseDown: (e) => {
|
30118
30279
|
e.stopPropagation();
|
30119
|
-
|
30120
|
-
},
|
30121
|
-
onMouseUp: (e) => {
|
30122
|
-
e.stopPropagation();
|
30123
|
-
setUserWillDrag(false);
|
30280
|
+
setZoneWillDrag(zone);
|
30124
30281
|
},
|
30125
30282
|
onMouseOver: (e) => {
|
30126
30283
|
e.stopPropagation();
|
@@ -30161,12 +30318,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30161
30318
|
style: {
|
30162
30319
|
pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
|
30163
30320
|
},
|
30164
|
-
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)) })
|
30165
30322
|
}
|
30166
30323
|
)
|
30167
30324
|
}
|
30168
30325
|
),
|
30169
|
-
userIsDragging && /* @__PURE__ */ (0,
|
30326
|
+
userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30170
30327
|
"div",
|
30171
30328
|
{
|
30172
30329
|
className: getClassName5("hitbox"),
|
@@ -30183,12 +30340,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30183
30340
|
);
|
30184
30341
|
}),
|
30185
30342
|
provided == null ? void 0 : provided.placeholder,
|
30186
|
-
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0,
|
30343
|
+
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30187
30344
|
"div",
|
30188
30345
|
{
|
30189
30346
|
"data-puck-placeholder": true,
|
30190
30347
|
style: __spreadProps(__spreadValues({}, placeholderStyle), {
|
30191
|
-
background: "var(--puck-color-azure-
|
30348
|
+
background: "var(--puck-color-azure-06)",
|
30192
30349
|
opacity: 0.3,
|
30193
30350
|
zIndex: 0
|
30194
30351
|
})
|
@@ -30215,14 +30372,14 @@ function DropZoneRender({ zone }) {
|
|
30215
30372
|
zoneCompound = `${areaId}:${zone}`;
|
30216
30373
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
30217
30374
|
}
|
30218
|
-
return /* @__PURE__ */ (0,
|
30375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: content.map((item) => {
|
30219
30376
|
const Component = config.components[item.type];
|
30220
30377
|
if (Component) {
|
30221
|
-
return /* @__PURE__ */ (0,
|
30378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30222
30379
|
DropZoneProvider,
|
30223
30380
|
{
|
30224
30381
|
value: { data, config, areaId: item.props.id },
|
30225
|
-
children: /* @__PURE__ */ (0,
|
30382
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30226
30383
|
Component.render,
|
30227
30384
|
__spreadProps(__spreadValues({}, item.props), {
|
30228
30385
|
puck: { renderDropZone: DropZone }
|
@@ -30238,9 +30395,9 @@ function DropZoneRender({ zone }) {
|
|
30238
30395
|
function DropZone(props) {
|
30239
30396
|
const ctx = (0, import_react9.useContext)(dropZoneContext);
|
30240
30397
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
30241
|
-
return /* @__PURE__ */ (0,
|
30398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneEdit, __spreadValues({}, props));
|
30242
30399
|
}
|
30243
|
-
return /* @__PURE__ */ (0,
|
30400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneRender, __spreadValues({}, props));
|
30244
30401
|
}
|
30245
30402
|
|
30246
30403
|
// components/IconButton/index.ts
|
@@ -30252,11 +30409,11 @@ var import_react10 = require("react");
|
|
30252
30409
|
|
30253
30410
|
// css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
|
30254
30411
|
init_react_import();
|
30255
|
-
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" };
|
30256
30413
|
|
30257
30414
|
// components/IconButton/IconButton.tsx
|
30258
30415
|
var import_react_spinners3 = require("react-spinners");
|
30259
|
-
var
|
30416
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
30260
30417
|
var getClassName6 = get_class_name_factory_default("IconButton", IconButton_module_default);
|
30261
30418
|
var IconButton = ({
|
30262
30419
|
children,
|
@@ -30272,7 +30429,7 @@ var IconButton = ({
|
|
30272
30429
|
}) => {
|
30273
30430
|
const [loading, setLoading] = (0, import_react10.useState)(false);
|
30274
30431
|
const ElementType = href ? "a" : "button";
|
30275
|
-
const el = /* @__PURE__ */ (0,
|
30432
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
30276
30433
|
ElementType,
|
30277
30434
|
{
|
30278
30435
|
className: getClassName6({
|
@@ -30297,11 +30454,11 @@ var IconButton = ({
|
|
30297
30454
|
href,
|
30298
30455
|
title,
|
30299
30456
|
children: [
|
30300
|
-
/* @__PURE__ */ (0,
|
30457
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: getClassName6("title"), children: title }),
|
30301
30458
|
children,
|
30302
|
-
loading && /* @__PURE__ */ (0,
|
30459
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
30303
30460
|
"\xA0\xA0",
|
30304
|
-
/* @__PURE__ */ (0,
|
30461
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
|
30305
30462
|
] })
|
30306
30463
|
]
|
30307
30464
|
}
|
@@ -30311,8 +30468,7 @@ var IconButton = ({
|
|
30311
30468
|
|
30312
30469
|
// components/Puck/index.tsx
|
30313
30470
|
init_react_import();
|
30314
|
-
var
|
30315
|
-
var import_dnd7 = require("@hello-pangea/dnd");
|
30471
|
+
var import_react28 = require("react");
|
30316
30472
|
|
30317
30473
|
// lib/use-placeholder-style.ts
|
30318
30474
|
init_react_import();
|
@@ -30321,16 +30477,17 @@ var usePlaceholderStyle = () => {
|
|
30321
30477
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
30322
30478
|
const [placeholderStyle, setPlaceholderStyle] = (0, import_react11.useState)();
|
30323
30479
|
const onDragStartOrUpdate = (draggedItem) => {
|
30324
|
-
var _a;
|
30480
|
+
var _a, _b, _c;
|
30325
30481
|
const draggableId = draggedItem.draggableId;
|
30326
30482
|
const destinationIndex = (draggedItem.destination || draggedItem.source).index;
|
30327
30483
|
const droppableId = (draggedItem.destination || draggedItem.source).droppableId;
|
30328
30484
|
const domQuery = `[${queryAttr}='${draggableId}']`;
|
30329
|
-
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));
|
30330
30487
|
if (!draggedDOM) {
|
30331
30488
|
return;
|
30332
30489
|
}
|
30333
|
-
const targetListElement = document.querySelector(
|
30490
|
+
const targetListElement = (_b = iframe == null ? void 0 : iframe.contentWindow) == null ? void 0 : _b.document.querySelector(
|
30334
30491
|
`[data-rfd-droppable-id='${droppableId}']`
|
30335
30492
|
);
|
30336
30493
|
const { clientHeight } = draggedDOM;
|
@@ -30338,7 +30495,7 @@ var usePlaceholderStyle = () => {
|
|
30338
30495
|
return;
|
30339
30496
|
}
|
30340
30497
|
let clientY = 0;
|
30341
|
-
const isSameDroppable = draggedItem.source.droppableId === ((
|
30498
|
+
const isSameDroppable = draggedItem.source.droppableId === ((_c = draggedItem.destination) == null ? void 0 : _c.droppableId);
|
30342
30499
|
if (destinationIndex > 0) {
|
30343
30500
|
const end = destinationIndex > draggedItem.source.index && isSameDroppable ? destinationIndex + 1 : destinationIndex;
|
30344
30501
|
const children = Array.from(targetListElement.children).filter(
|
@@ -30367,21 +30524,21 @@ init_react_import();
|
|
30367
30524
|
|
30368
30525
|
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
30369
30526
|
init_react_import();
|
30370
|
-
var styles_module_default5 = { "SidebarSection": "
|
30527
|
+
var styles_module_default5 = { "SidebarSection": "_SidebarSection_125qe_1", "SidebarSection-title": "_SidebarSection-title_125qe_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_125qe_20", "SidebarSection-content": "_SidebarSection-content_125qe_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_125qe_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_125qe_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_125qe_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_125qe_41", "SidebarSection-heading": "_SidebarSection-heading_125qe_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_125qe_86" };
|
30371
30528
|
|
30372
30529
|
// components/Heading/index.tsx
|
30373
30530
|
init_react_import();
|
30374
30531
|
|
30375
30532
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
|
30376
30533
|
init_react_import();
|
30377
|
-
var styles_module_default6 = { "Heading": "
|
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" };
|
30378
30535
|
|
30379
30536
|
// components/Heading/index.tsx
|
30380
|
-
var
|
30537
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
30381
30538
|
var getClassName7 = get_class_name_factory_default("Heading", styles_module_default6);
|
30382
30539
|
var Heading = ({ children, rank, size = "m" }) => {
|
30383
30540
|
const Tag = rank ? `h${rank}` : "span";
|
30384
|
-
return /* @__PURE__ */ (0,
|
30541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
30385
30542
|
Tag,
|
30386
30543
|
{
|
30387
30544
|
className: getClassName7({
|
@@ -30460,7 +30617,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
30460
30617
|
|
30461
30618
|
// components/SidebarSection/index.tsx
|
30462
30619
|
var import_react_spinners4 = require("react-spinners");
|
30463
|
-
var
|
30620
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
30464
30621
|
var getClassName8 = get_class_name_factory_default("SidebarSection", styles_module_default5);
|
30465
30622
|
var SidebarSection = ({
|
30466
30623
|
children,
|
@@ -30473,28 +30630,28 @@ var SidebarSection = ({
|
|
30473
30630
|
}) => {
|
30474
30631
|
const { setUi } = useAppContext();
|
30475
30632
|
const breadcrumbs = useBreadcrumbs(1);
|
30476
|
-
return /* @__PURE__ */ (0,
|
30633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
30477
30634
|
"div",
|
30478
30635
|
{
|
30479
30636
|
className: getClassName8({ noBorderTop, noPadding }),
|
30480
30637
|
style: { background },
|
30481
30638
|
children: [
|
30482
|
-
/* @__PURE__ */ (0,
|
30483
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
30484
|
-
/* @__PURE__ */ (0,
|
30485
|
-
"
|
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)(
|
30642
|
+
"button",
|
30486
30643
|
{
|
30487
30644
|
className: getClassName8("breadcrumbLabel"),
|
30488
30645
|
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
30489
30646
|
children: breadcrumb.label
|
30490
30647
|
}
|
30491
30648
|
),
|
30492
|
-
/* @__PURE__ */ (0,
|
30649
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronRight, { size: 16 })
|
30493
30650
|
] }, i)) : null,
|
30494
|
-
/* @__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 }) })
|
30495
30652
|
] }) }),
|
30496
|
-
/* @__PURE__ */ (0,
|
30497
|
-
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" }) })
|
30498
30655
|
]
|
30499
30656
|
}
|
30500
30657
|
);
|
@@ -31000,7 +31157,10 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
31000
31157
|
);
|
31001
31158
|
const runResolvers = () => __async(void 0, null, function* () {
|
31002
31159
|
const newData = newAppState.data;
|
31003
|
-
const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) =>
|
31160
|
+
const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) => {
|
31161
|
+
var _a;
|
31162
|
+
return !!((_a = config.components[item.type]) == null ? void 0 : _a.resolveData);
|
31163
|
+
});
|
31004
31164
|
const applyIfChange = (dynamicDataMap, dynamicRoot) => {
|
31005
31165
|
const processed = applyDynamicProps(
|
31006
31166
|
appState.data,
|
@@ -31070,10 +31230,10 @@ init_react_import();
|
|
31070
31230
|
|
31071
31231
|
// css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
|
31072
31232
|
init_react_import();
|
31073
|
-
var styles_module_default7 = { "MenuBar": "
|
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" };
|
31074
31234
|
|
31075
31235
|
// components/MenuBar/index.tsx
|
31076
|
-
var
|
31236
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
31077
31237
|
var getClassName9 = get_class_name_factory_default("MenuBar", styles_module_default7);
|
31078
31238
|
var MenuBar = ({
|
31079
31239
|
appState,
|
@@ -31088,7 +31248,7 @@ var MenuBar = ({
|
|
31088
31248
|
history: { back, forward, historyStore }
|
31089
31249
|
} = useAppContext();
|
31090
31250
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
31091
|
-
return /* @__PURE__ */ (0,
|
31251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31092
31252
|
"div",
|
31093
31253
|
{
|
31094
31254
|
className: getClassName9({ menuOpen }),
|
@@ -31102,34 +31262,34 @@ var MenuBar = ({
|
|
31102
31262
|
setMenuOpen(false);
|
31103
31263
|
}
|
31104
31264
|
},
|
31105
|
-
children: /* @__PURE__ */ (0,
|
31106
|
-
/* @__PURE__ */ (0,
|
31107
|
-
/* @__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)(
|
31108
31268
|
ChevronLeft,
|
31109
31269
|
{
|
31110
31270
|
size: 21,
|
31111
|
-
stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-
|
31271
|
+
stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
|
31112
31272
|
}
|
31113
31273
|
) }),
|
31114
|
-
/* @__PURE__ */ (0,
|
31274
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31115
31275
|
ChevronRight,
|
31116
31276
|
{
|
31117
31277
|
size: 21,
|
31118
|
-
stroke: hasFuture ? "var(--puck-color-black)" : "var(--puck-color-grey-
|
31278
|
+
stroke: hasFuture ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
|
31119
31279
|
}
|
31120
31280
|
) })
|
31121
31281
|
] }),
|
31122
|
-
/* @__PURE__ */ (0,
|
31282
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
31123
31283
|
state: appState,
|
31124
31284
|
dispatch
|
31125
31285
|
}) }),
|
31126
|
-
/* @__PURE__ */ (0,
|
31286
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31127
31287
|
Button,
|
31128
31288
|
{
|
31129
31289
|
onClick: () => {
|
31130
31290
|
onPublish && onPublish(data);
|
31131
31291
|
},
|
31132
|
-
icon: /* @__PURE__ */ (0,
|
31292
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Globe, { size: "14px" }),
|
31133
31293
|
children: "Publish"
|
31134
31294
|
}
|
31135
31295
|
) })
|
@@ -31140,7 +31300,7 @@ var MenuBar = ({
|
|
31140
31300
|
|
31141
31301
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
31142
31302
|
init_react_import();
|
31143
|
-
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" };
|
31144
31304
|
|
31145
31305
|
// components/Puck/components/Fields/index.tsx
|
31146
31306
|
init_react_import();
|
@@ -31151,7 +31311,7 @@ init_react_import();
|
|
31151
31311
|
|
31152
31312
|
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css#css-module
|
31153
31313
|
init_react_import();
|
31154
|
-
var styles_module_default9 = { "Input": "
|
31314
|
+
var styles_module_default9 = { "Input": "_Input_1qi5b_1", "Input-label": "_Input-label_1qi5b_26", "Input-labelIcon": "_Input-labelIcon_1qi5b_34", "Input-disabledIcon": "_Input-disabledIcon_1qi5b_41", "Input-input": "_Input-input_1qi5b_46", "Input--readOnly": "_Input--readOnly_1qi5b_90", "Input-radioGroupItems": "_Input-radioGroupItems_1qi5b_101", "Input-radio": "_Input-radio_1qi5b_101", "Input-radioInner": "_Input-radioInner_1qi5b_118", "Input-radioInput": "_Input-radioInput_1qi5b_163" };
|
31155
31315
|
|
31156
31316
|
// components/InputOrGroup/index.tsx
|
31157
31317
|
var import_react18 = require("react");
|
@@ -31164,13 +31324,24 @@ init_react_import();
|
|
31164
31324
|
|
31165
31325
|
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ArrayField/styles.module.css#css-module
|
31166
31326
|
init_react_import();
|
31167
|
-
var styles_module_default10 = { "ArrayField": "
|
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" };
|
31168
31328
|
|
31169
31329
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
31170
|
-
var import_dnd5 = require("@hello-pangea/dnd");
|
31171
|
-
var import_dnd6 = require("@hello-pangea/dnd");
|
31172
31330
|
var import_react14 = require("react");
|
31173
|
-
|
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 }) => 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");
|
31174
31345
|
var getClassName10 = get_class_name_factory_default("ArrayField", styles_module_default10);
|
31175
31346
|
var getClassNameItem2 = get_class_name_factory_default("ArrayFieldItem", styles_module_default10);
|
31176
31347
|
var ArrayField = ({
|
@@ -31240,15 +31411,15 @@ var ArrayField = ({
|
|
31240
31411
|
if (field.type !== "array" || !field.arrayFields) {
|
31241
31412
|
return null;
|
31242
31413
|
}
|
31243
|
-
return /* @__PURE__ */ (0,
|
31414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31244
31415
|
FieldLabelInternal,
|
31245
31416
|
{
|
31246
31417
|
label: label || name,
|
31247
|
-
icon: /* @__PURE__ */ (0,
|
31418
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(List, { size: 16 }),
|
31248
31419
|
el: "div",
|
31249
31420
|
readOnly,
|
31250
|
-
children: /* @__PURE__ */ (0,
|
31251
|
-
|
31421
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31422
|
+
DragDropContext,
|
31252
31423
|
{
|
31253
31424
|
onDragEnd: (event) => {
|
31254
31425
|
var _a, _b;
|
@@ -31274,8 +31445,8 @@ var ArrayField = ({
|
|
31274
31445
|
});
|
31275
31446
|
}
|
31276
31447
|
},
|
31277
|
-
children: /* @__PURE__ */ (0,
|
31278
|
-
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)(
|
31279
31450
|
"div",
|
31280
31451
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
31281
31452
|
ref: provided.innerRef,
|
@@ -31295,7 +31466,7 @@ var ArrayField = ({
|
|
31295
31466
|
localState.arrayState.items.map((item, i) => {
|
31296
31467
|
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
31297
31468
|
const data = Array.from(localState.value || [])[i] || {};
|
31298
|
-
return /* @__PURE__ */ (0,
|
31469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31299
31470
|
Draggable,
|
31300
31471
|
{
|
31301
31472
|
id: _arrayId,
|
@@ -31306,8 +31477,8 @@ var ArrayField = ({
|
|
31306
31477
|
readOnly
|
31307
31478
|
}),
|
31308
31479
|
isDragDisabled: readOnly || !hovering,
|
31309
|
-
children: () => /* @__PURE__ */ (0,
|
31310
|
-
/* @__PURE__ */ (0,
|
31480
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
31481
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
31311
31482
|
"div",
|
31312
31483
|
{
|
31313
31484
|
onClick: () => {
|
@@ -31328,10 +31499,11 @@ var ArrayField = ({
|
|
31328
31499
|
className: getClassNameItem2("summary"),
|
31329
31500
|
children: [
|
31330
31501
|
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
31331
|
-
/* @__PURE__ */ (0,
|
31332
|
-
!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)(
|
31333
31504
|
IconButton,
|
31334
31505
|
{
|
31506
|
+
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
31335
31507
|
onClick: (e) => {
|
31336
31508
|
e.stopPropagation();
|
31337
31509
|
const existingValue = [
|
@@ -31350,20 +31522,20 @@ var ArrayField = ({
|
|
31350
31522
|
);
|
31351
31523
|
},
|
31352
31524
|
title: "Delete",
|
31353
|
-
children: /* @__PURE__ */ (0,
|
31525
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Trash, { size: 16 })
|
31354
31526
|
}
|
31355
31527
|
) }) }),
|
31356
|
-
/* @__PURE__ */ (0,
|
31528
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DragIcon, {}) })
|
31357
31529
|
] })
|
31358
31530
|
]
|
31359
31531
|
}
|
31360
31532
|
),
|
31361
|
-
/* @__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(
|
31362
31534
|
(fieldName) => {
|
31363
31535
|
const subField = field.arrayFields[fieldName];
|
31364
31536
|
const subFieldName = `${name}[${i}].${fieldName}`;
|
31365
31537
|
const wildcardFieldName = `${name}[*].${fieldName}`;
|
31366
|
-
return /* @__PURE__ */ (0,
|
31538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31367
31539
|
InputOrGroup,
|
31368
31540
|
{
|
31369
31541
|
name: subFieldName,
|
@@ -31392,10 +31564,11 @@ var ArrayField = ({
|
|
31392
31564
|
);
|
31393
31565
|
}),
|
31394
31566
|
provided.placeholder,
|
31395
|
-
/* @__PURE__ */ (0,
|
31567
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31396
31568
|
"button",
|
31397
31569
|
{
|
31398
31570
|
className: getClassName10("addButton"),
|
31571
|
+
disabled: field.max !== void 0 && localState.arrayState.items.length >= field.max,
|
31399
31572
|
onClick: () => {
|
31400
31573
|
const existingValue = value || [];
|
31401
31574
|
const newValue = [
|
@@ -31405,7 +31578,7 @@ var ArrayField = ({
|
|
31405
31578
|
const newArrayState = regenerateArrayState(newValue);
|
31406
31579
|
onChange(newValue, mapArrayStateToUi(newArrayState));
|
31407
31580
|
},
|
31408
|
-
children: /* @__PURE__ */ (0,
|
31581
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Plus, { size: 21 })
|
31409
31582
|
}
|
31410
31583
|
)
|
31411
31584
|
]
|
@@ -31420,7 +31593,7 @@ var ArrayField = ({
|
|
31420
31593
|
|
31421
31594
|
// components/InputOrGroup/fields/DefaultField/index.tsx
|
31422
31595
|
init_react_import();
|
31423
|
-
var
|
31596
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
31424
31597
|
var getClassName11 = get_class_name_factory_default("Input", styles_module_default9);
|
31425
31598
|
var DefaultField = ({
|
31426
31599
|
field,
|
@@ -31431,16 +31604,16 @@ var DefaultField = ({
|
|
31431
31604
|
label,
|
31432
31605
|
id
|
31433
31606
|
}) => {
|
31434
|
-
return /* @__PURE__ */ (0,
|
31607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
31435
31608
|
FieldLabelInternal,
|
31436
31609
|
{
|
31437
31610
|
label: label || name,
|
31438
|
-
icon: /* @__PURE__ */ (0,
|
31439
|
-
field.type === "text" && /* @__PURE__ */ (0,
|
31440
|
-
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 })
|
31441
31614
|
] }),
|
31442
31615
|
readOnly,
|
31443
|
-
children: /* @__PURE__ */ (0,
|
31616
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
31444
31617
|
"input",
|
31445
31618
|
{
|
31446
31619
|
className: getClassName11("input"),
|
@@ -31456,6 +31629,7 @@ var DefaultField = ({
|
|
31456
31629
|
}
|
31457
31630
|
},
|
31458
31631
|
readOnly,
|
31632
|
+
tabIndex: readOnly ? -1 : void 0,
|
31459
31633
|
id,
|
31460
31634
|
min: field.type === "number" ? field.min : void 0,
|
31461
31635
|
max: field.type === "number" ? field.max : void 0
|
@@ -31475,7 +31649,7 @@ var import_react16 = require("react");
|
|
31475
31649
|
|
31476
31650
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
31477
31651
|
init_react_import();
|
31478
|
-
var styles_module_default11 = { "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" };
|
31479
31653
|
|
31480
31654
|
// components/Modal/index.tsx
|
31481
31655
|
init_react_import();
|
@@ -31483,11 +31657,11 @@ var import_react15 = require("react");
|
|
31483
31657
|
|
31484
31658
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
31485
31659
|
init_react_import();
|
31486
|
-
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" };
|
31487
31661
|
|
31488
31662
|
// components/Modal/index.tsx
|
31489
31663
|
var import_react_dom = __toESM(require_react_dom());
|
31490
|
-
var
|
31664
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
31491
31665
|
var getClassName12 = get_class_name_factory_default("Modal", styles_module_default12);
|
31492
31666
|
var Modal = ({
|
31493
31667
|
children,
|
@@ -31499,10 +31673,10 @@ var Modal = ({
|
|
31499
31673
|
setRootEl(document.getElementById("puck-portal-root"));
|
31500
31674
|
}, []);
|
31501
31675
|
if (!rootEl) {
|
31502
|
-
return /* @__PURE__ */ (0,
|
31676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", {});
|
31503
31677
|
}
|
31504
31678
|
return (0, import_react_dom.createPortal)(
|
31505
|
-
/* @__PURE__ */ (0,
|
31679
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
31506
31680
|
"div",
|
31507
31681
|
{
|
31508
31682
|
className: getClassName12("inner"),
|
@@ -31516,7 +31690,7 @@ var Modal = ({
|
|
31516
31690
|
|
31517
31691
|
// components/ExternalInput/index.tsx
|
31518
31692
|
var import_react_spinners5 = require("react-spinners");
|
31519
|
-
var
|
31693
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
31520
31694
|
var getClassName13 = get_class_name_factory_default("ExternalInput", styles_module_default11);
|
31521
31695
|
var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default11);
|
31522
31696
|
var dataCache = {};
|
@@ -31527,13 +31701,23 @@ var ExternalInput = ({
|
|
31527
31701
|
name,
|
31528
31702
|
id
|
31529
31703
|
}) => {
|
31530
|
-
const {
|
31704
|
+
const {
|
31705
|
+
mapProp = (val) => val,
|
31706
|
+
mapRow = (val) => val,
|
31707
|
+
filterFields
|
31708
|
+
} = field || {};
|
31531
31709
|
const [data, setData] = (0, import_react16.useState)([]);
|
31532
31710
|
const [isOpen, setOpen] = (0, import_react16.useState)(false);
|
31533
31711
|
const [isLoading, setIsLoading] = (0, import_react16.useState)(true);
|
31712
|
+
const hasFilterFields = !!filterFields;
|
31713
|
+
const [filters, setFilters] = (0, import_react16.useState)(field.initialFilters || {});
|
31714
|
+
const [filtersToggled, setFiltersToggled] = (0, import_react16.useState)(hasFilterFields);
|
31715
|
+
const mappedData = (0, import_react16.useMemo)(() => {
|
31716
|
+
return data.map(mapRow);
|
31717
|
+
}, [data]);
|
31534
31718
|
const keys = (0, import_react16.useMemo)(() => {
|
31535
31719
|
const validKeys = /* @__PURE__ */ new Set();
|
31536
|
-
for (const item of
|
31720
|
+
for (const item of mappedData) {
|
31537
31721
|
for (const key of Object.keys(item)) {
|
31538
31722
|
if (typeof item[key] === "string" || typeof item[key] === "number") {
|
31539
31723
|
validKeys.add(key);
|
@@ -31541,13 +31725,13 @@ var ExternalInput = ({
|
|
31541
31725
|
}
|
31542
31726
|
}
|
31543
31727
|
return Array.from(validKeys);
|
31544
|
-
}, [
|
31728
|
+
}, [mappedData]);
|
31545
31729
|
const [searchQuery, setSearchQuery] = (0, import_react16.useState)(field.initialQuery || "");
|
31546
31730
|
const search = (0, import_react16.useCallback)(
|
31547
|
-
(query) => __async(void 0, null, function* () {
|
31731
|
+
(query, filters2) => __async(void 0, null, function* () {
|
31548
31732
|
setIsLoading(true);
|
31549
|
-
const cacheKey = `${id}-${name}-${query}`;
|
31550
|
-
const listData = dataCache[cacheKey] || (yield field.fetchList({ query }));
|
31733
|
+
const cacheKey = `${id}-${name}-${query}-${JSON.stringify(filters2)}`;
|
31734
|
+
const listData = dataCache[cacheKey] || (yield field.fetchList({ query, filters: filters2 }));
|
31551
31735
|
if (listData) {
|
31552
31736
|
setData(listData);
|
31553
31737
|
setIsLoading(false);
|
@@ -31557,9 +31741,9 @@ var ExternalInput = ({
|
|
31557
31741
|
[name, field]
|
31558
31742
|
);
|
31559
31743
|
(0, import_react16.useEffect)(() => {
|
31560
|
-
search(searchQuery);
|
31744
|
+
search(searchQuery, filters);
|
31561
31745
|
}, []);
|
31562
|
-
return /* @__PURE__ */ (0,
|
31746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
31563
31747
|
"div",
|
31564
31748
|
{
|
31565
31749
|
className: getClassName13({
|
@@ -31568,102 +31752,133 @@ var ExternalInput = ({
|
|
31568
31752
|
}),
|
31569
31753
|
id,
|
31570
31754
|
children: [
|
31571
|
-
/* @__PURE__ */ (0,
|
31572
|
-
/* @__PURE__ */ (0,
|
31755
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName13("actions"), children: [
|
31756
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31573
31757
|
"button",
|
31574
31758
|
{
|
31575
31759
|
onClick: () => setOpen(true),
|
31576
31760
|
className: getClassName13("button"),
|
31577
|
-
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0,
|
31578
|
-
/* @__PURE__ */ (0,
|
31579
|
-
/* @__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 })
|
31580
31764
|
] })
|
31581
31765
|
}
|
31582
31766
|
),
|
31583
|
-
value && /* @__PURE__ */ (0,
|
31767
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31584
31768
|
"button",
|
31585
31769
|
{
|
31586
31770
|
className: getClassName13("detachButton"),
|
31587
31771
|
onClick: () => {
|
31588
31772
|
onChange(null);
|
31589
31773
|
},
|
31590
|
-
children: /* @__PURE__ */ (0,
|
31774
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Unlock, { size: 16 })
|
31591
31775
|
}
|
31592
31776
|
)
|
31593
31777
|
] }),
|
31594
|
-
/* @__PURE__ */ (0,
|
31595
|
-
"
|
31778
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
31779
|
+
"form",
|
31596
31780
|
{
|
31597
31781
|
className: getClassNameModal({
|
31598
31782
|
isLoading,
|
31599
31783
|
loaded: !isLoading,
|
31600
|
-
hasData:
|
31784
|
+
hasData: mappedData.length > 0,
|
31785
|
+
filtersToggled
|
31601
31786
|
}),
|
31787
|
+
onSubmit: (e) => {
|
31788
|
+
e.preventDefault();
|
31789
|
+
search(searchQuery, filters);
|
31790
|
+
},
|
31602
31791
|
children: [
|
31603
|
-
/* @__PURE__ */ (0,
|
31604
|
-
/* @__PURE__ */ (0,
|
31605
|
-
|
31606
|
-
"
|
31607
|
-
|
31608
|
-
|
31609
|
-
|
31610
|
-
|
31611
|
-
|
31612
|
-
|
31613
|
-
|
31614
|
-
|
31615
|
-
|
31616
|
-
|
31617
|
-
|
31618
|
-
|
31619
|
-
|
31620
|
-
|
31621
|
-
|
31622
|
-
|
31623
|
-
|
31624
|
-
|
31625
|
-
|
31626
|
-
|
31627
|
-
|
31628
|
-
|
31629
|
-
|
31630
|
-
)
|
31631
|
-
|
31632
|
-
|
31633
|
-
|
31634
|
-
|
31635
|
-
|
31636
|
-
|
31637
|
-
/* @__PURE__ */ (0,
|
31638
|
-
|
31639
|
-
|
31640
|
-
|
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)(
|
31797
|
+
"input",
|
31798
|
+
{
|
31799
|
+
className: getClassNameModal("searchInput"),
|
31800
|
+
name: "q",
|
31801
|
+
type: "search",
|
31802
|
+
placeholder: field.placeholder,
|
31803
|
+
onChange: (e) => {
|
31804
|
+
setSearchQuery(e.currentTarget.value);
|
31805
|
+
},
|
31806
|
+
autoComplete: "off",
|
31807
|
+
value: searchQuery
|
31808
|
+
}
|
31809
|
+
)
|
31810
|
+
] }),
|
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)(
|
31814
|
+
IconButton,
|
31815
|
+
{
|
31816
|
+
title: "Toggle filters",
|
31817
|
+
onClick: (e) => {
|
31818
|
+
e.preventDefault();
|
31819
|
+
e.stopPropagation();
|
31820
|
+
setFiltersToggled(!filtersToggled);
|
31821
|
+
},
|
31822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SlidersHorizontal, { size: 20 })
|
31823
|
+
}
|
31824
|
+
) })
|
31825
|
+
] })
|
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) => {
|
31829
|
+
const filterField = filterFields[fieldName];
|
31830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31831
|
+
InputOrGroup,
|
31641
31832
|
{
|
31642
|
-
|
31643
|
-
|
31644
|
-
|
31833
|
+
field: filterField,
|
31834
|
+
name: fieldName,
|
31835
|
+
id: `external_field_${fieldName}_filter`,
|
31836
|
+
label: filterField.label || fieldName,
|
31837
|
+
value: filters[fieldName],
|
31838
|
+
onChange: (value2) => {
|
31839
|
+
const newFilters = __spreadProps(__spreadValues({}, filters), { [fieldName]: value2 });
|
31840
|
+
setFilters(newFilters);
|
31841
|
+
search(searchQuery, newFilters);
|
31842
|
+
}
|
31645
31843
|
},
|
31646
|
-
|
31647
|
-
)
|
31648
|
-
|
31649
|
-
|
31650
|
-
|
31844
|
+
fieldName
|
31845
|
+
);
|
31846
|
+
}) }),
|
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)(
|
31850
|
+
"th",
|
31651
31851
|
{
|
31652
|
-
|
31653
|
-
|
31654
|
-
|
31655
|
-
onChange(mapProp(item));
|
31656
|
-
setOpen(false);
|
31657
|
-
},
|
31658
|
-
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
31852
|
+
className: getClassNameModal("th"),
|
31853
|
+
style: { textAlign: "left" },
|
31854
|
+
children: key
|
31659
31855
|
},
|
31660
|
-
|
31661
|
-
)
|
31662
|
-
|
31663
|
-
|
31664
|
-
|
31856
|
+
key
|
31857
|
+
)) }) }),
|
31858
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
|
31859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31860
|
+
"tr",
|
31861
|
+
{
|
31862
|
+
style: { whiteSpace: "nowrap" },
|
31863
|
+
className: getClassNameModal("tr"),
|
31864
|
+
onClick: () => {
|
31865
|
+
onChange(mapProp(data[i]));
|
31866
|
+
setOpen(false);
|
31867
|
+
},
|
31868
|
+
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
31869
|
+
},
|
31870
|
+
i
|
31871
|
+
);
|
31872
|
+
}) })
|
31873
|
+
] }),
|
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" }) })
|
31875
|
+
] })
|
31665
31876
|
] }),
|
31666
|
-
/* @__PURE__ */ (0,
|
31877
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("footer"), children: [
|
31878
|
+
mappedData.length,
|
31879
|
+
" result",
|
31880
|
+
mappedData.length === 1 ? "" : "s"
|
31881
|
+
] })
|
31667
31882
|
]
|
31668
31883
|
}
|
31669
31884
|
) })
|
@@ -31673,7 +31888,7 @@ var ExternalInput = ({
|
|
31673
31888
|
};
|
31674
31889
|
|
31675
31890
|
// components/InputOrGroup/fields/ExternalField/index.tsx
|
31676
|
-
var
|
31891
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
31677
31892
|
var ExternalField = ({
|
31678
31893
|
field,
|
31679
31894
|
onChange,
|
@@ -31695,13 +31910,13 @@ var ExternalField = ({
|
|
31695
31910
|
if (field.type !== "external") {
|
31696
31911
|
return null;
|
31697
31912
|
}
|
31698
|
-
return /* @__PURE__ */ (0,
|
31913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
31699
31914
|
FieldLabelInternal,
|
31700
31915
|
{
|
31701
31916
|
label: label || name,
|
31702
|
-
icon: /* @__PURE__ */ (0,
|
31917
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Link, { size: 16 }),
|
31703
31918
|
el: "div",
|
31704
|
-
children: /* @__PURE__ */ (0,
|
31919
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
31705
31920
|
ExternalInput,
|
31706
31921
|
{
|
31707
31922
|
name,
|
@@ -31709,6 +31924,7 @@ var ExternalField = ({
|
|
31709
31924
|
// DEPRECATED
|
31710
31925
|
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
|
31711
31926
|
mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
|
31927
|
+
mapRow: validField.mapRow,
|
31712
31928
|
fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
|
31713
31929
|
return yield deprecatedField.adaptor.fetchList(
|
31714
31930
|
deprecatedField.adaptorParams
|
@@ -31726,7 +31942,7 @@ var ExternalField = ({
|
|
31726
31942
|
|
31727
31943
|
// components/InputOrGroup/fields/RadioField/index.tsx
|
31728
31944
|
init_react_import();
|
31729
|
-
var
|
31945
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
31730
31946
|
var getClassName14 = get_class_name_factory_default("Input", styles_module_default9);
|
31731
31947
|
var RadioField = ({
|
31732
31948
|
field,
|
@@ -31740,19 +31956,19 @@ var RadioField = ({
|
|
31740
31956
|
if (field.type !== "radio" || !field.options) {
|
31741
31957
|
return null;
|
31742
31958
|
}
|
31743
|
-
return /* @__PURE__ */ (0,
|
31959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
31744
31960
|
FieldLabelInternal,
|
31745
31961
|
{
|
31746
|
-
icon: /* @__PURE__ */ (0,
|
31962
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CheckCircle, { size: 16 }),
|
31747
31963
|
label: label || name,
|
31748
31964
|
readOnly,
|
31749
31965
|
el: "div",
|
31750
|
-
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)(
|
31751
31967
|
"label",
|
31752
31968
|
{
|
31753
31969
|
className: getClassName14("radio"),
|
31754
31970
|
children: [
|
31755
|
-
/* @__PURE__ */ (0,
|
31971
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
31756
31972
|
"input",
|
31757
31973
|
{
|
31758
31974
|
type: "radio",
|
@@ -31770,7 +31986,7 @@ var RadioField = ({
|
|
31770
31986
|
defaultChecked: value === option.value
|
31771
31987
|
}
|
31772
31988
|
),
|
31773
|
-
/* @__PURE__ */ (0,
|
31989
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
|
31774
31990
|
]
|
31775
31991
|
},
|
31776
31992
|
option.label + option.value
|
@@ -31781,7 +31997,7 @@ var RadioField = ({
|
|
31781
31997
|
|
31782
31998
|
// components/InputOrGroup/fields/SelectField/index.tsx
|
31783
31999
|
init_react_import();
|
31784
|
-
var
|
32000
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
31785
32001
|
var getClassName15 = get_class_name_factory_default("Input", styles_module_default9);
|
31786
32002
|
var SelectField = ({
|
31787
32003
|
field,
|
@@ -31795,13 +32011,13 @@ var SelectField = ({
|
|
31795
32011
|
if (field.type !== "select" || !field.options) {
|
31796
32012
|
return null;
|
31797
32013
|
}
|
31798
|
-
return /* @__PURE__ */ (0,
|
32014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
31799
32015
|
FieldLabelInternal,
|
31800
32016
|
{
|
31801
32017
|
label: label || name,
|
31802
|
-
icon: /* @__PURE__ */ (0,
|
32018
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChevronDown, { size: 16 }),
|
31803
32019
|
readOnly,
|
31804
|
-
children: /* @__PURE__ */ (0,
|
32020
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
31805
32021
|
"select",
|
31806
32022
|
{
|
31807
32023
|
id,
|
@@ -31815,7 +32031,7 @@ var SelectField = ({
|
|
31815
32031
|
onChange(e.currentTarget.value);
|
31816
32032
|
},
|
31817
32033
|
value,
|
31818
|
-
children: field.options.map((option) => /* @__PURE__ */ (0,
|
32034
|
+
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
31819
32035
|
"option",
|
31820
32036
|
{
|
31821
32037
|
label: option.label,
|
@@ -31831,7 +32047,7 @@ var SelectField = ({
|
|
31831
32047
|
|
31832
32048
|
// components/InputOrGroup/fields/TextareaField/index.tsx
|
31833
32049
|
init_react_import();
|
31834
|
-
var
|
32050
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
31835
32051
|
var getClassName16 = get_class_name_factory_default("Input", styles_module_default9);
|
31836
32052
|
var TextareaField = ({
|
31837
32053
|
onChange,
|
@@ -31841,13 +32057,13 @@ var TextareaField = ({
|
|
31841
32057
|
label,
|
31842
32058
|
id
|
31843
32059
|
}) => {
|
31844
|
-
return /* @__PURE__ */ (0,
|
32060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
31845
32061
|
FieldLabelInternal,
|
31846
32062
|
{
|
31847
32063
|
label: label || name,
|
31848
|
-
icon: /* @__PURE__ */ (0,
|
32064
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Type, { size: 16 }),
|
31849
32065
|
readOnly,
|
31850
|
-
children: /* @__PURE__ */ (0,
|
32066
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
31851
32067
|
"textarea",
|
31852
32068
|
{
|
31853
32069
|
id,
|
@@ -31857,6 +32073,7 @@ var TextareaField = ({
|
|
31857
32073
|
value: typeof value === "undefined" ? "" : value,
|
31858
32074
|
onChange: (e) => onChange(e.currentTarget.value),
|
31859
32075
|
readOnly,
|
32076
|
+
tabIndex: readOnly ? -1 : void 0,
|
31860
32077
|
rows: 5
|
31861
32078
|
}
|
31862
32079
|
)
|
@@ -31872,10 +32089,10 @@ init_react_import();
|
|
31872
32089
|
|
31873
32090
|
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ObjectField/styles.module.css#css-module
|
31874
32091
|
init_react_import();
|
31875
|
-
var styles_module_default13 = { "ObjectField": "
|
32092
|
+
var styles_module_default13 = { "ObjectField": "_ObjectField_15j63_5", "ObjectField-fieldset": "_ObjectField-fieldset_15j63_13" };
|
31876
32093
|
|
31877
32094
|
// components/InputOrGroup/fields/ObjectField/index.tsx
|
31878
|
-
var
|
32095
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
31879
32096
|
var getClassName17 = get_class_name_factory_default("ObjectField", styles_module_default13);
|
31880
32097
|
var getClassNameItem3 = get_class_name_factory_default("ObjectFieldItem", styles_module_default13);
|
31881
32098
|
var ObjectField = ({
|
@@ -31892,18 +32109,18 @@ var ObjectField = ({
|
|
31892
32109
|
return null;
|
31893
32110
|
}
|
31894
32111
|
const data = value || {};
|
31895
|
-
return /* @__PURE__ */ (0,
|
32112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
31896
32113
|
FieldLabelInternal,
|
31897
32114
|
{
|
31898
32115
|
label: label || name,
|
31899
|
-
icon: /* @__PURE__ */ (0,
|
32116
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MoreVertical, { size: 16 }),
|
31900
32117
|
el: "div",
|
31901
32118
|
readOnly,
|
31902
|
-
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) => {
|
31903
32120
|
const subField = field.objectFields[fieldName];
|
31904
32121
|
const subFieldName = `${name}.${fieldName}`;
|
31905
32122
|
const wildcardFieldName = `${name}.${fieldName}`;
|
31906
|
-
return /* @__PURE__ */ (0,
|
32123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
31907
32124
|
InputOrGroup,
|
31908
32125
|
{
|
31909
32126
|
name: subFieldName,
|
@@ -31930,7 +32147,7 @@ var ObjectField = ({
|
|
31930
32147
|
};
|
31931
32148
|
|
31932
32149
|
// components/InputOrGroup/index.tsx
|
31933
|
-
var
|
32150
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
31934
32151
|
var getClassName18 = get_class_name_factory_default("Input", styles_module_default9);
|
31935
32152
|
var FieldLabel = ({
|
31936
32153
|
children,
|
@@ -31941,11 +32158,11 @@ var FieldLabel = ({
|
|
31941
32158
|
className
|
31942
32159
|
}) => {
|
31943
32160
|
const El = el;
|
31944
|
-
return /* @__PURE__ */ (0,
|
31945
|
-
/* @__PURE__ */ (0,
|
31946
|
-
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, {}),
|
31947
32164
|
label,
|
31948
|
-
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" }) })
|
31949
32166
|
] }),
|
31950
32167
|
children
|
31951
32168
|
] });
|
@@ -31962,7 +32179,7 @@ var FieldLabelInternal = ({
|
|
31962
32179
|
() => overrides.fieldLabel || FieldLabel,
|
31963
32180
|
[overrides]
|
31964
32181
|
);
|
31965
|
-
return /* @__PURE__ */ (0,
|
32182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
31966
32183
|
Wrapper,
|
31967
32184
|
{
|
31968
32185
|
label,
|
@@ -32002,7 +32219,7 @@ var InputOrGroup = (_a) => {
|
|
32002
32219
|
if (!field.render) {
|
32003
32220
|
return null;
|
32004
32221
|
}
|
32005
|
-
return /* @__PURE__ */ (0,
|
32222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
|
32006
32223
|
field,
|
32007
32224
|
name,
|
32008
32225
|
readOnly
|
@@ -32031,16 +32248,16 @@ var InputOrGroup = (_a) => {
|
|
32031
32248
|
const mergedProps = __spreadProps(__spreadValues(__spreadValues({}, props), localProps), { field });
|
32032
32249
|
const children = defaultFields[field.type](mergedProps);
|
32033
32250
|
const Render2 = render[field.type];
|
32034
|
-
return /* @__PURE__ */ (0,
|
32251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
|
32035
32252
|
};
|
32036
32253
|
|
32037
32254
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
|
32038
32255
|
init_react_import();
|
32039
|
-
var styles_module_default14 = { "PuckFields": "
|
32256
|
+
var styles_module_default14 = { "PuckFields": "_PuckFields_17k3p_1", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_17k3p_6" };
|
32040
32257
|
|
32041
32258
|
// components/Puck/components/Fields/index.tsx
|
32042
32259
|
var import_react19 = require("react");
|
32043
|
-
var
|
32260
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
32044
32261
|
var getClassName19 = get_class_name_factory_default("PuckFields", styles_module_default14);
|
32045
32262
|
var defaultPageFields = {
|
32046
32263
|
title: { type: "text" }
|
@@ -32049,9 +32266,9 @@ var DefaultFields = ({
|
|
32049
32266
|
children,
|
32050
32267
|
isLoading
|
32051
32268
|
}) => {
|
32052
|
-
return /* @__PURE__ */ (0,
|
32269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19(), children: [
|
32053
32270
|
children,
|
32054
|
-
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" }) })
|
32055
32272
|
] });
|
32056
32273
|
};
|
32057
32274
|
var Fields = () => {
|
@@ -32072,14 +32289,14 @@ var Fields = () => {
|
|
32072
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;
|
32073
32290
|
const rootProps = data.root.props || data.root;
|
32074
32291
|
const Wrapper = (0, import_react19.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
32075
|
-
return /* @__PURE__ */ (0,
|
32292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
32076
32293
|
"form",
|
32077
32294
|
{
|
32078
32295
|
className: getClassName19(),
|
32079
32296
|
onSubmit: (e) => {
|
32080
32297
|
e.preventDefault();
|
32081
32298
|
},
|
32082
|
-
children: /* @__PURE__ */ (0,
|
32299
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
32083
32300
|
const field = fields[fieldName];
|
32084
32301
|
const onChange = (value, updatedUi) => {
|
32085
32302
|
var _a2, _b2;
|
@@ -32145,7 +32362,7 @@ var Fields = () => {
|
|
32145
32362
|
};
|
32146
32363
|
if (selectedItem && itemSelector) {
|
32147
32364
|
const { readOnly = {} } = selectedItem;
|
32148
|
-
return /* @__PURE__ */ (0,
|
32365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
32149
32366
|
InputOrGroup,
|
32150
32367
|
{
|
32151
32368
|
field,
|
@@ -32161,7 +32378,7 @@ var Fields = () => {
|
|
32161
32378
|
);
|
32162
32379
|
} else {
|
32163
32380
|
const { readOnly = {} } = data.root;
|
32164
|
-
return /* @__PURE__ */ (0,
|
32381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
32165
32382
|
InputOrGroup,
|
32166
32383
|
{
|
32167
32384
|
field,
|
@@ -32193,17 +32410,18 @@ init_react_import();
|
|
32193
32410
|
|
32194
32411
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
32195
32412
|
init_react_import();
|
32196
|
-
var styles_module_default15 = { "ComponentList": "
|
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" };
|
32197
32414
|
|
32198
32415
|
// components/ComponentList/index.tsx
|
32199
|
-
var
|
32416
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
32200
32417
|
var getClassName20 = get_class_name_factory_default("ComponentList", styles_module_default15);
|
32201
32418
|
var ComponentListItem = ({
|
32202
32419
|
name,
|
32420
|
+
label,
|
32203
32421
|
index
|
32204
32422
|
}) => {
|
32205
32423
|
const { overrides } = useAppContext();
|
32206
|
-
return /* @__PURE__ */ (0,
|
32424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Drawer.Item, { label, name, index, children: overrides.componentItem });
|
32207
32425
|
};
|
32208
32426
|
var ComponentList = ({
|
32209
32427
|
children,
|
@@ -32212,9 +32430,9 @@ var ComponentList = ({
|
|
32212
32430
|
}) => {
|
32213
32431
|
const { config, state, setUi } = useAppContext();
|
32214
32432
|
const { expanded = true } = state.ui.componentList[id] || {};
|
32215
|
-
return /* @__PURE__ */ (0,
|
32216
|
-
title && /* @__PURE__ */ (0,
|
32217
|
-
"
|
32433
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
|
32434
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
32435
|
+
"button",
|
32218
32436
|
{
|
32219
32437
|
className: getClassName20("title"),
|
32220
32438
|
onClick: () => setUi({
|
@@ -32226,15 +32444,17 @@ var ComponentList = ({
|
|
32226
32444
|
}),
|
32227
32445
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
32228
32446
|
children: [
|
32229
|
-
/* @__PURE__ */ (0,
|
32230
|
-
/* @__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 }) })
|
32231
32449
|
]
|
32232
32450
|
}
|
32233
32451
|
),
|
32234
|
-
/* @__PURE__ */ (0,
|
32235
|
-
|
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) => {
|
32453
|
+
var _a;
|
32454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
32236
32455
|
ComponentListItem,
|
32237
32456
|
{
|
32457
|
+
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
32238
32458
|
name: componentKey,
|
32239
32459
|
index: i
|
32240
32460
|
},
|
@@ -32246,7 +32466,7 @@ var ComponentList = ({
|
|
32246
32466
|
ComponentList.Item = ComponentListItem;
|
32247
32467
|
|
32248
32468
|
// lib/use-component-list.tsx
|
32249
|
-
var
|
32469
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
32250
32470
|
var useComponentList = (config, ui) => {
|
32251
32471
|
const [componentList, setComponentList] = (0, import_react20.useState)();
|
32252
32472
|
(0, import_react20.useEffect)(() => {
|
@@ -32259,16 +32479,18 @@ var useComponentList = (config, ui) => {
|
|
32259
32479
|
if (category.visible === false || !category.components) {
|
32260
32480
|
return null;
|
32261
32481
|
}
|
32262
|
-
return /* @__PURE__ */ (0,
|
32482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32263
32483
|
ComponentList,
|
32264
32484
|
{
|
32265
32485
|
id: categoryKey,
|
32266
32486
|
title: category.title || categoryKey,
|
32267
32487
|
children: category.components.map((componentName, i) => {
|
32488
|
+
var _a2;
|
32268
32489
|
matchedComponents.push(componentName);
|
32269
|
-
return /* @__PURE__ */ (0,
|
32490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32270
32491
|
ComponentList.Item,
|
32271
32492
|
{
|
32493
|
+
label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
|
32272
32494
|
name: componentName,
|
32273
32495
|
index: i
|
32274
32496
|
},
|
@@ -32285,16 +32507,18 @@ var useComponentList = (config, ui) => {
|
|
32285
32507
|
);
|
32286
32508
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
32287
32509
|
_componentList.push(
|
32288
|
-
/* @__PURE__ */ (0,
|
32510
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32289
32511
|
ComponentList,
|
32290
32512
|
{
|
32291
32513
|
id: "other",
|
32292
32514
|
title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
|
32293
32515
|
children: remainingComponents.map((componentName, i) => {
|
32294
|
-
|
32516
|
+
var _a2;
|
32517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32295
32518
|
ComponentList.Item,
|
32296
32519
|
{
|
32297
32520
|
name: componentName,
|
32521
|
+
label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
|
32298
32522
|
index: i
|
32299
32523
|
},
|
32300
32524
|
componentName
|
@@ -32307,24 +32531,32 @@ var useComponentList = (config, ui) => {
|
|
32307
32531
|
}
|
32308
32532
|
setComponentList(_componentList);
|
32309
32533
|
}
|
32310
|
-
}, [config.categories, ui.componentList]);
|
32534
|
+
}, [config.categories, config.components, ui.componentList]);
|
32311
32535
|
return componentList;
|
32312
32536
|
};
|
32313
32537
|
|
32314
32538
|
// components/Puck/components/Components/index.tsx
|
32315
32539
|
var import_react21 = require("react");
|
32316
|
-
var
|
32540
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
32317
32541
|
var Components = () => {
|
32318
32542
|
const { config, state, overrides } = useAppContext();
|
32319
32543
|
const componentList = useComponentList(config, state.ui);
|
32320
32544
|
const Wrapper = (0, import_react21.useMemo)(() => overrides.components || "div", [overrides]);
|
32321
|
-
return /* @__PURE__ */ (0,
|
32545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComponentList, { id: "all" }) });
|
32322
32546
|
};
|
32323
32547
|
|
32324
32548
|
// components/Puck/components/Preview/index.tsx
|
32325
32549
|
init_react_import();
|
32326
32550
|
var import_react22 = require("react");
|
32327
|
-
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_29rm6_1", "PuckPreview-iframe": "_PuckPreview-iframe_29rm6_5" };
|
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);
|
32328
32560
|
var Preview = ({ id = "puck-preview" }) => {
|
32329
32561
|
const { config, dispatch, state } = useAppContext();
|
32330
32562
|
const Page = (0, import_react22.useCallback)(
|
@@ -32335,16 +32567,25 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
32335
32567
|
[config.root]
|
32336
32568
|
);
|
32337
32569
|
const rootProps = state.data.root.props || state.data.root;
|
32338
|
-
const
|
32339
|
-
return /* @__PURE__ */ (0,
|
32570
|
+
const ref = (0, import_react22.useRef)(null);
|
32571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
32340
32572
|
"div",
|
32341
32573
|
{
|
32574
|
+
className: getClassName21(),
|
32342
32575
|
id,
|
32343
32576
|
onClick: () => {
|
32344
32577
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
32345
32578
|
},
|
32346
|
-
|
32347
|
-
|
32579
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
32580
|
+
import_auto_frame_component.default,
|
32581
|
+
{
|
32582
|
+
id: "preview-iframe",
|
32583
|
+
className: getClassName21("iframe"),
|
32584
|
+
"data-rfd-iframe": true,
|
32585
|
+
ref,
|
32586
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId }) }))
|
32587
|
+
}
|
32588
|
+
)
|
32348
32589
|
}
|
32349
32590
|
);
|
32350
32591
|
};
|
@@ -32378,7 +32619,7 @@ init_react_import();
|
|
32378
32619
|
|
32379
32620
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
32380
32621
|
init_react_import();
|
32381
|
-
var
|
32622
|
+
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" };
|
32382
32623
|
|
32383
32624
|
// lib/scroll-into-view.ts
|
32384
32625
|
init_react_import();
|
@@ -32406,11 +32647,12 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
32406
32647
|
};
|
32407
32648
|
|
32408
32649
|
// components/LayerTree/index.tsx
|
32409
|
-
var
|
32410
|
-
var
|
32411
|
-
var getClassNameLayer = get_class_name_factory_default("Layer",
|
32650
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
32651
|
+
var getClassName22 = get_class_name_factory_default("LayerTree", styles_module_default17);
|
32652
|
+
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default17);
|
32412
32653
|
var LayerTree = ({
|
32413
32654
|
data,
|
32655
|
+
config,
|
32414
32656
|
zoneContent,
|
32415
32657
|
itemSelector,
|
32416
32658
|
setItemSelector,
|
@@ -32419,15 +32661,16 @@ var LayerTree = ({
|
|
32419
32661
|
}) => {
|
32420
32662
|
const zones = data.zones || {};
|
32421
32663
|
const ctx = (0, import_react23.useContext)(dropZoneContext);
|
32422
|
-
return /* @__PURE__ */ (0,
|
32423
|
-
label && /* @__PURE__ */ (0,
|
32424
|
-
/* @__PURE__ */ (0,
|
32664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
32665
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName22("zoneTitle"), children: [
|
32666
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Layers, { size: "16" }) }),
|
32425
32667
|
" ",
|
32426
32668
|
label
|
32427
32669
|
] }),
|
32428
|
-
/* @__PURE__ */ (0,
|
32429
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
32670
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("ul", { className: getClassName22(), children: [
|
32671
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("helper"), children: "No items" }),
|
32430
32672
|
zoneContent.map((item, i) => {
|
32673
|
+
var _a;
|
32431
32674
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
32432
32675
|
const zonesForItem = findZonesForArea(data, item.props.id);
|
32433
32676
|
const containsZone = Object.keys(zonesForItem).length > 0;
|
@@ -32441,7 +32684,7 @@ var LayerTree = ({
|
|
32441
32684
|
const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
|
32442
32685
|
const isHovering = hoveringComponent === item.props.id;
|
32443
32686
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
32444
|
-
return /* @__PURE__ */ (0,
|
32687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
32445
32688
|
"li",
|
32446
32689
|
{
|
32447
32690
|
className: getClassNameLayer({
|
@@ -32451,8 +32694,8 @@ var LayerTree = ({
|
|
32451
32694
|
childIsSelected
|
32452
32695
|
}),
|
32453
32696
|
children: [
|
32454
|
-
/* @__PURE__ */ (0,
|
32455
|
-
"
|
32697
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
32698
|
+
"button",
|
32456
32699
|
{
|
32457
32700
|
className: getClassNameLayer("clickable"),
|
32458
32701
|
onClick: () => {
|
@@ -32465,8 +32708,14 @@ var LayerTree = ({
|
|
32465
32708
|
zone
|
32466
32709
|
});
|
32467
32710
|
const id = zoneContent[i].props.id;
|
32711
|
+
const iframe = document.querySelector("#preview-iframe");
|
32712
|
+
if (!(iframe == null ? void 0 : iframe.contentDocument)) {
|
32713
|
+
throw new Error(
|
32714
|
+
`Preview iframe could not be found when trying to scroll to item ${id}`
|
32715
|
+
);
|
32716
|
+
}
|
32468
32717
|
scrollIntoView(
|
32469
|
-
|
32718
|
+
iframe.contentDocument.querySelector(
|
32470
32719
|
`[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
|
32471
32720
|
)
|
32472
32721
|
);
|
@@ -32482,24 +32731,25 @@ var LayerTree = ({
|
|
32482
32731
|
setHoveringComponent(null);
|
32483
32732
|
},
|
32484
32733
|
children: [
|
32485
|
-
containsZone && /* @__PURE__ */ (0,
|
32734
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32486
32735
|
"div",
|
32487
32736
|
{
|
32488
32737
|
className: getClassNameLayer("chevron"),
|
32489
32738
|
title: isSelected ? "Collapse" : "Expand",
|
32490
|
-
children: /* @__PURE__ */ (0,
|
32739
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronDown, { size: "12" })
|
32491
32740
|
}
|
32492
32741
|
),
|
32493
|
-
/* @__PURE__ */ (0,
|
32494
|
-
/* @__PURE__ */ (0,
|
32495
|
-
/* @__PURE__ */ (0,
|
32742
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
32743
|
+
/* @__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" }) }),
|
32744
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("name"), children: (_a = config.components[item.type]["label"]) != null ? _a : item.type })
|
32496
32745
|
] })
|
32497
32746
|
]
|
32498
32747
|
}
|
32499
32748
|
) }),
|
32500
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
32749
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32501
32750
|
LayerTree,
|
32502
32751
|
{
|
32752
|
+
config,
|
32503
32753
|
data,
|
32504
32754
|
zoneContent: zones[zoneKey],
|
32505
32755
|
setItemSelector,
|
@@ -32519,9 +32769,9 @@ var LayerTree = ({
|
|
32519
32769
|
|
32520
32770
|
// components/Puck/components/Outline/index.tsx
|
32521
32771
|
var import_react24 = require("react");
|
32522
|
-
var
|
32772
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
32523
32773
|
var Outline = () => {
|
32524
|
-
const { dispatch, state, overrides } = useAppContext();
|
32774
|
+
const { dispatch, state, overrides, config } = useAppContext();
|
32525
32775
|
const { data, ui } = state;
|
32526
32776
|
const { itemSelector } = ui;
|
32527
32777
|
const setItemSelector = (0, import_react24.useCallback)(
|
@@ -32534,10 +32784,11 @@ var Outline = () => {
|
|
32534
32784
|
[]
|
32535
32785
|
);
|
32536
32786
|
const Wrapper = (0, import_react24.useMemo)(() => overrides.outline || "div", [overrides]);
|
32537
|
-
return /* @__PURE__ */ (0,
|
32538
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0,
|
32787
|
+
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: [
|
32788
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
32539
32789
|
LayerTree,
|
32540
32790
|
{
|
32791
|
+
config,
|
32541
32792
|
data,
|
32542
32793
|
label: areaContainsZones(data, "root") ? rootDroppableId : "",
|
32543
32794
|
zoneContent: data.content,
|
@@ -32547,9 +32798,10 @@ var Outline = () => {
|
|
32547
32798
|
),
|
32548
32799
|
Object.entries(findZonesForArea(data, "root")).map(
|
32549
32800
|
([zoneKey, zone]) => {
|
32550
|
-
return /* @__PURE__ */ (0,
|
32801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
32551
32802
|
LayerTree,
|
32552
32803
|
{
|
32804
|
+
config,
|
32553
32805
|
data,
|
32554
32806
|
label: zoneKey,
|
32555
32807
|
zone: zoneKey,
|
@@ -32673,14 +32925,421 @@ function useHistoryStore() {
|
|
32673
32925
|
};
|
32674
32926
|
}
|
32675
32927
|
|
32928
|
+
// components/Puck/components/Canvas/index.tsx
|
32929
|
+
init_react_import();
|
32930
|
+
|
32931
|
+
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
32932
|
+
init_react_import();
|
32933
|
+
|
32934
|
+
// ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
32935
|
+
init_react_import();
|
32936
|
+
var isProduction = process.env.NODE_ENV === "production";
|
32937
|
+
var prefix = "Invariant failed";
|
32938
|
+
function invariant(condition, message) {
|
32939
|
+
if (condition) {
|
32940
|
+
return;
|
32941
|
+
}
|
32942
|
+
if (isProduction) {
|
32943
|
+
throw new Error(prefix);
|
32944
|
+
}
|
32945
|
+
var provided = typeof message === "function" ? message() : message;
|
32946
|
+
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
32947
|
+
throw new Error(value);
|
32948
|
+
}
|
32949
|
+
|
32950
|
+
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
32951
|
+
var getRect = function getRect2(_ref) {
|
32952
|
+
var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
|
32953
|
+
var width = right - left;
|
32954
|
+
var height = bottom - top;
|
32955
|
+
var rect = {
|
32956
|
+
top,
|
32957
|
+
right,
|
32958
|
+
bottom,
|
32959
|
+
left,
|
32960
|
+
width,
|
32961
|
+
height,
|
32962
|
+
x: left,
|
32963
|
+
y: top,
|
32964
|
+
center: {
|
32965
|
+
x: (right + left) / 2,
|
32966
|
+
y: (bottom + top) / 2
|
32967
|
+
}
|
32968
|
+
};
|
32969
|
+
return rect;
|
32970
|
+
};
|
32971
|
+
var expand = function expand2(target, expandBy) {
|
32972
|
+
return {
|
32973
|
+
top: target.top - expandBy.top,
|
32974
|
+
left: target.left - expandBy.left,
|
32975
|
+
bottom: target.bottom + expandBy.bottom,
|
32976
|
+
right: target.right + expandBy.right
|
32977
|
+
};
|
32978
|
+
};
|
32979
|
+
var shrink = function shrink2(target, shrinkBy) {
|
32980
|
+
return {
|
32981
|
+
top: target.top + shrinkBy.top,
|
32982
|
+
left: target.left + shrinkBy.left,
|
32983
|
+
bottom: target.bottom - shrinkBy.bottom,
|
32984
|
+
right: target.right - shrinkBy.right
|
32985
|
+
};
|
32986
|
+
};
|
32987
|
+
var noSpacing = {
|
32988
|
+
top: 0,
|
32989
|
+
right: 0,
|
32990
|
+
bottom: 0,
|
32991
|
+
left: 0
|
32992
|
+
};
|
32993
|
+
var createBox = function createBox2(_ref2) {
|
32994
|
+
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;
|
32995
|
+
var marginBox = getRect(expand(borderBox, margin));
|
32996
|
+
var paddingBox = getRect(shrink(borderBox, border));
|
32997
|
+
var contentBox = getRect(shrink(paddingBox, padding));
|
32998
|
+
return {
|
32999
|
+
marginBox,
|
33000
|
+
borderBox: getRect(borderBox),
|
33001
|
+
paddingBox,
|
33002
|
+
contentBox,
|
33003
|
+
margin,
|
33004
|
+
border,
|
33005
|
+
padding
|
33006
|
+
};
|
33007
|
+
};
|
33008
|
+
var parse = function parse2(raw) {
|
33009
|
+
var value = raw.slice(0, -2);
|
33010
|
+
var suffix = raw.slice(-2);
|
33011
|
+
if (suffix !== "px") {
|
33012
|
+
return 0;
|
33013
|
+
}
|
33014
|
+
var result = Number(value);
|
33015
|
+
!!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
|
33016
|
+
return result;
|
33017
|
+
};
|
33018
|
+
var calculateBox = function calculateBox2(borderBox, styles) {
|
33019
|
+
var margin = {
|
33020
|
+
top: parse(styles.marginTop),
|
33021
|
+
right: parse(styles.marginRight),
|
33022
|
+
bottom: parse(styles.marginBottom),
|
33023
|
+
left: parse(styles.marginLeft)
|
33024
|
+
};
|
33025
|
+
var padding = {
|
33026
|
+
top: parse(styles.paddingTop),
|
33027
|
+
right: parse(styles.paddingRight),
|
33028
|
+
bottom: parse(styles.paddingBottom),
|
33029
|
+
left: parse(styles.paddingLeft)
|
33030
|
+
};
|
33031
|
+
var border = {
|
33032
|
+
top: parse(styles.borderTopWidth),
|
33033
|
+
right: parse(styles.borderRightWidth),
|
33034
|
+
bottom: parse(styles.borderBottomWidth),
|
33035
|
+
left: parse(styles.borderLeftWidth)
|
33036
|
+
};
|
33037
|
+
return createBox({
|
33038
|
+
borderBox,
|
33039
|
+
margin,
|
33040
|
+
padding,
|
33041
|
+
border
|
33042
|
+
});
|
33043
|
+
};
|
33044
|
+
var getBox = function getBox2(el) {
|
33045
|
+
var borderBox = el.getBoundingClientRect();
|
33046
|
+
var styles = window.getComputedStyle(el);
|
33047
|
+
return calculateBox(borderBox, styles);
|
33048
|
+
};
|
33049
|
+
|
33050
|
+
// components/Puck/components/Canvas/index.tsx
|
33051
|
+
var import_react27 = require("react");
|
33052
|
+
|
33053
|
+
// components/ViewportControls/index.tsx
|
33054
|
+
init_react_import();
|
33055
|
+
var import_react26 = require("react");
|
33056
|
+
|
33057
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
33058
|
+
init_react_import();
|
33059
|
+
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" };
|
33060
|
+
|
33061
|
+
// components/ViewportControls/index.tsx
|
33062
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
33063
|
+
var icons = {
|
33064
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Smartphone, { size: 16 }),
|
33065
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Tablet, { size: 16 }),
|
33066
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Monitor, { size: 16 })
|
33067
|
+
};
|
33068
|
+
var getClassName23 = get_class_name_factory_default("ViewportControls", styles_module_default18);
|
33069
|
+
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default18);
|
33070
|
+
var ViewportButton = ({
|
33071
|
+
children,
|
33072
|
+
height = "auto",
|
33073
|
+
title,
|
33074
|
+
width,
|
33075
|
+
onClick
|
33076
|
+
}) => {
|
33077
|
+
const { state } = useAppContext();
|
33078
|
+
const isActive = width === state.ui.viewports.current.width;
|
33079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33080
|
+
IconButton,
|
33081
|
+
{
|
33082
|
+
title,
|
33083
|
+
disabled: isActive,
|
33084
|
+
onClick: (e) => {
|
33085
|
+
e.stopPropagation();
|
33086
|
+
onClick({ width, height });
|
33087
|
+
},
|
33088
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton("inner"), children })
|
33089
|
+
}
|
33090
|
+
) });
|
33091
|
+
};
|
33092
|
+
var defaultZoomOptions = [
|
33093
|
+
{ label: "25%", value: 0.25 },
|
33094
|
+
{ label: "50%", value: 0.5 },
|
33095
|
+
{ label: "75%", value: 0.75 },
|
33096
|
+
{ label: "100%", value: 1 },
|
33097
|
+
{ label: "125%", value: 1.25 },
|
33098
|
+
{ label: "150%", value: 1.5 },
|
33099
|
+
{ label: "200%", value: 2 }
|
33100
|
+
];
|
33101
|
+
var ViewportControls = ({
|
33102
|
+
autoZoom,
|
33103
|
+
zoom,
|
33104
|
+
onViewportChange,
|
33105
|
+
onZoom
|
33106
|
+
}) => {
|
33107
|
+
const { state, viewports } = useAppContext();
|
33108
|
+
const viewport = state.ui.viewports.current;
|
33109
|
+
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
33110
|
+
(option) => option.value === autoZoom
|
33111
|
+
);
|
33112
|
+
const zoomOptions = (0, import_react26.useMemo)(
|
33113
|
+
() => [
|
33114
|
+
...defaultZoomOptions,
|
33115
|
+
...defaultsContainAutoZoom ? [] : [
|
33116
|
+
{
|
33117
|
+
value: autoZoom,
|
33118
|
+
label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
|
33119
|
+
}
|
33120
|
+
]
|
33121
|
+
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
33122
|
+
[autoZoom]
|
33123
|
+
);
|
33124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName23(), children: [
|
33125
|
+
viewports.map((viewport2, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33126
|
+
ViewportButton,
|
33127
|
+
{
|
33128
|
+
height: viewport2.height,
|
33129
|
+
width: viewport2.width,
|
33130
|
+
title: viewport2.label ? `Switch to ${viewport2.label} viewport` : "Switch viewport",
|
33131
|
+
onClick: onViewportChange,
|
33132
|
+
children: typeof viewport2.icon === "string" ? icons[viewport2.icon] || viewport2.icon : viewport2.icon || icons.Smartphone
|
33133
|
+
},
|
33134
|
+
i
|
33135
|
+
)),
|
33136
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
|
33137
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33138
|
+
IconButton,
|
33139
|
+
{
|
33140
|
+
title: "Zoom viewport out",
|
33141
|
+
disabled: zoom <= zoomOptions[0].value,
|
33142
|
+
onClick: (e) => {
|
33143
|
+
e.stopPropagation();
|
33144
|
+
onZoom(
|
33145
|
+
zoomOptions[Math.max(
|
33146
|
+
zoomOptions.findIndex((option) => option.value === zoom) - 1,
|
33147
|
+
0
|
33148
|
+
)].value
|
33149
|
+
);
|
33150
|
+
},
|
33151
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomOut, { size: 16 })
|
33152
|
+
}
|
33153
|
+
),
|
33154
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33155
|
+
IconButton,
|
33156
|
+
{
|
33157
|
+
title: "Zoom viewport in",
|
33158
|
+
disabled: zoom >= zoomOptions[zoomOptions.length - 1].value,
|
33159
|
+
onClick: (e) => {
|
33160
|
+
e.stopPropagation();
|
33161
|
+
onZoom(
|
33162
|
+
zoomOptions[Math.min(
|
33163
|
+
zoomOptions.findIndex((option) => option.value === zoom) + 1,
|
33164
|
+
zoomOptions.length - 1
|
33165
|
+
)].value
|
33166
|
+
);
|
33167
|
+
},
|
33168
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomIn, { size: 16 })
|
33169
|
+
}
|
33170
|
+
),
|
33171
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
|
33172
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33173
|
+
"select",
|
33174
|
+
{
|
33175
|
+
className: getClassName23("zoomSelect"),
|
33176
|
+
value: zoom.toString(),
|
33177
|
+
onChange: (e) => {
|
33178
|
+
onZoom(parseFloat(e.currentTarget.value));
|
33179
|
+
},
|
33180
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33181
|
+
"option",
|
33182
|
+
{
|
33183
|
+
value: option.value,
|
33184
|
+
label: option.label
|
33185
|
+
},
|
33186
|
+
option.label
|
33187
|
+
))
|
33188
|
+
}
|
33189
|
+
)
|
33190
|
+
] });
|
33191
|
+
};
|
33192
|
+
|
33193
|
+
// lib/get-zoom-config.ts
|
33194
|
+
init_react_import();
|
33195
|
+
var RESET_ZOOM_SMALLER_THAN_FRAME = true;
|
33196
|
+
var getZoomConfig = (uiViewport, frame, zoom) => {
|
33197
|
+
const box = getBox(frame);
|
33198
|
+
const { width: frameWidth, height: frameHeight } = box.contentBox;
|
33199
|
+
const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
|
33200
|
+
let rootHeight = 0;
|
33201
|
+
let autoZoom = 1;
|
33202
|
+
if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
|
33203
|
+
const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
|
33204
|
+
const heightZoom = Math.min(frameHeight / viewportHeight, 1);
|
33205
|
+
zoom = widthZoom;
|
33206
|
+
if (widthZoom < heightZoom) {
|
33207
|
+
rootHeight = viewportHeight / zoom;
|
33208
|
+
} else {
|
33209
|
+
rootHeight = viewportHeight;
|
33210
|
+
zoom = heightZoom;
|
33211
|
+
}
|
33212
|
+
autoZoom = zoom;
|
33213
|
+
} else {
|
33214
|
+
if (RESET_ZOOM_SMALLER_THAN_FRAME) {
|
33215
|
+
autoZoom = 1;
|
33216
|
+
zoom = 1;
|
33217
|
+
rootHeight = viewportHeight;
|
33218
|
+
}
|
33219
|
+
}
|
33220
|
+
return { autoZoom, rootHeight, zoom };
|
33221
|
+
};
|
33222
|
+
|
33223
|
+
// components/Puck/components/Canvas/index.tsx
|
33224
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
33225
|
+
var getClassName24 = get_class_name_factory_default("Puck", styles_module_default8);
|
33226
|
+
var ZOOM_ON_CHANGE = true;
|
33227
|
+
var Canvas = () => {
|
33228
|
+
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
33229
|
+
const { ui } = state;
|
33230
|
+
const frameRef = (0, import_react27.useRef)(null);
|
33231
|
+
const [showTransition, setShowTransition] = (0, import_react27.useState)(false);
|
33232
|
+
const defaultRender = (0, import_react27.useMemo)(() => {
|
33233
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
|
33234
|
+
return PuckDefault;
|
33235
|
+
}, []);
|
33236
|
+
const CustomPreview = (0, import_react27.useMemo)(
|
33237
|
+
() => overrides.preview || defaultRender,
|
33238
|
+
[overrides]
|
33239
|
+
);
|
33240
|
+
const getFrameDimensions = (0, import_react27.useCallback)(() => {
|
33241
|
+
if (frameRef.current) {
|
33242
|
+
const frame = frameRef.current;
|
33243
|
+
const box = getBox(frame);
|
33244
|
+
return { width: box.contentBox.width, height: box.contentBox.height };
|
33245
|
+
}
|
33246
|
+
return { width: 0, height: 0 };
|
33247
|
+
}, [frameRef]);
|
33248
|
+
const resetAutoZoom = (0, import_react27.useCallback)(
|
33249
|
+
(ui2 = state.ui) => {
|
33250
|
+
if (frameRef.current) {
|
33251
|
+
setZoomConfig(
|
33252
|
+
getZoomConfig(ui2.viewports.current, frameRef.current, zoomConfig.zoom)
|
33253
|
+
);
|
33254
|
+
}
|
33255
|
+
},
|
33256
|
+
[frameRef, zoomConfig, state.ui]
|
33257
|
+
);
|
33258
|
+
(0, import_react27.useEffect)(() => {
|
33259
|
+
setShowTransition(false);
|
33260
|
+
resetAutoZoom();
|
33261
|
+
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
33262
|
+
(0, import_react27.useEffect)(() => {
|
33263
|
+
const { height: frameHeight } = getFrameDimensions();
|
33264
|
+
if (ui.viewports.current.height === "auto") {
|
33265
|
+
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
33266
|
+
rootHeight: frameHeight / zoomConfig.zoom
|
33267
|
+
}));
|
33268
|
+
}
|
33269
|
+
}, [zoomConfig.zoom]);
|
33270
|
+
(0, import_react27.useEffect)(() => {
|
33271
|
+
const observer = new ResizeObserver(() => {
|
33272
|
+
setShowTransition(false);
|
33273
|
+
resetAutoZoom();
|
33274
|
+
});
|
33275
|
+
if (document.body) {
|
33276
|
+
observer.observe(document.body);
|
33277
|
+
}
|
33278
|
+
return () => {
|
33279
|
+
observer.disconnect();
|
33280
|
+
};
|
33281
|
+
}, []);
|
33282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
33283
|
+
"div",
|
33284
|
+
{
|
33285
|
+
className: getClassName24("canvas"),
|
33286
|
+
onClick: () => dispatch({
|
33287
|
+
type: "setUi",
|
33288
|
+
ui: { itemSelector: null },
|
33289
|
+
recordHistory: true
|
33290
|
+
}),
|
33291
|
+
children: [
|
33292
|
+
ui.viewports.controlsVisible && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("canvasControls"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33293
|
+
ViewportControls,
|
33294
|
+
{
|
33295
|
+
autoZoom: zoomConfig.autoZoom,
|
33296
|
+
zoom: zoomConfig.zoom,
|
33297
|
+
onViewportChange: (viewport) => {
|
33298
|
+
setShowTransition(true);
|
33299
|
+
const uiViewport = __spreadProps(__spreadValues({}, viewport), {
|
33300
|
+
height: viewport.height || "auto",
|
33301
|
+
zoom: zoomConfig.zoom
|
33302
|
+
});
|
33303
|
+
const newUi = __spreadProps(__spreadValues({}, ui), {
|
33304
|
+
viewports: __spreadProps(__spreadValues({}, ui.viewports), { current: uiViewport })
|
33305
|
+
});
|
33306
|
+
setUi(newUi);
|
33307
|
+
if (ZOOM_ON_CHANGE) {
|
33308
|
+
resetAutoZoom(newUi);
|
33309
|
+
}
|
33310
|
+
},
|
33311
|
+
onZoom: (zoom) => {
|
33312
|
+
setShowTransition(true);
|
33313
|
+
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
|
33314
|
+
}
|
33315
|
+
}
|
33316
|
+
) }),
|
33317
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("frame"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33318
|
+
"div",
|
33319
|
+
{
|
33320
|
+
className: getClassName24("root"),
|
33321
|
+
style: {
|
33322
|
+
width: ui.viewports.current.width,
|
33323
|
+
height: zoomConfig.rootHeight,
|
33324
|
+
transform: `scale(${zoomConfig.zoom})`,
|
33325
|
+
transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : ""
|
33326
|
+
},
|
33327
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Preview, {}) })
|
33328
|
+
}
|
33329
|
+
) })
|
33330
|
+
]
|
33331
|
+
}
|
33332
|
+
);
|
33333
|
+
};
|
33334
|
+
|
32676
33335
|
// components/Puck/index.tsx
|
32677
|
-
var
|
32678
|
-
var
|
33336
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
33337
|
+
var getClassName25 = get_class_name_factory_default("Puck", styles_module_default8);
|
32679
33338
|
function Puck({
|
32680
33339
|
children,
|
32681
33340
|
config,
|
32682
33341
|
data: initialData = { content: [], root: { props: { title: "" } } },
|
32683
|
-
ui: initialUi
|
33342
|
+
ui: initialUi,
|
32684
33343
|
onChange,
|
32685
33344
|
onPublish,
|
32686
33345
|
plugins = [],
|
@@ -32688,32 +33347,58 @@ function Puck({
|
|
32688
33347
|
renderHeader,
|
32689
33348
|
renderHeaderActions,
|
32690
33349
|
headerTitle,
|
32691
|
-
headerPath
|
33350
|
+
headerPath,
|
33351
|
+
viewports = defaultViewports
|
32692
33352
|
}) {
|
33353
|
+
var _a;
|
32693
33354
|
const historyStore = useHistoryStore();
|
32694
|
-
const [reducer] = (0,
|
33355
|
+
const [reducer] = (0, import_react28.useState)(
|
32695
33356
|
() => createReducer({ config, record: historyStore.record })
|
32696
33357
|
);
|
32697
|
-
const [initialAppState] = (0,
|
32698
|
-
|
32699
|
-
|
32700
|
-
|
32701
|
-
|
32702
|
-
|
32703
|
-
|
32704
|
-
|
32705
|
-
|
32706
|
-
|
32707
|
-
|
32708
|
-
|
32709
|
-
|
32710
|
-
|
32711
|
-
|
32712
|
-
{}
|
32713
|
-
|
32714
|
-
|
32715
|
-
|
32716
|
-
|
33358
|
+
const [initialAppState] = (0, import_react28.useState)(() => {
|
33359
|
+
var _a2, _b, _c, _d;
|
33360
|
+
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
33361
|
+
let clientUiState = {};
|
33362
|
+
if (typeof window !== "undefined") {
|
33363
|
+
const viewportWidth = window.innerWidth;
|
33364
|
+
const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
|
33365
|
+
key,
|
33366
|
+
diff: Math.abs(viewportWidth - value.width)
|
33367
|
+
})).sort((a, b) => a.diff > b.diff ? 1 : -1);
|
33368
|
+
const closestViewport = viewportDifferences[0].key;
|
33369
|
+
clientUiState = __spreadProps(__spreadValues({}, window.matchMedia("(min-width: 638px)").matches ? {} : {
|
33370
|
+
leftSideBarVisible: false,
|
33371
|
+
rightSideBarVisible: false
|
33372
|
+
}), {
|
33373
|
+
viewports: __spreadProps(__spreadValues({}, initial.viewports), {
|
33374
|
+
current: __spreadProps(__spreadValues({}, initial.viewports.current), {
|
33375
|
+
height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || viewports[closestViewport].height || "auto",
|
33376
|
+
width: ((_d = (_c = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _c.current) == null ? void 0 : _d.width) || viewports[closestViewport].width
|
33377
|
+
})
|
33378
|
+
})
|
33379
|
+
});
|
33380
|
+
}
|
33381
|
+
return __spreadProps(__spreadValues({}, defaultAppState), {
|
33382
|
+
data: initialData,
|
33383
|
+
ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
|
33384
|
+
// Store categories under componentList on state to allow render functions and plugins to modify
|
33385
|
+
componentList: config.categories ? Object.entries(config.categories).reduce(
|
33386
|
+
(acc, [categoryName, category]) => {
|
33387
|
+
return __spreadProps(__spreadValues({}, acc), {
|
33388
|
+
[categoryName]: {
|
33389
|
+
title: category.title,
|
33390
|
+
components: category.components,
|
33391
|
+
expanded: category.defaultExpanded,
|
33392
|
+
visible: category.visible
|
33393
|
+
}
|
33394
|
+
});
|
33395
|
+
},
|
33396
|
+
{}
|
33397
|
+
) : {}
|
33398
|
+
})
|
33399
|
+
});
|
33400
|
+
});
|
33401
|
+
const [appState, dispatch] = (0, import_react28.useReducer)(
|
32717
33402
|
reducer,
|
32718
33403
|
flushZones(initialAppState)
|
32719
33404
|
);
|
@@ -32724,9 +33409,9 @@ function Puck({
|
|
32724
33409
|
config,
|
32725
33410
|
dispatch
|
32726
33411
|
);
|
32727
|
-
const [menuOpen, setMenuOpen] = (0,
|
33412
|
+
const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
|
32728
33413
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
32729
|
-
const setItemSelector = (0,
|
33414
|
+
const setItemSelector = (0, import_react28.useCallback)(
|
32730
33415
|
(newItemSelector) => {
|
32731
33416
|
if (newItemSelector === itemSelector)
|
32732
33417
|
return;
|
@@ -32739,21 +33424,21 @@ function Puck({
|
|
32739
33424
|
[itemSelector]
|
32740
33425
|
);
|
32741
33426
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
32742
|
-
(0,
|
33427
|
+
(0, import_react28.useEffect)(() => {
|
32743
33428
|
if (onChange)
|
32744
33429
|
onChange(data);
|
32745
33430
|
}, [data]);
|
32746
33431
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
32747
|
-
const [draggedItem, setDraggedItem] = (0,
|
33432
|
+
const [draggedItem, setDraggedItem] = (0, import_react28.useState)();
|
32748
33433
|
const rootProps = data.root.props || data.root;
|
32749
|
-
(0,
|
33434
|
+
(0, import_react28.useEffect)(() => {
|
32750
33435
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
32751
33436
|
console.error(
|
32752
33437
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
32753
33438
|
);
|
32754
33439
|
}
|
32755
33440
|
}, []);
|
32756
|
-
const toggleSidebars = (0,
|
33441
|
+
const toggleSidebars = (0, import_react28.useCallback)(
|
32757
33442
|
(sidebar) => {
|
32758
33443
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
32759
33444
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -32767,7 +33452,7 @@ function Puck({
|
|
32767
33452
|
},
|
32768
33453
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
32769
33454
|
);
|
32770
|
-
(0,
|
33455
|
+
(0, import_react28.useEffect)(() => {
|
32771
33456
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
32772
33457
|
dispatch({
|
32773
33458
|
type: "setUi",
|
@@ -32790,59 +33475,54 @@ function Puck({
|
|
32790
33475
|
window.removeEventListener("resize", handleResize);
|
32791
33476
|
};
|
32792
33477
|
}, []);
|
32793
|
-
const defaultRender = (0,
|
32794
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0,
|
33478
|
+
const defaultRender = (0, import_react28.useMemo)(() => {
|
33479
|
+
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: children2 });
|
32795
33480
|
return PuckDefault;
|
32796
33481
|
}, []);
|
32797
|
-
const defaultHeaderRender = (0,
|
33482
|
+
const defaultHeaderRender = (0, import_react28.useMemo)(() => {
|
32798
33483
|
if (renderHeader) {
|
32799
33484
|
console.warn(
|
32800
33485
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
32801
33486
|
);
|
32802
|
-
const RenderHeader = (
|
32803
|
-
var _b =
|
33487
|
+
const RenderHeader = (_a2) => {
|
33488
|
+
var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
|
32804
33489
|
const Comp = renderHeader;
|
32805
|
-
return /* @__PURE__ */ (0,
|
33490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
32806
33491
|
};
|
32807
33492
|
return RenderHeader;
|
32808
33493
|
}
|
32809
33494
|
return defaultRender;
|
32810
33495
|
}, [renderHeader]);
|
32811
|
-
const defaultHeaderActionsRender = (0,
|
33496
|
+
const defaultHeaderActionsRender = (0, import_react28.useMemo)(() => {
|
32812
33497
|
if (renderHeaderActions) {
|
32813
33498
|
console.warn(
|
32814
33499
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
32815
33500
|
);
|
32816
33501
|
const RenderHeader = (props) => {
|
32817
33502
|
const Comp = renderHeaderActions;
|
32818
|
-
return /* @__PURE__ */ (0,
|
33503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
32819
33504
|
};
|
32820
33505
|
return RenderHeader;
|
32821
33506
|
}
|
32822
33507
|
return defaultRender;
|
32823
33508
|
}, [renderHeader]);
|
32824
|
-
const loadedOverrides = (0,
|
33509
|
+
const loadedOverrides = (0, import_react28.useMemo)(() => {
|
32825
33510
|
return loadOverrides({ overrides, plugins });
|
32826
33511
|
}, [plugins]);
|
32827
|
-
const CustomPuck = (0,
|
33512
|
+
const CustomPuck = (0, import_react28.useMemo)(
|
32828
33513
|
() => loadedOverrides.puck || defaultRender,
|
32829
33514
|
[loadedOverrides]
|
32830
33515
|
);
|
32831
|
-
const
|
32832
|
-
() => loadedOverrides.preview || defaultRender,
|
32833
|
-
[loadedOverrides]
|
32834
|
-
);
|
32835
|
-
const CustomHeader = (0, import_react26.useMemo)(
|
33516
|
+
const CustomHeader = (0, import_react28.useMemo)(
|
32836
33517
|
() => loadedOverrides.header || defaultHeaderRender,
|
32837
33518
|
[loadedOverrides]
|
32838
33519
|
);
|
32839
|
-
const CustomHeaderActions = (0,
|
33520
|
+
const CustomHeaderActions = (0, import_react28.useMemo)(
|
32840
33521
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
32841
33522
|
[loadedOverrides]
|
32842
33523
|
);
|
32843
|
-
|
32844
|
-
|
32845
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "Puck", children: [
|
33525
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32846
33526
|
AppProvider,
|
32847
33527
|
{
|
32848
33528
|
value: {
|
@@ -32853,10 +33533,11 @@ function Puck({
|
|
32853
33533
|
resolveData,
|
32854
33534
|
plugins,
|
32855
33535
|
overrides: loadedOverrides,
|
32856
|
-
history
|
33536
|
+
history,
|
33537
|
+
viewports
|
32857
33538
|
},
|
32858
|
-
children: /* @__PURE__ */ (0,
|
32859
|
-
|
33539
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33540
|
+
DragDropContext,
|
32860
33541
|
{
|
32861
33542
|
onDragUpdate: (update) => {
|
32862
33543
|
setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
|
@@ -32910,7 +33591,7 @@ function Puck({
|
|
32910
33591
|
});
|
32911
33592
|
}
|
32912
33593
|
},
|
32913
|
-
children: /* @__PURE__ */ (0,
|
33594
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32914
33595
|
DropZoneProvider,
|
32915
33596
|
{
|
32916
33597
|
value: {
|
@@ -32922,77 +33603,75 @@ function Puck({
|
|
32922
33603
|
draggedItem,
|
32923
33604
|
placeholderStyle,
|
32924
33605
|
mode: "edit",
|
32925
|
-
areaId: "root"
|
32926
|
-
disableZoom
|
33606
|
+
areaId: "root"
|
32927
33607
|
},
|
32928
|
-
children: /* @__PURE__ */ (0,
|
33608
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
32929
33609
|
"div",
|
32930
33610
|
{
|
32931
|
-
className:
|
33611
|
+
className: getClassName25({
|
32932
33612
|
leftSideBarVisible,
|
32933
33613
|
menuOpen,
|
32934
|
-
rightSideBarVisible
|
32935
|
-
disableZoom
|
33614
|
+
rightSideBarVisible
|
32936
33615
|
}),
|
32937
33616
|
children: [
|
32938
|
-
/* @__PURE__ */ (0,
|
33617
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32939
33618
|
CustomHeader,
|
32940
33619
|
{
|
32941
|
-
actions: /* @__PURE__ */ (0,
|
32942
|
-
/* @__PURE__ */ (0,
|
32943
|
-
/* @__PURE__ */ (0,
|
33620
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
33621
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
|
33622
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32944
33623
|
Button,
|
32945
33624
|
{
|
32946
33625
|
onClick: () => {
|
32947
33626
|
onPublish && onPublish(data);
|
32948
33627
|
},
|
32949
|
-
icon: /* @__PURE__ */ (0,
|
33628
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Globe, { size: "14px" }),
|
32950
33629
|
children: "Publish"
|
32951
33630
|
}
|
32952
33631
|
)
|
32953
33632
|
] }),
|
32954
|
-
children: /* @__PURE__ */ (0,
|
32955
|
-
/* @__PURE__ */ (0,
|
32956
|
-
/* @__PURE__ */ (0,
|
33633
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerInner"), children: [
|
33634
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerToggle"), children: [
|
33635
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32957
33636
|
IconButton,
|
32958
33637
|
{
|
32959
33638
|
onClick: () => {
|
32960
33639
|
toggleSidebars("left");
|
32961
33640
|
},
|
32962
33641
|
title: "Toggle left sidebar",
|
32963
|
-
children: /* @__PURE__ */ (0,
|
33642
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelLeft, { focusable: "false" })
|
32964
33643
|
}
|
32965
33644
|
) }),
|
32966
|
-
/* @__PURE__ */ (0,
|
33645
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32967
33646
|
IconButton,
|
32968
33647
|
{
|
32969
33648
|
onClick: () => {
|
32970
33649
|
toggleSidebars("right");
|
32971
33650
|
},
|
32972
33651
|
title: "Toggle right sidebar",
|
32973
|
-
children: /* @__PURE__ */ (0,
|
33652
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelRight, { focusable: "false" })
|
32974
33653
|
}
|
32975
33654
|
) })
|
32976
33655
|
] }),
|
32977
|
-
/* @__PURE__ */ (0,
|
33656
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
32978
33657
|
headerTitle || rootProps.title || "Page",
|
32979
|
-
headerPath && /* @__PURE__ */ (0,
|
33658
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
32980
33659
|
" ",
|
32981
|
-
/* @__PURE__ */ (0,
|
33660
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
|
32982
33661
|
] })
|
32983
33662
|
] }) }),
|
32984
|
-
/* @__PURE__ */ (0,
|
32985
|
-
/* @__PURE__ */ (0,
|
33663
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerTools"), children: [
|
33664
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32986
33665
|
IconButton,
|
32987
33666
|
{
|
32988
33667
|
onClick: () => {
|
32989
33668
|
return setMenuOpen(!menuOpen);
|
32990
33669
|
},
|
32991
33670
|
title: "Toggle menu bar",
|
32992
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
33671
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { focusable: "false" })
|
32993
33672
|
}
|
32994
33673
|
) }),
|
32995
|
-
/* @__PURE__ */ (0,
|
33674
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32996
33675
|
MenuBar,
|
32997
33676
|
{
|
32998
33677
|
appState,
|
@@ -33000,7 +33679,7 @@ function Puck({
|
|
33000
33679
|
dispatch,
|
33001
33680
|
onPublish,
|
33002
33681
|
menuOpen,
|
33003
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
33682
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
|
33004
33683
|
setMenuOpen
|
33005
33684
|
}
|
33006
33685
|
)
|
@@ -33008,38 +33687,19 @@ function Puck({
|
|
33008
33687
|
] }) })
|
33009
33688
|
}
|
33010
33689
|
),
|
33011
|
-
/* @__PURE__ */ (0,
|
33012
|
-
/* @__PURE__ */ (0,
|
33013
|
-
/* @__PURE__ */ (0,
|
33690
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
|
33691
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Components, {}) }),
|
33692
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Outline, {}) })
|
33014
33693
|
] }),
|
33015
|
-
/* @__PURE__ */ (0,
|
33016
|
-
|
33017
|
-
{
|
33018
|
-
className: getClassName22("frame"),
|
33019
|
-
onClick: () => setItemSelector(null),
|
33020
|
-
children: [
|
33021
|
-
/* @__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, {}) }) }),
|
33022
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33023
|
-
"div",
|
33024
|
-
{
|
33025
|
-
style: {
|
33026
|
-
background: "var(--puck-color-grey-10)",
|
33027
|
-
height: "100%",
|
33028
|
-
flexGrow: 1
|
33029
|
-
}
|
33030
|
-
}
|
33031
|
-
)
|
33032
|
-
]
|
33033
|
-
}
|
33034
|
-
),
|
33035
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33694
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Canvas, {}),
|
33695
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33036
33696
|
SidebarSection,
|
33037
33697
|
{
|
33038
33698
|
noPadding: true,
|
33039
33699
|
noBorderTop: true,
|
33040
33700
|
showBreadcrumbs: true,
|
33041
|
-
title: selectedItem ? selectedItem.type : "Page",
|
33042
|
-
children: /* @__PURE__ */ (0,
|
33701
|
+
title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
|
33702
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Fields, {})
|
33043
33703
|
}
|
33044
33704
|
) })
|
33045
33705
|
]
|
@@ -33051,7 +33711,7 @@ function Puck({
|
|
33051
33711
|
)
|
33052
33712
|
}
|
33053
33713
|
),
|
33054
|
-
/* @__PURE__ */ (0,
|
33714
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { id: "puck-portal-root" })
|
33055
33715
|
] });
|
33056
33716
|
}
|
33057
33717
|
Puck.Components = Components;
|
@@ -33061,13 +33721,13 @@ Puck.Preview = Preview;
|
|
33061
33721
|
|
33062
33722
|
// components/Render/index.tsx
|
33063
33723
|
init_react_import();
|
33064
|
-
var
|
33724
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
33065
33725
|
function Render({ config, data }) {
|
33066
33726
|
var _a;
|
33067
33727
|
const rootProps = data.root.props || data.root;
|
33068
33728
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
33069
33729
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
33070
|
-
return /* @__PURE__ */ (0,
|
33730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33071
33731
|
config.root.render,
|
33072
33732
|
__spreadProps(__spreadValues({}, rootProps), {
|
33073
33733
|
puck: {
|
@@ -33076,11 +33736,11 @@ function Render({ config, data }) {
|
|
33076
33736
|
title,
|
33077
33737
|
editMode: false,
|
33078
33738
|
id: "puck-root",
|
33079
|
-
children: /* @__PURE__ */ (0,
|
33739
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId })
|
33080
33740
|
})
|
33081
33741
|
) });
|
33082
33742
|
}
|
33083
|
-
return /* @__PURE__ */ (0,
|
33743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId }) });
|
33084
33744
|
}
|
33085
33745
|
|
33086
33746
|
// lib/migrate.ts
|
@@ -33170,8 +33830,8 @@ var resolveAllData = (data, config, onResolveStart, onResolveEnd) => __async(voi
|
|
33170
33830
|
// lib/use-puck.ts
|
33171
33831
|
init_react_import();
|
33172
33832
|
var usePuck = () => {
|
33173
|
-
const { state: appState, config, dispatch } = useAppContext();
|
33174
|
-
return { appState, config, dispatch };
|
33833
|
+
const { state: appState, config, history, dispatch } = useAppContext();
|
33834
|
+
return { appState, config, dispatch, history };
|
33175
33835
|
};
|
33176
33836
|
// Annotate the CommonJS export names for ESM import in node:
|
33177
33837
|
0 && (module.exports = {
|
@@ -33375,6 +34035,14 @@ lucide-react/dist/esm/icons/lock.js:
|
|
33375
34035
|
* See the LICENSE file in the root directory of this source tree.
|
33376
34036
|
*)
|
33377
34037
|
|
34038
|
+
lucide-react/dist/esm/icons/monitor.js:
|
34039
|
+
(**
|
34040
|
+
* @license lucide-react v0.298.0 - ISC
|
34041
|
+
*
|
34042
|
+
* This source code is licensed under the ISC license.
|
34043
|
+
* See the LICENSE file in the root directory of this source tree.
|
34044
|
+
*)
|
34045
|
+
|
33378
34046
|
lucide-react/dist/esm/icons/more-vertical.js:
|
33379
34047
|
(**
|
33380
34048
|
* @license lucide-react v0.298.0 - ISC
|
@@ -33415,6 +34083,30 @@ lucide-react/dist/esm/icons/search.js:
|
|
33415
34083
|
* See the LICENSE file in the root directory of this source tree.
|
33416
34084
|
*)
|
33417
34085
|
|
34086
|
+
lucide-react/dist/esm/icons/sliders-horizontal.js:
|
34087
|
+
(**
|
34088
|
+
* @license lucide-react v0.298.0 - ISC
|
34089
|
+
*
|
34090
|
+
* This source code is licensed under the ISC license.
|
34091
|
+
* See the LICENSE file in the root directory of this source tree.
|
34092
|
+
*)
|
34093
|
+
|
34094
|
+
lucide-react/dist/esm/icons/smartphone.js:
|
34095
|
+
(**
|
34096
|
+
* @license lucide-react v0.298.0 - ISC
|
34097
|
+
*
|
34098
|
+
* This source code is licensed under the ISC license.
|
34099
|
+
* See the LICENSE file in the root directory of this source tree.
|
34100
|
+
*)
|
34101
|
+
|
34102
|
+
lucide-react/dist/esm/icons/tablet.js:
|
34103
|
+
(**
|
34104
|
+
* @license lucide-react v0.298.0 - ISC
|
34105
|
+
*
|
34106
|
+
* This source code is licensed under the ISC license.
|
34107
|
+
* See the LICENSE file in the root directory of this source tree.
|
34108
|
+
*)
|
34109
|
+
|
33418
34110
|
lucide-react/dist/esm/icons/trash.js:
|
33419
34111
|
(**
|
33420
34112
|
* @license lucide-react v0.298.0 - ISC
|
@@ -33439,6 +34131,22 @@ lucide-react/dist/esm/icons/unlock.js:
|
|
33439
34131
|
* See the LICENSE file in the root directory of this source tree.
|
33440
34132
|
*)
|
33441
34133
|
|
34134
|
+
lucide-react/dist/esm/icons/zoom-in.js:
|
34135
|
+
(**
|
34136
|
+
* @license lucide-react v0.298.0 - ISC
|
34137
|
+
*
|
34138
|
+
* This source code is licensed under the ISC license.
|
34139
|
+
* See the LICENSE file in the root directory of this source tree.
|
34140
|
+
*)
|
34141
|
+
|
34142
|
+
lucide-react/dist/esm/icons/zoom-out.js:
|
34143
|
+
(**
|
34144
|
+
* @license lucide-react v0.298.0 - ISC
|
34145
|
+
*
|
34146
|
+
* This source code is licensed under the ISC license.
|
34147
|
+
* See the LICENSE file in the root directory of this source tree.
|
34148
|
+
*)
|
34149
|
+
|
33442
34150
|
lucide-react/dist/esm/lucide-react.js:
|
33443
34151
|
(**
|
33444
34152
|
* @license lucide-react v0.298.0 - ISC
|