@measured/puck-plugin-heading-analyzer 0.21.0-canary.79a26849 → 0.21.0-canary.7c2f9283
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.css +5 -149
- package/dist/index.d.mts +220 -10
- package/dist/index.d.ts +220 -10
- package/dist/index.js +157 -255
- package/dist/index.mjs +154 -252
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -277,21 +277,21 @@ init_react_import();
|
|
|
277
277
|
|
|
278
278
|
// src/HeadingAnalyzer.tsx
|
|
279
279
|
init_react_import();
|
|
280
|
-
var
|
|
280
|
+
var import_react10 = require("react");
|
|
281
281
|
|
|
282
282
|
// css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
|
|
283
283
|
init_react_import();
|
|
284
|
-
var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "
|
|
284
|
+
var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_yg0s7_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_yg0s7_6", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_yg0s7_10", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_yg0s7_14" };
|
|
285
285
|
|
|
286
286
|
// src/HeadingAnalyzer.tsx
|
|
287
287
|
var import_puck = require("@measured/puck");
|
|
288
288
|
|
|
289
|
-
// ../core/components/
|
|
289
|
+
// ../core/components/OutlineList/index.tsx
|
|
290
290
|
init_react_import();
|
|
291
291
|
|
|
292
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/
|
|
292
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
|
293
293
|
init_react_import();
|
|
294
|
-
var styles_module_default = { "
|
|
294
|
+
var styles_module_default = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
|
295
295
|
|
|
296
296
|
// ../core/lib/get-class-name-factory.ts
|
|
297
297
|
init_react_import();
|
|
@@ -320,29 +320,50 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
|
|
|
320
320
|
};
|
|
321
321
|
var get_class_name_factory_default = getClassNameFactory;
|
|
322
322
|
|
|
323
|
-
// ../core/components/
|
|
324
|
-
init_react_import();
|
|
325
|
-
|
|
326
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
|
|
327
|
-
init_react_import();
|
|
328
|
-
var styles_module_default2 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
|
|
329
|
-
|
|
330
|
-
// ../core/components/Heading/index.tsx
|
|
323
|
+
// ../core/components/OutlineList/index.tsx
|
|
331
324
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
332
|
-
var getClassName = get_class_name_factory_default("
|
|
333
|
-
var
|
|
334
|
-
|
|
325
|
+
var getClassName = get_class_name_factory_default("OutlineList", styles_module_default);
|
|
326
|
+
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default);
|
|
327
|
+
var OutlineList = ({ children }) => {
|
|
328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: getClassName(), children });
|
|
329
|
+
};
|
|
330
|
+
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
|
|
331
|
+
OutlineList.Item = ({
|
|
332
|
+
children,
|
|
333
|
+
onClick
|
|
334
|
+
}) => {
|
|
335
335
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
336
|
-
|
|
336
|
+
"li",
|
|
337
337
|
{
|
|
338
|
-
className:
|
|
339
|
-
|
|
340
|
-
}),
|
|
338
|
+
className: getClassNameItem({ clickable: !!onClick }),
|
|
339
|
+
onClick,
|
|
341
340
|
children
|
|
342
341
|
}
|
|
343
342
|
);
|
|
344
343
|
};
|
|
345
344
|
|
|
345
|
+
// ../core/lib/scroll-into-view.ts
|
|
346
|
+
init_react_import();
|
|
347
|
+
var scrollIntoView = (el) => {
|
|
348
|
+
const oldStyle = __spreadValues({}, el.style);
|
|
349
|
+
el.style.scrollMargin = "256px";
|
|
350
|
+
if (el) {
|
|
351
|
+
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
|
352
|
+
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
// ../core/lib/get-frame.ts
|
|
357
|
+
init_react_import();
|
|
358
|
+
var getFrame = () => {
|
|
359
|
+
if (typeof window === "undefined") return;
|
|
360
|
+
let frameEl = document.querySelector("#preview-frame");
|
|
361
|
+
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
|
362
|
+
return frameEl.contentDocument || document;
|
|
363
|
+
}
|
|
364
|
+
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
|
365
|
+
};
|
|
366
|
+
|
|
346
367
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
|
347
368
|
init_react_import();
|
|
348
369
|
|
|
@@ -430,15 +451,29 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
|
430
451
|
return Component;
|
|
431
452
|
};
|
|
432
453
|
|
|
433
|
-
// ../../node_modules/lucide-react/dist/esm/icons/
|
|
454
|
+
// ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
|
|
434
455
|
init_react_import();
|
|
435
|
-
var
|
|
436
|
-
["path", { d: "
|
|
456
|
+
var Heading1 = createLucideIcon("Heading1", [
|
|
457
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
|
458
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
|
459
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
460
|
+
["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
|
|
437
461
|
]);
|
|
438
462
|
|
|
439
|
-
// ../core/lib/
|
|
463
|
+
// ../core/lib/index.ts
|
|
464
|
+
init_react_import();
|
|
465
|
+
|
|
466
|
+
// ../core/lib/filter.ts
|
|
467
|
+
init_react_import();
|
|
468
|
+
|
|
469
|
+
// ../core/lib/data/reorder.ts
|
|
470
|
+
init_react_import();
|
|
471
|
+
|
|
472
|
+
// ../core/lib/data/replace.ts
|
|
473
|
+
init_react_import();
|
|
474
|
+
|
|
475
|
+
// ../core/lib/use-reset-auto-zoom.ts
|
|
440
476
|
init_react_import();
|
|
441
|
-
var import_react10 = require("react");
|
|
442
477
|
|
|
443
478
|
// ../core/store/index.ts
|
|
444
479
|
init_react_import();
|
|
@@ -621,12 +656,12 @@ var walkObject = ({
|
|
|
621
656
|
}
|
|
622
657
|
return flatten(newProps);
|
|
623
658
|
};
|
|
624
|
-
function mapFields(item, mappers, config, recurseSlots = false) {
|
|
659
|
+
function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true) {
|
|
625
660
|
var _a, _b, _c, _d, _e;
|
|
626
661
|
const itemType = "type" in item ? item.type : "root";
|
|
627
662
|
const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
|
|
628
663
|
const newProps = walkObject({
|
|
629
|
-
value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
|
|
664
|
+
value: shouldDefaultSlots ? defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}) : item.props,
|
|
630
665
|
fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
|
|
631
666
|
mappers,
|
|
632
667
|
id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
|
|
@@ -656,9 +691,28 @@ var stripSlots = (data, config) => {
|
|
|
656
691
|
|
|
657
692
|
// ../core/lib/data/flatten-node.ts
|
|
658
693
|
var { flatten: flatten2, unflatten } = import_flat.default;
|
|
694
|
+
function isEmptyArrayOrObject(val) {
|
|
695
|
+
if (Array.isArray(val)) {
|
|
696
|
+
return val.length === 0;
|
|
697
|
+
}
|
|
698
|
+
if (val != null && Object.prototype.toString.call(val) === "[object Object]") {
|
|
699
|
+
return Object.keys(val).length === 0;
|
|
700
|
+
}
|
|
701
|
+
return false;
|
|
702
|
+
}
|
|
703
|
+
function stripEmptyObjects(props) {
|
|
704
|
+
const result = {};
|
|
705
|
+
for (const key in props) {
|
|
706
|
+
if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
|
|
707
|
+
const val = props[key];
|
|
708
|
+
if (isEmptyArrayOrObject(val)) continue;
|
|
709
|
+
result[key] = val;
|
|
710
|
+
}
|
|
711
|
+
return result;
|
|
712
|
+
}
|
|
659
713
|
var flattenNode = (node, config) => {
|
|
660
714
|
return __spreadProps(__spreadValues({}, node), {
|
|
661
|
-
props: flatten2(stripSlots(node, config).props)
|
|
715
|
+
props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
|
|
662
716
|
});
|
|
663
717
|
};
|
|
664
718
|
|
|
@@ -1006,7 +1060,9 @@ var replaceAction = (state, action, appStore) => {
|
|
|
1006
1060
|
});
|
|
1007
1061
|
});
|
|
1008
1062
|
});
|
|
1009
|
-
const stateWithDeepSlotsRemoved = __spreadValues({}, state)
|
|
1063
|
+
const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
|
|
1064
|
+
ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
|
|
1065
|
+
});
|
|
1010
1066
|
Object.keys(state.indexes.zones).forEach((zoneCompound) => {
|
|
1011
1067
|
const id = zoneCompound.split(":")[0];
|
|
1012
1068
|
if (id === originalId) {
|
|
@@ -1408,7 +1464,8 @@ init_react_import();
|
|
|
1408
1464
|
var defaultViewports = [
|
|
1409
1465
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
|
1410
1466
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
|
1411
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
|
1467
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" },
|
|
1468
|
+
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
|
1412
1469
|
];
|
|
1413
1470
|
|
|
1414
1471
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
|
@@ -1518,9 +1575,9 @@ function debounce(func, timeout = 300) {
|
|
|
1518
1575
|
var tidyState = (state) => {
|
|
1519
1576
|
return __spreadProps(__spreadValues({}, state), {
|
|
1520
1577
|
ui: __spreadProps(__spreadValues({}, state.ui), {
|
|
1521
|
-
field: {
|
|
1578
|
+
field: __spreadProps(__spreadValues({}, state.ui.field), {
|
|
1522
1579
|
focus: null
|
|
1523
|
-
}
|
|
1580
|
+
})
|
|
1524
1581
|
})
|
|
1525
1582
|
});
|
|
1526
1583
|
};
|
|
@@ -2214,15 +2271,34 @@ var createFieldsSlice = (_set, _get) => {
|
|
|
2214
2271
|
|
|
2215
2272
|
// ../core/lib/resolve-component-data.ts
|
|
2216
2273
|
init_react_import();
|
|
2274
|
+
|
|
2275
|
+
// ../core/lib/data/to-component.ts
|
|
2276
|
+
init_react_import();
|
|
2277
|
+
var toComponent = (item) => {
|
|
2278
|
+
return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
|
|
2279
|
+
props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
|
|
2280
|
+
type: "root"
|
|
2281
|
+
});
|
|
2282
|
+
};
|
|
2283
|
+
|
|
2284
|
+
// ../core/lib/resolve-component-data.ts
|
|
2217
2285
|
var cache = { lastChange: {} };
|
|
2218
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
|
2286
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null) {
|
|
2219
2287
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
2220
2288
|
const resolvedItem = __spreadValues({}, item);
|
|
2221
2289
|
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
2222
2290
|
const id = "id" in item.props ? item.props.id : "root";
|
|
2223
2291
|
if (shouldRunResolver) {
|
|
2224
|
-
const {
|
|
2225
|
-
|
|
2292
|
+
const {
|
|
2293
|
+
item: oldItem = null,
|
|
2294
|
+
resolved = {},
|
|
2295
|
+
parentId: oldParentId = null
|
|
2296
|
+
} = cache.lastChange[id] || {};
|
|
2297
|
+
const isRootOrInserted = oldParentId === null;
|
|
2298
|
+
const parentChanged = !isRootOrInserted && (parent == null ? void 0 : parent.props.id) !== oldParentId;
|
|
2299
|
+
const dataChanged = item && !deepEqual(item, oldItem);
|
|
2300
|
+
const shouldSkip = trigger === "move" && !parentChanged || trigger !== "move" && trigger !== "force" && !dataChanged;
|
|
2301
|
+
if (shouldSkip) {
|
|
2226
2302
|
return { node: resolved, didChange: false };
|
|
2227
2303
|
}
|
|
2228
2304
|
const changed = getChanged(item, oldItem);
|
|
@@ -2233,13 +2309,15 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2233
2309
|
changed,
|
|
2234
2310
|
lastData: oldItem,
|
|
2235
2311
|
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
|
2236
|
-
trigger
|
|
2312
|
+
trigger,
|
|
2313
|
+
parent
|
|
2237
2314
|
});
|
|
2238
2315
|
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
|
2239
2316
|
if (Object.keys(readOnly).length) {
|
|
2240
2317
|
resolvedItem.readOnly = readOnly;
|
|
2241
2318
|
}
|
|
2242
2319
|
}
|
|
2320
|
+
const itemAsComponentData = toComponent(resolvedItem);
|
|
2243
2321
|
let itemWithResolvedChildren = yield mapFields(
|
|
2244
2322
|
resolvedItem,
|
|
2245
2323
|
{
|
|
@@ -2254,7 +2332,8 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2254
2332
|
metadata,
|
|
2255
2333
|
onResolveStart,
|
|
2256
2334
|
onResolveEnd,
|
|
2257
|
-
trigger
|
|
2335
|
+
trigger,
|
|
2336
|
+
itemAsComponentData
|
|
2258
2337
|
)).node;
|
|
2259
2338
|
})
|
|
2260
2339
|
)
|
|
@@ -2268,7 +2347,8 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2268
2347
|
}
|
|
2269
2348
|
cache.lastChange[id] = {
|
|
2270
2349
|
item,
|
|
2271
|
-
resolved: itemWithResolvedChildren
|
|
2350
|
+
resolved: itemWithResolvedChildren,
|
|
2351
|
+
parentId: parent == null ? void 0 : parent.props.id
|
|
2272
2352
|
};
|
|
2273
2353
|
return {
|
|
2274
2354
|
node: itemWithResolvedChildren,
|
|
@@ -2313,7 +2393,8 @@ var defaultAppState = {
|
|
|
2313
2393
|
options: [],
|
|
2314
2394
|
controlsVisible: true
|
|
2315
2395
|
},
|
|
2316
|
-
field: { focus: null }
|
|
2396
|
+
field: { focus: null },
|
|
2397
|
+
plugin: { current: null }
|
|
2317
2398
|
},
|
|
2318
2399
|
indexes: {
|
|
2319
2400
|
nodes: {},
|
|
@@ -2329,6 +2410,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2329
2410
|
subscribeWithSelector((set, get) => {
|
|
2330
2411
|
var _a, _b;
|
|
2331
2412
|
return __spreadProps(__spreadValues({
|
|
2413
|
+
instanceId: generateId(),
|
|
2332
2414
|
state: defaultAppState,
|
|
2333
2415
|
config: { components: {} },
|
|
2334
2416
|
componentState: {},
|
|
@@ -2349,6 +2431,11 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2349
2431
|
history: createHistorySlice(set, get),
|
|
2350
2432
|
nodes: createNodesSlice(set, get),
|
|
2351
2433
|
permissions: createPermissionsSlice(set, get),
|
|
2434
|
+
getCurrentData: () => {
|
|
2435
|
+
var _a2;
|
|
2436
|
+
const s = get();
|
|
2437
|
+
return (_a2 = s.selectedItem) != null ? _a2 : s.state.data.root;
|
|
2438
|
+
},
|
|
2352
2439
|
getComponentConfig: (type) => {
|
|
2353
2440
|
var _a2;
|
|
2354
2441
|
const { config, selectedItem } = get();
|
|
@@ -2438,7 +2525,12 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2438
2525
|
return __spreadProps(__spreadValues({}, s), { state, selectedItem });
|
|
2439
2526
|
}),
|
|
2440
2527
|
resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
|
|
2441
|
-
|
|
2528
|
+
var _a2, _b2;
|
|
2529
|
+
const { config, metadata, setComponentLoading, permissions, state } = get();
|
|
2530
|
+
const componentId = "id" in componentData.props ? componentData.props.id : "root";
|
|
2531
|
+
const parentId = (_a2 = state.indexes.nodes[componentId]) == null ? void 0 : _a2.parentId;
|
|
2532
|
+
const parentNode = parentId ? state.indexes.nodes[parentId] : null;
|
|
2533
|
+
const parentData = (_b2 = parentNode == null ? void 0 : parentNode.data) != null ? _b2 : null;
|
|
2442
2534
|
const timeouts = {};
|
|
2443
2535
|
return yield resolveComponentData(
|
|
2444
2536
|
componentData,
|
|
@@ -2457,7 +2549,8 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2457
2549
|
}
|
|
2458
2550
|
timeouts[id]();
|
|
2459
2551
|
}),
|
|
2460
|
-
trigger
|
|
2552
|
+
trigger,
|
|
2553
|
+
parentData
|
|
2461
2554
|
);
|
|
2462
2555
|
}),
|
|
2463
2556
|
resolveAndCommitData: () => __async(null, null, function* () {
|
|
@@ -2499,203 +2592,14 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2499
2592
|
})
|
|
2500
2593
|
);
|
|
2501
2594
|
var appStoreContext = (0, import_react9.createContext)(createAppStore());
|
|
2502
|
-
function useAppStore(selector) {
|
|
2503
|
-
const context = (0, import_react9.useContext)(appStoreContext);
|
|
2504
|
-
return useStore(context, selector);
|
|
2505
|
-
}
|
|
2506
|
-
function useAppStoreApi() {
|
|
2507
|
-
return (0, import_react9.useContext)(appStoreContext);
|
|
2508
|
-
}
|
|
2509
|
-
|
|
2510
|
-
// ../core/lib/use-breadcrumbs.ts
|
|
2511
|
-
var useBreadcrumbs = (renderCount) => {
|
|
2512
|
-
const selectedId = useAppStore((s) => {
|
|
2513
|
-
var _a;
|
|
2514
|
-
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
|
2515
|
-
});
|
|
2516
|
-
const config = useAppStore((s) => s.config);
|
|
2517
|
-
const path = useAppStore((s) => {
|
|
2518
|
-
var _a;
|
|
2519
|
-
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
|
2520
|
-
});
|
|
2521
|
-
const appStore = useAppStoreApi();
|
|
2522
|
-
return (0, import_react10.useMemo)(() => {
|
|
2523
|
-
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
|
2524
|
-
var _a, _b, _c;
|
|
2525
|
-
const [componentId] = zoneCompound.split(":");
|
|
2526
|
-
if (componentId === "root") {
|
|
2527
|
-
return {
|
|
2528
|
-
label: "Page",
|
|
2529
|
-
selector: null
|
|
2530
|
-
};
|
|
2531
|
-
}
|
|
2532
|
-
const node = appStore.getState().state.indexes.nodes[componentId];
|
|
2533
|
-
const parentId = node.path[node.path.length - 1];
|
|
2534
|
-
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
|
2535
|
-
const index = contentIds.indexOf(componentId);
|
|
2536
|
-
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
|
2537
|
-
return {
|
|
2538
|
-
label,
|
|
2539
|
-
selector: node ? {
|
|
2540
|
-
index,
|
|
2541
|
-
zone: node.path[node.path.length - 1]
|
|
2542
|
-
} : null
|
|
2543
|
-
};
|
|
2544
|
-
})) || [];
|
|
2545
|
-
if (renderCount) {
|
|
2546
|
-
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
|
2547
|
-
}
|
|
2548
|
-
return breadcrumbs;
|
|
2549
|
-
}, [path, renderCount]);
|
|
2550
|
-
};
|
|
2551
|
-
|
|
2552
|
-
// ../core/components/Loader/index.tsx
|
|
2553
|
-
init_react_import();
|
|
2554
|
-
|
|
2555
|
-
// ../core/lib/index.ts
|
|
2556
|
-
init_react_import();
|
|
2557
|
-
|
|
2558
|
-
// ../core/lib/filter.ts
|
|
2559
|
-
init_react_import();
|
|
2560
|
-
|
|
2561
|
-
// ../core/lib/data/reorder.ts
|
|
2562
|
-
init_react_import();
|
|
2563
|
-
|
|
2564
|
-
// ../core/lib/data/replace.ts
|
|
2565
|
-
init_react_import();
|
|
2566
|
-
|
|
2567
|
-
// ../core/lib/use-reset-auto-zoom.ts
|
|
2568
|
-
init_react_import();
|
|
2569
2595
|
|
|
2570
2596
|
// ../core/lib/get-zoom-config.ts
|
|
2571
2597
|
init_react_import();
|
|
2572
2598
|
|
|
2573
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
|
2574
|
-
init_react_import();
|
|
2575
|
-
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
|
2576
|
-
|
|
2577
|
-
// ../core/components/Loader/index.tsx
|
|
2578
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
2579
|
-
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
|
2580
|
-
var Loader = (_a) => {
|
|
2581
|
-
var _b = _a, {
|
|
2582
|
-
color,
|
|
2583
|
-
size = 16
|
|
2584
|
-
} = _b, props = __objRest(_b, [
|
|
2585
|
-
"color",
|
|
2586
|
-
"size"
|
|
2587
|
-
]);
|
|
2588
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2589
|
-
"span",
|
|
2590
|
-
__spreadValues({
|
|
2591
|
-
className: getClassName2(),
|
|
2592
|
-
style: {
|
|
2593
|
-
width: size,
|
|
2594
|
-
height: size,
|
|
2595
|
-
color
|
|
2596
|
-
},
|
|
2597
|
-
"aria-label": "loading"
|
|
2598
|
-
}, props)
|
|
2599
|
-
);
|
|
2600
|
-
};
|
|
2601
|
-
|
|
2602
|
-
// ../core/components/SidebarSection/index.tsx
|
|
2603
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2604
|
-
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
|
2605
|
-
var SidebarSection = ({
|
|
2606
|
-
children,
|
|
2607
|
-
title,
|
|
2608
|
-
background,
|
|
2609
|
-
showBreadcrumbs,
|
|
2610
|
-
noBorderTop,
|
|
2611
|
-
noPadding,
|
|
2612
|
-
isLoading
|
|
2613
|
-
}) => {
|
|
2614
|
-
const setUi = useAppStore((s) => s.setUi);
|
|
2615
|
-
const breadcrumbs = useBreadcrumbs(1);
|
|
2616
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2617
|
-
"div",
|
|
2618
|
-
{
|
|
2619
|
-
className: getClassName3({ noBorderTop, noPadding }),
|
|
2620
|
-
style: { background },
|
|
2621
|
-
children: [
|
|
2622
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
|
|
2623
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
|
|
2624
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2625
|
-
"button",
|
|
2626
|
-
{
|
|
2627
|
-
type: "button",
|
|
2628
|
-
className: getClassName3("breadcrumbLabel"),
|
|
2629
|
-
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
|
2630
|
-
children: breadcrumb.label
|
|
2631
|
-
}
|
|
2632
|
-
),
|
|
2633
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, { size: 16 })
|
|
2634
|
-
] }, i)) : null,
|
|
2635
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
|
2636
|
-
] }) }),
|
|
2637
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("content"), children }),
|
|
2638
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 32 }) })
|
|
2639
|
-
]
|
|
2640
|
-
}
|
|
2641
|
-
);
|
|
2642
|
-
};
|
|
2643
|
-
|
|
2644
|
-
// ../core/components/OutlineList/index.tsx
|
|
2645
|
-
init_react_import();
|
|
2646
|
-
|
|
2647
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
|
2648
|
-
init_react_import();
|
|
2649
|
-
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
|
2650
|
-
|
|
2651
|
-
// ../core/components/OutlineList/index.tsx
|
|
2652
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2653
|
-
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
|
2654
|
-
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
|
2655
|
-
var OutlineList = ({ children }) => {
|
|
2656
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: getClassName4(), children });
|
|
2657
|
-
};
|
|
2658
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
|
|
2659
|
-
OutlineList.Item = ({
|
|
2660
|
-
children,
|
|
2661
|
-
onClick
|
|
2662
|
-
}) => {
|
|
2663
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2664
|
-
"li",
|
|
2665
|
-
{
|
|
2666
|
-
className: getClassNameItem({ clickable: !!onClick }),
|
|
2667
|
-
onClick,
|
|
2668
|
-
children
|
|
2669
|
-
}
|
|
2670
|
-
);
|
|
2671
|
-
};
|
|
2672
|
-
|
|
2673
|
-
// ../core/lib/scroll-into-view.ts
|
|
2674
|
-
init_react_import();
|
|
2675
|
-
var scrollIntoView = (el) => {
|
|
2676
|
-
const oldStyle = __spreadValues({}, el.style);
|
|
2677
|
-
el.style.scrollMargin = "256px";
|
|
2678
|
-
if (el) {
|
|
2679
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
|
2680
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
|
2681
|
-
}
|
|
2682
|
-
};
|
|
2683
|
-
|
|
2684
|
-
// ../core/lib/get-frame.ts
|
|
2685
|
-
init_react_import();
|
|
2686
|
-
var getFrame = () => {
|
|
2687
|
-
if (typeof window === "undefined") return;
|
|
2688
|
-
let frameEl = document.querySelector("#preview-frame");
|
|
2689
|
-
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
|
2690
|
-
return frameEl.contentDocument || document;
|
|
2691
|
-
}
|
|
2692
|
-
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
|
2693
|
-
};
|
|
2694
|
-
|
|
2695
2599
|
// src/HeadingAnalyzer.tsx
|
|
2696
2600
|
var import_react_from_json = __toESM(require("react-from-json"));
|
|
2697
|
-
var
|
|
2698
|
-
var
|
|
2601
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
2602
|
+
var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
|
2699
2603
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
|
2700
2604
|
var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
|
|
2701
2605
|
var getOutline = ({ frame } = {}) => {
|
|
@@ -2750,8 +2654,8 @@ function buildHierarchy(frame) {
|
|
|
2750
2654
|
var usePuck = (0, import_puck.createUsePuck)();
|
|
2751
2655
|
var HeadingAnalyzer = () => {
|
|
2752
2656
|
const data = usePuck((s) => s.appState.data);
|
|
2753
|
-
const [hierarchy, setHierarchy] = (0,
|
|
2754
|
-
(0,
|
|
2657
|
+
const [hierarchy, setHierarchy] = (0, import_react10.useState)([]);
|
|
2658
|
+
(0, import_react10.useEffect)(() => {
|
|
2755
2659
|
const frame = getFrame();
|
|
2756
2660
|
let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
|
|
2757
2661
|
const createHierarchy = () => {
|
|
@@ -2786,11 +2690,11 @@ var HeadingAnalyzer = () => {
|
|
|
2786
2690
|
frameObserver.disconnect();
|
|
2787
2691
|
};
|
|
2788
2692
|
}, [data]);
|
|
2789
|
-
return /* @__PURE__ */ (0,
|
|
2790
|
-
/* @__PURE__ */ (0,
|
|
2693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: getClassName2(), children: [
|
|
2694
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2791
2695
|
"small",
|
|
2792
2696
|
{
|
|
2793
|
-
className:
|
|
2697
|
+
className: getClassName2("cssWarning"),
|
|
2794
2698
|
style: {
|
|
2795
2699
|
color: "var(--puck-color-red-04)",
|
|
2796
2700
|
display: "block",
|
|
@@ -2799,19 +2703,19 @@ var HeadingAnalyzer = () => {
|
|
|
2799
2703
|
children: [
|
|
2800
2704
|
"Heading analyzer styles not loaded. Please review the",
|
|
2801
2705
|
" ",
|
|
2802
|
-
/* @__PURE__ */ (0,
|
|
2706
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
|
2803
2707
|
"."
|
|
2804
2708
|
]
|
|
2805
2709
|
}
|
|
2806
2710
|
),
|
|
2807
|
-
hierarchy.length === 0 && /* @__PURE__ */ (0,
|
|
2808
|
-
/* @__PURE__ */ (0,
|
|
2711
|
+
hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: "No headings." }),
|
|
2712
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2809
2713
|
ReactFromJSON,
|
|
2810
2714
|
{
|
|
2811
2715
|
mapping: {
|
|
2812
|
-
Root: (props) => /* @__PURE__ */ (0,
|
|
2813
|
-
OutlineListItem: (props) => /* @__PURE__ */ (0,
|
|
2814
|
-
/* @__PURE__ */ (0,
|
|
2716
|
+
Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: props.children }),
|
|
2717
|
+
OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(OutlineList.Item, { children: [
|
|
2718
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2815
2719
|
"small",
|
|
2816
2720
|
{
|
|
2817
2721
|
className: getClassNameItem2({ missing: props.missing }),
|
|
@@ -2829,14 +2733,14 @@ var HeadingAnalyzer = () => {
|
|
|
2829
2733
|
}, 2e3);
|
|
2830
2734
|
}
|
|
2831
2735
|
},
|
|
2832
|
-
children: props.missing ? /* @__PURE__ */ (0,
|
|
2833
|
-
/* @__PURE__ */ (0,
|
|
2736
|
+
children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
2737
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
|
|
2834
2738
|
"H",
|
|
2835
2739
|
props.rank
|
|
2836
2740
|
] }),
|
|
2837
2741
|
": Missing"
|
|
2838
|
-
] }) : /* @__PURE__ */ (0,
|
|
2839
|
-
/* @__PURE__ */ (0,
|
|
2742
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
2743
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
|
|
2840
2744
|
"H",
|
|
2841
2745
|
props.rank
|
|
2842
2746
|
] }),
|
|
@@ -2845,7 +2749,7 @@ var HeadingAnalyzer = () => {
|
|
|
2845
2749
|
] })
|
|
2846
2750
|
}
|
|
2847
2751
|
) }),
|
|
2848
|
-
/* @__PURE__ */ (0,
|
|
2752
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: props.children })
|
|
2849
2753
|
] })
|
|
2850
2754
|
},
|
|
2851
2755
|
entry: {
|
|
@@ -2866,12 +2770,10 @@ var HeadingAnalyzer = () => {
|
|
|
2866
2770
|
] });
|
|
2867
2771
|
};
|
|
2868
2772
|
var headingAnalyzer = {
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
] })
|
|
2874
|
-
}
|
|
2773
|
+
name: "heading-analyzer",
|
|
2774
|
+
label: "Audit",
|
|
2775
|
+
render: HeadingAnalyzer,
|
|
2776
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Heading1, {})
|
|
2875
2777
|
};
|
|
2876
2778
|
var HeadingAnalyzer_default = headingAnalyzer;
|
|
2877
2779
|
/*! Bundled license information:
|
|
@@ -2887,7 +2789,7 @@ lucide-react/dist/esm/shared/src/utils.js:
|
|
|
2887
2789
|
lucide-react/dist/esm/defaultAttributes.js:
|
|
2888
2790
|
lucide-react/dist/esm/Icon.js:
|
|
2889
2791
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
2890
|
-
lucide-react/dist/esm/icons/
|
|
2792
|
+
lucide-react/dist/esm/icons/heading-1.js:
|
|
2891
2793
|
lucide-react/dist/esm/lucide-react.js:
|
|
2892
2794
|
(**
|
|
2893
2795
|
* @license lucide-react v0.468.0 - ISC
|