@puckeditor/core 0.22.1 → 0.23.0-canary.20671fd7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Editor-MXSH3OSX.mjs → Editor-BJP5AFD5.mjs} +9 -9
- package/dist/{chunk-HRNJ42TO.mjs → chunk-25QAPMLH.mjs} +1 -1
- package/dist/{chunk-VOB4L2BJ.mjs → chunk-BMRBP3ET.mjs} +3 -3
- package/dist/{chunk-2AATV7NG.mjs → chunk-EYJW64M2.mjs} +21 -10
- package/dist/{chunk-DATOBXTJ.mjs → chunk-HB4CVO3I.mjs} +15 -8
- package/dist/{chunk-54LFCIWQ.mjs → chunk-JHNG6XYK.mjs} +122 -7
- package/dist/{chunk-FKYOVZNF.mjs → chunk-JNJJ2M57.mjs} +2 -2
- package/dist/{chunk-BVKXFA4V.mjs → chunk-MU6IPW26.mjs} +27 -12
- package/dist/{chunk-6PIQFZBM.mjs → chunk-Q6WCB6GM.mjs} +297 -160
- package/dist/{chunk-74HKFKJU.mjs → chunk-QHQD3BMI.mjs} +7 -5
- package/dist/{chunk-73XKHVBN.mjs → chunk-WQV7W7OC.mjs} +37 -22
- package/dist/{chunk-GR7NLT4T.mjs → chunk-WUO7D6OQ.mjs} +1 -1
- package/dist/{full-7JVAMOPS.mjs → full-7ONH7UPJ.mjs} +8 -8
- package/dist/{index-ClzBCbx_.d.mts → index-De5Tn61v.d.mts} +85 -1
- package/dist/{index-B1b1cFug.d.ts → index-t7c1w81O.d.ts} +85 -1
- package/dist/index.d.mts +20 -5
- package/dist/index.d.ts +20 -5
- package/dist/index.js +500 -154
- package/dist/index.mjs +11 -11
- package/dist/internal.d.mts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +7 -5
- package/dist/internal.mjs +2 -2
- package/dist/{loaded-HECCGJKO.mjs → loaded-35D7XAOE.mjs} +5 -5
- package/dist/{loaded-B7563MDT.mjs → loaded-6YDNF4HS.mjs} +5 -5
- package/dist/{loaded-EFZRGV2Y.mjs → loaded-PF5Y4VWH.mjs} +5 -5
- package/dist/no-external.d.mts +2 -2
- package/dist/no-external.d.ts +2 -2
- package/dist/no-external.js +500 -154
- package/dist/no-external.mjs +11 -11
- package/dist/rsc.js +7 -5
- package/dist/rsc.mjs +3 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EditorInner,
|
|
3
3
|
LoadedRichTextMenu
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BMRBP3ET.mjs";
|
|
5
5
|
import {
|
|
6
6
|
RichTextRenderFallback,
|
|
7
7
|
SlotRender,
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
getSlotTransform,
|
|
11
11
|
useRichtextProps,
|
|
12
12
|
useSlots
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JNJJ2M57.mjs";
|
|
14
14
|
import {
|
|
15
15
|
LoadedRichTextMenuInner
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WQV7W7OC.mjs";
|
|
17
17
|
import {
|
|
18
18
|
ActionBar,
|
|
19
19
|
ChevronDown,
|
|
@@ -63,12 +63,13 @@ import {
|
|
|
63
63
|
useAppStore,
|
|
64
64
|
useAppStoreApi,
|
|
65
65
|
useHotkey,
|
|
66
|
+
useMessage,
|
|
66
67
|
useMonitorHotkeys,
|
|
67
68
|
useRegisterFieldsSlice,
|
|
68
69
|
useRegisterHistorySlice,
|
|
69
70
|
useRegisterPermissionsSlice,
|
|
70
71
|
useResetAutoZoom
|
|
71
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-JHNG6XYK.mjs";
|
|
72
73
|
import {
|
|
73
74
|
generateId,
|
|
74
75
|
getItem,
|
|
@@ -76,11 +77,11 @@ import {
|
|
|
76
77
|
insertAction,
|
|
77
78
|
makeStatePublic,
|
|
78
79
|
populateIds
|
|
79
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-25QAPMLH.mjs";
|
|
80
81
|
import {
|
|
81
82
|
defaultAppState,
|
|
82
83
|
defaultViewports
|
|
83
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-WUO7D6OQ.mjs";
|
|
84
85
|
import {
|
|
85
86
|
get_class_name_factory_default
|
|
86
87
|
} from "./chunk-Y2EFNT5P.mjs";
|
|
@@ -95,7 +96,7 @@ import {
|
|
|
95
96
|
toComponent,
|
|
96
97
|
walkAppState,
|
|
97
98
|
walkField
|
|
98
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-QHQD3BMI.mjs";
|
|
99
100
|
import {
|
|
100
101
|
__async,
|
|
101
102
|
__objRest,
|
|
@@ -263,11 +264,12 @@ var FieldLabel = ({
|
|
|
263
264
|
className
|
|
264
265
|
}) => {
|
|
265
266
|
const El = el;
|
|
267
|
+
const readOnlyLabel = useMessage("field-readonly");
|
|
266
268
|
return /* @__PURE__ */ jsxs2(El, { className, children: [
|
|
267
269
|
/* @__PURE__ */ jsxs2("div", { className: getClassName2("label"), children: [
|
|
268
270
|
icon ? /* @__PURE__ */ jsx2("div", { className: getClassName2("labelIcon"), children: icon }) : /* @__PURE__ */ jsx2(Fragment, {}),
|
|
269
271
|
label,
|
|
270
|
-
readOnly && /* @__PURE__ */ jsx2("div", { className: getClassName2("disabledIcon"), title:
|
|
272
|
+
readOnly && /* @__PURE__ */ jsx2("div", { className: getClassName2("disabledIcon"), title: readOnlyLabel, children: /* @__PURE__ */ jsx2(Lock, { size: "12" }) })
|
|
271
273
|
] }),
|
|
272
274
|
children
|
|
273
275
|
] });
|
|
@@ -956,12 +958,15 @@ var ItemSummaryInner = ({
|
|
|
956
958
|
const path = `${[name]}[${index}]`;
|
|
957
959
|
return getDeep(s, path);
|
|
958
960
|
});
|
|
961
|
+
const fallbackSummary = useMessage("field-arrayitem-summary", {
|
|
962
|
+
index: originalIndex
|
|
963
|
+
});
|
|
959
964
|
const itemSummary = useMemo3(() => {
|
|
960
965
|
if (data && field.getItemSummary) {
|
|
961
966
|
return field.getItemSummary(data, index);
|
|
962
967
|
}
|
|
963
|
-
return
|
|
964
|
-
}, [data, field, originalIndex, index]);
|
|
968
|
+
return fallbackSummary;
|
|
969
|
+
}, [data, field, originalIndex, index, fallbackSummary]);
|
|
965
970
|
return itemSummary;
|
|
966
971
|
};
|
|
967
972
|
var ItemSummary = memo2(ItemSummaryInner);
|
|
@@ -1183,6 +1188,8 @@ var ArrayField = ({
|
|
|
1183
1188
|
const newArrayState = regenerateArrayState(getValue());
|
|
1184
1189
|
setUi(mapArrayStateToUi(newArrayState), false);
|
|
1185
1190
|
}, [numItems]);
|
|
1191
|
+
const duplicateLabel = useMessage("field-arrayitem-duplicate");
|
|
1192
|
+
const deleteLabel = useMessage("field-arrayitem-delete");
|
|
1186
1193
|
if (field.type !== "array" || !field.arrayFields) {
|
|
1187
1194
|
return null;
|
|
1188
1195
|
}
|
|
@@ -1294,7 +1301,7 @@ var ArrayField = ({
|
|
|
1294
1301
|
existingValue.splice(index, 0, newItem);
|
|
1295
1302
|
updateValue(existingValue);
|
|
1296
1303
|
},
|
|
1297
|
-
title:
|
|
1304
|
+
title: duplicateLabel,
|
|
1298
1305
|
children: /* @__PURE__ */ jsx8(Copy, { size: 16 })
|
|
1299
1306
|
}
|
|
1300
1307
|
) }),
|
|
@@ -1310,7 +1317,7 @@ var ArrayField = ({
|
|
|
1310
1317
|
existingValue.splice(index, 1);
|
|
1311
1318
|
updateValue(existingValue);
|
|
1312
1319
|
},
|
|
1313
|
-
title:
|
|
1320
|
+
title: deleteLabel,
|
|
1314
1321
|
children: /* @__PURE__ */ jsx8(Trash, { size: 16 })
|
|
1315
1322
|
}
|
|
1316
1323
|
) })
|
|
@@ -1532,6 +1539,11 @@ init_react_import();
|
|
|
1532
1539
|
import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1533
1540
|
var getClassName8 = get_class_name_factory_default("ExternalInput", styles_module_default4);
|
|
1534
1541
|
var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default4);
|
|
1542
|
+
var DefaultFooter = ({ count }) => {
|
|
1543
|
+
const singular = useMessage("field-external-result-singular", { count });
|
|
1544
|
+
const plural = useMessage("field-external-result-plural", { count });
|
|
1545
|
+
return /* @__PURE__ */ jsx12("span", { className: getClassNameModal("footer"), children: count === 1 ? singular : plural });
|
|
1546
|
+
};
|
|
1535
1547
|
var dataCache = {};
|
|
1536
1548
|
var ExternalInput = ({
|
|
1537
1549
|
field,
|
|
@@ -1590,16 +1602,16 @@ var ExternalInput = ({
|
|
|
1590
1602
|
[id, field]
|
|
1591
1603
|
);
|
|
1592
1604
|
const Footer = useCallback3(
|
|
1593
|
-
(props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */
|
|
1594
|
-
props.items.length,
|
|
1595
|
-
" result",
|
|
1596
|
-
props.items.length === 1 ? "" : "s"
|
|
1597
|
-
] }),
|
|
1605
|
+
(props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ jsx12(DefaultFooter, { count: props.items.length }),
|
|
1598
1606
|
[field.renderFooter]
|
|
1599
1607
|
);
|
|
1600
1608
|
useEffect5(() => {
|
|
1601
1609
|
search(searchQuery, filters);
|
|
1602
1610
|
}, []);
|
|
1611
|
+
const externalItemLabel = useMessage("field-external-item");
|
|
1612
|
+
const searchLabel = useMessage("field-external-search");
|
|
1613
|
+
const toggleFiltersLabel = useMessage("field-external-togglefilters");
|
|
1614
|
+
const selectDataLabel = useMessage("field-external-selectdata");
|
|
1603
1615
|
return /* @__PURE__ */ jsxs5(
|
|
1604
1616
|
"div",
|
|
1605
1617
|
{
|
|
@@ -1618,7 +1630,7 @@ var ExternalInput = ({
|
|
|
1618
1630
|
onClick: () => setOpen(true),
|
|
1619
1631
|
className: getClassName8("button"),
|
|
1620
1632
|
disabled: readOnly,
|
|
1621
|
-
children: value ? field.getItemSummary ? field.getItemSummary(value) :
|
|
1633
|
+
children: value ? field.getItemSummary ? field.getItemSummary(value) : externalItemLabel : /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
1622
1634
|
/* @__PURE__ */ jsx12(Link, { size: "16" }),
|
|
1623
1635
|
/* @__PURE__ */ jsx12("span", { children: field.placeholder })
|
|
1624
1636
|
] })
|
|
@@ -1654,7 +1666,7 @@ var ExternalInput = ({
|
|
|
1654
1666
|
children: [
|
|
1655
1667
|
/* @__PURE__ */ jsx12("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ jsxs5("div", { className: getClassNameModal("searchForm"), children: [
|
|
1656
1668
|
/* @__PURE__ */ jsxs5("label", { className: getClassNameModal("search"), children: [
|
|
1657
|
-
/* @__PURE__ */ jsx12("span", { className: getClassNameModal("searchIconText"), children:
|
|
1669
|
+
/* @__PURE__ */ jsx12("span", { className: getClassNameModal("searchIconText"), children: searchLabel }),
|
|
1658
1670
|
/* @__PURE__ */ jsx12("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ jsx12(Search, { size: "18" }) }),
|
|
1659
1671
|
/* @__PURE__ */ jsx12(
|
|
1660
1672
|
"input",
|
|
@@ -1672,12 +1684,12 @@ var ExternalInput = ({
|
|
|
1672
1684
|
)
|
|
1673
1685
|
] }),
|
|
1674
1686
|
/* @__PURE__ */ jsxs5("div", { className: getClassNameModal("searchActions"), children: [
|
|
1675
|
-
/* @__PURE__ */ jsx12(Button, { type: "submit", loading: isLoading, fullWidth: true, children:
|
|
1687
|
+
/* @__PURE__ */ jsx12(Button, { type: "submit", loading: isLoading, fullWidth: true, children: searchLabel }),
|
|
1676
1688
|
hasFilterFields && /* @__PURE__ */ jsx12("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ jsx12(
|
|
1677
1689
|
IconButton,
|
|
1678
1690
|
{
|
|
1679
1691
|
type: "button",
|
|
1680
|
-
title:
|
|
1692
|
+
title: toggleFiltersLabel,
|
|
1681
1693
|
onClick: (e) => {
|
|
1682
1694
|
e.preventDefault();
|
|
1683
1695
|
e.stopPropagation();
|
|
@@ -1687,7 +1699,7 @@ var ExternalInput = ({
|
|
|
1687
1699
|
}
|
|
1688
1700
|
) })
|
|
1689
1701
|
] })
|
|
1690
|
-
] }) : /* @__PURE__ */ jsx12(Heading, { rank: "2", size: "xs", children: field.placeholder ||
|
|
1702
|
+
] }) : /* @__PURE__ */ jsx12(Heading, { rank: "2", size: "xs", children: field.placeholder || selectDataLabel }) }),
|
|
1691
1703
|
/* @__PURE__ */ jsxs5("div", { className: getClassNameModal("grid"), children: [
|
|
1692
1704
|
hasFilterFields && /* @__PURE__ */ jsx12("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
|
|
1693
1705
|
const filterField = filterFields[fieldName];
|
|
@@ -1771,6 +1783,7 @@ var ExternalField = ({
|
|
|
1771
1783
|
const value = useDeepField(name);
|
|
1772
1784
|
const validField = field;
|
|
1773
1785
|
const deprecatedField = field;
|
|
1786
|
+
const selectDataLabel = useMessage("field-external-selectdata");
|
|
1774
1787
|
useEffect6(() => {
|
|
1775
1788
|
if (deprecatedField.adaptor) {
|
|
1776
1789
|
console.error(
|
|
@@ -1793,7 +1806,7 @@ var ExternalField = ({
|
|
|
1793
1806
|
name,
|
|
1794
1807
|
field: __spreadProps(__spreadValues({}, validField), {
|
|
1795
1808
|
// DEPRECATED
|
|
1796
|
-
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder ||
|
|
1809
|
+
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || selectDataLabel,
|
|
1797
1810
|
mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
|
|
1798
1811
|
mapRow: validField.mapRow,
|
|
1799
1812
|
fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(null, null, function* () {
|
|
@@ -1999,7 +2012,7 @@ EditorFallback.displayName = "EditorFallback";
|
|
|
1999
2012
|
// components/AutoField/fields/RichtextField/index.tsx
|
|
2000
2013
|
import { Fragment as Fragment5, jsx as jsx18 } from "react/jsx-runtime";
|
|
2001
2014
|
var Editor = lazy(
|
|
2002
|
-
() => import("./Editor-
|
|
2015
|
+
() => import("./Editor-BJP5AFD5.mjs").then((m) => ({
|
|
2003
2016
|
default: m.Editor
|
|
2004
2017
|
}))
|
|
2005
2018
|
);
|
|
@@ -2944,9 +2957,12 @@ var DraggableComponent = ({
|
|
|
2944
2957
|
}
|
|
2945
2958
|
setDragAxis(autoDragAxis);
|
|
2946
2959
|
}, [ref, userDragAxis, autoDragAxis]);
|
|
2960
|
+
const selectParentLabel = useMessage("action-selectparent");
|
|
2961
|
+
const duplicateLabel = useMessage("action-duplicate");
|
|
2962
|
+
const deleteLabel = useMessage("action-delete");
|
|
2947
2963
|
const parentAction = useMemo7(
|
|
2948
|
-
() => (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ jsx22(ActionBar.Action, { onClick: onSelectParent, label:
|
|
2949
|
-
[ctx == null ? void 0 : ctx.areaId]
|
|
2964
|
+
() => (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ jsx22(ActionBar.Action, { onClick: onSelectParent, label: selectParentLabel, children: /* @__PURE__ */ jsx22(CornerLeftUp, { size: 16 }) }),
|
|
2965
|
+
[ctx == null ? void 0 : ctx.areaId, selectParentLabel]
|
|
2950
2966
|
);
|
|
2951
2967
|
const nextContextValue = useMemo7(
|
|
2952
2968
|
() => __spreadProps(__spreadValues({}, ctx), {
|
|
@@ -3026,8 +3042,15 @@ var DraggableComponent = ({
|
|
|
3026
3042
|
),
|
|
3027
3043
|
hasNormalActions && /* @__PURE__ */ jsx22(ActionBar.Separator, {})
|
|
3028
3044
|
] }),
|
|
3029
|
-
permissions.duplicate && /* @__PURE__ */ jsx22(
|
|
3030
|
-
|
|
3045
|
+
permissions.duplicate && /* @__PURE__ */ jsx22(
|
|
3046
|
+
ActionBar.Action,
|
|
3047
|
+
{
|
|
3048
|
+
onClick: onDuplicate,
|
|
3049
|
+
label: duplicateLabel,
|
|
3050
|
+
children: /* @__PURE__ */ jsx22(Copy, { className: getClassName14("actionsAction") })
|
|
3051
|
+
}
|
|
3052
|
+
),
|
|
3053
|
+
permissions.delete && /* @__PURE__ */ jsx22(ActionBar.Action, { onClick: onDelete, label: deleteLabel, children: /* @__PURE__ */ jsx22(Trash, { className: getClassName14("actionsAction") }) })
|
|
3031
3054
|
]
|
|
3032
3055
|
}
|
|
3033
3056
|
)
|
|
@@ -4240,6 +4263,7 @@ var ContextSlotRender = ({
|
|
|
4240
4263
|
init_react_import();
|
|
4241
4264
|
import { useMemo as useMemo10, useRef as useRef5 } from "react";
|
|
4242
4265
|
function useFieldTransformsTracked(config, item, transforms, readOnly, forceReadOnly) {
|
|
4266
|
+
const prevMappers = useRef5(null);
|
|
4243
4267
|
const prevProps = useRef5(null);
|
|
4244
4268
|
const prevResult = useRef5(item.props);
|
|
4245
4269
|
const mappers = useMemo10(
|
|
@@ -4247,29 +4271,44 @@ function useFieldTransformsTracked(config, item, transforms, readOnly, forceRead
|
|
|
4247
4271
|
[transforms, readOnly, forceReadOnly]
|
|
4248
4272
|
);
|
|
4249
4273
|
const transformedProps = useMemo10(() => {
|
|
4250
|
-
var _a, _b, _c;
|
|
4251
|
-
const changedProps = {};
|
|
4274
|
+
var _a, _b, _c, _d;
|
|
4252
4275
|
const componentConfig = item.type === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[item.type];
|
|
4276
|
+
const componentFields = (_b = componentConfig == null ? void 0 : componentConfig.fields) != null ? _b : {};
|
|
4277
|
+
const fullRemap = prevMappers.current !== mappers;
|
|
4278
|
+
let changedFields;
|
|
4253
4279
|
let changeIncludesSlot = false;
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
changedProps[fieldName] = item.props[fieldName];
|
|
4258
|
-
if (fieldType === "slot") {
|
|
4280
|
+
if (!prevProps.current || fullRemap) {
|
|
4281
|
+
for (const fieldName in item.props) {
|
|
4282
|
+
if (((_c = componentFields[fieldName]) == null ? void 0 : _c.type) === "slot") {
|
|
4259
4283
|
changeIncludesSlot = true;
|
|
4260
4284
|
}
|
|
4261
4285
|
}
|
|
4286
|
+
} else {
|
|
4287
|
+
changedFields = ["id"];
|
|
4288
|
+
const allFieldNames = /* @__PURE__ */ new Set([
|
|
4289
|
+
...Object.keys(item.props),
|
|
4290
|
+
...Object.keys(prevProps.current)
|
|
4291
|
+
]);
|
|
4292
|
+
for (const fieldName of allFieldNames) {
|
|
4293
|
+
if (item.props[fieldName] !== prevProps.current[fieldName]) {
|
|
4294
|
+
changedFields.push(fieldName);
|
|
4295
|
+
if (((_d = componentFields[fieldName]) == null ? void 0 : _d.type) === "slot") {
|
|
4296
|
+
changeIncludesSlot = true;
|
|
4297
|
+
}
|
|
4298
|
+
}
|
|
4299
|
+
}
|
|
4262
4300
|
}
|
|
4263
|
-
changedProps.id = item.props.id;
|
|
4264
|
-
prevProps.current = item.props;
|
|
4265
4301
|
const mapped = mapFields(
|
|
4266
|
-
|
|
4302
|
+
item,
|
|
4267
4303
|
mappers,
|
|
4268
4304
|
config,
|
|
4269
4305
|
false,
|
|
4270
|
-
changeIncludesSlot
|
|
4306
|
+
changeIncludesSlot,
|
|
4307
|
+
changedFields
|
|
4271
4308
|
).props;
|
|
4272
|
-
|
|
4309
|
+
prevProps.current = item.props;
|
|
4310
|
+
prevMappers.current = mappers;
|
|
4311
|
+
prevResult.current = changedFields ? __spreadValues(__spreadValues({}, prevResult.current), mapped) : mapped;
|
|
4273
4312
|
return prevResult.current;
|
|
4274
4313
|
}, [config, item, mappers]);
|
|
4275
4314
|
const mergedProps = useMemo10(
|
|
@@ -4499,7 +4538,7 @@ import {
|
|
|
4499
4538
|
} from "react";
|
|
4500
4539
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
4501
4540
|
var Editor2 = lazy2(
|
|
4502
|
-
() => import("./Editor-
|
|
4541
|
+
() => import("./Editor-BJP5AFD5.mjs").then((m) => ({
|
|
4503
4542
|
default: m.Editor
|
|
4504
4543
|
}))
|
|
4505
4544
|
);
|
|
@@ -4868,7 +4907,7 @@ var VirtualizedDropZone = ({
|
|
|
4868
4907
|
};
|
|
4869
4908
|
|
|
4870
4909
|
// components/DropZone/index.tsx
|
|
4871
|
-
import { Fragment as Fragment9, jsx as jsx31
|
|
4910
|
+
import { Fragment as Fragment9, jsx as jsx31 } from "react/jsx-runtime";
|
|
4872
4911
|
var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default9);
|
|
4873
4912
|
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
|
4874
4913
|
var RENDER_DEBUG = false;
|
|
@@ -4895,7 +4934,7 @@ var DropZoneChild = ({
|
|
|
4895
4934
|
inDroppableZone,
|
|
4896
4935
|
itemRef
|
|
4897
4936
|
}) => {
|
|
4898
|
-
var _a, _b;
|
|
4937
|
+
var _a, _b, _c, _d;
|
|
4899
4938
|
const metadata = useAppStore((s) => s.metadata);
|
|
4900
4939
|
const ctx = useContext9(dropZoneContext);
|
|
4901
4940
|
const { depth = 1 } = ctx != null ? ctx : {};
|
|
@@ -4963,7 +5002,11 @@ var DropZoneChild = ({
|
|
|
4963
5002
|
return ((_a2 = s.selectedItem) == null ? void 0 : _a2.props.id) === componentId || false;
|
|
4964
5003
|
}
|
|
4965
5004
|
);
|
|
4966
|
-
|
|
5005
|
+
const componentLabel = useMessage("label-component");
|
|
5006
|
+
const noConfigMessage = useMessage("canvas-noconfig", {
|
|
5007
|
+
type: (_b = (_a = item == null ? void 0 : item.type) == null ? void 0 : _a.toString()) != null ? _b : ""
|
|
5008
|
+
});
|
|
5009
|
+
let label = (_d = (_c = componentConfig == null ? void 0 : componentConfig.label) != null ? _c : item == null ? void 0 : item.type.toString()) != null ? _d : componentLabel;
|
|
4967
5010
|
const defaultsProps = useMemo12(
|
|
4968
5011
|
() => __spreadProps(__spreadValues(__spreadValues({}, componentConfig == null ? void 0 : componentConfig.defaultProps), item == null ? void 0 : item.props), {
|
|
4969
5012
|
puck: puckProps,
|
|
@@ -4997,10 +5040,7 @@ var DropZoneChild = ({
|
|
|
4997
5040
|
isLoading
|
|
4998
5041
|
);
|
|
4999
5042
|
if (!item) return;
|
|
5000
|
-
const Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */
|
|
5001
|
-
"No configuration for ",
|
|
5002
|
-
item.type
|
|
5003
|
-
] });
|
|
5043
|
+
const Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ jsx31("div", { style: { padding: 48, textAlign: "center" }, children: noConfigMessage });
|
|
5004
5044
|
let componentType = item.type;
|
|
5005
5045
|
const isInserting = "previewType" in item ? item.previewType === "insert" : false;
|
|
5006
5046
|
return /* @__PURE__ */ jsx31(
|
|
@@ -5492,7 +5532,8 @@ var generateUsePuck = (store, getState) => {
|
|
|
5492
5532
|
const parentNode = store.state.indexes.nodes[parentId];
|
|
5493
5533
|
if (!parentNode) return;
|
|
5494
5534
|
return parentNode.data;
|
|
5495
|
-
}
|
|
5535
|
+
},
|
|
5536
|
+
dictionary: store.dictionary
|
|
5496
5537
|
};
|
|
5497
5538
|
storeData.__private = {
|
|
5498
5539
|
appState: store.state
|
|
@@ -5509,7 +5550,8 @@ var convertToPickedStore = (store) => {
|
|
|
5509
5550
|
dispatch: store.dispatch,
|
|
5510
5551
|
permissions: store.permissions,
|
|
5511
5552
|
history: store.history,
|
|
5512
|
-
selectedItem: store.selectedItem
|
|
5553
|
+
selectedItem: store.selectedItem,
|
|
5554
|
+
dictionary: store.dictionary
|
|
5513
5555
|
};
|
|
5514
5556
|
};
|
|
5515
5557
|
var useRegisterUsePuckStore = (appStore) => {
|
|
@@ -5579,7 +5621,7 @@ var styles_module_default12 = { "ComponentList": "_ComponentList_htktj_1", "Comp
|
|
|
5579
5621
|
|
|
5580
5622
|
// components/ComponentList/index.tsx
|
|
5581
5623
|
import { useEffect as useEffect18 } from "react";
|
|
5582
|
-
import { jsx as jsx33, jsxs as
|
|
5624
|
+
import { jsx as jsx33, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
5583
5625
|
var getClassName18 = get_class_name_factory_default("ComponentList", styles_module_default12);
|
|
5584
5626
|
var ComponentListItem = ({
|
|
5585
5627
|
name,
|
|
@@ -5611,8 +5653,14 @@ var ComponentList = ({
|
|
|
5611
5653
|
const componentList = useAppStore((s) => s.state.ui.componentList);
|
|
5612
5654
|
const { expanded = true } = componentList[id] || {};
|
|
5613
5655
|
const contentId = `puck-drawer-category-${id}`;
|
|
5614
|
-
|
|
5615
|
-
title
|
|
5656
|
+
const collapseTitle = useMessage("drawer-category-collapse", {
|
|
5657
|
+
title: title != null ? title : ""
|
|
5658
|
+
});
|
|
5659
|
+
const expandTitle = useMessage("drawer-category-expand", {
|
|
5660
|
+
title: title != null ? title : ""
|
|
5661
|
+
});
|
|
5662
|
+
return /* @__PURE__ */ jsxs10("div", { className: getClassName18({ isExpanded: expanded }), children: [
|
|
5663
|
+
title && /* @__PURE__ */ jsxs10(
|
|
5616
5664
|
"button",
|
|
5617
5665
|
{
|
|
5618
5666
|
type: "button",
|
|
@@ -5626,7 +5674,7 @@ var ComponentList = ({
|
|
|
5626
5674
|
})
|
|
5627
5675
|
})
|
|
5628
5676
|
}),
|
|
5629
|
-
title: expanded ?
|
|
5677
|
+
title: expanded ? collapseTitle : expandTitle,
|
|
5630
5678
|
children: [
|
|
5631
5679
|
/* @__PURE__ */ jsx33("div", { children: title }),
|
|
5632
5680
|
/* @__PURE__ */ jsx33("div", { className: getClassName18("titleIcon"), children: expanded ? /* @__PURE__ */ jsx33(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx33(ChevronDown, { size: 12 }) })
|
|
@@ -5654,6 +5702,7 @@ var useComponentList = () => {
|
|
|
5654
5702
|
const [componentList, setComponentList] = useState17();
|
|
5655
5703
|
const config = useAppStore((s) => s.config);
|
|
5656
5704
|
const uiComponentList = useAppStore((s) => s.state.ui.componentList);
|
|
5705
|
+
const otherLabel = useMessage("drawer-category-other");
|
|
5657
5706
|
useEffect19(() => {
|
|
5658
5707
|
var _a, _b, _c;
|
|
5659
5708
|
if (Object.keys(uiComponentList).length > 0) {
|
|
@@ -5661,6 +5710,7 @@ var useComponentList = () => {
|
|
|
5661
5710
|
let _componentList;
|
|
5662
5711
|
_componentList = Object.entries(uiComponentList).map(
|
|
5663
5712
|
([categoryKey, category]) => {
|
|
5713
|
+
var _a2, _b2;
|
|
5664
5714
|
if (!category.components) {
|
|
5665
5715
|
return null;
|
|
5666
5716
|
}
|
|
@@ -5674,14 +5724,14 @@ var useComponentList = () => {
|
|
|
5674
5724
|
ComponentList,
|
|
5675
5725
|
{
|
|
5676
5726
|
id: categoryKey,
|
|
5677
|
-
title: category.title || categoryKey,
|
|
5727
|
+
title: ((_b2 = (_a2 = config.categories) == null ? void 0 : _a2[categoryKey]) == null ? void 0 : _b2.title) || category.title || categoryKey,
|
|
5678
5728
|
children: category.components.map((componentName, i) => {
|
|
5679
|
-
var
|
|
5729
|
+
var _a3;
|
|
5680
5730
|
const componentConf = config.components[componentName] || {};
|
|
5681
5731
|
return /* @__PURE__ */ jsx34(
|
|
5682
5732
|
ComponentList.Item,
|
|
5683
5733
|
{
|
|
5684
|
-
label: (
|
|
5734
|
+
label: (_a3 = componentConf["label"]) != null ? _a3 : componentName,
|
|
5685
5735
|
name: componentName,
|
|
5686
5736
|
index: i
|
|
5687
5737
|
},
|
|
@@ -5702,7 +5752,7 @@ var useComponentList = () => {
|
|
|
5702
5752
|
ComponentList,
|
|
5703
5753
|
{
|
|
5704
5754
|
id: "other",
|
|
5705
|
-
title: ((_c = uiComponentList.other) == null ? void 0 : _c.title) ||
|
|
5755
|
+
title: ((_c = uiComponentList.other) == null ? void 0 : _c.title) || otherLabel,
|
|
5706
5756
|
children: remainingComponents.map((componentName, i) => {
|
|
5707
5757
|
var _a2;
|
|
5708
5758
|
const componentConf = config.components[componentName] || {};
|
|
@@ -5723,7 +5773,7 @@ var useComponentList = () => {
|
|
|
5723
5773
|
}
|
|
5724
5774
|
setComponentList(_componentList);
|
|
5725
5775
|
}
|
|
5726
|
-
}, [config.categories, config.components, uiComponentList]);
|
|
5776
|
+
}, [config.categories, config.components, uiComponentList, otherLabel]);
|
|
5727
5777
|
return componentList;
|
|
5728
5778
|
};
|
|
5729
5779
|
|
|
@@ -5751,12 +5801,15 @@ var styles_module_default13 = { "BlocksPlugin": "_BlocksPlugin_9af19_1" };
|
|
|
5751
5801
|
// plugins/blocks/index.tsx
|
|
5752
5802
|
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
5753
5803
|
var getClassName19 = get_class_name_factory_default("BlocksPlugin", styles_module_default13);
|
|
5754
|
-
var blocksPlugin = () =>
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
})
|
|
5804
|
+
var blocksPlugin = (props = {}) => {
|
|
5805
|
+
var _a, _b;
|
|
5806
|
+
return {
|
|
5807
|
+
name: "blocks",
|
|
5808
|
+
label: (_a = props.label) != null ? _a : "Blocks",
|
|
5809
|
+
render: () => /* @__PURE__ */ jsx36("div", { className: getClassName19(), children: /* @__PURE__ */ jsx36(Components, {}) }),
|
|
5810
|
+
icon: (_b = props.icon) != null ? _b : /* @__PURE__ */ jsx36(Hammer, {})
|
|
5811
|
+
};
|
|
5812
|
+
};
|
|
5760
5813
|
|
|
5761
5814
|
// plugins/outline/index.tsx
|
|
5762
5815
|
init_react_import();
|
|
@@ -5779,7 +5832,7 @@ import {
|
|
|
5779
5832
|
useRef as useRef10
|
|
5780
5833
|
} from "react";
|
|
5781
5834
|
import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
|
|
5782
|
-
import { Fragment as Fragment10, jsx as jsx37, jsxs as
|
|
5835
|
+
import { Fragment as Fragment10, jsx as jsx37, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5783
5836
|
var getClassName20 = get_class_name_factory_default("LayerTree", styles_module_default14);
|
|
5784
5837
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default14);
|
|
5785
5838
|
var DEFAULT_LAYER_ROW_HEIGHT = 32;
|
|
@@ -5813,11 +5866,12 @@ var buildLayerNode = ({
|
|
|
5813
5866
|
nodes,
|
|
5814
5867
|
zoneCompound,
|
|
5815
5868
|
zones,
|
|
5816
|
-
zonesByParent
|
|
5869
|
+
zonesByParent,
|
|
5870
|
+
componentFallbackLabel = "Component"
|
|
5817
5871
|
}) => {
|
|
5818
5872
|
var _a, _b, _c;
|
|
5819
5873
|
const nodeData = nodes[itemId];
|
|
5820
|
-
const componentType = ((_a = nodeData == null ? void 0 : nodeData.data.type) == null ? void 0 : _a.toString()) ||
|
|
5874
|
+
const componentType = ((_a = nodeData == null ? void 0 : nodeData.data.type) == null ? void 0 : _a.toString()) || componentFallbackLabel;
|
|
5821
5875
|
const label = (_c = (_b = config.components[componentType]) == null ? void 0 : _b.label) != null ? _c : componentType;
|
|
5822
5876
|
const childZoneCompounds = zonesByParent[itemId] || [];
|
|
5823
5877
|
return {
|
|
@@ -5827,7 +5881,8 @@ var buildLayerNode = ({
|
|
|
5827
5881
|
nodes,
|
|
5828
5882
|
zoneCompound: childZoneCompound,
|
|
5829
5883
|
zones,
|
|
5830
|
-
zonesByParent
|
|
5884
|
+
zonesByParent,
|
|
5885
|
+
componentFallbackLabel
|
|
5831
5886
|
})
|
|
5832
5887
|
),
|
|
5833
5888
|
componentType,
|
|
@@ -5843,7 +5898,8 @@ var buildLayerTree = ({
|
|
|
5843
5898
|
nodes,
|
|
5844
5899
|
zoneCompound,
|
|
5845
5900
|
zones,
|
|
5846
|
-
zonesByParent = getZonesByParent(zones)
|
|
5901
|
+
zonesByParent = getZonesByParent(zones),
|
|
5902
|
+
componentFallbackLabel = "Component"
|
|
5847
5903
|
}) => {
|
|
5848
5904
|
var _a, _b;
|
|
5849
5905
|
const contentIds = (_b = (_a = zones[zoneCompound]) == null ? void 0 : _a.contentIds) != null ? _b : [];
|
|
@@ -5856,7 +5912,8 @@ var buildLayerTree = ({
|
|
|
5856
5912
|
nodes,
|
|
5857
5913
|
zoneCompound,
|
|
5858
5914
|
zones,
|
|
5859
|
-
zonesByParent
|
|
5915
|
+
zonesByParent,
|
|
5916
|
+
componentFallbackLabel
|
|
5860
5917
|
})
|
|
5861
5918
|
),
|
|
5862
5919
|
label: getZoneLabel(zoneCompound, nodes, config, label),
|
|
@@ -5901,6 +5958,8 @@ var Layer = forwardRef2(function Layer2({
|
|
|
5901
5958
|
(s) => s.hoveringComponent === node.itemId
|
|
5902
5959
|
);
|
|
5903
5960
|
const containsZone = node.childZones.length > 0;
|
|
5961
|
+
const collapseLabel = useMessage("outline-collapse");
|
|
5962
|
+
const expandLabel = useMessage("outline-expand");
|
|
5904
5963
|
const setItemSelector = useCallback14(
|
|
5905
5964
|
(itemSelector) => {
|
|
5906
5965
|
dispatch({ type: "setUi", ui: { itemSelector } });
|
|
@@ -5908,7 +5967,7 @@ var Layer = forwardRef2(function Layer2({
|
|
|
5908
5967
|
[dispatch]
|
|
5909
5968
|
);
|
|
5910
5969
|
const shouldRenderChildren = isSelected || childIsSelected;
|
|
5911
|
-
return /* @__PURE__ */
|
|
5970
|
+
return /* @__PURE__ */ jsxs11(
|
|
5912
5971
|
"li",
|
|
5913
5972
|
{
|
|
5914
5973
|
ref,
|
|
@@ -5921,7 +5980,7 @@ var Layer = forwardRef2(function Layer2({
|
|
|
5921
5980
|
"data-index": dataIndex,
|
|
5922
5981
|
"data-puck-layer-tree-id": node.itemId,
|
|
5923
5982
|
children: [
|
|
5924
|
-
/* @__PURE__ */ jsx37("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */
|
|
5983
|
+
/* @__PURE__ */ jsx37("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs11(
|
|
5925
5984
|
"button",
|
|
5926
5985
|
{
|
|
5927
5986
|
type: "button",
|
|
@@ -5950,11 +6009,11 @@ var Layer = forwardRef2(function Layer2({
|
|
|
5950
6009
|
"div",
|
|
5951
6010
|
{
|
|
5952
6011
|
className: getClassNameLayer("chevron"),
|
|
5953
|
-
title: isSelected ?
|
|
6012
|
+
title: isSelected ? collapseLabel : expandLabel,
|
|
5954
6013
|
children: /* @__PURE__ */ jsx37(ChevronDown, { size: "12" })
|
|
5955
6014
|
}
|
|
5956
6015
|
),
|
|
5957
|
-
/* @__PURE__ */
|
|
6016
|
+
/* @__PURE__ */ jsxs11("div", { className: getClassNameLayer("title"), children: [
|
|
5958
6017
|
/* @__PURE__ */ jsx37("div", { className: getClassNameLayer("icon"), children: node.componentType === "Text" || node.componentType === "Heading" ? /* @__PURE__ */ jsx37(Type, { size: "16" }) : /* @__PURE__ */ jsx37(LayoutGrid, { size: "16" }) }),
|
|
5959
6018
|
/* @__PURE__ */ jsx37("div", { className: getClassNameLayer("name"), children: node.label })
|
|
5960
6019
|
] })
|
|
@@ -5988,8 +6047,8 @@ var LayerTreeZone = ({
|
|
|
5988
6047
|
tree
|
|
5989
6048
|
}) => {
|
|
5990
6049
|
const shouldVirtualize = depth === 0 && tree.items.length >= MIN_VIRTUALIZED_LAYER_COUNT;
|
|
5991
|
-
return /* @__PURE__ */
|
|
5992
|
-
tree.label && /* @__PURE__ */
|
|
6050
|
+
return /* @__PURE__ */ jsxs11(Fragment10, { children: [
|
|
6051
|
+
tree.label && /* @__PURE__ */ jsxs11("div", { className: getClassName20("zoneTitle"), children: [
|
|
5993
6052
|
/* @__PURE__ */ jsx37("div", { className: getClassName20("zoneIcon"), children: /* @__PURE__ */ jsx37(Layers, { size: "16" }) }),
|
|
5994
6053
|
tree.label
|
|
5995
6054
|
] }),
|
|
@@ -6018,8 +6077,9 @@ var StaticLayerTreeItems = ({
|
|
|
6018
6077
|
selectedPathIds,
|
|
6019
6078
|
tree
|
|
6020
6079
|
}) => {
|
|
6021
|
-
|
|
6022
|
-
|
|
6080
|
+
const noItemsLabel = useMessage("outline-empty");
|
|
6081
|
+
return /* @__PURE__ */ jsxs11("ul", { className: getClassName20(), children: [
|
|
6082
|
+
tree.items.length === 0 && /* @__PURE__ */ jsx37("div", { className: getClassName20("helper"), children: noItemsLabel }),
|
|
6023
6083
|
tree.items.map((node) => /* @__PURE__ */ jsx37(
|
|
6024
6084
|
Layer,
|
|
6025
6085
|
{
|
|
@@ -6041,6 +6101,7 @@ var VirtualizedLayerTreeItems = ({
|
|
|
6041
6101
|
tree
|
|
6042
6102
|
}) => {
|
|
6043
6103
|
const listRef = useRef10(null);
|
|
6104
|
+
const noItemsLabel = useMessage("outline-empty");
|
|
6044
6105
|
const virtualizer = useVirtualizer2({
|
|
6045
6106
|
count: tree.items.length,
|
|
6046
6107
|
estimateSize: (index) => getEstimatedRowHeight(tree.items[index].itemId),
|
|
@@ -6108,8 +6169,8 @@ var VirtualizedLayerTreeItems = ({
|
|
|
6108
6169
|
)
|
|
6109
6170
|
);
|
|
6110
6171
|
}
|
|
6111
|
-
return /* @__PURE__ */
|
|
6112
|
-
tree.items.length === 0 && /* @__PURE__ */ jsx37("div", { className: getClassName20("helper"), children:
|
|
6172
|
+
return /* @__PURE__ */ jsxs11("ul", { className: getClassName20(), ref: listRef, children: [
|
|
6173
|
+
tree.items.length === 0 && /* @__PURE__ */ jsx37("div", { className: getClassName20("helper"), children: noItemsLabel }),
|
|
6113
6174
|
renderedItems
|
|
6114
6175
|
] });
|
|
6115
6176
|
};
|
|
@@ -6153,6 +6214,7 @@ var Outline = () => {
|
|
|
6153
6214
|
var _a;
|
|
6154
6215
|
return ((_a = s.selectedItem) == null ? void 0 : _a.props.id) || null;
|
|
6155
6216
|
});
|
|
6217
|
+
const componentFallbackLabel = useMessage("label-component");
|
|
6156
6218
|
const rootZones = useAppStore(
|
|
6157
6219
|
useShallow7((s) => findZonesForArea(s.state, "root"))
|
|
6158
6220
|
);
|
|
@@ -6170,10 +6232,11 @@ var Outline = () => {
|
|
|
6170
6232
|
label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
|
|
6171
6233
|
nodes,
|
|
6172
6234
|
zoneCompound,
|
|
6173
|
-
zones
|
|
6235
|
+
zones,
|
|
6236
|
+
componentFallbackLabel
|
|
6174
6237
|
})
|
|
6175
6238
|
),
|
|
6176
|
-
[config, nodes, rootZones, zones]
|
|
6239
|
+
[config, nodes, rootZones, zones, componentFallbackLabel]
|
|
6177
6240
|
);
|
|
6178
6241
|
const Wrapper = useMemo15(() => outlineOverride || "div", [outlineOverride]);
|
|
6179
6242
|
return /* @__PURE__ */ jsx38(Wrapper, { children: /* @__PURE__ */ jsx38(
|
|
@@ -6193,12 +6256,15 @@ var styles_module_default15 = { "OutlinePlugin": "_OutlinePlugin_16k03_1" };
|
|
|
6193
6256
|
// plugins/outline/index.tsx
|
|
6194
6257
|
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
6195
6258
|
var getClassName21 = get_class_name_factory_default("OutlinePlugin", styles_module_default15);
|
|
6196
|
-
var outlinePlugin = () =>
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
})
|
|
6259
|
+
var outlinePlugin = (props = {}) => {
|
|
6260
|
+
var _a, _b;
|
|
6261
|
+
return {
|
|
6262
|
+
name: "outline",
|
|
6263
|
+
label: (_a = props.label) != null ? _a : "Outline",
|
|
6264
|
+
render: () => /* @__PURE__ */ jsx39("div", { className: getClassName21(), children: /* @__PURE__ */ jsx39(Outline, {}) }),
|
|
6265
|
+
icon: (_b = props.icon) != null ? _b : /* @__PURE__ */ jsx39(Layers, {})
|
|
6266
|
+
};
|
|
6267
|
+
};
|
|
6202
6268
|
|
|
6203
6269
|
// plugins/fields/index.tsx
|
|
6204
6270
|
init_react_import();
|
|
@@ -6224,13 +6290,15 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
6224
6290
|
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
|
6225
6291
|
});
|
|
6226
6292
|
const appStore = useAppStoreApi();
|
|
6293
|
+
const pageLabel = useMessage("label-page");
|
|
6294
|
+
const componentLabel = useMessage("label-component");
|
|
6227
6295
|
return useMemo16(() => {
|
|
6228
6296
|
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
|
6229
6297
|
var _a, _b, _c, _d;
|
|
6230
6298
|
const [componentId] = zoneCompound.split(":");
|
|
6231
6299
|
if (componentId === "root") {
|
|
6232
6300
|
return {
|
|
6233
|
-
label: ((_a = config == null ? void 0 : config.root) == null ? void 0 : _a.label) ||
|
|
6301
|
+
label: ((_a = config == null ? void 0 : config.root) == null ? void 0 : _a.label) || pageLabel,
|
|
6234
6302
|
selector: null
|
|
6235
6303
|
};
|
|
6236
6304
|
}
|
|
@@ -6238,7 +6306,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
6238
6306
|
const parentId = node.path[node.path.length - 1];
|
|
6239
6307
|
const contentIds = ((_b = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _b.contentIds) || [];
|
|
6240
6308
|
const index = contentIds.indexOf(componentId);
|
|
6241
|
-
const label = node ? (_d = (_c = config.components[node.data.type]) == null ? void 0 : _c.label) != null ? _d : node.data.type :
|
|
6309
|
+
const label = node ? (_d = (_c = config.components[node.data.type]) == null ? void 0 : _c.label) != null ? _d : node.data.type : componentLabel;
|
|
6242
6310
|
return {
|
|
6243
6311
|
label,
|
|
6244
6312
|
selector: node ? {
|
|
@@ -6251,11 +6319,11 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
6251
6319
|
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
|
6252
6320
|
}
|
|
6253
6321
|
return breadcrumbs;
|
|
6254
|
-
}, [path, renderCount]);
|
|
6322
|
+
}, [path, renderCount, pageLabel, componentLabel]);
|
|
6255
6323
|
};
|
|
6256
6324
|
|
|
6257
6325
|
// components/Breadcrumbs/index.tsx
|
|
6258
|
-
import { jsx as jsx40, jsxs as
|
|
6326
|
+
import { jsx as jsx40, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
6259
6327
|
var getClassName22 = get_class_name_factory_default("Breadcrumbs", styles_module_default16);
|
|
6260
6328
|
var Breadcrumbs = ({
|
|
6261
6329
|
children,
|
|
@@ -6263,8 +6331,8 @@ var Breadcrumbs = ({
|
|
|
6263
6331
|
}) => {
|
|
6264
6332
|
const setUi = useAppStore((s) => s.setUi);
|
|
6265
6333
|
const breadcrumbs = useBreadcrumbs(numParents);
|
|
6266
|
-
return /* @__PURE__ */
|
|
6267
|
-
breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */
|
|
6334
|
+
return /* @__PURE__ */ jsxs12("div", { className: getClassName22(), children: [
|
|
6335
|
+
breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs12("div", { className: getClassName22("breadcrumb"), children: [
|
|
6268
6336
|
/* @__PURE__ */ jsx40(
|
|
6269
6337
|
"button",
|
|
6270
6338
|
{
|
|
@@ -6296,7 +6364,7 @@ import {
|
|
|
6296
6364
|
useMemo as useMemo17
|
|
6297
6365
|
} from "react";
|
|
6298
6366
|
import { useShallow as useShallow8 } from "zustand/react/shallow";
|
|
6299
|
-
import { Fragment as Fragment11, jsx as jsx41, jsxs as
|
|
6367
|
+
import { Fragment as Fragment11, jsx as jsx41, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6300
6368
|
var getClassName23 = get_class_name_factory_default("PuckFields", styles_module_default17);
|
|
6301
6369
|
var DefaultFields = ({
|
|
6302
6370
|
children
|
|
@@ -6427,7 +6495,7 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
6427
6495
|
);
|
|
6428
6496
|
const isLoading = fieldsLoading || componentResolving;
|
|
6429
6497
|
const Wrapper = useMemo17(() => overrides.fields || DefaultFields, [overrides]);
|
|
6430
|
-
return /* @__PURE__ */
|
|
6498
|
+
return /* @__PURE__ */ jsxs13(
|
|
6431
6499
|
"form",
|
|
6432
6500
|
{
|
|
6433
6501
|
className: getClassName23({ wrapFields }),
|
|
@@ -6448,24 +6516,25 @@ init_react_import();
|
|
|
6448
6516
|
var styles_module_default18 = { "FieldsPlugin": "_FieldsPlugin_18cj3_1", "FieldsPlugin-header": "_FieldsPlugin-header_18cj3_7" };
|
|
6449
6517
|
|
|
6450
6518
|
// plugins/fields/index.tsx
|
|
6451
|
-
import { jsx as jsx42, jsxs as
|
|
6519
|
+
import { jsx as jsx42, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
6452
6520
|
var getClassName24 = get_class_name_factory_default("FieldsPlugin", styles_module_default18);
|
|
6453
6521
|
var CurrentTitle = () => {
|
|
6522
|
+
const pageLabel = useMessage("label-page");
|
|
6454
6523
|
const label = useAppStore((s) => {
|
|
6455
6524
|
var _a, _b;
|
|
6456
6525
|
const selectedItem = s.selectedItem;
|
|
6457
|
-
return selectedItem ? (_b = (_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.label) != null ? _b : selectedItem.type :
|
|
6526
|
+
return selectedItem ? (_b = (_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.label) != null ? _b : selectedItem.type : null;
|
|
6458
6527
|
});
|
|
6459
|
-
return label;
|
|
6528
|
+
return label != null ? label : pageLabel;
|
|
6460
6529
|
};
|
|
6461
|
-
var fieldsPlugin = ({ desktopSideBar = "right" } = {}) => ({
|
|
6530
|
+
var fieldsPlugin = ({ desktopSideBar = "right", label, icon } = {}) => ({
|
|
6462
6531
|
name: "fields",
|
|
6463
|
-
label: "Fields",
|
|
6464
|
-
render: () => /* @__PURE__ */
|
|
6532
|
+
label: label != null ? label : "Fields",
|
|
6533
|
+
render: () => /* @__PURE__ */ jsxs14("div", { className: getClassName24(), children: [
|
|
6465
6534
|
/* @__PURE__ */ jsx42("div", { className: getClassName24("header"), children: /* @__PURE__ */ jsx42(Breadcrumbs, { numParents: 2, children: /* @__PURE__ */ jsx42(CurrentTitle, {}) }) }),
|
|
6466
6535
|
/* @__PURE__ */ jsx42(Fields, {})
|
|
6467
6536
|
] }),
|
|
6468
|
-
icon: /* @__PURE__ */ jsx42(RectangleEllipsis, {}),
|
|
6537
|
+
icon: icon != null ? icon : /* @__PURE__ */ jsx42(RectangleEllipsis, {}),
|
|
6469
6538
|
mobileOnly: desktopSideBar === "right"
|
|
6470
6539
|
});
|
|
6471
6540
|
|
|
@@ -9980,7 +10049,7 @@ init_react_import();
|
|
|
9980
10049
|
var styles_module_default21 = { "MenuBar": "_MenuBar_1hxnj_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_1hxnj_14", "MenuBar-inner": "_MenuBar-inner_1hxnj_29", "MenuBar-history": "_MenuBar-history_1hxnj_45" };
|
|
9981
10050
|
|
|
9982
10051
|
// components/MenuBar/index.tsx
|
|
9983
|
-
import { Fragment as Fragment15, jsx as jsx46, jsxs as
|
|
10052
|
+
import { Fragment as Fragment15, jsx as jsx46, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
9984
10053
|
var getClassName26 = get_class_name_factory_default("MenuBar", styles_module_default21);
|
|
9985
10054
|
function MenuBar({
|
|
9986
10055
|
menuOpen = false,
|
|
@@ -9991,6 +10060,8 @@ function MenuBar({
|
|
|
9991
10060
|
const forward = useAppStore((s) => s.history.forward);
|
|
9992
10061
|
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
|
9993
10062
|
const hasPast = useAppStore((s) => s.history.hasPast());
|
|
10063
|
+
const undoLabel = useMessage("header-undo");
|
|
10064
|
+
const redoLabel = useMessage("header-redo");
|
|
9994
10065
|
return /* @__PURE__ */ jsx46(
|
|
9995
10066
|
"div",
|
|
9996
10067
|
{
|
|
@@ -10005,13 +10076,13 @@ function MenuBar({
|
|
|
10005
10076
|
setMenuOpen(false);
|
|
10006
10077
|
}
|
|
10007
10078
|
},
|
|
10008
|
-
children: /* @__PURE__ */
|
|
10009
|
-
/* @__PURE__ */
|
|
10079
|
+
children: /* @__PURE__ */ jsxs15("div", { className: getClassName26("inner"), children: [
|
|
10080
|
+
/* @__PURE__ */ jsxs15("div", { className: getClassName26("history"), children: [
|
|
10010
10081
|
/* @__PURE__ */ jsx46(
|
|
10011
10082
|
IconButton,
|
|
10012
10083
|
{
|
|
10013
10084
|
type: "button",
|
|
10014
|
-
title:
|
|
10085
|
+
title: undoLabel,
|
|
10015
10086
|
disabled: !hasPast,
|
|
10016
10087
|
onClick: back,
|
|
10017
10088
|
children: /* @__PURE__ */ jsx46(Undo2, { size: 21 })
|
|
@@ -10021,7 +10092,7 @@ function MenuBar({
|
|
|
10021
10092
|
IconButton,
|
|
10022
10093
|
{
|
|
10023
10094
|
type: "button",
|
|
10024
|
-
title:
|
|
10095
|
+
title: redoLabel,
|
|
10025
10096
|
disabled: !hasFuture,
|
|
10026
10097
|
onClick: forward,
|
|
10027
10098
|
children: /* @__PURE__ */ jsx46(Redo2, { size: 21 })
|
|
@@ -10039,7 +10110,7 @@ init_react_import();
|
|
|
10039
10110
|
var styles_module_default22 = { "PuckHeader": "_PuckHeader_c2nei_1", "PuckHeader--hidePlugins": "_PuckHeader--hidePlugins_c2nei_21", "PuckHeader-inner": "_PuckHeader-inner_c2nei_26", "PuckHeader-toggle": "_PuckHeader-toggle_c2nei_46", "PuckHeader-rightSideBarToggle": "_PuckHeader-rightSideBarToggle_c2nei_52", "PuckHeader-leftSideBarToggle": "_PuckHeader-leftSideBarToggle_c2nei_53", "PuckHeader-title": "_PuckHeader-title_c2nei_64", "PuckHeader-path": "_PuckHeader-path_c2nei_68", "PuckHeader-tools": "_PuckHeader-tools_c2nei_75", "PuckHeader-menuButton": "_PuckHeader-menuButton_c2nei_81", "PuckHeader--menuOpen": "_PuckHeader--menuOpen_c2nei_86" };
|
|
10040
10111
|
|
|
10041
10112
|
// components/Puck/components/Header/index.tsx
|
|
10042
|
-
import { Fragment as Fragment16, jsx as jsx47, jsxs as
|
|
10113
|
+
import { Fragment as Fragment16, jsx as jsx47, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
10043
10114
|
var getClassName27 = get_class_name_factory_default("PuckHeader", styles_module_default22);
|
|
10044
10115
|
var HeaderInner = ({
|
|
10045
10116
|
hidePlugins
|
|
@@ -10113,6 +10184,11 @@ var HeaderInner = ({
|
|
|
10113
10184
|
},
|
|
10114
10185
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
|
10115
10186
|
);
|
|
10187
|
+
const publishLabel = useMessage("header-publish");
|
|
10188
|
+
const pageLabel = useMessage("label-page");
|
|
10189
|
+
const toggleLeftLabel = useMessage("header-toggle-leftsidebar");
|
|
10190
|
+
const toggleRightLabel = useMessage("header-toggle-rightsidebar");
|
|
10191
|
+
const toggleMenuLabel = useMessage("header-toggle-menubar");
|
|
10116
10192
|
return /* @__PURE__ */ jsx47(
|
|
10117
10193
|
CustomHeader,
|
|
10118
10194
|
{
|
|
@@ -10124,7 +10200,7 @@ var HeaderInner = ({
|
|
|
10124
10200
|
onPublish && onPublish(data);
|
|
10125
10201
|
},
|
|
10126
10202
|
icon: /* @__PURE__ */ jsx47(Globe, { size: "14px" }),
|
|
10127
|
-
children:
|
|
10203
|
+
children: publishLabel
|
|
10128
10204
|
}
|
|
10129
10205
|
) }) }),
|
|
10130
10206
|
children: /* @__PURE__ */ jsx47(
|
|
@@ -10135,8 +10211,8 @@ var HeaderInner = ({
|
|
|
10135
10211
|
rightSideBarVisible,
|
|
10136
10212
|
hidePlugins
|
|
10137
10213
|
}),
|
|
10138
|
-
children: /* @__PURE__ */
|
|
10139
|
-
/* @__PURE__ */
|
|
10214
|
+
children: /* @__PURE__ */ jsxs16("div", { className: getClassName27("inner"), children: [
|
|
10215
|
+
/* @__PURE__ */ jsxs16("div", { className: getClassName27("toggle"), children: [
|
|
10140
10216
|
/* @__PURE__ */ jsx47("div", { className: getClassName27("leftSideBarToggle"), children: /* @__PURE__ */ jsx47(
|
|
10141
10217
|
IconButton,
|
|
10142
10218
|
{
|
|
@@ -10144,7 +10220,7 @@ var HeaderInner = ({
|
|
|
10144
10220
|
onClick: () => {
|
|
10145
10221
|
toggleSidebars("left");
|
|
10146
10222
|
},
|
|
10147
|
-
title:
|
|
10223
|
+
title: toggleLeftLabel,
|
|
10148
10224
|
children: /* @__PURE__ */ jsx47(PanelLeft, { focusable: "false" })
|
|
10149
10225
|
}
|
|
10150
10226
|
) }),
|
|
@@ -10155,19 +10231,19 @@ var HeaderInner = ({
|
|
|
10155
10231
|
onClick: () => {
|
|
10156
10232
|
toggleSidebars("right");
|
|
10157
10233
|
},
|
|
10158
|
-
title:
|
|
10234
|
+
title: toggleRightLabel,
|
|
10159
10235
|
children: /* @__PURE__ */ jsx47(PanelRight, { focusable: "false" })
|
|
10160
10236
|
}
|
|
10161
10237
|
) })
|
|
10162
10238
|
] }),
|
|
10163
|
-
/* @__PURE__ */ jsx47("div", { className: getClassName27("title"), children: /* @__PURE__ */
|
|
10164
|
-
headerTitle || rootTitle ||
|
|
10165
|
-
headerPath && /* @__PURE__ */
|
|
10239
|
+
/* @__PURE__ */ jsx47("div", { className: getClassName27("title"), children: /* @__PURE__ */ jsxs16(Heading, { rank: "2", size: "xs", children: [
|
|
10240
|
+
headerTitle || rootTitle || pageLabel,
|
|
10241
|
+
headerPath && /* @__PURE__ */ jsxs16(Fragment16, { children: [
|
|
10166
10242
|
" ",
|
|
10167
10243
|
/* @__PURE__ */ jsx47("code", { className: getClassName27("path"), children: headerPath })
|
|
10168
10244
|
] })
|
|
10169
10245
|
] }) }),
|
|
10170
|
-
/* @__PURE__ */
|
|
10246
|
+
/* @__PURE__ */ jsxs16("div", { className: getClassName27("tools"), children: [
|
|
10171
10247
|
/* @__PURE__ */ jsx47("div", { className: getClassName27("menuButton"), children: /* @__PURE__ */ jsx47(
|
|
10172
10248
|
IconButton,
|
|
10173
10249
|
{
|
|
@@ -10175,7 +10251,7 @@ var HeaderInner = ({
|
|
|
10175
10251
|
onClick: () => {
|
|
10176
10252
|
return setMenuOpen(!menuOpen);
|
|
10177
10253
|
},
|
|
10178
|
-
title:
|
|
10254
|
+
title: toggleMenuLabel,
|
|
10179
10255
|
children: menuOpen ? /* @__PURE__ */ jsx47(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx47(ChevronDown, { focusable: "false" })
|
|
10180
10256
|
}
|
|
10181
10257
|
) }),
|
|
@@ -10193,7 +10269,7 @@ var HeaderInner = ({
|
|
|
10193
10269
|
onPublish && onPublish(data);
|
|
10194
10270
|
},
|
|
10195
10271
|
icon: /* @__PURE__ */ jsx47(Globe, { size: "14px" }),
|
|
10196
|
-
children:
|
|
10272
|
+
children: publishLabel
|
|
10197
10273
|
}
|
|
10198
10274
|
) }),
|
|
10199
10275
|
setMenuOpen
|
|
@@ -10216,7 +10292,7 @@ init_react_import();
|
|
|
10216
10292
|
var styles_module_default23 = { "SidebarSection": "_SidebarSection_1uv88_1", "SidebarSection-title": "_SidebarSection-title_1uv88_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_1uv88_20", "SidebarSection-content": "_SidebarSection-content_1uv88_24", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_1uv88_33", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_1uv88_62", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_1uv88_33", "SidebarSection-heading": "_SidebarSection-heading_1uv88_74", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_1uv88_78" };
|
|
10217
10293
|
|
|
10218
10294
|
// components/SidebarSection/index.tsx
|
|
10219
|
-
import { jsx as jsx48, jsxs as
|
|
10295
|
+
import { jsx as jsx48, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
10220
10296
|
var getClassName28 = get_class_name_factory_default("SidebarSection", styles_module_default23);
|
|
10221
10297
|
var SidebarSection = ({
|
|
10222
10298
|
children,
|
|
@@ -10226,8 +10302,8 @@ var SidebarSection = ({
|
|
|
10226
10302
|
noBorderTop,
|
|
10227
10303
|
isLoading
|
|
10228
10304
|
}) => {
|
|
10229
|
-
return /* @__PURE__ */
|
|
10230
|
-
/* @__PURE__ */ jsx48("div", { className: getClassName28("title"), children: /* @__PURE__ */
|
|
10305
|
+
return /* @__PURE__ */ jsxs17("div", { className: getClassName28({ noBorderTop }), style: { background }, children: [
|
|
10306
|
+
/* @__PURE__ */ jsx48("div", { className: getClassName28("title"), children: /* @__PURE__ */ jsxs17("div", { className: getClassName28("breadcrumbs"), children: [
|
|
10231
10307
|
showBreadcrumbs && /* @__PURE__ */ jsx48(Breadcrumbs, {}),
|
|
10232
10308
|
/* @__PURE__ */ jsx48("div", { className: getClassName28("heading"), children: /* @__PURE__ */ jsx48(Heading, { rank: "2", size: "xs", children: title }) })
|
|
10233
10309
|
] }) }),
|
|
@@ -10255,7 +10331,7 @@ init_react_import();
|
|
|
10255
10331
|
var styles_module_default24 = { "ViewportControls": "_ViewportControls_v26yb_1", "ViewportControls--fullScreen": "_ViewportControls--fullScreen_v26yb_5", "ViewportControls-toggleButton": "_ViewportControls-toggleButton_v26yb_14", "ViewportControls-actions": "_ViewportControls-actions_v26yb_39", "ViewportControls-actionsInner": "_ViewportControls-actionsInner_v26yb_43", "ViewportControls--isExpanded": "_ViewportControls--isExpanded_v26yb_67", "ViewportControls-divider": "_ViewportControls-divider_v26yb_72", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_v26yb_79", "ViewportControls-zoom": "_ViewportControls-zoom_v26yb_79", "ViewportButton-inner": "_ViewportButton-inner_v26yb_110", "ViewportButton--isActive": "_ViewportButton--isActive_v26yb_118" };
|
|
10256
10332
|
|
|
10257
10333
|
// components/ViewportControls/index.tsx
|
|
10258
|
-
import { jsx as jsx49, jsxs as
|
|
10334
|
+
import { jsx as jsx49, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
10259
10335
|
var icons = {
|
|
10260
10336
|
Smartphone: /* @__PURE__ */ jsx49(Smartphone, { size: 16 }),
|
|
10261
10337
|
Tablet: /* @__PURE__ */ jsx49(Tablet, { size: 16 }),
|
|
@@ -10292,6 +10368,26 @@ var defaultZoomOptions = [
|
|
|
10292
10368
|
{ label: "150%", value: 1.5 },
|
|
10293
10369
|
{ label: "200%", value: 2 }
|
|
10294
10370
|
];
|
|
10371
|
+
var ViewportButton = ({
|
|
10372
|
+
viewport,
|
|
10373
|
+
isActive,
|
|
10374
|
+
onClick
|
|
10375
|
+
}) => {
|
|
10376
|
+
var _a;
|
|
10377
|
+
const switchTitle = useMessage("viewport-switch", {
|
|
10378
|
+
label: (_a = viewport.label) != null ? _a : ""
|
|
10379
|
+
});
|
|
10380
|
+
const switchDefaultTitle = useMessage("viewport-switch-default");
|
|
10381
|
+
return /* @__PURE__ */ jsx49(
|
|
10382
|
+
ActionButton,
|
|
10383
|
+
{
|
|
10384
|
+
title: viewport.label ? switchTitle : switchDefaultTitle,
|
|
10385
|
+
onClick,
|
|
10386
|
+
isActive,
|
|
10387
|
+
children: typeof viewport.icon === "string" ? icons[viewport.icon] || viewport.icon : viewport.icon || icons.Smartphone
|
|
10388
|
+
}
|
|
10389
|
+
);
|
|
10390
|
+
};
|
|
10295
10391
|
var ViewportControls = ({
|
|
10296
10392
|
autoZoom,
|
|
10297
10393
|
zoom,
|
|
@@ -10305,17 +10401,20 @@ var ViewportControls = ({
|
|
|
10305
10401
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
|
10306
10402
|
(option) => option.value === autoZoom
|
|
10307
10403
|
);
|
|
10404
|
+
const autoZoomLabel = useMessage("viewport-zoom-auto", {
|
|
10405
|
+
zoom: (autoZoom * 100).toFixed(0)
|
|
10406
|
+
});
|
|
10308
10407
|
const zoomOptions = useMemo21(
|
|
10309
10408
|
() => [
|
|
10310
10409
|
...defaultZoomOptions,
|
|
10311
10410
|
...defaultsContainAutoZoom ? [] : [
|
|
10312
10411
|
{
|
|
10313
10412
|
value: autoZoom,
|
|
10314
|
-
label:
|
|
10413
|
+
label: autoZoomLabel
|
|
10315
10414
|
}
|
|
10316
10415
|
]
|
|
10317
10416
|
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
|
10318
|
-
[autoZoom]
|
|
10417
|
+
[autoZoom, autoZoomLabel]
|
|
10319
10418
|
);
|
|
10320
10419
|
const [activeViewport, setActiveViewport] = useState20(
|
|
10321
10420
|
uiViewports.current.width
|
|
@@ -10324,23 +10423,25 @@ var ViewportControls = ({
|
|
|
10324
10423
|
setActiveViewport(uiViewports.current.width);
|
|
10325
10424
|
}, [uiViewports.current]);
|
|
10326
10425
|
const [isExpanded, setIsExpanded] = useState20(false);
|
|
10327
|
-
|
|
10426
|
+
const zoomOutLabel = useMessage("viewport-zoom-out");
|
|
10427
|
+
const zoomInLabel = useMessage("viewport-zoom-in");
|
|
10428
|
+
const toggleMenuLabel = useMessage("viewport-toggle-menu");
|
|
10429
|
+
return /* @__PURE__ */ jsxs18(
|
|
10328
10430
|
"div",
|
|
10329
10431
|
{
|
|
10330
10432
|
className: getClassName29({ isExpanded, fullScreen }),
|
|
10331
10433
|
suppressHydrationWarning: true,
|
|
10332
10434
|
children: [
|
|
10333
|
-
/* @__PURE__ */ jsx49("div", { className: getClassName29("actions"), children: /* @__PURE__ */
|
|
10435
|
+
/* @__PURE__ */ jsx49("div", { className: getClassName29("actions"), children: /* @__PURE__ */ jsxs18("div", { className: getClassName29("actionsInner"), children: [
|
|
10334
10436
|
viewports.map((viewport, i) => /* @__PURE__ */ jsx49(
|
|
10335
|
-
|
|
10437
|
+
ViewportButton,
|
|
10336
10438
|
{
|
|
10337
|
-
|
|
10439
|
+
viewport,
|
|
10338
10440
|
onClick: () => {
|
|
10339
10441
|
setActiveViewport(viewport.width);
|
|
10340
10442
|
onViewportChange(viewport);
|
|
10341
10443
|
},
|
|
10342
|
-
isActive: activeViewport === viewport.width
|
|
10343
|
-
children: typeof viewport.icon === "string" ? icons[viewport.icon] || viewport.icon : viewport.icon || icons.Smartphone
|
|
10444
|
+
isActive: activeViewport === viewport.width
|
|
10344
10445
|
},
|
|
10345
10446
|
i
|
|
10346
10447
|
)),
|
|
@@ -10348,7 +10449,7 @@ var ViewportControls = ({
|
|
|
10348
10449
|
/* @__PURE__ */ jsx49(
|
|
10349
10450
|
ActionButton,
|
|
10350
10451
|
{
|
|
10351
|
-
title:
|
|
10452
|
+
title: zoomOutLabel,
|
|
10352
10453
|
disabled: zoom <= ((_a = zoomOptions[0]) == null ? void 0 : _a.value),
|
|
10353
10454
|
onClick: (e) => {
|
|
10354
10455
|
e.stopPropagation();
|
|
@@ -10365,7 +10466,7 @@ var ViewportControls = ({
|
|
|
10365
10466
|
/* @__PURE__ */ jsx49(
|
|
10366
10467
|
ActionButton,
|
|
10367
10468
|
{
|
|
10368
|
-
title:
|
|
10469
|
+
title: zoomInLabel,
|
|
10369
10470
|
disabled: zoom >= ((_b = zoomOptions[zoomOptions.length - 1]) == null ? void 0 : _b.value),
|
|
10370
10471
|
onClick: (e) => {
|
|
10371
10472
|
e.stopPropagation();
|
|
@@ -10379,7 +10480,7 @@ var ViewportControls = ({
|
|
|
10379
10480
|
children: /* @__PURE__ */ jsx49(ZoomIn, { size: 16 })
|
|
10380
10481
|
}
|
|
10381
10482
|
),
|
|
10382
|
-
/* @__PURE__ */
|
|
10483
|
+
/* @__PURE__ */ jsxs18("div", { className: getClassName29("zoom"), children: [
|
|
10383
10484
|
/* @__PURE__ */ jsx49("div", { className: getClassName29("divider") }),
|
|
10384
10485
|
/* @__PURE__ */ jsx49(
|
|
10385
10486
|
"select",
|
|
@@ -10408,7 +10509,7 @@ var ViewportControls = ({
|
|
|
10408
10509
|
"button",
|
|
10409
10510
|
{
|
|
10410
10511
|
className: getClassName29("toggleButton"),
|
|
10411
|
-
title:
|
|
10512
|
+
title: toggleMenuLabel,
|
|
10412
10513
|
onClick: () => setIsExpanded((s) => !s),
|
|
10413
10514
|
children: isExpanded ? /* @__PURE__ */ jsx49(X, { size: 16 }) : /* @__PURE__ */ jsx49(Monitor, { size: 16 })
|
|
10414
10515
|
}
|
|
@@ -10456,7 +10557,7 @@ var useCanvasFrame = () => {
|
|
|
10456
10557
|
};
|
|
10457
10558
|
|
|
10458
10559
|
// components/Puck/components/Canvas/index.tsx
|
|
10459
|
-
import { Fragment as Fragment17, jsx as jsx51, jsxs as
|
|
10560
|
+
import { Fragment as Fragment17, jsx as jsx51, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
10460
10561
|
var getClassName30 = get_class_name_factory_default("PuckCanvas", styles_module_default25);
|
|
10461
10562
|
var ZOOM_ON_CHANGE = true;
|
|
10462
10563
|
var TRANSITION_DURATION = 150;
|
|
@@ -10612,7 +10713,7 @@ var Canvas = () => {
|
|
|
10612
10713
|
appStoreApi,
|
|
10613
10714
|
(_a = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _a.current
|
|
10614
10715
|
]);
|
|
10615
|
-
return /* @__PURE__ */
|
|
10716
|
+
return /* @__PURE__ */ jsxs19(
|
|
10616
10717
|
"div",
|
|
10617
10718
|
{
|
|
10618
10719
|
className: getClassName30({
|
|
@@ -10661,7 +10762,7 @@ var Canvas = () => {
|
|
|
10661
10762
|
}
|
|
10662
10763
|
}
|
|
10663
10764
|
) }),
|
|
10664
|
-
/* @__PURE__ */
|
|
10765
|
+
/* @__PURE__ */ jsxs19("div", { className: getClassName30("inner"), ref: frameRef, children: [
|
|
10665
10766
|
/* @__PURE__ */ jsx51(
|
|
10666
10767
|
"div",
|
|
10667
10768
|
{
|
|
@@ -10856,7 +10957,7 @@ init_react_import();
|
|
|
10856
10957
|
var styles_module_default27 = { "Sidebar": "_Sidebar_16oed_1", "Sidebar--isVisible": "_Sidebar--isVisible_16oed_10", "Sidebar--left": "_Sidebar--left_16oed_14", "Sidebar--right": "_Sidebar--right_16oed_34", "Sidebar-resizeHandle": "_Sidebar-resizeHandle_16oed_51" };
|
|
10857
10958
|
|
|
10858
10959
|
// components/Puck/components/Sidebar/index.tsx
|
|
10859
|
-
import { Fragment as Fragment18, jsx as jsx53, jsxs as
|
|
10960
|
+
import { Fragment as Fragment18, jsx as jsx53, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
10860
10961
|
var getClassName32 = get_class_name_factory_default("Sidebar", styles_module_default27);
|
|
10861
10962
|
var Sidebar = ({
|
|
10862
10963
|
position,
|
|
@@ -10866,7 +10967,7 @@ var Sidebar = ({
|
|
|
10866
10967
|
onResizeEnd,
|
|
10867
10968
|
children
|
|
10868
10969
|
}) => {
|
|
10869
|
-
return /* @__PURE__ */
|
|
10970
|
+
return /* @__PURE__ */ jsxs20(Fragment18, { children: [
|
|
10870
10971
|
/* @__PURE__ */ jsx53(
|
|
10871
10972
|
"div",
|
|
10872
10973
|
{
|
|
@@ -10956,7 +11057,7 @@ init_react_import();
|
|
|
10956
11057
|
var styles_module_default28 = { "Nav": "_Nav_vll2r_1", "Nav-list": "_Nav-list_vll2r_5", "Nav-mobileActions": "_Nav-mobileActions_vll2r_23", "NavItem-link": "_NavItem-link_vll2r_39", "NavItem": "_NavItem_vll2r_39", "NavItem-linkIcon": "_NavItem-linkIcon_vll2r_90", "NavItem--active": "_NavItem--active_vll2r_100", "NavItem--mobileOnly": "_NavItem--mobileOnly_vll2r_136", "NavItem--desktopOnly": "_NavItem--desktopOnly_vll2r_141" };
|
|
10957
11058
|
|
|
10958
11059
|
// components/Puck/components/Nav/index.tsx
|
|
10959
|
-
import { jsx as jsx54, jsxs as
|
|
11060
|
+
import { jsx as jsx54, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
10960
11061
|
var getClassName33 = get_class_name_factory_default("Nav", styles_module_default28);
|
|
10961
11062
|
var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default28);
|
|
10962
11063
|
var MenuItem = ({
|
|
@@ -10975,7 +11076,7 @@ var MenuItem = ({
|
|
|
10975
11076
|
mobileOnly,
|
|
10976
11077
|
desktopOnly
|
|
10977
11078
|
}),
|
|
10978
|
-
children: onClick && /* @__PURE__ */
|
|
11079
|
+
children: onClick && /* @__PURE__ */ jsxs21("div", { className: getClassNameItem3("link"), onClick, children: [
|
|
10979
11080
|
icon && /* @__PURE__ */ jsx54("span", { className: getClassNameItem3("linkIcon"), children: icon }),
|
|
10980
11081
|
/* @__PURE__ */ jsx54("span", { className: getClassNameItem3("linkLabel"), children: label })
|
|
10981
11082
|
] })
|
|
@@ -10986,7 +11087,7 @@ var Nav = ({
|
|
|
10986
11087
|
items,
|
|
10987
11088
|
mobileActions
|
|
10988
11089
|
}) => {
|
|
10989
|
-
return /* @__PURE__ */
|
|
11090
|
+
return /* @__PURE__ */ jsxs21("nav", { className: getClassName33(), children: [
|
|
10990
11091
|
/* @__PURE__ */ jsx54("ul", { className: getClassName33("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx54(MenuItem, __spreadValues({}, item), key)) }),
|
|
10991
11092
|
mobileActions && /* @__PURE__ */ jsx54("div", { className: getClassName33("mobileActions"), children: mobileActions })
|
|
10992
11093
|
] });
|
|
@@ -11001,19 +11102,20 @@ var normalizeIframeConfig = (iframe) => __spreadValues({
|
|
|
11001
11102
|
}, iframe);
|
|
11002
11103
|
|
|
11003
11104
|
// components/Puck/components/Layout/index.tsx
|
|
11004
|
-
import { jsx as jsx55, jsxs as
|
|
11105
|
+
import { jsx as jsx55, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
11005
11106
|
var getClassName34 = get_class_name_factory_default("Puck", styles_module_default20);
|
|
11006
11107
|
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default20);
|
|
11007
11108
|
var getPluginTabClassName = get_class_name_factory_default("PuckPluginTab", styles_module_default20);
|
|
11008
11109
|
var useBrowserLayoutEffect = typeof window === "undefined" ? useEffect28 : useLayoutEffect2;
|
|
11009
11110
|
var FieldSideBar = () => {
|
|
11111
|
+
const pageLabel = useMessage("label-page");
|
|
11010
11112
|
const title = useAppStore(
|
|
11011
11113
|
(s) => {
|
|
11012
11114
|
var _a, _b, _c;
|
|
11013
|
-
return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : (
|
|
11115
|
+
return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : (_c = s.config.root) == null ? void 0 : _c.label;
|
|
11014
11116
|
}
|
|
11015
11117
|
);
|
|
11016
|
-
return /* @__PURE__ */ jsx55(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx55(Fields, {}) });
|
|
11118
|
+
return /* @__PURE__ */ jsx55(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title: title || pageLabel, children: /* @__PURE__ */ jsx55(Fields, {}) });
|
|
11017
11119
|
};
|
|
11018
11120
|
var PluginTab = ({
|
|
11019
11121
|
children,
|
|
@@ -11115,16 +11217,22 @@ var Layout = ({ children }) => {
|
|
|
11115
11217
|
() => !!(plugins == null ? void 0 : plugins.find((p) => p.name === "legacy-side-bar")),
|
|
11116
11218
|
[plugins]
|
|
11117
11219
|
);
|
|
11220
|
+
const blocksLabel = useMessage("plugin-blocks");
|
|
11221
|
+
const outlineLabel = useMessage("plugin-outline");
|
|
11222
|
+
const fieldsLabel = useMessage("plugin-fields");
|
|
11118
11223
|
const pluginItems = useMemo24(() => {
|
|
11119
11224
|
const details = {};
|
|
11120
|
-
const defaultPlugins = [
|
|
11225
|
+
const defaultPlugins = [
|
|
11226
|
+
blocksPlugin({ label: blocksLabel }),
|
|
11227
|
+
outlinePlugin({ label: outlineLabel })
|
|
11228
|
+
];
|
|
11121
11229
|
const isLegacy = (plugin) => plugin.name === "legacy-side-bar" ? -1 : 0;
|
|
11122
11230
|
const combinedPlugins = [
|
|
11123
11231
|
...defaultPlugins,
|
|
11124
11232
|
...plugins != null ? plugins : []
|
|
11125
11233
|
].sort((a, b) => isLegacy(a) - isLegacy(b));
|
|
11126
11234
|
if (!(plugins == null ? void 0 : plugins.some((p) => p.name === "fields"))) {
|
|
11127
|
-
combinedPlugins.push(fieldsPlugin());
|
|
11235
|
+
combinedPlugins.push(fieldsPlugin({ label: fieldsLabel }));
|
|
11128
11236
|
}
|
|
11129
11237
|
combinedPlugins == null ? void 0 : combinedPlugins.forEach((plugin) => {
|
|
11130
11238
|
var _a, _b;
|
|
@@ -11161,7 +11269,15 @@ var Layout = ({ children }) => {
|
|
|
11161
11269
|
}
|
|
11162
11270
|
});
|
|
11163
11271
|
return details;
|
|
11164
|
-
}, [
|
|
11272
|
+
}, [
|
|
11273
|
+
plugins,
|
|
11274
|
+
currentPlugin,
|
|
11275
|
+
appStoreApi,
|
|
11276
|
+
leftSideBarVisible,
|
|
11277
|
+
blocksLabel,
|
|
11278
|
+
outlineLabel,
|
|
11279
|
+
fieldsLabel
|
|
11280
|
+
]);
|
|
11165
11281
|
useEffect28(() => {
|
|
11166
11282
|
if (!currentPlugin) {
|
|
11167
11283
|
const names = Object.keys(pluginItems);
|
|
@@ -11175,7 +11291,9 @@ var Layout = ({ children }) => {
|
|
|
11175
11291
|
return (_a = s.state.ui.mobilePanelExpanded) != null ? _a : false;
|
|
11176
11292
|
}
|
|
11177
11293
|
);
|
|
11178
|
-
|
|
11294
|
+
const maximizeLabel = useMessage("layout-maximize");
|
|
11295
|
+
const minimizeLabel = useMessage("layout-minimize");
|
|
11296
|
+
return /* @__PURE__ */ jsxs22(
|
|
11179
11297
|
"div",
|
|
11180
11298
|
{
|
|
11181
11299
|
className: `Puck ${getClassName34({
|
|
@@ -11196,7 +11314,7 @@ var Layout = ({ children }) => {
|
|
|
11196
11314
|
mobilePanelHeightMinContent: mobilePanelHeightMode === "min-content"
|
|
11197
11315
|
}),
|
|
11198
11316
|
style: { height },
|
|
11199
|
-
children: /* @__PURE__ */
|
|
11317
|
+
children: /* @__PURE__ */ jsxs22(
|
|
11200
11318
|
"div",
|
|
11201
11319
|
{
|
|
11202
11320
|
className: getLayoutClassName("inner"),
|
|
@@ -11211,7 +11329,7 @@ var Layout = ({ children }) => {
|
|
|
11211
11329
|
IconButton,
|
|
11212
11330
|
{
|
|
11213
11331
|
type: "button",
|
|
11214
|
-
title:
|
|
11332
|
+
title: mobilePanelExpanded ? minimizeLabel : maximizeLabel,
|
|
11215
11333
|
onClick: () => {
|
|
11216
11334
|
setUi({
|
|
11217
11335
|
mobilePanelExpanded: !mobilePanelExpanded
|
|
@@ -11286,6 +11404,7 @@ function PuckProvider({ children }) {
|
|
|
11286
11404
|
iframe: _iframe,
|
|
11287
11405
|
initialHistory: _initialHistory,
|
|
11288
11406
|
metadata,
|
|
11407
|
+
dictionary,
|
|
11289
11408
|
onAction,
|
|
11290
11409
|
fieldTransforms,
|
|
11291
11410
|
_experimentalFullScreenCanvas,
|
|
@@ -11383,6 +11502,7 @@ function PuckProvider({ children }) {
|
|
|
11383
11502
|
_experimentalVirtualization: !!_experimentalVirtualization,
|
|
11384
11503
|
onAction,
|
|
11385
11504
|
metadata,
|
|
11505
|
+
dictionary: dictionary || {},
|
|
11386
11506
|
fieldTransforms: loadedFieldTransforms
|
|
11387
11507
|
};
|
|
11388
11508
|
},
|
|
@@ -11398,6 +11518,7 @@ function PuckProvider({ children }) {
|
|
|
11398
11518
|
_experimentalVirtualization,
|
|
11399
11519
|
onAction,
|
|
11400
11520
|
metadata,
|
|
11521
|
+
dictionary,
|
|
11401
11522
|
loadedFieldTransforms
|
|
11402
11523
|
]
|
|
11403
11524
|
);
|
|
@@ -11452,13 +11573,29 @@ Puck.Preview = Preview2;
|
|
|
11452
11573
|
|
|
11453
11574
|
// plugins/legacy-side-bar/index.tsx
|
|
11454
11575
|
init_react_import();
|
|
11455
|
-
import { jsx as jsx57, jsxs as
|
|
11456
|
-
var
|
|
11576
|
+
import { jsx as jsx57, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
11577
|
+
var LegacySideBar = ({
|
|
11578
|
+
outlineLabel,
|
|
11579
|
+
componentsLabel
|
|
11580
|
+
}) => {
|
|
11581
|
+
const componentsLabelMessage = useMessage("plugin-components");
|
|
11582
|
+
const outlineLabelMessage = useMessage("plugin-outline");
|
|
11583
|
+
const resolvedComponentsLabel = componentsLabel != null ? componentsLabel : componentsLabelMessage;
|
|
11584
|
+
const resolvedOutlineLabel = outlineLabel != null ? outlineLabel : outlineLabelMessage;
|
|
11585
|
+
return /* @__PURE__ */ jsxs23("div", { style: { overflowY: "auto" }, children: [
|
|
11586
|
+
/* @__PURE__ */ jsx57(SidebarSection, { title: resolvedComponentsLabel, noBorderTop: true, children: /* @__PURE__ */ jsx57(Components, {}) }),
|
|
11587
|
+
/* @__PURE__ */ jsx57(SidebarSection, { title: resolvedOutlineLabel, children: /* @__PURE__ */ jsx57(Outline, {}) })
|
|
11588
|
+
] });
|
|
11589
|
+
};
|
|
11590
|
+
var legacySideBarPlugin = (props = {}) => ({
|
|
11457
11591
|
name: "legacy-side-bar",
|
|
11458
|
-
render: () => /* @__PURE__ */
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11592
|
+
render: () => /* @__PURE__ */ jsx57(
|
|
11593
|
+
LegacySideBar,
|
|
11594
|
+
{
|
|
11595
|
+
outlineLabel: props.outlineLabel,
|
|
11596
|
+
componentsLabel: props.componentsLabel
|
|
11597
|
+
}
|
|
11598
|
+
)
|
|
11462
11599
|
});
|
|
11463
11600
|
|
|
11464
11601
|
// bundle/core.ts
|