@measured/puck-plugin-heading-analyzer 0.21.0-canary.2e1b5267 → 0.21.0-canary.38e79ba8
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 +64 -59
- package/dist/index.d.ts +64 -59
- package/dist/index.js +288 -161
- package/dist/index.mjs +282 -155
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -269,17 +269,17 @@ import { useEffect as useEffect5, useState } from "react";
|
|
|
269
269
|
|
|
270
270
|
// css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
|
|
271
271
|
init_react_import();
|
|
272
|
-
var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "
|
|
272
|
+
var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_116v6_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_116v6_5", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_116v6_9", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_116v6_13" };
|
|
273
273
|
|
|
274
274
|
// src/HeadingAnalyzer.tsx
|
|
275
275
|
import { createUsePuck } from "@measured/puck";
|
|
276
276
|
|
|
277
|
-
// ../core/components/
|
|
277
|
+
// ../core/components/SidebarSection/index.tsx
|
|
278
278
|
init_react_import();
|
|
279
279
|
|
|
280
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/
|
|
280
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
|
281
281
|
init_react_import();
|
|
282
|
-
var styles_module_default = { "
|
|
282
|
+
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" };
|
|
283
283
|
|
|
284
284
|
// ../core/lib/get-class-name-factory.ts
|
|
285
285
|
init_react_import();
|
|
@@ -308,50 +308,29 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
|
|
|
308
308
|
};
|
|
309
309
|
var get_class_name_factory_default = getClassNameFactory;
|
|
310
310
|
|
|
311
|
-
// ../core/components/
|
|
311
|
+
// ../core/components/Heading/index.tsx
|
|
312
|
+
init_react_import();
|
|
313
|
+
|
|
314
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
|
|
315
|
+
init_react_import();
|
|
316
|
+
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" };
|
|
317
|
+
|
|
318
|
+
// ../core/components/Heading/index.tsx
|
|
312
319
|
import { jsx } from "react/jsx-runtime";
|
|
313
|
-
var getClassName = get_class_name_factory_default("
|
|
314
|
-
var
|
|
315
|
-
|
|
316
|
-
return /* @__PURE__ */ jsx("ul", { className: getClassName(), children });
|
|
317
|
-
};
|
|
318
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx("div", { className: getClassNameItem({ clickable: true }), children });
|
|
319
|
-
OutlineList.Item = ({
|
|
320
|
-
children,
|
|
321
|
-
onClick
|
|
322
|
-
}) => {
|
|
320
|
+
var getClassName = get_class_name_factory_default("Heading", styles_module_default2);
|
|
321
|
+
var Heading = ({ children, rank, size = "m" }) => {
|
|
322
|
+
const Tag = rank ? `h${rank}` : "span";
|
|
323
323
|
return /* @__PURE__ */ jsx(
|
|
324
|
-
|
|
324
|
+
Tag,
|
|
325
325
|
{
|
|
326
|
-
className:
|
|
327
|
-
|
|
326
|
+
className: getClassName({
|
|
327
|
+
[size]: true
|
|
328
|
+
}),
|
|
328
329
|
children
|
|
329
330
|
}
|
|
330
331
|
);
|
|
331
332
|
};
|
|
332
333
|
|
|
333
|
-
// ../core/lib/scroll-into-view.ts
|
|
334
|
-
init_react_import();
|
|
335
|
-
var scrollIntoView = (el) => {
|
|
336
|
-
const oldStyle = __spreadValues({}, el.style);
|
|
337
|
-
el.style.scrollMargin = "256px";
|
|
338
|
-
if (el) {
|
|
339
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
|
340
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
// ../core/lib/get-frame.ts
|
|
345
|
-
init_react_import();
|
|
346
|
-
var getFrame = () => {
|
|
347
|
-
if (typeof window === "undefined") return;
|
|
348
|
-
let frameEl = document.querySelector("#preview-frame");
|
|
349
|
-
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
|
350
|
-
return frameEl.contentDocument || document;
|
|
351
|
-
}
|
|
352
|
-
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
|
353
|
-
};
|
|
354
|
-
|
|
355
334
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
|
356
335
|
init_react_import();
|
|
357
336
|
|
|
@@ -439,29 +418,15 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
|
439
418
|
return Component;
|
|
440
419
|
};
|
|
441
420
|
|
|
442
|
-
// ../../node_modules/lucide-react/dist/esm/icons/
|
|
421
|
+
// ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
|
443
422
|
init_react_import();
|
|
444
|
-
var
|
|
445
|
-
["path", { d: "
|
|
446
|
-
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
|
447
|
-
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
448
|
-
["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
|
|
423
|
+
var ChevronRight = createLucideIcon("ChevronRight", [
|
|
424
|
+
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
|
449
425
|
]);
|
|
450
426
|
|
|
451
|
-
// ../core/lib/
|
|
452
|
-
init_react_import();
|
|
453
|
-
|
|
454
|
-
// ../core/lib/filter.ts
|
|
455
|
-
init_react_import();
|
|
456
|
-
|
|
457
|
-
// ../core/lib/data/reorder.ts
|
|
458
|
-
init_react_import();
|
|
459
|
-
|
|
460
|
-
// ../core/lib/data/replace.ts
|
|
461
|
-
init_react_import();
|
|
462
|
-
|
|
463
|
-
// ../core/lib/use-reset-auto-zoom.ts
|
|
427
|
+
// ../core/lib/use-breadcrumbs.ts
|
|
464
428
|
init_react_import();
|
|
429
|
+
import { useMemo } from "react";
|
|
465
430
|
|
|
466
431
|
// ../core/store/index.ts
|
|
467
432
|
init_react_import();
|
|
@@ -841,10 +806,10 @@ var insert = (list, index, item) => {
|
|
|
841
806
|
// ../core/lib/generate-id.ts
|
|
842
807
|
init_react_import();
|
|
843
808
|
|
|
844
|
-
//
|
|
809
|
+
// ../core/node_modules/uuid/dist/esm-node/index.js
|
|
845
810
|
init_react_import();
|
|
846
811
|
|
|
847
|
-
//
|
|
812
|
+
// ../core/node_modules/uuid/dist/esm-node/rng.js
|
|
848
813
|
init_react_import();
|
|
849
814
|
import crypto from "crypto";
|
|
850
815
|
var rnds8Pool = new Uint8Array(256);
|
|
@@ -857,7 +822,7 @@ function rng() {
|
|
|
857
822
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
858
823
|
}
|
|
859
824
|
|
|
860
|
-
//
|
|
825
|
+
// ../core/node_modules/uuid/dist/esm-node/stringify.js
|
|
861
826
|
init_react_import();
|
|
862
827
|
var byteToHex = [];
|
|
863
828
|
for (let i = 0; i < 256; ++i) {
|
|
@@ -867,17 +832,17 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
867
832
|
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
868
833
|
}
|
|
869
834
|
|
|
870
|
-
//
|
|
835
|
+
// ../core/node_modules/uuid/dist/esm-node/v4.js
|
|
871
836
|
init_react_import();
|
|
872
837
|
|
|
873
|
-
//
|
|
838
|
+
// ../core/node_modules/uuid/dist/esm-node/native.js
|
|
874
839
|
init_react_import();
|
|
875
840
|
import crypto2 from "crypto";
|
|
876
841
|
var native_default = {
|
|
877
842
|
randomUUID: crypto2.randomUUID
|
|
878
843
|
};
|
|
879
844
|
|
|
880
|
-
//
|
|
845
|
+
// ../core/node_modules/uuid/dist/esm-node/v4.js
|
|
881
846
|
function v4(options, buf, offset) {
|
|
882
847
|
if (native_default.randomUUID && !buf && !options) {
|
|
883
848
|
return native_default.randomUUID();
|
|
@@ -1431,8 +1396,7 @@ init_react_import();
|
|
|
1431
1396
|
var defaultViewports = [
|
|
1432
1397
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
|
1433
1398
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
|
1434
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
|
1435
|
-
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
|
1399
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
|
1436
1400
|
];
|
|
1437
1401
|
|
|
1438
1402
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
|
@@ -1458,7 +1422,7 @@ var createStoreImpl = (createState) => {
|
|
|
1458
1422
|
const initialState = state = createState(setState, getState, api);
|
|
1459
1423
|
return api;
|
|
1460
1424
|
};
|
|
1461
|
-
var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
1425
|
+
var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
|
1462
1426
|
|
|
1463
1427
|
// ../../node_modules/zustand/esm/react.mjs
|
|
1464
1428
|
init_react_import();
|
|
@@ -1467,8 +1431,8 @@ var identity = (arg) => arg;
|
|
|
1467
1431
|
function useStore(api, selector = identity) {
|
|
1468
1432
|
const slice = React2.useSyncExternalStore(
|
|
1469
1433
|
api.subscribe,
|
|
1470
|
-
() => selector(api.getState()),
|
|
1471
|
-
() => selector(api.getInitialState())
|
|
1434
|
+
React2.useCallback(() => selector(api.getState()), [api, selector]),
|
|
1435
|
+
React2.useCallback(() => selector(api.getInitialState()), [api, selector])
|
|
1472
1436
|
);
|
|
1473
1437
|
React2.useDebugValue(slice);
|
|
1474
1438
|
return slice;
|
|
@@ -1479,13 +1443,13 @@ var createImpl = (createState) => {
|
|
|
1479
1443
|
Object.assign(useBoundStore, api);
|
|
1480
1444
|
return useBoundStore;
|
|
1481
1445
|
};
|
|
1482
|
-
var create = (createState) => createState ? createImpl(createState) : createImpl;
|
|
1446
|
+
var create = ((createState) => createState ? createImpl(createState) : createImpl);
|
|
1483
1447
|
|
|
1484
1448
|
// ../../node_modules/zustand/esm/middleware.mjs
|
|
1485
1449
|
init_react_import();
|
|
1486
1450
|
var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
|
|
1487
1451
|
const origSubscribe = api.subscribe;
|
|
1488
|
-
api.subscribe = (selector, optListener, options) => {
|
|
1452
|
+
api.subscribe = ((selector, optListener, options) => {
|
|
1489
1453
|
let listener = selector;
|
|
1490
1454
|
if (optListener) {
|
|
1491
1455
|
const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
|
|
@@ -1502,7 +1466,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
|
|
|
1502
1466
|
}
|
|
1503
1467
|
}
|
|
1504
1468
|
return origSubscribe(listener);
|
|
1505
|
-
};
|
|
1469
|
+
});
|
|
1506
1470
|
const initialState = fn(set, get, api);
|
|
1507
1471
|
return initialState;
|
|
1508
1472
|
};
|
|
@@ -1719,9 +1683,9 @@ function createIsCircular(areItemsEqual) {
|
|
|
1719
1683
|
function getStrictProperties(object) {
|
|
1720
1684
|
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
|
1721
1685
|
}
|
|
1722
|
-
var hasOwn = Object.hasOwn || function(object, property) {
|
|
1686
|
+
var hasOwn = Object.hasOwn || (function(object, property) {
|
|
1723
1687
|
return hasOwnProperty.call(object, property);
|
|
1724
|
-
};
|
|
1688
|
+
});
|
|
1725
1689
|
function sameValueZeroEqual(a, b) {
|
|
1726
1690
|
return a === b || !a && !b && a !== a && b !== b;
|
|
1727
1691
|
}
|
|
@@ -2111,29 +2075,37 @@ var getChanged = (newItem, oldItem) => {
|
|
|
2111
2075
|
|
|
2112
2076
|
// ../core/store/slices/permissions.ts
|
|
2113
2077
|
var createPermissionsSlice = (set, get) => {
|
|
2114
|
-
const resolvePermissions = (..._0) => __async(
|
|
2078
|
+
const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
|
|
2115
2079
|
const { state, permissions, config } = get();
|
|
2116
2080
|
const { cache: cache2, globalPermissions } = permissions;
|
|
2117
|
-
const
|
|
2118
|
-
var _a, _b
|
|
2081
|
+
const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
|
|
2082
|
+
var _a, _b;
|
|
2119
2083
|
const { config: config2, state: appState, setComponentLoading } = get();
|
|
2084
|
+
const itemCache = cache2[item2.props.id];
|
|
2085
|
+
const nodes = appState.indexes.nodes;
|
|
2086
|
+
const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
|
|
2087
|
+
const parentNode = parentId ? nodes[parentId] : null;
|
|
2088
|
+
const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
|
|
2120
2089
|
const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
|
|
2121
2090
|
if (!componentConfig) {
|
|
2122
2091
|
return;
|
|
2123
2092
|
}
|
|
2124
2093
|
const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
|
|
2125
2094
|
if (componentConfig.resolvePermissions) {
|
|
2126
|
-
const changed = getChanged(item2,
|
|
2127
|
-
|
|
2095
|
+
const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
|
|
2096
|
+
const propsChanged = Object.values(changed).some((el) => el === true);
|
|
2097
|
+
const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
|
|
2098
|
+
if (propsChanged || parentChanged || force2) {
|
|
2128
2099
|
const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
|
|
2129
2100
|
const resolvedPermissions = yield componentConfig.resolvePermissions(
|
|
2130
2101
|
item2,
|
|
2131
2102
|
{
|
|
2132
2103
|
changed,
|
|
2133
|
-
lastPermissions: (
|
|
2104
|
+
lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
|
|
2134
2105
|
permissions: initialPermissions,
|
|
2135
2106
|
appState: makeStatePublic(appState),
|
|
2136
|
-
lastData: (
|
|
2107
|
+
lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
|
|
2108
|
+
parent: parentData
|
|
2137
2109
|
}
|
|
2138
2110
|
);
|
|
2139
2111
|
const latest = get().permissions;
|
|
@@ -2141,6 +2113,7 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2141
2113
|
permissions: __spreadProps(__spreadValues({}, latest), {
|
|
2142
2114
|
cache: __spreadProps(__spreadValues({}, latest.cache), {
|
|
2143
2115
|
[item2.props.id]: {
|
|
2116
|
+
lastParentId: parentId,
|
|
2144
2117
|
lastData: item2,
|
|
2145
2118
|
lastPermissions: resolvedPermissions
|
|
2146
2119
|
}
|
|
@@ -2154,9 +2127,9 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2154
2127
|
}
|
|
2155
2128
|
}
|
|
2156
2129
|
});
|
|
2157
|
-
const
|
|
2130
|
+
const resolvePermissionsForRoot = (force2 = false) => {
|
|
2158
2131
|
const { state: appState } = get();
|
|
2159
|
-
|
|
2132
|
+
resolvePermissionsForItem(
|
|
2160
2133
|
// Shim the root data in by conforming to component data shape
|
|
2161
2134
|
{
|
|
2162
2135
|
type: "root",
|
|
@@ -2167,16 +2140,16 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2167
2140
|
};
|
|
2168
2141
|
const { item, type, root } = params;
|
|
2169
2142
|
if (item) {
|
|
2170
|
-
yield
|
|
2143
|
+
yield resolvePermissionsForItem(item, force);
|
|
2171
2144
|
} else if (type) {
|
|
2172
|
-
flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(
|
|
2173
|
-
yield
|
|
2145
|
+
flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
|
|
2146
|
+
yield resolvePermissionsForItem(item2, force);
|
|
2174
2147
|
}));
|
|
2175
2148
|
} else if (root) {
|
|
2176
|
-
|
|
2149
|
+
resolvePermissionsForRoot(force);
|
|
2177
2150
|
} else {
|
|
2178
|
-
flattenData(state, config).map((item2) => __async(
|
|
2179
|
-
yield
|
|
2151
|
+
flattenData(state, config).map((item2) => __async(null, null, function* () {
|
|
2152
|
+
yield resolvePermissionsForItem(item2, force);
|
|
2180
2153
|
}));
|
|
2181
2154
|
}
|
|
2182
2155
|
});
|
|
@@ -2230,7 +2203,7 @@ var createFieldsSlice = (_set, _get) => {
|
|
|
2230
2203
|
// ../core/lib/resolve-component-data.ts
|
|
2231
2204
|
init_react_import();
|
|
2232
2205
|
var cache = { lastChange: {} };
|
|
2233
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(
|
|
2206
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
|
2234
2207
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
2235
2208
|
const resolvedItem = __spreadValues({}, item);
|
|
2236
2209
|
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
@@ -2258,11 +2231,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
|
2258
2231
|
let itemWithResolvedChildren = yield mapFields(
|
|
2259
2232
|
resolvedItem,
|
|
2260
2233
|
{
|
|
2261
|
-
slot: (_02) => __async(
|
|
2234
|
+
slot: (_02) => __async(null, [_02], function* ({ value }) {
|
|
2262
2235
|
const content = value;
|
|
2263
2236
|
return yield Promise.all(
|
|
2264
2237
|
content.map(
|
|
2265
|
-
(childItem) => __async(
|
|
2238
|
+
(childItem) => __async(null, null, function* () {
|
|
2266
2239
|
return (yield resolveComponentData(
|
|
2267
2240
|
childItem,
|
|
2268
2241
|
config,
|
|
@@ -2328,8 +2301,7 @@ var defaultAppState = {
|
|
|
2328
2301
|
options: [],
|
|
2329
2302
|
controlsVisible: true
|
|
2330
2303
|
},
|
|
2331
|
-
field: { focus: null }
|
|
2332
|
-
plugin: { current: null }
|
|
2304
|
+
field: { focus: null }
|
|
2333
2305
|
},
|
|
2334
2306
|
indexes: {
|
|
2335
2307
|
nodes: {},
|
|
@@ -2345,7 +2317,6 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2345
2317
|
subscribeWithSelector((set, get) => {
|
|
2346
2318
|
var _a, _b;
|
|
2347
2319
|
return __spreadProps(__spreadValues({
|
|
2348
|
-
instanceId: generateId(),
|
|
2349
2320
|
state: defaultAppState,
|
|
2350
2321
|
config: { components: {} },
|
|
2351
2322
|
componentState: {},
|
|
@@ -2454,7 +2425,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2454
2425
|
const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
|
|
2455
2426
|
return __spreadProps(__spreadValues({}, s), { state, selectedItem });
|
|
2456
2427
|
}),
|
|
2457
|
-
resolveComponentData: (componentData, trigger) => __async(
|
|
2428
|
+
resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
|
|
2458
2429
|
const { config, metadata, setComponentLoading, permissions } = get();
|
|
2459
2430
|
const timeouts = {};
|
|
2460
2431
|
return yield resolveComponentData(
|
|
@@ -2465,7 +2436,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2465
2436
|
const id = "id" in item.props ? item.props.id : "root";
|
|
2466
2437
|
timeouts[id] = setComponentLoading(id, true, 50);
|
|
2467
2438
|
},
|
|
2468
|
-
(item) => __async(
|
|
2439
|
+
(item) => __async(null, null, function* () {
|
|
2469
2440
|
const id = "id" in item.props ? item.props.id : "root";
|
|
2470
2441
|
if ("type" in item) {
|
|
2471
2442
|
yield permissions.refreshPermissions({ item });
|
|
@@ -2477,7 +2448,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2477
2448
|
trigger
|
|
2478
2449
|
);
|
|
2479
2450
|
}),
|
|
2480
|
-
resolveAndCommitData: () => __async(
|
|
2451
|
+
resolveAndCommitData: () => __async(null, null, function* () {
|
|
2481
2452
|
const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
|
|
2482
2453
|
walkAppState(
|
|
2483
2454
|
state,
|
|
@@ -2516,14 +2487,203 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2516
2487
|
})
|
|
2517
2488
|
);
|
|
2518
2489
|
var appStoreContext = createContext(createAppStore());
|
|
2490
|
+
function useAppStore(selector) {
|
|
2491
|
+
const context = useContext(appStoreContext);
|
|
2492
|
+
return useStore(context, selector);
|
|
2493
|
+
}
|
|
2494
|
+
function useAppStoreApi() {
|
|
2495
|
+
return useContext(appStoreContext);
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
// ../core/lib/use-breadcrumbs.ts
|
|
2499
|
+
var useBreadcrumbs = (renderCount) => {
|
|
2500
|
+
const selectedId = useAppStore((s) => {
|
|
2501
|
+
var _a;
|
|
2502
|
+
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
|
2503
|
+
});
|
|
2504
|
+
const config = useAppStore((s) => s.config);
|
|
2505
|
+
const path = useAppStore((s) => {
|
|
2506
|
+
var _a;
|
|
2507
|
+
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
|
2508
|
+
});
|
|
2509
|
+
const appStore = useAppStoreApi();
|
|
2510
|
+
return useMemo(() => {
|
|
2511
|
+
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
|
2512
|
+
var _a, _b, _c;
|
|
2513
|
+
const [componentId] = zoneCompound.split(":");
|
|
2514
|
+
if (componentId === "root") {
|
|
2515
|
+
return {
|
|
2516
|
+
label: "Page",
|
|
2517
|
+
selector: null
|
|
2518
|
+
};
|
|
2519
|
+
}
|
|
2520
|
+
const node = appStore.getState().state.indexes.nodes[componentId];
|
|
2521
|
+
const parentId = node.path[node.path.length - 1];
|
|
2522
|
+
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
|
2523
|
+
const index = contentIds.indexOf(componentId);
|
|
2524
|
+
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
|
2525
|
+
return {
|
|
2526
|
+
label,
|
|
2527
|
+
selector: node ? {
|
|
2528
|
+
index,
|
|
2529
|
+
zone: node.path[node.path.length - 1]
|
|
2530
|
+
} : null
|
|
2531
|
+
};
|
|
2532
|
+
})) || [];
|
|
2533
|
+
if (renderCount) {
|
|
2534
|
+
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
|
2535
|
+
}
|
|
2536
|
+
return breadcrumbs;
|
|
2537
|
+
}, [path, renderCount]);
|
|
2538
|
+
};
|
|
2539
|
+
|
|
2540
|
+
// ../core/components/Loader/index.tsx
|
|
2541
|
+
init_react_import();
|
|
2542
|
+
|
|
2543
|
+
// ../core/lib/index.ts
|
|
2544
|
+
init_react_import();
|
|
2545
|
+
|
|
2546
|
+
// ../core/lib/filter.ts
|
|
2547
|
+
init_react_import();
|
|
2548
|
+
|
|
2549
|
+
// ../core/lib/data/reorder.ts
|
|
2550
|
+
init_react_import();
|
|
2551
|
+
|
|
2552
|
+
// ../core/lib/data/replace.ts
|
|
2553
|
+
init_react_import();
|
|
2554
|
+
|
|
2555
|
+
// ../core/lib/use-reset-auto-zoom.ts
|
|
2556
|
+
init_react_import();
|
|
2519
2557
|
|
|
2520
2558
|
// ../core/lib/get-zoom-config.ts
|
|
2521
2559
|
init_react_import();
|
|
2522
2560
|
|
|
2561
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
|
2562
|
+
init_react_import();
|
|
2563
|
+
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
|
2564
|
+
|
|
2565
|
+
// ../core/components/Loader/index.tsx
|
|
2566
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2567
|
+
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
|
2568
|
+
var Loader = (_a) => {
|
|
2569
|
+
var _b = _a, {
|
|
2570
|
+
color,
|
|
2571
|
+
size = 16
|
|
2572
|
+
} = _b, props = __objRest(_b, [
|
|
2573
|
+
"color",
|
|
2574
|
+
"size"
|
|
2575
|
+
]);
|
|
2576
|
+
return /* @__PURE__ */ jsx2(
|
|
2577
|
+
"span",
|
|
2578
|
+
__spreadValues({
|
|
2579
|
+
className: getClassName2(),
|
|
2580
|
+
style: {
|
|
2581
|
+
width: size,
|
|
2582
|
+
height: size,
|
|
2583
|
+
color
|
|
2584
|
+
},
|
|
2585
|
+
"aria-label": "loading"
|
|
2586
|
+
}, props)
|
|
2587
|
+
);
|
|
2588
|
+
};
|
|
2589
|
+
|
|
2590
|
+
// ../core/components/SidebarSection/index.tsx
|
|
2591
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
2592
|
+
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
|
2593
|
+
var SidebarSection = ({
|
|
2594
|
+
children,
|
|
2595
|
+
title,
|
|
2596
|
+
background,
|
|
2597
|
+
showBreadcrumbs,
|
|
2598
|
+
noBorderTop,
|
|
2599
|
+
noPadding,
|
|
2600
|
+
isLoading
|
|
2601
|
+
}) => {
|
|
2602
|
+
const setUi = useAppStore((s) => s.setUi);
|
|
2603
|
+
const breadcrumbs = useBreadcrumbs(1);
|
|
2604
|
+
return /* @__PURE__ */ jsxs(
|
|
2605
|
+
"div",
|
|
2606
|
+
{
|
|
2607
|
+
className: getClassName3({ noBorderTop, noPadding }),
|
|
2608
|
+
style: { background },
|
|
2609
|
+
children: [
|
|
2610
|
+
/* @__PURE__ */ jsx3("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
|
|
2611
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumb"), children: [
|
|
2612
|
+
/* @__PURE__ */ jsx3(
|
|
2613
|
+
"button",
|
|
2614
|
+
{
|
|
2615
|
+
type: "button",
|
|
2616
|
+
className: getClassName3("breadcrumbLabel"),
|
|
2617
|
+
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
|
2618
|
+
children: breadcrumb.label
|
|
2619
|
+
}
|
|
2620
|
+
),
|
|
2621
|
+
/* @__PURE__ */ jsx3(ChevronRight, { size: 16 })
|
|
2622
|
+
] }, i)) : null,
|
|
2623
|
+
/* @__PURE__ */ jsx3("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx3(Heading, { rank: "2", size: "xs", children: title }) })
|
|
2624
|
+
] }) }),
|
|
2625
|
+
/* @__PURE__ */ jsx3("div", { className: getClassName3("content"), children }),
|
|
2626
|
+
isLoading && /* @__PURE__ */ jsx3("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx3(Loader, { size: 32 }) })
|
|
2627
|
+
]
|
|
2628
|
+
}
|
|
2629
|
+
);
|
|
2630
|
+
};
|
|
2631
|
+
|
|
2632
|
+
// ../core/components/OutlineList/index.tsx
|
|
2633
|
+
init_react_import();
|
|
2634
|
+
|
|
2635
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
|
2636
|
+
init_react_import();
|
|
2637
|
+
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
|
2638
|
+
|
|
2639
|
+
// ../core/components/OutlineList/index.tsx
|
|
2640
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2641
|
+
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
|
2642
|
+
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
|
2643
|
+
var OutlineList = ({ children }) => {
|
|
2644
|
+
return /* @__PURE__ */ jsx4("ul", { className: getClassName4(), children });
|
|
2645
|
+
};
|
|
2646
|
+
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx4("div", { className: getClassNameItem({ clickable: true }), children });
|
|
2647
|
+
OutlineList.Item = ({
|
|
2648
|
+
children,
|
|
2649
|
+
onClick
|
|
2650
|
+
}) => {
|
|
2651
|
+
return /* @__PURE__ */ jsx4(
|
|
2652
|
+
"li",
|
|
2653
|
+
{
|
|
2654
|
+
className: getClassNameItem({ clickable: !!onClick }),
|
|
2655
|
+
onClick,
|
|
2656
|
+
children
|
|
2657
|
+
}
|
|
2658
|
+
);
|
|
2659
|
+
};
|
|
2660
|
+
|
|
2661
|
+
// ../core/lib/scroll-into-view.ts
|
|
2662
|
+
init_react_import();
|
|
2663
|
+
var scrollIntoView = (el) => {
|
|
2664
|
+
const oldStyle = __spreadValues({}, el.style);
|
|
2665
|
+
el.style.scrollMargin = "256px";
|
|
2666
|
+
if (el) {
|
|
2667
|
+
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
|
2668
|
+
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
|
2669
|
+
}
|
|
2670
|
+
};
|
|
2671
|
+
|
|
2672
|
+
// ../core/lib/get-frame.ts
|
|
2673
|
+
init_react_import();
|
|
2674
|
+
var getFrame = () => {
|
|
2675
|
+
if (typeof window === "undefined") return;
|
|
2676
|
+
let frameEl = document.querySelector("#preview-frame");
|
|
2677
|
+
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
|
2678
|
+
return frameEl.contentDocument || document;
|
|
2679
|
+
}
|
|
2680
|
+
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
|
2681
|
+
};
|
|
2682
|
+
|
|
2523
2683
|
// src/HeadingAnalyzer.tsx
|
|
2524
2684
|
import ReactFromJSONModule from "react-from-json";
|
|
2525
|
-
import { Fragment, jsx as
|
|
2526
|
-
var
|
|
2685
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2686
|
+
var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
|
2527
2687
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
|
2528
2688
|
var ReactFromJSON = ReactFromJSONModule.default || ReactFromJSONModule;
|
|
2529
2689
|
var getOutline = ({ frame } = {}) => {
|
|
@@ -2614,11 +2774,11 @@ var HeadingAnalyzer = () => {
|
|
|
2614
2774
|
frameObserver.disconnect();
|
|
2615
2775
|
};
|
|
2616
2776
|
}, [data]);
|
|
2617
|
-
return /* @__PURE__ */
|
|
2618
|
-
/* @__PURE__ */
|
|
2777
|
+
return /* @__PURE__ */ jsxs2("div", { className: getClassName5(), children: [
|
|
2778
|
+
/* @__PURE__ */ jsxs2(
|
|
2619
2779
|
"small",
|
|
2620
2780
|
{
|
|
2621
|
-
className:
|
|
2781
|
+
className: getClassName5("cssWarning"),
|
|
2622
2782
|
style: {
|
|
2623
2783
|
color: "var(--puck-color-red-04)",
|
|
2624
2784
|
display: "block",
|
|
@@ -2627,19 +2787,19 @@ var HeadingAnalyzer = () => {
|
|
|
2627
2787
|
children: [
|
|
2628
2788
|
"Heading analyzer styles not loaded. Please review the",
|
|
2629
2789
|
" ",
|
|
2630
|
-
/* @__PURE__ */
|
|
2790
|
+
/* @__PURE__ */ jsx5("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
|
2631
2791
|
"."
|
|
2632
2792
|
]
|
|
2633
2793
|
}
|
|
2634
2794
|
),
|
|
2635
|
-
hierarchy.length === 0 && /* @__PURE__ */
|
|
2636
|
-
/* @__PURE__ */
|
|
2795
|
+
hierarchy.length === 0 && /* @__PURE__ */ jsx5("div", { children: "No headings." }),
|
|
2796
|
+
/* @__PURE__ */ jsx5(OutlineList, { children: /* @__PURE__ */ jsx5(
|
|
2637
2797
|
ReactFromJSON,
|
|
2638
2798
|
{
|
|
2639
2799
|
mapping: {
|
|
2640
|
-
Root: (props) => /* @__PURE__ */
|
|
2641
|
-
OutlineListItem: (props) => /* @__PURE__ */
|
|
2642
|
-
/* @__PURE__ */
|
|
2800
|
+
Root: (props) => /* @__PURE__ */ jsx5(Fragment, { children: props.children }),
|
|
2801
|
+
OutlineListItem: (props) => /* @__PURE__ */ jsxs2(OutlineList.Item, { children: [
|
|
2802
|
+
/* @__PURE__ */ jsx5(OutlineList.Clickable, { children: /* @__PURE__ */ jsx5(
|
|
2643
2803
|
"small",
|
|
2644
2804
|
{
|
|
2645
2805
|
className: getClassNameItem2({ missing: props.missing }),
|
|
@@ -2657,14 +2817,14 @@ var HeadingAnalyzer = () => {
|
|
|
2657
2817
|
}, 2e3);
|
|
2658
2818
|
}
|
|
2659
2819
|
},
|
|
2660
|
-
children: props.missing ? /* @__PURE__ */
|
|
2661
|
-
/* @__PURE__ */
|
|
2820
|
+
children: props.missing ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
2821
|
+
/* @__PURE__ */ jsxs2("b", { children: [
|
|
2662
2822
|
"H",
|
|
2663
2823
|
props.rank
|
|
2664
2824
|
] }),
|
|
2665
2825
|
": Missing"
|
|
2666
|
-
] }) : /* @__PURE__ */
|
|
2667
|
-
/* @__PURE__ */
|
|
2826
|
+
] }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
2827
|
+
/* @__PURE__ */ jsxs2("b", { children: [
|
|
2668
2828
|
"H",
|
|
2669
2829
|
props.rank
|
|
2670
2830
|
] }),
|
|
@@ -2673,7 +2833,7 @@ var HeadingAnalyzer = () => {
|
|
|
2673
2833
|
] })
|
|
2674
2834
|
}
|
|
2675
2835
|
) }),
|
|
2676
|
-
/* @__PURE__ */
|
|
2836
|
+
/* @__PURE__ */ jsx5(OutlineList, { children: props.children })
|
|
2677
2837
|
] })
|
|
2678
2838
|
},
|
|
2679
2839
|
entry: {
|
|
@@ -2694,10 +2854,12 @@ var HeadingAnalyzer = () => {
|
|
|
2694
2854
|
] });
|
|
2695
2855
|
};
|
|
2696
2856
|
var headingAnalyzer = {
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2857
|
+
overrides: {
|
|
2858
|
+
fields: ({ children, itemSelector }) => /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
2859
|
+
children,
|
|
2860
|
+
/* @__PURE__ */ jsx5("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ jsx5(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ jsx5(HeadingAnalyzer, {}) }) })
|
|
2861
|
+
] })
|
|
2862
|
+
}
|
|
2701
2863
|
};
|
|
2702
2864
|
var HeadingAnalyzer_default = headingAnalyzer;
|
|
2703
2865
|
export {
|
|
@@ -2713,45 +2875,10 @@ classnames/index.js:
|
|
|
2713
2875
|
*)
|
|
2714
2876
|
|
|
2715
2877
|
lucide-react/dist/esm/shared/src/utils.js:
|
|
2716
|
-
(**
|
|
2717
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2718
|
-
*
|
|
2719
|
-
* This source code is licensed under the ISC license.
|
|
2720
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2721
|
-
*)
|
|
2722
|
-
|
|
2723
2878
|
lucide-react/dist/esm/defaultAttributes.js:
|
|
2724
|
-
(**
|
|
2725
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2726
|
-
*
|
|
2727
|
-
* This source code is licensed under the ISC license.
|
|
2728
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2729
|
-
*)
|
|
2730
|
-
|
|
2731
2879
|
lucide-react/dist/esm/Icon.js:
|
|
2732
|
-
(**
|
|
2733
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2734
|
-
*
|
|
2735
|
-
* This source code is licensed under the ISC license.
|
|
2736
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2737
|
-
*)
|
|
2738
|
-
|
|
2739
2880
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
2740
|
-
|
|
2741
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2742
|
-
*
|
|
2743
|
-
* This source code is licensed under the ISC license.
|
|
2744
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2745
|
-
*)
|
|
2746
|
-
|
|
2747
|
-
lucide-react/dist/esm/icons/heading-1.js:
|
|
2748
|
-
(**
|
|
2749
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2750
|
-
*
|
|
2751
|
-
* This source code is licensed under the ISC license.
|
|
2752
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2753
|
-
*)
|
|
2754
|
-
|
|
2881
|
+
lucide-react/dist/esm/icons/chevron-right.js:
|
|
2755
2882
|
lucide-react/dist/esm/lucide-react.js:
|
|
2756
2883
|
(**
|
|
2757
2884
|
* @license lucide-react v0.468.0 - ISC
|