@puckeditor/plugin-heading-analyzer 0.22.1-canary.5f5b18aa → 0.22.1-canary.d8d77eb5
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.js +24 -10
- package/dist/index.mjs +24 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -544,7 +544,7 @@ var walkField = ({
|
|
|
544
544
|
config,
|
|
545
545
|
recurseSlots = false
|
|
546
546
|
}) => {
|
|
547
|
-
var _a, _b, _c;
|
|
547
|
+
var _a, _b, _c, _d;
|
|
548
548
|
const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
|
|
549
549
|
const map = mappers[fieldType];
|
|
550
550
|
if (map && fieldType === "slot") {
|
|
@@ -605,7 +605,9 @@ var walkField = ({
|
|
|
605
605
|
id,
|
|
606
606
|
getPropPath: (k) => `${propPath}.${k}`,
|
|
607
607
|
config,
|
|
608
|
-
recurseSlots
|
|
608
|
+
recurseSlots,
|
|
609
|
+
// Only default missing fields when objectFields describe this value
|
|
610
|
+
ownedFields: ((_d = fields[propKey]) == null ? void 0 : _d.type) === "object"
|
|
609
611
|
});
|
|
610
612
|
}
|
|
611
613
|
}
|
|
@@ -618,11 +620,21 @@ var walkObject = ({
|
|
|
618
620
|
id,
|
|
619
621
|
getPropPath,
|
|
620
622
|
config,
|
|
621
|
-
recurseSlots
|
|
623
|
+
recurseSlots,
|
|
624
|
+
ownedFields
|
|
622
625
|
}) => {
|
|
623
|
-
const
|
|
626
|
+
const keys2 = Object.keys(value);
|
|
627
|
+
if (ownedFields) {
|
|
628
|
+
for (const fieldName in fields) {
|
|
629
|
+
const fieldType = fields[fieldName].type;
|
|
630
|
+
if (fieldType !== "slot" && mappers[fieldType] && !(fieldName in value)) {
|
|
631
|
+
keys2.push(fieldName);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
const newProps = keys2.map((k) => {
|
|
624
636
|
const opts = {
|
|
625
|
-
value:
|
|
637
|
+
value: value[k],
|
|
626
638
|
fields,
|
|
627
639
|
mappers,
|
|
628
640
|
propKey: k,
|
|
@@ -657,7 +669,8 @@ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlo
|
|
|
657
669
|
id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
|
|
658
670
|
getPropPath: (k) => k,
|
|
659
671
|
config,
|
|
660
|
-
recurseSlots
|
|
672
|
+
recurseSlots,
|
|
673
|
+
ownedFields: true
|
|
661
674
|
});
|
|
662
675
|
if (isPromise(newProps)) {
|
|
663
676
|
return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
|
|
@@ -2258,7 +2271,7 @@ var createFieldsSlice = (_set, _get) => {
|
|
|
2258
2271
|
// ../core/lib/resolve-component-data.ts
|
|
2259
2272
|
init_react_import();
|
|
2260
2273
|
var cache = { lastChange: {} };
|
|
2261
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }) {
|
|
2274
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }, cacheStore = cache) {
|
|
2262
2275
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
2263
2276
|
const resolvedItem = __spreadValues({}, item);
|
|
2264
2277
|
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
@@ -2268,7 +2281,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2268
2281
|
item: oldItem = null,
|
|
2269
2282
|
resolved = {},
|
|
2270
2283
|
parentId: oldParentId = null
|
|
2271
|
-
} =
|
|
2284
|
+
} = cacheStore.lastChange[id] || {};
|
|
2272
2285
|
const isRootOrInserted = oldParentId === null;
|
|
2273
2286
|
const parentChanged = !isRootOrInserted && (parent == null ? void 0 : parent.props.id) !== oldParentId;
|
|
2274
2287
|
const dataChanged = item && !deepEqual(item, oldItem);
|
|
@@ -2310,7 +2323,8 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2310
2323
|
onResolveEnd,
|
|
2311
2324
|
trigger,
|
|
2312
2325
|
itemAsComponentData,
|
|
2313
|
-
root
|
|
2326
|
+
root,
|
|
2327
|
+
cacheStore
|
|
2314
2328
|
)).node;
|
|
2315
2329
|
})
|
|
2316
2330
|
)
|
|
@@ -2322,7 +2336,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2322
2336
|
if (shouldRunResolver && onResolveEnd) {
|
|
2323
2337
|
onResolveEnd(resolvedItem);
|
|
2324
2338
|
}
|
|
2325
|
-
|
|
2339
|
+
cacheStore.lastChange[id] = {
|
|
2326
2340
|
item,
|
|
2327
2341
|
resolved: itemWithResolvedChildren,
|
|
2328
2342
|
parentId: parent == null ? void 0 : parent.props.id
|
package/dist/index.mjs
CHANGED
|
@@ -532,7 +532,7 @@ var walkField = ({
|
|
|
532
532
|
config,
|
|
533
533
|
recurseSlots = false
|
|
534
534
|
}) => {
|
|
535
|
-
var _a, _b, _c;
|
|
535
|
+
var _a, _b, _c, _d;
|
|
536
536
|
const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
|
|
537
537
|
const map = mappers[fieldType];
|
|
538
538
|
if (map && fieldType === "slot") {
|
|
@@ -593,7 +593,9 @@ var walkField = ({
|
|
|
593
593
|
id,
|
|
594
594
|
getPropPath: (k) => `${propPath}.${k}`,
|
|
595
595
|
config,
|
|
596
|
-
recurseSlots
|
|
596
|
+
recurseSlots,
|
|
597
|
+
// Only default missing fields when objectFields describe this value
|
|
598
|
+
ownedFields: ((_d = fields[propKey]) == null ? void 0 : _d.type) === "object"
|
|
597
599
|
});
|
|
598
600
|
}
|
|
599
601
|
}
|
|
@@ -606,11 +608,21 @@ var walkObject = ({
|
|
|
606
608
|
id,
|
|
607
609
|
getPropPath,
|
|
608
610
|
config,
|
|
609
|
-
recurseSlots
|
|
611
|
+
recurseSlots,
|
|
612
|
+
ownedFields
|
|
610
613
|
}) => {
|
|
611
|
-
const
|
|
614
|
+
const keys2 = Object.keys(value);
|
|
615
|
+
if (ownedFields) {
|
|
616
|
+
for (const fieldName in fields) {
|
|
617
|
+
const fieldType = fields[fieldName].type;
|
|
618
|
+
if (fieldType !== "slot" && mappers[fieldType] && !(fieldName in value)) {
|
|
619
|
+
keys2.push(fieldName);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
const newProps = keys2.map((k) => {
|
|
612
624
|
const opts = {
|
|
613
|
-
value:
|
|
625
|
+
value: value[k],
|
|
614
626
|
fields,
|
|
615
627
|
mappers,
|
|
616
628
|
propKey: k,
|
|
@@ -645,7 +657,8 @@ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlo
|
|
|
645
657
|
id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
|
|
646
658
|
getPropPath: (k) => k,
|
|
647
659
|
config,
|
|
648
|
-
recurseSlots
|
|
660
|
+
recurseSlots,
|
|
661
|
+
ownedFields: true
|
|
649
662
|
});
|
|
650
663
|
if (isPromise(newProps)) {
|
|
651
664
|
return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
|
|
@@ -2246,7 +2259,7 @@ var createFieldsSlice = (_set, _get) => {
|
|
|
2246
2259
|
// ../core/lib/resolve-component-data.ts
|
|
2247
2260
|
init_react_import();
|
|
2248
2261
|
var cache = { lastChange: {} };
|
|
2249
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }) {
|
|
2262
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }, cacheStore = cache) {
|
|
2250
2263
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
2251
2264
|
const resolvedItem = __spreadValues({}, item);
|
|
2252
2265
|
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
@@ -2256,7 +2269,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2256
2269
|
item: oldItem = null,
|
|
2257
2270
|
resolved = {},
|
|
2258
2271
|
parentId: oldParentId = null
|
|
2259
|
-
} =
|
|
2272
|
+
} = cacheStore.lastChange[id] || {};
|
|
2260
2273
|
const isRootOrInserted = oldParentId === null;
|
|
2261
2274
|
const parentChanged = !isRootOrInserted && (parent == null ? void 0 : parent.props.id) !== oldParentId;
|
|
2262
2275
|
const dataChanged = item && !deepEqual(item, oldItem);
|
|
@@ -2298,7 +2311,8 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2298
2311
|
onResolveEnd,
|
|
2299
2312
|
trigger,
|
|
2300
2313
|
itemAsComponentData,
|
|
2301
|
-
root
|
|
2314
|
+
root,
|
|
2315
|
+
cacheStore
|
|
2302
2316
|
)).node;
|
|
2303
2317
|
})
|
|
2304
2318
|
)
|
|
@@ -2310,7 +2324,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
2310
2324
|
if (shouldRunResolver && onResolveEnd) {
|
|
2311
2325
|
onResolveEnd(resolvedItem);
|
|
2312
2326
|
}
|
|
2313
|
-
|
|
2327
|
+
cacheStore.lastChange[id] = {
|
|
2314
2328
|
item,
|
|
2315
2329
|
resolved: itemWithResolvedChildren,
|
|
2316
2330
|
parentId: parent == null ? void 0 : parent.props.id
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puckeditor/plugin-heading-analyzer",
|
|
3
|
-
"version": "0.22.1-canary.
|
|
3
|
+
"version": "0.22.1-canary.d8d77eb5",
|
|
4
4
|
"author": "Chris Villa <chris@puckeditor.com>",
|
|
5
5
|
"repository": "puckeditor/puck",
|
|
6
6
|
"bugs": "https://github.com/puckeditor/puck/issues",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@puckeditor/core": "^0.22.1-canary.
|
|
28
|
+
"@puckeditor/core": "^0.22.1-canary.d8d77eb5",
|
|
29
29
|
"@types/minimatch": "3.0.5",
|
|
30
30
|
"@types/react": "^19.0.1",
|
|
31
31
|
"@types/react-dom": "^19.0.2",
|