sveld 0.24.9 → 0.25.0
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/lib/ComponentParser.js
CHANGED
|
@@ -193,6 +193,7 @@ class ComponentParser {
|
|
|
193
193
|
let currentTypedefName;
|
|
194
194
|
let currentTypedefType;
|
|
195
195
|
let currentTypedefDescription;
|
|
196
|
+
let commentDescriptionUsed = false;
|
|
196
197
|
const typedefProperties = [];
|
|
197
198
|
const finalizeEvent = () => {
|
|
198
199
|
if (currentEventName !== undefined) {
|
|
@@ -309,10 +310,18 @@ class ComponentParser {
|
|
|
309
310
|
// Start tracking new typedef
|
|
310
311
|
currentTypedefName = name;
|
|
311
312
|
currentTypedefType = type;
|
|
312
|
-
// Use inline description if present, otherwise use comment description
|
|
313
|
+
// Use inline description if present, otherwise use comment description only if not already used
|
|
313
314
|
const trimmedCommentDesc = commentDescription?.trim();
|
|
314
|
-
|
|
315
|
-
|
|
315
|
+
if (description) {
|
|
316
|
+
currentTypedefDescription = description;
|
|
317
|
+
}
|
|
318
|
+
else if (!commentDescriptionUsed && trimmedCommentDesc && trimmedCommentDesc !== "}") {
|
|
319
|
+
currentTypedefDescription = trimmedCommentDesc;
|
|
320
|
+
commentDescriptionUsed = true;
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
currentTypedefDescription = undefined;
|
|
324
|
+
}
|
|
316
325
|
break;
|
|
317
326
|
}
|
|
318
327
|
case "generics":
|
|
@@ -26,7 +26,14 @@ function formatTsProps(props) {
|
|
|
26
26
|
function getTypeDefs(def) {
|
|
27
27
|
if (def.typedefs.length === 0)
|
|
28
28
|
return EMPTY_STR;
|
|
29
|
-
return def.typedefs
|
|
29
|
+
return def.typedefs
|
|
30
|
+
.map((typedef) => {
|
|
31
|
+
const typedefComment = typedef.description
|
|
32
|
+
? `/**\n * ${typedef.description.replace(NEWLINE_TO_COMMENT_REGEX, "\n * ")}\n */\n`
|
|
33
|
+
: "";
|
|
34
|
+
return `${typedefComment}export ${typedef.ts}`;
|
|
35
|
+
})
|
|
36
|
+
.join("\n\n");
|
|
30
37
|
}
|
|
31
38
|
function getContextDefs(def) {
|
|
32
39
|
if (!def.contexts || def.contexts.length === 0)
|