@measured/puck-plugin-heading-analyzer 0.21.0-canary.d32e582b → 0.21.0-canary.e4131567
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +149 -5
- package/dist/index.d.mts +12 -21
- package/dist/index.d.ts +12 -21
- package/dist/index.js +663 -135
- package/dist/index.mjs +660 -132
- 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_react11 = 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_116v6_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_116v6_5", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_116v6_9", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_116v6_13" };
|
321
285
|
|
322
286
|
// src/HeadingAnalyzer.tsx
|
323
287
|
var import_puck = require("@measured/puck");
|
324
288
|
|
325
|
-
// ../core/components/
|
289
|
+
// ../core/components/SidebarSection/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/SidebarSection/styles.module.css#css-module
|
329
293
|
init_react_import();
|
330
|
-
var styles_module_default = { "
|
294
|
+
var styles_module_default = { "SidebarSection": "_SidebarSection_8boj8_1", "SidebarSection-title": "_SidebarSection-title_8boj8_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_8boj8_20", "SidebarSection-content": "_SidebarSection-content_8boj8_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_8boj8_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_8boj8_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_8boj8_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_8boj8_41", "SidebarSection-heading": "_SidebarSection-heading_8boj8_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_8boj8_86" };
|
331
295
|
|
332
296
|
// ../core/lib/get-class-name-factory.ts
|
333
297
|
init_react_import();
|
@@ -356,50 +320,29 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
|
|
356
320
|
};
|
357
321
|
var get_class_name_factory_default = getClassNameFactory;
|
358
322
|
|
359
|
-
// ../core/components/
|
323
|
+
// ../core/components/Heading/index.tsx
|
324
|
+
init_react_import();
|
325
|
+
|
326
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
|
327
|
+
init_react_import();
|
328
|
+
var styles_module_default2 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
|
329
|
+
|
330
|
+
// ../core/components/Heading/index.tsx
|
360
331
|
var import_jsx_runtime = require("react/jsx-runtime");
|
361
|
-
var getClassName = get_class_name_factory_default("
|
362
|
-
var
|
363
|
-
|
364
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: getClassName(), children });
|
365
|
-
};
|
366
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
|
367
|
-
OutlineList.Item = ({
|
368
|
-
children,
|
369
|
-
onClick
|
370
|
-
}) => {
|
332
|
+
var getClassName = get_class_name_factory_default("Heading", styles_module_default2);
|
333
|
+
var Heading = ({ children, rank, size = "m" }) => {
|
334
|
+
const Tag = rank ? `h${rank}` : "span";
|
371
335
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
372
|
-
|
336
|
+
Tag,
|
373
337
|
{
|
374
|
-
className:
|
375
|
-
|
338
|
+
className: getClassName({
|
339
|
+
[size]: true
|
340
|
+
}),
|
376
341
|
children
|
377
342
|
}
|
378
343
|
);
|
379
344
|
};
|
380
345
|
|
381
|
-
// ../core/lib/scroll-into-view.ts
|
382
|
-
init_react_import();
|
383
|
-
var scrollIntoView = (el) => {
|
384
|
-
const oldStyle = __spreadValues({}, el.style);
|
385
|
-
el.style.scrollMargin = "256px";
|
386
|
-
if (el) {
|
387
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
388
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
389
|
-
}
|
390
|
-
};
|
391
|
-
|
392
|
-
// ../core/lib/get-frame.ts
|
393
|
-
init_react_import();
|
394
|
-
var getFrame = () => {
|
395
|
-
if (typeof window === "undefined") return;
|
396
|
-
let frameEl = document.querySelector("#preview-frame");
|
397
|
-
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
398
|
-
return frameEl.contentDocument || document;
|
399
|
-
}
|
400
|
-
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
401
|
-
};
|
402
|
-
|
403
346
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
404
347
|
init_react_import();
|
405
348
|
|
@@ -487,29 +430,15 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
487
430
|
return Component;
|
488
431
|
};
|
489
432
|
|
490
|
-
// ../../node_modules/lucide-react/dist/esm/icons/
|
433
|
+
// ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
491
434
|
init_react_import();
|
492
|
-
var
|
493
|
-
["path", { d: "
|
494
|
-
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
495
|
-
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
496
|
-
["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
|
435
|
+
var ChevronRight = createLucideIcon("ChevronRight", [
|
436
|
+
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
497
437
|
]);
|
498
438
|
|
499
|
-
// ../core/lib/
|
500
|
-
init_react_import();
|
501
|
-
|
502
|
-
// ../core/lib/filter.ts
|
503
|
-
init_react_import();
|
504
|
-
|
505
|
-
// ../core/lib/data/reorder.ts
|
506
|
-
init_react_import();
|
507
|
-
|
508
|
-
// ../core/lib/data/replace.ts
|
509
|
-
init_react_import();
|
510
|
-
|
511
|
-
// ../core/lib/use-reset-auto-zoom.ts
|
439
|
+
// ../core/lib/use-breadcrumbs.ts
|
512
440
|
init_react_import();
|
441
|
+
var import_react10 = require("react");
|
513
442
|
|
514
443
|
// ../core/store/index.ts
|
515
444
|
init_react_import();
|
@@ -607,7 +536,7 @@ var walkField = ({
|
|
607
536
|
return map({
|
608
537
|
value: mappedContent,
|
609
538
|
parentId: id,
|
610
|
-
propName:
|
539
|
+
propName: propPath,
|
611
540
|
field: fields[propKey],
|
612
541
|
propPath
|
613
542
|
});
|
@@ -1479,8 +1408,7 @@ init_react_import();
|
|
1479
1408
|
var defaultViewports = [
|
1480
1409
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1481
1410
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1482
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1483
|
-
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
1411
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1484
1412
|
];
|
1485
1413
|
|
1486
1414
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
@@ -1726,7 +1654,7 @@ var flattenData = (state, config) => {
|
|
1726
1654
|
(content) => content,
|
1727
1655
|
(item) => {
|
1728
1656
|
data.push(item);
|
1729
|
-
return
|
1657
|
+
return item;
|
1730
1658
|
}
|
1731
1659
|
);
|
1732
1660
|
return data;
|
@@ -1734,13 +1662,425 @@ var flattenData = (state, config) => {
|
|
1734
1662
|
|
1735
1663
|
// ../core/lib/get-changed.ts
|
1736
1664
|
init_react_import();
|
1737
|
-
|
1665
|
+
|
1666
|
+
// ../../node_modules/fast-equals/dist/esm/index.mjs
|
1667
|
+
init_react_import();
|
1668
|
+
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
1669
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
1670
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
1671
|
+
function combineComparators(comparatorA, comparatorB) {
|
1672
|
+
return function isEqual(a, b, state) {
|
1673
|
+
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
1674
|
+
};
|
1675
|
+
}
|
1676
|
+
function createIsCircular(areItemsEqual) {
|
1677
|
+
return function isCircular(a, b, state) {
|
1678
|
+
if (!a || !b || typeof a !== "object" || typeof b !== "object") {
|
1679
|
+
return areItemsEqual(a, b, state);
|
1680
|
+
}
|
1681
|
+
var cache2 = state.cache;
|
1682
|
+
var cachedA = cache2.get(a);
|
1683
|
+
var cachedB = cache2.get(b);
|
1684
|
+
if (cachedA && cachedB) {
|
1685
|
+
return cachedA === b && cachedB === a;
|
1686
|
+
}
|
1687
|
+
cache2.set(a, b);
|
1688
|
+
cache2.set(b, a);
|
1689
|
+
var result = areItemsEqual(a, b, state);
|
1690
|
+
cache2.delete(a);
|
1691
|
+
cache2.delete(b);
|
1692
|
+
return result;
|
1693
|
+
};
|
1694
|
+
}
|
1695
|
+
function getStrictProperties(object) {
|
1696
|
+
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
1697
|
+
}
|
1698
|
+
var hasOwn = Object.hasOwn || function(object, property) {
|
1699
|
+
return hasOwnProperty.call(object, property);
|
1700
|
+
};
|
1701
|
+
function sameValueZeroEqual(a, b) {
|
1702
|
+
return a === b || !a && !b && a !== a && b !== b;
|
1703
|
+
}
|
1704
|
+
var PREACT_VNODE = "__v";
|
1705
|
+
var PREACT_OWNER = "__o";
|
1706
|
+
var REACT_OWNER = "_owner";
|
1707
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
1708
|
+
var keys = Object.keys;
|
1709
|
+
function areArraysEqual(a, b, state) {
|
1710
|
+
var index = a.length;
|
1711
|
+
if (b.length !== index) {
|
1712
|
+
return false;
|
1713
|
+
}
|
1714
|
+
while (index-- > 0) {
|
1715
|
+
if (!state.equals(a[index], b[index], index, index, a, b, state)) {
|
1716
|
+
return false;
|
1717
|
+
}
|
1718
|
+
}
|
1719
|
+
return true;
|
1720
|
+
}
|
1721
|
+
function areDatesEqual(a, b) {
|
1722
|
+
return sameValueZeroEqual(a.getTime(), b.getTime());
|
1723
|
+
}
|
1724
|
+
function areErrorsEqual(a, b) {
|
1725
|
+
return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
|
1726
|
+
}
|
1727
|
+
function areFunctionsEqual(a, b) {
|
1728
|
+
return a === b;
|
1729
|
+
}
|
1730
|
+
function areMapsEqual(a, b, state) {
|
1731
|
+
var size = a.size;
|
1732
|
+
if (size !== b.size) {
|
1733
|
+
return false;
|
1734
|
+
}
|
1735
|
+
if (!size) {
|
1736
|
+
return true;
|
1737
|
+
}
|
1738
|
+
var matchedIndices = new Array(size);
|
1739
|
+
var aIterable = a.entries();
|
1740
|
+
var aResult;
|
1741
|
+
var bResult;
|
1742
|
+
var index = 0;
|
1743
|
+
while (aResult = aIterable.next()) {
|
1744
|
+
if (aResult.done) {
|
1745
|
+
break;
|
1746
|
+
}
|
1747
|
+
var bIterable = b.entries();
|
1748
|
+
var hasMatch = false;
|
1749
|
+
var matchIndex = 0;
|
1750
|
+
while (bResult = bIterable.next()) {
|
1751
|
+
if (bResult.done) {
|
1752
|
+
break;
|
1753
|
+
}
|
1754
|
+
if (matchedIndices[matchIndex]) {
|
1755
|
+
matchIndex++;
|
1756
|
+
continue;
|
1757
|
+
}
|
1758
|
+
var aEntry = aResult.value;
|
1759
|
+
var bEntry = bResult.value;
|
1760
|
+
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)) {
|
1761
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
1762
|
+
break;
|
1763
|
+
}
|
1764
|
+
matchIndex++;
|
1765
|
+
}
|
1766
|
+
if (!hasMatch) {
|
1767
|
+
return false;
|
1768
|
+
}
|
1769
|
+
index++;
|
1770
|
+
}
|
1771
|
+
return true;
|
1772
|
+
}
|
1773
|
+
var areNumbersEqual = sameValueZeroEqual;
|
1774
|
+
function areObjectsEqual(a, b, state) {
|
1775
|
+
var properties = keys(a);
|
1776
|
+
var index = properties.length;
|
1777
|
+
if (keys(b).length !== index) {
|
1778
|
+
return false;
|
1779
|
+
}
|
1780
|
+
while (index-- > 0) {
|
1781
|
+
if (!isPropertyEqual(a, b, state, properties[index])) {
|
1782
|
+
return false;
|
1783
|
+
}
|
1784
|
+
}
|
1785
|
+
return true;
|
1786
|
+
}
|
1787
|
+
function areObjectsEqualStrict(a, b, state) {
|
1788
|
+
var properties = getStrictProperties(a);
|
1789
|
+
var index = properties.length;
|
1790
|
+
if (getStrictProperties(b).length !== index) {
|
1791
|
+
return false;
|
1792
|
+
}
|
1793
|
+
var property;
|
1794
|
+
var descriptorA;
|
1795
|
+
var descriptorB;
|
1796
|
+
while (index-- > 0) {
|
1797
|
+
property = properties[index];
|
1798
|
+
if (!isPropertyEqual(a, b, state, property)) {
|
1799
|
+
return false;
|
1800
|
+
}
|
1801
|
+
descriptorA = getOwnPropertyDescriptor(a, property);
|
1802
|
+
descriptorB = getOwnPropertyDescriptor(b, property);
|
1803
|
+
if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) {
|
1804
|
+
return false;
|
1805
|
+
}
|
1806
|
+
}
|
1807
|
+
return true;
|
1808
|
+
}
|
1809
|
+
function arePrimitiveWrappersEqual(a, b) {
|
1810
|
+
return sameValueZeroEqual(a.valueOf(), b.valueOf());
|
1811
|
+
}
|
1812
|
+
function areRegExpsEqual(a, b) {
|
1813
|
+
return a.source === b.source && a.flags === b.flags;
|
1814
|
+
}
|
1815
|
+
function areSetsEqual(a, b, state) {
|
1816
|
+
var size = a.size;
|
1817
|
+
if (size !== b.size) {
|
1818
|
+
return false;
|
1819
|
+
}
|
1820
|
+
if (!size) {
|
1821
|
+
return true;
|
1822
|
+
}
|
1823
|
+
var matchedIndices = new Array(size);
|
1824
|
+
var aIterable = a.values();
|
1825
|
+
var aResult;
|
1826
|
+
var bResult;
|
1827
|
+
while (aResult = aIterable.next()) {
|
1828
|
+
if (aResult.done) {
|
1829
|
+
break;
|
1830
|
+
}
|
1831
|
+
var bIterable = b.values();
|
1832
|
+
var hasMatch = false;
|
1833
|
+
var matchIndex = 0;
|
1834
|
+
while (bResult = bIterable.next()) {
|
1835
|
+
if (bResult.done) {
|
1836
|
+
break;
|
1837
|
+
}
|
1838
|
+
if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
|
1839
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
1840
|
+
break;
|
1841
|
+
}
|
1842
|
+
matchIndex++;
|
1843
|
+
}
|
1844
|
+
if (!hasMatch) {
|
1845
|
+
return false;
|
1846
|
+
}
|
1847
|
+
}
|
1848
|
+
return true;
|
1849
|
+
}
|
1850
|
+
function areTypedArraysEqual(a, b) {
|
1851
|
+
var index = a.length;
|
1852
|
+
if (b.length !== index) {
|
1853
|
+
return false;
|
1854
|
+
}
|
1855
|
+
while (index-- > 0) {
|
1856
|
+
if (a[index] !== b[index]) {
|
1857
|
+
return false;
|
1858
|
+
}
|
1859
|
+
}
|
1860
|
+
return true;
|
1861
|
+
}
|
1862
|
+
function areUrlsEqual(a, b) {
|
1863
|
+
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;
|
1864
|
+
}
|
1865
|
+
function isPropertyEqual(a, b, state, property) {
|
1866
|
+
if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) {
|
1867
|
+
return true;
|
1868
|
+
}
|
1869
|
+
return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
|
1870
|
+
}
|
1871
|
+
var ARGUMENTS_TAG = "[object Arguments]";
|
1872
|
+
var BOOLEAN_TAG = "[object Boolean]";
|
1873
|
+
var DATE_TAG = "[object Date]";
|
1874
|
+
var ERROR_TAG = "[object Error]";
|
1875
|
+
var MAP_TAG = "[object Map]";
|
1876
|
+
var NUMBER_TAG = "[object Number]";
|
1877
|
+
var OBJECT_TAG = "[object Object]";
|
1878
|
+
var REG_EXP_TAG = "[object RegExp]";
|
1879
|
+
var SET_TAG = "[object Set]";
|
1880
|
+
var STRING_TAG = "[object String]";
|
1881
|
+
var URL_TAG = "[object URL]";
|
1882
|
+
var isArray = Array.isArray;
|
1883
|
+
var isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null;
|
1884
|
+
var assign = Object.assign;
|
1885
|
+
var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
|
1886
|
+
function createEqualityComparator(_a) {
|
1887
|
+
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;
|
1888
|
+
return function comparator(a, b, state) {
|
1889
|
+
if (a === b) {
|
1890
|
+
return true;
|
1891
|
+
}
|
1892
|
+
if (a == null || b == null) {
|
1893
|
+
return false;
|
1894
|
+
}
|
1895
|
+
var type = typeof a;
|
1896
|
+
if (type !== typeof b) {
|
1897
|
+
return false;
|
1898
|
+
}
|
1899
|
+
if (type !== "object") {
|
1900
|
+
if (type === "number") {
|
1901
|
+
return areNumbersEqual2(a, b, state);
|
1902
|
+
}
|
1903
|
+
if (type === "function") {
|
1904
|
+
return areFunctionsEqual2(a, b, state);
|
1905
|
+
}
|
1906
|
+
return false;
|
1907
|
+
}
|
1908
|
+
var constructor = a.constructor;
|
1909
|
+
if (constructor !== b.constructor) {
|
1910
|
+
return false;
|
1911
|
+
}
|
1912
|
+
if (constructor === Object) {
|
1913
|
+
return areObjectsEqual2(a, b, state);
|
1914
|
+
}
|
1915
|
+
if (isArray(a)) {
|
1916
|
+
return areArraysEqual2(a, b, state);
|
1917
|
+
}
|
1918
|
+
if (isTypedArray != null && isTypedArray(a)) {
|
1919
|
+
return areTypedArraysEqual2(a, b, state);
|
1920
|
+
}
|
1921
|
+
if (constructor === Date) {
|
1922
|
+
return areDatesEqual2(a, b, state);
|
1923
|
+
}
|
1924
|
+
if (constructor === RegExp) {
|
1925
|
+
return areRegExpsEqual2(a, b, state);
|
1926
|
+
}
|
1927
|
+
if (constructor === Map) {
|
1928
|
+
return areMapsEqual2(a, b, state);
|
1929
|
+
}
|
1930
|
+
if (constructor === Set) {
|
1931
|
+
return areSetsEqual2(a, b, state);
|
1932
|
+
}
|
1933
|
+
var tag = getTag(a);
|
1934
|
+
if (tag === DATE_TAG) {
|
1935
|
+
return areDatesEqual2(a, b, state);
|
1936
|
+
}
|
1937
|
+
if (tag === REG_EXP_TAG) {
|
1938
|
+
return areRegExpsEqual2(a, b, state);
|
1939
|
+
}
|
1940
|
+
if (tag === MAP_TAG) {
|
1941
|
+
return areMapsEqual2(a, b, state);
|
1942
|
+
}
|
1943
|
+
if (tag === SET_TAG) {
|
1944
|
+
return areSetsEqual2(a, b, state);
|
1945
|
+
}
|
1946
|
+
if (tag === OBJECT_TAG) {
|
1947
|
+
return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state);
|
1948
|
+
}
|
1949
|
+
if (tag === URL_TAG) {
|
1950
|
+
return areUrlsEqual2(a, b, state);
|
1951
|
+
}
|
1952
|
+
if (tag === ERROR_TAG) {
|
1953
|
+
return areErrorsEqual2(a, b, state);
|
1954
|
+
}
|
1955
|
+
if (tag === ARGUMENTS_TAG) {
|
1956
|
+
return areObjectsEqual2(a, b, state);
|
1957
|
+
}
|
1958
|
+
if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
|
1959
|
+
return arePrimitiveWrappersEqual2(a, b, state);
|
1960
|
+
}
|
1961
|
+
return false;
|
1962
|
+
};
|
1963
|
+
}
|
1964
|
+
function createEqualityComparatorConfig(_a) {
|
1965
|
+
var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
|
1966
|
+
var config = {
|
1967
|
+
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
1968
|
+
areDatesEqual,
|
1969
|
+
areErrorsEqual,
|
1970
|
+
areFunctionsEqual,
|
1971
|
+
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
1972
|
+
areNumbersEqual,
|
1973
|
+
areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
|
1974
|
+
arePrimitiveWrappersEqual,
|
1975
|
+
areRegExpsEqual,
|
1976
|
+
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
1977
|
+
areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
|
1978
|
+
areUrlsEqual
|
1979
|
+
};
|
1980
|
+
if (createCustomConfig) {
|
1981
|
+
config = assign({}, config, createCustomConfig(config));
|
1982
|
+
}
|
1983
|
+
if (circular) {
|
1984
|
+
var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
|
1985
|
+
var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
|
1986
|
+
var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
|
1987
|
+
var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
|
1988
|
+
config = assign({}, config, {
|
1989
|
+
areArraysEqual: areArraysEqual$1,
|
1990
|
+
areMapsEqual: areMapsEqual$1,
|
1991
|
+
areObjectsEqual: areObjectsEqual$1,
|
1992
|
+
areSetsEqual: areSetsEqual$1
|
1993
|
+
});
|
1994
|
+
}
|
1995
|
+
return config;
|
1996
|
+
}
|
1997
|
+
function createInternalEqualityComparator(compare) {
|
1998
|
+
return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
|
1999
|
+
return compare(a, b, state);
|
2000
|
+
};
|
2001
|
+
}
|
2002
|
+
function createIsEqual(_a) {
|
2003
|
+
var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
|
2004
|
+
if (createState) {
|
2005
|
+
return function isEqual(a, b) {
|
2006
|
+
var _a2 = createState(), _b = _a2.cache, cache2 = _b === void 0 ? circular ? /* @__PURE__ */ new WeakMap() : void 0 : _b, meta = _a2.meta;
|
2007
|
+
return comparator(a, b, {
|
2008
|
+
cache: cache2,
|
2009
|
+
equals,
|
2010
|
+
meta,
|
2011
|
+
strict
|
2012
|
+
});
|
2013
|
+
};
|
2014
|
+
}
|
2015
|
+
if (circular) {
|
2016
|
+
return function isEqual(a, b) {
|
2017
|
+
return comparator(a, b, {
|
2018
|
+
cache: /* @__PURE__ */ new WeakMap(),
|
2019
|
+
equals,
|
2020
|
+
meta: void 0,
|
2021
|
+
strict
|
2022
|
+
});
|
2023
|
+
};
|
2024
|
+
}
|
2025
|
+
var state = {
|
2026
|
+
cache: void 0,
|
2027
|
+
equals,
|
2028
|
+
meta: void 0,
|
2029
|
+
strict
|
2030
|
+
};
|
2031
|
+
return function isEqual(a, b) {
|
2032
|
+
return comparator(a, b, state);
|
2033
|
+
};
|
2034
|
+
}
|
2035
|
+
var deepEqual = createCustomEqual();
|
2036
|
+
var strictDeepEqual = createCustomEqual({ strict: true });
|
2037
|
+
var circularDeepEqual = createCustomEqual({ circular: true });
|
2038
|
+
var strictCircularDeepEqual = createCustomEqual({
|
2039
|
+
circular: true,
|
2040
|
+
strict: true
|
2041
|
+
});
|
2042
|
+
var shallowEqual = createCustomEqual({
|
2043
|
+
createInternalComparator: function() {
|
2044
|
+
return sameValueZeroEqual;
|
2045
|
+
}
|
2046
|
+
});
|
2047
|
+
var strictShallowEqual = createCustomEqual({
|
2048
|
+
strict: true,
|
2049
|
+
createInternalComparator: function() {
|
2050
|
+
return sameValueZeroEqual;
|
2051
|
+
}
|
2052
|
+
});
|
2053
|
+
var circularShallowEqual = createCustomEqual({
|
2054
|
+
circular: true,
|
2055
|
+
createInternalComparator: function() {
|
2056
|
+
return sameValueZeroEqual;
|
2057
|
+
}
|
2058
|
+
});
|
2059
|
+
var strictCircularShallowEqual = createCustomEqual({
|
2060
|
+
circular: true,
|
2061
|
+
createInternalComparator: function() {
|
2062
|
+
return sameValueZeroEqual;
|
2063
|
+
},
|
2064
|
+
strict: true
|
2065
|
+
});
|
2066
|
+
function createCustomEqual(options) {
|
2067
|
+
if (options === void 0) {
|
2068
|
+
options = {};
|
2069
|
+
}
|
2070
|
+
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;
|
2071
|
+
var config = createEqualityComparatorConfig(options);
|
2072
|
+
var comparator = createEqualityComparator(config);
|
2073
|
+
var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
|
2074
|
+
return createIsEqual({ circular, comparator, createState, equals, strict });
|
2075
|
+
}
|
2076
|
+
|
2077
|
+
// ../core/lib/get-changed.ts
|
1738
2078
|
var getChanged = (newItem, oldItem) => {
|
1739
2079
|
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1740
2080
|
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1741
2081
|
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1742
2082
|
return __spreadProps(__spreadValues({}, acc), {
|
1743
|
-
[item]: !(
|
2083
|
+
[item]: !deepEqual(oldItemProps[item], newItemProps[item])
|
1744
2084
|
});
|
1745
2085
|
}, {}) : {};
|
1746
2086
|
};
|
@@ -1865,7 +2205,6 @@ var createFieldsSlice = (_set, _get) => {
|
|
1865
2205
|
|
1866
2206
|
// ../core/lib/resolve-component-data.ts
|
1867
2207
|
init_react_import();
|
1868
|
-
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
1869
2208
|
var cache = { lastChange: {} };
|
1870
2209
|
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
1871
2210
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
@@ -1874,7 +2213,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1874
2213
|
const id = "id" in item.props ? item.props.id : "root";
|
1875
2214
|
if (shouldRunResolver) {
|
1876
2215
|
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1877
|
-
if (item && (
|
2216
|
+
if (trigger !== "force" && item && deepEqual(item, oldItem)) {
|
1878
2217
|
return { node: resolved, didChange: false };
|
1879
2218
|
}
|
1880
2219
|
const changed = getChanged(item, oldItem);
|
@@ -1924,7 +2263,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1924
2263
|
};
|
1925
2264
|
return {
|
1926
2265
|
node: itemWithResolvedChildren,
|
1927
|
-
didChange: !(
|
2266
|
+
didChange: !deepEqual(item, itemWithResolvedChildren)
|
1928
2267
|
};
|
1929
2268
|
});
|
1930
2269
|
|
@@ -1965,8 +2304,7 @@ var defaultAppState = {
|
|
1965
2304
|
options: [],
|
1966
2305
|
controlsVisible: true
|
1967
2306
|
},
|
1968
|
-
field: { focus: null }
|
1969
|
-
plugin: { current: null }
|
2307
|
+
field: { focus: null }
|
1970
2308
|
},
|
1971
2309
|
indexes: {
|
1972
2310
|
nodes: {},
|
@@ -1982,7 +2320,6 @@ var createAppStore = (initialAppStore) => create()(
|
|
1982
2320
|
subscribeWithSelector((set, get) => {
|
1983
2321
|
var _a, _b;
|
1984
2322
|
return __spreadProps(__spreadValues({
|
1985
|
-
instanceId: generateId(),
|
1986
2323
|
state: defaultAppState,
|
1987
2324
|
config: { components: {} },
|
1988
2325
|
componentState: {},
|
@@ -2153,14 +2490,203 @@ var createAppStore = (initialAppStore) => create()(
|
|
2153
2490
|
})
|
2154
2491
|
);
|
2155
2492
|
var appStoreContext = (0, import_react9.createContext)(createAppStore());
|
2493
|
+
function useAppStore(selector) {
|
2494
|
+
const context = (0, import_react9.useContext)(appStoreContext);
|
2495
|
+
return useStore(context, selector);
|
2496
|
+
}
|
2497
|
+
function useAppStoreApi() {
|
2498
|
+
return (0, import_react9.useContext)(appStoreContext);
|
2499
|
+
}
|
2500
|
+
|
2501
|
+
// ../core/lib/use-breadcrumbs.ts
|
2502
|
+
var useBreadcrumbs = (renderCount) => {
|
2503
|
+
const selectedId = useAppStore((s) => {
|
2504
|
+
var _a;
|
2505
|
+
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
2506
|
+
});
|
2507
|
+
const config = useAppStore((s) => s.config);
|
2508
|
+
const path = useAppStore((s) => {
|
2509
|
+
var _a;
|
2510
|
+
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
2511
|
+
});
|
2512
|
+
const appStore = useAppStoreApi();
|
2513
|
+
return (0, import_react10.useMemo)(() => {
|
2514
|
+
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
2515
|
+
var _a, _b, _c;
|
2516
|
+
const [componentId] = zoneCompound.split(":");
|
2517
|
+
if (componentId === "root") {
|
2518
|
+
return {
|
2519
|
+
label: "Page",
|
2520
|
+
selector: null
|
2521
|
+
};
|
2522
|
+
}
|
2523
|
+
const node = appStore.getState().state.indexes.nodes[componentId];
|
2524
|
+
const parentId = node.path[node.path.length - 1];
|
2525
|
+
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
2526
|
+
const index = contentIds.indexOf(componentId);
|
2527
|
+
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
2528
|
+
return {
|
2529
|
+
label,
|
2530
|
+
selector: node ? {
|
2531
|
+
index,
|
2532
|
+
zone: node.path[node.path.length - 1]
|
2533
|
+
} : null
|
2534
|
+
};
|
2535
|
+
})) || [];
|
2536
|
+
if (renderCount) {
|
2537
|
+
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
2538
|
+
}
|
2539
|
+
return breadcrumbs;
|
2540
|
+
}, [path, renderCount]);
|
2541
|
+
};
|
2542
|
+
|
2543
|
+
// ../core/components/Loader/index.tsx
|
2544
|
+
init_react_import();
|
2545
|
+
|
2546
|
+
// ../core/lib/index.ts
|
2547
|
+
init_react_import();
|
2548
|
+
|
2549
|
+
// ../core/lib/filter.ts
|
2550
|
+
init_react_import();
|
2551
|
+
|
2552
|
+
// ../core/lib/data/reorder.ts
|
2553
|
+
init_react_import();
|
2554
|
+
|
2555
|
+
// ../core/lib/data/replace.ts
|
2556
|
+
init_react_import();
|
2557
|
+
|
2558
|
+
// ../core/lib/use-reset-auto-zoom.ts
|
2559
|
+
init_react_import();
|
2156
2560
|
|
2157
2561
|
// ../core/lib/get-zoom-config.ts
|
2158
2562
|
init_react_import();
|
2159
2563
|
|
2564
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
2565
|
+
init_react_import();
|
2566
|
+
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
2567
|
+
|
2568
|
+
// ../core/components/Loader/index.tsx
|
2569
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
2570
|
+
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
2571
|
+
var Loader = (_a) => {
|
2572
|
+
var _b = _a, {
|
2573
|
+
color,
|
2574
|
+
size = 16
|
2575
|
+
} = _b, props = __objRest(_b, [
|
2576
|
+
"color",
|
2577
|
+
"size"
|
2578
|
+
]);
|
2579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
2580
|
+
"span",
|
2581
|
+
__spreadValues({
|
2582
|
+
className: getClassName2(),
|
2583
|
+
style: {
|
2584
|
+
width: size,
|
2585
|
+
height: size,
|
2586
|
+
color
|
2587
|
+
},
|
2588
|
+
"aria-label": "loading"
|
2589
|
+
}, props)
|
2590
|
+
);
|
2591
|
+
};
|
2592
|
+
|
2593
|
+
// ../core/components/SidebarSection/index.tsx
|
2594
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
2595
|
+
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
2596
|
+
var SidebarSection = ({
|
2597
|
+
children,
|
2598
|
+
title,
|
2599
|
+
background,
|
2600
|
+
showBreadcrumbs,
|
2601
|
+
noBorderTop,
|
2602
|
+
noPadding,
|
2603
|
+
isLoading
|
2604
|
+
}) => {
|
2605
|
+
const setUi = useAppStore((s) => s.setUi);
|
2606
|
+
const breadcrumbs = useBreadcrumbs(1);
|
2607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
2608
|
+
"div",
|
2609
|
+
{
|
2610
|
+
className: getClassName3({ noBorderTop, noPadding }),
|
2611
|
+
style: { background },
|
2612
|
+
children: [
|
2613
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
|
2614
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
|
2615
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
2616
|
+
"button",
|
2617
|
+
{
|
2618
|
+
type: "button",
|
2619
|
+
className: getClassName3("breadcrumbLabel"),
|
2620
|
+
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
2621
|
+
children: breadcrumb.label
|
2622
|
+
}
|
2623
|
+
),
|
2624
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, { size: 16 })
|
2625
|
+
] }, i)) : null,
|
2626
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
2627
|
+
] }) }),
|
2628
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("content"), children }),
|
2629
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 32 }) })
|
2630
|
+
]
|
2631
|
+
}
|
2632
|
+
);
|
2633
|
+
};
|
2634
|
+
|
2635
|
+
// ../core/components/OutlineList/index.tsx
|
2636
|
+
init_react_import();
|
2637
|
+
|
2638
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
2639
|
+
init_react_import();
|
2640
|
+
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
2641
|
+
|
2642
|
+
// ../core/components/OutlineList/index.tsx
|
2643
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
2644
|
+
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
2645
|
+
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
2646
|
+
var OutlineList = ({ children }) => {
|
2647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: getClassName4(), children });
|
2648
|
+
};
|
2649
|
+
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
|
2650
|
+
OutlineList.Item = ({
|
2651
|
+
children,
|
2652
|
+
onClick
|
2653
|
+
}) => {
|
2654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
2655
|
+
"li",
|
2656
|
+
{
|
2657
|
+
className: getClassNameItem({ clickable: !!onClick }),
|
2658
|
+
onClick,
|
2659
|
+
children
|
2660
|
+
}
|
2661
|
+
);
|
2662
|
+
};
|
2663
|
+
|
2664
|
+
// ../core/lib/scroll-into-view.ts
|
2665
|
+
init_react_import();
|
2666
|
+
var scrollIntoView = (el) => {
|
2667
|
+
const oldStyle = __spreadValues({}, el.style);
|
2668
|
+
el.style.scrollMargin = "256px";
|
2669
|
+
if (el) {
|
2670
|
+
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
2671
|
+
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
2672
|
+
}
|
2673
|
+
};
|
2674
|
+
|
2675
|
+
// ../core/lib/get-frame.ts
|
2676
|
+
init_react_import();
|
2677
|
+
var getFrame = () => {
|
2678
|
+
if (typeof window === "undefined") return;
|
2679
|
+
let frameEl = document.querySelector("#preview-frame");
|
2680
|
+
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
2681
|
+
return frameEl.contentDocument || document;
|
2682
|
+
}
|
2683
|
+
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
2684
|
+
};
|
2685
|
+
|
2160
2686
|
// src/HeadingAnalyzer.tsx
|
2161
2687
|
var import_react_from_json = __toESM(require("react-from-json"));
|
2162
|
-
var
|
2163
|
-
var
|
2688
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
2689
|
+
var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
2164
2690
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
2165
2691
|
var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
|
2166
2692
|
var getOutline = ({ frame } = {}) => {
|
@@ -2215,8 +2741,8 @@ function buildHierarchy(frame) {
|
|
2215
2741
|
var usePuck = (0, import_puck.createUsePuck)();
|
2216
2742
|
var HeadingAnalyzer = () => {
|
2217
2743
|
const data = usePuck((s) => s.appState.data);
|
2218
|
-
const [hierarchy, setHierarchy] = (0,
|
2219
|
-
(0,
|
2744
|
+
const [hierarchy, setHierarchy] = (0, import_react11.useState)([]);
|
2745
|
+
(0, import_react11.useEffect)(() => {
|
2220
2746
|
const frame = getFrame();
|
2221
2747
|
let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
|
2222
2748
|
const createHierarchy = () => {
|
@@ -2251,11 +2777,11 @@ var HeadingAnalyzer = () => {
|
|
2251
2777
|
frameObserver.disconnect();
|
2252
2778
|
};
|
2253
2779
|
}, [data]);
|
2254
|
-
return /* @__PURE__ */ (0,
|
2255
|
-
/* @__PURE__ */ (0,
|
2780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
|
2781
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
2256
2782
|
"small",
|
2257
2783
|
{
|
2258
|
-
className:
|
2784
|
+
className: getClassName5("cssWarning"),
|
2259
2785
|
style: {
|
2260
2786
|
color: "var(--puck-color-red-04)",
|
2261
2787
|
display: "block",
|
@@ -2264,19 +2790,19 @@ var HeadingAnalyzer = () => {
|
|
2264
2790
|
children: [
|
2265
2791
|
"Heading analyzer styles not loaded. Please review the",
|
2266
2792
|
" ",
|
2267
|
-
/* @__PURE__ */ (0,
|
2793
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
2268
2794
|
"."
|
2269
2795
|
]
|
2270
2796
|
}
|
2271
2797
|
),
|
2272
|
-
hierarchy.length === 0 && /* @__PURE__ */ (0,
|
2273
|
-
/* @__PURE__ */ (0,
|
2798
|
+
hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: "No headings." }),
|
2799
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
2274
2800
|
ReactFromJSON,
|
2275
2801
|
{
|
2276
2802
|
mapping: {
|
2277
|
-
Root: (props) => /* @__PURE__ */ (0,
|
2278
|
-
OutlineListItem: (props) => /* @__PURE__ */ (0,
|
2279
|
-
/* @__PURE__ */ (0,
|
2803
|
+
Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: props.children }),
|
2804
|
+
OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(OutlineList.Item, { children: [
|
2805
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
2280
2806
|
"small",
|
2281
2807
|
{
|
2282
2808
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -2294,14 +2820,14 @@ var HeadingAnalyzer = () => {
|
|
2294
2820
|
}, 2e3);
|
2295
2821
|
}
|
2296
2822
|
},
|
2297
|
-
children: props.missing ? /* @__PURE__ */ (0,
|
2298
|
-
/* @__PURE__ */ (0,
|
2823
|
+
children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
2824
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
|
2299
2825
|
"H",
|
2300
2826
|
props.rank
|
2301
2827
|
] }),
|
2302
2828
|
": Missing"
|
2303
|
-
] }) : /* @__PURE__ */ (0,
|
2304
|
-
/* @__PURE__ */ (0,
|
2829
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
2830
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
|
2305
2831
|
"H",
|
2306
2832
|
props.rank
|
2307
2833
|
] }),
|
@@ -2310,7 +2836,7 @@ var HeadingAnalyzer = () => {
|
|
2310
2836
|
] })
|
2311
2837
|
}
|
2312
2838
|
) }),
|
2313
|
-
/* @__PURE__ */ (0,
|
2839
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: props.children })
|
2314
2840
|
] })
|
2315
2841
|
},
|
2316
2842
|
entry: {
|
@@ -2331,10 +2857,12 @@ var HeadingAnalyzer = () => {
|
|
2331
2857
|
] });
|
2332
2858
|
};
|
2333
2859
|
var headingAnalyzer = {
|
2334
|
-
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2860
|
+
overrides: {
|
2861
|
+
fields: ({ children, itemSelector }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
2862
|
+
children,
|
2863
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeadingAnalyzer, {}) }) })
|
2864
|
+
] })
|
2865
|
+
}
|
2338
2866
|
};
|
2339
2867
|
var HeadingAnalyzer_default = headingAnalyzer;
|
2340
2868
|
/*! Bundled license information:
|
@@ -2378,7 +2906,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
2378
2906
|
* See the LICENSE file in the root directory of this source tree.
|
2379
2907
|
*)
|
2380
2908
|
|
2381
|
-
lucide-react/dist/esm/icons/
|
2909
|
+
lucide-react/dist/esm/icons/chevron-right.js:
|
2382
2910
|
(**
|
2383
2911
|
* @license lucide-react v0.468.0 - ISC
|
2384
2912
|
*
|