@measured/puck-plugin-heading-analyzer 0.21.0-canary.20aafb6a → 0.21.0-canary.2e1b5267
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 +509 -287
- package/dist/index.mjs +506 -284
- 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();
|
@@ -1444,7 +1443,8 @@ init_react_import();
|
|
1444
1443
|
var defaultViewports = [
|
1445
1444
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1446
1445
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1447
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1446
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" },
|
1447
|
+
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
1448
1448
|
];
|
1449
1449
|
|
1450
1450
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
@@ -1690,7 +1690,7 @@ var flattenData = (state, config) => {
|
|
1690
1690
|
(content) => content,
|
1691
1691
|
(item) => {
|
1692
1692
|
data.push(item);
|
1693
|
-
return
|
1693
|
+
return item;
|
1694
1694
|
}
|
1695
1695
|
);
|
1696
1696
|
return data;
|
@@ -1698,13 +1698,425 @@ var flattenData = (state, config) => {
|
|
1698
1698
|
|
1699
1699
|
// ../core/lib/get-changed.ts
|
1700
1700
|
init_react_import();
|
1701
|
-
|
1701
|
+
|
1702
|
+
// ../../node_modules/fast-equals/dist/esm/index.mjs
|
1703
|
+
init_react_import();
|
1704
|
+
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
1705
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
1706
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
1707
|
+
function combineComparators(comparatorA, comparatorB) {
|
1708
|
+
return function isEqual(a, b, state) {
|
1709
|
+
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
1710
|
+
};
|
1711
|
+
}
|
1712
|
+
function createIsCircular(areItemsEqual) {
|
1713
|
+
return function isCircular(a, b, state) {
|
1714
|
+
if (!a || !b || typeof a !== "object" || typeof b !== "object") {
|
1715
|
+
return areItemsEqual(a, b, state);
|
1716
|
+
}
|
1717
|
+
var cache2 = state.cache;
|
1718
|
+
var cachedA = cache2.get(a);
|
1719
|
+
var cachedB = cache2.get(b);
|
1720
|
+
if (cachedA && cachedB) {
|
1721
|
+
return cachedA === b && cachedB === a;
|
1722
|
+
}
|
1723
|
+
cache2.set(a, b);
|
1724
|
+
cache2.set(b, a);
|
1725
|
+
var result = areItemsEqual(a, b, state);
|
1726
|
+
cache2.delete(a);
|
1727
|
+
cache2.delete(b);
|
1728
|
+
return result;
|
1729
|
+
};
|
1730
|
+
}
|
1731
|
+
function getStrictProperties(object) {
|
1732
|
+
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
1733
|
+
}
|
1734
|
+
var hasOwn = Object.hasOwn || function(object, property) {
|
1735
|
+
return hasOwnProperty.call(object, property);
|
1736
|
+
};
|
1737
|
+
function sameValueZeroEqual(a, b) {
|
1738
|
+
return a === b || !a && !b && a !== a && b !== b;
|
1739
|
+
}
|
1740
|
+
var PREACT_VNODE = "__v";
|
1741
|
+
var PREACT_OWNER = "__o";
|
1742
|
+
var REACT_OWNER = "_owner";
|
1743
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
1744
|
+
var keys = Object.keys;
|
1745
|
+
function areArraysEqual(a, b, state) {
|
1746
|
+
var index = a.length;
|
1747
|
+
if (b.length !== index) {
|
1748
|
+
return false;
|
1749
|
+
}
|
1750
|
+
while (index-- > 0) {
|
1751
|
+
if (!state.equals(a[index], b[index], index, index, a, b, state)) {
|
1752
|
+
return false;
|
1753
|
+
}
|
1754
|
+
}
|
1755
|
+
return true;
|
1756
|
+
}
|
1757
|
+
function areDatesEqual(a, b) {
|
1758
|
+
return sameValueZeroEqual(a.getTime(), b.getTime());
|
1759
|
+
}
|
1760
|
+
function areErrorsEqual(a, b) {
|
1761
|
+
return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
|
1762
|
+
}
|
1763
|
+
function areFunctionsEqual(a, b) {
|
1764
|
+
return a === b;
|
1765
|
+
}
|
1766
|
+
function areMapsEqual(a, b, state) {
|
1767
|
+
var size = a.size;
|
1768
|
+
if (size !== b.size) {
|
1769
|
+
return false;
|
1770
|
+
}
|
1771
|
+
if (!size) {
|
1772
|
+
return true;
|
1773
|
+
}
|
1774
|
+
var matchedIndices = new Array(size);
|
1775
|
+
var aIterable = a.entries();
|
1776
|
+
var aResult;
|
1777
|
+
var bResult;
|
1778
|
+
var index = 0;
|
1779
|
+
while (aResult = aIterable.next()) {
|
1780
|
+
if (aResult.done) {
|
1781
|
+
break;
|
1782
|
+
}
|
1783
|
+
var bIterable = b.entries();
|
1784
|
+
var hasMatch = false;
|
1785
|
+
var matchIndex = 0;
|
1786
|
+
while (bResult = bIterable.next()) {
|
1787
|
+
if (bResult.done) {
|
1788
|
+
break;
|
1789
|
+
}
|
1790
|
+
if (matchedIndices[matchIndex]) {
|
1791
|
+
matchIndex++;
|
1792
|
+
continue;
|
1793
|
+
}
|
1794
|
+
var aEntry = aResult.value;
|
1795
|
+
var bEntry = bResult.value;
|
1796
|
+
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)) {
|
1797
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
1798
|
+
break;
|
1799
|
+
}
|
1800
|
+
matchIndex++;
|
1801
|
+
}
|
1802
|
+
if (!hasMatch) {
|
1803
|
+
return false;
|
1804
|
+
}
|
1805
|
+
index++;
|
1806
|
+
}
|
1807
|
+
return true;
|
1808
|
+
}
|
1809
|
+
var areNumbersEqual = sameValueZeroEqual;
|
1810
|
+
function areObjectsEqual(a, b, state) {
|
1811
|
+
var properties = keys(a);
|
1812
|
+
var index = properties.length;
|
1813
|
+
if (keys(b).length !== index) {
|
1814
|
+
return false;
|
1815
|
+
}
|
1816
|
+
while (index-- > 0) {
|
1817
|
+
if (!isPropertyEqual(a, b, state, properties[index])) {
|
1818
|
+
return false;
|
1819
|
+
}
|
1820
|
+
}
|
1821
|
+
return true;
|
1822
|
+
}
|
1823
|
+
function areObjectsEqualStrict(a, b, state) {
|
1824
|
+
var properties = getStrictProperties(a);
|
1825
|
+
var index = properties.length;
|
1826
|
+
if (getStrictProperties(b).length !== index) {
|
1827
|
+
return false;
|
1828
|
+
}
|
1829
|
+
var property;
|
1830
|
+
var descriptorA;
|
1831
|
+
var descriptorB;
|
1832
|
+
while (index-- > 0) {
|
1833
|
+
property = properties[index];
|
1834
|
+
if (!isPropertyEqual(a, b, state, property)) {
|
1835
|
+
return false;
|
1836
|
+
}
|
1837
|
+
descriptorA = getOwnPropertyDescriptor(a, property);
|
1838
|
+
descriptorB = getOwnPropertyDescriptor(b, property);
|
1839
|
+
if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) {
|
1840
|
+
return false;
|
1841
|
+
}
|
1842
|
+
}
|
1843
|
+
return true;
|
1844
|
+
}
|
1845
|
+
function arePrimitiveWrappersEqual(a, b) {
|
1846
|
+
return sameValueZeroEqual(a.valueOf(), b.valueOf());
|
1847
|
+
}
|
1848
|
+
function areRegExpsEqual(a, b) {
|
1849
|
+
return a.source === b.source && a.flags === b.flags;
|
1850
|
+
}
|
1851
|
+
function areSetsEqual(a, b, state) {
|
1852
|
+
var size = a.size;
|
1853
|
+
if (size !== b.size) {
|
1854
|
+
return false;
|
1855
|
+
}
|
1856
|
+
if (!size) {
|
1857
|
+
return true;
|
1858
|
+
}
|
1859
|
+
var matchedIndices = new Array(size);
|
1860
|
+
var aIterable = a.values();
|
1861
|
+
var aResult;
|
1862
|
+
var bResult;
|
1863
|
+
while (aResult = aIterable.next()) {
|
1864
|
+
if (aResult.done) {
|
1865
|
+
break;
|
1866
|
+
}
|
1867
|
+
var bIterable = b.values();
|
1868
|
+
var hasMatch = false;
|
1869
|
+
var matchIndex = 0;
|
1870
|
+
while (bResult = bIterable.next()) {
|
1871
|
+
if (bResult.done) {
|
1872
|
+
break;
|
1873
|
+
}
|
1874
|
+
if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
|
1875
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
1876
|
+
break;
|
1877
|
+
}
|
1878
|
+
matchIndex++;
|
1879
|
+
}
|
1880
|
+
if (!hasMatch) {
|
1881
|
+
return false;
|
1882
|
+
}
|
1883
|
+
}
|
1884
|
+
return true;
|
1885
|
+
}
|
1886
|
+
function areTypedArraysEqual(a, b) {
|
1887
|
+
var index = a.length;
|
1888
|
+
if (b.length !== index) {
|
1889
|
+
return false;
|
1890
|
+
}
|
1891
|
+
while (index-- > 0) {
|
1892
|
+
if (a[index] !== b[index]) {
|
1893
|
+
return false;
|
1894
|
+
}
|
1895
|
+
}
|
1896
|
+
return true;
|
1897
|
+
}
|
1898
|
+
function areUrlsEqual(a, b) {
|
1899
|
+
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;
|
1900
|
+
}
|
1901
|
+
function isPropertyEqual(a, b, state, property) {
|
1902
|
+
if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) {
|
1903
|
+
return true;
|
1904
|
+
}
|
1905
|
+
return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
|
1906
|
+
}
|
1907
|
+
var ARGUMENTS_TAG = "[object Arguments]";
|
1908
|
+
var BOOLEAN_TAG = "[object Boolean]";
|
1909
|
+
var DATE_TAG = "[object Date]";
|
1910
|
+
var ERROR_TAG = "[object Error]";
|
1911
|
+
var MAP_TAG = "[object Map]";
|
1912
|
+
var NUMBER_TAG = "[object Number]";
|
1913
|
+
var OBJECT_TAG = "[object Object]";
|
1914
|
+
var REG_EXP_TAG = "[object RegExp]";
|
1915
|
+
var SET_TAG = "[object Set]";
|
1916
|
+
var STRING_TAG = "[object String]";
|
1917
|
+
var URL_TAG = "[object URL]";
|
1918
|
+
var isArray = Array.isArray;
|
1919
|
+
var isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null;
|
1920
|
+
var assign = Object.assign;
|
1921
|
+
var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
|
1922
|
+
function createEqualityComparator(_a) {
|
1923
|
+
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;
|
1924
|
+
return function comparator(a, b, state) {
|
1925
|
+
if (a === b) {
|
1926
|
+
return true;
|
1927
|
+
}
|
1928
|
+
if (a == null || b == null) {
|
1929
|
+
return false;
|
1930
|
+
}
|
1931
|
+
var type = typeof a;
|
1932
|
+
if (type !== typeof b) {
|
1933
|
+
return false;
|
1934
|
+
}
|
1935
|
+
if (type !== "object") {
|
1936
|
+
if (type === "number") {
|
1937
|
+
return areNumbersEqual2(a, b, state);
|
1938
|
+
}
|
1939
|
+
if (type === "function") {
|
1940
|
+
return areFunctionsEqual2(a, b, state);
|
1941
|
+
}
|
1942
|
+
return false;
|
1943
|
+
}
|
1944
|
+
var constructor = a.constructor;
|
1945
|
+
if (constructor !== b.constructor) {
|
1946
|
+
return false;
|
1947
|
+
}
|
1948
|
+
if (constructor === Object) {
|
1949
|
+
return areObjectsEqual2(a, b, state);
|
1950
|
+
}
|
1951
|
+
if (isArray(a)) {
|
1952
|
+
return areArraysEqual2(a, b, state);
|
1953
|
+
}
|
1954
|
+
if (isTypedArray != null && isTypedArray(a)) {
|
1955
|
+
return areTypedArraysEqual2(a, b, state);
|
1956
|
+
}
|
1957
|
+
if (constructor === Date) {
|
1958
|
+
return areDatesEqual2(a, b, state);
|
1959
|
+
}
|
1960
|
+
if (constructor === RegExp) {
|
1961
|
+
return areRegExpsEqual2(a, b, state);
|
1962
|
+
}
|
1963
|
+
if (constructor === Map) {
|
1964
|
+
return areMapsEqual2(a, b, state);
|
1965
|
+
}
|
1966
|
+
if (constructor === Set) {
|
1967
|
+
return areSetsEqual2(a, b, state);
|
1968
|
+
}
|
1969
|
+
var tag = getTag(a);
|
1970
|
+
if (tag === DATE_TAG) {
|
1971
|
+
return areDatesEqual2(a, b, state);
|
1972
|
+
}
|
1973
|
+
if (tag === REG_EXP_TAG) {
|
1974
|
+
return areRegExpsEqual2(a, b, state);
|
1975
|
+
}
|
1976
|
+
if (tag === MAP_TAG) {
|
1977
|
+
return areMapsEqual2(a, b, state);
|
1978
|
+
}
|
1979
|
+
if (tag === SET_TAG) {
|
1980
|
+
return areSetsEqual2(a, b, state);
|
1981
|
+
}
|
1982
|
+
if (tag === OBJECT_TAG) {
|
1983
|
+
return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state);
|
1984
|
+
}
|
1985
|
+
if (tag === URL_TAG) {
|
1986
|
+
return areUrlsEqual2(a, b, state);
|
1987
|
+
}
|
1988
|
+
if (tag === ERROR_TAG) {
|
1989
|
+
return areErrorsEqual2(a, b, state);
|
1990
|
+
}
|
1991
|
+
if (tag === ARGUMENTS_TAG) {
|
1992
|
+
return areObjectsEqual2(a, b, state);
|
1993
|
+
}
|
1994
|
+
if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
|
1995
|
+
return arePrimitiveWrappersEqual2(a, b, state);
|
1996
|
+
}
|
1997
|
+
return false;
|
1998
|
+
};
|
1999
|
+
}
|
2000
|
+
function createEqualityComparatorConfig(_a) {
|
2001
|
+
var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
|
2002
|
+
var config = {
|
2003
|
+
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
2004
|
+
areDatesEqual,
|
2005
|
+
areErrorsEqual,
|
2006
|
+
areFunctionsEqual,
|
2007
|
+
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
2008
|
+
areNumbersEqual,
|
2009
|
+
areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
|
2010
|
+
arePrimitiveWrappersEqual,
|
2011
|
+
areRegExpsEqual,
|
2012
|
+
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
2013
|
+
areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
|
2014
|
+
areUrlsEqual
|
2015
|
+
};
|
2016
|
+
if (createCustomConfig) {
|
2017
|
+
config = assign({}, config, createCustomConfig(config));
|
2018
|
+
}
|
2019
|
+
if (circular) {
|
2020
|
+
var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
|
2021
|
+
var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
|
2022
|
+
var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
|
2023
|
+
var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
|
2024
|
+
config = assign({}, config, {
|
2025
|
+
areArraysEqual: areArraysEqual$1,
|
2026
|
+
areMapsEqual: areMapsEqual$1,
|
2027
|
+
areObjectsEqual: areObjectsEqual$1,
|
2028
|
+
areSetsEqual: areSetsEqual$1
|
2029
|
+
});
|
2030
|
+
}
|
2031
|
+
return config;
|
2032
|
+
}
|
2033
|
+
function createInternalEqualityComparator(compare) {
|
2034
|
+
return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
|
2035
|
+
return compare(a, b, state);
|
2036
|
+
};
|
2037
|
+
}
|
2038
|
+
function createIsEqual(_a) {
|
2039
|
+
var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
|
2040
|
+
if (createState) {
|
2041
|
+
return function isEqual(a, b) {
|
2042
|
+
var _a2 = createState(), _b = _a2.cache, cache2 = _b === void 0 ? circular ? /* @__PURE__ */ new WeakMap() : void 0 : _b, meta = _a2.meta;
|
2043
|
+
return comparator(a, b, {
|
2044
|
+
cache: cache2,
|
2045
|
+
equals,
|
2046
|
+
meta,
|
2047
|
+
strict
|
2048
|
+
});
|
2049
|
+
};
|
2050
|
+
}
|
2051
|
+
if (circular) {
|
2052
|
+
return function isEqual(a, b) {
|
2053
|
+
return comparator(a, b, {
|
2054
|
+
cache: /* @__PURE__ */ new WeakMap(),
|
2055
|
+
equals,
|
2056
|
+
meta: void 0,
|
2057
|
+
strict
|
2058
|
+
});
|
2059
|
+
};
|
2060
|
+
}
|
2061
|
+
var state = {
|
2062
|
+
cache: void 0,
|
2063
|
+
equals,
|
2064
|
+
meta: void 0,
|
2065
|
+
strict
|
2066
|
+
};
|
2067
|
+
return function isEqual(a, b) {
|
2068
|
+
return comparator(a, b, state);
|
2069
|
+
};
|
2070
|
+
}
|
2071
|
+
var deepEqual = createCustomEqual();
|
2072
|
+
var strictDeepEqual = createCustomEqual({ strict: true });
|
2073
|
+
var circularDeepEqual = createCustomEqual({ circular: true });
|
2074
|
+
var strictCircularDeepEqual = createCustomEqual({
|
2075
|
+
circular: true,
|
2076
|
+
strict: true
|
2077
|
+
});
|
2078
|
+
var shallowEqual = createCustomEqual({
|
2079
|
+
createInternalComparator: function() {
|
2080
|
+
return sameValueZeroEqual;
|
2081
|
+
}
|
2082
|
+
});
|
2083
|
+
var strictShallowEqual = createCustomEqual({
|
2084
|
+
strict: true,
|
2085
|
+
createInternalComparator: function() {
|
2086
|
+
return sameValueZeroEqual;
|
2087
|
+
}
|
2088
|
+
});
|
2089
|
+
var circularShallowEqual = createCustomEqual({
|
2090
|
+
circular: true,
|
2091
|
+
createInternalComparator: function() {
|
2092
|
+
return sameValueZeroEqual;
|
2093
|
+
}
|
2094
|
+
});
|
2095
|
+
var strictCircularShallowEqual = createCustomEqual({
|
2096
|
+
circular: true,
|
2097
|
+
createInternalComparator: function() {
|
2098
|
+
return sameValueZeroEqual;
|
2099
|
+
},
|
2100
|
+
strict: true
|
2101
|
+
});
|
2102
|
+
function createCustomEqual(options) {
|
2103
|
+
if (options === void 0) {
|
2104
|
+
options = {};
|
2105
|
+
}
|
2106
|
+
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;
|
2107
|
+
var config = createEqualityComparatorConfig(options);
|
2108
|
+
var comparator = createEqualityComparator(config);
|
2109
|
+
var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
|
2110
|
+
return createIsEqual({ circular, comparator, createState, equals, strict });
|
2111
|
+
}
|
2112
|
+
|
2113
|
+
// ../core/lib/get-changed.ts
|
1702
2114
|
var getChanged = (newItem, oldItem) => {
|
1703
2115
|
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1704
2116
|
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1705
2117
|
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1706
2118
|
return __spreadProps(__spreadValues({}, acc), {
|
1707
|
-
[item]: !(
|
2119
|
+
[item]: !deepEqual(oldItemProps[item], newItemProps[item])
|
1708
2120
|
});
|
1709
2121
|
}, {}) : {};
|
1710
2122
|
};
|
@@ -1829,7 +2241,6 @@ var createFieldsSlice = (_set, _get) => {
|
|
1829
2241
|
|
1830
2242
|
// ../core/lib/resolve-component-data.ts
|
1831
2243
|
init_react_import();
|
1832
|
-
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
1833
2244
|
var cache = { lastChange: {} };
|
1834
2245
|
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
1835
2246
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
@@ -1838,7 +2249,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1838
2249
|
const id = "id" in item.props ? item.props.id : "root";
|
1839
2250
|
if (shouldRunResolver) {
|
1840
2251
|
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1841
|
-
if (trigger !== "force" && item && (
|
2252
|
+
if (trigger !== "force" && item && deepEqual(item, oldItem)) {
|
1842
2253
|
return { node: resolved, didChange: false };
|
1843
2254
|
}
|
1844
2255
|
const changed = getChanged(item, oldItem);
|
@@ -1888,7 +2299,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1888
2299
|
};
|
1889
2300
|
return {
|
1890
2301
|
node: itemWithResolvedChildren,
|
1891
|
-
didChange: !(
|
2302
|
+
didChange: !deepEqual(item, itemWithResolvedChildren)
|
1892
2303
|
};
|
1893
2304
|
});
|
1894
2305
|
|
@@ -1929,7 +2340,8 @@ var defaultAppState = {
|
|
1929
2340
|
options: [],
|
1930
2341
|
controlsVisible: true
|
1931
2342
|
},
|
1932
|
-
field: { focus: null }
|
2343
|
+
field: { focus: null },
|
2344
|
+
plugin: { current: null }
|
1933
2345
|
},
|
1934
2346
|
indexes: {
|
1935
2347
|
nodes: {},
|
@@ -1945,6 +2357,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
1945
2357
|
subscribeWithSelector((set, get) => {
|
1946
2358
|
var _a, _b;
|
1947
2359
|
return __spreadProps(__spreadValues({
|
2360
|
+
instanceId: generateId(),
|
1948
2361
|
state: defaultAppState,
|
1949
2362
|
config: { components: {} },
|
1950
2363
|
componentState: {},
|
@@ -2115,203 +2528,14 @@ var createAppStore = (initialAppStore) => create()(
|
|
2115
2528
|
})
|
2116
2529
|
);
|
2117
2530
|
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
2531
|
|
2186
2532
|
// ../core/lib/get-zoom-config.ts
|
2187
2533
|
init_react_import();
|
2188
2534
|
|
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
2535
|
// src/HeadingAnalyzer.tsx
|
2312
2536
|
var import_react_from_json = __toESM(require("react-from-json"));
|
2313
|
-
var
|
2314
|
-
var
|
2537
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
2538
|
+
var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
2315
2539
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
2316
2540
|
var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
|
2317
2541
|
var getOutline = ({ frame } = {}) => {
|
@@ -2366,8 +2590,8 @@ function buildHierarchy(frame) {
|
|
2366
2590
|
var usePuck = (0, import_puck.createUsePuck)();
|
2367
2591
|
var HeadingAnalyzer = () => {
|
2368
2592
|
const data = usePuck((s) => s.appState.data);
|
2369
|
-
const [hierarchy, setHierarchy] = (0,
|
2370
|
-
(0,
|
2593
|
+
const [hierarchy, setHierarchy] = (0, import_react10.useState)([]);
|
2594
|
+
(0, import_react10.useEffect)(() => {
|
2371
2595
|
const frame = getFrame();
|
2372
2596
|
let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
|
2373
2597
|
const createHierarchy = () => {
|
@@ -2402,11 +2626,11 @@ var HeadingAnalyzer = () => {
|
|
2402
2626
|
frameObserver.disconnect();
|
2403
2627
|
};
|
2404
2628
|
}, [data]);
|
2405
|
-
return /* @__PURE__ */ (0,
|
2406
|
-
/* @__PURE__ */ (0,
|
2629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: getClassName2(), children: [
|
2630
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
2407
2631
|
"small",
|
2408
2632
|
{
|
2409
|
-
className:
|
2633
|
+
className: getClassName2("cssWarning"),
|
2410
2634
|
style: {
|
2411
2635
|
color: "var(--puck-color-red-04)",
|
2412
2636
|
display: "block",
|
@@ -2415,19 +2639,19 @@ var HeadingAnalyzer = () => {
|
|
2415
2639
|
children: [
|
2416
2640
|
"Heading analyzer styles not loaded. Please review the",
|
2417
2641
|
" ",
|
2418
|
-
/* @__PURE__ */ (0,
|
2642
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
2419
2643
|
"."
|
2420
2644
|
]
|
2421
2645
|
}
|
2422
2646
|
),
|
2423
|
-
hierarchy.length === 0 && /* @__PURE__ */ (0,
|
2424
|
-
/* @__PURE__ */ (0,
|
2647
|
+
hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: "No headings." }),
|
2648
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
2425
2649
|
ReactFromJSON,
|
2426
2650
|
{
|
2427
2651
|
mapping: {
|
2428
|
-
Root: (props) => /* @__PURE__ */ (0,
|
2429
|
-
OutlineListItem: (props) => /* @__PURE__ */ (0,
|
2430
|
-
/* @__PURE__ */ (0,
|
2652
|
+
Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: props.children }),
|
2653
|
+
OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(OutlineList.Item, { children: [
|
2654
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
2431
2655
|
"small",
|
2432
2656
|
{
|
2433
2657
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -2445,14 +2669,14 @@ var HeadingAnalyzer = () => {
|
|
2445
2669
|
}, 2e3);
|
2446
2670
|
}
|
2447
2671
|
},
|
2448
|
-
children: props.missing ? /* @__PURE__ */ (0,
|
2449
|
-
/* @__PURE__ */ (0,
|
2672
|
+
children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
2673
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
|
2450
2674
|
"H",
|
2451
2675
|
props.rank
|
2452
2676
|
] }),
|
2453
2677
|
": Missing"
|
2454
|
-
] }) : /* @__PURE__ */ (0,
|
2455
|
-
/* @__PURE__ */ (0,
|
2678
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
2679
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
|
2456
2680
|
"H",
|
2457
2681
|
props.rank
|
2458
2682
|
] }),
|
@@ -2461,7 +2685,7 @@ var HeadingAnalyzer = () => {
|
|
2461
2685
|
] })
|
2462
2686
|
}
|
2463
2687
|
) }),
|
2464
|
-
/* @__PURE__ */ (0,
|
2688
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: props.children })
|
2465
2689
|
] })
|
2466
2690
|
},
|
2467
2691
|
entry: {
|
@@ -2482,12 +2706,10 @@ var HeadingAnalyzer = () => {
|
|
2482
2706
|
] });
|
2483
2707
|
};
|
2484
2708
|
var headingAnalyzer = {
|
2485
|
-
|
2486
|
-
|
2487
|
-
|
2488
|
-
|
2489
|
-
] })
|
2490
|
-
}
|
2709
|
+
name: "heading-analyzer",
|
2710
|
+
label: "Audit",
|
2711
|
+
render: HeadingAnalyzer,
|
2712
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Heading1, {})
|
2491
2713
|
};
|
2492
2714
|
var HeadingAnalyzer_default = headingAnalyzer;
|
2493
2715
|
/*! Bundled license information:
|
@@ -2531,7 +2753,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
2531
2753
|
* See the LICENSE file in the root directory of this source tree.
|
2532
2754
|
*)
|
2533
2755
|
|
2534
|
-
lucide-react/dist/esm/icons/
|
2756
|
+
lucide-react/dist/esm/icons/heading-1.js:
|
2535
2757
|
(**
|
2536
2758
|
* @license lucide-react v0.468.0 - ISC
|
2537
2759
|
*
|