@measured/puck-plugin-heading-analyzer 0.21.0-canary.5c9698fb → 0.21.0-canary.8db6528d
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.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +445 -65
- package/dist/index.mjs +445 -65
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
@@ -210,6 +210,7 @@ UserField extends BaseField = {}> = {
|
|
210
210
|
fields: Fields<FieldProps>;
|
211
211
|
lastFields: Fields<FieldProps>;
|
212
212
|
lastData: DataShape | null;
|
213
|
+
metadata: Metadata;
|
213
214
|
appState: AppState;
|
214
215
|
parent: ComponentData | null;
|
215
216
|
}) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
|
@@ -249,7 +250,7 @@ type ConfigInternal<Props extends DefaultComponents = DefaultComponents, RootPro
|
|
249
250
|
root?: RootConfigInternal<RootProps, UserField>;
|
250
251
|
};
|
251
252
|
type DefaultComponents = Record<string, any>;
|
252
|
-
type Config<PropsOrParams extends LeftOrExactRight<PropsOrParams, DefaultComponents, ConfigParams> = DefaultComponents | ConfigParams, RootProps extends DefaultComponentProps =
|
253
|
+
type Config<PropsOrParams extends LeftOrExactRight<PropsOrParams, DefaultComponents, ConfigParams> = DefaultComponents | ConfigParams, RootProps extends DefaultComponentProps = any, CategoryName extends string = string> = PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, never> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number]> : PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, infer ParamFields> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number], ParamFields[keyof ParamFields] & BaseField> : PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, any> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number], {}> : ConfigInternal<PropsOrParams, RootProps, CategoryName>;
|
253
254
|
type ExtractConfigParams<UserConfig extends ConfigInternal> = UserConfig extends ConfigInternal<infer PropsOrParams, infer RootProps, infer CategoryName, infer UserField> ? {
|
254
255
|
props: PropsOrParams;
|
255
256
|
rootProps: RootProps & DefaultRootFieldProps;
|
@@ -370,7 +371,7 @@ type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined
|
|
370
371
|
type WithDeepSlots<T, SlotType = T> = T extends Slot ? SlotType : T extends (infer U)[] ? Array<WithDeepSlots<U, SlotType>> : T extends (infer U)[] ? WithDeepSlots<U, SlotType>[] : T extends BuiltinTypes ? T : T extends object ? {
|
371
372
|
[K in keyof T]: WithDeepSlots<T[K], SlotType>;
|
372
373
|
} : T;
|
373
|
-
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps =
|
374
|
+
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
|
374
375
|
components?: Components;
|
375
376
|
root?: RootProps;
|
376
377
|
categories?: CategoryNames;
|
package/dist/index.d.ts
CHANGED
@@ -210,6 +210,7 @@ UserField extends BaseField = {}> = {
|
|
210
210
|
fields: Fields<FieldProps>;
|
211
211
|
lastFields: Fields<FieldProps>;
|
212
212
|
lastData: DataShape | null;
|
213
|
+
metadata: Metadata;
|
213
214
|
appState: AppState;
|
214
215
|
parent: ComponentData | null;
|
215
216
|
}) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
|
@@ -249,7 +250,7 @@ type ConfigInternal<Props extends DefaultComponents = DefaultComponents, RootPro
|
|
249
250
|
root?: RootConfigInternal<RootProps, UserField>;
|
250
251
|
};
|
251
252
|
type DefaultComponents = Record<string, any>;
|
252
|
-
type Config<PropsOrParams extends LeftOrExactRight<PropsOrParams, DefaultComponents, ConfigParams> = DefaultComponents | ConfigParams, RootProps extends DefaultComponentProps =
|
253
|
+
type Config<PropsOrParams extends LeftOrExactRight<PropsOrParams, DefaultComponents, ConfigParams> = DefaultComponents | ConfigParams, RootProps extends DefaultComponentProps = any, CategoryName extends string = string> = PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, never> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number]> : PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, infer ParamFields> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number], ParamFields[keyof ParamFields] & BaseField> : PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, any> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number], {}> : ConfigInternal<PropsOrParams, RootProps, CategoryName>;
|
253
254
|
type ExtractConfigParams<UserConfig extends ConfigInternal> = UserConfig extends ConfigInternal<infer PropsOrParams, infer RootProps, infer CategoryName, infer UserField> ? {
|
254
255
|
props: PropsOrParams;
|
255
256
|
rootProps: RootProps & DefaultRootFieldProps;
|
@@ -370,7 +371,7 @@ type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined
|
|
370
371
|
type WithDeepSlots<T, SlotType = T> = T extends Slot ? SlotType : T extends (infer U)[] ? Array<WithDeepSlots<U, SlotType>> : T extends (infer U)[] ? WithDeepSlots<U, SlotType>[] : T extends BuiltinTypes ? T : T extends object ? {
|
371
372
|
[K in keyof T]: WithDeepSlots<T[K], SlotType>;
|
372
373
|
} : T;
|
373
|
-
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps =
|
374
|
+
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
|
374
375
|
components?: Components;
|
375
376
|
root?: RootProps;
|
376
377
|
categories?: CategoryNames;
|
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, {
|
@@ -580,34 +544,39 @@ var walkField = ({
|
|
580
544
|
config,
|
581
545
|
recurseSlots = false
|
582
546
|
}) => {
|
583
|
-
var _a, _b, _c;
|
547
|
+
var _a, _b, _c, _d;
|
584
548
|
const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
|
585
549
|
const map = mappers[fieldType];
|
586
550
|
if (map && fieldType === "slot") {
|
587
551
|
const content = value || [];
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
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 || !el.props) {
|
558
|
+
continue;
|
559
|
+
}
|
560
|
+
const fields2 = (_b = componentConfig.fields) != null ? _b : {};
|
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
|
+
);
|
593
571
|
}
|
594
|
-
|
595
|
-
return walkField({
|
596
|
-
value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
|
597
|
-
fields: fields2,
|
598
|
-
mappers,
|
599
|
-
id: el.props.id,
|
600
|
-
config,
|
601
|
-
recurseSlots
|
602
|
-
});
|
603
|
-
}) : content;
|
572
|
+
}
|
604
573
|
if (containsPromise(mappedContent)) {
|
605
574
|
return Promise.all(mappedContent);
|
606
575
|
}
|
607
576
|
return map({
|
608
577
|
value: mappedContent,
|
609
578
|
parentId: id,
|
610
|
-
propName:
|
579
|
+
propName: propPath,
|
611
580
|
field: fields[propKey],
|
612
581
|
propPath
|
613
582
|
});
|
@@ -622,7 +591,7 @@ var walkField = ({
|
|
622
591
|
}
|
623
592
|
if (value && typeof value === "object") {
|
624
593
|
if (Array.isArray(value)) {
|
625
|
-
const arrayFields = ((
|
594
|
+
const arrayFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "array" ? fields[propKey].arrayFields : null;
|
626
595
|
if (!arrayFields) return value;
|
627
596
|
const newValue = value.map(
|
628
597
|
(el, idx) => walkField({
|
@@ -643,7 +612,7 @@ var walkField = ({
|
|
643
612
|
} else if ("$$typeof" in value) {
|
644
613
|
return value;
|
645
614
|
} else {
|
646
|
-
const objectFields = ((
|
615
|
+
const objectFields = ((_d = fields[propKey]) == null ? void 0 : _d.type) === "object" ? fields[propKey].objectFields : fields;
|
647
616
|
return walkObject({
|
648
617
|
value,
|
649
618
|
fields: objectFields,
|
@@ -1726,7 +1695,7 @@ var flattenData = (state, config) => {
|
|
1726
1695
|
(content) => content,
|
1727
1696
|
(item) => {
|
1728
1697
|
data.push(item);
|
1729
|
-
return
|
1698
|
+
return item;
|
1730
1699
|
}
|
1731
1700
|
);
|
1732
1701
|
return data;
|
@@ -1734,13 +1703,425 @@ var flattenData = (state, config) => {
|
|
1734
1703
|
|
1735
1704
|
// ../core/lib/get-changed.ts
|
1736
1705
|
init_react_import();
|
1737
|
-
|
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
|
1738
2119
|
var getChanged = (newItem, oldItem) => {
|
1739
2120
|
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1740
2121
|
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1741
2122
|
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1742
2123
|
return __spreadProps(__spreadValues({}, acc), {
|
1743
|
-
[item]: !(
|
2124
|
+
[item]: !deepEqual(oldItemProps[item], newItemProps[item])
|
1744
2125
|
});
|
1745
2126
|
}, {}) : {};
|
1746
2127
|
};
|
@@ -1865,7 +2246,6 @@ var createFieldsSlice = (_set, _get) => {
|
|
1865
2246
|
|
1866
2247
|
// ../core/lib/resolve-component-data.ts
|
1867
2248
|
init_react_import();
|
1868
|
-
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
1869
2249
|
var cache = { lastChange: {} };
|
1870
2250
|
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
1871
2251
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
@@ -1874,7 +2254,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1874
2254
|
const id = "id" in item.props ? item.props.id : "root";
|
1875
2255
|
if (shouldRunResolver) {
|
1876
2256
|
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1877
|
-
if (item && (
|
2257
|
+
if (trigger !== "force" && item && deepEqual(item, oldItem)) {
|
1878
2258
|
return { node: resolved, didChange: false };
|
1879
2259
|
}
|
1880
2260
|
const changed = getChanged(item, oldItem);
|
@@ -1924,7 +2304,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1924
2304
|
};
|
1925
2305
|
return {
|
1926
2306
|
node: itemWithResolvedChildren,
|
1927
|
-
didChange: !(
|
2307
|
+
didChange: !deepEqual(item, itemWithResolvedChildren)
|
1928
2308
|
};
|
1929
2309
|
});
|
1930
2310
|
|
package/dist/index.mjs
CHANGED
@@ -91,7 +91,7 @@ var require_classnames = __commonJS({
|
|
91
91
|
init_react_import();
|
92
92
|
(function() {
|
93
93
|
"use strict";
|
94
|
-
var
|
94
|
+
var hasOwn2 = {}.hasOwnProperty;
|
95
95
|
function classNames() {
|
96
96
|
var classes = "";
|
97
97
|
for (var i = 0; i < arguments.length; i++) {
|
@@ -117,7 +117,7 @@ var require_classnames = __commonJS({
|
|
117
117
|
}
|
118
118
|
var classes = "";
|
119
119
|
for (var key in arg) {
|
120
|
-
if (
|
120
|
+
if (hasOwn2.call(arg, key) && arg[key]) {
|
121
121
|
classes = appendClass(classes, key);
|
122
122
|
}
|
123
123
|
}
|
@@ -206,11 +206,11 @@ var require_flat = __commonJS({
|
|
206
206
|
}
|
207
207
|
function isEmpty(val) {
|
208
208
|
const type = Object.prototype.toString.call(val);
|
209
|
-
const
|
209
|
+
const isArray2 = type === "[object Array]";
|
210
210
|
const isObject = type === "[object Object]";
|
211
211
|
if (!val) {
|
212
212
|
return true;
|
213
|
-
} else if (
|
213
|
+
} else if (isArray2) {
|
214
214
|
return !val.length;
|
215
215
|
} else if (isObject) {
|
216
216
|
return !Object.keys(val).length;
|
@@ -260,42 +260,6 @@ var require_flat = __commonJS({
|
|
260
260
|
}
|
261
261
|
});
|
262
262
|
|
263
|
-
// ../../node_modules/fast-deep-equal/index.js
|
264
|
-
var require_fast_deep_equal = __commonJS({
|
265
|
-
"../../node_modules/fast-deep-equal/index.js"(exports, module) {
|
266
|
-
"use strict";
|
267
|
-
init_react_import();
|
268
|
-
module.exports = function equal(a, b) {
|
269
|
-
if (a === b) return true;
|
270
|
-
if (a && b && typeof a == "object" && typeof b == "object") {
|
271
|
-
if (a.constructor !== b.constructor) return false;
|
272
|
-
var length, i, keys;
|
273
|
-
if (Array.isArray(a)) {
|
274
|
-
length = a.length;
|
275
|
-
if (length != b.length) return false;
|
276
|
-
for (i = length; i-- !== 0; )
|
277
|
-
if (!equal(a[i], b[i])) return false;
|
278
|
-
return true;
|
279
|
-
}
|
280
|
-
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
281
|
-
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
282
|
-
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
283
|
-
keys = Object.keys(a);
|
284
|
-
length = keys.length;
|
285
|
-
if (length !== Object.keys(b).length) return false;
|
286
|
-
for (i = length; i-- !== 0; )
|
287
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
288
|
-
for (i = length; i-- !== 0; ) {
|
289
|
-
var key = keys[i];
|
290
|
-
if (!equal(a[key], b[key])) return false;
|
291
|
-
}
|
292
|
-
return true;
|
293
|
-
}
|
294
|
-
return a !== a && b !== b;
|
295
|
-
};
|
296
|
-
}
|
297
|
-
});
|
298
|
-
|
299
263
|
// index.ts
|
300
264
|
init_react_import();
|
301
265
|
|
@@ -568,34 +532,39 @@ var walkField = ({
|
|
568
532
|
config,
|
569
533
|
recurseSlots = false
|
570
534
|
}) => {
|
571
|
-
var _a, _b, _c;
|
535
|
+
var _a, _b, _c, _d;
|
572
536
|
const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
|
573
537
|
const map = mappers[fieldType];
|
574
538
|
if (map && fieldType === "slot") {
|
575
539
|
const content = value || [];
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
540
|
+
let mappedContent = content;
|
541
|
+
if (recurseSlots) {
|
542
|
+
for (let i = 0; i < content.length; i++) {
|
543
|
+
const el = content[i];
|
544
|
+
const componentConfig = config.components[el.type];
|
545
|
+
if (!componentConfig || !el.props) {
|
546
|
+
continue;
|
547
|
+
}
|
548
|
+
const fields2 = (_b = componentConfig.fields) != null ? _b : {};
|
549
|
+
mappedContent.push(
|
550
|
+
walkField({
|
551
|
+
value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
|
552
|
+
fields: fields2,
|
553
|
+
mappers,
|
554
|
+
id: el.props.id,
|
555
|
+
config,
|
556
|
+
recurseSlots
|
557
|
+
})
|
558
|
+
);
|
581
559
|
}
|
582
|
-
|
583
|
-
return walkField({
|
584
|
-
value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
|
585
|
-
fields: fields2,
|
586
|
-
mappers,
|
587
|
-
id: el.props.id,
|
588
|
-
config,
|
589
|
-
recurseSlots
|
590
|
-
});
|
591
|
-
}) : content;
|
560
|
+
}
|
592
561
|
if (containsPromise(mappedContent)) {
|
593
562
|
return Promise.all(mappedContent);
|
594
563
|
}
|
595
564
|
return map({
|
596
565
|
value: mappedContent,
|
597
566
|
parentId: id,
|
598
|
-
propName:
|
567
|
+
propName: propPath,
|
599
568
|
field: fields[propKey],
|
600
569
|
propPath
|
601
570
|
});
|
@@ -610,7 +579,7 @@ var walkField = ({
|
|
610
579
|
}
|
611
580
|
if (value && typeof value === "object") {
|
612
581
|
if (Array.isArray(value)) {
|
613
|
-
const arrayFields = ((
|
582
|
+
const arrayFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "array" ? fields[propKey].arrayFields : null;
|
614
583
|
if (!arrayFields) return value;
|
615
584
|
const newValue = value.map(
|
616
585
|
(el, idx) => walkField({
|
@@ -631,7 +600,7 @@ var walkField = ({
|
|
631
600
|
} else if ("$$typeof" in value) {
|
632
601
|
return value;
|
633
602
|
} else {
|
634
|
-
const objectFields = ((
|
603
|
+
const objectFields = ((_d = fields[propKey]) == null ? void 0 : _d.type) === "object" ? fields[propKey].objectFields : fields;
|
635
604
|
return walkObject({
|
636
605
|
value,
|
637
606
|
fields: objectFields,
|
@@ -1714,7 +1683,7 @@ var flattenData = (state, config) => {
|
|
1714
1683
|
(content) => content,
|
1715
1684
|
(item) => {
|
1716
1685
|
data.push(item);
|
1717
|
-
return
|
1686
|
+
return item;
|
1718
1687
|
}
|
1719
1688
|
);
|
1720
1689
|
return data;
|
@@ -1722,13 +1691,425 @@ var flattenData = (state, config) => {
|
|
1722
1691
|
|
1723
1692
|
// ../core/lib/get-changed.ts
|
1724
1693
|
init_react_import();
|
1725
|
-
|
1694
|
+
|
1695
|
+
// ../../node_modules/fast-equals/dist/esm/index.mjs
|
1696
|
+
init_react_import();
|
1697
|
+
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
1698
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
1699
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
1700
|
+
function combineComparators(comparatorA, comparatorB) {
|
1701
|
+
return function isEqual(a, b, state) {
|
1702
|
+
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
1703
|
+
};
|
1704
|
+
}
|
1705
|
+
function createIsCircular(areItemsEqual) {
|
1706
|
+
return function isCircular(a, b, state) {
|
1707
|
+
if (!a || !b || typeof a !== "object" || typeof b !== "object") {
|
1708
|
+
return areItemsEqual(a, b, state);
|
1709
|
+
}
|
1710
|
+
var cache2 = state.cache;
|
1711
|
+
var cachedA = cache2.get(a);
|
1712
|
+
var cachedB = cache2.get(b);
|
1713
|
+
if (cachedA && cachedB) {
|
1714
|
+
return cachedA === b && cachedB === a;
|
1715
|
+
}
|
1716
|
+
cache2.set(a, b);
|
1717
|
+
cache2.set(b, a);
|
1718
|
+
var result = areItemsEqual(a, b, state);
|
1719
|
+
cache2.delete(a);
|
1720
|
+
cache2.delete(b);
|
1721
|
+
return result;
|
1722
|
+
};
|
1723
|
+
}
|
1724
|
+
function getStrictProperties(object) {
|
1725
|
+
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
1726
|
+
}
|
1727
|
+
var hasOwn = Object.hasOwn || function(object, property) {
|
1728
|
+
return hasOwnProperty.call(object, property);
|
1729
|
+
};
|
1730
|
+
function sameValueZeroEqual(a, b) {
|
1731
|
+
return a === b || !a && !b && a !== a && b !== b;
|
1732
|
+
}
|
1733
|
+
var PREACT_VNODE = "__v";
|
1734
|
+
var PREACT_OWNER = "__o";
|
1735
|
+
var REACT_OWNER = "_owner";
|
1736
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
1737
|
+
var keys = Object.keys;
|
1738
|
+
function areArraysEqual(a, b, state) {
|
1739
|
+
var index = a.length;
|
1740
|
+
if (b.length !== index) {
|
1741
|
+
return false;
|
1742
|
+
}
|
1743
|
+
while (index-- > 0) {
|
1744
|
+
if (!state.equals(a[index], b[index], index, index, a, b, state)) {
|
1745
|
+
return false;
|
1746
|
+
}
|
1747
|
+
}
|
1748
|
+
return true;
|
1749
|
+
}
|
1750
|
+
function areDatesEqual(a, b) {
|
1751
|
+
return sameValueZeroEqual(a.getTime(), b.getTime());
|
1752
|
+
}
|
1753
|
+
function areErrorsEqual(a, b) {
|
1754
|
+
return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
|
1755
|
+
}
|
1756
|
+
function areFunctionsEqual(a, b) {
|
1757
|
+
return a === b;
|
1758
|
+
}
|
1759
|
+
function areMapsEqual(a, b, state) {
|
1760
|
+
var size = a.size;
|
1761
|
+
if (size !== b.size) {
|
1762
|
+
return false;
|
1763
|
+
}
|
1764
|
+
if (!size) {
|
1765
|
+
return true;
|
1766
|
+
}
|
1767
|
+
var matchedIndices = new Array(size);
|
1768
|
+
var aIterable = a.entries();
|
1769
|
+
var aResult;
|
1770
|
+
var bResult;
|
1771
|
+
var index = 0;
|
1772
|
+
while (aResult = aIterable.next()) {
|
1773
|
+
if (aResult.done) {
|
1774
|
+
break;
|
1775
|
+
}
|
1776
|
+
var bIterable = b.entries();
|
1777
|
+
var hasMatch = false;
|
1778
|
+
var matchIndex = 0;
|
1779
|
+
while (bResult = bIterable.next()) {
|
1780
|
+
if (bResult.done) {
|
1781
|
+
break;
|
1782
|
+
}
|
1783
|
+
if (matchedIndices[matchIndex]) {
|
1784
|
+
matchIndex++;
|
1785
|
+
continue;
|
1786
|
+
}
|
1787
|
+
var aEntry = aResult.value;
|
1788
|
+
var bEntry = bResult.value;
|
1789
|
+
if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state) && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
|
1790
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
1791
|
+
break;
|
1792
|
+
}
|
1793
|
+
matchIndex++;
|
1794
|
+
}
|
1795
|
+
if (!hasMatch) {
|
1796
|
+
return false;
|
1797
|
+
}
|
1798
|
+
index++;
|
1799
|
+
}
|
1800
|
+
return true;
|
1801
|
+
}
|
1802
|
+
var areNumbersEqual = sameValueZeroEqual;
|
1803
|
+
function areObjectsEqual(a, b, state) {
|
1804
|
+
var properties = keys(a);
|
1805
|
+
var index = properties.length;
|
1806
|
+
if (keys(b).length !== index) {
|
1807
|
+
return false;
|
1808
|
+
}
|
1809
|
+
while (index-- > 0) {
|
1810
|
+
if (!isPropertyEqual(a, b, state, properties[index])) {
|
1811
|
+
return false;
|
1812
|
+
}
|
1813
|
+
}
|
1814
|
+
return true;
|
1815
|
+
}
|
1816
|
+
function areObjectsEqualStrict(a, b, state) {
|
1817
|
+
var properties = getStrictProperties(a);
|
1818
|
+
var index = properties.length;
|
1819
|
+
if (getStrictProperties(b).length !== index) {
|
1820
|
+
return false;
|
1821
|
+
}
|
1822
|
+
var property;
|
1823
|
+
var descriptorA;
|
1824
|
+
var descriptorB;
|
1825
|
+
while (index-- > 0) {
|
1826
|
+
property = properties[index];
|
1827
|
+
if (!isPropertyEqual(a, b, state, property)) {
|
1828
|
+
return false;
|
1829
|
+
}
|
1830
|
+
descriptorA = getOwnPropertyDescriptor(a, property);
|
1831
|
+
descriptorB = getOwnPropertyDescriptor(b, property);
|
1832
|
+
if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) {
|
1833
|
+
return false;
|
1834
|
+
}
|
1835
|
+
}
|
1836
|
+
return true;
|
1837
|
+
}
|
1838
|
+
function arePrimitiveWrappersEqual(a, b) {
|
1839
|
+
return sameValueZeroEqual(a.valueOf(), b.valueOf());
|
1840
|
+
}
|
1841
|
+
function areRegExpsEqual(a, b) {
|
1842
|
+
return a.source === b.source && a.flags === b.flags;
|
1843
|
+
}
|
1844
|
+
function areSetsEqual(a, b, state) {
|
1845
|
+
var size = a.size;
|
1846
|
+
if (size !== b.size) {
|
1847
|
+
return false;
|
1848
|
+
}
|
1849
|
+
if (!size) {
|
1850
|
+
return true;
|
1851
|
+
}
|
1852
|
+
var matchedIndices = new Array(size);
|
1853
|
+
var aIterable = a.values();
|
1854
|
+
var aResult;
|
1855
|
+
var bResult;
|
1856
|
+
while (aResult = aIterable.next()) {
|
1857
|
+
if (aResult.done) {
|
1858
|
+
break;
|
1859
|
+
}
|
1860
|
+
var bIterable = b.values();
|
1861
|
+
var hasMatch = false;
|
1862
|
+
var matchIndex = 0;
|
1863
|
+
while (bResult = bIterable.next()) {
|
1864
|
+
if (bResult.done) {
|
1865
|
+
break;
|
1866
|
+
}
|
1867
|
+
if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
|
1868
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
1869
|
+
break;
|
1870
|
+
}
|
1871
|
+
matchIndex++;
|
1872
|
+
}
|
1873
|
+
if (!hasMatch) {
|
1874
|
+
return false;
|
1875
|
+
}
|
1876
|
+
}
|
1877
|
+
return true;
|
1878
|
+
}
|
1879
|
+
function areTypedArraysEqual(a, b) {
|
1880
|
+
var index = a.length;
|
1881
|
+
if (b.length !== index) {
|
1882
|
+
return false;
|
1883
|
+
}
|
1884
|
+
while (index-- > 0) {
|
1885
|
+
if (a[index] !== b[index]) {
|
1886
|
+
return false;
|
1887
|
+
}
|
1888
|
+
}
|
1889
|
+
return true;
|
1890
|
+
}
|
1891
|
+
function areUrlsEqual(a, b) {
|
1892
|
+
return a.hostname === b.hostname && a.pathname === b.pathname && a.protocol === b.protocol && a.port === b.port && a.hash === b.hash && a.username === b.username && a.password === b.password;
|
1893
|
+
}
|
1894
|
+
function isPropertyEqual(a, b, state, property) {
|
1895
|
+
if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) {
|
1896
|
+
return true;
|
1897
|
+
}
|
1898
|
+
return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
|
1899
|
+
}
|
1900
|
+
var ARGUMENTS_TAG = "[object Arguments]";
|
1901
|
+
var BOOLEAN_TAG = "[object Boolean]";
|
1902
|
+
var DATE_TAG = "[object Date]";
|
1903
|
+
var ERROR_TAG = "[object Error]";
|
1904
|
+
var MAP_TAG = "[object Map]";
|
1905
|
+
var NUMBER_TAG = "[object Number]";
|
1906
|
+
var OBJECT_TAG = "[object Object]";
|
1907
|
+
var REG_EXP_TAG = "[object RegExp]";
|
1908
|
+
var SET_TAG = "[object Set]";
|
1909
|
+
var STRING_TAG = "[object String]";
|
1910
|
+
var URL_TAG = "[object URL]";
|
1911
|
+
var isArray = Array.isArray;
|
1912
|
+
var isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null;
|
1913
|
+
var assign = Object.assign;
|
1914
|
+
var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
|
1915
|
+
function createEqualityComparator(_a) {
|
1916
|
+
var areArraysEqual2 = _a.areArraysEqual, areDatesEqual2 = _a.areDatesEqual, areErrorsEqual2 = _a.areErrorsEqual, areFunctionsEqual2 = _a.areFunctionsEqual, areMapsEqual2 = _a.areMapsEqual, areNumbersEqual2 = _a.areNumbersEqual, areObjectsEqual2 = _a.areObjectsEqual, arePrimitiveWrappersEqual2 = _a.arePrimitiveWrappersEqual, areRegExpsEqual2 = _a.areRegExpsEqual, areSetsEqual2 = _a.areSetsEqual, areTypedArraysEqual2 = _a.areTypedArraysEqual, areUrlsEqual2 = _a.areUrlsEqual;
|
1917
|
+
return function comparator(a, b, state) {
|
1918
|
+
if (a === b) {
|
1919
|
+
return true;
|
1920
|
+
}
|
1921
|
+
if (a == null || b == null) {
|
1922
|
+
return false;
|
1923
|
+
}
|
1924
|
+
var type = typeof a;
|
1925
|
+
if (type !== typeof b) {
|
1926
|
+
return false;
|
1927
|
+
}
|
1928
|
+
if (type !== "object") {
|
1929
|
+
if (type === "number") {
|
1930
|
+
return areNumbersEqual2(a, b, state);
|
1931
|
+
}
|
1932
|
+
if (type === "function") {
|
1933
|
+
return areFunctionsEqual2(a, b, state);
|
1934
|
+
}
|
1935
|
+
return false;
|
1936
|
+
}
|
1937
|
+
var constructor = a.constructor;
|
1938
|
+
if (constructor !== b.constructor) {
|
1939
|
+
return false;
|
1940
|
+
}
|
1941
|
+
if (constructor === Object) {
|
1942
|
+
return areObjectsEqual2(a, b, state);
|
1943
|
+
}
|
1944
|
+
if (isArray(a)) {
|
1945
|
+
return areArraysEqual2(a, b, state);
|
1946
|
+
}
|
1947
|
+
if (isTypedArray != null && isTypedArray(a)) {
|
1948
|
+
return areTypedArraysEqual2(a, b, state);
|
1949
|
+
}
|
1950
|
+
if (constructor === Date) {
|
1951
|
+
return areDatesEqual2(a, b, state);
|
1952
|
+
}
|
1953
|
+
if (constructor === RegExp) {
|
1954
|
+
return areRegExpsEqual2(a, b, state);
|
1955
|
+
}
|
1956
|
+
if (constructor === Map) {
|
1957
|
+
return areMapsEqual2(a, b, state);
|
1958
|
+
}
|
1959
|
+
if (constructor === Set) {
|
1960
|
+
return areSetsEqual2(a, b, state);
|
1961
|
+
}
|
1962
|
+
var tag = getTag(a);
|
1963
|
+
if (tag === DATE_TAG) {
|
1964
|
+
return areDatesEqual2(a, b, state);
|
1965
|
+
}
|
1966
|
+
if (tag === REG_EXP_TAG) {
|
1967
|
+
return areRegExpsEqual2(a, b, state);
|
1968
|
+
}
|
1969
|
+
if (tag === MAP_TAG) {
|
1970
|
+
return areMapsEqual2(a, b, state);
|
1971
|
+
}
|
1972
|
+
if (tag === SET_TAG) {
|
1973
|
+
return areSetsEqual2(a, b, state);
|
1974
|
+
}
|
1975
|
+
if (tag === OBJECT_TAG) {
|
1976
|
+
return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state);
|
1977
|
+
}
|
1978
|
+
if (tag === URL_TAG) {
|
1979
|
+
return areUrlsEqual2(a, b, state);
|
1980
|
+
}
|
1981
|
+
if (tag === ERROR_TAG) {
|
1982
|
+
return areErrorsEqual2(a, b, state);
|
1983
|
+
}
|
1984
|
+
if (tag === ARGUMENTS_TAG) {
|
1985
|
+
return areObjectsEqual2(a, b, state);
|
1986
|
+
}
|
1987
|
+
if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
|
1988
|
+
return arePrimitiveWrappersEqual2(a, b, state);
|
1989
|
+
}
|
1990
|
+
return false;
|
1991
|
+
};
|
1992
|
+
}
|
1993
|
+
function createEqualityComparatorConfig(_a) {
|
1994
|
+
var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
|
1995
|
+
var config = {
|
1996
|
+
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
1997
|
+
areDatesEqual,
|
1998
|
+
areErrorsEqual,
|
1999
|
+
areFunctionsEqual,
|
2000
|
+
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
2001
|
+
areNumbersEqual,
|
2002
|
+
areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
|
2003
|
+
arePrimitiveWrappersEqual,
|
2004
|
+
areRegExpsEqual,
|
2005
|
+
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
2006
|
+
areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
|
2007
|
+
areUrlsEqual
|
2008
|
+
};
|
2009
|
+
if (createCustomConfig) {
|
2010
|
+
config = assign({}, config, createCustomConfig(config));
|
2011
|
+
}
|
2012
|
+
if (circular) {
|
2013
|
+
var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
|
2014
|
+
var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
|
2015
|
+
var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
|
2016
|
+
var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
|
2017
|
+
config = assign({}, config, {
|
2018
|
+
areArraysEqual: areArraysEqual$1,
|
2019
|
+
areMapsEqual: areMapsEqual$1,
|
2020
|
+
areObjectsEqual: areObjectsEqual$1,
|
2021
|
+
areSetsEqual: areSetsEqual$1
|
2022
|
+
});
|
2023
|
+
}
|
2024
|
+
return config;
|
2025
|
+
}
|
2026
|
+
function createInternalEqualityComparator(compare) {
|
2027
|
+
return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
|
2028
|
+
return compare(a, b, state);
|
2029
|
+
};
|
2030
|
+
}
|
2031
|
+
function createIsEqual(_a) {
|
2032
|
+
var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
|
2033
|
+
if (createState) {
|
2034
|
+
return function isEqual(a, b) {
|
2035
|
+
var _a2 = createState(), _b = _a2.cache, cache2 = _b === void 0 ? circular ? /* @__PURE__ */ new WeakMap() : void 0 : _b, meta = _a2.meta;
|
2036
|
+
return comparator(a, b, {
|
2037
|
+
cache: cache2,
|
2038
|
+
equals,
|
2039
|
+
meta,
|
2040
|
+
strict
|
2041
|
+
});
|
2042
|
+
};
|
2043
|
+
}
|
2044
|
+
if (circular) {
|
2045
|
+
return function isEqual(a, b) {
|
2046
|
+
return comparator(a, b, {
|
2047
|
+
cache: /* @__PURE__ */ new WeakMap(),
|
2048
|
+
equals,
|
2049
|
+
meta: void 0,
|
2050
|
+
strict
|
2051
|
+
});
|
2052
|
+
};
|
2053
|
+
}
|
2054
|
+
var state = {
|
2055
|
+
cache: void 0,
|
2056
|
+
equals,
|
2057
|
+
meta: void 0,
|
2058
|
+
strict
|
2059
|
+
};
|
2060
|
+
return function isEqual(a, b) {
|
2061
|
+
return comparator(a, b, state);
|
2062
|
+
};
|
2063
|
+
}
|
2064
|
+
var deepEqual = createCustomEqual();
|
2065
|
+
var strictDeepEqual = createCustomEqual({ strict: true });
|
2066
|
+
var circularDeepEqual = createCustomEqual({ circular: true });
|
2067
|
+
var strictCircularDeepEqual = createCustomEqual({
|
2068
|
+
circular: true,
|
2069
|
+
strict: true
|
2070
|
+
});
|
2071
|
+
var shallowEqual = createCustomEqual({
|
2072
|
+
createInternalComparator: function() {
|
2073
|
+
return sameValueZeroEqual;
|
2074
|
+
}
|
2075
|
+
});
|
2076
|
+
var strictShallowEqual = createCustomEqual({
|
2077
|
+
strict: true,
|
2078
|
+
createInternalComparator: function() {
|
2079
|
+
return sameValueZeroEqual;
|
2080
|
+
}
|
2081
|
+
});
|
2082
|
+
var circularShallowEqual = createCustomEqual({
|
2083
|
+
circular: true,
|
2084
|
+
createInternalComparator: function() {
|
2085
|
+
return sameValueZeroEqual;
|
2086
|
+
}
|
2087
|
+
});
|
2088
|
+
var strictCircularShallowEqual = createCustomEqual({
|
2089
|
+
circular: true,
|
2090
|
+
createInternalComparator: function() {
|
2091
|
+
return sameValueZeroEqual;
|
2092
|
+
},
|
2093
|
+
strict: true
|
2094
|
+
});
|
2095
|
+
function createCustomEqual(options) {
|
2096
|
+
if (options === void 0) {
|
2097
|
+
options = {};
|
2098
|
+
}
|
2099
|
+
var _a = options.circular, circular = _a === void 0 ? false : _a, createCustomInternalComparator = options.createInternalComparator, createState = options.createState, _b = options.strict, strict = _b === void 0 ? false : _b;
|
2100
|
+
var config = createEqualityComparatorConfig(options);
|
2101
|
+
var comparator = createEqualityComparator(config);
|
2102
|
+
var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
|
2103
|
+
return createIsEqual({ circular, comparator, createState, equals, strict });
|
2104
|
+
}
|
2105
|
+
|
2106
|
+
// ../core/lib/get-changed.ts
|
1726
2107
|
var getChanged = (newItem, oldItem) => {
|
1727
2108
|
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1728
2109
|
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1729
2110
|
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1730
2111
|
return __spreadProps(__spreadValues({}, acc), {
|
1731
|
-
[item]: !(
|
2112
|
+
[item]: !deepEqual(oldItemProps[item], newItemProps[item])
|
1732
2113
|
});
|
1733
2114
|
}, {}) : {};
|
1734
2115
|
};
|
@@ -1853,7 +2234,6 @@ var createFieldsSlice = (_set, _get) => {
|
|
1853
2234
|
|
1854
2235
|
// ../core/lib/resolve-component-data.ts
|
1855
2236
|
init_react_import();
|
1856
|
-
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
1857
2237
|
var cache = { lastChange: {} };
|
1858
2238
|
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
1859
2239
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
@@ -1862,7 +2242,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1862
2242
|
const id = "id" in item.props ? item.props.id : "root";
|
1863
2243
|
if (shouldRunResolver) {
|
1864
2244
|
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1865
|
-
if (item && (
|
2245
|
+
if (trigger !== "force" && item && deepEqual(item, oldItem)) {
|
1866
2246
|
return { node: resolved, didChange: false };
|
1867
2247
|
}
|
1868
2248
|
const changed = getChanged(item, oldItem);
|
@@ -1912,7 +2292,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1912
2292
|
};
|
1913
2293
|
return {
|
1914
2294
|
node: itemWithResolvedChildren,
|
1915
|
-
didChange: !(
|
2295
|
+
didChange: !deepEqual(item, itemWithResolvedChildren)
|
1916
2296
|
};
|
1917
2297
|
});
|
1918
2298
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck-plugin-heading-analyzer",
|
3
|
-
"version": "0.21.0-canary.
|
3
|
+
"version": "0.21.0-canary.8db6528d",
|
4
4
|
"author": "Chris Villa <chris@puckeditor.com>",
|
5
5
|
"repository": "measuredco/puck",
|
6
6
|
"bugs": "https://github.com/measuredco/puck/issues",
|
@@ -25,7 +25,7 @@
|
|
25
25
|
"dist"
|
26
26
|
],
|
27
27
|
"devDependencies": {
|
28
|
-
"@measured/puck": "^0.21.0-canary.
|
28
|
+
"@measured/puck": "^0.21.0-canary.8db6528d",
|
29
29
|
"@types/react": "^19.0.1",
|
30
30
|
"@types/react-dom": "^19.0.2",
|
31
31
|
"eslint": "^7.32.0",
|