typedoc 0.27.9 → 0.28.0-beta.1

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 (324) hide show
  1. package/README.md +26 -26
  2. package/bin/package.json +1 -1
  3. package/dist/browser-locales/en.d.ts +2 -0
  4. package/dist/browser-locales/en.js +62 -0
  5. package/dist/browser-locales/ja.d.ts +2 -0
  6. package/dist/browser-locales/ja.js +62 -0
  7. package/dist/browser-locales/ko.d.ts +2 -0
  8. package/dist/browser-locales/ko.js +62 -0
  9. package/dist/browser-locales/zh.d.ts +2 -0
  10. package/dist/browser-locales/zh.js +62 -0
  11. package/dist/browser-utils.d.ts +3 -0
  12. package/dist/browser-utils.js +3 -0
  13. package/dist/index.d.ts +15 -9
  14. package/dist/index.js +13 -7
  15. package/dist/lib/application.d.ts +9 -10
  16. package/dist/lib/application.js +75 -56
  17. package/dist/lib/cli.js +4 -3
  18. package/dist/lib/converter/comments/blockLexer.js +2 -2
  19. package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +1 -1
  20. package/dist/lib/converter/comments/declarationReferenceResolver.js +8 -10
  21. package/dist/lib/converter/comments/discovery.d.ts +1 -1
  22. package/dist/lib/converter/comments/discovery.js +3 -4
  23. package/dist/lib/converter/comments/index.d.ts +1 -1
  24. package/dist/lib/converter/comments/index.js +5 -7
  25. package/dist/lib/converter/comments/linkResolver.d.ts +1 -1
  26. package/dist/lib/converter/comments/linkResolver.js +10 -16
  27. package/dist/lib/converter/comments/parser.d.ts +2 -2
  28. package/dist/lib/converter/comments/parser.js +8 -8
  29. package/dist/lib/converter/comments/textParser.d.ts +3 -2
  30. package/dist/lib/converter/comments/textParser.js +1 -2
  31. package/dist/lib/converter/context.d.ts +13 -14
  32. package/dist/lib/converter/context.js +49 -13
  33. package/dist/lib/converter/converter.d.ts +10 -5
  34. package/dist/lib/converter/converter.js +59 -42
  35. package/dist/lib/converter/factories/index-signature.js +3 -2
  36. package/dist/lib/converter/factories/signature.js +5 -6
  37. package/dist/lib/converter/factories/symbol-id.d.ts +4 -0
  38. package/dist/lib/converter/factories/symbol-id.js +92 -0
  39. package/dist/lib/converter/factories/types.d.ts +4 -0
  40. package/dist/lib/converter/factories/types.js +13 -0
  41. package/dist/lib/converter/index.d.ts +3 -4
  42. package/dist/lib/converter/index.js +2 -2
  43. package/dist/lib/converter/jsdoc.js +5 -4
  44. package/dist/lib/converter/plugins/CategoryPlugin.js +4 -2
  45. package/dist/lib/converter/plugins/CommentPlugin.d.ts +0 -1
  46. package/dist/lib/converter/plugins/CommentPlugin.js +8 -6
  47. package/dist/lib/converter/plugins/GroupPlugin.d.ts +2 -3
  48. package/dist/lib/converter/plugins/GroupPlugin.js +8 -7
  49. package/dist/lib/converter/plugins/ImplementsPlugin.js +6 -8
  50. package/dist/lib/converter/plugins/IncludePlugin.d.ts +1 -1
  51. package/dist/lib/converter/plugins/IncludePlugin.js +19 -16
  52. package/dist/lib/converter/plugins/InheritDocPlugin.js +7 -9
  53. package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +3 -2
  54. package/dist/lib/converter/plugins/PackagePlugin.d.ts +3 -2
  55. package/dist/lib/converter/plugins/PackagePlugin.js +23 -19
  56. package/dist/lib/converter/plugins/SourcePlugin.d.ts +2 -1
  57. package/dist/lib/converter/plugins/SourcePlugin.js +10 -9
  58. package/dist/lib/converter/plugins/TypePlugin.d.ts +1 -1
  59. package/dist/lib/converter/plugins/TypePlugin.js +1 -1
  60. package/dist/lib/converter/plugins/index.d.ts +1 -1
  61. package/dist/lib/converter/plugins/index.js +1 -1
  62. package/dist/lib/converter/symbols.js +103 -32
  63. package/dist/lib/converter/types.js +14 -13
  64. package/dist/lib/converter/utils/repository.d.ts +1 -1
  65. package/dist/lib/converter/utils/repository.js +2 -2
  66. package/dist/lib/debug/index.d.ts +2 -2
  67. package/dist/lib/debug/index.js +2 -2
  68. package/dist/lib/debug/{debugReflectionLifetimes.d.ts → reflectionLifetimes.d.ts} +2 -1
  69. package/dist/lib/debug/{debugReflectionLifetimes.js → reflectionLifetimes.js} +12 -4
  70. package/dist/lib/debug/{debugRendererUrls.d.ts → rendererUrls.d.ts} +1 -0
  71. package/dist/lib/debug/rendererUrls.js +68 -0
  72. package/dist/lib/internationalization/index.d.ts +2 -1
  73. package/dist/lib/internationalization/index.js +2 -1
  74. package/dist/lib/internationalization/internationalization.d.ts +16 -46
  75. package/dist/lib/internationalization/internationalization.js +44 -213
  76. package/dist/lib/internationalization/locales/en.cjs +9 -1
  77. package/dist/lib/internationalization/locales/en.d.cts +9 -1
  78. package/dist/lib/internationalization/locales/ja.cjs +1 -0
  79. package/dist/lib/internationalization/locales/zh.cjs +61 -5
  80. package/dist/lib/internationalization/locales/zh.d.cts +26 -2
  81. package/dist/lib/internationalization/translatable.d.ts +2 -1
  82. package/dist/lib/models/{comments/comment.d.ts → Comment.d.ts} +9 -8
  83. package/dist/lib/models/{comments/comment.js → Comment.js} +15 -18
  84. package/dist/lib/models/{reflections/container.d.ts → ContainerReflection.d.ts} +6 -6
  85. package/dist/lib/models/{reflections/container.js → ContainerReflection.js} +4 -5
  86. package/dist/lib/models/{reflections/declaration.d.ts → DeclarationReflection.d.ts} +11 -19
  87. package/dist/lib/models/{reflections/declaration.js → DeclarationReflection.js} +11 -29
  88. package/dist/lib/models/{reflections/document.d.ts → DocumentReflection.d.ts} +3 -3
  89. package/dist/lib/models/{reflections/document.js → DocumentReflection.js} +3 -3
  90. package/dist/lib/models/FileRegistry.d.ts +12 -20
  91. package/dist/lib/models/FileRegistry.js +8 -44
  92. package/dist/lib/models/{reflections/parameter.d.ts → ParameterReflection.d.ts} +4 -4
  93. package/dist/lib/models/{reflections/parameter.js → ParameterReflection.js} +2 -2
  94. package/dist/lib/models/{reflections/project.d.ts → ProjectReflection.d.ts} +12 -21
  95. package/dist/lib/models/{reflections/project.js → ProjectReflection.js} +16 -48
  96. package/dist/lib/models/{reflections/reference.d.ts → ReferenceReflection.d.ts} +3 -3
  97. package/dist/lib/models/{reflections/reference.js → ReferenceReflection.js} +3 -4
  98. package/dist/lib/models/{reflections/abstract.d.ts → Reflection.d.ts} +15 -28
  99. package/dist/lib/models/{reflections/abstract.js → Reflection.js} +38 -21
  100. package/dist/lib/models/ReflectionCategory.d.ts +2 -6
  101. package/dist/lib/models/ReflectionCategory.js +3 -9
  102. package/dist/lib/models/ReflectionGroup.d.ts +1 -5
  103. package/dist/lib/models/ReflectionGroup.js +2 -8
  104. package/dist/lib/models/{reflections/ReflectionSymbolId.d.ts → ReflectionSymbolId.d.ts} +23 -10
  105. package/dist/lib/models/ReflectionSymbolId.js +75 -0
  106. package/dist/lib/models/{reflections/signature.d.ts → SignatureReflection.d.ts} +8 -7
  107. package/dist/lib/models/{reflections/signature.js → SignatureReflection.js} +7 -11
  108. package/dist/lib/models/{sources/file.d.ts → SourceReference.d.ts} +3 -4
  109. package/dist/lib/models/{reflections/type-parameter.d.ts → TypeParameterReflection.d.ts} +6 -5
  110. package/dist/lib/models/{reflections/type-parameter.js → TypeParameterReflection.js} +4 -1
  111. package/dist/lib/models/index.d.ts +18 -6
  112. package/dist/lib/models/index.js +18 -6
  113. package/dist/lib/models/{reflections/kind.d.ts → kind.d.ts} +2 -8
  114. package/dist/lib/models/{reflections/kind.js → kind.js} +99 -30
  115. package/dist/lib/models/types.d.ts +8 -10
  116. package/dist/lib/models/types.js +11 -22
  117. package/dist/lib/models/{reflections/variant.d.ts → variant.d.ts} +7 -7
  118. package/dist/lib/output/components.d.ts +2 -2
  119. package/dist/lib/output/components.js +1 -1
  120. package/dist/lib/output/events.d.ts +10 -18
  121. package/dist/lib/output/events.js +10 -27
  122. package/dist/lib/output/formatter.d.ts +8 -5
  123. package/dist/lib/output/formatter.js +45 -18
  124. package/dist/lib/output/index.d.ts +4 -5
  125. package/dist/lib/output/index.js +4 -4
  126. package/dist/lib/output/output.js +5 -4
  127. package/dist/lib/output/plugins/AssetsPlugin.js +7 -6
  128. package/dist/lib/output/plugins/HierarchyPlugin.js +4 -3
  129. package/dist/lib/output/plugins/IconsPlugin.js +3 -3
  130. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +12 -17
  131. package/dist/lib/output/plugins/SitemapPlugin.js +6 -7
  132. package/dist/lib/output/renderer.d.ts +22 -14
  133. package/dist/lib/output/renderer.js +76 -36
  134. package/dist/lib/output/router.d.ts +175 -0
  135. package/dist/lib/output/router.js +478 -0
  136. package/dist/lib/output/theme.d.ts +3 -28
  137. package/dist/lib/output/theme.js +2 -15
  138. package/dist/lib/output/themes/MarkedPlugin.d.ts +2 -2
  139. package/dist/lib/output/themes/MarkedPlugin.js +32 -30
  140. package/dist/lib/output/themes/default/DefaultTheme.d.ts +11 -40
  141. package/dist/lib/output/themes/default/DefaultTheme.js +207 -406
  142. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +49 -47
  143. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +17 -14
  144. package/dist/lib/output/themes/default/Slugger.js +1 -1
  145. package/dist/lib/output/themes/default/layouts/default.d.ts +1 -1
  146. package/dist/lib/output/themes/default/layouts/default.js +6 -6
  147. package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +4 -1
  148. package/dist/lib/output/themes/default/partials/anchor-icon.js +12 -2
  149. package/dist/lib/output/themes/default/partials/breadcrumb.d.ts +2 -2
  150. package/dist/lib/output/themes/default/partials/breadcrumb.js +11 -5
  151. package/dist/lib/output/themes/default/partials/comment.d.ts +1 -1
  152. package/dist/lib/output/themes/default/partials/comment.js +9 -9
  153. package/dist/lib/output/themes/default/partials/footer.d.ts +1 -1
  154. package/dist/lib/output/themes/default/partials/footer.js +2 -2
  155. package/dist/lib/output/themes/default/partials/header.d.ts +2 -2
  156. package/dist/lib/output/themes/default/partials/header.js +4 -3
  157. package/dist/lib/output/themes/default/partials/hierarchy.d.ts +1 -1
  158. package/dist/lib/output/themes/default/partials/hierarchy.js +10 -8
  159. package/dist/lib/output/themes/default/partials/icon.d.ts +2 -3
  160. package/dist/lib/output/themes/default/partials/icon.js +3 -3
  161. package/dist/lib/output/themes/default/partials/index.d.ts +1 -1
  162. package/dist/lib/output/themes/default/partials/index.js +10 -18
  163. package/dist/lib/output/themes/default/partials/member.d.ts +1 -1
  164. package/dist/lib/output/themes/default/partials/member.declaration.d.ts +1 -1
  165. package/dist/lib/output/themes/default/partials/member.declaration.js +2 -2
  166. package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +1 -1
  167. package/dist/lib/output/themes/default/partials/member.getterSetter.js +5 -5
  168. package/dist/lib/output/themes/default/partials/member.js +10 -9
  169. package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +1 -1
  170. package/dist/lib/output/themes/default/partials/member.signature.body.js +4 -4
  171. package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +1 -1
  172. package/dist/lib/output/themes/default/partials/member.signature.title.js +1 -1
  173. package/dist/lib/output/themes/default/partials/member.signatures.d.ts +1 -1
  174. package/dist/lib/output/themes/default/partials/member.signatures.js +4 -4
  175. package/dist/lib/output/themes/default/partials/member.sources.d.ts +1 -1
  176. package/dist/lib/output/themes/default/partials/member.sources.js +7 -7
  177. package/dist/lib/output/themes/default/partials/members.d.ts +1 -1
  178. package/dist/lib/output/themes/default/partials/members.js +2 -2
  179. package/dist/lib/output/themes/default/partials/moduleReflection.d.ts +2 -2
  180. package/dist/lib/output/themes/default/partials/moduleReflection.js +5 -5
  181. package/dist/lib/output/themes/default/partials/navigation.d.ts +1 -1
  182. package/dist/lib/output/themes/default/partials/navigation.js +17 -15
  183. package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +1 -1
  184. package/dist/lib/output/themes/default/partials/reflectionPreview.js +2 -2
  185. package/dist/lib/output/themes/default/partials/toolbar.d.ts +1 -1
  186. package/dist/lib/output/themes/default/partials/toolbar.js +10 -13
  187. package/dist/lib/output/themes/default/partials/type.d.ts +1 -1
  188. package/dist/lib/output/themes/default/partials/type.js +1 -1
  189. package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +1 -1
  190. package/dist/lib/output/themes/default/partials/typeAndParent.js +3 -3
  191. package/dist/lib/output/themes/default/partials/typeDetails.d.ts +1 -1
  192. package/dist/lib/output/themes/default/partials/typeDetails.js +23 -19
  193. package/dist/lib/output/themes/default/partials/typeParameters.d.ts +1 -1
  194. package/dist/lib/output/themes/default/partials/typeParameters.js +12 -7
  195. package/dist/lib/output/themes/default/templates/document.d.ts +1 -1
  196. package/dist/lib/output/themes/default/templates/document.js +2 -2
  197. package/dist/lib/output/themes/default/templates/hierarchy.d.ts +1 -1
  198. package/dist/lib/output/themes/default/templates/hierarchy.js +4 -3
  199. package/dist/lib/output/themes/default/templates/index.d.ts +1 -1
  200. package/dist/lib/output/themes/default/templates/index.js +2 -2
  201. package/dist/lib/output/themes/default/templates/reflection.d.ts +1 -1
  202. package/dist/lib/output/themes/default/templates/reflection.js +9 -12
  203. package/dist/lib/output/themes/lib.d.ts +1 -1
  204. package/dist/lib/output/themes/lib.js +3 -3
  205. package/dist/lib/serialization/components.d.ts +1 -1
  206. package/dist/lib/serialization/deserializer.d.ts +9 -13
  207. package/dist/lib/serialization/deserializer.js +22 -24
  208. package/dist/lib/serialization/events.d.ts +1 -1
  209. package/dist/lib/serialization/index.d.ts +1 -1
  210. package/dist/lib/serialization/index.js +1 -1
  211. package/dist/lib/serialization/schema.d.ts +15 -10
  212. package/dist/lib/serialization/schema.js +1 -1
  213. package/dist/lib/serialization/serializer.d.ts +4 -4
  214. package/dist/lib/serialization/serializer.js +1 -2
  215. package/dist/lib/utils/ValidatingFileRegistry.d.ts +10 -0
  216. package/dist/lib/utils/ValidatingFileRegistry.js +34 -0
  217. package/dist/lib/utils/component.d.ts +1 -1
  218. package/dist/lib/utils/component.js +1 -1
  219. package/dist/lib/utils/entry-point.d.ts +3 -3
  220. package/dist/lib/utils/entry-point.js +29 -26
  221. package/dist/lib/utils/fs.d.ts +5 -13
  222. package/dist/lib/utils/fs.js +11 -67
  223. package/dist/lib/utils/general.d.ts +1 -47
  224. package/dist/lib/utils/general.js +4 -74
  225. package/dist/lib/utils/highlighter.js +1 -2
  226. package/dist/lib/utils/html.d.ts +0 -1
  227. package/dist/lib/utils/html.js +4 -13
  228. package/dist/lib/utils/index.d.ts +9 -17
  229. package/dist/lib/utils/index.js +8 -15
  230. package/dist/lib/utils/loggers.d.ts +5 -108
  231. package/dist/lib/utils/loggers.js +24 -168
  232. package/dist/lib/utils/options/declaration.d.ts +63 -38
  233. package/dist/lib/utils/options/declaration.js +124 -66
  234. package/dist/lib/utils/options/defaults.d.ts +1 -1
  235. package/dist/lib/utils/options/help.d.ts +1 -2
  236. package/dist/lib/utils/options/help.js +5 -5
  237. package/dist/lib/utils/options/index.d.ts +4 -4
  238. package/dist/lib/utils/options/index.js +3 -3
  239. package/dist/lib/utils/options/options.d.ts +3 -6
  240. package/dist/lib/utils/options/options.js +10 -12
  241. package/dist/lib/utils/options/readers/arguments.d.ts +2 -2
  242. package/dist/lib/utils/options/readers/arguments.js +4 -3
  243. package/dist/lib/utils/options/readers/package-json.d.ts +1 -1
  244. package/dist/lib/utils/options/readers/package-json.js +3 -2
  245. package/dist/lib/utils/options/readers/tsconfig.d.ts +1 -1
  246. package/dist/lib/utils/options/readers/tsconfig.js +27 -27
  247. package/dist/lib/utils/options/readers/typedoc.d.ts +1 -1
  248. package/dist/lib/utils/options/readers/typedoc.js +8 -9
  249. package/dist/lib/utils/options/sources/typedoc.js +143 -135
  250. package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
  251. package/dist/lib/utils/options/tsdoc-defaults.js +3 -1
  252. package/dist/lib/utils/package-manifest.d.ts +3 -3
  253. package/dist/lib/utils/package-manifest.js +9 -8
  254. package/dist/lib/utils/paths.d.ts +17 -6
  255. package/dist/lib/utils/paths.js +94 -11
  256. package/dist/lib/utils/perf.d.ts +4 -1
  257. package/dist/lib/utils/perf.js +32 -13
  258. package/dist/lib/utils/plugins.js +4 -3
  259. package/dist/lib/utils/sort.d.ts +1 -1
  260. package/dist/lib/utils/sort.js +8 -3
  261. package/dist/lib/utils/tsconfig.d.ts +1 -1
  262. package/dist/lib/utils/tsconfig.js +4 -3
  263. package/dist/lib/utils-common/general.d.ts +40 -0
  264. package/dist/lib/utils-common/general.js +20 -0
  265. package/dist/lib/utils-common/i18n.d.ts +17 -0
  266. package/dist/lib/utils-common/i18n.js +39 -0
  267. package/dist/lib/utils-common/index.d.ts +16 -0
  268. package/dist/lib/utils-common/index.js +18 -0
  269. package/dist/lib/{utils → utils-common}/jsx.d.ts +3 -3
  270. package/dist/lib/{utils → utils-common}/jsx.js +1 -1
  271. package/dist/lib/utils-common/logger.d.ts +86 -0
  272. package/dist/lib/utils-common/logger.js +120 -0
  273. package/dist/lib/{utils → utils-common}/minimalSourceFile.d.ts +7 -2
  274. package/dist/lib/{utils → utils-common}/minimalSourceFile.js +3 -2
  275. package/dist/lib/utils-common/path.d.ts +35 -0
  276. package/dist/lib/utils-common/path.js +123 -0
  277. package/dist/lib/utils-common/string.d.ts +11 -0
  278. package/dist/lib/utils-common/string.js +84 -0
  279. package/dist/lib/validation/documentation.d.ts +2 -2
  280. package/dist/lib/validation/documentation.js +5 -6
  281. package/dist/lib/validation/exports.d.ts +1 -1
  282. package/dist/lib/validation/exports.js +4 -4
  283. package/dist/lib/validation/links.d.ts +1 -1
  284. package/dist/lib/validation/links.js +9 -8
  285. package/dist/lib/validation/unusedMergeModuleWith.d.ts +1 -1
  286. package/dist/lib/validation/unusedMergeModuleWith.js +3 -2
  287. package/package.json +57 -36
  288. package/static/main.js +4 -4
  289. package/static/style.css +232 -209
  290. package/tsdoc.json +8 -0
  291. package/dist/lib/debug/debugRendererUrls.js +0 -59
  292. package/dist/lib/internationalization/locales/jp.cjs +0 -3
  293. package/dist/lib/internationalization/locales/jp.d.cts +0 -2
  294. package/dist/lib/models/comments/index.d.ts +0 -2
  295. package/dist/lib/models/comments/index.js +0 -1
  296. package/dist/lib/models/reflections/ReflectionSymbolId.js +0 -133
  297. package/dist/lib/models/reflections/index.d.ts +0 -15
  298. package/dist/lib/models/reflections/index.js +0 -12
  299. package/dist/lib/models/sources/index.d.ts +0 -1
  300. package/dist/lib/models/sources/index.js +0 -1
  301. package/dist/lib/output/models/UrlMapping.d.ts +0 -13
  302. package/dist/lib/output/models/UrlMapping.js +0 -10
  303. /package/dist/lib/models/{sources/file.js → SourceReference.js} +0 -0
  304. /package/dist/lib/models/{reflections/utils.d.ts → utils.d.ts} +0 -0
  305. /package/dist/lib/models/{reflections/utils.js → utils.js} +0 -0
  306. /package/dist/lib/models/{reflections/variant.js → variant.js} +0 -0
  307. /package/dist/lib/{utils → utils-common}/array.d.ts +0 -0
  308. /package/dist/lib/{utils → utils-common}/array.js +0 -0
  309. /package/dist/lib/{converter/comments → utils-common}/declarationReference.d.ts +0 -0
  310. /package/dist/lib/{converter/comments → utils-common}/declarationReference.js +0 -0
  311. /package/dist/lib/{utils → utils-common}/enum.d.ts +0 -0
  312. /package/dist/lib/{utils → utils-common}/enum.js +0 -0
  313. /package/dist/lib/{utils → utils-common}/events.d.ts +0 -0
  314. /package/dist/lib/{utils → utils-common}/events.js +0 -0
  315. /package/dist/lib/{utils → utils-common}/hooks.d.ts +0 -0
  316. /package/dist/lib/{utils → utils-common}/hooks.js +0 -0
  317. /package/dist/lib/{utils → utils-common}/jsx.elements.d.ts +0 -0
  318. /package/dist/lib/{utils → utils-common}/jsx.elements.js +0 -0
  319. /package/dist/lib/{utils → utils-common}/map.d.ts +0 -0
  320. /package/dist/lib/{utils → utils-common}/map.js +0 -0
  321. /package/dist/lib/{utils → utils-common}/set.d.ts +0 -0
  322. /package/dist/lib/{utils → utils-common}/set.js +0 -0
  323. /package/dist/lib/{utils → utils-common}/validation.d.ts +0 -0
  324. /package/dist/lib/{utils → utils-common}/validation.js +0 -0
@@ -1,436 +1,237 @@
1
- var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
- var _, done = false;
7
- for (var i = decorators.length - 1; i >= 0; i--) {
8
- var context = {};
9
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
- if (kind === "accessor") {
14
- if (result === void 0) continue;
15
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
- if (_ = accept(result.get)) descriptor.get = _;
17
- if (_ = accept(result.set)) descriptor.set = _;
18
- if (_ = accept(result.init)) initializers.unshift(_);
19
- }
20
- else if (_ = accept(result)) {
21
- if (kind === "field") initializers.unshift(_);
22
- else descriptor[key] = _;
23
- }
24
- }
25
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
- done = true;
27
- };
28
- var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
- var useValue = arguments.length > 2;
30
- for (var i = 0; i < initializers.length; i++) {
31
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
- }
33
- return useValue ? value : void 0;
34
- };
35
1
  import { Theme } from "../../theme.js";
36
- import { ReflectionKind, ProjectReflection, DeclarationReflection, SignatureReflection, ReflectionCategory, ReflectionGroup, TypeParameterReflection, ReferenceReflection, } from "../../../models/index.js";
37
- import { UrlMapping } from "../../models/UrlMapping.js";
2
+ import { ReferenceReflection, ReflectionCategory, ReflectionGroup, ReflectionKind, } from "../../../models/index.js";
38
3
  import { DefaultThemeRenderContext } from "./DefaultThemeRenderContext.js";
39
- import { filterMap, JSX, Option } from "../../../utils/index.js";
40
- import { classNames, getDisplayName, getHierarchyRoots, toStyleClass } from "../lib.js";
41
4
  import { getIcons } from "./partials/icon.js";
42
- import { Slugger } from "./Slugger.js";
43
- import { createNormalizedUrl } from "../../../utils/html.js";
44
- let DefaultTheme = (() => {
45
- let _classSuper = Theme;
46
- let _sluggerConfiguration_decorators;
47
- let _sluggerConfiguration_initializers = [];
48
- let _sluggerConfiguration_extraInitializers = [];
49
- return class DefaultTheme extends _classSuper {
50
- static {
51
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
52
- _sluggerConfiguration_decorators = [Option("sluggerConfiguration")];
53
- __esDecorate(this, null, _sluggerConfiguration_decorators, { kind: "accessor", name: "sluggerConfiguration", static: false, private: false, access: { has: obj => "sluggerConfiguration" in obj, get: obj => obj.sluggerConfiguration, set: (obj, value) => { obj.sluggerConfiguration = value; } }, metadata: _metadata }, _sluggerConfiguration_initializers, _sluggerConfiguration_extraInitializers);
54
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
55
- }
56
- // Note: This will always contain lowercased names to avoid issues with
57
- // case-insensitive file systems.
58
- usedFileNames = new Set();
59
- #sluggerConfiguration_accessor_storage = __runInitializers(this, _sluggerConfiguration_initializers, void 0);
60
- get sluggerConfiguration() { return this.#sluggerConfiguration_accessor_storage; }
61
- set sluggerConfiguration(value) { this.#sluggerConfiguration_accessor_storage = value; }
62
- /** @internal */
63
- markedPlugin = __runInitializers(this, _sluggerConfiguration_extraInitializers);
64
- /**
65
- * The icons which will actually be rendered. The source of truth lives on the theme, and
66
- * the {@link DefaultThemeRenderContext.icons} member will produce references to these.
67
- *
68
- * These icons will be written twice. Once to an `icons.svg` file in the assets directory
69
- * which will be referenced by icons on the context, and once to an `icons.js` file so that
70
- * references to the icons can be dynamically embedded within the page for use by the search
71
- * dropdown and when loading the page on `file://` urls.
72
- *
73
- * Custom themes may overwrite this entire object or individual properties on it to customize
74
- * the icons used within the page, however TypeDoc currently assumes that all icons are svg
75
- * elements, so custom themes must also use svg elements.
76
- */
77
- icons;
78
- getRenderContext(pageEvent) {
79
- return new DefaultThemeRenderContext(this, pageEvent, this.application.options);
5
+ import { filterMap, JSX } from "#utils";
6
+ import { classNames, getDisplayName, toStyleClass } from "../lib.js";
7
+ import { PageKind } from "../../router.js";
8
+ import { createNormalizedUrl } from "#node-utils";
9
+ export class DefaultTheme extends Theme {
10
+ // Note: This will always contain lowercased names to avoid issues with
11
+ // case-insensitive file systems.
12
+ usedFileNames = new Set();
13
+ /** @internal */
14
+ markedPlugin;
15
+ router;
16
+ /**
17
+ * The icons which will actually be rendered. The source of truth lives on the theme, and
18
+ * the {@link DefaultThemeRenderContext.icons} member will produce references to these.
19
+ *
20
+ * These icons will be written twice. Once to an `icons.svg` file in the assets directory
21
+ * which will be referenced by icons on the context, and once to an `icons.js` file so that
22
+ * references to the icons can be dynamically embedded within the page for use by the search
23
+ * dropdown and when loading the page on `file://` urls.
24
+ *
25
+ * Custom themes may overwrite this entire object or individual properties on it to customize
26
+ * the icons used within the page, however TypeDoc currently assumes that all icons are svg
27
+ * elements, so custom themes must also use svg elements.
28
+ */
29
+ icons;
30
+ ContextClass = DefaultThemeRenderContext;
31
+ getRenderContext(pageEvent) {
32
+ return new this.ContextClass(this.router, this, pageEvent, this.application.options);
33
+ }
34
+ documentTemplate = (pageEvent) => {
35
+ return this.getRenderContext(pageEvent).documentTemplate(pageEvent);
36
+ };
37
+ reflectionTemplate = (pageEvent) => {
38
+ return this.getRenderContext(pageEvent).reflectionTemplate(pageEvent);
39
+ };
40
+ indexTemplate = (pageEvent) => {
41
+ return this.getRenderContext(pageEvent).indexTemplate(pageEvent);
42
+ };
43
+ hierarchyTemplate = (pageEvent) => {
44
+ return this.getRenderContext(pageEvent).hierarchyTemplate(pageEvent);
45
+ };
46
+ defaultLayoutTemplate = (pageEvent, template) => {
47
+ return this.getRenderContext(pageEvent).defaultLayout(template, pageEvent);
48
+ };
49
+ getReflectionClasses(reflection) {
50
+ const filters = this.application.options.getValue("visibilityFilters");
51
+ return getReflectionClasses(reflection, filters);
52
+ }
53
+ /**
54
+ * Create a new DefaultTheme instance.
55
+ *
56
+ * @param renderer The renderer this theme is attached to.
57
+ */
58
+ constructor(renderer) {
59
+ super(renderer);
60
+ this.icons = getIcons();
61
+ this.markedPlugin = renderer.markedPlugin;
62
+ this.router = renderer.router;
63
+ }
64
+ /**
65
+ * @param reflection The reflection the url should be generated for.
66
+ */
67
+ getFileName(reflection) {
68
+ const parts = [createNormalizedUrl(reflection.name)];
69
+ while (reflection.parent && !reflection.parent.isProject()) {
70
+ reflection = reflection.parent;
71
+ parts.unshift(createNormalizedUrl(reflection.name));
80
72
  }
81
- documentTemplate = (pageEvent) => {
82
- return this.getRenderContext(pageEvent).documentTemplate(pageEvent);
83
- };
84
- reflectionTemplate = (pageEvent) => {
85
- return this.getRenderContext(pageEvent).reflectionTemplate(pageEvent);
86
- };
87
- indexTemplate = (pageEvent) => {
88
- return this.getRenderContext(pageEvent).indexTemplate(pageEvent);
89
- };
90
- hierarchyTemplate = (pageEvent) => {
91
- return this.getRenderContext(pageEvent).hierarchyTemplate(pageEvent);
92
- };
93
- defaultLayoutTemplate = (pageEvent, template) => {
94
- return this.getRenderContext(pageEvent).defaultLayout(template, pageEvent);
95
- };
96
- getReflectionClasses(reflection) {
97
- const filters = this.application.options.getValue("visibilityFilters");
98
- return getReflectionClasses(reflection, filters);
73
+ const baseName = parts.join(".");
74
+ const lowerBaseName = baseName.toLocaleLowerCase();
75
+ if (this.usedFileNames.has(lowerBaseName)) {
76
+ let index = 1;
77
+ while (this.usedFileNames.has(`${lowerBaseName}-${index}`)) {
78
+ ++index;
79
+ }
80
+ this.usedFileNames.add(`${lowerBaseName}-${index}`);
81
+ return `${baseName}-${index}.html`;
99
82
  }
100
- /**
101
- * Mappings of reflections kinds to templates used by this theme.
102
- */
103
- mappings = [
104
- {
105
- kind: [ReflectionKind.Class],
106
- directory: "classes",
107
- template: this.reflectionTemplate,
108
- },
109
- {
110
- kind: [ReflectionKind.Interface],
111
- directory: "interfaces",
112
- template: this.reflectionTemplate,
113
- },
114
- {
115
- kind: [ReflectionKind.Enum],
116
- directory: "enums",
117
- template: this.reflectionTemplate,
118
- },
119
- {
120
- kind: [ReflectionKind.Namespace, ReflectionKind.Module],
121
- directory: "modules",
122
- template: this.reflectionTemplate,
123
- },
124
- {
125
- kind: [ReflectionKind.TypeAlias],
126
- directory: "types",
127
- template: this.reflectionTemplate,
128
- },
129
- {
130
- kind: [ReflectionKind.Function],
131
- directory: "functions",
132
- template: this.reflectionTemplate,
133
- },
134
- {
135
- kind: [ReflectionKind.Variable],
136
- directory: "variables",
137
- template: this.reflectionTemplate,
138
- },
139
- {
140
- kind: [ReflectionKind.Document],
141
- directory: "documents",
142
- template: this.documentTemplate,
143
- },
144
- ];
145
- static URL_PREFIX = /^(http|ftp)s?:\/\//;
146
- /**
147
- * Create a new DefaultTheme instance.
148
- *
149
- * @param renderer The renderer this theme is attached to.
150
- */
151
- constructor(renderer) {
152
- super(renderer);
153
- this.icons = getIcons(renderer.application.i18n);
154
- this.markedPlugin = renderer.markedPlugin;
83
+ this.usedFileNames.add(lowerBaseName);
84
+ return `${baseName}.html`;
85
+ }
86
+ render(page) {
87
+ const template = {
88
+ [PageKind.Index]: this.indexTemplate,
89
+ [PageKind.Document]: this.documentTemplate,
90
+ [PageKind.Hierarchy]: this.hierarchyTemplate,
91
+ [PageKind.Reflection]: this.reflectionTemplate,
92
+ }[page.pageKind];
93
+ const templateOutput = this.defaultLayoutTemplate(page, template);
94
+ return "<!DOCTYPE html>" + JSX.renderElement(templateOutput) + "\n";
95
+ }
96
+ _navigationCache;
97
+ /**
98
+ * If implementing a custom theme, it is recommended to override {@link buildNavigation} instead.
99
+ */
100
+ getNavigation(project) {
101
+ // This is ok because currently TypeDoc wipes out the theme after each render.
102
+ // Might need to change in the future, but it's fine for now.
103
+ if (this._navigationCache) {
104
+ return this._navigationCache;
155
105
  }
156
- /**
157
- * Map the models of the given project to the desired output files.
158
- *
159
- * @param project The project whose urls should be generated.
160
- * @returns A list of {@link UrlMapping} instances defining which models
161
- * should be rendered to which files.
162
- */
163
- getUrls(project) {
164
- this.usedFileNames = new Set();
165
- const urls = [];
166
- this.setSlugger(project, new Slugger(this.sluggerConfiguration));
167
- if (!project.readme?.length) {
168
- project.url = "index.html";
169
- urls.push(new UrlMapping("index.html", project, this.reflectionTemplate));
170
- }
171
- else {
172
- project.url = "modules.html";
173
- urls.push(new UrlMapping("modules.html", project, this.reflectionTemplate));
174
- urls.push(new UrlMapping("index.html", project, this.indexTemplate));
106
+ return (this._navigationCache = this.buildNavigation(project));
107
+ }
108
+ buildNavigation(project) {
109
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
110
+ const theme = this;
111
+ const router = this.router;
112
+ const opts = this.application.options.getValue("navigation");
113
+ const leaves = this.application.options.getValue("navigationLeaves");
114
+ return getNavigationElements(project) || [];
115
+ function toNavigation(element) {
116
+ if (opts.excludeReferences && element instanceof ReferenceReflection) {
117
+ return;
175
118
  }
176
- if (this.application.options.getValue("includeHierarchySummary") && getHierarchyRoots(project).length) {
177
- urls.push(new UrlMapping("hierarchy.html", project, this.hierarchyTemplate));
119
+ const children = getNavigationElements(element);
120
+ if (element instanceof ReflectionCategory || element instanceof ReflectionGroup) {
121
+ if (!children?.length) {
122
+ return;
123
+ }
124
+ return {
125
+ text: element.title,
126
+ children,
127
+ };
178
128
  }
179
- project.childrenIncludingDocuments?.forEach((child) => this.buildUrls(child, urls));
180
- return urls;
129
+ return {
130
+ text: getDisplayName(element),
131
+ path: router.getFullUrl(element),
132
+ kind: element.kind & ReflectionKind.Project ? undefined : element.kind,
133
+ class: classNames({ deprecated: element.isDeprecated() }, theme.getReflectionClasses(element)),
134
+ children: children?.length ? children : undefined,
135
+ };
181
136
  }
182
- /**
183
- * @param reflection The reflection the url should be generated for.
184
- */
185
- getFileName(reflection) {
186
- const parts = [createNormalizedUrl(reflection.name)];
187
- while (reflection.parent && !reflection.parent.isProject()) {
188
- reflection = reflection.parent;
189
- parts.unshift(createNormalizedUrl(reflection.name));
137
+ function getNavigationElements(parent) {
138
+ if (parent instanceof ReflectionCategory) {
139
+ return filterMap(parent.children, toNavigation);
190
140
  }
191
- const baseName = parts.join(".");
192
- const lowerBaseName = baseName.toLocaleLowerCase();
193
- if (this.usedFileNames.has(lowerBaseName)) {
194
- let index = 1;
195
- while (this.usedFileNames.has(`${lowerBaseName}-${index}`)) {
196
- ++index;
141
+ if (parent instanceof ReflectionGroup) {
142
+ if (shouldShowCategories(parent.owningReflection, opts) && parent.categories) {
143
+ return filterMap(parent.categories, toNavigation);
197
144
  }
198
- this.usedFileNames.add(`${lowerBaseName}-${index}`);
199
- return `${baseName}-${index}.html`;
145
+ return filterMap(parent.children, toNavigation);
200
146
  }
201
- this.usedFileNames.add(lowerBaseName);
202
- return `${baseName}.html`;
203
- }
204
- /**
205
- * Return the template mapping for the given reflection.
206
- *
207
- * @param reflection The reflection whose mapping should be resolved.
208
- * @returns The found mapping or undefined if no mapping could be found.
209
- */
210
- getMapping(reflection) {
211
- return this.mappings.find((mapping) => reflection.kindOf(mapping.kind));
212
- }
213
- /**
214
- * Build the url for the the given reflection and all of its children.
215
- *
216
- * @param reflection The reflection the url should be created for.
217
- * @param urls The array the url should be appended to.
218
- * @returns The altered urls array.
219
- */
220
- buildUrls(reflection, urls) {
221
- const mapping = this.getMapping(reflection);
222
- if (mapping) {
223
- if (!reflection.url || !DefaultTheme.URL_PREFIX.test(reflection.url)) {
224
- const url = [mapping.directory, this.getFileName(reflection)].join("/");
225
- urls.push(new UrlMapping(url, reflection, mapping.template));
226
- this.setSlugger(reflection, new Slugger(this.sluggerConfiguration));
227
- reflection.url = url;
228
- reflection.hasOwnDocument = true;
229
- }
230
- reflection.traverse((child) => {
231
- if (child.isDeclaration() || child.isDocument()) {
232
- this.buildUrls(child, urls);
233
- }
234
- else {
235
- this.applyAnchorUrl(child, reflection);
236
- }
237
- return true;
238
- });
147
+ if (leaves.includes(parent.getFullName())) {
148
+ return;
239
149
  }
240
- else if (reflection.parent) {
241
- this.applyAnchorUrl(reflection, reflection.parent);
150
+ if (!parent.kindOf(ReflectionKind.MayContainDocuments)) {
151
+ return;
242
152
  }
243
- return urls;
244
- }
245
- render(page, template) {
246
- const templateOutput = this.defaultLayoutTemplate(page, template);
247
- return "<!DOCTYPE html>" + JSX.renderElement(templateOutput) + "\n";
248
- }
249
- _navigationCache;
250
- /**
251
- * If implementing a custom theme, it is recommended to override {@link buildNavigation} instead.
252
- */
253
- getNavigation(project) {
254
- // This is ok because currently TypeDoc wipes out the theme after each render.
255
- // Might need to change in the future, but it's fine for now.
256
- if (this._navigationCache) {
257
- return this._navigationCache;
153
+ if (parent.isDocument()) {
154
+ return filterMap(parent.children, toNavigation);
258
155
  }
259
- return (this._navigationCache = this.buildNavigation(project));
260
- }
261
- buildNavigation(project) {
262
- // eslint-disable-next-line @typescript-eslint/no-this-alias
263
- const theme = this;
264
- const opts = this.application.options.getValue("navigation");
265
- const leaves = this.application.options.getValue("navigationLeaves");
266
- return getNavigationElements(project) || [];
267
- function toNavigation(element) {
268
- if (opts.excludeReferences && element instanceof ReferenceReflection) {
269
- return;
270
- }
271
- const children = getNavigationElements(element);
272
- if (element instanceof ReflectionCategory || element instanceof ReflectionGroup) {
273
- if (!children?.length) {
274
- return;
275
- }
276
- return {
277
- text: element.title,
278
- children,
279
- };
280
- }
281
- return {
282
- text: getDisplayName(element),
283
- path: element.url,
284
- kind: element.kind & ReflectionKind.Project ? undefined : element.kind,
285
- class: classNames({ deprecated: element.isDeprecated() }, theme.getReflectionClasses(element)),
286
- children: children?.length ? children : undefined,
287
- };
156
+ if (!parent.kindOf(ReflectionKind.SomeModule | ReflectionKind.Project)) {
157
+ // Tricky: Non-module children don't show up in the navigation pane,
158
+ // but any documents added by them should.
159
+ return filterMap(parent.documents, toNavigation);
288
160
  }
289
- function getNavigationElements(parent) {
290
- if (parent instanceof ReflectionCategory) {
291
- return filterMap(parent.children, toNavigation);
292
- }
293
- if (parent instanceof ReflectionGroup) {
294
- if (shouldShowCategories(parent.owningReflection, opts) && parent.categories) {
295
- return filterMap(parent.categories, toNavigation);
296
- }
297
- return filterMap(parent.children, toNavigation);
298
- }
299
- if (leaves.includes(parent.getFullName())) {
300
- return;
301
- }
302
- if (!parent.kindOf(ReflectionKind.MayContainDocuments)) {
303
- return;
304
- }
305
- if (parent.isDocument()) {
306
- return filterMap(parent.children, toNavigation);
307
- }
308
- if (!parent.kindOf(ReflectionKind.SomeModule | ReflectionKind.Project)) {
309
- // Tricky: Non-module children don't show up in the navigation pane,
310
- // but any documents added by them should.
311
- return filterMap(parent.documents, toNavigation);
312
- }
313
- if (parent.categories && shouldShowCategories(parent, opts)) {
314
- return filterMapWithNoneCollection(parent.categories);
315
- }
316
- if (parent.groups && shouldShowGroups(parent, opts)) {
317
- return filterMapWithNoneCollection(parent.groups);
318
- }
319
- if (opts.includeFolders && parent.childrenIncludingDocuments?.some((child) => child.name.includes("/"))) {
320
- return deriveModuleFolders(parent.childrenIncludingDocuments);
321
- }
322
- return filterMap(parent.childrenIncludingDocuments, toNavigation);
161
+ if (parent.categories && shouldShowCategories(parent, opts)) {
162
+ return filterMapWithNoneCollection(parent.categories);
323
163
  }
324
- function filterMapWithNoneCollection(reflection) {
325
- const none = reflection.find((x) => x.title.toLocaleLowerCase() === "none");
326
- const others = reflection.filter((x) => x.title.toLocaleLowerCase() !== "none");
327
- const mappedOthers = filterMap(others, toNavigation);
328
- if (none) {
329
- const noneMappedChildren = filterMap(none.children, toNavigation);
330
- return [...noneMappedChildren, ...mappedOthers];
331
- }
332
- return mappedOthers;
164
+ if (parent.groups && shouldShowGroups(parent, opts)) {
165
+ return filterMapWithNoneCollection(parent.groups);
166
+ }
167
+ if (opts.includeFolders && parent.childrenIncludingDocuments?.some((child) => child.name.includes("/"))) {
168
+ return deriveModuleFolders(parent.childrenIncludingDocuments);
169
+ }
170
+ return filterMap(parent.childrenIncludingDocuments, toNavigation);
171
+ }
172
+ function filterMapWithNoneCollection(reflection) {
173
+ const none = reflection.find((x) => x.title.toLocaleLowerCase() === "none");
174
+ const others = reflection.filter((x) => x.title.toLocaleLowerCase() !== "none");
175
+ const mappedOthers = filterMap(others, toNavigation);
176
+ if (none) {
177
+ const noneMappedChildren = filterMap(none.children, toNavigation);
178
+ return [...noneMappedChildren, ...mappedOthers];
333
179
  }
334
- function deriveModuleFolders(children) {
335
- const result = [];
336
- const resolveOrCreateParents = (path, root = result) => {
337
- if (path.length > 1) {
338
- const inner = root.find((el) => el.text === path[0]);
339
- if (inner) {
340
- inner.children ||= [];
341
- return resolveOrCreateParents(path.slice(1), inner.children);
342
- }
343
- else {
344
- root.push({
345
- text: path[0],
346
- children: [],
347
- });
348
- return resolveOrCreateParents(path.slice(1), root[root.length - 1].children);
349
- }
180
+ return mappedOthers;
181
+ }
182
+ function deriveModuleFolders(children) {
183
+ const result = [];
184
+ const resolveOrCreateParents = (path, root = result) => {
185
+ if (path.length > 1) {
186
+ const inner = root.find((el) => el.text === path[0]);
187
+ if (inner) {
188
+ inner.children ||= [];
189
+ return resolveOrCreateParents(path.slice(1), inner.children);
350
190
  }
351
- return root;
352
- };
353
- // Note: This might end up putting a module within another module if we document
354
- // both foo/index.ts and foo/bar.ts.
355
- for (const child of children.filter((c) => c.hasOwnDocument)) {
356
- const nav = toNavigation(child);
357
- if (nav) {
358
- const parts = child.name.split("/");
359
- const collection = resolveOrCreateParents(parts);
360
- nav.text = parts[parts.length - 1];
361
- collection.push(nav);
191
+ else {
192
+ root.push({
193
+ text: path[0],
194
+ children: [],
195
+ });
196
+ return resolveOrCreateParents(path.slice(1), root[root.length - 1].children);
362
197
  }
363
198
  }
364
- // Now merge single-possible-paths together so we don't have folders in our navigation
365
- // which contain only another single folder.
366
- if (opts.compactFolders) {
367
- const queue = [...result];
368
- while (queue.length) {
369
- const review = queue.shift();
370
- queue.push(...(review.children || []));
371
- if (review.kind || review.path)
372
- continue;
373
- if (review.children?.length === 1) {
374
- const copyFrom = review.children[0];
375
- const fullName = `${review.text}/${copyFrom.text}`;
376
- delete review.children;
377
- Object.assign(review, copyFrom);
378
- review.text = fullName;
379
- queue.push(review);
380
- }
381
- }
199
+ return root;
200
+ };
201
+ // Note: This might end up putting a module within another module if we document
202
+ // both foo/index.ts and foo/bar.ts.
203
+ for (const child of children.filter((c) => router.hasOwnDocument(c))) {
204
+ const nav = toNavigation(child);
205
+ if (nav) {
206
+ const parts = child.name.split("/");
207
+ const collection = resolveOrCreateParents(parts);
208
+ nav.text = parts[parts.length - 1];
209
+ collection.push(nav);
382
210
  }
383
- return result;
384
211
  }
385
- }
386
- /**
387
- * Generate an anchor url for the given reflection and all of its children.
388
- *
389
- * @param reflection The reflection an anchor url should be created for.
390
- * @param container The nearest reflection having an own document.
391
- */
392
- applyAnchorUrl(reflection, container) {
393
- if (!(reflection instanceof DeclarationReflection) &&
394
- !(reflection instanceof SignatureReflection) &&
395
- !(reflection instanceof TypeParameterReflection)) {
396
- return;
397
- }
398
- // We support linking to reflections for types directly contained within an export
399
- // but not any deeper. This is because TypeDoc may or may not render the type details
400
- // for a property depending on whether or not it is deemed useful, and defining a link
401
- // which might not be used may result in a link being generated which isn't valid. #2808.
402
- // This should be kept in sync with the renderingChildIsUseful function.
403
- if (reflection.kindOf(ReflectionKind.TypeLiteral) &&
404
- (!reflection.parent?.kindOf(ReflectionKind.SomeExport) ||
405
- reflection.parent.type?.type !== "reflection")) {
406
- return;
407
- }
408
- if ((!reflection.url || !DefaultTheme.URL_PREFIX.test(reflection.url)) &&
409
- !reflection.kindOf(ReflectionKind.TypeLiteral)) {
410
- let refl = reflection;
411
- const parts = [refl.name];
412
- while (refl.parent && refl.parent !== container && !(reflection.parent instanceof ProjectReflection)) {
413
- refl = refl.parent;
414
- // Avoid duplicate names for signatures
415
- // BREAKING: In 0.28, also add !refl.kindOf(ReflectionKind.TypeLiteral) to this check to improve anchor
416
- // generation by omitting useless __type prefixes.
417
- if (parts[0] !== refl.name) {
418
- parts.unshift(refl.name);
212
+ // Now merge single-possible-paths together so we don't have folders in our navigation
213
+ // which contain only another single folder.
214
+ if (opts.compactFolders) {
215
+ const queue = [...result];
216
+ while (queue.length) {
217
+ const review = queue.shift();
218
+ queue.push(...(review.children || []));
219
+ if (review.kind || review.path)
220
+ continue;
221
+ if (review.children?.length === 1) {
222
+ const copyFrom = review.children[0];
223
+ const fullName = `${review.text}/${copyFrom.text}`;
224
+ delete review.children;
225
+ Object.assign(review, copyFrom);
226
+ review.text = fullName;
227
+ queue.push(review);
419
228
  }
420
229
  }
421
- const anchor = this.getSlugger(reflection).slug(parts.join("."));
422
- reflection.url = container.url + "#" + anchor;
423
- reflection.anchor = anchor;
424
- reflection.hasOwnDocument = false;
425
230
  }
426
- reflection.traverse((child) => {
427
- this.applyAnchorUrl(child, container);
428
- return true;
429
- });
231
+ return result;
430
232
  }
431
- };
432
- })();
433
- export { DefaultTheme };
233
+ }
234
+ }
434
235
  function getReflectionClasses(reflection, filters) {
435
236
  const classes = new Set();
436
237
  // Filter classes should match up with the settings function in