@measured/puck-plugin-heading-analyzer 0.21.0-canary.b818cb1f → 0.21.0-canary.c0db75c1
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 +71 -50
- package/dist/index.d.ts +71 -50
- package/dist/index.js +135 -314
- package/dist/index.mjs +129 -308
- 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_yg0s7_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_yg0s7_6", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_yg0s7_10", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_yg0s7_14" };
|
|
273
273
|
|
|
274
274
|
// src/HeadingAnalyzer.tsx
|
|
275
275
|
import { createUsePuck } from "@measured/puck";
|
|
276
276
|
|
|
277
|
-
// ../core/components/
|
|
277
|
+
// ../core/components/OutlineList/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/OutlineList/styles.module.css#css-module
|
|
281
281
|
init_react_import();
|
|
282
|
-
var styles_module_default = { "
|
|
282
|
+
var styles_module_default = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
|
283
283
|
|
|
284
284
|
// ../core/lib/get-class-name-factory.ts
|
|
285
285
|
init_react_import();
|
|
@@ -308,29 +308,50 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
|
|
|
308
308
|
};
|
|
309
309
|
var get_class_name_factory_default = getClassNameFactory;
|
|
310
310
|
|
|
311
|
-
// ../core/components/
|
|
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
|
|
311
|
+
// ../core/components/OutlineList/index.tsx
|
|
319
312
|
import { jsx } from "react/jsx-runtime";
|
|
320
|
-
var getClassName = get_class_name_factory_default("
|
|
321
|
-
var
|
|
322
|
-
|
|
313
|
+
var getClassName = get_class_name_factory_default("OutlineList", styles_module_default);
|
|
314
|
+
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default);
|
|
315
|
+
var OutlineList = ({ children }) => {
|
|
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
|
+
}) => {
|
|
323
323
|
return /* @__PURE__ */ jsx(
|
|
324
|
-
|
|
324
|
+
"li",
|
|
325
325
|
{
|
|
326
|
-
className:
|
|
327
|
-
|
|
328
|
-
}),
|
|
326
|
+
className: getClassNameItem({ clickable: !!onClick }),
|
|
327
|
+
onClick,
|
|
329
328
|
children
|
|
330
329
|
}
|
|
331
330
|
);
|
|
332
331
|
};
|
|
333
332
|
|
|
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
|
+
|
|
334
355
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
|
335
356
|
init_react_import();
|
|
336
357
|
|
|
@@ -418,15 +439,29 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
|
418
439
|
return Component;
|
|
419
440
|
};
|
|
420
441
|
|
|
421
|
-
// ../../node_modules/lucide-react/dist/esm/icons/
|
|
442
|
+
// ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
|
|
422
443
|
init_react_import();
|
|
423
|
-
var
|
|
424
|
-
["path", { d: "
|
|
444
|
+
var Heading1 = createLucideIcon("Heading1", [
|
|
445
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
|
446
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
|
447
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
448
|
+
["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
|
|
425
449
|
]);
|
|
426
450
|
|
|
427
|
-
// ../core/lib/
|
|
451
|
+
// ../core/lib/index.ts
|
|
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
|
|
428
464
|
init_react_import();
|
|
429
|
-
import { useMemo } from "react";
|
|
430
465
|
|
|
431
466
|
// ../core/store/index.ts
|
|
432
467
|
init_react_import();
|
|
@@ -806,10 +841,10 @@ var insert = (list, index, item) => {
|
|
|
806
841
|
// ../core/lib/generate-id.ts
|
|
807
842
|
init_react_import();
|
|
808
843
|
|
|
809
|
-
//
|
|
844
|
+
// ../core/node_modules/uuid/dist/esm-node/index.js
|
|
810
845
|
init_react_import();
|
|
811
846
|
|
|
812
|
-
//
|
|
847
|
+
// ../core/node_modules/uuid/dist/esm-node/rng.js
|
|
813
848
|
init_react_import();
|
|
814
849
|
import crypto from "crypto";
|
|
815
850
|
var rnds8Pool = new Uint8Array(256);
|
|
@@ -822,7 +857,7 @@ function rng() {
|
|
|
822
857
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
823
858
|
}
|
|
824
859
|
|
|
825
|
-
//
|
|
860
|
+
// ../core/node_modules/uuid/dist/esm-node/stringify.js
|
|
826
861
|
init_react_import();
|
|
827
862
|
var byteToHex = [];
|
|
828
863
|
for (let i = 0; i < 256; ++i) {
|
|
@@ -832,17 +867,17 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
832
867
|
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]];
|
|
833
868
|
}
|
|
834
869
|
|
|
835
|
-
//
|
|
870
|
+
// ../core/node_modules/uuid/dist/esm-node/v4.js
|
|
836
871
|
init_react_import();
|
|
837
872
|
|
|
838
|
-
//
|
|
873
|
+
// ../core/node_modules/uuid/dist/esm-node/native.js
|
|
839
874
|
init_react_import();
|
|
840
875
|
import crypto2 from "crypto";
|
|
841
876
|
var native_default = {
|
|
842
877
|
randomUUID: crypto2.randomUUID
|
|
843
878
|
};
|
|
844
879
|
|
|
845
|
-
//
|
|
880
|
+
// ../core/node_modules/uuid/dist/esm-node/v4.js
|
|
846
881
|
function v4(options, buf, offset) {
|
|
847
882
|
if (native_default.randomUUID && !buf && !options) {
|
|
848
883
|
return native_default.randomUUID();
|
|
@@ -1396,7 +1431,8 @@ init_react_import();
|
|
|
1396
1431
|
var defaultViewports = [
|
|
1397
1432
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
|
1398
1433
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
|
1399
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
|
1434
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" },
|
|
1435
|
+
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
|
1400
1436
|
];
|
|
1401
1437
|
|
|
1402
1438
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
|
@@ -1422,7 +1458,7 @@ var createStoreImpl = (createState) => {
|
|
|
1422
1458
|
const initialState = state = createState(setState, getState, api);
|
|
1423
1459
|
return api;
|
|
1424
1460
|
};
|
|
1425
|
-
var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
1461
|
+
var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
|
1426
1462
|
|
|
1427
1463
|
// ../../node_modules/zustand/esm/react.mjs
|
|
1428
1464
|
init_react_import();
|
|
@@ -1431,8 +1467,8 @@ var identity = (arg) => arg;
|
|
|
1431
1467
|
function useStore(api, selector = identity) {
|
|
1432
1468
|
const slice = React2.useSyncExternalStore(
|
|
1433
1469
|
api.subscribe,
|
|
1434
|
-
() => selector(api.getState()),
|
|
1435
|
-
() => selector(api.getInitialState())
|
|
1470
|
+
React2.useCallback(() => selector(api.getState()), [api, selector]),
|
|
1471
|
+
React2.useCallback(() => selector(api.getInitialState()), [api, selector])
|
|
1436
1472
|
);
|
|
1437
1473
|
React2.useDebugValue(slice);
|
|
1438
1474
|
return slice;
|
|
@@ -1443,13 +1479,13 @@ var createImpl = (createState) => {
|
|
|
1443
1479
|
Object.assign(useBoundStore, api);
|
|
1444
1480
|
return useBoundStore;
|
|
1445
1481
|
};
|
|
1446
|
-
var create = (createState) => createState ? createImpl(createState) : createImpl;
|
|
1482
|
+
var create = ((createState) => createState ? createImpl(createState) : createImpl);
|
|
1447
1483
|
|
|
1448
1484
|
// ../../node_modules/zustand/esm/middleware.mjs
|
|
1449
1485
|
init_react_import();
|
|
1450
1486
|
var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
|
|
1451
1487
|
const origSubscribe = api.subscribe;
|
|
1452
|
-
api.subscribe = (selector, optListener, options) => {
|
|
1488
|
+
api.subscribe = ((selector, optListener, options) => {
|
|
1453
1489
|
let listener = selector;
|
|
1454
1490
|
if (optListener) {
|
|
1455
1491
|
const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
|
|
@@ -1466,7 +1502,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
|
|
|
1466
1502
|
}
|
|
1467
1503
|
}
|
|
1468
1504
|
return origSubscribe(listener);
|
|
1469
|
-
};
|
|
1505
|
+
});
|
|
1470
1506
|
const initialState = fn(set, get, api);
|
|
1471
1507
|
return initialState;
|
|
1472
1508
|
};
|
|
@@ -1683,9 +1719,9 @@ function createIsCircular(areItemsEqual) {
|
|
|
1683
1719
|
function getStrictProperties(object) {
|
|
1684
1720
|
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
|
1685
1721
|
}
|
|
1686
|
-
var hasOwn = Object.hasOwn || function(object, property) {
|
|
1722
|
+
var hasOwn = Object.hasOwn || (function(object, property) {
|
|
1687
1723
|
return hasOwnProperty.call(object, property);
|
|
1688
|
-
};
|
|
1724
|
+
});
|
|
1689
1725
|
function sameValueZeroEqual(a, b) {
|
|
1690
1726
|
return a === b || !a && !b && a !== a && b !== b;
|
|
1691
1727
|
}
|
|
@@ -2075,29 +2111,37 @@ var getChanged = (newItem, oldItem) => {
|
|
|
2075
2111
|
|
|
2076
2112
|
// ../core/store/slices/permissions.ts
|
|
2077
2113
|
var createPermissionsSlice = (set, get) => {
|
|
2078
|
-
const resolvePermissions = (..._0) => __async(
|
|
2114
|
+
const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
|
|
2079
2115
|
const { state, permissions, config } = get();
|
|
2080
2116
|
const { cache: cache2, globalPermissions } = permissions;
|
|
2081
|
-
const
|
|
2082
|
-
var _a, _b
|
|
2117
|
+
const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
|
|
2118
|
+
var _a, _b;
|
|
2083
2119
|
const { config: config2, state: appState, setComponentLoading } = get();
|
|
2120
|
+
const itemCache = cache2[item2.props.id];
|
|
2121
|
+
const nodes = appState.indexes.nodes;
|
|
2122
|
+
const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
|
|
2123
|
+
const parentNode = parentId ? nodes[parentId] : null;
|
|
2124
|
+
const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
|
|
2084
2125
|
const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
|
|
2085
2126
|
if (!componentConfig) {
|
|
2086
2127
|
return;
|
|
2087
2128
|
}
|
|
2088
2129
|
const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
|
|
2089
2130
|
if (componentConfig.resolvePermissions) {
|
|
2090
|
-
const changed = getChanged(item2,
|
|
2091
|
-
|
|
2131
|
+
const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
|
|
2132
|
+
const propsChanged = Object.values(changed).some((el) => el === true);
|
|
2133
|
+
const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
|
|
2134
|
+
if (propsChanged || parentChanged || force2) {
|
|
2092
2135
|
const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
|
|
2093
2136
|
const resolvedPermissions = yield componentConfig.resolvePermissions(
|
|
2094
2137
|
item2,
|
|
2095
2138
|
{
|
|
2096
2139
|
changed,
|
|
2097
|
-
lastPermissions: (
|
|
2140
|
+
lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
|
|
2098
2141
|
permissions: initialPermissions,
|
|
2099
2142
|
appState: makeStatePublic(appState),
|
|
2100
|
-
lastData: (
|
|
2143
|
+
lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
|
|
2144
|
+
parent: parentData
|
|
2101
2145
|
}
|
|
2102
2146
|
);
|
|
2103
2147
|
const latest = get().permissions;
|
|
@@ -2105,6 +2149,7 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2105
2149
|
permissions: __spreadProps(__spreadValues({}, latest), {
|
|
2106
2150
|
cache: __spreadProps(__spreadValues({}, latest.cache), {
|
|
2107
2151
|
[item2.props.id]: {
|
|
2152
|
+
lastParentId: parentId,
|
|
2108
2153
|
lastData: item2,
|
|
2109
2154
|
lastPermissions: resolvedPermissions
|
|
2110
2155
|
}
|
|
@@ -2118,9 +2163,9 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2118
2163
|
}
|
|
2119
2164
|
}
|
|
2120
2165
|
});
|
|
2121
|
-
const
|
|
2166
|
+
const resolvePermissionsForRoot = (force2 = false) => {
|
|
2122
2167
|
const { state: appState } = get();
|
|
2123
|
-
|
|
2168
|
+
resolvePermissionsForItem(
|
|
2124
2169
|
// Shim the root data in by conforming to component data shape
|
|
2125
2170
|
{
|
|
2126
2171
|
type: "root",
|
|
@@ -2131,16 +2176,16 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2131
2176
|
};
|
|
2132
2177
|
const { item, type, root } = params;
|
|
2133
2178
|
if (item) {
|
|
2134
|
-
yield
|
|
2179
|
+
yield resolvePermissionsForItem(item, force);
|
|
2135
2180
|
} else if (type) {
|
|
2136
|
-
flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(
|
|
2137
|
-
yield
|
|
2181
|
+
flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
|
|
2182
|
+
yield resolvePermissionsForItem(item2, force);
|
|
2138
2183
|
}));
|
|
2139
2184
|
} else if (root) {
|
|
2140
|
-
|
|
2185
|
+
resolvePermissionsForRoot(force);
|
|
2141
2186
|
} else {
|
|
2142
|
-
flattenData(state, config).map((item2) => __async(
|
|
2143
|
-
yield
|
|
2187
|
+
flattenData(state, config).map((item2) => __async(null, null, function* () {
|
|
2188
|
+
yield resolvePermissionsForItem(item2, force);
|
|
2144
2189
|
}));
|
|
2145
2190
|
}
|
|
2146
2191
|
});
|
|
@@ -2194,7 +2239,7 @@ var createFieldsSlice = (_set, _get) => {
|
|
|
2194
2239
|
// ../core/lib/resolve-component-data.ts
|
|
2195
2240
|
init_react_import();
|
|
2196
2241
|
var cache = { lastChange: {} };
|
|
2197
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(
|
|
2242
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
|
2198
2243
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
2199
2244
|
const resolvedItem = __spreadValues({}, item);
|
|
2200
2245
|
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
@@ -2222,11 +2267,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
|
2222
2267
|
let itemWithResolvedChildren = yield mapFields(
|
|
2223
2268
|
resolvedItem,
|
|
2224
2269
|
{
|
|
2225
|
-
slot: (_02) => __async(
|
|
2270
|
+
slot: (_02) => __async(null, [_02], function* ({ value }) {
|
|
2226
2271
|
const content = value;
|
|
2227
2272
|
return yield Promise.all(
|
|
2228
2273
|
content.map(
|
|
2229
|
-
(childItem) => __async(
|
|
2274
|
+
(childItem) => __async(null, null, function* () {
|
|
2230
2275
|
return (yield resolveComponentData(
|
|
2231
2276
|
childItem,
|
|
2232
2277
|
config,
|
|
@@ -2292,7 +2337,8 @@ var defaultAppState = {
|
|
|
2292
2337
|
options: [],
|
|
2293
2338
|
controlsVisible: true
|
|
2294
2339
|
},
|
|
2295
|
-
field: { focus: null }
|
|
2340
|
+
field: { focus: null },
|
|
2341
|
+
plugin: { current: null }
|
|
2296
2342
|
},
|
|
2297
2343
|
indexes: {
|
|
2298
2344
|
nodes: {},
|
|
@@ -2308,6 +2354,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2308
2354
|
subscribeWithSelector((set, get) => {
|
|
2309
2355
|
var _a, _b;
|
|
2310
2356
|
return __spreadProps(__spreadValues({
|
|
2357
|
+
instanceId: generateId(),
|
|
2311
2358
|
state: defaultAppState,
|
|
2312
2359
|
config: { components: {} },
|
|
2313
2360
|
componentState: {},
|
|
@@ -2416,7 +2463,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2416
2463
|
const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
|
|
2417
2464
|
return __spreadProps(__spreadValues({}, s), { state, selectedItem });
|
|
2418
2465
|
}),
|
|
2419
|
-
resolveComponentData: (componentData, trigger) => __async(
|
|
2466
|
+
resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
|
|
2420
2467
|
const { config, metadata, setComponentLoading, permissions } = get();
|
|
2421
2468
|
const timeouts = {};
|
|
2422
2469
|
return yield resolveComponentData(
|
|
@@ -2427,7 +2474,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2427
2474
|
const id = "id" in item.props ? item.props.id : "root";
|
|
2428
2475
|
timeouts[id] = setComponentLoading(id, true, 50);
|
|
2429
2476
|
},
|
|
2430
|
-
(item) => __async(
|
|
2477
|
+
(item) => __async(null, null, function* () {
|
|
2431
2478
|
const id = "id" in item.props ? item.props.id : "root";
|
|
2432
2479
|
if ("type" in item) {
|
|
2433
2480
|
yield permissions.refreshPermissions({ item });
|
|
@@ -2439,7 +2486,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2439
2486
|
trigger
|
|
2440
2487
|
);
|
|
2441
2488
|
}),
|
|
2442
|
-
resolveAndCommitData: () => __async(
|
|
2489
|
+
resolveAndCommitData: () => __async(null, null, function* () {
|
|
2443
2490
|
const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
|
|
2444
2491
|
walkAppState(
|
|
2445
2492
|
state,
|
|
@@ -2478,203 +2525,14 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2478
2525
|
})
|
|
2479
2526
|
);
|
|
2480
2527
|
var appStoreContext = createContext(createAppStore());
|
|
2481
|
-
function useAppStore(selector) {
|
|
2482
|
-
const context = useContext(appStoreContext);
|
|
2483
|
-
return useStore(context, selector);
|
|
2484
|
-
}
|
|
2485
|
-
function useAppStoreApi() {
|
|
2486
|
-
return useContext(appStoreContext);
|
|
2487
|
-
}
|
|
2488
|
-
|
|
2489
|
-
// ../core/lib/use-breadcrumbs.ts
|
|
2490
|
-
var useBreadcrumbs = (renderCount) => {
|
|
2491
|
-
const selectedId = useAppStore((s) => {
|
|
2492
|
-
var _a;
|
|
2493
|
-
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
|
2494
|
-
});
|
|
2495
|
-
const config = useAppStore((s) => s.config);
|
|
2496
|
-
const path = useAppStore((s) => {
|
|
2497
|
-
var _a;
|
|
2498
|
-
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
|
2499
|
-
});
|
|
2500
|
-
const appStore = useAppStoreApi();
|
|
2501
|
-
return useMemo(() => {
|
|
2502
|
-
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
|
2503
|
-
var _a, _b, _c;
|
|
2504
|
-
const [componentId] = zoneCompound.split(":");
|
|
2505
|
-
if (componentId === "root") {
|
|
2506
|
-
return {
|
|
2507
|
-
label: "Page",
|
|
2508
|
-
selector: null
|
|
2509
|
-
};
|
|
2510
|
-
}
|
|
2511
|
-
const node = appStore.getState().state.indexes.nodes[componentId];
|
|
2512
|
-
const parentId = node.path[node.path.length - 1];
|
|
2513
|
-
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
|
2514
|
-
const index = contentIds.indexOf(componentId);
|
|
2515
|
-
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
|
2516
|
-
return {
|
|
2517
|
-
label,
|
|
2518
|
-
selector: node ? {
|
|
2519
|
-
index,
|
|
2520
|
-
zone: node.path[node.path.length - 1]
|
|
2521
|
-
} : null
|
|
2522
|
-
};
|
|
2523
|
-
})) || [];
|
|
2524
|
-
if (renderCount) {
|
|
2525
|
-
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
|
2526
|
-
}
|
|
2527
|
-
return breadcrumbs;
|
|
2528
|
-
}, [path, renderCount]);
|
|
2529
|
-
};
|
|
2530
|
-
|
|
2531
|
-
// ../core/components/Loader/index.tsx
|
|
2532
|
-
init_react_import();
|
|
2533
|
-
|
|
2534
|
-
// ../core/lib/index.ts
|
|
2535
|
-
init_react_import();
|
|
2536
|
-
|
|
2537
|
-
// ../core/lib/filter.ts
|
|
2538
|
-
init_react_import();
|
|
2539
|
-
|
|
2540
|
-
// ../core/lib/data/reorder.ts
|
|
2541
|
-
init_react_import();
|
|
2542
|
-
|
|
2543
|
-
// ../core/lib/data/replace.ts
|
|
2544
|
-
init_react_import();
|
|
2545
|
-
|
|
2546
|
-
// ../core/lib/use-reset-auto-zoom.ts
|
|
2547
|
-
init_react_import();
|
|
2548
2528
|
|
|
2549
2529
|
// ../core/lib/get-zoom-config.ts
|
|
2550
2530
|
init_react_import();
|
|
2551
2531
|
|
|
2552
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
|
2553
|
-
init_react_import();
|
|
2554
|
-
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
|
2555
|
-
|
|
2556
|
-
// ../core/components/Loader/index.tsx
|
|
2557
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2558
|
-
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
|
2559
|
-
var Loader = (_a) => {
|
|
2560
|
-
var _b = _a, {
|
|
2561
|
-
color,
|
|
2562
|
-
size = 16
|
|
2563
|
-
} = _b, props = __objRest(_b, [
|
|
2564
|
-
"color",
|
|
2565
|
-
"size"
|
|
2566
|
-
]);
|
|
2567
|
-
return /* @__PURE__ */ jsx2(
|
|
2568
|
-
"span",
|
|
2569
|
-
__spreadValues({
|
|
2570
|
-
className: getClassName2(),
|
|
2571
|
-
style: {
|
|
2572
|
-
width: size,
|
|
2573
|
-
height: size,
|
|
2574
|
-
color
|
|
2575
|
-
},
|
|
2576
|
-
"aria-label": "loading"
|
|
2577
|
-
}, props)
|
|
2578
|
-
);
|
|
2579
|
-
};
|
|
2580
|
-
|
|
2581
|
-
// ../core/components/SidebarSection/index.tsx
|
|
2582
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
2583
|
-
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
|
2584
|
-
var SidebarSection = ({
|
|
2585
|
-
children,
|
|
2586
|
-
title,
|
|
2587
|
-
background,
|
|
2588
|
-
showBreadcrumbs,
|
|
2589
|
-
noBorderTop,
|
|
2590
|
-
noPadding,
|
|
2591
|
-
isLoading
|
|
2592
|
-
}) => {
|
|
2593
|
-
const setUi = useAppStore((s) => s.setUi);
|
|
2594
|
-
const breadcrumbs = useBreadcrumbs(1);
|
|
2595
|
-
return /* @__PURE__ */ jsxs(
|
|
2596
|
-
"div",
|
|
2597
|
-
{
|
|
2598
|
-
className: getClassName3({ noBorderTop, noPadding }),
|
|
2599
|
-
style: { background },
|
|
2600
|
-
children: [
|
|
2601
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
|
|
2602
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumb"), children: [
|
|
2603
|
-
/* @__PURE__ */ jsx3(
|
|
2604
|
-
"button",
|
|
2605
|
-
{
|
|
2606
|
-
type: "button",
|
|
2607
|
-
className: getClassName3("breadcrumbLabel"),
|
|
2608
|
-
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
|
2609
|
-
children: breadcrumb.label
|
|
2610
|
-
}
|
|
2611
|
-
),
|
|
2612
|
-
/* @__PURE__ */ jsx3(ChevronRight, { size: 16 })
|
|
2613
|
-
] }, i)) : null,
|
|
2614
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx3(Heading, { rank: "2", size: "xs", children: title }) })
|
|
2615
|
-
] }) }),
|
|
2616
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("content"), children }),
|
|
2617
|
-
isLoading && /* @__PURE__ */ jsx3("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx3(Loader, { size: 32 }) })
|
|
2618
|
-
]
|
|
2619
|
-
}
|
|
2620
|
-
);
|
|
2621
|
-
};
|
|
2622
|
-
|
|
2623
|
-
// ../core/components/OutlineList/index.tsx
|
|
2624
|
-
init_react_import();
|
|
2625
|
-
|
|
2626
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
|
2627
|
-
init_react_import();
|
|
2628
|
-
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
|
2629
|
-
|
|
2630
|
-
// ../core/components/OutlineList/index.tsx
|
|
2631
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2632
|
-
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
|
2633
|
-
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
|
2634
|
-
var OutlineList = ({ children }) => {
|
|
2635
|
-
return /* @__PURE__ */ jsx4("ul", { className: getClassName4(), children });
|
|
2636
|
-
};
|
|
2637
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx4("div", { className: getClassNameItem({ clickable: true }), children });
|
|
2638
|
-
OutlineList.Item = ({
|
|
2639
|
-
children,
|
|
2640
|
-
onClick
|
|
2641
|
-
}) => {
|
|
2642
|
-
return /* @__PURE__ */ jsx4(
|
|
2643
|
-
"li",
|
|
2644
|
-
{
|
|
2645
|
-
className: getClassNameItem({ clickable: !!onClick }),
|
|
2646
|
-
onClick,
|
|
2647
|
-
children
|
|
2648
|
-
}
|
|
2649
|
-
);
|
|
2650
|
-
};
|
|
2651
|
-
|
|
2652
|
-
// ../core/lib/scroll-into-view.ts
|
|
2653
|
-
init_react_import();
|
|
2654
|
-
var scrollIntoView = (el) => {
|
|
2655
|
-
const oldStyle = __spreadValues({}, el.style);
|
|
2656
|
-
el.style.scrollMargin = "256px";
|
|
2657
|
-
if (el) {
|
|
2658
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
|
2659
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
|
2660
|
-
}
|
|
2661
|
-
};
|
|
2662
|
-
|
|
2663
|
-
// ../core/lib/get-frame.ts
|
|
2664
|
-
init_react_import();
|
|
2665
|
-
var getFrame = () => {
|
|
2666
|
-
if (typeof window === "undefined") return;
|
|
2667
|
-
let frameEl = document.querySelector("#preview-frame");
|
|
2668
|
-
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
|
2669
|
-
return frameEl.contentDocument || document;
|
|
2670
|
-
}
|
|
2671
|
-
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
|
2672
|
-
};
|
|
2673
|
-
|
|
2674
2532
|
// src/HeadingAnalyzer.tsx
|
|
2675
2533
|
import ReactFromJSONModule from "react-from-json";
|
|
2676
|
-
import { Fragment, jsx as
|
|
2677
|
-
var
|
|
2534
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
2535
|
+
var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
|
2678
2536
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
|
2679
2537
|
var ReactFromJSON = ReactFromJSONModule.default || ReactFromJSONModule;
|
|
2680
2538
|
var getOutline = ({ frame } = {}) => {
|
|
@@ -2765,11 +2623,11 @@ var HeadingAnalyzer = () => {
|
|
|
2765
2623
|
frameObserver.disconnect();
|
|
2766
2624
|
};
|
|
2767
2625
|
}, [data]);
|
|
2768
|
-
return /* @__PURE__ */
|
|
2769
|
-
/* @__PURE__ */
|
|
2626
|
+
return /* @__PURE__ */ jsxs("div", { className: getClassName2(), children: [
|
|
2627
|
+
/* @__PURE__ */ jsxs(
|
|
2770
2628
|
"small",
|
|
2771
2629
|
{
|
|
2772
|
-
className:
|
|
2630
|
+
className: getClassName2("cssWarning"),
|
|
2773
2631
|
style: {
|
|
2774
2632
|
color: "var(--puck-color-red-04)",
|
|
2775
2633
|
display: "block",
|
|
@@ -2778,19 +2636,19 @@ var HeadingAnalyzer = () => {
|
|
|
2778
2636
|
children: [
|
|
2779
2637
|
"Heading analyzer styles not loaded. Please review the",
|
|
2780
2638
|
" ",
|
|
2781
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ jsx2("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
|
2782
2640
|
"."
|
|
2783
2641
|
]
|
|
2784
2642
|
}
|
|
2785
2643
|
),
|
|
2786
|
-
hierarchy.length === 0 && /* @__PURE__ */
|
|
2787
|
-
/* @__PURE__ */
|
|
2644
|
+
hierarchy.length === 0 && /* @__PURE__ */ jsx2("div", { children: "No headings." }),
|
|
2645
|
+
/* @__PURE__ */ jsx2(OutlineList, { children: /* @__PURE__ */ jsx2(
|
|
2788
2646
|
ReactFromJSON,
|
|
2789
2647
|
{
|
|
2790
2648
|
mapping: {
|
|
2791
|
-
Root: (props) => /* @__PURE__ */
|
|
2792
|
-
OutlineListItem: (props) => /* @__PURE__ */
|
|
2793
|
-
/* @__PURE__ */
|
|
2649
|
+
Root: (props) => /* @__PURE__ */ jsx2(Fragment, { children: props.children }),
|
|
2650
|
+
OutlineListItem: (props) => /* @__PURE__ */ jsxs(OutlineList.Item, { children: [
|
|
2651
|
+
/* @__PURE__ */ jsx2(OutlineList.Clickable, { children: /* @__PURE__ */ jsx2(
|
|
2794
2652
|
"small",
|
|
2795
2653
|
{
|
|
2796
2654
|
className: getClassNameItem2({ missing: props.missing }),
|
|
@@ -2808,14 +2666,14 @@ var HeadingAnalyzer = () => {
|
|
|
2808
2666
|
}, 2e3);
|
|
2809
2667
|
}
|
|
2810
2668
|
},
|
|
2811
|
-
children: props.missing ? /* @__PURE__ */
|
|
2812
|
-
/* @__PURE__ */
|
|
2669
|
+
children: props.missing ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2670
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
|
2813
2671
|
"H",
|
|
2814
2672
|
props.rank
|
|
2815
2673
|
] }),
|
|
2816
2674
|
": Missing"
|
|
2817
|
-
] }) : /* @__PURE__ */
|
|
2818
|
-
/* @__PURE__ */
|
|
2675
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2676
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
|
2819
2677
|
"H",
|
|
2820
2678
|
props.rank
|
|
2821
2679
|
] }),
|
|
@@ -2824,7 +2682,7 @@ var HeadingAnalyzer = () => {
|
|
|
2824
2682
|
] })
|
|
2825
2683
|
}
|
|
2826
2684
|
) }),
|
|
2827
|
-
/* @__PURE__ */
|
|
2685
|
+
/* @__PURE__ */ jsx2(OutlineList, { children: props.children })
|
|
2828
2686
|
] })
|
|
2829
2687
|
},
|
|
2830
2688
|
entry: {
|
|
@@ -2845,12 +2703,10 @@ var HeadingAnalyzer = () => {
|
|
|
2845
2703
|
] });
|
|
2846
2704
|
};
|
|
2847
2705
|
var headingAnalyzer = {
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
] })
|
|
2853
|
-
}
|
|
2706
|
+
name: "heading-analyzer",
|
|
2707
|
+
label: "Audit",
|
|
2708
|
+
render: HeadingAnalyzer,
|
|
2709
|
+
icon: /* @__PURE__ */ jsx2(Heading1, {})
|
|
2854
2710
|
};
|
|
2855
2711
|
var HeadingAnalyzer_default = headingAnalyzer;
|
|
2856
2712
|
export {
|
|
@@ -2866,45 +2722,10 @@ classnames/index.js:
|
|
|
2866
2722
|
*)
|
|
2867
2723
|
|
|
2868
2724
|
lucide-react/dist/esm/shared/src/utils.js:
|
|
2869
|
-
(**
|
|
2870
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2871
|
-
*
|
|
2872
|
-
* This source code is licensed under the ISC license.
|
|
2873
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2874
|
-
*)
|
|
2875
|
-
|
|
2876
2725
|
lucide-react/dist/esm/defaultAttributes.js:
|
|
2877
|
-
(**
|
|
2878
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2879
|
-
*
|
|
2880
|
-
* This source code is licensed under the ISC license.
|
|
2881
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2882
|
-
*)
|
|
2883
|
-
|
|
2884
2726
|
lucide-react/dist/esm/Icon.js:
|
|
2885
|
-
(**
|
|
2886
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2887
|
-
*
|
|
2888
|
-
* This source code is licensed under the ISC license.
|
|
2889
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2890
|
-
*)
|
|
2891
|
-
|
|
2892
2727
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
2893
|
-
|
|
2894
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2895
|
-
*
|
|
2896
|
-
* This source code is licensed under the ISC license.
|
|
2897
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2898
|
-
*)
|
|
2899
|
-
|
|
2900
|
-
lucide-react/dist/esm/icons/chevron-right.js:
|
|
2901
|
-
(**
|
|
2902
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2903
|
-
*
|
|
2904
|
-
* This source code is licensed under the ISC license.
|
|
2905
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2906
|
-
*)
|
|
2907
|
-
|
|
2728
|
+
lucide-react/dist/esm/icons/heading-1.js:
|
|
2908
2729
|
lucide-react/dist/esm/lucide-react.js:
|
|
2909
2730
|
(**
|
|
2910
2731
|
* @license lucide-react v0.468.0 - ISC
|