@measured/puck-plugin-heading-analyzer 0.21.0-canary.6dae6cb7 → 0.21.0-canary.a3dabae1
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 +17 -7
- package/dist/index.d.ts +17 -7
- package/dist/index.js +532 -305
- package/dist/index.mjs +529 -302
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
@@ -91,7 +91,7 @@ var require_classnames = __commonJS({
|
|
91
91
|
init_react_import();
|
92
92
|
(function() {
|
93
93
|
"use strict";
|
94
|
-
var
|
94
|
+
var hasOwn2 = {}.hasOwnProperty;
|
95
95
|
function classNames() {
|
96
96
|
var classes = "";
|
97
97
|
for (var i = 0; i < arguments.length; i++) {
|
@@ -117,7 +117,7 @@ var require_classnames = __commonJS({
|
|
117
117
|
}
|
118
118
|
var classes = "";
|
119
119
|
for (var key in arg) {
|
120
|
-
if (
|
120
|
+
if (hasOwn2.call(arg, key) && arg[key]) {
|
121
121
|
classes = appendClass(classes, key);
|
122
122
|
}
|
123
123
|
}
|
@@ -206,11 +206,11 @@ var require_flat = __commonJS({
|
|
206
206
|
}
|
207
207
|
function isEmpty(val) {
|
208
208
|
const type = Object.prototype.toString.call(val);
|
209
|
-
const
|
209
|
+
const isArray2 = type === "[object Array]";
|
210
210
|
const isObject = type === "[object Object]";
|
211
211
|
if (!val) {
|
212
212
|
return true;
|
213
|
-
} else if (
|
213
|
+
} else if (isArray2) {
|
214
214
|
return !val.length;
|
215
215
|
} else if (isObject) {
|
216
216
|
return !Object.keys(val).length;
|
@@ -260,42 +260,6 @@ var require_flat = __commonJS({
|
|
260
260
|
}
|
261
261
|
});
|
262
262
|
|
263
|
-
// ../../node_modules/fast-deep-equal/index.js
|
264
|
-
var require_fast_deep_equal = __commonJS({
|
265
|
-
"../../node_modules/fast-deep-equal/index.js"(exports, module) {
|
266
|
-
"use strict";
|
267
|
-
init_react_import();
|
268
|
-
module.exports = function equal(a, b) {
|
269
|
-
if (a === b) return true;
|
270
|
-
if (a && b && typeof a == "object" && typeof b == "object") {
|
271
|
-
if (a.constructor !== b.constructor) return false;
|
272
|
-
var length, i, keys;
|
273
|
-
if (Array.isArray(a)) {
|
274
|
-
length = a.length;
|
275
|
-
if (length != b.length) return false;
|
276
|
-
for (i = length; i-- !== 0; )
|
277
|
-
if (!equal(a[i], b[i])) return false;
|
278
|
-
return true;
|
279
|
-
}
|
280
|
-
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
281
|
-
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
282
|
-
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
283
|
-
keys = Object.keys(a);
|
284
|
-
length = keys.length;
|
285
|
-
if (length !== Object.keys(b).length) return false;
|
286
|
-
for (i = length; i-- !== 0; )
|
287
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
288
|
-
for (i = length; i-- !== 0; ) {
|
289
|
-
var key = keys[i];
|
290
|
-
if (!equal(a[key], b[key])) return false;
|
291
|
-
}
|
292
|
-
return true;
|
293
|
-
}
|
294
|
-
return a !== a && b !== b;
|
295
|
-
};
|
296
|
-
}
|
297
|
-
});
|
298
|
-
|
299
263
|
// index.ts
|
300
264
|
init_react_import();
|
301
265
|
|
@@ -305,17 +269,17 @@ import { useEffect as useEffect5, useState } from "react";
|
|
305
269
|
|
306
270
|
// css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
|
307
271
|
init_react_import();
|
308
|
-
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" };
|
309
273
|
|
310
274
|
// src/HeadingAnalyzer.tsx
|
311
275
|
import { createUsePuck } from "@measured/puck";
|
312
276
|
|
313
|
-
// ../core/components/
|
277
|
+
// ../core/components/OutlineList/index.tsx
|
314
278
|
init_react_import();
|
315
279
|
|
316
|
-
// 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
|
317
281
|
init_react_import();
|
318
|
-
var styles_module_default = { "
|
282
|
+
var styles_module_default = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
319
283
|
|
320
284
|
// ../core/lib/get-class-name-factory.ts
|
321
285
|
init_react_import();
|
@@ -344,29 +308,50 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
|
|
344
308
|
};
|
345
309
|
var get_class_name_factory_default = getClassNameFactory;
|
346
310
|
|
347
|
-
// ../core/components/
|
348
|
-
init_react_import();
|
349
|
-
|
350
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
|
351
|
-
init_react_import();
|
352
|
-
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" };
|
353
|
-
|
354
|
-
// ../core/components/Heading/index.tsx
|
311
|
+
// ../core/components/OutlineList/index.tsx
|
355
312
|
import { jsx } from "react/jsx-runtime";
|
356
|
-
var getClassName = get_class_name_factory_default("
|
357
|
-
var
|
358
|
-
|
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
|
+
}) => {
|
359
323
|
return /* @__PURE__ */ jsx(
|
360
|
-
|
324
|
+
"li",
|
361
325
|
{
|
362
|
-
className:
|
363
|
-
|
364
|
-
}),
|
326
|
+
className: getClassNameItem({ clickable: !!onClick }),
|
327
|
+
onClick,
|
365
328
|
children
|
366
329
|
}
|
367
330
|
);
|
368
331
|
};
|
369
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
|
+
|
370
355
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
371
356
|
init_react_import();
|
372
357
|
|
@@ -454,15 +439,29 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
454
439
|
return Component;
|
455
440
|
};
|
456
441
|
|
457
|
-
// ../../node_modules/lucide-react/dist/esm/icons/
|
442
|
+
// ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
|
458
443
|
init_react_import();
|
459
|
-
var
|
460
|
-
["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" }]
|
461
449
|
]);
|
462
450
|
|
463
|
-
// ../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
|
464
464
|
init_react_import();
|
465
|
-
import { useMemo } from "react";
|
466
465
|
|
467
466
|
// ../core/store/index.ts
|
468
467
|
init_react_import();
|
@@ -533,27 +532,32 @@ var walkField = ({
|
|
533
532
|
config,
|
534
533
|
recurseSlots = false
|
535
534
|
}) => {
|
536
|
-
var _a, _b, _c;
|
535
|
+
var _a, _b, _c, _d, _e;
|
537
536
|
const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
|
538
537
|
const map = mappers[fieldType];
|
539
538
|
if (map && fieldType === "slot") {
|
540
539
|
const content = value || [];
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
540
|
+
let mappedContent = content;
|
541
|
+
if (recurseSlots) {
|
542
|
+
for (let i = 0; i < content.length; i++) {
|
543
|
+
const el = content[i];
|
544
|
+
const componentConfig = config.components[el.type];
|
545
|
+
if (!componentConfig || !((_b = el.props) == null ? void 0 : _b.id)) {
|
546
|
+
continue;
|
547
|
+
}
|
548
|
+
const fields2 = (_c = componentConfig.fields) != null ? _c : {};
|
549
|
+
mappedContent.push(
|
550
|
+
walkField({
|
551
|
+
value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
|
552
|
+
fields: fields2,
|
553
|
+
mappers,
|
554
|
+
id: el.props.id,
|
555
|
+
config,
|
556
|
+
recurseSlots
|
557
|
+
})
|
558
|
+
);
|
546
559
|
}
|
547
|
-
|
548
|
-
return walkField({
|
549
|
-
value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
|
550
|
-
fields: fields2,
|
551
|
-
mappers,
|
552
|
-
id: el.props.id,
|
553
|
-
config,
|
554
|
-
recurseSlots
|
555
|
-
});
|
556
|
-
}) : content;
|
560
|
+
}
|
557
561
|
if (containsPromise(mappedContent)) {
|
558
562
|
return Promise.all(mappedContent);
|
559
563
|
}
|
@@ -575,7 +579,7 @@ var walkField = ({
|
|
575
579
|
}
|
576
580
|
if (value && typeof value === "object") {
|
577
581
|
if (Array.isArray(value)) {
|
578
|
-
const arrayFields = ((
|
582
|
+
const arrayFields = ((_d = fields[propKey]) == null ? void 0 : _d.type) === "array" ? fields[propKey].arrayFields : null;
|
579
583
|
if (!arrayFields) return value;
|
580
584
|
const newValue = value.map(
|
581
585
|
(el, idx) => walkField({
|
@@ -596,7 +600,7 @@ var walkField = ({
|
|
596
600
|
} else if ("$$typeof" in value) {
|
597
601
|
return value;
|
598
602
|
} else {
|
599
|
-
const objectFields = ((
|
603
|
+
const objectFields = ((_e = fields[propKey]) == null ? void 0 : _e.type) === "object" ? fields[propKey].objectFields : fields;
|
600
604
|
return walkObject({
|
601
605
|
value,
|
602
606
|
fields: objectFields,
|
@@ -1432,7 +1436,8 @@ init_react_import();
|
|
1432
1436
|
var defaultViewports = [
|
1433
1437
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1434
1438
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1435
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1439
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" },
|
1440
|
+
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
1436
1441
|
];
|
1437
1442
|
|
1438
1443
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
@@ -1678,7 +1683,7 @@ var flattenData = (state, config) => {
|
|
1678
1683
|
(content) => content,
|
1679
1684
|
(item) => {
|
1680
1685
|
data.push(item);
|
1681
|
-
return
|
1686
|
+
return item;
|
1682
1687
|
}
|
1683
1688
|
);
|
1684
1689
|
return data;
|
@@ -1686,13 +1691,425 @@ var flattenData = (state, config) => {
|
|
1686
1691
|
|
1687
1692
|
// ../core/lib/get-changed.ts
|
1688
1693
|
init_react_import();
|
1689
|
-
|
1694
|
+
|
1695
|
+
// ../../node_modules/fast-equals/dist/esm/index.mjs
|
1696
|
+
init_react_import();
|
1697
|
+
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
1698
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
1699
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
1700
|
+
function combineComparators(comparatorA, comparatorB) {
|
1701
|
+
return function isEqual(a, b, state) {
|
1702
|
+
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
1703
|
+
};
|
1704
|
+
}
|
1705
|
+
function createIsCircular(areItemsEqual) {
|
1706
|
+
return function isCircular(a, b, state) {
|
1707
|
+
if (!a || !b || typeof a !== "object" || typeof b !== "object") {
|
1708
|
+
return areItemsEqual(a, b, state);
|
1709
|
+
}
|
1710
|
+
var cache2 = state.cache;
|
1711
|
+
var cachedA = cache2.get(a);
|
1712
|
+
var cachedB = cache2.get(b);
|
1713
|
+
if (cachedA && cachedB) {
|
1714
|
+
return cachedA === b && cachedB === a;
|
1715
|
+
}
|
1716
|
+
cache2.set(a, b);
|
1717
|
+
cache2.set(b, a);
|
1718
|
+
var result = areItemsEqual(a, b, state);
|
1719
|
+
cache2.delete(a);
|
1720
|
+
cache2.delete(b);
|
1721
|
+
return result;
|
1722
|
+
};
|
1723
|
+
}
|
1724
|
+
function getStrictProperties(object) {
|
1725
|
+
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
1726
|
+
}
|
1727
|
+
var hasOwn = Object.hasOwn || function(object, property) {
|
1728
|
+
return hasOwnProperty.call(object, property);
|
1729
|
+
};
|
1730
|
+
function sameValueZeroEqual(a, b) {
|
1731
|
+
return a === b || !a && !b && a !== a && b !== b;
|
1732
|
+
}
|
1733
|
+
var PREACT_VNODE = "__v";
|
1734
|
+
var PREACT_OWNER = "__o";
|
1735
|
+
var REACT_OWNER = "_owner";
|
1736
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
1737
|
+
var keys = Object.keys;
|
1738
|
+
function areArraysEqual(a, b, state) {
|
1739
|
+
var index = a.length;
|
1740
|
+
if (b.length !== index) {
|
1741
|
+
return false;
|
1742
|
+
}
|
1743
|
+
while (index-- > 0) {
|
1744
|
+
if (!state.equals(a[index], b[index], index, index, a, b, state)) {
|
1745
|
+
return false;
|
1746
|
+
}
|
1747
|
+
}
|
1748
|
+
return true;
|
1749
|
+
}
|
1750
|
+
function areDatesEqual(a, b) {
|
1751
|
+
return sameValueZeroEqual(a.getTime(), b.getTime());
|
1752
|
+
}
|
1753
|
+
function areErrorsEqual(a, b) {
|
1754
|
+
return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
|
1755
|
+
}
|
1756
|
+
function areFunctionsEqual(a, b) {
|
1757
|
+
return a === b;
|
1758
|
+
}
|
1759
|
+
function areMapsEqual(a, b, state) {
|
1760
|
+
var size = a.size;
|
1761
|
+
if (size !== b.size) {
|
1762
|
+
return false;
|
1763
|
+
}
|
1764
|
+
if (!size) {
|
1765
|
+
return true;
|
1766
|
+
}
|
1767
|
+
var matchedIndices = new Array(size);
|
1768
|
+
var aIterable = a.entries();
|
1769
|
+
var aResult;
|
1770
|
+
var bResult;
|
1771
|
+
var index = 0;
|
1772
|
+
while (aResult = aIterable.next()) {
|
1773
|
+
if (aResult.done) {
|
1774
|
+
break;
|
1775
|
+
}
|
1776
|
+
var bIterable = b.entries();
|
1777
|
+
var hasMatch = false;
|
1778
|
+
var matchIndex = 0;
|
1779
|
+
while (bResult = bIterable.next()) {
|
1780
|
+
if (bResult.done) {
|
1781
|
+
break;
|
1782
|
+
}
|
1783
|
+
if (matchedIndices[matchIndex]) {
|
1784
|
+
matchIndex++;
|
1785
|
+
continue;
|
1786
|
+
}
|
1787
|
+
var aEntry = aResult.value;
|
1788
|
+
var bEntry = bResult.value;
|
1789
|
+
if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state) && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
|
1790
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
1791
|
+
break;
|
1792
|
+
}
|
1793
|
+
matchIndex++;
|
1794
|
+
}
|
1795
|
+
if (!hasMatch) {
|
1796
|
+
return false;
|
1797
|
+
}
|
1798
|
+
index++;
|
1799
|
+
}
|
1800
|
+
return true;
|
1801
|
+
}
|
1802
|
+
var areNumbersEqual = sameValueZeroEqual;
|
1803
|
+
function areObjectsEqual(a, b, state) {
|
1804
|
+
var properties = keys(a);
|
1805
|
+
var index = properties.length;
|
1806
|
+
if (keys(b).length !== index) {
|
1807
|
+
return false;
|
1808
|
+
}
|
1809
|
+
while (index-- > 0) {
|
1810
|
+
if (!isPropertyEqual(a, b, state, properties[index])) {
|
1811
|
+
return false;
|
1812
|
+
}
|
1813
|
+
}
|
1814
|
+
return true;
|
1815
|
+
}
|
1816
|
+
function areObjectsEqualStrict(a, b, state) {
|
1817
|
+
var properties = getStrictProperties(a);
|
1818
|
+
var index = properties.length;
|
1819
|
+
if (getStrictProperties(b).length !== index) {
|
1820
|
+
return false;
|
1821
|
+
}
|
1822
|
+
var property;
|
1823
|
+
var descriptorA;
|
1824
|
+
var descriptorB;
|
1825
|
+
while (index-- > 0) {
|
1826
|
+
property = properties[index];
|
1827
|
+
if (!isPropertyEqual(a, b, state, property)) {
|
1828
|
+
return false;
|
1829
|
+
}
|
1830
|
+
descriptorA = getOwnPropertyDescriptor(a, property);
|
1831
|
+
descriptorB = getOwnPropertyDescriptor(b, property);
|
1832
|
+
if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) {
|
1833
|
+
return false;
|
1834
|
+
}
|
1835
|
+
}
|
1836
|
+
return true;
|
1837
|
+
}
|
1838
|
+
function arePrimitiveWrappersEqual(a, b) {
|
1839
|
+
return sameValueZeroEqual(a.valueOf(), b.valueOf());
|
1840
|
+
}
|
1841
|
+
function areRegExpsEqual(a, b) {
|
1842
|
+
return a.source === b.source && a.flags === b.flags;
|
1843
|
+
}
|
1844
|
+
function areSetsEqual(a, b, state) {
|
1845
|
+
var size = a.size;
|
1846
|
+
if (size !== b.size) {
|
1847
|
+
return false;
|
1848
|
+
}
|
1849
|
+
if (!size) {
|
1850
|
+
return true;
|
1851
|
+
}
|
1852
|
+
var matchedIndices = new Array(size);
|
1853
|
+
var aIterable = a.values();
|
1854
|
+
var aResult;
|
1855
|
+
var bResult;
|
1856
|
+
while (aResult = aIterable.next()) {
|
1857
|
+
if (aResult.done) {
|
1858
|
+
break;
|
1859
|
+
}
|
1860
|
+
var bIterable = b.values();
|
1861
|
+
var hasMatch = false;
|
1862
|
+
var matchIndex = 0;
|
1863
|
+
while (bResult = bIterable.next()) {
|
1864
|
+
if (bResult.done) {
|
1865
|
+
break;
|
1866
|
+
}
|
1867
|
+
if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
|
1868
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
1869
|
+
break;
|
1870
|
+
}
|
1871
|
+
matchIndex++;
|
1872
|
+
}
|
1873
|
+
if (!hasMatch) {
|
1874
|
+
return false;
|
1875
|
+
}
|
1876
|
+
}
|
1877
|
+
return true;
|
1878
|
+
}
|
1879
|
+
function areTypedArraysEqual(a, b) {
|
1880
|
+
var index = a.length;
|
1881
|
+
if (b.length !== index) {
|
1882
|
+
return false;
|
1883
|
+
}
|
1884
|
+
while (index-- > 0) {
|
1885
|
+
if (a[index] !== b[index]) {
|
1886
|
+
return false;
|
1887
|
+
}
|
1888
|
+
}
|
1889
|
+
return true;
|
1890
|
+
}
|
1891
|
+
function areUrlsEqual(a, b) {
|
1892
|
+
return a.hostname === b.hostname && a.pathname === b.pathname && a.protocol === b.protocol && a.port === b.port && a.hash === b.hash && a.username === b.username && a.password === b.password;
|
1893
|
+
}
|
1894
|
+
function isPropertyEqual(a, b, state, property) {
|
1895
|
+
if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) {
|
1896
|
+
return true;
|
1897
|
+
}
|
1898
|
+
return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
|
1899
|
+
}
|
1900
|
+
var ARGUMENTS_TAG = "[object Arguments]";
|
1901
|
+
var BOOLEAN_TAG = "[object Boolean]";
|
1902
|
+
var DATE_TAG = "[object Date]";
|
1903
|
+
var ERROR_TAG = "[object Error]";
|
1904
|
+
var MAP_TAG = "[object Map]";
|
1905
|
+
var NUMBER_TAG = "[object Number]";
|
1906
|
+
var OBJECT_TAG = "[object Object]";
|
1907
|
+
var REG_EXP_TAG = "[object RegExp]";
|
1908
|
+
var SET_TAG = "[object Set]";
|
1909
|
+
var STRING_TAG = "[object String]";
|
1910
|
+
var URL_TAG = "[object URL]";
|
1911
|
+
var isArray = Array.isArray;
|
1912
|
+
var isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null;
|
1913
|
+
var assign = Object.assign;
|
1914
|
+
var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
|
1915
|
+
function createEqualityComparator(_a) {
|
1916
|
+
var areArraysEqual2 = _a.areArraysEqual, areDatesEqual2 = _a.areDatesEqual, areErrorsEqual2 = _a.areErrorsEqual, areFunctionsEqual2 = _a.areFunctionsEqual, areMapsEqual2 = _a.areMapsEqual, areNumbersEqual2 = _a.areNumbersEqual, areObjectsEqual2 = _a.areObjectsEqual, arePrimitiveWrappersEqual2 = _a.arePrimitiveWrappersEqual, areRegExpsEqual2 = _a.areRegExpsEqual, areSetsEqual2 = _a.areSetsEqual, areTypedArraysEqual2 = _a.areTypedArraysEqual, areUrlsEqual2 = _a.areUrlsEqual;
|
1917
|
+
return function comparator(a, b, state) {
|
1918
|
+
if (a === b) {
|
1919
|
+
return true;
|
1920
|
+
}
|
1921
|
+
if (a == null || b == null) {
|
1922
|
+
return false;
|
1923
|
+
}
|
1924
|
+
var type = typeof a;
|
1925
|
+
if (type !== typeof b) {
|
1926
|
+
return false;
|
1927
|
+
}
|
1928
|
+
if (type !== "object") {
|
1929
|
+
if (type === "number") {
|
1930
|
+
return areNumbersEqual2(a, b, state);
|
1931
|
+
}
|
1932
|
+
if (type === "function") {
|
1933
|
+
return areFunctionsEqual2(a, b, state);
|
1934
|
+
}
|
1935
|
+
return false;
|
1936
|
+
}
|
1937
|
+
var constructor = a.constructor;
|
1938
|
+
if (constructor !== b.constructor) {
|
1939
|
+
return false;
|
1940
|
+
}
|
1941
|
+
if (constructor === Object) {
|
1942
|
+
return areObjectsEqual2(a, b, state);
|
1943
|
+
}
|
1944
|
+
if (isArray(a)) {
|
1945
|
+
return areArraysEqual2(a, b, state);
|
1946
|
+
}
|
1947
|
+
if (isTypedArray != null && isTypedArray(a)) {
|
1948
|
+
return areTypedArraysEqual2(a, b, state);
|
1949
|
+
}
|
1950
|
+
if (constructor === Date) {
|
1951
|
+
return areDatesEqual2(a, b, state);
|
1952
|
+
}
|
1953
|
+
if (constructor === RegExp) {
|
1954
|
+
return areRegExpsEqual2(a, b, state);
|
1955
|
+
}
|
1956
|
+
if (constructor === Map) {
|
1957
|
+
return areMapsEqual2(a, b, state);
|
1958
|
+
}
|
1959
|
+
if (constructor === Set) {
|
1960
|
+
return areSetsEqual2(a, b, state);
|
1961
|
+
}
|
1962
|
+
var tag = getTag(a);
|
1963
|
+
if (tag === DATE_TAG) {
|
1964
|
+
return areDatesEqual2(a, b, state);
|
1965
|
+
}
|
1966
|
+
if (tag === REG_EXP_TAG) {
|
1967
|
+
return areRegExpsEqual2(a, b, state);
|
1968
|
+
}
|
1969
|
+
if (tag === MAP_TAG) {
|
1970
|
+
return areMapsEqual2(a, b, state);
|
1971
|
+
}
|
1972
|
+
if (tag === SET_TAG) {
|
1973
|
+
return areSetsEqual2(a, b, state);
|
1974
|
+
}
|
1975
|
+
if (tag === OBJECT_TAG) {
|
1976
|
+
return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state);
|
1977
|
+
}
|
1978
|
+
if (tag === URL_TAG) {
|
1979
|
+
return areUrlsEqual2(a, b, state);
|
1980
|
+
}
|
1981
|
+
if (tag === ERROR_TAG) {
|
1982
|
+
return areErrorsEqual2(a, b, state);
|
1983
|
+
}
|
1984
|
+
if (tag === ARGUMENTS_TAG) {
|
1985
|
+
return areObjectsEqual2(a, b, state);
|
1986
|
+
}
|
1987
|
+
if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
|
1988
|
+
return arePrimitiveWrappersEqual2(a, b, state);
|
1989
|
+
}
|
1990
|
+
return false;
|
1991
|
+
};
|
1992
|
+
}
|
1993
|
+
function createEqualityComparatorConfig(_a) {
|
1994
|
+
var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
|
1995
|
+
var config = {
|
1996
|
+
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
1997
|
+
areDatesEqual,
|
1998
|
+
areErrorsEqual,
|
1999
|
+
areFunctionsEqual,
|
2000
|
+
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
2001
|
+
areNumbersEqual,
|
2002
|
+
areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
|
2003
|
+
arePrimitiveWrappersEqual,
|
2004
|
+
areRegExpsEqual,
|
2005
|
+
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
2006
|
+
areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
|
2007
|
+
areUrlsEqual
|
2008
|
+
};
|
2009
|
+
if (createCustomConfig) {
|
2010
|
+
config = assign({}, config, createCustomConfig(config));
|
2011
|
+
}
|
2012
|
+
if (circular) {
|
2013
|
+
var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
|
2014
|
+
var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
|
2015
|
+
var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
|
2016
|
+
var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
|
2017
|
+
config = assign({}, config, {
|
2018
|
+
areArraysEqual: areArraysEqual$1,
|
2019
|
+
areMapsEqual: areMapsEqual$1,
|
2020
|
+
areObjectsEqual: areObjectsEqual$1,
|
2021
|
+
areSetsEqual: areSetsEqual$1
|
2022
|
+
});
|
2023
|
+
}
|
2024
|
+
return config;
|
2025
|
+
}
|
2026
|
+
function createInternalEqualityComparator(compare) {
|
2027
|
+
return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
|
2028
|
+
return compare(a, b, state);
|
2029
|
+
};
|
2030
|
+
}
|
2031
|
+
function createIsEqual(_a) {
|
2032
|
+
var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
|
2033
|
+
if (createState) {
|
2034
|
+
return function isEqual(a, b) {
|
2035
|
+
var _a2 = createState(), _b = _a2.cache, cache2 = _b === void 0 ? circular ? /* @__PURE__ */ new WeakMap() : void 0 : _b, meta = _a2.meta;
|
2036
|
+
return comparator(a, b, {
|
2037
|
+
cache: cache2,
|
2038
|
+
equals,
|
2039
|
+
meta,
|
2040
|
+
strict
|
2041
|
+
});
|
2042
|
+
};
|
2043
|
+
}
|
2044
|
+
if (circular) {
|
2045
|
+
return function isEqual(a, b) {
|
2046
|
+
return comparator(a, b, {
|
2047
|
+
cache: /* @__PURE__ */ new WeakMap(),
|
2048
|
+
equals,
|
2049
|
+
meta: void 0,
|
2050
|
+
strict
|
2051
|
+
});
|
2052
|
+
};
|
2053
|
+
}
|
2054
|
+
var state = {
|
2055
|
+
cache: void 0,
|
2056
|
+
equals,
|
2057
|
+
meta: void 0,
|
2058
|
+
strict
|
2059
|
+
};
|
2060
|
+
return function isEqual(a, b) {
|
2061
|
+
return comparator(a, b, state);
|
2062
|
+
};
|
2063
|
+
}
|
2064
|
+
var deepEqual = createCustomEqual();
|
2065
|
+
var strictDeepEqual = createCustomEqual({ strict: true });
|
2066
|
+
var circularDeepEqual = createCustomEqual({ circular: true });
|
2067
|
+
var strictCircularDeepEqual = createCustomEqual({
|
2068
|
+
circular: true,
|
2069
|
+
strict: true
|
2070
|
+
});
|
2071
|
+
var shallowEqual = createCustomEqual({
|
2072
|
+
createInternalComparator: function() {
|
2073
|
+
return sameValueZeroEqual;
|
2074
|
+
}
|
2075
|
+
});
|
2076
|
+
var strictShallowEqual = createCustomEqual({
|
2077
|
+
strict: true,
|
2078
|
+
createInternalComparator: function() {
|
2079
|
+
return sameValueZeroEqual;
|
2080
|
+
}
|
2081
|
+
});
|
2082
|
+
var circularShallowEqual = createCustomEqual({
|
2083
|
+
circular: true,
|
2084
|
+
createInternalComparator: function() {
|
2085
|
+
return sameValueZeroEqual;
|
2086
|
+
}
|
2087
|
+
});
|
2088
|
+
var strictCircularShallowEqual = createCustomEqual({
|
2089
|
+
circular: true,
|
2090
|
+
createInternalComparator: function() {
|
2091
|
+
return sameValueZeroEqual;
|
2092
|
+
},
|
2093
|
+
strict: true
|
2094
|
+
});
|
2095
|
+
function createCustomEqual(options) {
|
2096
|
+
if (options === void 0) {
|
2097
|
+
options = {};
|
2098
|
+
}
|
2099
|
+
var _a = options.circular, circular = _a === void 0 ? false : _a, createCustomInternalComparator = options.createInternalComparator, createState = options.createState, _b = options.strict, strict = _b === void 0 ? false : _b;
|
2100
|
+
var config = createEqualityComparatorConfig(options);
|
2101
|
+
var comparator = createEqualityComparator(config);
|
2102
|
+
var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
|
2103
|
+
return createIsEqual({ circular, comparator, createState, equals, strict });
|
2104
|
+
}
|
2105
|
+
|
2106
|
+
// ../core/lib/get-changed.ts
|
1690
2107
|
var getChanged = (newItem, oldItem) => {
|
1691
2108
|
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1692
2109
|
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1693
2110
|
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1694
2111
|
return __spreadProps(__spreadValues({}, acc), {
|
1695
|
-
[item]: !(
|
2112
|
+
[item]: !deepEqual(oldItemProps[item], newItemProps[item])
|
1696
2113
|
});
|
1697
2114
|
}, {}) : {};
|
1698
2115
|
};
|
@@ -1817,7 +2234,6 @@ var createFieldsSlice = (_set, _get) => {
|
|
1817
2234
|
|
1818
2235
|
// ../core/lib/resolve-component-data.ts
|
1819
2236
|
init_react_import();
|
1820
|
-
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
1821
2237
|
var cache = { lastChange: {} };
|
1822
2238
|
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
1823
2239
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
@@ -1826,7 +2242,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1826
2242
|
const id = "id" in item.props ? item.props.id : "root";
|
1827
2243
|
if (shouldRunResolver) {
|
1828
2244
|
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1829
|
-
if (trigger !== "force" && item && (
|
2245
|
+
if (trigger !== "force" && item && deepEqual(item, oldItem)) {
|
1830
2246
|
return { node: resolved, didChange: false };
|
1831
2247
|
}
|
1832
2248
|
const changed = getChanged(item, oldItem);
|
@@ -1876,7 +2292,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1876
2292
|
};
|
1877
2293
|
return {
|
1878
2294
|
node: itemWithResolvedChildren,
|
1879
|
-
didChange: !(
|
2295
|
+
didChange: !deepEqual(item, itemWithResolvedChildren)
|
1880
2296
|
};
|
1881
2297
|
});
|
1882
2298
|
|
@@ -1917,7 +2333,8 @@ var defaultAppState = {
|
|
1917
2333
|
options: [],
|
1918
2334
|
controlsVisible: true
|
1919
2335
|
},
|
1920
|
-
field: { focus: null }
|
2336
|
+
field: { focus: null },
|
2337
|
+
plugin: { current: null }
|
1921
2338
|
},
|
1922
2339
|
indexes: {
|
1923
2340
|
nodes: {},
|
@@ -1933,6 +2350,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
1933
2350
|
subscribeWithSelector((set, get) => {
|
1934
2351
|
var _a, _b;
|
1935
2352
|
return __spreadProps(__spreadValues({
|
2353
|
+
instanceId: generateId(),
|
1936
2354
|
state: defaultAppState,
|
1937
2355
|
config: { components: {} },
|
1938
2356
|
componentState: {},
|
@@ -2103,203 +2521,14 @@ var createAppStore = (initialAppStore) => create()(
|
|
2103
2521
|
})
|
2104
2522
|
);
|
2105
2523
|
var appStoreContext = createContext(createAppStore());
|
2106
|
-
function useAppStore(selector) {
|
2107
|
-
const context = useContext(appStoreContext);
|
2108
|
-
return useStore(context, selector);
|
2109
|
-
}
|
2110
|
-
function useAppStoreApi() {
|
2111
|
-
return useContext(appStoreContext);
|
2112
|
-
}
|
2113
|
-
|
2114
|
-
// ../core/lib/use-breadcrumbs.ts
|
2115
|
-
var useBreadcrumbs = (renderCount) => {
|
2116
|
-
const selectedId = useAppStore((s) => {
|
2117
|
-
var _a;
|
2118
|
-
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
2119
|
-
});
|
2120
|
-
const config = useAppStore((s) => s.config);
|
2121
|
-
const path = useAppStore((s) => {
|
2122
|
-
var _a;
|
2123
|
-
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
2124
|
-
});
|
2125
|
-
const appStore = useAppStoreApi();
|
2126
|
-
return useMemo(() => {
|
2127
|
-
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
2128
|
-
var _a, _b, _c;
|
2129
|
-
const [componentId] = zoneCompound.split(":");
|
2130
|
-
if (componentId === "root") {
|
2131
|
-
return {
|
2132
|
-
label: "Page",
|
2133
|
-
selector: null
|
2134
|
-
};
|
2135
|
-
}
|
2136
|
-
const node = appStore.getState().state.indexes.nodes[componentId];
|
2137
|
-
const parentId = node.path[node.path.length - 1];
|
2138
|
-
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
2139
|
-
const index = contentIds.indexOf(componentId);
|
2140
|
-
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
2141
|
-
return {
|
2142
|
-
label,
|
2143
|
-
selector: node ? {
|
2144
|
-
index,
|
2145
|
-
zone: node.path[node.path.length - 1]
|
2146
|
-
} : null
|
2147
|
-
};
|
2148
|
-
})) || [];
|
2149
|
-
if (renderCount) {
|
2150
|
-
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
2151
|
-
}
|
2152
|
-
return breadcrumbs;
|
2153
|
-
}, [path, renderCount]);
|
2154
|
-
};
|
2155
|
-
|
2156
|
-
// ../core/components/Loader/index.tsx
|
2157
|
-
init_react_import();
|
2158
|
-
|
2159
|
-
// ../core/lib/index.ts
|
2160
|
-
init_react_import();
|
2161
|
-
|
2162
|
-
// ../core/lib/filter.ts
|
2163
|
-
init_react_import();
|
2164
|
-
|
2165
|
-
// ../core/lib/data/reorder.ts
|
2166
|
-
init_react_import();
|
2167
|
-
|
2168
|
-
// ../core/lib/data/replace.ts
|
2169
|
-
init_react_import();
|
2170
|
-
|
2171
|
-
// ../core/lib/use-reset-auto-zoom.ts
|
2172
|
-
init_react_import();
|
2173
2524
|
|
2174
2525
|
// ../core/lib/get-zoom-config.ts
|
2175
2526
|
init_react_import();
|
2176
2527
|
|
2177
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
2178
|
-
init_react_import();
|
2179
|
-
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
2180
|
-
|
2181
|
-
// ../core/components/Loader/index.tsx
|
2182
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
2183
|
-
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
2184
|
-
var Loader = (_a) => {
|
2185
|
-
var _b = _a, {
|
2186
|
-
color,
|
2187
|
-
size = 16
|
2188
|
-
} = _b, props = __objRest(_b, [
|
2189
|
-
"color",
|
2190
|
-
"size"
|
2191
|
-
]);
|
2192
|
-
return /* @__PURE__ */ jsx2(
|
2193
|
-
"span",
|
2194
|
-
__spreadValues({
|
2195
|
-
className: getClassName2(),
|
2196
|
-
style: {
|
2197
|
-
width: size,
|
2198
|
-
height: size,
|
2199
|
-
color
|
2200
|
-
},
|
2201
|
-
"aria-label": "loading"
|
2202
|
-
}, props)
|
2203
|
-
);
|
2204
|
-
};
|
2205
|
-
|
2206
|
-
// ../core/components/SidebarSection/index.tsx
|
2207
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
2208
|
-
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
2209
|
-
var SidebarSection = ({
|
2210
|
-
children,
|
2211
|
-
title,
|
2212
|
-
background,
|
2213
|
-
showBreadcrumbs,
|
2214
|
-
noBorderTop,
|
2215
|
-
noPadding,
|
2216
|
-
isLoading
|
2217
|
-
}) => {
|
2218
|
-
const setUi = useAppStore((s) => s.setUi);
|
2219
|
-
const breadcrumbs = useBreadcrumbs(1);
|
2220
|
-
return /* @__PURE__ */ jsxs(
|
2221
|
-
"div",
|
2222
|
-
{
|
2223
|
-
className: getClassName3({ noBorderTop, noPadding }),
|
2224
|
-
style: { background },
|
2225
|
-
children: [
|
2226
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
|
2227
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumb"), children: [
|
2228
|
-
/* @__PURE__ */ jsx3(
|
2229
|
-
"button",
|
2230
|
-
{
|
2231
|
-
type: "button",
|
2232
|
-
className: getClassName3("breadcrumbLabel"),
|
2233
|
-
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
2234
|
-
children: breadcrumb.label
|
2235
|
-
}
|
2236
|
-
),
|
2237
|
-
/* @__PURE__ */ jsx3(ChevronRight, { size: 16 })
|
2238
|
-
] }, i)) : null,
|
2239
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx3(Heading, { rank: "2", size: "xs", children: title }) })
|
2240
|
-
] }) }),
|
2241
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("content"), children }),
|
2242
|
-
isLoading && /* @__PURE__ */ jsx3("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx3(Loader, { size: 32 }) })
|
2243
|
-
]
|
2244
|
-
}
|
2245
|
-
);
|
2246
|
-
};
|
2247
|
-
|
2248
|
-
// ../core/components/OutlineList/index.tsx
|
2249
|
-
init_react_import();
|
2250
|
-
|
2251
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
2252
|
-
init_react_import();
|
2253
|
-
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
2254
|
-
|
2255
|
-
// ../core/components/OutlineList/index.tsx
|
2256
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
2257
|
-
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
2258
|
-
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
2259
|
-
var OutlineList = ({ children }) => {
|
2260
|
-
return /* @__PURE__ */ jsx4("ul", { className: getClassName4(), children });
|
2261
|
-
};
|
2262
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx4("div", { className: getClassNameItem({ clickable: true }), children });
|
2263
|
-
OutlineList.Item = ({
|
2264
|
-
children,
|
2265
|
-
onClick
|
2266
|
-
}) => {
|
2267
|
-
return /* @__PURE__ */ jsx4(
|
2268
|
-
"li",
|
2269
|
-
{
|
2270
|
-
className: getClassNameItem({ clickable: !!onClick }),
|
2271
|
-
onClick,
|
2272
|
-
children
|
2273
|
-
}
|
2274
|
-
);
|
2275
|
-
};
|
2276
|
-
|
2277
|
-
// ../core/lib/scroll-into-view.ts
|
2278
|
-
init_react_import();
|
2279
|
-
var scrollIntoView = (el) => {
|
2280
|
-
const oldStyle = __spreadValues({}, el.style);
|
2281
|
-
el.style.scrollMargin = "256px";
|
2282
|
-
if (el) {
|
2283
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
2284
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
2285
|
-
}
|
2286
|
-
};
|
2287
|
-
|
2288
|
-
// ../core/lib/get-frame.ts
|
2289
|
-
init_react_import();
|
2290
|
-
var getFrame = () => {
|
2291
|
-
if (typeof window === "undefined") return;
|
2292
|
-
let frameEl = document.querySelector("#preview-frame");
|
2293
|
-
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
2294
|
-
return frameEl.contentDocument || document;
|
2295
|
-
}
|
2296
|
-
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
2297
|
-
};
|
2298
|
-
|
2299
2528
|
// src/HeadingAnalyzer.tsx
|
2300
2529
|
import ReactFromJSONModule from "react-from-json";
|
2301
|
-
import { Fragment, jsx as
|
2302
|
-
var
|
2530
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
2531
|
+
var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
2303
2532
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
2304
2533
|
var ReactFromJSON = ReactFromJSONModule.default || ReactFromJSONModule;
|
2305
2534
|
var getOutline = ({ frame } = {}) => {
|
@@ -2390,11 +2619,11 @@ var HeadingAnalyzer = () => {
|
|
2390
2619
|
frameObserver.disconnect();
|
2391
2620
|
};
|
2392
2621
|
}, [data]);
|
2393
|
-
return /* @__PURE__ */
|
2394
|
-
/* @__PURE__ */
|
2622
|
+
return /* @__PURE__ */ jsxs("div", { className: getClassName2(), children: [
|
2623
|
+
/* @__PURE__ */ jsxs(
|
2395
2624
|
"small",
|
2396
2625
|
{
|
2397
|
-
className:
|
2626
|
+
className: getClassName2("cssWarning"),
|
2398
2627
|
style: {
|
2399
2628
|
color: "var(--puck-color-red-04)",
|
2400
2629
|
display: "block",
|
@@ -2403,19 +2632,19 @@ var HeadingAnalyzer = () => {
|
|
2403
2632
|
children: [
|
2404
2633
|
"Heading analyzer styles not loaded. Please review the",
|
2405
2634
|
" ",
|
2406
|
-
/* @__PURE__ */
|
2635
|
+
/* @__PURE__ */ jsx2("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
2407
2636
|
"."
|
2408
2637
|
]
|
2409
2638
|
}
|
2410
2639
|
),
|
2411
|
-
hierarchy.length === 0 && /* @__PURE__ */
|
2412
|
-
/* @__PURE__ */
|
2640
|
+
hierarchy.length === 0 && /* @__PURE__ */ jsx2("div", { children: "No headings." }),
|
2641
|
+
/* @__PURE__ */ jsx2(OutlineList, { children: /* @__PURE__ */ jsx2(
|
2413
2642
|
ReactFromJSON,
|
2414
2643
|
{
|
2415
2644
|
mapping: {
|
2416
|
-
Root: (props) => /* @__PURE__ */
|
2417
|
-
OutlineListItem: (props) => /* @__PURE__ */
|
2418
|
-
/* @__PURE__ */
|
2645
|
+
Root: (props) => /* @__PURE__ */ jsx2(Fragment, { children: props.children }),
|
2646
|
+
OutlineListItem: (props) => /* @__PURE__ */ jsxs(OutlineList.Item, { children: [
|
2647
|
+
/* @__PURE__ */ jsx2(OutlineList.Clickable, { children: /* @__PURE__ */ jsx2(
|
2419
2648
|
"small",
|
2420
2649
|
{
|
2421
2650
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -2433,14 +2662,14 @@ var HeadingAnalyzer = () => {
|
|
2433
2662
|
}, 2e3);
|
2434
2663
|
}
|
2435
2664
|
},
|
2436
|
-
children: props.missing ? /* @__PURE__ */
|
2437
|
-
/* @__PURE__ */
|
2665
|
+
children: props.missing ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
2666
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
2438
2667
|
"H",
|
2439
2668
|
props.rank
|
2440
2669
|
] }),
|
2441
2670
|
": Missing"
|
2442
|
-
] }) : /* @__PURE__ */
|
2443
|
-
/* @__PURE__ */
|
2671
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
2672
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
2444
2673
|
"H",
|
2445
2674
|
props.rank
|
2446
2675
|
] }),
|
@@ -2449,7 +2678,7 @@ var HeadingAnalyzer = () => {
|
|
2449
2678
|
] })
|
2450
2679
|
}
|
2451
2680
|
) }),
|
2452
|
-
/* @__PURE__ */
|
2681
|
+
/* @__PURE__ */ jsx2(OutlineList, { children: props.children })
|
2453
2682
|
] })
|
2454
2683
|
},
|
2455
2684
|
entry: {
|
@@ -2470,12 +2699,10 @@ var HeadingAnalyzer = () => {
|
|
2470
2699
|
] });
|
2471
2700
|
};
|
2472
2701
|
var headingAnalyzer = {
|
2473
|
-
|
2474
|
-
|
2475
|
-
|
2476
|
-
|
2477
|
-
] })
|
2478
|
-
}
|
2702
|
+
name: "heading-analyzer",
|
2703
|
+
label: "Audit",
|
2704
|
+
render: HeadingAnalyzer,
|
2705
|
+
icon: /* @__PURE__ */ jsx2(Heading1, {})
|
2479
2706
|
};
|
2480
2707
|
var HeadingAnalyzer_default = headingAnalyzer;
|
2481
2708
|
export {
|
@@ -2522,7 +2749,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
2522
2749
|
* See the LICENSE file in the root directory of this source tree.
|
2523
2750
|
*)
|
2524
2751
|
|
2525
|
-
lucide-react/dist/esm/icons/
|
2752
|
+
lucide-react/dist/esm/icons/heading-1.js:
|
2526
2753
|
(**
|
2527
2754
|
* @license lucide-react v0.468.0 - ISC
|
2528
2755
|
*
|