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