@optique/core 0.7.15 → 0.7.16-dev.389
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/constructs.cjs +9 -2
- package/dist/constructs.js +9 -2
- package/package.json +1 -1
package/dist/constructs.cjs
CHANGED
|
@@ -1112,10 +1112,17 @@ function group(label, parser) {
|
|
|
1112
1112
|
for (const fragment of fragments) if (fragment.type === "entry") allEntries.push(fragment);
|
|
1113
1113
|
else if (fragment.type === "section") if (fragment.title) titledSections.push(fragment);
|
|
1114
1114
|
else allEntries.push(...fragment.entries);
|
|
1115
|
-
const
|
|
1115
|
+
const initialFragments = parser.getDocFragments({
|
|
1116
|
+
kind: "available",
|
|
1117
|
+
state: parser.initialState
|
|
1118
|
+
}, void 0);
|
|
1119
|
+
const initialHasCommands = initialFragments.fragments.some((f) => f.type === "entry" && f.term.type === "command" || f.type === "section" && f.entries.some((e) => e.term.type === "command"));
|
|
1120
|
+
const currentHasCommands = allEntries.some((e) => e.term.type === "command");
|
|
1121
|
+
const applyLabel = !initialHasCommands || currentHasCommands;
|
|
1122
|
+
const labeledSection = applyLabel ? {
|
|
1116
1123
|
title: label,
|
|
1117
1124
|
entries: allEntries
|
|
1118
|
-
};
|
|
1125
|
+
} : { entries: allEntries };
|
|
1119
1126
|
return {
|
|
1120
1127
|
description,
|
|
1121
1128
|
fragments: [...titledSections.map((s) => ({
|
package/dist/constructs.js
CHANGED
|
@@ -1112,10 +1112,17 @@ function group(label, parser) {
|
|
|
1112
1112
|
for (const fragment of fragments) if (fragment.type === "entry") allEntries.push(fragment);
|
|
1113
1113
|
else if (fragment.type === "section") if (fragment.title) titledSections.push(fragment);
|
|
1114
1114
|
else allEntries.push(...fragment.entries);
|
|
1115
|
-
const
|
|
1115
|
+
const initialFragments = parser.getDocFragments({
|
|
1116
|
+
kind: "available",
|
|
1117
|
+
state: parser.initialState
|
|
1118
|
+
}, void 0);
|
|
1119
|
+
const initialHasCommands = initialFragments.fragments.some((f) => f.type === "entry" && f.term.type === "command" || f.type === "section" && f.entries.some((e) => e.term.type === "command"));
|
|
1120
|
+
const currentHasCommands = allEntries.some((e) => e.term.type === "command");
|
|
1121
|
+
const applyLabel = !initialHasCommands || currentHasCommands;
|
|
1122
|
+
const labeledSection = applyLabel ? {
|
|
1116
1123
|
title: label,
|
|
1117
1124
|
entries: allEntries
|
|
1118
|
-
};
|
|
1125
|
+
} : { entries: allEntries };
|
|
1119
1126
|
return {
|
|
1120
1127
|
description,
|
|
1121
1128
|
fragments: [...titledSections.map((s) => ({
|