@measured/puck-plugin-heading-analyzer 0.19.1-canary.85971053 → 0.19.1-canary.f9d3f0e9
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.js +338 -176
- package/dist/index.mjs +317 -155
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
@@ -462,7 +462,7 @@ var ChevronRight = createLucideIcon("ChevronRight", [
|
|
462
462
|
|
463
463
|
// ../core/lib/use-breadcrumbs.ts
|
464
464
|
init_react_import();
|
465
|
-
import { useMemo } from "react";
|
465
|
+
import { useMemo as useMemo2 } from "react";
|
466
466
|
|
467
467
|
// ../core/store/index.ts
|
468
468
|
init_react_import();
|
@@ -663,9 +663,10 @@ var stripSlots = (data, config) => {
|
|
663
663
|
};
|
664
664
|
|
665
665
|
// ../core/lib/data/flatten-node.ts
|
666
|
+
var { flatten: flatten2, unflatten } = import_flat.default;
|
666
667
|
var flattenNode = (node, config) => {
|
667
668
|
return __spreadProps(__spreadValues({}, node), {
|
668
|
-
props: (
|
669
|
+
props: flatten2(stripSlots(node, config).props)
|
669
670
|
});
|
670
671
|
};
|
671
672
|
|
@@ -987,6 +988,275 @@ function insertAction(state, action, appStore) {
|
|
987
988
|
|
988
989
|
// ../core/reducer/actions/replace.ts
|
989
990
|
init_react_import();
|
991
|
+
|
992
|
+
// ../core/rsc.tsx
|
993
|
+
init_react_import();
|
994
|
+
|
995
|
+
// ../core/components/ServerRender/index.tsx
|
996
|
+
init_react_import();
|
997
|
+
|
998
|
+
// ../core/lib/data/setup-zone.ts
|
999
|
+
init_react_import();
|
1000
|
+
var setupZone = (data, zoneKey) => {
|
1001
|
+
if (zoneKey === rootDroppableId) {
|
1002
|
+
return data;
|
1003
|
+
}
|
1004
|
+
const newData = __spreadProps(__spreadValues({}, data), {
|
1005
|
+
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
1006
|
+
});
|
1007
|
+
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
1008
|
+
return newData;
|
1009
|
+
};
|
1010
|
+
|
1011
|
+
// ../core/lib/use-slots.tsx
|
1012
|
+
init_react_import();
|
1013
|
+
import { useMemo } from "react";
|
1014
|
+
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
1015
|
+
const slotProps = useMemo(() => {
|
1016
|
+
const mapped = mapSlots(
|
1017
|
+
item,
|
1018
|
+
(content, _parentId, propName, field, propPath) => {
|
1019
|
+
const wildcardPath = propPath.replace(/\[\d+\]/g, "[*]");
|
1020
|
+
const isReadOnly = (readOnly == null ? void 0 : readOnly[propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly;
|
1021
|
+
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
1022
|
+
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
1023
|
+
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
1024
|
+
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
1025
|
+
}, dzProps), {
|
1026
|
+
zone: propName,
|
1027
|
+
content
|
1028
|
+
}));
|
1029
|
+
return Slot;
|
1030
|
+
},
|
1031
|
+
config
|
1032
|
+
).props;
|
1033
|
+
return mapped;
|
1034
|
+
}, [config, item, readOnly, forceReadOnly]);
|
1035
|
+
const mergedProps = useMemo(
|
1036
|
+
() => __spreadValues(__spreadValues({}, item.props), slotProps),
|
1037
|
+
[item.props, slotProps]
|
1038
|
+
);
|
1039
|
+
return mergedProps;
|
1040
|
+
}
|
1041
|
+
|
1042
|
+
// ../core/components/SlotRender/server.tsx
|
1043
|
+
init_react_import();
|
1044
|
+
import { forwardRef as forwardRef3 } from "react";
|
1045
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
1046
|
+
var SlotRenderPure = (props) => /* @__PURE__ */ jsx2(SlotRender, __spreadValues({}, props));
|
1047
|
+
var Item = ({
|
1048
|
+
config,
|
1049
|
+
item,
|
1050
|
+
metadata
|
1051
|
+
}) => {
|
1052
|
+
const Component = config.components[item.type];
|
1053
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx2(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
1054
|
+
return /* @__PURE__ */ jsx2(
|
1055
|
+
Component.render,
|
1056
|
+
__spreadProps(__spreadValues({}, props), {
|
1057
|
+
puck: __spreadProps(__spreadValues({}, props.puck), {
|
1058
|
+
renderDropZone: DropZoneRender,
|
1059
|
+
metadata: metadata || {}
|
1060
|
+
})
|
1061
|
+
})
|
1062
|
+
);
|
1063
|
+
};
|
1064
|
+
var SlotRender = forwardRef3(
|
1065
|
+
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
1066
|
+
return /* @__PURE__ */ jsx2("div", { className, style, ref, children: content.map((item) => {
|
1067
|
+
if (!config.components[item.type]) {
|
1068
|
+
return null;
|
1069
|
+
}
|
1070
|
+
return /* @__PURE__ */ jsx2(
|
1071
|
+
Item,
|
1072
|
+
{
|
1073
|
+
config,
|
1074
|
+
item,
|
1075
|
+
metadata
|
1076
|
+
},
|
1077
|
+
item.props.id
|
1078
|
+
);
|
1079
|
+
}) });
|
1080
|
+
}
|
1081
|
+
);
|
1082
|
+
|
1083
|
+
// ../core/components/ServerRender/index.tsx
|
1084
|
+
import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
|
1085
|
+
function DropZoneRender({
|
1086
|
+
zone,
|
1087
|
+
data,
|
1088
|
+
areaId = "root",
|
1089
|
+
config,
|
1090
|
+
metadata = {}
|
1091
|
+
}) {
|
1092
|
+
let zoneCompound = rootDroppableId;
|
1093
|
+
let content = (data == null ? void 0 : data.content) || [];
|
1094
|
+
if (!data || !config) {
|
1095
|
+
return null;
|
1096
|
+
}
|
1097
|
+
if (areaId !== rootAreaId && zone !== rootZone) {
|
1098
|
+
zoneCompound = `${areaId}:${zone}`;
|
1099
|
+
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
1100
|
+
}
|
1101
|
+
return /* @__PURE__ */ jsx3(Fragment, { children: content.map((item) => {
|
1102
|
+
const Component = config.components[item.type];
|
1103
|
+
const props = __spreadProps(__spreadValues({}, item.props), {
|
1104
|
+
puck: {
|
1105
|
+
renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ jsx3(
|
1106
|
+
DropZoneRender,
|
1107
|
+
{
|
1108
|
+
zone: zone2,
|
1109
|
+
data,
|
1110
|
+
areaId: item.props.id,
|
1111
|
+
config,
|
1112
|
+
metadata
|
1113
|
+
}
|
1114
|
+
),
|
1115
|
+
metadata,
|
1116
|
+
dragRef: null,
|
1117
|
+
isEditing: false
|
1118
|
+
}
|
1119
|
+
});
|
1120
|
+
const renderItem = __spreadProps(__spreadValues({}, item), { props });
|
1121
|
+
const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ jsx3(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
1122
|
+
if (Component) {
|
1123
|
+
return /* @__PURE__ */ jsx3(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
|
1124
|
+
}
|
1125
|
+
return null;
|
1126
|
+
}) });
|
1127
|
+
}
|
1128
|
+
|
1129
|
+
// ../core/lib/resolve-all-data.ts
|
1130
|
+
init_react_import();
|
1131
|
+
|
1132
|
+
// ../core/lib/resolve-component-data.ts
|
1133
|
+
init_react_import();
|
1134
|
+
|
1135
|
+
// ../core/lib/get-changed.ts
|
1136
|
+
init_react_import();
|
1137
|
+
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
1138
|
+
var getChanged = (newItem, oldItem) => {
|
1139
|
+
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1140
|
+
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1141
|
+
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1142
|
+
return __spreadProps(__spreadValues({}, acc), {
|
1143
|
+
[item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
|
1144
|
+
});
|
1145
|
+
}, {}) : {};
|
1146
|
+
};
|
1147
|
+
|
1148
|
+
// ../core/lib/resolve-component-data.ts
|
1149
|
+
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
1150
|
+
var cache = { lastChange: {} };
|
1151
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
1152
|
+
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
1153
|
+
const resolvedItem = __spreadValues({}, item);
|
1154
|
+
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
1155
|
+
const id = "id" in item.props ? item.props.id : "root";
|
1156
|
+
if (shouldRunResolver) {
|
1157
|
+
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1158
|
+
if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
|
1159
|
+
return { node: resolved, didChange: false };
|
1160
|
+
}
|
1161
|
+
const changed = getChanged(item, oldItem);
|
1162
|
+
if (onResolveStart) {
|
1163
|
+
onResolveStart(item);
|
1164
|
+
}
|
1165
|
+
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
1166
|
+
changed,
|
1167
|
+
lastData: oldItem,
|
1168
|
+
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
1169
|
+
trigger
|
1170
|
+
});
|
1171
|
+
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
1172
|
+
if (Object.keys(readOnly).length) {
|
1173
|
+
resolvedItem.readOnly = readOnly;
|
1174
|
+
}
|
1175
|
+
}
|
1176
|
+
let itemWithResolvedChildren = yield mapSlots(
|
1177
|
+
resolvedItem,
|
1178
|
+
(content) => __async(void 0, null, function* () {
|
1179
|
+
return yield Promise.all(
|
1180
|
+
content.map(
|
1181
|
+
(childItem) => __async(void 0, null, function* () {
|
1182
|
+
return (yield resolveComponentData(
|
1183
|
+
childItem,
|
1184
|
+
config,
|
1185
|
+
metadata,
|
1186
|
+
onResolveStart,
|
1187
|
+
onResolveEnd,
|
1188
|
+
trigger
|
1189
|
+
)).node;
|
1190
|
+
})
|
1191
|
+
)
|
1192
|
+
);
|
1193
|
+
}),
|
1194
|
+
config
|
1195
|
+
);
|
1196
|
+
if (shouldRunResolver && onResolveEnd) {
|
1197
|
+
onResolveEnd(resolvedItem);
|
1198
|
+
}
|
1199
|
+
cache.lastChange[id] = {
|
1200
|
+
item,
|
1201
|
+
resolved: itemWithResolvedChildren
|
1202
|
+
};
|
1203
|
+
return {
|
1204
|
+
node: itemWithResolvedChildren,
|
1205
|
+
didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
|
1206
|
+
};
|
1207
|
+
});
|
1208
|
+
|
1209
|
+
// ../core/lib/data/default-data.ts
|
1210
|
+
init_react_import();
|
1211
|
+
|
1212
|
+
// ../core/lib/data/to-component.ts
|
1213
|
+
init_react_import();
|
1214
|
+
|
1215
|
+
// ../core/lib/transform-props.ts
|
1216
|
+
init_react_import();
|
1217
|
+
|
1218
|
+
// ../core/lib/migrate.ts
|
1219
|
+
init_react_import();
|
1220
|
+
|
1221
|
+
// ../core/store/default-app-state.ts
|
1222
|
+
init_react_import();
|
1223
|
+
|
1224
|
+
// ../core/components/ViewportControls/default-viewports.ts
|
1225
|
+
init_react_import();
|
1226
|
+
var defaultViewports = [
|
1227
|
+
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1228
|
+
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1229
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1230
|
+
];
|
1231
|
+
|
1232
|
+
// ../core/store/default-app-state.ts
|
1233
|
+
var defaultAppState = {
|
1234
|
+
data: { content: [], root: {}, zones: {} },
|
1235
|
+
ui: {
|
1236
|
+
leftSideBarVisible: true,
|
1237
|
+
rightSideBarVisible: true,
|
1238
|
+
arrayState: {},
|
1239
|
+
itemSelector: null,
|
1240
|
+
componentList: {},
|
1241
|
+
isDragging: false,
|
1242
|
+
previewMode: "edit",
|
1243
|
+
viewports: {
|
1244
|
+
current: {
|
1245
|
+
width: defaultViewports[0].width,
|
1246
|
+
height: defaultViewports[0].height || "auto"
|
1247
|
+
},
|
1248
|
+
options: [],
|
1249
|
+
controlsVisible: true
|
1250
|
+
},
|
1251
|
+
field: { focus: null }
|
1252
|
+
},
|
1253
|
+
indexes: {
|
1254
|
+
nodes: {},
|
1255
|
+
zones: {}
|
1256
|
+
}
|
1257
|
+
};
|
1258
|
+
|
1259
|
+
// ../core/reducer/actions/replace.ts
|
990
1260
|
var replaceAction = (state, action, appStore) => {
|
991
1261
|
const [parentId] = action.destinationZone.split(":");
|
992
1262
|
const idsInPath = getIdsForParent(action.destinationZone, state);
|
@@ -997,9 +1267,27 @@ var replaceAction = (state, action, appStore) => {
|
|
997
1267
|
`Can't change the id during a replace action. Please us "remove" and "insert" to define a new node.`
|
998
1268
|
);
|
999
1269
|
}
|
1000
|
-
const
|
1270
|
+
const newSlotIds = [];
|
1271
|
+
const data = walkTree(action.data, appStore.config, (contents, opts) => {
|
1272
|
+
newSlotIds.push(`${opts.parentId}:${opts.propName}`);
|
1273
|
+
return contents.map((item) => {
|
1274
|
+
const id = generateId(item.type);
|
1275
|
+
return __spreadProps(__spreadValues({}, item), {
|
1276
|
+
props: __spreadValues({ id }, item.props)
|
1277
|
+
});
|
1278
|
+
});
|
1279
|
+
});
|
1280
|
+
const stateWithDeepSlotsRemoved = __spreadValues({}, state);
|
1281
|
+
Object.keys(state.indexes.zones).forEach((zoneCompound) => {
|
1282
|
+
const id = zoneCompound.split(":")[0];
|
1283
|
+
if (id === originalId) {
|
1284
|
+
if (!newSlotIds.includes(zoneCompound)) {
|
1285
|
+
delete stateWithDeepSlotsRemoved.indexes.zones[zoneCompound];
|
1286
|
+
}
|
1287
|
+
}
|
1288
|
+
});
|
1001
1289
|
return walkAppState(
|
1002
|
-
|
1290
|
+
stateWithDeepSlotsRemoved,
|
1003
1291
|
appStore.config,
|
1004
1292
|
(content, zoneCompound) => {
|
1005
1293
|
const newContent = [...content];
|
@@ -1219,21 +1507,6 @@ var removeAction = (state, action, appStore) => {
|
|
1219
1507
|
|
1220
1508
|
// ../core/reducer/actions/register-zone.ts
|
1221
1509
|
init_react_import();
|
1222
|
-
|
1223
|
-
// ../core/lib/data/setup-zone.ts
|
1224
|
-
init_react_import();
|
1225
|
-
var setupZone = (data, zoneKey) => {
|
1226
|
-
if (zoneKey === rootDroppableId) {
|
1227
|
-
return data;
|
1228
|
-
}
|
1229
|
-
const newData = __spreadProps(__spreadValues({}, data), {
|
1230
|
-
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
1231
|
-
});
|
1232
|
-
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
1233
|
-
return newData;
|
1234
|
-
};
|
1235
|
-
|
1236
|
-
// ../core/reducer/actions/register-zone.ts
|
1237
1510
|
var zoneCache = {};
|
1238
1511
|
function registerZoneAction(state, action) {
|
1239
1512
|
if (zoneCache[action.zone]) {
|
@@ -1386,14 +1659,6 @@ function createReducer({
|
|
1386
1659
|
);
|
1387
1660
|
}
|
1388
1661
|
|
1389
|
-
// ../core/components/ViewportControls/default-viewports.ts
|
1390
|
-
init_react_import();
|
1391
|
-
var defaultViewports = [
|
1392
|
-
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1393
|
-
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1394
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1395
|
-
];
|
1396
|
-
|
1397
1662
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
1398
1663
|
init_react_import();
|
1399
1664
|
var createStoreImpl = (createState) => {
|
@@ -1643,19 +1908,6 @@ var flattenData = (state, config) => {
|
|
1643
1908
|
return data;
|
1644
1909
|
};
|
1645
1910
|
|
1646
|
-
// ../core/lib/get-changed.ts
|
1647
|
-
init_react_import();
|
1648
|
-
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
1649
|
-
var getChanged = (newItem, oldItem) => {
|
1650
|
-
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1651
|
-
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1652
|
-
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1653
|
-
return __spreadProps(__spreadValues({}, acc), {
|
1654
|
-
[item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
|
1655
|
-
});
|
1656
|
-
}, {}) : {};
|
1657
|
-
};
|
1658
|
-
|
1659
1911
|
// ../core/store/slices/permissions.ts
|
1660
1912
|
var createPermissionsSlice = (set, get) => {
|
1661
1913
|
const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
|
@@ -1774,68 +2026,6 @@ var createFieldsSlice = (_set, _get) => {
|
|
1774
2026
|
};
|
1775
2027
|
};
|
1776
2028
|
|
1777
|
-
// ../core/lib/resolve-component-data.ts
|
1778
|
-
init_react_import();
|
1779
|
-
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
1780
|
-
var cache = { lastChange: {} };
|
1781
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
1782
|
-
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
1783
|
-
const resolvedItem = __spreadValues({}, item);
|
1784
|
-
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
1785
|
-
const id = "id" in item.props ? item.props.id : "root";
|
1786
|
-
if (shouldRunResolver) {
|
1787
|
-
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1788
|
-
if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
|
1789
|
-
return { node: resolved, didChange: false };
|
1790
|
-
}
|
1791
|
-
const changed = getChanged(item, oldItem);
|
1792
|
-
if (onResolveStart) {
|
1793
|
-
onResolveStart(item);
|
1794
|
-
}
|
1795
|
-
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
1796
|
-
changed,
|
1797
|
-
lastData: oldItem,
|
1798
|
-
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
1799
|
-
trigger
|
1800
|
-
});
|
1801
|
-
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
1802
|
-
if (Object.keys(readOnly).length) {
|
1803
|
-
resolvedItem.readOnly = readOnly;
|
1804
|
-
}
|
1805
|
-
}
|
1806
|
-
let itemWithResolvedChildren = yield mapSlots(
|
1807
|
-
resolvedItem,
|
1808
|
-
(content) => __async(void 0, null, function* () {
|
1809
|
-
return yield Promise.all(
|
1810
|
-
content.map(
|
1811
|
-
(childItem) => __async(void 0, null, function* () {
|
1812
|
-
return (yield resolveComponentData(
|
1813
|
-
childItem,
|
1814
|
-
config,
|
1815
|
-
metadata,
|
1816
|
-
onResolveStart,
|
1817
|
-
onResolveEnd,
|
1818
|
-
trigger
|
1819
|
-
)).node;
|
1820
|
-
})
|
1821
|
-
)
|
1822
|
-
);
|
1823
|
-
}),
|
1824
|
-
config
|
1825
|
-
);
|
1826
|
-
if (shouldRunResolver && onResolveEnd) {
|
1827
|
-
onResolveEnd(resolvedItem);
|
1828
|
-
}
|
1829
|
-
cache.lastChange[id] = {
|
1830
|
-
item,
|
1831
|
-
resolved: itemWithResolvedChildren
|
1832
|
-
};
|
1833
|
-
return {
|
1834
|
-
node: itemWithResolvedChildren,
|
1835
|
-
didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
|
1836
|
-
};
|
1837
|
-
});
|
1838
|
-
|
1839
2029
|
// ../core/lib/data/to-root.ts
|
1840
2030
|
init_react_import();
|
1841
2031
|
var toRoot = (item) => {
|
@@ -1853,34 +2043,6 @@ var toRoot = (item) => {
|
|
1853
2043
|
return { props: {}, readOnly };
|
1854
2044
|
};
|
1855
2045
|
|
1856
|
-
// ../core/store/default-app-state.ts
|
1857
|
-
init_react_import();
|
1858
|
-
var defaultAppState = {
|
1859
|
-
data: { content: [], root: {}, zones: {} },
|
1860
|
-
ui: {
|
1861
|
-
leftSideBarVisible: true,
|
1862
|
-
rightSideBarVisible: true,
|
1863
|
-
arrayState: {},
|
1864
|
-
itemSelector: null,
|
1865
|
-
componentList: {},
|
1866
|
-
isDragging: false,
|
1867
|
-
previewMode: "edit",
|
1868
|
-
viewports: {
|
1869
|
-
current: {
|
1870
|
-
width: defaultViewports[0].width,
|
1871
|
-
height: defaultViewports[0].height || "auto"
|
1872
|
-
},
|
1873
|
-
options: [],
|
1874
|
-
controlsVisible: true
|
1875
|
-
},
|
1876
|
-
field: { focus: null }
|
1877
|
-
},
|
1878
|
-
indexes: {
|
1879
|
-
nodes: {},
|
1880
|
-
zones: {}
|
1881
|
-
}
|
1882
|
-
};
|
1883
|
-
|
1884
2046
|
// ../core/store/index.ts
|
1885
2047
|
var defaultPageFields = {
|
1886
2048
|
title: { type: "text" }
|
@@ -2078,7 +2240,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
2078
2240
|
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
2079
2241
|
});
|
2080
2242
|
const appStore = useAppStoreApi();
|
2081
|
-
return
|
2243
|
+
return useMemo2(() => {
|
2082
2244
|
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
2083
2245
|
var _a, _b, _c;
|
2084
2246
|
const [componentId] = zoneCompound.split(":");
|
@@ -2128,7 +2290,7 @@ init_react_import();
|
|
2128
2290
|
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
2129
2291
|
|
2130
2292
|
// ../core/components/Loader/index.tsx
|
2131
|
-
import { jsx as
|
2293
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
2132
2294
|
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
2133
2295
|
var Loader = (_a) => {
|
2134
2296
|
var _b = _a, {
|
@@ -2138,7 +2300,7 @@ var Loader = (_a) => {
|
|
2138
2300
|
"color",
|
2139
2301
|
"size"
|
2140
2302
|
]);
|
2141
|
-
return /* @__PURE__ */
|
2303
|
+
return /* @__PURE__ */ jsx4(
|
2142
2304
|
"span",
|
2143
2305
|
__spreadValues({
|
2144
2306
|
className: getClassName2(),
|
@@ -2153,7 +2315,7 @@ var Loader = (_a) => {
|
|
2153
2315
|
};
|
2154
2316
|
|
2155
2317
|
// ../core/components/SidebarSection/index.tsx
|
2156
|
-
import { jsx as
|
2318
|
+
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
2157
2319
|
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
2158
2320
|
var SidebarSection = ({
|
2159
2321
|
children,
|
@@ -2172,9 +2334,9 @@ var SidebarSection = ({
|
|
2172
2334
|
className: getClassName3({ noBorderTop, noPadding }),
|
2173
2335
|
style: { background },
|
2174
2336
|
children: [
|
2175
|
-
/* @__PURE__ */
|
2337
|
+
/* @__PURE__ */ jsx5("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
|
2176
2338
|
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumb"), children: [
|
2177
|
-
/* @__PURE__ */
|
2339
|
+
/* @__PURE__ */ jsx5(
|
2178
2340
|
"button",
|
2179
2341
|
{
|
2180
2342
|
type: "button",
|
@@ -2183,12 +2345,12 @@ var SidebarSection = ({
|
|
2183
2345
|
children: breadcrumb.label
|
2184
2346
|
}
|
2185
2347
|
),
|
2186
|
-
/* @__PURE__ */
|
2348
|
+
/* @__PURE__ */ jsx5(ChevronRight, { size: 16 })
|
2187
2349
|
] }, i)) : null,
|
2188
|
-
/* @__PURE__ */
|
2350
|
+
/* @__PURE__ */ jsx5("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx5(Heading, { rank: "2", size: "xs", children: title }) })
|
2189
2351
|
] }) }),
|
2190
|
-
/* @__PURE__ */
|
2191
|
-
isLoading && /* @__PURE__ */
|
2352
|
+
/* @__PURE__ */ jsx5("div", { className: getClassName3("content"), children }),
|
2353
|
+
isLoading && /* @__PURE__ */ jsx5("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx5(Loader, { size: 32 }) })
|
2192
2354
|
]
|
2193
2355
|
}
|
2194
2356
|
);
|
@@ -2202,18 +2364,18 @@ init_react_import();
|
|
2202
2364
|
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
2203
2365
|
|
2204
2366
|
// ../core/components/OutlineList/index.tsx
|
2205
|
-
import { jsx as
|
2367
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
2206
2368
|
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
2207
2369
|
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
2208
2370
|
var OutlineList = ({ children }) => {
|
2209
|
-
return /* @__PURE__ */
|
2371
|
+
return /* @__PURE__ */ jsx6("ul", { className: getClassName4(), children });
|
2210
2372
|
};
|
2211
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */
|
2373
|
+
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx6("div", { className: getClassNameItem({ clickable: true }), children });
|
2212
2374
|
OutlineList.Item = ({
|
2213
2375
|
children,
|
2214
2376
|
onClick
|
2215
2377
|
}) => {
|
2216
|
-
return /* @__PURE__ */
|
2378
|
+
return /* @__PURE__ */ jsx6(
|
2217
2379
|
"li",
|
2218
2380
|
{
|
2219
2381
|
className: getClassNameItem({ clickable: !!onClick }),
|
@@ -2247,7 +2409,7 @@ var getFrame = () => {
|
|
2247
2409
|
|
2248
2410
|
// src/HeadingAnalyzer.tsx
|
2249
2411
|
import ReactFromJSONModule from "react-from-json";
|
2250
|
-
import { Fragment, jsx as
|
2412
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
2251
2413
|
var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
2252
2414
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
2253
2415
|
var ReactFromJSON = ReactFromJSONModule.default || ReactFromJSONModule;
|
@@ -2352,19 +2514,19 @@ var HeadingAnalyzer = () => {
|
|
2352
2514
|
children: [
|
2353
2515
|
"Heading analyzer styles not loaded. Please review the",
|
2354
2516
|
" ",
|
2355
|
-
/* @__PURE__ */
|
2517
|
+
/* @__PURE__ */ jsx7("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
2356
2518
|
"."
|
2357
2519
|
]
|
2358
2520
|
}
|
2359
2521
|
),
|
2360
|
-
hierarchy.length === 0 && /* @__PURE__ */
|
2361
|
-
/* @__PURE__ */
|
2522
|
+
hierarchy.length === 0 && /* @__PURE__ */ jsx7("div", { children: "No headings." }),
|
2523
|
+
/* @__PURE__ */ jsx7(OutlineList, { children: /* @__PURE__ */ jsx7(
|
2362
2524
|
ReactFromJSON,
|
2363
2525
|
{
|
2364
2526
|
mapping: {
|
2365
|
-
Root: (props) => /* @__PURE__ */
|
2527
|
+
Root: (props) => /* @__PURE__ */ jsx7(Fragment2, { children: props.children }),
|
2366
2528
|
OutlineListItem: (props) => /* @__PURE__ */ jsxs2(OutlineList.Item, { children: [
|
2367
|
-
/* @__PURE__ */
|
2529
|
+
/* @__PURE__ */ jsx7(OutlineList.Clickable, { children: /* @__PURE__ */ jsx7(
|
2368
2530
|
"small",
|
2369
2531
|
{
|
2370
2532
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -2382,13 +2544,13 @@ var HeadingAnalyzer = () => {
|
|
2382
2544
|
}, 2e3);
|
2383
2545
|
}
|
2384
2546
|
},
|
2385
|
-
children: props.missing ? /* @__PURE__ */ jsxs2(
|
2547
|
+
children: props.missing ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
2386
2548
|
/* @__PURE__ */ jsxs2("b", { children: [
|
2387
2549
|
"H",
|
2388
2550
|
props.rank
|
2389
2551
|
] }),
|
2390
2552
|
": Missing"
|
2391
|
-
] }) : /* @__PURE__ */ jsxs2(
|
2553
|
+
] }) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
2392
2554
|
/* @__PURE__ */ jsxs2("b", { children: [
|
2393
2555
|
"H",
|
2394
2556
|
props.rank
|
@@ -2398,7 +2560,7 @@ var HeadingAnalyzer = () => {
|
|
2398
2560
|
] })
|
2399
2561
|
}
|
2400
2562
|
) }),
|
2401
|
-
/* @__PURE__ */
|
2563
|
+
/* @__PURE__ */ jsx7(OutlineList, { children: props.children })
|
2402
2564
|
] })
|
2403
2565
|
},
|
2404
2566
|
entry: {
|
@@ -2420,9 +2582,9 @@ var HeadingAnalyzer = () => {
|
|
2420
2582
|
};
|
2421
2583
|
var headingAnalyzer = {
|
2422
2584
|
overrides: {
|
2423
|
-
fields: ({ children, itemSelector }) => /* @__PURE__ */ jsxs2(
|
2585
|
+
fields: ({ children, itemSelector }) => /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
2424
2586
|
children,
|
2425
|
-
/* @__PURE__ */
|
2587
|
+
/* @__PURE__ */ jsx7("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ jsx7(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ jsx7(HeadingAnalyzer, {}) }) })
|
2426
2588
|
] })
|
2427
2589
|
}
|
2428
2590
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck-plugin-heading-analyzer",
|
3
|
-
"version": "0.19.1-canary.
|
3
|
+
"version": "0.19.1-canary.f9d3f0e9",
|
4
4
|
"author": "Chris Villa <chris@puckeditor.com>",
|
5
5
|
"repository": "measuredco/puck",
|
6
6
|
"bugs": "https://github.com/measuredco/puck/issues",
|
@@ -25,7 +25,7 @@
|
|
25
25
|
"dist"
|
26
26
|
],
|
27
27
|
"devDependencies": {
|
28
|
-
"@measured/puck": "^0.19.1-canary.
|
28
|
+
"@measured/puck": "^0.19.1-canary.f9d3f0e9",
|
29
29
|
"@types/react": "^19.0.1",
|
30
30
|
"@types/react-dom": "^19.0.2",
|
31
31
|
"eslint": "^7.32.0",
|