@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.js
CHANGED
@@ -98,7 +98,7 @@ var require_classnames = __commonJS({
|
|
98
98
|
init_react_import();
|
99
99
|
(function() {
|
100
100
|
"use strict";
|
101
|
-
var
|
101
|
+
var hasOwn2 = {}.hasOwnProperty;
|
102
102
|
function classNames() {
|
103
103
|
var classes = "";
|
104
104
|
for (var i = 0; i < arguments.length; i++) {
|
@@ -124,7 +124,7 @@ var require_classnames = __commonJS({
|
|
124
124
|
}
|
125
125
|
var classes = "";
|
126
126
|
for (var key in arg) {
|
127
|
-
if (
|
127
|
+
if (hasOwn2.call(arg, key) && arg[key]) {
|
128
128
|
classes = appendClass(classes, key);
|
129
129
|
}
|
130
130
|
}
|
@@ -213,11 +213,11 @@ var require_flat = __commonJS({
|
|
213
213
|
}
|
214
214
|
function isEmpty(val) {
|
215
215
|
const type = Object.prototype.toString.call(val);
|
216
|
-
const
|
216
|
+
const isArray2 = type === "[object Array]";
|
217
217
|
const isObject = type === "[object Object]";
|
218
218
|
if (!val) {
|
219
219
|
return true;
|
220
|
-
} else if (
|
220
|
+
} else if (isArray2) {
|
221
221
|
return !val.length;
|
222
222
|
} else if (isObject) {
|
223
223
|
return !Object.keys(val).length;
|
@@ -267,42 +267,6 @@ var require_flat = __commonJS({
|
|
267
267
|
}
|
268
268
|
});
|
269
269
|
|
270
|
-
// ../../node_modules/fast-deep-equal/index.js
|
271
|
-
var require_fast_deep_equal = __commonJS({
|
272
|
-
"../../node_modules/fast-deep-equal/index.js"(exports2, module2) {
|
273
|
-
"use strict";
|
274
|
-
init_react_import();
|
275
|
-
module2.exports = function equal(a, b) {
|
276
|
-
if (a === b) return true;
|
277
|
-
if (a && b && typeof a == "object" && typeof b == "object") {
|
278
|
-
if (a.constructor !== b.constructor) return false;
|
279
|
-
var length, i, keys;
|
280
|
-
if (Array.isArray(a)) {
|
281
|
-
length = a.length;
|
282
|
-
if (length != b.length) return false;
|
283
|
-
for (i = length; i-- !== 0; )
|
284
|
-
if (!equal(a[i], b[i])) return false;
|
285
|
-
return true;
|
286
|
-
}
|
287
|
-
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
288
|
-
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
289
|
-
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
290
|
-
keys = Object.keys(a);
|
291
|
-
length = keys.length;
|
292
|
-
if (length !== Object.keys(b).length) return false;
|
293
|
-
for (i = length; i-- !== 0; )
|
294
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
295
|
-
for (i = length; i-- !== 0; ) {
|
296
|
-
var key = keys[i];
|
297
|
-
if (!equal(a[key], b[key])) return false;
|
298
|
-
}
|
299
|
-
return true;
|
300
|
-
}
|
301
|
-
return a !== a && b !== b;
|
302
|
-
};
|
303
|
-
}
|
304
|
-
});
|
305
|
-
|
306
270
|
// index.ts
|
307
271
|
var plugin_heading_analyzer_exports = {};
|
308
272
|
__export(plugin_heading_analyzer_exports, {
|
@@ -313,21 +277,21 @@ init_react_import();
|
|
313
277
|
|
314
278
|
// src/HeadingAnalyzer.tsx
|
315
279
|
init_react_import();
|
316
|
-
var
|
280
|
+
var import_react10 = require("react");
|
317
281
|
|
318
282
|
// css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
|
319
283
|
init_react_import();
|
320
|
-
var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "
|
284
|
+
var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_yg0s7_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_yg0s7_6", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_yg0s7_10", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_yg0s7_14" };
|
321
285
|
|
322
286
|
// src/HeadingAnalyzer.tsx
|
323
287
|
var import_puck = require("@measured/puck");
|
324
288
|
|
325
|
-
// ../core/components/
|
289
|
+
// ../core/components/OutlineList/index.tsx
|
326
290
|
init_react_import();
|
327
291
|
|
328
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/
|
292
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
329
293
|
init_react_import();
|
330
|
-
var styles_module_default = { "
|
294
|
+
var styles_module_default = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
331
295
|
|
332
296
|
// ../core/lib/get-class-name-factory.ts
|
333
297
|
init_react_import();
|
@@ -356,29 +320,50 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
|
|
356
320
|
};
|
357
321
|
var get_class_name_factory_default = getClassNameFactory;
|
358
322
|
|
359
|
-
// ../core/components/
|
360
|
-
init_react_import();
|
361
|
-
|
362
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
|
363
|
-
init_react_import();
|
364
|
-
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" };
|
365
|
-
|
366
|
-
// ../core/components/Heading/index.tsx
|
323
|
+
// ../core/components/OutlineList/index.tsx
|
367
324
|
var import_jsx_runtime = require("react/jsx-runtime");
|
368
|
-
var getClassName = get_class_name_factory_default("
|
369
|
-
var
|
370
|
-
|
325
|
+
var getClassName = get_class_name_factory_default("OutlineList", styles_module_default);
|
326
|
+
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default);
|
327
|
+
var OutlineList = ({ children }) => {
|
328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: getClassName(), children });
|
329
|
+
};
|
330
|
+
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
|
331
|
+
OutlineList.Item = ({
|
332
|
+
children,
|
333
|
+
onClick
|
334
|
+
}) => {
|
371
335
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
372
|
-
|
336
|
+
"li",
|
373
337
|
{
|
374
|
-
className:
|
375
|
-
|
376
|
-
}),
|
338
|
+
className: getClassNameItem({ clickable: !!onClick }),
|
339
|
+
onClick,
|
377
340
|
children
|
378
341
|
}
|
379
342
|
);
|
380
343
|
};
|
381
344
|
|
345
|
+
// ../core/lib/scroll-into-view.ts
|
346
|
+
init_react_import();
|
347
|
+
var scrollIntoView = (el) => {
|
348
|
+
const oldStyle = __spreadValues({}, el.style);
|
349
|
+
el.style.scrollMargin = "256px";
|
350
|
+
if (el) {
|
351
|
+
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
352
|
+
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
353
|
+
}
|
354
|
+
};
|
355
|
+
|
356
|
+
// ../core/lib/get-frame.ts
|
357
|
+
init_react_import();
|
358
|
+
var getFrame = () => {
|
359
|
+
if (typeof window === "undefined") return;
|
360
|
+
let frameEl = document.querySelector("#preview-frame");
|
361
|
+
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
362
|
+
return frameEl.contentDocument || document;
|
363
|
+
}
|
364
|
+
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
365
|
+
};
|
366
|
+
|
382
367
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
383
368
|
init_react_import();
|
384
369
|
|
@@ -466,15 +451,29 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
466
451
|
return Component;
|
467
452
|
};
|
468
453
|
|
469
|
-
// ../../node_modules/lucide-react/dist/esm/icons/
|
454
|
+
// ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
|
470
455
|
init_react_import();
|
471
|
-
var
|
472
|
-
["path", { d: "
|
456
|
+
var Heading1 = createLucideIcon("Heading1", [
|
457
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
458
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
459
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
460
|
+
["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
|
473
461
|
]);
|
474
462
|
|
475
|
-
// ../core/lib/
|
463
|
+
// ../core/lib/index.ts
|
464
|
+
init_react_import();
|
465
|
+
|
466
|
+
// ../core/lib/filter.ts
|
467
|
+
init_react_import();
|
468
|
+
|
469
|
+
// ../core/lib/data/reorder.ts
|
470
|
+
init_react_import();
|
471
|
+
|
472
|
+
// ../core/lib/data/replace.ts
|
473
|
+
init_react_import();
|
474
|
+
|
475
|
+
// ../core/lib/use-reset-auto-zoom.ts
|
476
476
|
init_react_import();
|
477
|
-
var import_react10 = require("react");
|
478
477
|
|
479
478
|
// ../core/store/index.ts
|
480
479
|
init_react_import();
|
@@ -545,27 +544,32 @@ var walkField = ({
|
|
545
544
|
config,
|
546
545
|
recurseSlots = false
|
547
546
|
}) => {
|
548
|
-
var _a, _b, _c;
|
547
|
+
var _a, _b, _c, _d, _e;
|
549
548
|
const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
|
550
549
|
const map = mappers[fieldType];
|
551
550
|
if (map && fieldType === "slot") {
|
552
551
|
const content = value || [];
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
552
|
+
let mappedContent = content;
|
553
|
+
if (recurseSlots) {
|
554
|
+
for (let i = 0; i < content.length; i++) {
|
555
|
+
const el = content[i];
|
556
|
+
const componentConfig = config.components[el.type];
|
557
|
+
if (!componentConfig || !((_b = el.props) == null ? void 0 : _b.id)) {
|
558
|
+
continue;
|
559
|
+
}
|
560
|
+
const fields2 = (_c = componentConfig.fields) != null ? _c : {};
|
561
|
+
mappedContent.push(
|
562
|
+
walkField({
|
563
|
+
value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
|
564
|
+
fields: fields2,
|
565
|
+
mappers,
|
566
|
+
id: el.props.id,
|
567
|
+
config,
|
568
|
+
recurseSlots
|
569
|
+
})
|
570
|
+
);
|
558
571
|
}
|
559
|
-
|
560
|
-
return walkField({
|
561
|
-
value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
|
562
|
-
fields: fields2,
|
563
|
-
mappers,
|
564
|
-
id: el.props.id,
|
565
|
-
config,
|
566
|
-
recurseSlots
|
567
|
-
});
|
568
|
-
}) : content;
|
572
|
+
}
|
569
573
|
if (containsPromise(mappedContent)) {
|
570
574
|
return Promise.all(mappedContent);
|
571
575
|
}
|
@@ -587,7 +591,7 @@ var walkField = ({
|
|
587
591
|
}
|
588
592
|
if (value && typeof value === "object") {
|
589
593
|
if (Array.isArray(value)) {
|
590
|
-
const arrayFields = ((
|
594
|
+
const arrayFields = ((_d = fields[propKey]) == null ? void 0 : _d.type) === "array" ? fields[propKey].arrayFields : null;
|
591
595
|
if (!arrayFields) return value;
|
592
596
|
const newValue = value.map(
|
593
597
|
(el, idx) => walkField({
|
@@ -608,7 +612,7 @@ var walkField = ({
|
|
608
612
|
} else if ("$$typeof" in value) {
|
609
613
|
return value;
|
610
614
|
} else {
|
611
|
-
const objectFields = ((
|
615
|
+
const objectFields = ((_e = fields[propKey]) == null ? void 0 : _e.type) === "object" ? fields[propKey].objectFields : fields;
|
612
616
|
return walkObject({
|
613
617
|
value,
|
614
618
|
fields: objectFields,
|
@@ -1444,7 +1448,8 @@ init_react_import();
|
|
1444
1448
|
var defaultViewports = [
|
1445
1449
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1446
1450
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1447
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1451
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" },
|
1452
|
+
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
1448
1453
|
];
|
1449
1454
|
|
1450
1455
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
@@ -1690,7 +1695,7 @@ var flattenData = (state, config) => {
|
|
1690
1695
|
(content) => content,
|
1691
1696
|
(item) => {
|
1692
1697
|
data.push(item);
|
1693
|
-
return
|
1698
|
+
return item;
|
1694
1699
|
}
|
1695
1700
|
);
|
1696
1701
|
return data;
|
@@ -1698,13 +1703,425 @@ var flattenData = (state, config) => {
|
|
1698
1703
|
|
1699
1704
|
// ../core/lib/get-changed.ts
|
1700
1705
|
init_react_import();
|
1701
|
-
|
1706
|
+
|
1707
|
+
// ../../node_modules/fast-equals/dist/esm/index.mjs
|
1708
|
+
init_react_import();
|
1709
|
+
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
1710
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
1711
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
1712
|
+
function combineComparators(comparatorA, comparatorB) {
|
1713
|
+
return function isEqual(a, b, state) {
|
1714
|
+
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
1715
|
+
};
|
1716
|
+
}
|
1717
|
+
function createIsCircular(areItemsEqual) {
|
1718
|
+
return function isCircular(a, b, state) {
|
1719
|
+
if (!a || !b || typeof a !== "object" || typeof b !== "object") {
|
1720
|
+
return areItemsEqual(a, b, state);
|
1721
|
+
}
|
1722
|
+
var cache2 = state.cache;
|
1723
|
+
var cachedA = cache2.get(a);
|
1724
|
+
var cachedB = cache2.get(b);
|
1725
|
+
if (cachedA && cachedB) {
|
1726
|
+
return cachedA === b && cachedB === a;
|
1727
|
+
}
|
1728
|
+
cache2.set(a, b);
|
1729
|
+
cache2.set(b, a);
|
1730
|
+
var result = areItemsEqual(a, b, state);
|
1731
|
+
cache2.delete(a);
|
1732
|
+
cache2.delete(b);
|
1733
|
+
return result;
|
1734
|
+
};
|
1735
|
+
}
|
1736
|
+
function getStrictProperties(object) {
|
1737
|
+
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
1738
|
+
}
|
1739
|
+
var hasOwn = Object.hasOwn || function(object, property) {
|
1740
|
+
return hasOwnProperty.call(object, property);
|
1741
|
+
};
|
1742
|
+
function sameValueZeroEqual(a, b) {
|
1743
|
+
return a === b || !a && !b && a !== a && b !== b;
|
1744
|
+
}
|
1745
|
+
var PREACT_VNODE = "__v";
|
1746
|
+
var PREACT_OWNER = "__o";
|
1747
|
+
var REACT_OWNER = "_owner";
|
1748
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
1749
|
+
var keys = Object.keys;
|
1750
|
+
function areArraysEqual(a, b, state) {
|
1751
|
+
var index = a.length;
|
1752
|
+
if (b.length !== index) {
|
1753
|
+
return false;
|
1754
|
+
}
|
1755
|
+
while (index-- > 0) {
|
1756
|
+
if (!state.equals(a[index], b[index], index, index, a, b, state)) {
|
1757
|
+
return false;
|
1758
|
+
}
|
1759
|
+
}
|
1760
|
+
return true;
|
1761
|
+
}
|
1762
|
+
function areDatesEqual(a, b) {
|
1763
|
+
return sameValueZeroEqual(a.getTime(), b.getTime());
|
1764
|
+
}
|
1765
|
+
function areErrorsEqual(a, b) {
|
1766
|
+
return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
|
1767
|
+
}
|
1768
|
+
function areFunctionsEqual(a, b) {
|
1769
|
+
return a === b;
|
1770
|
+
}
|
1771
|
+
function areMapsEqual(a, b, state) {
|
1772
|
+
var size = a.size;
|
1773
|
+
if (size !== b.size) {
|
1774
|
+
return false;
|
1775
|
+
}
|
1776
|
+
if (!size) {
|
1777
|
+
return true;
|
1778
|
+
}
|
1779
|
+
var matchedIndices = new Array(size);
|
1780
|
+
var aIterable = a.entries();
|
1781
|
+
var aResult;
|
1782
|
+
var bResult;
|
1783
|
+
var index = 0;
|
1784
|
+
while (aResult = aIterable.next()) {
|
1785
|
+
if (aResult.done) {
|
1786
|
+
break;
|
1787
|
+
}
|
1788
|
+
var bIterable = b.entries();
|
1789
|
+
var hasMatch = false;
|
1790
|
+
var matchIndex = 0;
|
1791
|
+
while (bResult = bIterable.next()) {
|
1792
|
+
if (bResult.done) {
|
1793
|
+
break;
|
1794
|
+
}
|
1795
|
+
if (matchedIndices[matchIndex]) {
|
1796
|
+
matchIndex++;
|
1797
|
+
continue;
|
1798
|
+
}
|
1799
|
+
var aEntry = aResult.value;
|
1800
|
+
var bEntry = bResult.value;
|
1801
|
+
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)) {
|
1802
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
1803
|
+
break;
|
1804
|
+
}
|
1805
|
+
matchIndex++;
|
1806
|
+
}
|
1807
|
+
if (!hasMatch) {
|
1808
|
+
return false;
|
1809
|
+
}
|
1810
|
+
index++;
|
1811
|
+
}
|
1812
|
+
return true;
|
1813
|
+
}
|
1814
|
+
var areNumbersEqual = sameValueZeroEqual;
|
1815
|
+
function areObjectsEqual(a, b, state) {
|
1816
|
+
var properties = keys(a);
|
1817
|
+
var index = properties.length;
|
1818
|
+
if (keys(b).length !== index) {
|
1819
|
+
return false;
|
1820
|
+
}
|
1821
|
+
while (index-- > 0) {
|
1822
|
+
if (!isPropertyEqual(a, b, state, properties[index])) {
|
1823
|
+
return false;
|
1824
|
+
}
|
1825
|
+
}
|
1826
|
+
return true;
|
1827
|
+
}
|
1828
|
+
function areObjectsEqualStrict(a, b, state) {
|
1829
|
+
var properties = getStrictProperties(a);
|
1830
|
+
var index = properties.length;
|
1831
|
+
if (getStrictProperties(b).length !== index) {
|
1832
|
+
return false;
|
1833
|
+
}
|
1834
|
+
var property;
|
1835
|
+
var descriptorA;
|
1836
|
+
var descriptorB;
|
1837
|
+
while (index-- > 0) {
|
1838
|
+
property = properties[index];
|
1839
|
+
if (!isPropertyEqual(a, b, state, property)) {
|
1840
|
+
return false;
|
1841
|
+
}
|
1842
|
+
descriptorA = getOwnPropertyDescriptor(a, property);
|
1843
|
+
descriptorB = getOwnPropertyDescriptor(b, property);
|
1844
|
+
if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) {
|
1845
|
+
return false;
|
1846
|
+
}
|
1847
|
+
}
|
1848
|
+
return true;
|
1849
|
+
}
|
1850
|
+
function arePrimitiveWrappersEqual(a, b) {
|
1851
|
+
return sameValueZeroEqual(a.valueOf(), b.valueOf());
|
1852
|
+
}
|
1853
|
+
function areRegExpsEqual(a, b) {
|
1854
|
+
return a.source === b.source && a.flags === b.flags;
|
1855
|
+
}
|
1856
|
+
function areSetsEqual(a, b, state) {
|
1857
|
+
var size = a.size;
|
1858
|
+
if (size !== b.size) {
|
1859
|
+
return false;
|
1860
|
+
}
|
1861
|
+
if (!size) {
|
1862
|
+
return true;
|
1863
|
+
}
|
1864
|
+
var matchedIndices = new Array(size);
|
1865
|
+
var aIterable = a.values();
|
1866
|
+
var aResult;
|
1867
|
+
var bResult;
|
1868
|
+
while (aResult = aIterable.next()) {
|
1869
|
+
if (aResult.done) {
|
1870
|
+
break;
|
1871
|
+
}
|
1872
|
+
var bIterable = b.values();
|
1873
|
+
var hasMatch = false;
|
1874
|
+
var matchIndex = 0;
|
1875
|
+
while (bResult = bIterable.next()) {
|
1876
|
+
if (bResult.done) {
|
1877
|
+
break;
|
1878
|
+
}
|
1879
|
+
if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
|
1880
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
1881
|
+
break;
|
1882
|
+
}
|
1883
|
+
matchIndex++;
|
1884
|
+
}
|
1885
|
+
if (!hasMatch) {
|
1886
|
+
return false;
|
1887
|
+
}
|
1888
|
+
}
|
1889
|
+
return true;
|
1890
|
+
}
|
1891
|
+
function areTypedArraysEqual(a, b) {
|
1892
|
+
var index = a.length;
|
1893
|
+
if (b.length !== index) {
|
1894
|
+
return false;
|
1895
|
+
}
|
1896
|
+
while (index-- > 0) {
|
1897
|
+
if (a[index] !== b[index]) {
|
1898
|
+
return false;
|
1899
|
+
}
|
1900
|
+
}
|
1901
|
+
return true;
|
1902
|
+
}
|
1903
|
+
function areUrlsEqual(a, b) {
|
1904
|
+
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;
|
1905
|
+
}
|
1906
|
+
function isPropertyEqual(a, b, state, property) {
|
1907
|
+
if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) {
|
1908
|
+
return true;
|
1909
|
+
}
|
1910
|
+
return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
|
1911
|
+
}
|
1912
|
+
var ARGUMENTS_TAG = "[object Arguments]";
|
1913
|
+
var BOOLEAN_TAG = "[object Boolean]";
|
1914
|
+
var DATE_TAG = "[object Date]";
|
1915
|
+
var ERROR_TAG = "[object Error]";
|
1916
|
+
var MAP_TAG = "[object Map]";
|
1917
|
+
var NUMBER_TAG = "[object Number]";
|
1918
|
+
var OBJECT_TAG = "[object Object]";
|
1919
|
+
var REG_EXP_TAG = "[object RegExp]";
|
1920
|
+
var SET_TAG = "[object Set]";
|
1921
|
+
var STRING_TAG = "[object String]";
|
1922
|
+
var URL_TAG = "[object URL]";
|
1923
|
+
var isArray = Array.isArray;
|
1924
|
+
var isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null;
|
1925
|
+
var assign = Object.assign;
|
1926
|
+
var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
|
1927
|
+
function createEqualityComparator(_a) {
|
1928
|
+
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;
|
1929
|
+
return function comparator(a, b, state) {
|
1930
|
+
if (a === b) {
|
1931
|
+
return true;
|
1932
|
+
}
|
1933
|
+
if (a == null || b == null) {
|
1934
|
+
return false;
|
1935
|
+
}
|
1936
|
+
var type = typeof a;
|
1937
|
+
if (type !== typeof b) {
|
1938
|
+
return false;
|
1939
|
+
}
|
1940
|
+
if (type !== "object") {
|
1941
|
+
if (type === "number") {
|
1942
|
+
return areNumbersEqual2(a, b, state);
|
1943
|
+
}
|
1944
|
+
if (type === "function") {
|
1945
|
+
return areFunctionsEqual2(a, b, state);
|
1946
|
+
}
|
1947
|
+
return false;
|
1948
|
+
}
|
1949
|
+
var constructor = a.constructor;
|
1950
|
+
if (constructor !== b.constructor) {
|
1951
|
+
return false;
|
1952
|
+
}
|
1953
|
+
if (constructor === Object) {
|
1954
|
+
return areObjectsEqual2(a, b, state);
|
1955
|
+
}
|
1956
|
+
if (isArray(a)) {
|
1957
|
+
return areArraysEqual2(a, b, state);
|
1958
|
+
}
|
1959
|
+
if (isTypedArray != null && isTypedArray(a)) {
|
1960
|
+
return areTypedArraysEqual2(a, b, state);
|
1961
|
+
}
|
1962
|
+
if (constructor === Date) {
|
1963
|
+
return areDatesEqual2(a, b, state);
|
1964
|
+
}
|
1965
|
+
if (constructor === RegExp) {
|
1966
|
+
return areRegExpsEqual2(a, b, state);
|
1967
|
+
}
|
1968
|
+
if (constructor === Map) {
|
1969
|
+
return areMapsEqual2(a, b, state);
|
1970
|
+
}
|
1971
|
+
if (constructor === Set) {
|
1972
|
+
return areSetsEqual2(a, b, state);
|
1973
|
+
}
|
1974
|
+
var tag = getTag(a);
|
1975
|
+
if (tag === DATE_TAG) {
|
1976
|
+
return areDatesEqual2(a, b, state);
|
1977
|
+
}
|
1978
|
+
if (tag === REG_EXP_TAG) {
|
1979
|
+
return areRegExpsEqual2(a, b, state);
|
1980
|
+
}
|
1981
|
+
if (tag === MAP_TAG) {
|
1982
|
+
return areMapsEqual2(a, b, state);
|
1983
|
+
}
|
1984
|
+
if (tag === SET_TAG) {
|
1985
|
+
return areSetsEqual2(a, b, state);
|
1986
|
+
}
|
1987
|
+
if (tag === OBJECT_TAG) {
|
1988
|
+
return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state);
|
1989
|
+
}
|
1990
|
+
if (tag === URL_TAG) {
|
1991
|
+
return areUrlsEqual2(a, b, state);
|
1992
|
+
}
|
1993
|
+
if (tag === ERROR_TAG) {
|
1994
|
+
return areErrorsEqual2(a, b, state);
|
1995
|
+
}
|
1996
|
+
if (tag === ARGUMENTS_TAG) {
|
1997
|
+
return areObjectsEqual2(a, b, state);
|
1998
|
+
}
|
1999
|
+
if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
|
2000
|
+
return arePrimitiveWrappersEqual2(a, b, state);
|
2001
|
+
}
|
2002
|
+
return false;
|
2003
|
+
};
|
2004
|
+
}
|
2005
|
+
function createEqualityComparatorConfig(_a) {
|
2006
|
+
var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
|
2007
|
+
var config = {
|
2008
|
+
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
2009
|
+
areDatesEqual,
|
2010
|
+
areErrorsEqual,
|
2011
|
+
areFunctionsEqual,
|
2012
|
+
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
2013
|
+
areNumbersEqual,
|
2014
|
+
areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
|
2015
|
+
arePrimitiveWrappersEqual,
|
2016
|
+
areRegExpsEqual,
|
2017
|
+
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
2018
|
+
areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
|
2019
|
+
areUrlsEqual
|
2020
|
+
};
|
2021
|
+
if (createCustomConfig) {
|
2022
|
+
config = assign({}, config, createCustomConfig(config));
|
2023
|
+
}
|
2024
|
+
if (circular) {
|
2025
|
+
var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
|
2026
|
+
var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
|
2027
|
+
var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
|
2028
|
+
var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
|
2029
|
+
config = assign({}, config, {
|
2030
|
+
areArraysEqual: areArraysEqual$1,
|
2031
|
+
areMapsEqual: areMapsEqual$1,
|
2032
|
+
areObjectsEqual: areObjectsEqual$1,
|
2033
|
+
areSetsEqual: areSetsEqual$1
|
2034
|
+
});
|
2035
|
+
}
|
2036
|
+
return config;
|
2037
|
+
}
|
2038
|
+
function createInternalEqualityComparator(compare) {
|
2039
|
+
return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
|
2040
|
+
return compare(a, b, state);
|
2041
|
+
};
|
2042
|
+
}
|
2043
|
+
function createIsEqual(_a) {
|
2044
|
+
var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
|
2045
|
+
if (createState) {
|
2046
|
+
return function isEqual(a, b) {
|
2047
|
+
var _a2 = createState(), _b = _a2.cache, cache2 = _b === void 0 ? circular ? /* @__PURE__ */ new WeakMap() : void 0 : _b, meta = _a2.meta;
|
2048
|
+
return comparator(a, b, {
|
2049
|
+
cache: cache2,
|
2050
|
+
equals,
|
2051
|
+
meta,
|
2052
|
+
strict
|
2053
|
+
});
|
2054
|
+
};
|
2055
|
+
}
|
2056
|
+
if (circular) {
|
2057
|
+
return function isEqual(a, b) {
|
2058
|
+
return comparator(a, b, {
|
2059
|
+
cache: /* @__PURE__ */ new WeakMap(),
|
2060
|
+
equals,
|
2061
|
+
meta: void 0,
|
2062
|
+
strict
|
2063
|
+
});
|
2064
|
+
};
|
2065
|
+
}
|
2066
|
+
var state = {
|
2067
|
+
cache: void 0,
|
2068
|
+
equals,
|
2069
|
+
meta: void 0,
|
2070
|
+
strict
|
2071
|
+
};
|
2072
|
+
return function isEqual(a, b) {
|
2073
|
+
return comparator(a, b, state);
|
2074
|
+
};
|
2075
|
+
}
|
2076
|
+
var deepEqual = createCustomEqual();
|
2077
|
+
var strictDeepEqual = createCustomEqual({ strict: true });
|
2078
|
+
var circularDeepEqual = createCustomEqual({ circular: true });
|
2079
|
+
var strictCircularDeepEqual = createCustomEqual({
|
2080
|
+
circular: true,
|
2081
|
+
strict: true
|
2082
|
+
});
|
2083
|
+
var shallowEqual = createCustomEqual({
|
2084
|
+
createInternalComparator: function() {
|
2085
|
+
return sameValueZeroEqual;
|
2086
|
+
}
|
2087
|
+
});
|
2088
|
+
var strictShallowEqual = createCustomEqual({
|
2089
|
+
strict: true,
|
2090
|
+
createInternalComparator: function() {
|
2091
|
+
return sameValueZeroEqual;
|
2092
|
+
}
|
2093
|
+
});
|
2094
|
+
var circularShallowEqual = createCustomEqual({
|
2095
|
+
circular: true,
|
2096
|
+
createInternalComparator: function() {
|
2097
|
+
return sameValueZeroEqual;
|
2098
|
+
}
|
2099
|
+
});
|
2100
|
+
var strictCircularShallowEqual = createCustomEqual({
|
2101
|
+
circular: true,
|
2102
|
+
createInternalComparator: function() {
|
2103
|
+
return sameValueZeroEqual;
|
2104
|
+
},
|
2105
|
+
strict: true
|
2106
|
+
});
|
2107
|
+
function createCustomEqual(options) {
|
2108
|
+
if (options === void 0) {
|
2109
|
+
options = {};
|
2110
|
+
}
|
2111
|
+
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;
|
2112
|
+
var config = createEqualityComparatorConfig(options);
|
2113
|
+
var comparator = createEqualityComparator(config);
|
2114
|
+
var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
|
2115
|
+
return createIsEqual({ circular, comparator, createState, equals, strict });
|
2116
|
+
}
|
2117
|
+
|
2118
|
+
// ../core/lib/get-changed.ts
|
1702
2119
|
var getChanged = (newItem, oldItem) => {
|
1703
2120
|
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1704
2121
|
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1705
2122
|
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1706
2123
|
return __spreadProps(__spreadValues({}, acc), {
|
1707
|
-
[item]: !(
|
2124
|
+
[item]: !deepEqual(oldItemProps[item], newItemProps[item])
|
1708
2125
|
});
|
1709
2126
|
}, {}) : {};
|
1710
2127
|
};
|
@@ -1829,7 +2246,6 @@ var createFieldsSlice = (_set, _get) => {
|
|
1829
2246
|
|
1830
2247
|
// ../core/lib/resolve-component-data.ts
|
1831
2248
|
init_react_import();
|
1832
|
-
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
1833
2249
|
var cache = { lastChange: {} };
|
1834
2250
|
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
1835
2251
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
@@ -1838,7 +2254,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1838
2254
|
const id = "id" in item.props ? item.props.id : "root";
|
1839
2255
|
if (shouldRunResolver) {
|
1840
2256
|
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1841
|
-
if (trigger !== "force" && item && (
|
2257
|
+
if (trigger !== "force" && item && deepEqual(item, oldItem)) {
|
1842
2258
|
return { node: resolved, didChange: false };
|
1843
2259
|
}
|
1844
2260
|
const changed = getChanged(item, oldItem);
|
@@ -1888,7 +2304,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1888
2304
|
};
|
1889
2305
|
return {
|
1890
2306
|
node: itemWithResolvedChildren,
|
1891
|
-
didChange: !(
|
2307
|
+
didChange: !deepEqual(item, itemWithResolvedChildren)
|
1892
2308
|
};
|
1893
2309
|
});
|
1894
2310
|
|
@@ -1929,7 +2345,8 @@ var defaultAppState = {
|
|
1929
2345
|
options: [],
|
1930
2346
|
controlsVisible: true
|
1931
2347
|
},
|
1932
|
-
field: { focus: null }
|
2348
|
+
field: { focus: null },
|
2349
|
+
plugin: { current: null }
|
1933
2350
|
},
|
1934
2351
|
indexes: {
|
1935
2352
|
nodes: {},
|
@@ -1945,6 +2362,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
1945
2362
|
subscribeWithSelector((set, get) => {
|
1946
2363
|
var _a, _b;
|
1947
2364
|
return __spreadProps(__spreadValues({
|
2365
|
+
instanceId: generateId(),
|
1948
2366
|
state: defaultAppState,
|
1949
2367
|
config: { components: {} },
|
1950
2368
|
componentState: {},
|
@@ -2115,203 +2533,14 @@ var createAppStore = (initialAppStore) => create()(
|
|
2115
2533
|
})
|
2116
2534
|
);
|
2117
2535
|
var appStoreContext = (0, import_react9.createContext)(createAppStore());
|
2118
|
-
function useAppStore(selector) {
|
2119
|
-
const context = (0, import_react9.useContext)(appStoreContext);
|
2120
|
-
return useStore(context, selector);
|
2121
|
-
}
|
2122
|
-
function useAppStoreApi() {
|
2123
|
-
return (0, import_react9.useContext)(appStoreContext);
|
2124
|
-
}
|
2125
|
-
|
2126
|
-
// ../core/lib/use-breadcrumbs.ts
|
2127
|
-
var useBreadcrumbs = (renderCount) => {
|
2128
|
-
const selectedId = useAppStore((s) => {
|
2129
|
-
var _a;
|
2130
|
-
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
2131
|
-
});
|
2132
|
-
const config = useAppStore((s) => s.config);
|
2133
|
-
const path = useAppStore((s) => {
|
2134
|
-
var _a;
|
2135
|
-
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
2136
|
-
});
|
2137
|
-
const appStore = useAppStoreApi();
|
2138
|
-
return (0, import_react10.useMemo)(() => {
|
2139
|
-
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
2140
|
-
var _a, _b, _c;
|
2141
|
-
const [componentId] = zoneCompound.split(":");
|
2142
|
-
if (componentId === "root") {
|
2143
|
-
return {
|
2144
|
-
label: "Page",
|
2145
|
-
selector: null
|
2146
|
-
};
|
2147
|
-
}
|
2148
|
-
const node = appStore.getState().state.indexes.nodes[componentId];
|
2149
|
-
const parentId = node.path[node.path.length - 1];
|
2150
|
-
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
2151
|
-
const index = contentIds.indexOf(componentId);
|
2152
|
-
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
2153
|
-
return {
|
2154
|
-
label,
|
2155
|
-
selector: node ? {
|
2156
|
-
index,
|
2157
|
-
zone: node.path[node.path.length - 1]
|
2158
|
-
} : null
|
2159
|
-
};
|
2160
|
-
})) || [];
|
2161
|
-
if (renderCount) {
|
2162
|
-
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
2163
|
-
}
|
2164
|
-
return breadcrumbs;
|
2165
|
-
}, [path, renderCount]);
|
2166
|
-
};
|
2167
|
-
|
2168
|
-
// ../core/components/Loader/index.tsx
|
2169
|
-
init_react_import();
|
2170
|
-
|
2171
|
-
// ../core/lib/index.ts
|
2172
|
-
init_react_import();
|
2173
|
-
|
2174
|
-
// ../core/lib/filter.ts
|
2175
|
-
init_react_import();
|
2176
|
-
|
2177
|
-
// ../core/lib/data/reorder.ts
|
2178
|
-
init_react_import();
|
2179
|
-
|
2180
|
-
// ../core/lib/data/replace.ts
|
2181
|
-
init_react_import();
|
2182
|
-
|
2183
|
-
// ../core/lib/use-reset-auto-zoom.ts
|
2184
|
-
init_react_import();
|
2185
2536
|
|
2186
2537
|
// ../core/lib/get-zoom-config.ts
|
2187
2538
|
init_react_import();
|
2188
2539
|
|
2189
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
2190
|
-
init_react_import();
|
2191
|
-
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
2192
|
-
|
2193
|
-
// ../core/components/Loader/index.tsx
|
2194
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
2195
|
-
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
2196
|
-
var Loader = (_a) => {
|
2197
|
-
var _b = _a, {
|
2198
|
-
color,
|
2199
|
-
size = 16
|
2200
|
-
} = _b, props = __objRest(_b, [
|
2201
|
-
"color",
|
2202
|
-
"size"
|
2203
|
-
]);
|
2204
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
2205
|
-
"span",
|
2206
|
-
__spreadValues({
|
2207
|
-
className: getClassName2(),
|
2208
|
-
style: {
|
2209
|
-
width: size,
|
2210
|
-
height: size,
|
2211
|
-
color
|
2212
|
-
},
|
2213
|
-
"aria-label": "loading"
|
2214
|
-
}, props)
|
2215
|
-
);
|
2216
|
-
};
|
2217
|
-
|
2218
|
-
// ../core/components/SidebarSection/index.tsx
|
2219
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
2220
|
-
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
2221
|
-
var SidebarSection = ({
|
2222
|
-
children,
|
2223
|
-
title,
|
2224
|
-
background,
|
2225
|
-
showBreadcrumbs,
|
2226
|
-
noBorderTop,
|
2227
|
-
noPadding,
|
2228
|
-
isLoading
|
2229
|
-
}) => {
|
2230
|
-
const setUi = useAppStore((s) => s.setUi);
|
2231
|
-
const breadcrumbs = useBreadcrumbs(1);
|
2232
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
2233
|
-
"div",
|
2234
|
-
{
|
2235
|
-
className: getClassName3({ noBorderTop, noPadding }),
|
2236
|
-
style: { background },
|
2237
|
-
children: [
|
2238
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
|
2239
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
|
2240
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
2241
|
-
"button",
|
2242
|
-
{
|
2243
|
-
type: "button",
|
2244
|
-
className: getClassName3("breadcrumbLabel"),
|
2245
|
-
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
2246
|
-
children: breadcrumb.label
|
2247
|
-
}
|
2248
|
-
),
|
2249
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, { size: 16 })
|
2250
|
-
] }, i)) : null,
|
2251
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
2252
|
-
] }) }),
|
2253
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("content"), children }),
|
2254
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 32 }) })
|
2255
|
-
]
|
2256
|
-
}
|
2257
|
-
);
|
2258
|
-
};
|
2259
|
-
|
2260
|
-
// ../core/components/OutlineList/index.tsx
|
2261
|
-
init_react_import();
|
2262
|
-
|
2263
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
2264
|
-
init_react_import();
|
2265
|
-
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
2266
|
-
|
2267
|
-
// ../core/components/OutlineList/index.tsx
|
2268
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
2269
|
-
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
2270
|
-
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
2271
|
-
var OutlineList = ({ children }) => {
|
2272
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: getClassName4(), children });
|
2273
|
-
};
|
2274
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
|
2275
|
-
OutlineList.Item = ({
|
2276
|
-
children,
|
2277
|
-
onClick
|
2278
|
-
}) => {
|
2279
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
2280
|
-
"li",
|
2281
|
-
{
|
2282
|
-
className: getClassNameItem({ clickable: !!onClick }),
|
2283
|
-
onClick,
|
2284
|
-
children
|
2285
|
-
}
|
2286
|
-
);
|
2287
|
-
};
|
2288
|
-
|
2289
|
-
// ../core/lib/scroll-into-view.ts
|
2290
|
-
init_react_import();
|
2291
|
-
var scrollIntoView = (el) => {
|
2292
|
-
const oldStyle = __spreadValues({}, el.style);
|
2293
|
-
el.style.scrollMargin = "256px";
|
2294
|
-
if (el) {
|
2295
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
2296
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
2297
|
-
}
|
2298
|
-
};
|
2299
|
-
|
2300
|
-
// ../core/lib/get-frame.ts
|
2301
|
-
init_react_import();
|
2302
|
-
var getFrame = () => {
|
2303
|
-
if (typeof window === "undefined") return;
|
2304
|
-
let frameEl = document.querySelector("#preview-frame");
|
2305
|
-
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
2306
|
-
return frameEl.contentDocument || document;
|
2307
|
-
}
|
2308
|
-
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
2309
|
-
};
|
2310
|
-
|
2311
2540
|
// src/HeadingAnalyzer.tsx
|
2312
2541
|
var import_react_from_json = __toESM(require("react-from-json"));
|
2313
|
-
var
|
2314
|
-
var
|
2542
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
2543
|
+
var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
2315
2544
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
2316
2545
|
var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
|
2317
2546
|
var getOutline = ({ frame } = {}) => {
|
@@ -2366,8 +2595,8 @@ function buildHierarchy(frame) {
|
|
2366
2595
|
var usePuck = (0, import_puck.createUsePuck)();
|
2367
2596
|
var HeadingAnalyzer = () => {
|
2368
2597
|
const data = usePuck((s) => s.appState.data);
|
2369
|
-
const [hierarchy, setHierarchy] = (0,
|
2370
|
-
(0,
|
2598
|
+
const [hierarchy, setHierarchy] = (0, import_react10.useState)([]);
|
2599
|
+
(0, import_react10.useEffect)(() => {
|
2371
2600
|
const frame = getFrame();
|
2372
2601
|
let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
|
2373
2602
|
const createHierarchy = () => {
|
@@ -2402,11 +2631,11 @@ var HeadingAnalyzer = () => {
|
|
2402
2631
|
frameObserver.disconnect();
|
2403
2632
|
};
|
2404
2633
|
}, [data]);
|
2405
|
-
return /* @__PURE__ */ (0,
|
2406
|
-
/* @__PURE__ */ (0,
|
2634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: getClassName2(), children: [
|
2635
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
2407
2636
|
"small",
|
2408
2637
|
{
|
2409
|
-
className:
|
2638
|
+
className: getClassName2("cssWarning"),
|
2410
2639
|
style: {
|
2411
2640
|
color: "var(--puck-color-red-04)",
|
2412
2641
|
display: "block",
|
@@ -2415,19 +2644,19 @@ var HeadingAnalyzer = () => {
|
|
2415
2644
|
children: [
|
2416
2645
|
"Heading analyzer styles not loaded. Please review the",
|
2417
2646
|
" ",
|
2418
|
-
/* @__PURE__ */ (0,
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
2419
2648
|
"."
|
2420
2649
|
]
|
2421
2650
|
}
|
2422
2651
|
),
|
2423
|
-
hierarchy.length === 0 && /* @__PURE__ */ (0,
|
2424
|
-
/* @__PURE__ */ (0,
|
2652
|
+
hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: "No headings." }),
|
2653
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
2425
2654
|
ReactFromJSON,
|
2426
2655
|
{
|
2427
2656
|
mapping: {
|
2428
|
-
Root: (props) => /* @__PURE__ */ (0,
|
2429
|
-
OutlineListItem: (props) => /* @__PURE__ */ (0,
|
2430
|
-
/* @__PURE__ */ (0,
|
2657
|
+
Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: props.children }),
|
2658
|
+
OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(OutlineList.Item, { children: [
|
2659
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
2431
2660
|
"small",
|
2432
2661
|
{
|
2433
2662
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -2445,14 +2674,14 @@ var HeadingAnalyzer = () => {
|
|
2445
2674
|
}, 2e3);
|
2446
2675
|
}
|
2447
2676
|
},
|
2448
|
-
children: props.missing ? /* @__PURE__ */ (0,
|
2449
|
-
/* @__PURE__ */ (0,
|
2677
|
+
children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
2678
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
|
2450
2679
|
"H",
|
2451
2680
|
props.rank
|
2452
2681
|
] }),
|
2453
2682
|
": Missing"
|
2454
|
-
] }) : /* @__PURE__ */ (0,
|
2455
|
-
/* @__PURE__ */ (0,
|
2683
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
2684
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
|
2456
2685
|
"H",
|
2457
2686
|
props.rank
|
2458
2687
|
] }),
|
@@ -2461,7 +2690,7 @@ var HeadingAnalyzer = () => {
|
|
2461
2690
|
] })
|
2462
2691
|
}
|
2463
2692
|
) }),
|
2464
|
-
/* @__PURE__ */ (0,
|
2693
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: props.children })
|
2465
2694
|
] })
|
2466
2695
|
},
|
2467
2696
|
entry: {
|
@@ -2482,12 +2711,10 @@ var HeadingAnalyzer = () => {
|
|
2482
2711
|
] });
|
2483
2712
|
};
|
2484
2713
|
var headingAnalyzer = {
|
2485
|
-
|
2486
|
-
|
2487
|
-
|
2488
|
-
|
2489
|
-
] })
|
2490
|
-
}
|
2714
|
+
name: "heading-analyzer",
|
2715
|
+
label: "Audit",
|
2716
|
+
render: HeadingAnalyzer,
|
2717
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Heading1, {})
|
2491
2718
|
};
|
2492
2719
|
var HeadingAnalyzer_default = headingAnalyzer;
|
2493
2720
|
/*! Bundled license information:
|
@@ -2531,7 +2758,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
2531
2758
|
* See the LICENSE file in the root directory of this source tree.
|
2532
2759
|
*)
|
2533
2760
|
|
2534
|
-
lucide-react/dist/esm/icons/
|
2761
|
+
lucide-react/dist/esm/icons/heading-1.js:
|
2535
2762
|
(**
|
2536
2763
|
* @license lucide-react v0.468.0 - ISC
|
2537
2764
|
*
|