@measured/puck-plugin-heading-analyzer 0.20.0-canary.d2e09bdc → 0.20.0-canary.def0ecb5
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/index.d.mts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +180 -316
- package/dist/index.mjs +159 -295
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -313,7 +313,7 @@ init_react_import();
|
|
313
313
|
|
314
314
|
// src/HeadingAnalyzer.tsx
|
315
315
|
init_react_import();
|
316
|
-
var
|
316
|
+
var import_react12 = require("react");
|
317
317
|
|
318
318
|
// css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
|
319
319
|
init_react_import();
|
@@ -474,7 +474,7 @@ var ChevronRight = createLucideIcon("ChevronRight", [
|
|
474
474
|
|
475
475
|
// ../core/lib/use-breadcrumbs.ts
|
476
476
|
init_react_import();
|
477
|
-
var
|
477
|
+
var import_react10 = require("react");
|
478
478
|
|
479
479
|
// ../core/store/index.ts
|
480
480
|
init_react_import();
|
@@ -1000,275 +1000,6 @@ function insertAction(state, action, appStore) {
|
|
1000
1000
|
|
1001
1001
|
// ../core/reducer/actions/replace.ts
|
1002
1002
|
init_react_import();
|
1003
|
-
|
1004
|
-
// ../core/rsc.tsx
|
1005
|
-
init_react_import();
|
1006
|
-
|
1007
|
-
// ../core/components/ServerRender/index.tsx
|
1008
|
-
init_react_import();
|
1009
|
-
|
1010
|
-
// ../core/lib/data/setup-zone.ts
|
1011
|
-
init_react_import();
|
1012
|
-
var setupZone = (data, zoneKey) => {
|
1013
|
-
if (zoneKey === rootDroppableId) {
|
1014
|
-
return data;
|
1015
|
-
}
|
1016
|
-
const newData = __spreadProps(__spreadValues({}, data), {
|
1017
|
-
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
1018
|
-
});
|
1019
|
-
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
1020
|
-
return newData;
|
1021
|
-
};
|
1022
|
-
|
1023
|
-
// ../core/lib/use-slots.tsx
|
1024
|
-
init_react_import();
|
1025
|
-
var import_react4 = require("react");
|
1026
|
-
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
1027
|
-
const slotProps = (0, import_react4.useMemo)(() => {
|
1028
|
-
const mapped = mapSlots(
|
1029
|
-
item,
|
1030
|
-
(content, _parentId, propName, field, propPath) => {
|
1031
|
-
const wildcardPath = propPath.replace(/\[\d+\]/g, "[*]");
|
1032
|
-
const isReadOnly = (readOnly == null ? void 0 : readOnly[propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly;
|
1033
|
-
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
1034
|
-
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
1035
|
-
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
1036
|
-
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
1037
|
-
}, dzProps), {
|
1038
|
-
zone: propName,
|
1039
|
-
content
|
1040
|
-
}));
|
1041
|
-
return Slot;
|
1042
|
-
},
|
1043
|
-
config
|
1044
|
-
).props;
|
1045
|
-
return mapped;
|
1046
|
-
}, [config, item, readOnly, forceReadOnly]);
|
1047
|
-
const mergedProps = (0, import_react4.useMemo)(
|
1048
|
-
() => __spreadValues(__spreadValues({}, item.props), slotProps),
|
1049
|
-
[item.props, slotProps]
|
1050
|
-
);
|
1051
|
-
return mergedProps;
|
1052
|
-
}
|
1053
|
-
|
1054
|
-
// ../core/components/SlotRender/server.tsx
|
1055
|
-
init_react_import();
|
1056
|
-
var import_react5 = require("react");
|
1057
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
1058
|
-
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotRender, __spreadValues({}, props));
|
1059
|
-
var Item = ({
|
1060
|
-
config,
|
1061
|
-
item,
|
1062
|
-
metadata
|
1063
|
-
}) => {
|
1064
|
-
const Component = config.components[item.type];
|
1065
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
1066
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
1067
|
-
Component.render,
|
1068
|
-
__spreadProps(__spreadValues({}, props), {
|
1069
|
-
puck: __spreadProps(__spreadValues({}, props.puck), {
|
1070
|
-
renderDropZone: DropZoneRender,
|
1071
|
-
metadata: metadata || {}
|
1072
|
-
})
|
1073
|
-
})
|
1074
|
-
);
|
1075
|
-
};
|
1076
|
-
var SlotRender = (0, import_react5.forwardRef)(
|
1077
|
-
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
1078
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className, style, ref, children: content.map((item) => {
|
1079
|
-
if (!config.components[item.type]) {
|
1080
|
-
return null;
|
1081
|
-
}
|
1082
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
1083
|
-
Item,
|
1084
|
-
{
|
1085
|
-
config,
|
1086
|
-
item,
|
1087
|
-
metadata
|
1088
|
-
},
|
1089
|
-
item.props.id
|
1090
|
-
);
|
1091
|
-
}) });
|
1092
|
-
}
|
1093
|
-
);
|
1094
|
-
|
1095
|
-
// ../core/components/ServerRender/index.tsx
|
1096
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
1097
|
-
function DropZoneRender({
|
1098
|
-
zone,
|
1099
|
-
data,
|
1100
|
-
areaId = "root",
|
1101
|
-
config,
|
1102
|
-
metadata = {}
|
1103
|
-
}) {
|
1104
|
-
let zoneCompound = rootDroppableId;
|
1105
|
-
let content = (data == null ? void 0 : data.content) || [];
|
1106
|
-
if (!data || !config) {
|
1107
|
-
return null;
|
1108
|
-
}
|
1109
|
-
if (areaId !== rootAreaId && zone !== rootZone) {
|
1110
|
-
zoneCompound = `${areaId}:${zone}`;
|
1111
|
-
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
1112
|
-
}
|
1113
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: content.map((item) => {
|
1114
|
-
const Component = config.components[item.type];
|
1115
|
-
const props = __spreadProps(__spreadValues({}, item.props), {
|
1116
|
-
puck: {
|
1117
|
-
renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
1118
|
-
DropZoneRender,
|
1119
|
-
{
|
1120
|
-
zone: zone2,
|
1121
|
-
data,
|
1122
|
-
areaId: item.props.id,
|
1123
|
-
config,
|
1124
|
-
metadata
|
1125
|
-
}
|
1126
|
-
),
|
1127
|
-
metadata,
|
1128
|
-
dragRef: null,
|
1129
|
-
isEditing: false
|
1130
|
-
}
|
1131
|
-
});
|
1132
|
-
const renderItem = __spreadProps(__spreadValues({}, item), { props });
|
1133
|
-
const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
1134
|
-
if (Component) {
|
1135
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
|
1136
|
-
}
|
1137
|
-
return null;
|
1138
|
-
}) });
|
1139
|
-
}
|
1140
|
-
|
1141
|
-
// ../core/lib/resolve-all-data.ts
|
1142
|
-
init_react_import();
|
1143
|
-
|
1144
|
-
// ../core/lib/resolve-component-data.ts
|
1145
|
-
init_react_import();
|
1146
|
-
|
1147
|
-
// ../core/lib/get-changed.ts
|
1148
|
-
init_react_import();
|
1149
|
-
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
1150
|
-
var getChanged = (newItem, oldItem) => {
|
1151
|
-
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1152
|
-
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1153
|
-
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1154
|
-
return __spreadProps(__spreadValues({}, acc), {
|
1155
|
-
[item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
|
1156
|
-
});
|
1157
|
-
}, {}) : {};
|
1158
|
-
};
|
1159
|
-
|
1160
|
-
// ../core/lib/resolve-component-data.ts
|
1161
|
-
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
1162
|
-
var cache = { lastChange: {} };
|
1163
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
1164
|
-
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
1165
|
-
const resolvedItem = __spreadValues({}, item);
|
1166
|
-
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
1167
|
-
const id = "id" in item.props ? item.props.id : "root";
|
1168
|
-
if (shouldRunResolver) {
|
1169
|
-
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1170
|
-
if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
|
1171
|
-
return { node: resolved, didChange: false };
|
1172
|
-
}
|
1173
|
-
const changed = getChanged(item, oldItem);
|
1174
|
-
if (onResolveStart) {
|
1175
|
-
onResolveStart(item);
|
1176
|
-
}
|
1177
|
-
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
1178
|
-
changed,
|
1179
|
-
lastData: oldItem,
|
1180
|
-
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
1181
|
-
trigger
|
1182
|
-
});
|
1183
|
-
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
1184
|
-
if (Object.keys(readOnly).length) {
|
1185
|
-
resolvedItem.readOnly = readOnly;
|
1186
|
-
}
|
1187
|
-
}
|
1188
|
-
let itemWithResolvedChildren = yield mapSlots(
|
1189
|
-
resolvedItem,
|
1190
|
-
(content) => __async(void 0, null, function* () {
|
1191
|
-
return yield Promise.all(
|
1192
|
-
content.map(
|
1193
|
-
(childItem) => __async(void 0, null, function* () {
|
1194
|
-
return (yield resolveComponentData(
|
1195
|
-
childItem,
|
1196
|
-
config,
|
1197
|
-
metadata,
|
1198
|
-
onResolveStart,
|
1199
|
-
onResolveEnd,
|
1200
|
-
trigger
|
1201
|
-
)).node;
|
1202
|
-
})
|
1203
|
-
)
|
1204
|
-
);
|
1205
|
-
}),
|
1206
|
-
config
|
1207
|
-
);
|
1208
|
-
if (shouldRunResolver && onResolveEnd) {
|
1209
|
-
onResolveEnd(resolvedItem);
|
1210
|
-
}
|
1211
|
-
cache.lastChange[id] = {
|
1212
|
-
item,
|
1213
|
-
resolved: itemWithResolvedChildren
|
1214
|
-
};
|
1215
|
-
return {
|
1216
|
-
node: itemWithResolvedChildren,
|
1217
|
-
didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
|
1218
|
-
};
|
1219
|
-
});
|
1220
|
-
|
1221
|
-
// ../core/lib/data/default-data.ts
|
1222
|
-
init_react_import();
|
1223
|
-
|
1224
|
-
// ../core/lib/data/to-component.ts
|
1225
|
-
init_react_import();
|
1226
|
-
|
1227
|
-
// ../core/lib/transform-props.ts
|
1228
|
-
init_react_import();
|
1229
|
-
|
1230
|
-
// ../core/lib/migrate.ts
|
1231
|
-
init_react_import();
|
1232
|
-
|
1233
|
-
// ../core/store/default-app-state.ts
|
1234
|
-
init_react_import();
|
1235
|
-
|
1236
|
-
// ../core/components/ViewportControls/default-viewports.ts
|
1237
|
-
init_react_import();
|
1238
|
-
var defaultViewports = [
|
1239
|
-
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1240
|
-
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1241
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1242
|
-
];
|
1243
|
-
|
1244
|
-
// ../core/store/default-app-state.ts
|
1245
|
-
var defaultAppState = {
|
1246
|
-
data: { content: [], root: {}, zones: {} },
|
1247
|
-
ui: {
|
1248
|
-
leftSideBarVisible: true,
|
1249
|
-
rightSideBarVisible: true,
|
1250
|
-
arrayState: {},
|
1251
|
-
itemSelector: null,
|
1252
|
-
componentList: {},
|
1253
|
-
isDragging: false,
|
1254
|
-
previewMode: "edit",
|
1255
|
-
viewports: {
|
1256
|
-
current: {
|
1257
|
-
width: defaultViewports[0].width,
|
1258
|
-
height: defaultViewports[0].height || "auto"
|
1259
|
-
},
|
1260
|
-
options: [],
|
1261
|
-
controlsVisible: true
|
1262
|
-
},
|
1263
|
-
field: { focus: null }
|
1264
|
-
},
|
1265
|
-
indexes: {
|
1266
|
-
nodes: {},
|
1267
|
-
zones: {}
|
1268
|
-
}
|
1269
|
-
};
|
1270
|
-
|
1271
|
-
// ../core/reducer/actions/replace.ts
|
1272
1003
|
var replaceAction = (state, action, appStore) => {
|
1273
1004
|
const [parentId] = action.destinationZone.split(":");
|
1274
1005
|
const idsInPath = getIdsForParent(action.destinationZone, state);
|
@@ -1519,6 +1250,21 @@ var removeAction = (state, action, appStore) => {
|
|
1519
1250
|
|
1520
1251
|
// ../core/reducer/actions/register-zone.ts
|
1521
1252
|
init_react_import();
|
1253
|
+
|
1254
|
+
// ../core/lib/data/setup-zone.ts
|
1255
|
+
init_react_import();
|
1256
|
+
var setupZone = (data, zoneKey) => {
|
1257
|
+
if (zoneKey === rootDroppableId) {
|
1258
|
+
return data;
|
1259
|
+
}
|
1260
|
+
const newData = __spreadProps(__spreadValues({}, data), {
|
1261
|
+
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
1262
|
+
});
|
1263
|
+
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
1264
|
+
return newData;
|
1265
|
+
};
|
1266
|
+
|
1267
|
+
// ../core/reducer/actions/register-zone.ts
|
1522
1268
|
var zoneCache = {};
|
1523
1269
|
function registerZoneAction(state, action) {
|
1524
1270
|
if (zoneCache[action.zone]) {
|
@@ -1671,6 +1417,14 @@ function createReducer({
|
|
1671
1417
|
);
|
1672
1418
|
}
|
1673
1419
|
|
1420
|
+
// ../core/components/ViewportControls/default-viewports.ts
|
1421
|
+
init_react_import();
|
1422
|
+
var defaultViewports = [
|
1423
|
+
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1424
|
+
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1425
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1426
|
+
];
|
1427
|
+
|
1674
1428
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
1675
1429
|
init_react_import();
|
1676
1430
|
var createStoreImpl = (createState) => {
|
@@ -1698,15 +1452,15 @@ var createStore = (createState) => createState ? createStoreImpl(createState) :
|
|
1698
1452
|
|
1699
1453
|
// ../../node_modules/zustand/esm/react.mjs
|
1700
1454
|
init_react_import();
|
1701
|
-
var
|
1455
|
+
var import_react4 = __toESM(require("react"), 1);
|
1702
1456
|
var identity = (arg) => arg;
|
1703
1457
|
function useStore(api, selector = identity) {
|
1704
|
-
const slice =
|
1458
|
+
const slice = import_react4.default.useSyncExternalStore(
|
1705
1459
|
api.subscribe,
|
1706
1460
|
() => selector(api.getState()),
|
1707
1461
|
() => selector(api.getInitialState())
|
1708
1462
|
);
|
1709
|
-
|
1463
|
+
import_react4.default.useDebugValue(slice);
|
1710
1464
|
return slice;
|
1711
1465
|
}
|
1712
1466
|
var createImpl = (createState) => {
|
@@ -1745,15 +1499,15 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
|
|
1745
1499
|
var subscribeWithSelector = subscribeWithSelectorImpl;
|
1746
1500
|
|
1747
1501
|
// ../core/store/index.ts
|
1748
|
-
var
|
1502
|
+
var import_react9 = require("react");
|
1749
1503
|
|
1750
1504
|
// ../core/store/slices/history.ts
|
1751
1505
|
init_react_import();
|
1752
|
-
var
|
1506
|
+
var import_react6 = require("react");
|
1753
1507
|
|
1754
1508
|
// ../core/lib/use-hotkey.ts
|
1755
1509
|
init_react_import();
|
1756
|
-
var
|
1510
|
+
var import_react5 = require("react");
|
1757
1511
|
var useHotkeyStore = create()(
|
1758
1512
|
subscribeWithSelector((set) => ({
|
1759
1513
|
held: {},
|
@@ -1902,7 +1656,7 @@ var createNodesSlice = (set, get) => ({
|
|
1902
1656
|
|
1903
1657
|
// ../core/store/slices/permissions.ts
|
1904
1658
|
init_react_import();
|
1905
|
-
var
|
1659
|
+
var import_react7 = require("react");
|
1906
1660
|
|
1907
1661
|
// ../core/lib/data/flatten-data.ts
|
1908
1662
|
init_react_import();
|
@@ -1920,6 +1674,19 @@ var flattenData = (state, config) => {
|
|
1920
1674
|
return data;
|
1921
1675
|
};
|
1922
1676
|
|
1677
|
+
// ../core/lib/get-changed.ts
|
1678
|
+
init_react_import();
|
1679
|
+
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
1680
|
+
var getChanged = (newItem, oldItem) => {
|
1681
|
+
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1682
|
+
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1683
|
+
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1684
|
+
return __spreadProps(__spreadValues({}, acc), {
|
1685
|
+
[item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
|
1686
|
+
});
|
1687
|
+
}, {}) : {};
|
1688
|
+
};
|
1689
|
+
|
1923
1690
|
// ../core/store/slices/permissions.ts
|
1924
1691
|
var createPermissionsSlice = (set, get) => {
|
1925
1692
|
const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
|
@@ -2028,7 +1795,7 @@ var createPermissionsSlice = (set, get) => {
|
|
2028
1795
|
|
2029
1796
|
// ../core/store/slices/fields.ts
|
2030
1797
|
init_react_import();
|
2031
|
-
var
|
1798
|
+
var import_react8 = require("react");
|
2032
1799
|
var createFieldsSlice = (_set, _get) => {
|
2033
1800
|
return {
|
2034
1801
|
fields: {},
|
@@ -2038,6 +1805,68 @@ var createFieldsSlice = (_set, _get) => {
|
|
2038
1805
|
};
|
2039
1806
|
};
|
2040
1807
|
|
1808
|
+
// ../core/lib/resolve-component-data.ts
|
1809
|
+
init_react_import();
|
1810
|
+
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
1811
|
+
var cache = { lastChange: {} };
|
1812
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
1813
|
+
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
1814
|
+
const resolvedItem = __spreadValues({}, item);
|
1815
|
+
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
1816
|
+
const id = "id" in item.props ? item.props.id : "root";
|
1817
|
+
if (shouldRunResolver) {
|
1818
|
+
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1819
|
+
if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
|
1820
|
+
return { node: resolved, didChange: false };
|
1821
|
+
}
|
1822
|
+
const changed = getChanged(item, oldItem);
|
1823
|
+
if (onResolveStart) {
|
1824
|
+
onResolveStart(item);
|
1825
|
+
}
|
1826
|
+
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
1827
|
+
changed,
|
1828
|
+
lastData: oldItem,
|
1829
|
+
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
1830
|
+
trigger
|
1831
|
+
});
|
1832
|
+
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
1833
|
+
if (Object.keys(readOnly).length) {
|
1834
|
+
resolvedItem.readOnly = readOnly;
|
1835
|
+
}
|
1836
|
+
}
|
1837
|
+
let itemWithResolvedChildren = yield mapSlots(
|
1838
|
+
resolvedItem,
|
1839
|
+
(content) => __async(void 0, null, function* () {
|
1840
|
+
return yield Promise.all(
|
1841
|
+
content.map(
|
1842
|
+
(childItem) => __async(void 0, null, function* () {
|
1843
|
+
return (yield resolveComponentData(
|
1844
|
+
childItem,
|
1845
|
+
config,
|
1846
|
+
metadata,
|
1847
|
+
onResolveStart,
|
1848
|
+
onResolveEnd,
|
1849
|
+
trigger
|
1850
|
+
)).node;
|
1851
|
+
})
|
1852
|
+
)
|
1853
|
+
);
|
1854
|
+
}),
|
1855
|
+
config
|
1856
|
+
);
|
1857
|
+
if (shouldRunResolver && onResolveEnd) {
|
1858
|
+
onResolveEnd(resolvedItem);
|
1859
|
+
}
|
1860
|
+
cache.lastChange[id] = {
|
1861
|
+
item,
|
1862
|
+
resolved: itemWithResolvedChildren
|
1863
|
+
};
|
1864
|
+
return {
|
1865
|
+
node: itemWithResolvedChildren,
|
1866
|
+
didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
|
1867
|
+
};
|
1868
|
+
});
|
1869
|
+
|
2041
1870
|
// ../core/lib/data/to-root.ts
|
2042
1871
|
init_react_import();
|
2043
1872
|
var toRoot = (item) => {
|
@@ -2055,6 +1884,34 @@ var toRoot = (item) => {
|
|
2055
1884
|
return { props: {}, readOnly };
|
2056
1885
|
};
|
2057
1886
|
|
1887
|
+
// ../core/store/default-app-state.ts
|
1888
|
+
init_react_import();
|
1889
|
+
var defaultAppState = {
|
1890
|
+
data: { content: [], root: {}, zones: {} },
|
1891
|
+
ui: {
|
1892
|
+
leftSideBarVisible: true,
|
1893
|
+
rightSideBarVisible: true,
|
1894
|
+
arrayState: {},
|
1895
|
+
itemSelector: null,
|
1896
|
+
componentList: {},
|
1897
|
+
isDragging: false,
|
1898
|
+
previewMode: "edit",
|
1899
|
+
viewports: {
|
1900
|
+
current: {
|
1901
|
+
width: defaultViewports[0].width,
|
1902
|
+
height: defaultViewports[0].height || "auto"
|
1903
|
+
},
|
1904
|
+
options: [],
|
1905
|
+
controlsVisible: true
|
1906
|
+
},
|
1907
|
+
field: { focus: null }
|
1908
|
+
},
|
1909
|
+
indexes: {
|
1910
|
+
nodes: {},
|
1911
|
+
zones: {}
|
1912
|
+
}
|
1913
|
+
};
|
1914
|
+
|
2058
1915
|
// ../core/store/index.ts
|
2059
1916
|
var defaultPageFields = {
|
2060
1917
|
title: { type: "text" }
|
@@ -2231,13 +2088,13 @@ var createAppStore = (initialAppStore) => create()(
|
|
2231
2088
|
});
|
2232
2089
|
})
|
2233
2090
|
);
|
2234
|
-
var appStoreContext = (0,
|
2091
|
+
var appStoreContext = (0, import_react9.createContext)(createAppStore());
|
2235
2092
|
function useAppStore(selector) {
|
2236
|
-
const context = (0,
|
2093
|
+
const context = (0, import_react9.useContext)(appStoreContext);
|
2237
2094
|
return useStore(context, selector);
|
2238
2095
|
}
|
2239
2096
|
function useAppStoreApi() {
|
2240
|
-
return (0,
|
2097
|
+
return (0, import_react9.useContext)(appStoreContext);
|
2241
2098
|
}
|
2242
2099
|
|
2243
2100
|
// ../core/lib/use-breadcrumbs.ts
|
@@ -2252,7 +2109,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
2252
2109
|
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
2253
2110
|
});
|
2254
2111
|
const appStore = useAppStoreApi();
|
2255
|
-
return (0,
|
2112
|
+
return (0, import_react10.useMemo)(() => {
|
2256
2113
|
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
2257
2114
|
var _a, _b, _c;
|
2258
2115
|
const [componentId] = zoneCompound.split(":");
|
@@ -2297,12 +2154,19 @@ init_react_import();
|
|
2297
2154
|
// ../core/lib/data/replace.ts
|
2298
2155
|
init_react_import();
|
2299
2156
|
|
2157
|
+
// ../core/lib/use-reset-auto-zoom.ts
|
2158
|
+
init_react_import();
|
2159
|
+
var import_react11 = require("react");
|
2160
|
+
|
2161
|
+
// ../core/lib/get-zoom-config.ts
|
2162
|
+
init_react_import();
|
2163
|
+
|
2300
2164
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
2301
2165
|
init_react_import();
|
2302
2166
|
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
2303
2167
|
|
2304
2168
|
// ../core/components/Loader/index.tsx
|
2305
|
-
var
|
2169
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
2306
2170
|
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
2307
2171
|
var Loader = (_a) => {
|
2308
2172
|
var _b = _a, {
|
@@ -2312,7 +2176,7 @@ var Loader = (_a) => {
|
|
2312
2176
|
"color",
|
2313
2177
|
"size"
|
2314
2178
|
]);
|
2315
|
-
return /* @__PURE__ */ (0,
|
2179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
2316
2180
|
"span",
|
2317
2181
|
__spreadValues({
|
2318
2182
|
className: getClassName2(),
|
@@ -2327,7 +2191,7 @@ var Loader = (_a) => {
|
|
2327
2191
|
};
|
2328
2192
|
|
2329
2193
|
// ../core/components/SidebarSection/index.tsx
|
2330
|
-
var
|
2194
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
2331
2195
|
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
2332
2196
|
var SidebarSection = ({
|
2333
2197
|
children,
|
@@ -2340,15 +2204,15 @@ var SidebarSection = ({
|
|
2340
2204
|
}) => {
|
2341
2205
|
const setUi = useAppStore((s) => s.setUi);
|
2342
2206
|
const breadcrumbs = useBreadcrumbs(1);
|
2343
|
-
return /* @__PURE__ */ (0,
|
2207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
2344
2208
|
"div",
|
2345
2209
|
{
|
2346
2210
|
className: getClassName3({ noBorderTop, noPadding }),
|
2347
2211
|
style: { background },
|
2348
2212
|
children: [
|
2349
|
-
/* @__PURE__ */ (0,
|
2350
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
2351
|
-
/* @__PURE__ */ (0,
|
2213
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
|
2214
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
|
2215
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
2352
2216
|
"button",
|
2353
2217
|
{
|
2354
2218
|
type: "button",
|
@@ -2357,12 +2221,12 @@ var SidebarSection = ({
|
|
2357
2221
|
children: breadcrumb.label
|
2358
2222
|
}
|
2359
2223
|
),
|
2360
|
-
/* @__PURE__ */ (0,
|
2224
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, { size: 16 })
|
2361
2225
|
] }, i)) : null,
|
2362
|
-
/* @__PURE__ */ (0,
|
2226
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
2363
2227
|
] }) }),
|
2364
|
-
/* @__PURE__ */ (0,
|
2365
|
-
isLoading && /* @__PURE__ */ (0,
|
2228
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("content"), children }),
|
2229
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 32 }) })
|
2366
2230
|
]
|
2367
2231
|
}
|
2368
2232
|
);
|
@@ -2376,18 +2240,18 @@ init_react_import();
|
|
2376
2240
|
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
2377
2241
|
|
2378
2242
|
// ../core/components/OutlineList/index.tsx
|
2379
|
-
var
|
2243
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
2380
2244
|
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
2381
2245
|
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
2382
2246
|
var OutlineList = ({ children }) => {
|
2383
|
-
return /* @__PURE__ */ (0,
|
2247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: getClassName4(), children });
|
2384
2248
|
};
|
2385
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0,
|
2249
|
+
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
|
2386
2250
|
OutlineList.Item = ({
|
2387
2251
|
children,
|
2388
2252
|
onClick
|
2389
2253
|
}) => {
|
2390
|
-
return /* @__PURE__ */ (0,
|
2254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
2391
2255
|
"li",
|
2392
2256
|
{
|
2393
2257
|
className: getClassNameItem({ clickable: !!onClick }),
|
@@ -2421,7 +2285,7 @@ var getFrame = () => {
|
|
2421
2285
|
|
2422
2286
|
// src/HeadingAnalyzer.tsx
|
2423
2287
|
var import_react_from_json = __toESM(require("react-from-json"));
|
2424
|
-
var
|
2288
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
2425
2289
|
var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
2426
2290
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
2427
2291
|
var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
|
@@ -2477,8 +2341,8 @@ function buildHierarchy(frame) {
|
|
2477
2341
|
var usePuck = (0, import_puck.createUsePuck)();
|
2478
2342
|
var HeadingAnalyzer = () => {
|
2479
2343
|
const data = usePuck((s) => s.appState.data);
|
2480
|
-
const [hierarchy, setHierarchy] = (0,
|
2481
|
-
(0,
|
2344
|
+
const [hierarchy, setHierarchy] = (0, import_react12.useState)([]);
|
2345
|
+
(0, import_react12.useEffect)(() => {
|
2482
2346
|
const frame = getFrame();
|
2483
2347
|
let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
|
2484
2348
|
const createHierarchy = () => {
|
@@ -2513,8 +2377,8 @@ var HeadingAnalyzer = () => {
|
|
2513
2377
|
frameObserver.disconnect();
|
2514
2378
|
};
|
2515
2379
|
}, [data]);
|
2516
|
-
return /* @__PURE__ */ (0,
|
2517
|
-
/* @__PURE__ */ (0,
|
2380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
|
2381
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
2518
2382
|
"small",
|
2519
2383
|
{
|
2520
2384
|
className: getClassName5("cssWarning"),
|
@@ -2526,19 +2390,19 @@ var HeadingAnalyzer = () => {
|
|
2526
2390
|
children: [
|
2527
2391
|
"Heading analyzer styles not loaded. Please review the",
|
2528
2392
|
" ",
|
2529
|
-
/* @__PURE__ */ (0,
|
2393
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
2530
2394
|
"."
|
2531
2395
|
]
|
2532
2396
|
}
|
2533
2397
|
),
|
2534
|
-
hierarchy.length === 0 && /* @__PURE__ */ (0,
|
2535
|
-
/* @__PURE__ */ (0,
|
2398
|
+
hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: "No headings." }),
|
2399
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
2536
2400
|
ReactFromJSON,
|
2537
2401
|
{
|
2538
2402
|
mapping: {
|
2539
|
-
Root: (props) => /* @__PURE__ */ (0,
|
2540
|
-
OutlineListItem: (props) => /* @__PURE__ */ (0,
|
2541
|
-
/* @__PURE__ */ (0,
|
2403
|
+
Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: props.children }),
|
2404
|
+
OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(OutlineList.Item, { children: [
|
2405
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
2542
2406
|
"small",
|
2543
2407
|
{
|
2544
2408
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -2556,14 +2420,14 @@ var HeadingAnalyzer = () => {
|
|
2556
2420
|
}, 2e3);
|
2557
2421
|
}
|
2558
2422
|
},
|
2559
|
-
children: props.missing ? /* @__PURE__ */ (0,
|
2560
|
-
/* @__PURE__ */ (0,
|
2423
|
+
children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
2424
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
|
2561
2425
|
"H",
|
2562
2426
|
props.rank
|
2563
2427
|
] }),
|
2564
2428
|
": Missing"
|
2565
|
-
] }) : /* @__PURE__ */ (0,
|
2566
|
-
/* @__PURE__ */ (0,
|
2429
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
2430
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
|
2567
2431
|
"H",
|
2568
2432
|
props.rank
|
2569
2433
|
] }),
|
@@ -2572,7 +2436,7 @@ var HeadingAnalyzer = () => {
|
|
2572
2436
|
] })
|
2573
2437
|
}
|
2574
2438
|
) }),
|
2575
|
-
/* @__PURE__ */ (0,
|
2439
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: props.children })
|
2576
2440
|
] })
|
2577
2441
|
},
|
2578
2442
|
entry: {
|
@@ -2594,9 +2458,9 @@ var HeadingAnalyzer = () => {
|
|
2594
2458
|
};
|
2595
2459
|
var headingAnalyzer = {
|
2596
2460
|
overrides: {
|
2597
|
-
fields: ({ children, itemSelector }) => /* @__PURE__ */ (0,
|
2461
|
+
fields: ({ children, itemSelector }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
2598
2462
|
children,
|
2599
|
-
/* @__PURE__ */ (0,
|
2463
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeadingAnalyzer, {}) }) })
|
2600
2464
|
] })
|
2601
2465
|
}
|
2602
2466
|
};
|