@measured/puck-plugin-heading-analyzer 0.21.0-canary.f3ce0d72 → 0.21.0-canary.fee2ba98
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 +149 -5
- package/dist/index.d.mts +214 -22
- package/dist/index.d.ts +214 -22
- package/dist/index.js +272 -103
- package/dist/index.mjs +269 -100
- 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_react11 = 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_116v6_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_116v6_5", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_116v6_9", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_116v6_13" };
|
|
285
285
|
|
|
286
286
|
// src/HeadingAnalyzer.tsx
|
|
287
287
|
var import_puck = require("@measured/puck");
|
|
288
288
|
|
|
289
|
-
// ../core/components/
|
|
289
|
+
// ../core/components/SidebarSection/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/SidebarSection/styles.module.css#css-module
|
|
293
293
|
init_react_import();
|
|
294
|
-
var styles_module_default = { "
|
|
294
|
+
var styles_module_default = { "SidebarSection": "_SidebarSection_8boj8_1", "SidebarSection-title": "_SidebarSection-title_8boj8_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_8boj8_20", "SidebarSection-content": "_SidebarSection-content_8boj8_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_8boj8_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_8boj8_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_8boj8_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_8boj8_41", "SidebarSection-heading": "_SidebarSection-heading_8boj8_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_8boj8_86" };
|
|
295
295
|
|
|
296
296
|
// ../core/lib/get-class-name-factory.ts
|
|
297
297
|
init_react_import();
|
|
@@ -320,50 +320,29 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
|
|
|
320
320
|
};
|
|
321
321
|
var get_class_name_factory_default = getClassNameFactory;
|
|
322
322
|
|
|
323
|
-
// ../core/components/
|
|
323
|
+
// ../core/components/Heading/index.tsx
|
|
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
|
|
324
331
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
325
|
-
var getClassName = get_class_name_factory_default("
|
|
326
|
-
var
|
|
327
|
-
|
|
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
|
-
}) => {
|
|
332
|
+
var getClassName = get_class_name_factory_default("Heading", styles_module_default2);
|
|
333
|
+
var Heading = ({ children, rank, size = "m" }) => {
|
|
334
|
+
const Tag = rank ? `h${rank}` : "span";
|
|
335
335
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
336
|
-
|
|
336
|
+
Tag,
|
|
337
337
|
{
|
|
338
|
-
className:
|
|
339
|
-
|
|
338
|
+
className: getClassName({
|
|
339
|
+
[size]: true
|
|
340
|
+
}),
|
|
340
341
|
children
|
|
341
342
|
}
|
|
342
343
|
);
|
|
343
344
|
};
|
|
344
345
|
|
|
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
|
-
|
|
367
346
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
|
368
347
|
init_react_import();
|
|
369
348
|
|
|
@@ -451,29 +430,15 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
|
451
430
|
return Component;
|
|
452
431
|
};
|
|
453
432
|
|
|
454
|
-
// ../../node_modules/lucide-react/dist/esm/icons/
|
|
433
|
+
// ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
|
455
434
|
init_react_import();
|
|
456
|
-
var
|
|
457
|
-
["path", { d: "
|
|
458
|
-
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
|
459
|
-
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
460
|
-
["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
|
|
435
|
+
var ChevronRight = createLucideIcon("ChevronRight", [
|
|
436
|
+
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
|
461
437
|
]);
|
|
462
438
|
|
|
463
|
-
// ../core/lib/
|
|
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
|
|
439
|
+
// ../core/lib/use-breadcrumbs.ts
|
|
476
440
|
init_react_import();
|
|
441
|
+
var import_react10 = require("react");
|
|
477
442
|
|
|
478
443
|
// ../core/store/index.ts
|
|
479
444
|
init_react_import();
|
|
@@ -1041,7 +1006,9 @@ var replaceAction = (state, action, appStore) => {
|
|
|
1041
1006
|
});
|
|
1042
1007
|
});
|
|
1043
1008
|
});
|
|
1044
|
-
const stateWithDeepSlotsRemoved = __spreadValues({}, state)
|
|
1009
|
+
const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
|
|
1010
|
+
ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
|
|
1011
|
+
});
|
|
1045
1012
|
Object.keys(state.indexes.zones).forEach((zoneCompound) => {
|
|
1046
1013
|
const id = zoneCompound.split(":")[0];
|
|
1047
1014
|
if (id === originalId) {
|
|
@@ -1443,8 +1410,7 @@ init_react_import();
|
|
|
1443
1410
|
var defaultViewports = [
|
|
1444
1411
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
|
1445
1412
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
|
1446
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
|
1447
|
-
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
|
1413
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
|
1448
1414
|
];
|
|
1449
1415
|
|
|
1450
1416
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
|
@@ -1554,9 +1520,9 @@ function debounce(func, timeout = 300) {
|
|
|
1554
1520
|
var tidyState = (state) => {
|
|
1555
1521
|
return __spreadProps(__spreadValues({}, state), {
|
|
1556
1522
|
ui: __spreadProps(__spreadValues({}, state.ui), {
|
|
1557
|
-
field: {
|
|
1523
|
+
field: __spreadProps(__spreadValues({}, state.ui.field), {
|
|
1558
1524
|
focus: null
|
|
1559
|
-
}
|
|
1525
|
+
})
|
|
1560
1526
|
})
|
|
1561
1527
|
});
|
|
1562
1528
|
};
|
|
@@ -2126,26 +2092,34 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2126
2092
|
const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
|
|
2127
2093
|
const { state, permissions, config } = get();
|
|
2128
2094
|
const { cache: cache2, globalPermissions } = permissions;
|
|
2129
|
-
const
|
|
2130
|
-
var _a, _b
|
|
2095
|
+
const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
|
|
2096
|
+
var _a, _b;
|
|
2131
2097
|
const { config: config2, state: appState, setComponentLoading } = get();
|
|
2098
|
+
const itemCache = cache2[item2.props.id];
|
|
2099
|
+
const nodes = appState.indexes.nodes;
|
|
2100
|
+
const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
|
|
2101
|
+
const parentNode = parentId ? nodes[parentId] : null;
|
|
2102
|
+
const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
|
|
2132
2103
|
const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
|
|
2133
2104
|
if (!componentConfig) {
|
|
2134
2105
|
return;
|
|
2135
2106
|
}
|
|
2136
2107
|
const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
|
|
2137
2108
|
if (componentConfig.resolvePermissions) {
|
|
2138
|
-
const changed = getChanged(item2,
|
|
2139
|
-
|
|
2109
|
+
const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
|
|
2110
|
+
const propsChanged = Object.values(changed).some((el) => el === true);
|
|
2111
|
+
const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
|
|
2112
|
+
if (propsChanged || parentChanged || force2) {
|
|
2140
2113
|
const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
|
|
2141
2114
|
const resolvedPermissions = yield componentConfig.resolvePermissions(
|
|
2142
2115
|
item2,
|
|
2143
2116
|
{
|
|
2144
2117
|
changed,
|
|
2145
|
-
lastPermissions: (
|
|
2118
|
+
lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
|
|
2146
2119
|
permissions: initialPermissions,
|
|
2147
2120
|
appState: makeStatePublic(appState),
|
|
2148
|
-
lastData: (
|
|
2121
|
+
lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
|
|
2122
|
+
parent: parentData
|
|
2149
2123
|
}
|
|
2150
2124
|
);
|
|
2151
2125
|
const latest = get().permissions;
|
|
@@ -2153,6 +2127,7 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2153
2127
|
permissions: __spreadProps(__spreadValues({}, latest), {
|
|
2154
2128
|
cache: __spreadProps(__spreadValues({}, latest.cache), {
|
|
2155
2129
|
[item2.props.id]: {
|
|
2130
|
+
lastParentId: parentId,
|
|
2156
2131
|
lastData: item2,
|
|
2157
2132
|
lastPermissions: resolvedPermissions
|
|
2158
2133
|
}
|
|
@@ -2166,9 +2141,9 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2166
2141
|
}
|
|
2167
2142
|
}
|
|
2168
2143
|
});
|
|
2169
|
-
const
|
|
2144
|
+
const resolvePermissionsForRoot = (force2 = false) => {
|
|
2170
2145
|
const { state: appState } = get();
|
|
2171
|
-
|
|
2146
|
+
resolvePermissionsForItem(
|
|
2172
2147
|
// Shim the root data in by conforming to component data shape
|
|
2173
2148
|
{
|
|
2174
2149
|
type: "root",
|
|
@@ -2179,16 +2154,16 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2179
2154
|
};
|
|
2180
2155
|
const { item, type, root } = params;
|
|
2181
2156
|
if (item) {
|
|
2182
|
-
yield
|
|
2157
|
+
yield resolvePermissionsForItem(item, force);
|
|
2183
2158
|
} else if (type) {
|
|
2184
2159
|
flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
|
|
2185
|
-
yield
|
|
2160
|
+
yield resolvePermissionsForItem(item2, force);
|
|
2186
2161
|
}));
|
|
2187
2162
|
} else if (root) {
|
|
2188
|
-
|
|
2163
|
+
resolvePermissionsForRoot(force);
|
|
2189
2164
|
} else {
|
|
2190
2165
|
flattenData(state, config).map((item2) => __async(null, null, function* () {
|
|
2191
|
-
yield
|
|
2166
|
+
yield resolvePermissionsForItem(item2, force);
|
|
2192
2167
|
}));
|
|
2193
2168
|
}
|
|
2194
2169
|
});
|
|
@@ -2340,8 +2315,7 @@ var defaultAppState = {
|
|
|
2340
2315
|
options: [],
|
|
2341
2316
|
controlsVisible: true
|
|
2342
2317
|
},
|
|
2343
|
-
field: { focus: null }
|
|
2344
|
-
plugin: { current: null }
|
|
2318
|
+
field: { focus: null }
|
|
2345
2319
|
},
|
|
2346
2320
|
indexes: {
|
|
2347
2321
|
nodes: {},
|
|
@@ -2357,7 +2331,6 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2357
2331
|
subscribeWithSelector((set, get) => {
|
|
2358
2332
|
var _a, _b;
|
|
2359
2333
|
return __spreadProps(__spreadValues({
|
|
2360
|
-
instanceId: generateId(),
|
|
2361
2334
|
state: defaultAppState,
|
|
2362
2335
|
config: { components: {} },
|
|
2363
2336
|
componentState: {},
|
|
@@ -2378,6 +2351,11 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2378
2351
|
history: createHistorySlice(set, get),
|
|
2379
2352
|
nodes: createNodesSlice(set, get),
|
|
2380
2353
|
permissions: createPermissionsSlice(set, get),
|
|
2354
|
+
getCurrentData: () => {
|
|
2355
|
+
var _a2;
|
|
2356
|
+
const s = get();
|
|
2357
|
+
return (_a2 = s.selectedItem) != null ? _a2 : s.state.data.root;
|
|
2358
|
+
},
|
|
2381
2359
|
getComponentConfig: (type) => {
|
|
2382
2360
|
var _a2;
|
|
2383
2361
|
const { config, selectedItem } = get();
|
|
@@ -2528,14 +2506,203 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2528
2506
|
})
|
|
2529
2507
|
);
|
|
2530
2508
|
var appStoreContext = (0, import_react9.createContext)(createAppStore());
|
|
2509
|
+
function useAppStore(selector) {
|
|
2510
|
+
const context = (0, import_react9.useContext)(appStoreContext);
|
|
2511
|
+
return useStore(context, selector);
|
|
2512
|
+
}
|
|
2513
|
+
function useAppStoreApi() {
|
|
2514
|
+
return (0, import_react9.useContext)(appStoreContext);
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
// ../core/lib/use-breadcrumbs.ts
|
|
2518
|
+
var useBreadcrumbs = (renderCount) => {
|
|
2519
|
+
const selectedId = useAppStore((s) => {
|
|
2520
|
+
var _a;
|
|
2521
|
+
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
|
2522
|
+
});
|
|
2523
|
+
const config = useAppStore((s) => s.config);
|
|
2524
|
+
const path = useAppStore((s) => {
|
|
2525
|
+
var _a;
|
|
2526
|
+
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
|
2527
|
+
});
|
|
2528
|
+
const appStore = useAppStoreApi();
|
|
2529
|
+
return (0, import_react10.useMemo)(() => {
|
|
2530
|
+
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
|
2531
|
+
var _a, _b, _c;
|
|
2532
|
+
const [componentId] = zoneCompound.split(":");
|
|
2533
|
+
if (componentId === "root") {
|
|
2534
|
+
return {
|
|
2535
|
+
label: "Page",
|
|
2536
|
+
selector: null
|
|
2537
|
+
};
|
|
2538
|
+
}
|
|
2539
|
+
const node = appStore.getState().state.indexes.nodes[componentId];
|
|
2540
|
+
const parentId = node.path[node.path.length - 1];
|
|
2541
|
+
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
|
2542
|
+
const index = contentIds.indexOf(componentId);
|
|
2543
|
+
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
|
2544
|
+
return {
|
|
2545
|
+
label,
|
|
2546
|
+
selector: node ? {
|
|
2547
|
+
index,
|
|
2548
|
+
zone: node.path[node.path.length - 1]
|
|
2549
|
+
} : null
|
|
2550
|
+
};
|
|
2551
|
+
})) || [];
|
|
2552
|
+
if (renderCount) {
|
|
2553
|
+
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
|
2554
|
+
}
|
|
2555
|
+
return breadcrumbs;
|
|
2556
|
+
}, [path, renderCount]);
|
|
2557
|
+
};
|
|
2558
|
+
|
|
2559
|
+
// ../core/components/Loader/index.tsx
|
|
2560
|
+
init_react_import();
|
|
2561
|
+
|
|
2562
|
+
// ../core/lib/index.ts
|
|
2563
|
+
init_react_import();
|
|
2564
|
+
|
|
2565
|
+
// ../core/lib/filter.ts
|
|
2566
|
+
init_react_import();
|
|
2567
|
+
|
|
2568
|
+
// ../core/lib/data/reorder.ts
|
|
2569
|
+
init_react_import();
|
|
2570
|
+
|
|
2571
|
+
// ../core/lib/data/replace.ts
|
|
2572
|
+
init_react_import();
|
|
2573
|
+
|
|
2574
|
+
// ../core/lib/use-reset-auto-zoom.ts
|
|
2575
|
+
init_react_import();
|
|
2531
2576
|
|
|
2532
2577
|
// ../core/lib/get-zoom-config.ts
|
|
2533
2578
|
init_react_import();
|
|
2534
2579
|
|
|
2580
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
|
2581
|
+
init_react_import();
|
|
2582
|
+
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
|
2583
|
+
|
|
2584
|
+
// ../core/components/Loader/index.tsx
|
|
2585
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
2586
|
+
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
|
2587
|
+
var Loader = (_a) => {
|
|
2588
|
+
var _b = _a, {
|
|
2589
|
+
color,
|
|
2590
|
+
size = 16
|
|
2591
|
+
} = _b, props = __objRest(_b, [
|
|
2592
|
+
"color",
|
|
2593
|
+
"size"
|
|
2594
|
+
]);
|
|
2595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2596
|
+
"span",
|
|
2597
|
+
__spreadValues({
|
|
2598
|
+
className: getClassName2(),
|
|
2599
|
+
style: {
|
|
2600
|
+
width: size,
|
|
2601
|
+
height: size,
|
|
2602
|
+
color
|
|
2603
|
+
},
|
|
2604
|
+
"aria-label": "loading"
|
|
2605
|
+
}, props)
|
|
2606
|
+
);
|
|
2607
|
+
};
|
|
2608
|
+
|
|
2609
|
+
// ../core/components/SidebarSection/index.tsx
|
|
2610
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2611
|
+
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
|
2612
|
+
var SidebarSection = ({
|
|
2613
|
+
children,
|
|
2614
|
+
title,
|
|
2615
|
+
background,
|
|
2616
|
+
showBreadcrumbs,
|
|
2617
|
+
noBorderTop,
|
|
2618
|
+
noPadding,
|
|
2619
|
+
isLoading
|
|
2620
|
+
}) => {
|
|
2621
|
+
const setUi = useAppStore((s) => s.setUi);
|
|
2622
|
+
const breadcrumbs = useBreadcrumbs(1);
|
|
2623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2624
|
+
"div",
|
|
2625
|
+
{
|
|
2626
|
+
className: getClassName3({ noBorderTop, noPadding }),
|
|
2627
|
+
style: { background },
|
|
2628
|
+
children: [
|
|
2629
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
|
|
2630
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
|
|
2631
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2632
|
+
"button",
|
|
2633
|
+
{
|
|
2634
|
+
type: "button",
|
|
2635
|
+
className: getClassName3("breadcrumbLabel"),
|
|
2636
|
+
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
|
2637
|
+
children: breadcrumb.label
|
|
2638
|
+
}
|
|
2639
|
+
),
|
|
2640
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, { size: 16 })
|
|
2641
|
+
] }, i)) : null,
|
|
2642
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
|
2643
|
+
] }) }),
|
|
2644
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("content"), children }),
|
|
2645
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 32 }) })
|
|
2646
|
+
]
|
|
2647
|
+
}
|
|
2648
|
+
);
|
|
2649
|
+
};
|
|
2650
|
+
|
|
2651
|
+
// ../core/components/OutlineList/index.tsx
|
|
2652
|
+
init_react_import();
|
|
2653
|
+
|
|
2654
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
|
2655
|
+
init_react_import();
|
|
2656
|
+
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
|
2657
|
+
|
|
2658
|
+
// ../core/components/OutlineList/index.tsx
|
|
2659
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2660
|
+
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
|
2661
|
+
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
|
2662
|
+
var OutlineList = ({ children }) => {
|
|
2663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: getClassName4(), children });
|
|
2664
|
+
};
|
|
2665
|
+
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
|
|
2666
|
+
OutlineList.Item = ({
|
|
2667
|
+
children,
|
|
2668
|
+
onClick
|
|
2669
|
+
}) => {
|
|
2670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2671
|
+
"li",
|
|
2672
|
+
{
|
|
2673
|
+
className: getClassNameItem({ clickable: !!onClick }),
|
|
2674
|
+
onClick,
|
|
2675
|
+
children
|
|
2676
|
+
}
|
|
2677
|
+
);
|
|
2678
|
+
};
|
|
2679
|
+
|
|
2680
|
+
// ../core/lib/scroll-into-view.ts
|
|
2681
|
+
init_react_import();
|
|
2682
|
+
var scrollIntoView = (el) => {
|
|
2683
|
+
const oldStyle = __spreadValues({}, el.style);
|
|
2684
|
+
el.style.scrollMargin = "256px";
|
|
2685
|
+
if (el) {
|
|
2686
|
+
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
|
2687
|
+
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
|
2688
|
+
}
|
|
2689
|
+
};
|
|
2690
|
+
|
|
2691
|
+
// ../core/lib/get-frame.ts
|
|
2692
|
+
init_react_import();
|
|
2693
|
+
var getFrame = () => {
|
|
2694
|
+
if (typeof window === "undefined") return;
|
|
2695
|
+
let frameEl = document.querySelector("#preview-frame");
|
|
2696
|
+
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
|
2697
|
+
return frameEl.contentDocument || document;
|
|
2698
|
+
}
|
|
2699
|
+
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
|
2700
|
+
};
|
|
2701
|
+
|
|
2535
2702
|
// src/HeadingAnalyzer.tsx
|
|
2536
2703
|
var import_react_from_json = __toESM(require("react-from-json"));
|
|
2537
|
-
var
|
|
2538
|
-
var
|
|
2704
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2705
|
+
var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
|
2539
2706
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
|
2540
2707
|
var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
|
|
2541
2708
|
var getOutline = ({ frame } = {}) => {
|
|
@@ -2590,8 +2757,8 @@ function buildHierarchy(frame) {
|
|
|
2590
2757
|
var usePuck = (0, import_puck.createUsePuck)();
|
|
2591
2758
|
var HeadingAnalyzer = () => {
|
|
2592
2759
|
const data = usePuck((s) => s.appState.data);
|
|
2593
|
-
const [hierarchy, setHierarchy] = (0,
|
|
2594
|
-
(0,
|
|
2760
|
+
const [hierarchy, setHierarchy] = (0, import_react11.useState)([]);
|
|
2761
|
+
(0, import_react11.useEffect)(() => {
|
|
2595
2762
|
const frame = getFrame();
|
|
2596
2763
|
let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
|
|
2597
2764
|
const createHierarchy = () => {
|
|
@@ -2626,11 +2793,11 @@ var HeadingAnalyzer = () => {
|
|
|
2626
2793
|
frameObserver.disconnect();
|
|
2627
2794
|
};
|
|
2628
2795
|
}, [data]);
|
|
2629
|
-
return /* @__PURE__ */ (0,
|
|
2630
|
-
/* @__PURE__ */ (0,
|
|
2796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
|
|
2797
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2631
2798
|
"small",
|
|
2632
2799
|
{
|
|
2633
|
-
className:
|
|
2800
|
+
className: getClassName5("cssWarning"),
|
|
2634
2801
|
style: {
|
|
2635
2802
|
color: "var(--puck-color-red-04)",
|
|
2636
2803
|
display: "block",
|
|
@@ -2639,19 +2806,19 @@ var HeadingAnalyzer = () => {
|
|
|
2639
2806
|
children: [
|
|
2640
2807
|
"Heading analyzer styles not loaded. Please review the",
|
|
2641
2808
|
" ",
|
|
2642
|
-
/* @__PURE__ */ (0,
|
|
2809
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
|
2643
2810
|
"."
|
|
2644
2811
|
]
|
|
2645
2812
|
}
|
|
2646
2813
|
),
|
|
2647
|
-
hierarchy.length === 0 && /* @__PURE__ */ (0,
|
|
2648
|
-
/* @__PURE__ */ (0,
|
|
2814
|
+
hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: "No headings." }),
|
|
2815
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2649
2816
|
ReactFromJSON,
|
|
2650
2817
|
{
|
|
2651
2818
|
mapping: {
|
|
2652
|
-
Root: (props) => /* @__PURE__ */ (0,
|
|
2653
|
-
OutlineListItem: (props) => /* @__PURE__ */ (0,
|
|
2654
|
-
/* @__PURE__ */ (0,
|
|
2819
|
+
Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: props.children }),
|
|
2820
|
+
OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(OutlineList.Item, { children: [
|
|
2821
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2655
2822
|
"small",
|
|
2656
2823
|
{
|
|
2657
2824
|
className: getClassNameItem2({ missing: props.missing }),
|
|
@@ -2669,14 +2836,14 @@ var HeadingAnalyzer = () => {
|
|
|
2669
2836
|
}, 2e3);
|
|
2670
2837
|
}
|
|
2671
2838
|
},
|
|
2672
|
-
children: props.missing ? /* @__PURE__ */ (0,
|
|
2673
|
-
/* @__PURE__ */ (0,
|
|
2839
|
+
children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
2840
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
|
|
2674
2841
|
"H",
|
|
2675
2842
|
props.rank
|
|
2676
2843
|
] }),
|
|
2677
2844
|
": Missing"
|
|
2678
|
-
] }) : /* @__PURE__ */ (0,
|
|
2679
|
-
/* @__PURE__ */ (0,
|
|
2845
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
2846
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
|
|
2680
2847
|
"H",
|
|
2681
2848
|
props.rank
|
|
2682
2849
|
] }),
|
|
@@ -2685,7 +2852,7 @@ var HeadingAnalyzer = () => {
|
|
|
2685
2852
|
] })
|
|
2686
2853
|
}
|
|
2687
2854
|
) }),
|
|
2688
|
-
/* @__PURE__ */ (0,
|
|
2855
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: props.children })
|
|
2689
2856
|
] })
|
|
2690
2857
|
},
|
|
2691
2858
|
entry: {
|
|
@@ -2706,10 +2873,12 @@ var HeadingAnalyzer = () => {
|
|
|
2706
2873
|
] });
|
|
2707
2874
|
};
|
|
2708
2875
|
var headingAnalyzer = {
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2876
|
+
overrides: {
|
|
2877
|
+
fields: ({ children, itemSelector }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
2878
|
+
children,
|
|
2879
|
+
/* @__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, {}) }) })
|
|
2880
|
+
] })
|
|
2881
|
+
}
|
|
2713
2882
|
};
|
|
2714
2883
|
var HeadingAnalyzer_default = headingAnalyzer;
|
|
2715
2884
|
/*! Bundled license information:
|
|
@@ -2725,7 +2894,7 @@ lucide-react/dist/esm/shared/src/utils.js:
|
|
|
2725
2894
|
lucide-react/dist/esm/defaultAttributes.js:
|
|
2726
2895
|
lucide-react/dist/esm/Icon.js:
|
|
2727
2896
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
2728
|
-
lucide-react/dist/esm/icons/
|
|
2897
|
+
lucide-react/dist/esm/icons/chevron-right.js:
|
|
2729
2898
|
lucide-react/dist/esm/lucide-react.js:
|
|
2730
2899
|
(**
|
|
2731
2900
|
* @license lucide-react v0.468.0 - ISC
|