@puckeditor/plugin-heading-analyzer 0.21.0-canary.08cd0aca → 0.21.0-canary.de0baf39
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 +13 -12
- package/dist/index.mjs +13 -12
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -691,27 +691,28 @@ var stripSlots = (data, config) => {
|
|
|
691
691
|
|
|
692
692
|
// ../core/lib/data/flatten-node.ts
|
|
693
693
|
var { flatten: flatten2, unflatten } = import_flat.default;
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
694
|
+
function isEmptyArrayOrObject(val) {
|
|
695
|
+
if (Array.isArray(val)) {
|
|
696
|
+
return val.length === 0;
|
|
697
|
+
}
|
|
698
|
+
if (val != null && Object.prototype.toString.call(val) === "[object Object]") {
|
|
699
|
+
return Object.keys(val).length === 0;
|
|
700
|
+
}
|
|
701
|
+
return false;
|
|
702
|
+
}
|
|
703
|
+
function stripEmptyObjects(props) {
|
|
698
704
|
const result = {};
|
|
699
705
|
for (const key in props) {
|
|
700
706
|
if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
|
|
701
707
|
const val = props[key];
|
|
702
|
-
if (
|
|
703
|
-
|
|
704
|
-
} else if (isPureObject(val) && Object.keys(val).length === 0) {
|
|
705
|
-
result[key] = emptyObjectStr;
|
|
706
|
-
} else {
|
|
707
|
-
result[key] = val;
|
|
708
|
-
}
|
|
708
|
+
if (isEmptyArrayOrObject(val)) continue;
|
|
709
|
+
result[key] = val;
|
|
709
710
|
}
|
|
710
711
|
return result;
|
|
711
712
|
}
|
|
712
713
|
var flattenNode = (node, config) => {
|
|
713
714
|
return __spreadProps(__spreadValues({}, node), {
|
|
714
|
-
props:
|
|
715
|
+
props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
|
|
715
716
|
});
|
|
716
717
|
};
|
|
717
718
|
|
package/dist/index.mjs
CHANGED
|
@@ -679,27 +679,28 @@ var stripSlots = (data, config) => {
|
|
|
679
679
|
|
|
680
680
|
// ../core/lib/data/flatten-node.ts
|
|
681
681
|
var { flatten: flatten2, unflatten } = import_flat.default;
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
682
|
+
function isEmptyArrayOrObject(val) {
|
|
683
|
+
if (Array.isArray(val)) {
|
|
684
|
+
return val.length === 0;
|
|
685
|
+
}
|
|
686
|
+
if (val != null && Object.prototype.toString.call(val) === "[object Object]") {
|
|
687
|
+
return Object.keys(val).length === 0;
|
|
688
|
+
}
|
|
689
|
+
return false;
|
|
690
|
+
}
|
|
691
|
+
function stripEmptyObjects(props) {
|
|
686
692
|
const result = {};
|
|
687
693
|
for (const key in props) {
|
|
688
694
|
if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
|
|
689
695
|
const val = props[key];
|
|
690
|
-
if (
|
|
691
|
-
|
|
692
|
-
} else if (isPureObject(val) && Object.keys(val).length === 0) {
|
|
693
|
-
result[key] = emptyObjectStr;
|
|
694
|
-
} else {
|
|
695
|
-
result[key] = val;
|
|
696
|
-
}
|
|
696
|
+
if (isEmptyArrayOrObject(val)) continue;
|
|
697
|
+
result[key] = val;
|
|
697
698
|
}
|
|
698
699
|
return result;
|
|
699
700
|
}
|
|
700
701
|
var flattenNode = (node, config) => {
|
|
701
702
|
return __spreadProps(__spreadValues({}, node), {
|
|
702
|
-
props:
|
|
703
|
+
props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
|
|
703
704
|
});
|
|
704
705
|
};
|
|
705
706
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puckeditor/plugin-heading-analyzer",
|
|
3
|
-
"version": "0.21.0-canary.
|
|
3
|
+
"version": "0.21.0-canary.de0baf39",
|
|
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.21.0-canary.
|
|
28
|
+
"@puckeditor/core": "^0.21.0-canary.de0baf39",
|
|
29
29
|
"@types/minimatch": "3.0.5",
|
|
30
30
|
"@types/react": "^19.0.1",
|
|
31
31
|
"@types/react-dom": "^19.0.2",
|