ardo 3.1.0 → 3.2.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.
Files changed (120) hide show
  1. package/README.md +9 -19
  2. package/dist/DocPage-BVibJR9O.js +997 -0
  3. package/dist/DocPage-BVibJR9O.js.map +1 -0
  4. package/dist/assets/src/ui/Breadcrumb.css.ts.vanilla-Dpgq-C_p.css +20 -0
  5. package/dist/assets/src/ui/DocPage.css.ts.vanilla-CXKuz4U-.css +34 -0
  6. package/dist/assets/src/ui/Footer.css.ts.vanilla-BSzPIPt4.css +100 -0
  7. package/dist/assets/src/ui/Header.css.ts.vanilla-8QL0Jzgk.css +156 -0
  8. package/dist/assets/src/ui/Layout.css.ts.vanilla-Bpx_-gJt.css +67 -0
  9. package/dist/assets/src/ui/Nav.css.ts.vanilla-CsAQjogy.css +51 -0
  10. package/dist/assets/src/ui/Sidebar.css.ts.vanilla-D70qXTEr.css +115 -0
  11. package/dist/assets/src/ui/TOC.css.ts.vanilla-435FKDcl.css +52 -0
  12. package/dist/assets/src/ui/components/ApiItem.css.ts.vanilla-B_DW-1iJ.css +218 -0
  13. package/dist/assets/src/ui/components/CodeBlock.css.ts.vanilla-lNKqskjQ.css +182 -0
  14. package/dist/assets/src/ui/components/Container.css.ts.vanilla-CUhRUA9t.css +80 -0
  15. package/dist/assets/src/ui/components/CopyButton.css.ts.vanilla-DZZ5jgTM.css +24 -0
  16. package/dist/assets/src/ui/components/Features.css.ts.vanilla-D-pNXM9Q.css +129 -0
  17. package/dist/assets/src/ui/components/Hero.css.ts.vanilla-DHJVZ6GX.css +134 -0
  18. package/dist/assets/src/ui/components/Search.css.ts.vanilla-BYpWHzky.css +135 -0
  19. package/dist/assets/src/ui/components/Steps.css.ts.vanilla-CisaxeNj.css +59 -0
  20. package/dist/assets/src/ui/components/Tabs.css.ts.vanilla-C4-vJSnf.css +30 -0
  21. package/dist/assets/src/ui/components/ThemeToggle.css.ts.vanilla---sSUELC.css +22 -0
  22. package/dist/assets/src/ui/content.css.ts.vanilla-O_RaSPXm.css +106 -0
  23. package/dist/assets/src/ui/theme/animations.css.ts.vanilla-D6ImVUKy.css +10 -0
  24. package/dist/assets/src/ui/theme/dark.css.ts.vanilla-2iJgcpbU.css +87 -0
  25. package/dist/assets/src/ui/theme/light.css.ts.vanilla-CwinfWSf.css +87 -0
  26. package/dist/assets/src/ui/theme/reset.css.ts.vanilla-0Q3pLjfC.css +34 -0
  27. package/dist/config/index.d.ts +5 -5
  28. package/dist/config/index.d.ts.map +1 -0
  29. package/dist/config/index.js +54 -11
  30. package/dist/config/index.js.map +1 -1
  31. package/dist/contract.css-QS0y3-CM.d.ts +105 -0
  32. package/dist/contract.css-QS0y3-CM.d.ts.map +1 -0
  33. package/dist/generator-DcUomVnD.js +1193 -0
  34. package/dist/generator-DcUomVnD.js.map +1 -0
  35. package/dist/icons/index.d.ts +1 -1
  36. package/dist/icons/index.js +1 -2
  37. package/dist/index-DNKCjxv5.d.ts +78 -0
  38. package/dist/index-DNKCjxv5.d.ts.map +1 -0
  39. package/dist/index-DSeJoaxz.d.ts +938 -0
  40. package/dist/index-DSeJoaxz.d.ts.map +1 -0
  41. package/dist/index.d.ts +5 -8
  42. package/dist/index.js +6 -100
  43. package/dist/mdx/provider.d.ts +61 -4
  44. package/dist/mdx/provider.d.ts.map +1 -0
  45. package/dist/mdx/provider.js +89 -117
  46. package/dist/mdx/provider.js.map +1 -1
  47. package/dist/runtime/index.d.ts +2 -41
  48. package/dist/runtime/index.js +2 -28
  49. package/dist/sidebar-utils-1Skqle1Q.js +109 -0
  50. package/dist/sidebar-utils-1Skqle1Q.js.map +1 -0
  51. package/dist/theme/index.d.ts +201 -182
  52. package/dist/theme/index.d.ts.map +1 -0
  53. package/dist/theme/index.js +288 -128
  54. package/dist/theme/index.js.map +1 -1
  55. package/dist/typedoc/components/index.d.ts +55 -0
  56. package/dist/typedoc/components/index.d.ts.map +1 -0
  57. package/dist/typedoc/components/index.js +328 -0
  58. package/dist/typedoc/components/index.js.map +1 -0
  59. package/dist/typedoc/index.d.ts +34 -303
  60. package/dist/typedoc/index.d.ts.map +1 -0
  61. package/dist/typedoc/index.js +97 -268
  62. package/dist/typedoc/index.js.map +1 -1
  63. package/dist/types-DAZHcySL.d.ts +182 -0
  64. package/dist/types-DAZHcySL.d.ts.map +1 -0
  65. package/dist/types-DVodb4lK.d.ts +198 -0
  66. package/dist/types-DVodb4lK.d.ts.map +1 -0
  67. package/dist/ui/index.d.ts +2 -178
  68. package/dist/ui/index.js +3 -95
  69. package/dist/ui/styles.css +1401 -1335
  70. package/dist/ui/styles.d.ts +1 -2
  71. package/dist/ui/styles.js +23 -4
  72. package/dist/ui-NhRDIFUN.js +1301 -0
  73. package/dist/ui-NhRDIFUN.js.map +1 -0
  74. package/dist/vite/index.d.ts +72 -78
  75. package/dist/vite/index.d.ts.map +1 -0
  76. package/dist/vite/index.js +2918 -1282
  77. package/dist/vite/index.js.map +1 -1
  78. package/package.json +25 -17
  79. package/dist/Features-D_Pt7zpA.d.ts +0 -615
  80. package/dist/Search-DOJMNI2T.css +0 -193
  81. package/dist/Search-DOJMNI2T.css.map +0 -1
  82. package/dist/Search-VYYG3D43.js +0 -10
  83. package/dist/Search-VYYG3D43.js.map +0 -1
  84. package/dist/chunk-4YQE3TNM.js +0 -1
  85. package/dist/chunk-4YQE3TNM.js.map +0 -1
  86. package/dist/chunk-AXLJDGQL.js +0 -1
  87. package/dist/chunk-AXLJDGQL.js.map +0 -1
  88. package/dist/chunk-CZM5NX27.js +0 -909
  89. package/dist/chunk-CZM5NX27.js.map +0 -1
  90. package/dist/chunk-FZP2AVJL.js +0 -43
  91. package/dist/chunk-FZP2AVJL.js.map +0 -1
  92. package/dist/chunk-IEPSORG5.js +0 -444
  93. package/dist/chunk-IEPSORG5.js.map +0 -1
  94. package/dist/chunk-KUWEUO37.js +0 -1
  95. package/dist/chunk-KUWEUO37.js.map +0 -1
  96. package/dist/chunk-NBRHGTR2.js +0 -79
  97. package/dist/chunk-NBRHGTR2.js.map +0 -1
  98. package/dist/chunk-PGHUPTGL.js +0 -1035
  99. package/dist/chunk-PGHUPTGL.js.map +0 -1
  100. package/dist/chunk-PMS3P4MA.js +0 -43
  101. package/dist/chunk-PMS3P4MA.js.map +0 -1
  102. package/dist/chunk-QELSOHIY.js +0 -46
  103. package/dist/chunk-QELSOHIY.js.map +0 -1
  104. package/dist/chunk-R2QKY6G3.js +0 -1
  105. package/dist/chunk-R2QKY6G3.js.map +0 -1
  106. package/dist/chunk-ZPYQQZ7J.js +0 -210
  107. package/dist/chunk-ZPYQQZ7J.js.map +0 -1
  108. package/dist/icons/index.js.map +0 -1
  109. package/dist/index.css +0 -1290
  110. package/dist/index.css.map +0 -1
  111. package/dist/index.js.map +0 -1
  112. package/dist/mdx/provider.css +0 -403
  113. package/dist/mdx/provider.css.map +0 -1
  114. package/dist/runtime/index.js.map +0 -1
  115. package/dist/types-CLkHwCch.d.ts +0 -248
  116. package/dist/ui/index.css +0 -1290
  117. package/dist/ui/index.css.map +0 -1
  118. package/dist/ui/index.js.map +0 -1
  119. package/dist/ui/styles.css.map +0 -1
  120. package/dist/ui/styles.js.map +0 -1
@@ -0,0 +1,1193 @@
1
+ import path from "node:path";
2
+ import fs from "node:fs/promises";
3
+ import { readPackageUp } from "read-package-up";
4
+ import { Application, ReflectionKind, TSConfigReader, TypeDocReader } from "typedoc";
5
+ //#region src/typedoc/generator-config.ts
6
+ function resolveTypeDocConfig(config) {
7
+ const sidebar = resolveSidebarConfig(config.sidebar);
8
+ const markdown = resolveMarkdownConfig(config.markdown);
9
+ return {
10
+ ...config,
11
+ excludeExternals: withDefault(config.excludeExternals, true),
12
+ excludeInternal: withDefault(config.excludeInternal, true),
13
+ excludePrivate: withDefault(config.excludePrivate, true),
14
+ excludeProtected: withDefault(config.excludeProtected, false),
15
+ markdown,
16
+ out: withDefault(config.out, "api"),
17
+ sidebar,
18
+ sort: withDefault(config.sort, ["source-order"])
19
+ };
20
+ }
21
+ function getTypedocOptions(config) {
22
+ const options = {
23
+ entryPoints: config.entryPoints,
24
+ excludeExternals: config.excludeExternals,
25
+ excludeInternal: config.excludeInternal,
26
+ excludePrivate: config.excludePrivate,
27
+ excludeProtected: config.excludeProtected,
28
+ sort: config.sort,
29
+ tsconfig: config.tsconfig
30
+ };
31
+ applyOptionalOption(options, "exclude", config.exclude);
32
+ applyOptionalOption(options, "categoryOrder", config.categoryOrder);
33
+ applyOptionalOption(options, "groupOrder", config.groupOrder);
34
+ applyOptionalOption(options, "plugin", config.plugin);
35
+ applyOptionalOption(options, "readme", config.readme);
36
+ return options;
37
+ }
38
+ function applyOptionalOption(options, key, value) {
39
+ if (value != null) options[key] = value;
40
+ }
41
+ function withDefault(value, fallback) {
42
+ return value ?? fallback;
43
+ }
44
+ function resolveSidebarConfig(sidebar) {
45
+ return {
46
+ collapsed: withDefault(sidebar?.collapsed, false),
47
+ position: withDefault(sidebar?.position, 100),
48
+ title: withDefault(sidebar?.title, "API Reference")
49
+ };
50
+ }
51
+ function resolveMarkdownConfig(markdown) {
52
+ return {
53
+ breadcrumbs: withDefault(markdown?.breadcrumbs, true),
54
+ codeBlocks: withDefault(markdown?.codeBlocks, true),
55
+ hierarchy: withDefault(markdown?.hierarchy, true),
56
+ sourceBaseUrl: markdown?.sourceBaseUrl,
57
+ sourceLinks: withDefault(markdown?.sourceLinks, true)
58
+ };
59
+ }
60
+ //#endregion
61
+ //#region src/typedoc/generator-shared.ts
62
+ function groupProjectChildren(project, isComponentName) {
63
+ const grouped = {
64
+ componentItems: [],
65
+ functionsByFile: /* @__PURE__ */ new Map(),
66
+ standaloneItems: [],
67
+ typesByFile: /* @__PURE__ */ new Map()
68
+ };
69
+ const children = project.children ?? [];
70
+ for (const child of children) {
71
+ if (appendFunctionReflection(grouped, child, isComponentName)) continue;
72
+ if (appendTypeAliasReflection(grouped, child)) continue;
73
+ grouped.standaloneItems.push(child);
74
+ }
75
+ return grouped;
76
+ }
77
+ function appendFunctionReflection(grouped, child, isComponentName) {
78
+ const sourceFile = child.sources?.[0]?.fileName;
79
+ if (child.kind !== ReflectionKind.Function || sourceFile == null) return false;
80
+ if (isComponentName(child.name)) {
81
+ grouped.componentItems.push(child);
82
+ return true;
83
+ }
84
+ appendToMapList(grouped.functionsByFile, sourceFile, child);
85
+ return true;
86
+ }
87
+ function appendTypeAliasReflection(grouped, child) {
88
+ const sourceFile = child.sources?.[0]?.fileName;
89
+ if (child.kind !== ReflectionKind.TypeAlias || sourceFile == null) return false;
90
+ appendToMapList(grouped.typesByFile, sourceFile, child);
91
+ return true;
92
+ }
93
+ function appendToMapList(map, key, item) {
94
+ const items = map.get(key) ?? [];
95
+ items.push(item);
96
+ map.set(key, items);
97
+ }
98
+ function sortReflectionsByName(items) {
99
+ return [...items].sort((left, right) => left.name.localeCompare(right.name));
100
+ }
101
+ function getModuleNameFromPath(filePath, packageNameCache) {
102
+ const parts = filePath.split("/");
103
+ const basename = (parts.pop() ?? filePath).replace(/\.(?:ts|tsx|js|jsx)$/u, "");
104
+ const parent = parts.pop();
105
+ if (parent != null && parent !== "src") return `${parent}/${basename}`;
106
+ if (basename === "index") {
107
+ for (const packageName of packageNameCache.values()) if (packageName != null && packageName.length > 0) return packageName;
108
+ }
109
+ return basename;
110
+ }
111
+ function renderComment(parts) {
112
+ return parts.map((part) => part.text).join("");
113
+ }
114
+ function renderCommentShort(parts) {
115
+ const text = renderComment(parts);
116
+ const firstSentence = text.split(/[!.?]\s/u)[0];
117
+ if (firstSentence.length < text.length) return `${firstSentence}.`;
118
+ return text;
119
+ }
120
+ function getSlug(name) {
121
+ return name.toLowerCase().replaceAll(/[^\da-z]+/gu, "-").replaceAll(/^-|-$/gu, "");
122
+ }
123
+ function buildLink(basePath, category, slug) {
124
+ if (slug === "index") return `${basePath}/${category}`;
125
+ return `${basePath}/${category}/${slug}`;
126
+ }
127
+ function getSourceUrl(sourceBaseUrl, fileName, line) {
128
+ if (sourceBaseUrl == null || sourceBaseUrl.length === 0) return null;
129
+ return `${sourceBaseUrl.replace(/\/$/u, "")}/${fileName}#L${line}`;
130
+ }
131
+ function getKindName(kind) {
132
+ return {
133
+ [ReflectionKind.Project]: "Project",
134
+ [ReflectionKind.Module]: "Module",
135
+ [ReflectionKind.Namespace]: "Namespace",
136
+ [ReflectionKind.Enum]: "Enum",
137
+ [ReflectionKind.EnumMember]: "Enum Member",
138
+ [ReflectionKind.Variable]: "Variable",
139
+ [ReflectionKind.Function]: "Function",
140
+ [ReflectionKind.Class]: "Class",
141
+ [ReflectionKind.Interface]: "Interface",
142
+ [ReflectionKind.Constructor]: "Constructor",
143
+ [ReflectionKind.Property]: "Property",
144
+ [ReflectionKind.Method]: "Method",
145
+ [ReflectionKind.TypeAlias]: "Type"
146
+ }[kind] ?? "Unknown";
147
+ }
148
+ function getGroupUrlPrefix(kind) {
149
+ return {
150
+ [ReflectionKind.Enum]: "enums",
151
+ [ReflectionKind.Variable]: "variables",
152
+ [ReflectionKind.Class]: "classes",
153
+ [ReflectionKind.Interface]: "interfaces",
154
+ [ReflectionKind.Namespace]: "namespaces",
155
+ [ReflectionKind.Module]: "modules"
156
+ }[kind] ?? "other";
157
+ }
158
+ function getKindGroupName(kind, name) {
159
+ if (kind === ReflectionKind.Function) {
160
+ if (name.startsWith("use")) return "React Hooks";
161
+ if (isReactComponent(name)) return "React Components";
162
+ return "Functions";
163
+ }
164
+ switch (kind) {
165
+ case ReflectionKind.Interface: return "Interfaces";
166
+ case ReflectionKind.TypeAlias: return "Types";
167
+ case ReflectionKind.Class: return "Classes";
168
+ case ReflectionKind.Variable: return "Variables";
169
+ case ReflectionKind.Enum: return "Enums";
170
+ default: return "Other";
171
+ }
172
+ }
173
+ function isReactComponent(name) {
174
+ const first = name.slice(0, 1);
175
+ if (first.length === 0 || first !== first.toUpperCase()) return false;
176
+ if (name.includes("_") || name.startsWith("use")) return false;
177
+ if (name.endsWith("Props") || name.endsWith("Options") || name.endsWith("Config")) return false;
178
+ return true;
179
+ }
180
+ function createBreadcrumbs(basePath, pagePath) {
181
+ const parts = pagePath.split("/");
182
+ const breadcrumbs = [`[API](${basePath})`];
183
+ let currentPath = "";
184
+ for (const part of parts.slice(0, -1)) {
185
+ currentPath = currentPath.length > 0 ? `${currentPath}/${part}` : part;
186
+ breadcrumbs.push(`[${part}](${basePath}/${currentPath})`);
187
+ }
188
+ const leaf = parts.at(-1);
189
+ if (leaf != null) breadcrumbs.push(leaf);
190
+ return breadcrumbs.join(" / ");
191
+ }
192
+ function createNavigationLine(params) {
193
+ const { basePath, kind, navigation } = params;
194
+ const prefix = getGroupUrlPrefix(kind);
195
+ const prevLink = navigation.prev == null ? "" : `[← ${navigation.prev.name}](${buildLink(basePath, prefix, getSlug(navigation.prev.name))})`;
196
+ const nextLink = navigation.next == null ? "" : `[${navigation.next.name} →](${buildLink(basePath, prefix, getSlug(navigation.next.name))})`;
197
+ if (prevLink.length > 0 && nextLink.length > 0) return `${prevLink} | ${nextLink}`;
198
+ if (prevLink.length > 0) return prevLink;
199
+ if (nextLink.length > 0) return nextLink;
200
+ return null;
201
+ }
202
+ //#endregion
203
+ //#region src/typedoc/generator-pages-categories.ts
204
+ function generateCategoryIndexPages(context, grouped) {
205
+ const pages = [];
206
+ pushIfNotNull(pages, createComponentsIndexPage(context, grouped.componentItems));
207
+ pushIfNotNull(pages, createFunctionsIndexPage(context, grouped.functionsByFile));
208
+ pushIfNotNull(pages, createInterfacesIndexPage(context, grouped.standaloneItems));
209
+ pushIfNotNull(pages, createTypesIndexPage(context, grouped.typesByFile));
210
+ pushIfNotNull(pages, createClassesIndexPage(context, grouped.standaloneItems));
211
+ return pages;
212
+ }
213
+ function pushIfNotNull(docs, doc) {
214
+ if (doc != null) docs.push(doc);
215
+ }
216
+ function createComponentsIndexPage(context, components) {
217
+ if (components.length === 0) return null;
218
+ return {
219
+ content: renderSimpleItemIndex({
220
+ basePath: context.basePath,
221
+ category: "components",
222
+ items: components,
223
+ title: "Components"
224
+ }),
225
+ frontmatter: {
226
+ sidebar: false,
227
+ title: "Components"
228
+ },
229
+ path: "components/index.md"
230
+ };
231
+ }
232
+ function createInterfacesIndexPage(context, standaloneItems) {
233
+ const interfaces = standaloneItems.filter((item) => item.kind === ReflectionKind.Interface);
234
+ if (interfaces.length === 0) return null;
235
+ return {
236
+ content: renderSimpleItemIndex({
237
+ basePath: context.basePath,
238
+ category: "interfaces",
239
+ items: interfaces,
240
+ title: "Interfaces"
241
+ }),
242
+ frontmatter: {
243
+ sidebar: false,
244
+ title: "Interfaces"
245
+ },
246
+ path: "interfaces/index.md"
247
+ };
248
+ }
249
+ function createClassesIndexPage(context, standaloneItems) {
250
+ const classes = standaloneItems.filter((item) => item.kind === ReflectionKind.Class);
251
+ if (classes.length === 0) return null;
252
+ return {
253
+ content: renderSimpleItemIndex({
254
+ basePath: context.basePath,
255
+ category: "classes",
256
+ items: classes,
257
+ title: "Classes"
258
+ }),
259
+ frontmatter: {
260
+ sidebar: false,
261
+ title: "Classes"
262
+ },
263
+ path: "classes/index.md"
264
+ };
265
+ }
266
+ function renderSimpleItemIndex(params) {
267
+ const lines = [`# ${params.title}`, ""];
268
+ const sortedItems = sortReflectionsByName(params.items);
269
+ for (const item of sortedItems) {
270
+ const summary = item.comment?.summary;
271
+ const description = summary == null ? "" : ` - ${renderCommentShort(summary)}`;
272
+ const link = buildLink(params.basePath, params.category, getSlug(item.name));
273
+ lines.push(`- [${item.name}](${link})${description}`);
274
+ }
275
+ lines.push("");
276
+ return lines.join("\n");
277
+ }
278
+ function createFunctionsIndexPage(context, functionsByFile) {
279
+ if (functionsByFile.size === 0) return null;
280
+ return {
281
+ content: renderModuleIndex({
282
+ basePath: context.basePath,
283
+ category: "functions",
284
+ modules: functionsByFile,
285
+ packageNameCache: context.packageNameCache,
286
+ title: "Functions"
287
+ }),
288
+ frontmatter: {
289
+ sidebar: false,
290
+ title: "Functions"
291
+ },
292
+ path: "functions/index.md"
293
+ };
294
+ }
295
+ function createTypesIndexPage(context, typesByFile) {
296
+ if (typesByFile.size === 0) return null;
297
+ return {
298
+ content: renderModuleIndex({
299
+ basePath: context.basePath,
300
+ category: "types",
301
+ modules: typesByFile,
302
+ packageNameCache: context.packageNameCache,
303
+ title: "Types"
304
+ }),
305
+ frontmatter: {
306
+ sidebar: false,
307
+ title: "Types"
308
+ },
309
+ path: "types/index.md"
310
+ };
311
+ }
312
+ function renderModuleIndex(params) {
313
+ const lines = [`# ${params.title}`, ""];
314
+ const sortedModules = [...params.modules.entries()].sort(([left], [right]) => {
315
+ const leftName = getModuleNameFromPath(left, params.packageNameCache);
316
+ const rightName = getModuleNameFromPath(right, params.packageNameCache);
317
+ return leftName.localeCompare(rightName);
318
+ });
319
+ for (const [sourceFile, items] of sortedModules) {
320
+ const moduleName = getModuleNameFromPath(sourceFile, params.packageNameCache);
321
+ const slug = getSlug(moduleName);
322
+ const itemNames = items.map((item) => item.name).sort().join(", ");
323
+ lines.push(`- [${moduleName}](${buildLink(params.basePath, params.category, slug)}) - ${itemNames}`);
324
+ }
325
+ lines.push("");
326
+ return lines.join("\n");
327
+ }
328
+ //#endregion
329
+ //#region src/typedoc/generator-render-component.ts
330
+ function getTypeName(paramType) {
331
+ if (paramType == null || typeof paramType !== "object") return null;
332
+ const typeRecord = paramType;
333
+ if (typeof typeRecord.name === "string" && typeRecord.name.length > 0) return typeRecord.name;
334
+ if (typeRecord.type !== "reference") return null;
335
+ if (typeof typeRecord.qualifiedName === "string" && typeRecord.qualifiedName.length > 0) return typeRecord.qualifiedName;
336
+ return null;
337
+ }
338
+ function getPropsFromType(context, paramType) {
339
+ const inlineProps = getInlineDeclarationProps(paramType);
340
+ if (inlineProps.length > 0) return inlineProps;
341
+ const typeName = getTypeName(paramType);
342
+ if (typeName == null) return [];
343
+ const reflection = findReflectionByName(context, typeName);
344
+ if (reflection == null) return [];
345
+ return extractPropsFromChildren(reflection.children ?? []);
346
+ }
347
+ function getInlineDeclarationProps(paramType) {
348
+ if (paramType == null || typeof paramType !== "object") return [];
349
+ const declaration = paramType.declaration;
350
+ if (declaration == null) return [];
351
+ return extractPropsFromChildren(declaration.children ?? []);
352
+ }
353
+ function findReflectionByName(context, typeName) {
354
+ const direct = context.project.getChildByName(typeName);
355
+ if (direct != null && "children" in direct) return direct;
356
+ const children = context.project.children ?? [];
357
+ for (const child of children) if (child.name === typeName) return child;
358
+ return null;
359
+ }
360
+ function extractPropsFromChildren(children) {
361
+ return children.map((child) => ({
362
+ description: child.comment?.summary == null ? "" : renderCommentShort(child.comment.summary),
363
+ name: child.name,
364
+ optional: child.flags.isOptional,
365
+ type: child.type == null ? "unknown" : child.type.toString()
366
+ }));
367
+ }
368
+ function renderComponentSignature(context, signature, componentName) {
369
+ const lines = [];
370
+ const propsParam = signature.parameters?.[0];
371
+ const props = propsParam == null ? [] : getPropsFromType(context, propsParam.type);
372
+ const propsTypeName = propsParam == null ? null : getTypeName(propsParam.type);
373
+ appendComponentUsageBlock(lines, componentName, props);
374
+ appendComponentPropsTable({
375
+ context,
376
+ lines,
377
+ props,
378
+ propsTypeName
379
+ });
380
+ return lines.join("\n");
381
+ }
382
+ function appendComponentUsageBlock(lines, componentName, props) {
383
+ const hasChildren = props.some((prop) => prop.name === "children");
384
+ const displayProps = props.filter((prop) => prop.name !== "children");
385
+ lines.push("```tsx");
386
+ lines.push(`<${componentName}`);
387
+ if (displayProps.length > 0) for (const prop of displayProps) {
388
+ const optionalMark = prop.optional ? "?" : "";
389
+ lines.push(` ${prop.name}${optionalMark}={${prop.type}}`);
390
+ }
391
+ else if (!hasChildren) lines.push(" {...props}");
392
+ if (hasChildren) {
393
+ lines.push(">");
394
+ lines.push(" {children}");
395
+ lines.push(`</${componentName}>`);
396
+ } else lines.push("/>");
397
+ lines.push("```");
398
+ }
399
+ function appendComponentPropsTable(params) {
400
+ const { context, lines, props, propsTypeName } = params;
401
+ if (props.length === 0) return;
402
+ lines.push("");
403
+ lines.push(getPropsHeading(context.basePath, propsTypeName));
404
+ lines.push("");
405
+ lines.push("| Prop | Type | Required | Description |");
406
+ lines.push("|------|------|----------|-------------|");
407
+ for (const prop of props) {
408
+ const required = prop.optional ? "No" : "Yes";
409
+ const description = prop.description.length > 0 ? prop.description : "-";
410
+ lines.push(`| ${prop.name} | \`${prop.type}\` | ${required} | ${description} |`);
411
+ }
412
+ }
413
+ function getPropsHeading(basePath, propsTypeName) {
414
+ if (propsTypeName == null) return "## Props";
415
+ return `## [Props](${buildLink(basePath, "interfaces", getSlug(propsTypeName))})`;
416
+ }
417
+ //#endregion
418
+ //#region src/typedoc/generator-pages-components.ts
419
+ function generateComponentPage(params) {
420
+ const { component, context, navigation } = params;
421
+ const slug = getSlug(component.name);
422
+ return {
423
+ content: createComponentContent(context, component, navigation),
424
+ frontmatter: {
425
+ description: component.comment?.summary == null ? `${component.name} component` : renderCommentShort(component.comment.summary),
426
+ title: component.name
427
+ },
428
+ path: `components/${slug}.md`
429
+ };
430
+ }
431
+ function createComponentContent(context, component, navigation) {
432
+ const lines = [`# ${component.name}`, ""];
433
+ const summary = component.comment?.summary;
434
+ if (summary != null) {
435
+ lines.push(renderComment(summary));
436
+ lines.push("");
437
+ }
438
+ appendComponentUsage(lines, context, component);
439
+ appendExamples$1(lines, component);
440
+ appendSourceLink$1(lines, context, component);
441
+ appendComponentNavigation({
442
+ component,
443
+ context,
444
+ lines,
445
+ navigation
446
+ });
447
+ return lines.join("\n");
448
+ }
449
+ function appendComponentUsage(lines, context, component) {
450
+ const signatures = component.signatures ?? [];
451
+ if (signatures.length === 0) return;
452
+ lines.push("## Usage");
453
+ lines.push("");
454
+ for (const signature of signatures) {
455
+ lines.push(renderComponentSignature(context, signature, component.name));
456
+ lines.push("");
457
+ }
458
+ }
459
+ function appendExamples$1(lines, reflection) {
460
+ const examples = (reflection.comment?.blockTags ?? []).filter((tag) => tag.tag === "@example");
461
+ if (examples.length === 0) return;
462
+ lines.push("## Example");
463
+ lines.push("");
464
+ for (const example of examples) {
465
+ lines.push(renderComment(example.content));
466
+ lines.push("");
467
+ }
468
+ }
469
+ function appendSourceLink$1(lines, context, reflection) {
470
+ if (!context.config.markdown.sourceLinks) return;
471
+ const source = reflection.sources?.[0];
472
+ if (source == null) return;
473
+ const sourceUrl = getSourceUrl(context.config.markdown.sourceBaseUrl, source.fileName, source.line);
474
+ if (sourceUrl == null) return;
475
+ lines.push(`[Source](${sourceUrl})`);
476
+ lines.push("");
477
+ }
478
+ function appendComponentNavigation(params) {
479
+ const { component, context, lines, navigation } = params;
480
+ const line = createNavigationLine({
481
+ basePath: context.basePath,
482
+ kind: component.kind,
483
+ navigation
484
+ });
485
+ if (line == null) return;
486
+ lines.push("---");
487
+ lines.push("");
488
+ lines.push(line);
489
+ lines.push("");
490
+ }
491
+ //#endregion
492
+ //#region src/typedoc/generator-render.ts
493
+ function renderSignature(context, signature) {
494
+ const lines = [];
495
+ appendCodeFenceStart(lines, context);
496
+ lines.push(getSignatureLine(signature));
497
+ appendCodeFenceEnd(lines, context);
498
+ appendSignatureParameters(lines, signature);
499
+ appendSignatureReturn(lines, signature);
500
+ return lines.join("\n");
501
+ }
502
+ function appendCodeFenceStart(lines, context) {
503
+ if (context.config.markdown.codeBlocks) lines.push("```typescript");
504
+ }
505
+ function appendCodeFenceEnd(lines, context) {
506
+ if (context.config.markdown.codeBlocks) lines.push("```");
507
+ }
508
+ function getSignatureLine(signature) {
509
+ const typeParameters = renderTypeParameterNames(signature.typeParameters);
510
+ const parameters = renderSignatureParameters(signature);
511
+ const returnType = signature.type == null ? "" : `: ${signature.type.toString()}`;
512
+ return `function ${signature.name}${typeParameters}(${parameters})${returnType}`;
513
+ }
514
+ function renderTypeParameterNames(typeParameters) {
515
+ if (typeParameters == null || typeParameters.length === 0) return "";
516
+ return `<${typeParameters.map((item) => item.name).join(", ")}>`;
517
+ }
518
+ function renderSignatureParameters(signature) {
519
+ return (signature.parameters ?? []).map((parameter) => {
520
+ const optional = parameter.flags.isOptional ? "?" : "";
521
+ const type = parameter.type == null ? "" : `: ${parameter.type.toString()}`;
522
+ return `${parameter.name}${optional}${type}`;
523
+ }).join(", ");
524
+ }
525
+ function appendSignatureParameters(lines, signature) {
526
+ const parameters = signature.parameters ?? [];
527
+ if (parameters.length === 0) return;
528
+ lines.push("");
529
+ lines.push("### Parameters");
530
+ lines.push("");
531
+ lines.push("| Name | Type | Description |");
532
+ lines.push("|------|------|-------------|");
533
+ for (const parameter of parameters) lines.push(renderSignatureParameterRow(parameter));
534
+ }
535
+ function renderSignatureParameterRow(parameter) {
536
+ const optional = parameter.flags.isOptional ? " (optional)" : "";
537
+ const type = parameter.type == null ? "-" : `\`${parameter.type.toString()}\``;
538
+ const summary = parameter.comment?.summary;
539
+ const description = summary == null ? "-" : renderCommentShort(summary);
540
+ return `| ${parameter.name}${optional} | ${type} | ${description} |`;
541
+ }
542
+ function appendSignatureReturn(lines, signature) {
543
+ const returnType = signature.type;
544
+ if (returnType == null || returnType.toString() === "void") return;
545
+ lines.push("");
546
+ lines.push("### Returns");
547
+ lines.push("");
548
+ lines.push(`\`${returnType.toString()}\``);
549
+ const returnTag = signature.comment?.blockTags.find((tag) => tag.tag === "@returns");
550
+ if (returnTag == null) return;
551
+ lines.push("");
552
+ lines.push(renderComment(returnTag.content));
553
+ }
554
+ function renderProperty(property) {
555
+ const lines = [];
556
+ const flags = getPropertyFlags(property);
557
+ lines.push(`### ${property.name}`);
558
+ if (flags.length > 0) lines.push(`*${flags.join(", ")}*`);
559
+ lines.push("");
560
+ appendPropertyType(lines, property);
561
+ appendPropertySummary(lines, property);
562
+ appendPropertyDefaultValue(lines, property);
563
+ return lines.join("\n");
564
+ }
565
+ function getPropertyFlags(property) {
566
+ const flags = [];
567
+ if (property.flags.isOptional) flags.push("optional");
568
+ if (property.flags.isReadonly) flags.push("readonly");
569
+ if (property.flags.isStatic) flags.push("static");
570
+ return flags;
571
+ }
572
+ function appendPropertyType(lines, property) {
573
+ if (property.type == null) return;
574
+ lines.push("```typescript");
575
+ lines.push(`${property.name}: ${property.type.toString()}`);
576
+ lines.push("```");
577
+ lines.push("");
578
+ }
579
+ function appendPropertySummary(lines, property) {
580
+ const summary = property.comment?.summary;
581
+ if (summary != null) lines.push(renderComment(summary));
582
+ }
583
+ function appendPropertyDefaultValue(lines, property) {
584
+ if (property.defaultValue == null || property.defaultValue.length === 0) return;
585
+ lines.push("");
586
+ lines.push(`**Default:** \`${property.defaultValue}\``);
587
+ }
588
+ function renderMethod(context, method) {
589
+ const lines = [];
590
+ lines.push(`### ${method.name}()`);
591
+ lines.push("");
592
+ const signatures = method.signatures ?? [];
593
+ for (const signature of signatures) appendMethodSignature(lines, context, signature);
594
+ return lines.join("\n");
595
+ }
596
+ function appendMethodSignature(lines, context, signature) {
597
+ const summary = signature.comment?.summary;
598
+ if (summary != null) {
599
+ lines.push(renderComment(summary));
600
+ lines.push("");
601
+ }
602
+ lines.push(renderSignature(context, signature));
603
+ lines.push("");
604
+ }
605
+ function renderTypeParameters(typeParameters) {
606
+ const lines = [];
607
+ lines.push("| Name | Constraint | Default | Description |");
608
+ lines.push("|------|------------|---------|-------------|");
609
+ for (const typeParameter of typeParameters) lines.push(renderTypeParameterRow(typeParameter));
610
+ return lines.join("\n");
611
+ }
612
+ function renderTypeParameterRow(typeParameter) {
613
+ const constraint = typeParameter.type == null ? "-" : `\`${typeParameter.type.toString()}\``;
614
+ const defaultValue = typeParameter.default == null ? "-" : `\`${typeParameter.default.toString()}\``;
615
+ const summary = typeParameter.comment?.summary;
616
+ const description = summary == null ? "-" : renderCommentShort(summary);
617
+ return `| ${typeParameter.name} | ${constraint} | ${defaultValue} | ${description} |`;
618
+ }
619
+ function renderHierarchy(reflection) {
620
+ const lines = [];
621
+ appendHierarchySection(lines, "**Extends:**", reflection.extendedTypes);
622
+ appendHierarchySection(lines, "**Implements:**", reflection.implementedTypes);
623
+ appendHierarchySection(lines, "**Extended by:**", reflection.extendedBy);
624
+ appendHierarchySection(lines, "**Implemented by:**", reflection.implementedBy);
625
+ return lines.length === 0 ? null : lines.join("\n");
626
+ }
627
+ function appendHierarchySection(lines, title, types) {
628
+ if (types == null || types.length === 0) return;
629
+ lines.push(title);
630
+ for (const item of types) lines.push(`- \`${item.toString()}\``);
631
+ }
632
+ //#endregion
633
+ //#region src/typedoc/generator-pages-grouped.ts
634
+ function generateGroupedFunctionsPage(params) {
635
+ const { context, functions, sourceFile } = params;
636
+ const moduleName = getModuleNameFromPath(sourceFile, context.packageNameCache);
637
+ return {
638
+ content: createGroupedFunctionsContent({
639
+ context,
640
+ functions,
641
+ moduleName,
642
+ sourceFile
643
+ }),
644
+ frontmatter: {
645
+ description: `Functions from ${sourceFile}`,
646
+ title: `${moduleName} Functions`
647
+ },
648
+ path: `functions/${getSlug(moduleName)}.md`
649
+ };
650
+ }
651
+ function createGroupedFunctionsContent(params) {
652
+ const { context, functions, moduleName, sourceFile } = params;
653
+ const lines = [
654
+ `# ${moduleName} Functions`,
655
+ "",
656
+ `Functions exported from \`${sourceFile}\``,
657
+ ""
658
+ ];
659
+ const sortedFunctions = sortReflectionsByName(functions);
660
+ for (const fn of sortedFunctions) appendGroupedFunction(lines, context, fn);
661
+ return lines.join("\n");
662
+ }
663
+ function appendGroupedFunction(lines, context, fn) {
664
+ lines.push(`## ${fn.name}`);
665
+ lines.push("");
666
+ const summary = fn.comment?.summary;
667
+ if (summary != null) {
668
+ lines.push(renderComment(summary));
669
+ lines.push("");
670
+ }
671
+ const signatures = fn.signatures ?? [];
672
+ for (const signature of signatures) {
673
+ lines.push(renderSignature(context, signature));
674
+ lines.push("");
675
+ }
676
+ appendExamples(lines, fn);
677
+ appendSourceLink(lines, context, fn);
678
+ lines.push("---");
679
+ lines.push("");
680
+ }
681
+ function appendExamples(lines, reflection) {
682
+ const examples = (reflection.comment?.blockTags ?? []).filter((tag) => tag.tag === "@example");
683
+ if (examples.length === 0) return;
684
+ lines.push("### Example");
685
+ lines.push("");
686
+ for (const example of examples) {
687
+ lines.push(renderComment(example.content));
688
+ lines.push("");
689
+ }
690
+ }
691
+ function appendSourceLink(lines, context, reflection) {
692
+ if (!context.config.markdown.sourceLinks) return;
693
+ const source = reflection.sources?.[0];
694
+ if (source == null) return;
695
+ const sourceUrl = getSourceUrl(context.config.markdown.sourceBaseUrl, source.fileName, source.line);
696
+ if (sourceUrl == null) return;
697
+ lines.push(`[Source](${sourceUrl})`);
698
+ lines.push("");
699
+ }
700
+ function generateGroupedTypesPage(params) {
701
+ const { context, sourceFile, types } = params;
702
+ const moduleName = getModuleNameFromPath(sourceFile, context.packageNameCache);
703
+ return {
704
+ content: createGroupedTypesContent({
705
+ context,
706
+ moduleName,
707
+ sourceFile,
708
+ types
709
+ }),
710
+ frontmatter: {
711
+ description: `Type definitions from ${sourceFile}`,
712
+ title: `${moduleName} Types`
713
+ },
714
+ path: `types/${getSlug(moduleName)}.md`
715
+ };
716
+ }
717
+ function createGroupedTypesContent(params) {
718
+ const { context, moduleName, sourceFile, types } = params;
719
+ const lines = [
720
+ `# ${moduleName} Types`,
721
+ "",
722
+ `Type definitions from \`${sourceFile}\``,
723
+ ""
724
+ ];
725
+ const sortedTypes = sortReflectionsByName(types);
726
+ for (const typeAlias of sortedTypes) appendGroupedType(lines, context, typeAlias);
727
+ return lines.join("\n");
728
+ }
729
+ function appendGroupedType(lines, context, typeAlias) {
730
+ lines.push(`## ${typeAlias.name}`);
731
+ lines.push("");
732
+ const summary = typeAlias.comment?.summary;
733
+ if (summary != null) {
734
+ lines.push(renderComment(summary));
735
+ lines.push("");
736
+ }
737
+ if (typeAlias.type != null) {
738
+ lines.push("```typescript");
739
+ lines.push(`type ${typeAlias.name} = ${typeAlias.type.toString()}`);
740
+ lines.push("```");
741
+ lines.push("");
742
+ }
743
+ appendSourceLink(lines, context, typeAlias);
744
+ lines.push("---");
745
+ lines.push("");
746
+ }
747
+ //#endregion
748
+ //#region src/typedoc/generator-pages-index.ts
749
+ function generateIndexPage(context, grouped) {
750
+ const lines = [
751
+ `# ${context.config.sidebar.title}`,
752
+ "",
753
+ getProjectSummary(context),
754
+ ""
755
+ ];
756
+ appendComponentSection(lines, context, grouped.componentItems);
757
+ appendFunctionsSection(lines, context, grouped.functionsByFile);
758
+ appendTypesSection(lines, context, grouped.typesByFile);
759
+ appendStandaloneSections(lines, context, grouped.standaloneItems);
760
+ return {
761
+ content: lines.join("\n"),
762
+ frontmatter: {
763
+ description: "Auto-generated API documentation",
764
+ sidebar_position: 0,
765
+ title: context.config.sidebar.title
766
+ },
767
+ path: "index.md"
768
+ };
769
+ }
770
+ function getProjectSummary(context) {
771
+ const summary = context.project.comment?.summary;
772
+ if (summary == null) return "Auto-generated API documentation.";
773
+ return renderComment(summary);
774
+ }
775
+ function appendComponentSection(lines, context, components) {
776
+ if (components.length === 0) return;
777
+ lines.push("## Components");
778
+ lines.push("");
779
+ for (const component of sortReflectionsByName(components)) {
780
+ const description = component.comment?.summary;
781
+ const suffix = description == null ? "" : ` - ${renderCommentShort(description)}`;
782
+ const link = buildLink(context.basePath, "components", getSlug(component.name));
783
+ lines.push(`- [${component.name}](${link})${suffix}`);
784
+ }
785
+ lines.push("");
786
+ }
787
+ function appendFunctionsSection(lines, context, functionsByFile) {
788
+ if (functionsByFile.size === 0) return;
789
+ lines.push("## Functions");
790
+ lines.push("");
791
+ lines.push(...renderModuleSectionItems(context, functionsByFile, "functions"));
792
+ lines.push("");
793
+ }
794
+ function appendTypesSection(lines, context, typesByFile) {
795
+ if (typesByFile.size === 0) return;
796
+ lines.push("## Type Aliases");
797
+ lines.push("");
798
+ lines.push(...renderModuleSectionItems(context, typesByFile, "types"));
799
+ lines.push("");
800
+ }
801
+ function renderModuleSectionItems(context, modules, category) {
802
+ return [...modules.entries()].sort(([left], [right]) => {
803
+ const leftName = getModuleNameFromPath(left, context.packageNameCache);
804
+ const rightName = getModuleNameFromPath(right, context.packageNameCache);
805
+ return leftName.localeCompare(rightName);
806
+ }).map(([sourceFile, items]) => {
807
+ const moduleName = getModuleNameFromPath(sourceFile, context.packageNameCache);
808
+ const itemNames = items.map((item) => item.name).sort().join(", ");
809
+ return `- [${moduleName}](${buildLink(context.basePath, category, getSlug(moduleName))}) - ${itemNames}`;
810
+ });
811
+ }
812
+ function appendStandaloneSections(lines, context, standaloneItems) {
813
+ const groups = /* @__PURE__ */ new Map();
814
+ for (const item of standaloneItems) appendToMapList(groups, getKindGroupName(item.kind, item.name), item);
815
+ for (const groupName of [
816
+ "Interfaces",
817
+ "Classes",
818
+ "Variables",
819
+ "Enums",
820
+ "Other"
821
+ ]) {
822
+ const groupItems = groups.get(groupName);
823
+ if (groupItems == null || groupItems.length === 0) continue;
824
+ appendStandaloneGroup({
825
+ context,
826
+ groupItems,
827
+ groupName,
828
+ lines
829
+ });
830
+ }
831
+ }
832
+ function appendStandaloneGroup(params) {
833
+ const { context, groupItems, groupName, lines } = params;
834
+ lines.push(`## ${groupName}`);
835
+ lines.push("");
836
+ for (const item of sortReflectionsByName(groupItems)) {
837
+ const description = item.comment?.summary;
838
+ const suffix = description == null ? "" : ` - ${renderCommentShort(description)}`;
839
+ const prefix = groupName.toLowerCase();
840
+ const link = buildLink(context.basePath, prefix, getSlug(item.name));
841
+ lines.push(`- [${item.name}](${link})${suffix}`);
842
+ }
843
+ lines.push("");
844
+ }
845
+ //#endregion
846
+ //#region src/typedoc/generator-reflection-tags.ts
847
+ function appendReflectionCommentTags(lines, reflection) {
848
+ const blockTags = reflection.comment?.blockTags ?? [];
849
+ appendTagExamples(lines, blockTags);
850
+ appendTagDeprecated(lines, blockTags);
851
+ appendTagSeeAlso(lines, blockTags);
852
+ }
853
+ function appendTagExamples(lines, blockTags) {
854
+ const examples = blockTags.filter((tag) => tag.tag === "@example");
855
+ if (examples.length === 0) return;
856
+ lines.push("## Examples");
857
+ lines.push("");
858
+ for (const example of examples) {
859
+ lines.push(renderComment(example.content));
860
+ lines.push("");
861
+ }
862
+ }
863
+ function appendTagDeprecated(lines, blockTags) {
864
+ const deprecatedTag = blockTags.find((tag) => tag.tag === "@deprecated");
865
+ if (deprecatedTag == null) return;
866
+ lines.push("<Warning title=\"Deprecated\">");
867
+ lines.push(renderComment(deprecatedTag.content));
868
+ lines.push("</Warning>");
869
+ lines.push("");
870
+ }
871
+ function appendTagSeeAlso(lines, blockTags) {
872
+ const seeTags = blockTags.filter((tag) => tag.tag === "@see");
873
+ if (seeTags.length === 0) return;
874
+ lines.push("## See Also");
875
+ lines.push("");
876
+ for (const seeTag of seeTags) lines.push(`- ${renderComment(seeTag.content)}`);
877
+ lines.push("");
878
+ }
879
+ //#endregion
880
+ //#region src/typedoc/generator-reflection.ts
881
+ function generateReflectionDocs(params) {
882
+ const { context, navigation, parentPath, reflection } = params;
883
+ const pagePath = getReflectionPagePath(reflection, parentPath);
884
+ const docs = [generateReflectionPage({
885
+ context,
886
+ navigation,
887
+ pagePath,
888
+ reflection
889
+ })];
890
+ const childRefs = reflection.children ?? [];
891
+ for (const child of childRefs) if (hasOwnPage(child.kind)) docs.push(...generateReflectionDocs({
892
+ context,
893
+ navigation: {
894
+ next: null,
895
+ prev: null
896
+ },
897
+ parentPath: pagePath,
898
+ reflection: child
899
+ }));
900
+ return docs;
901
+ }
902
+ function getReflectionPagePath(reflection, parentPath) {
903
+ const slug = getSlug(reflection.name);
904
+ if (parentPath.length > 0) return `${parentPath}/${slug}`;
905
+ const prefix = getGroupUrlPrefix(reflection.kind);
906
+ return prefix.length === 0 ? slug : `${prefix}/${slug}`;
907
+ }
908
+ function hasOwnPage(kind) {
909
+ return [
910
+ ReflectionKind.Class,
911
+ ReflectionKind.Enum,
912
+ ReflectionKind.Interface,
913
+ ReflectionKind.Module,
914
+ ReflectionKind.Namespace
915
+ ].includes(kind);
916
+ }
917
+ function generateReflectionPage(params) {
918
+ const { context, navigation, pagePath, reflection } = params;
919
+ const lines = [];
920
+ appendReflectionSections({
921
+ context,
922
+ lines,
923
+ navigation,
924
+ pagePath,
925
+ reflection
926
+ });
927
+ return {
928
+ content: lines.join("\n"),
929
+ frontmatter: {
930
+ description: reflection.comment?.summary == null ? `${getKindName(reflection.kind)} ${reflection.name}` : renderCommentShort(reflection.comment.summary),
931
+ title: reflection.name
932
+ },
933
+ path: `${pagePath}.md`
934
+ };
935
+ }
936
+ function appendReflectionSections(params) {
937
+ const { context, lines, navigation, pagePath, reflection } = params;
938
+ appendBreadcrumbs(lines, context, pagePath);
939
+ appendTitle(lines, reflection);
940
+ appendDescription(lines, reflection);
941
+ appendTypeParameters(lines, reflection);
942
+ appendHierarchy(lines, context, reflection);
943
+ appendSignatures(lines, context, reflection);
944
+ appendProperties(lines, reflection);
945
+ appendMethods(lines, context, reflection);
946
+ appendEnumMembers(lines, reflection);
947
+ appendTypeAlias(lines, reflection);
948
+ appendSourceSection(lines, context, reflection);
949
+ appendReflectionCommentTags(lines, reflection);
950
+ appendNavigation({
951
+ context,
952
+ lines,
953
+ navigation,
954
+ reflection
955
+ });
956
+ }
957
+ function appendBreadcrumbs(lines, context, pagePath) {
958
+ if (!context.config.markdown.breadcrumbs) return;
959
+ lines.push(createBreadcrumbs(context.basePath, pagePath));
960
+ lines.push("");
961
+ }
962
+ function appendTitle(lines, reflection) {
963
+ const kind = getKindName(reflection.kind);
964
+ lines.push(`# ${kind}: ${reflection.name}`);
965
+ lines.push("");
966
+ }
967
+ function appendDescription(lines, reflection) {
968
+ const summary = reflection.comment?.summary;
969
+ if (summary == null) return;
970
+ lines.push(renderComment(summary));
971
+ lines.push("");
972
+ }
973
+ function appendTypeParameters(lines, reflection) {
974
+ const typeParameters = reflection.typeParameters ?? [];
975
+ if (typeParameters.length === 0) return;
976
+ lines.push("## Type Parameters");
977
+ lines.push("");
978
+ lines.push(renderTypeParameters(typeParameters));
979
+ lines.push("");
980
+ }
981
+ function appendHierarchy(lines, context, reflection) {
982
+ if (!context.config.markdown.hierarchy) return;
983
+ const hierarchy = renderHierarchy(reflection);
984
+ if (hierarchy == null) return;
985
+ lines.push("## Hierarchy");
986
+ lines.push("");
987
+ lines.push(hierarchy);
988
+ lines.push("");
989
+ }
990
+ function appendSignatures(lines, context, reflection) {
991
+ const signatures = reflection.signatures ?? [];
992
+ if (signatures.length === 0) return;
993
+ lines.push("## Signature");
994
+ lines.push("");
995
+ for (const signature of signatures) {
996
+ lines.push(renderSignature(context, signature));
997
+ lines.push("");
998
+ }
999
+ }
1000
+ function appendProperties(lines, reflection) {
1001
+ const properties = (reflection.children ?? []).filter((child) => child.kind === ReflectionKind.Property);
1002
+ if (properties.length === 0) return;
1003
+ lines.push("## Properties");
1004
+ lines.push("");
1005
+ for (const property of properties) {
1006
+ lines.push(renderProperty(property));
1007
+ lines.push("");
1008
+ }
1009
+ }
1010
+ function appendMethods(lines, context, reflection) {
1011
+ const methods = (reflection.children ?? []).filter((child) => child.kind === ReflectionKind.Method);
1012
+ if (methods.length === 0) return;
1013
+ lines.push("## Methods");
1014
+ lines.push("");
1015
+ for (const method of methods) {
1016
+ lines.push(renderMethod(context, method));
1017
+ lines.push("");
1018
+ }
1019
+ }
1020
+ function appendEnumMembers(lines, reflection) {
1021
+ const enumMembers = (reflection.children ?? []).filter((child) => child.kind === ReflectionKind.EnumMember);
1022
+ if (enumMembers.length === 0) return;
1023
+ lines.push("## Members");
1024
+ lines.push("");
1025
+ lines.push("| Member | Value | Description |");
1026
+ lines.push("|--------|-------|-------------|");
1027
+ for (const member of enumMembers) {
1028
+ const value = member.defaultValue ?? "";
1029
+ const summary = member.comment?.summary;
1030
+ const description = summary == null ? "" : renderCommentShort(summary);
1031
+ lines.push(`| \`${member.name}\` | \`${value}\` | ${description} |`);
1032
+ }
1033
+ lines.push("");
1034
+ }
1035
+ function appendTypeAlias(lines, reflection) {
1036
+ if (reflection.kind !== ReflectionKind.TypeAlias || reflection.type == null) return;
1037
+ lines.push("## Type");
1038
+ lines.push("");
1039
+ lines.push("```typescript");
1040
+ lines.push(`type ${reflection.name} = ${reflection.type.toString()}`);
1041
+ lines.push("```");
1042
+ lines.push("");
1043
+ }
1044
+ function appendSourceSection(lines, context, reflection) {
1045
+ if (!context.config.markdown.sourceLinks) return;
1046
+ const source = reflection.sources?.[0];
1047
+ if (source == null) return;
1048
+ lines.push("## Source");
1049
+ lines.push("");
1050
+ const sourceUrl = getSourceUrl(context.config.markdown.sourceBaseUrl, source.fileName, source.line);
1051
+ if (sourceUrl == null) lines.push(`${source.fileName}:${source.line}`);
1052
+ else lines.push(`[${source.fileName}:${source.line}](${sourceUrl})`);
1053
+ lines.push("");
1054
+ }
1055
+ function appendNavigation(params) {
1056
+ const { context, lines, navigation, reflection } = params;
1057
+ const line = createNavigationLine({
1058
+ basePath: context.basePath,
1059
+ kind: reflection.kind,
1060
+ navigation
1061
+ });
1062
+ if (line == null) return;
1063
+ lines.push("---");
1064
+ lines.push("");
1065
+ lines.push(line);
1066
+ lines.push("");
1067
+ }
1068
+ //#endregion
1069
+ //#region src/typedoc/generator-docs.ts
1070
+ function generateMarkdownDocs(context) {
1071
+ const grouped = groupProjectChildren(context.project, isReactComponent);
1072
+ const docs = [generateIndexPage(context, grouped)];
1073
+ addGroupedFunctionPages(context, docs, grouped.functionsByFile);
1074
+ addGroupedTypePages(context, docs, grouped.typesByFile);
1075
+ addComponentPages(context, docs, grouped.componentItems);
1076
+ addStandalonePages(context, docs, grouped.standaloneItems);
1077
+ docs.push(...generateCategoryIndexPages(context, grouped));
1078
+ return docs;
1079
+ }
1080
+ function addGroupedFunctionPages(context, docs, functionsByFile) {
1081
+ for (const [sourceFile, functions] of functionsByFile) docs.push(generateGroupedFunctionsPage({
1082
+ context,
1083
+ functions,
1084
+ sourceFile
1085
+ }));
1086
+ }
1087
+ function addGroupedTypePages(context, docs, typesByFile) {
1088
+ for (const [sourceFile, types] of typesByFile) docs.push(generateGroupedTypesPage({
1089
+ context,
1090
+ sourceFile,
1091
+ types
1092
+ }));
1093
+ }
1094
+ function addComponentPages(context, docs, componentItems) {
1095
+ const sorted = sortReflectionsByName(componentItems);
1096
+ for (const [index, component] of sorted.entries()) docs.push(generateComponentPage({
1097
+ component,
1098
+ context,
1099
+ navigation: getNavigation(sorted, index)
1100
+ }));
1101
+ }
1102
+ function addStandalonePages(context, docs, standaloneItems) {
1103
+ const itemsByKind = groupStandaloneByKind(standaloneItems);
1104
+ for (const items of itemsByKind.values()) {
1105
+ const sorted = sortReflectionsByName(items);
1106
+ for (const [index, reflection] of sorted.entries()) docs.push(...generateReflectionDocs({
1107
+ context,
1108
+ navigation: getNavigation(sorted, index),
1109
+ parentPath: "",
1110
+ reflection
1111
+ }));
1112
+ }
1113
+ }
1114
+ function groupStandaloneByKind(standaloneItems) {
1115
+ const itemsByKind = /* @__PURE__ */ new Map();
1116
+ for (const item of standaloneItems) {
1117
+ const existing = itemsByKind.get(item.kind) ?? [];
1118
+ existing.push(item);
1119
+ itemsByKind.set(item.kind, existing);
1120
+ }
1121
+ return itemsByKind;
1122
+ }
1123
+ function getNavigation(sortedItems, index) {
1124
+ return {
1125
+ next: index < sortedItems.length - 1 ? sortedItems[index + 1] : null,
1126
+ prev: index > 0 ? sortedItems[index - 1] : null
1127
+ };
1128
+ }
1129
+ //#endregion
1130
+ //#region src/typedoc/generator.ts
1131
+ var TypeDocGenerator = class {
1132
+ basePath;
1133
+ config;
1134
+ packageNameCache = /* @__PURE__ */ new Map();
1135
+ constructor(config) {
1136
+ this.config = resolveTypeDocConfig(config);
1137
+ this.basePath = `/${this.config.out}`;
1138
+ }
1139
+ async generate(outputDir) {
1140
+ await this.populatePackageNameCache();
1141
+ const project = await (await Application.bootstrapWithPlugins(getTypedocOptions(this.config), [new TSConfigReader(), new TypeDocReader()])).convert();
1142
+ if (project == null) throw new Error("TypeDoc conversion failed");
1143
+ const docs = generateMarkdownDocs({
1144
+ basePath: this.basePath,
1145
+ config: this.config,
1146
+ packageNameCache: this.packageNameCache,
1147
+ project
1148
+ });
1149
+ await this.writeDocs(outputDir, docs);
1150
+ return docs;
1151
+ }
1152
+ async populatePackageNameCache() {
1153
+ for (const entryPoint of this.config.entryPoints) await this.resolvePackageName(entryPoint);
1154
+ }
1155
+ async resolvePackageName(filePath) {
1156
+ const directory = path.dirname(path.resolve(filePath));
1157
+ if (this.packageNameCache.has(directory)) return this.packageNameCache.get(directory);
1158
+ const packageName = (await readPackageUp({ cwd: directory }))?.packageJson.name;
1159
+ const resolvedName = packageName == null || packageName.length === 0 ? void 0 : packageName.replace(/^@[^/]+\//u, "");
1160
+ this.packageNameCache.set(directory, resolvedName);
1161
+ return resolvedName;
1162
+ }
1163
+ async writeDocs(outputDir, docs) {
1164
+ const apiDirectory = path.join(outputDir, this.config.out);
1165
+ await fs.rm(apiDirectory, {
1166
+ force: true,
1167
+ recursive: true
1168
+ });
1169
+ await fs.mkdir(apiDirectory, { recursive: true });
1170
+ for (const doc of docs) await this.writeSingleDoc(apiDirectory, doc);
1171
+ }
1172
+ async writeSingleDoc(apiDirectory, doc) {
1173
+ const filePath = path.join(apiDirectory, doc.path);
1174
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
1175
+ const frontmatter = createFrontmatter(doc);
1176
+ await fs.writeFile(filePath, `${frontmatter}${doc.content}`);
1177
+ }
1178
+ };
1179
+ function createFrontmatter(doc) {
1180
+ const lines = ["---", `title: ${doc.frontmatter.title}`];
1181
+ if (doc.frontmatter.description != null && doc.frontmatter.description.length > 0) lines.push(`description: ${doc.frontmatter.description}`);
1182
+ if (doc.frontmatter.sidebar_position != null) lines.push(`sidebar_position: ${doc.frontmatter.sidebar_position}`);
1183
+ if (doc.frontmatter.sidebar === false) lines.push("sidebar: false");
1184
+ lines.push("---", "");
1185
+ return `${lines.join("\n")}\n`;
1186
+ }
1187
+ async function generateApiDocs(config, outputDir) {
1188
+ return new TypeDocGenerator(config).generate(outputDir);
1189
+ }
1190
+ //#endregion
1191
+ export { generateApiDocs as n, TypeDocGenerator as t };
1192
+
1193
+ //# sourceMappingURL=generator-DcUomVnD.js.map