typedoc 0.26.11 → 0.27.0-beta.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 (335) hide show
  1. package/bin/package.json +3 -0
  2. package/bin/typedoc +1 -1
  3. package/dist/index.d.ts +23 -13
  4. package/dist/index.js +22 -81
  5. package/dist/lib/application-events.js +1 -4
  6. package/dist/lib/application.d.ts +26 -16
  7. package/dist/lib/application.js +222 -242
  8. package/dist/lib/cli.js +3 -40
  9. package/dist/lib/converter/comments/blockLexer.d.ts +1 -1
  10. package/dist/lib/converter/comments/blockLexer.js +24 -30
  11. package/dist/lib/converter/comments/declarationReference.js +10 -21
  12. package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +2 -2
  13. package/dist/lib/converter/comments/declarationReferenceResolver.js +40 -36
  14. package/dist/lib/converter/comments/discovery.d.ts +4 -4
  15. package/dist/lib/converter/comments/discovery.js +154 -172
  16. package/dist/lib/converter/comments/index.d.ts +4 -4
  17. package/dist/lib/converter/comments/index.js +39 -50
  18. package/dist/lib/converter/comments/lexer.d.ts +1 -1
  19. package/dist/lib/converter/comments/lexer.js +2 -5
  20. package/dist/lib/converter/comments/lineLexer.d.ts +1 -1
  21. package/dist/lib/converter/comments/lineLexer.js +12 -15
  22. package/dist/lib/converter/comments/linkResolver.d.ts +2 -2
  23. package/dist/lib/converter/comments/linkResolver.js +14 -21
  24. package/dist/lib/converter/comments/parser.d.ts +6 -6
  25. package/dist/lib/converter/comments/parser.js +69 -96
  26. package/dist/lib/converter/comments/rawLexer.d.ts +1 -1
  27. package/dist/lib/converter/comments/rawLexer.js +13 -16
  28. package/dist/lib/converter/comments/tagName.js +1 -4
  29. package/dist/lib/converter/comments/textParser.d.ts +4 -4
  30. package/dist/lib/converter/comments/textParser.js +28 -30
  31. package/dist/lib/converter/components.d.ts +2 -3
  32. package/dist/lib/converter/components.js +2 -7
  33. package/dist/lib/converter/context.d.ts +9 -9
  34. package/dist/lib/converter/context.js +54 -44
  35. package/dist/lib/converter/convert-expression.js +16 -23
  36. package/dist/lib/converter/converter-events.d.ts +1 -0
  37. package/dist/lib/converter/converter-events.js +2 -4
  38. package/dist/lib/converter/converter.d.ts +16 -13
  39. package/dist/lib/converter/converter.js +210 -238
  40. package/dist/lib/converter/factories/index-signature.d.ts +1 -1
  41. package/dist/lib/converter/factories/index-signature.js +11 -17
  42. package/dist/lib/converter/factories/signature.d.ts +2 -2
  43. package/dist/lib/converter/factories/signature.js +95 -106
  44. package/dist/lib/converter/index.d.ts +6 -7
  45. package/dist/lib/converter/index.js +3 -11
  46. package/dist/lib/converter/jsdoc.d.ts +1 -1
  47. package/dist/lib/converter/jsdoc.js +34 -41
  48. package/dist/lib/converter/plugins/CategoryPlugin.d.ts +6 -21
  49. package/dist/lib/converter/plugins/CategoryPlugin.js +57 -139
  50. package/dist/lib/converter/plugins/CommentPlugin.d.ts +3 -5
  51. package/dist/lib/converter/plugins/CommentPlugin.js +153 -163
  52. package/dist/lib/converter/plugins/GroupPlugin.d.ts +10 -9
  53. package/dist/lib/converter/plugins/GroupPlugin.js +87 -124
  54. package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +3 -5
  55. package/dist/lib/converter/plugins/ImplementsPlugin.js +255 -321
  56. package/dist/lib/converter/plugins/IncludePlugin.d.ts +11 -0
  57. package/dist/lib/converter/plugins/IncludePlugin.js +72 -0
  58. package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +4 -3
  59. package/dist/lib/converter/plugins/InheritDocPlugin.js +41 -72
  60. package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +5 -5
  61. package/dist/lib/converter/plugins/LinkResolverPlugin.js +37 -58
  62. package/dist/lib/converter/plugins/MergeModuleWithPlugin.d.ts +12 -0
  63. package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +49 -0
  64. package/dist/lib/converter/plugins/PackagePlugin.d.ts +4 -3
  65. package/dist/lib/converter/plugins/PackagePlugin.js +62 -111
  66. package/dist/lib/converter/plugins/SourcePlugin.d.ts +3 -5
  67. package/dist/lib/converter/plugins/SourcePlugin.js +69 -110
  68. package/dist/lib/converter/plugins/TypePlugin.d.ts +4 -6
  69. package/dist/lib/converter/plugins/TypePlugin.js +95 -158
  70. package/dist/lib/converter/plugins/index.d.ts +10 -9
  71. package/dist/lib/converter/plugins/index.js +10 -21
  72. package/dist/lib/converter/symbols.d.ts +1 -1
  73. package/dist/lib/converter/symbols.js +234 -227
  74. package/dist/lib/converter/types.d.ts +2 -2
  75. package/dist/lib/converter/types.js +252 -237
  76. package/dist/lib/converter/utils/nodes.js +5 -13
  77. package/dist/lib/converter/utils/reflections.d.ts +1 -1
  78. package/dist/lib/converter/utils/reflections.js +4 -7
  79. package/dist/lib/converter/utils/repository.d.ts +1 -1
  80. package/dist/lib/converter/utils/repository.js +103 -97
  81. package/dist/lib/converter/utils/symbols.js +3 -9
  82. package/dist/lib/internationalization/index.d.ts +3 -4
  83. package/dist/lib/internationalization/index.js +3 -8
  84. package/dist/lib/internationalization/internationalization.d.ts +5 -4
  85. package/dist/lib/internationalization/internationalization.js +97 -103
  86. package/dist/lib/internationalization/locale-utils.cjs +8 -0
  87. package/dist/lib/internationalization/locale-utils.d.cts +8 -0
  88. package/dist/lib/internationalization/locales/en.cjs +366 -2
  89. package/dist/lib/internationalization/locales/en.d.cts +339 -2
  90. package/dist/lib/internationalization/locales/jp.cjs +8 -11
  91. package/dist/lib/internationalization/locales/jp.d.cts +310 -1
  92. package/dist/lib/internationalization/locales/ko.cjs +7 -9
  93. package/dist/lib/internationalization/locales/ko.d.cts +223 -1
  94. package/dist/lib/internationalization/locales/zh.cjs +7 -10
  95. package/dist/lib/internationalization/locales/zh.d.cts +381 -1
  96. package/dist/lib/internationalization/translatable.d.ts +4 -327
  97. package/dist/lib/internationalization/translatable.js +2 -360
  98. package/dist/lib/models/FileRegistry.d.ts +20 -9
  99. package/dist/lib/models/FileRegistry.js +54 -45
  100. package/dist/lib/models/ReflectionCategory.d.ts +2 -2
  101. package/dist/lib/models/ReflectionCategory.js +16 -12
  102. package/dist/lib/models/ReflectionGroup.d.ts +3 -3
  103. package/dist/lib/models/ReflectionGroup.js +23 -14
  104. package/dist/lib/models/comments/comment.d.ts +23 -37
  105. package/dist/lib/models/comments/comment.js +388 -325
  106. package/dist/lib/models/comments/index.d.ts +2 -2
  107. package/dist/lib/models/comments/index.js +1 -6
  108. package/dist/lib/models/index.d.ts +7 -7
  109. package/dist/lib/models/index.js +7 -23
  110. package/dist/lib/models/reflections/ReflectionSymbolId.d.ts +2 -2
  111. package/dist/lib/models/reflections/ReflectionSymbolId.js +42 -34
  112. package/dist/lib/models/reflections/abstract.d.ts +17 -20
  113. package/dist/lib/models/reflections/abstract.js +249 -256
  114. package/dist/lib/models/reflections/container.d.ts +7 -7
  115. package/dist/lib/models/reflections/container.js +43 -16
  116. package/dist/lib/models/reflections/declaration.d.ts +15 -12
  117. package/dist/lib/models/reflections/declaration.js +150 -29
  118. package/dist/lib/models/reflections/document.d.ts +3 -3
  119. package/dist/lib/models/reflections/document.js +26 -13
  120. package/dist/lib/models/reflections/index.d.ts +15 -15
  121. package/dist/lib/models/reflections/index.js +12 -31
  122. package/dist/lib/models/reflections/kind.d.ts +1 -1
  123. package/dist/lib/models/reflections/kind.js +3 -6
  124. package/dist/lib/models/reflections/parameter.d.ts +5 -4
  125. package/dist/lib/models/reflections/parameter.js +11 -13
  126. package/dist/lib/models/reflections/project.d.ts +14 -9
  127. package/dist/lib/models/reflections/project.js +104 -56
  128. package/dist/lib/models/reflections/reference.d.ts +3 -3
  129. package/dist/lib/models/reflections/reference.js +6 -9
  130. package/dist/lib/models/reflections/signature.d.ts +8 -8
  131. package/dist/lib/models/reflections/signature.js +35 -14
  132. package/dist/lib/models/reflections/type-parameter.d.ts +5 -5
  133. package/dist/lib/models/reflections/type-parameter.js +9 -10
  134. package/dist/lib/models/reflections/utils.js +1 -4
  135. package/dist/lib/models/reflections/variant.d.ts +8 -7
  136. package/dist/lib/models/reflections/variant.js +1 -2
  137. package/dist/lib/models/sources/file.d.ts +2 -2
  138. package/dist/lib/models/sources/file.js +22 -5
  139. package/dist/lib/models/sources/index.d.ts +1 -1
  140. package/dist/lib/models/sources/index.js +1 -5
  141. package/dist/lib/models/types.d.ts +26 -13
  142. package/dist/lib/models/types.js +236 -151
  143. package/dist/lib/output/components.d.ts +5 -11
  144. package/dist/lib/output/components.js +84 -125
  145. package/dist/lib/output/events.d.ts +3 -3
  146. package/dist/lib/output/events.js +128 -94
  147. package/dist/lib/output/formatter.d.ts +84 -0
  148. package/dist/lib/output/formatter.js +619 -0
  149. package/dist/lib/output/index.d.ts +9 -8
  150. package/dist/lib/output/index.js +7 -19
  151. package/dist/lib/output/models/UrlMapping.d.ts +2 -2
  152. package/dist/lib/output/models/UrlMapping.js +4 -5
  153. package/dist/lib/output/output.d.ts +13 -0
  154. package/dist/lib/output/output.js +72 -0
  155. package/dist/lib/output/plugins/AssetsPlugin.d.ts +7 -8
  156. package/dist/lib/output/plugins/AssetsPlugin.js +62 -80
  157. package/dist/lib/output/plugins/IconsPlugin.d.ts +3 -2
  158. package/dist/lib/output/plugins/IconsPlugin.js +28 -84
  159. package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +9 -2
  160. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +90 -96
  161. package/dist/lib/output/plugins/NavigationPlugin.d.ts +3 -2
  162. package/dist/lib/output/plugins/NavigationPlugin.js +22 -102
  163. package/dist/lib/output/plugins/SitemapPlugin.d.ts +3 -2
  164. package/dist/lib/output/plugins/SitemapPlugin.js +60 -120
  165. package/dist/lib/output/plugins/index.d.ts +6 -6
  166. package/dist/lib/output/plugins/index.js +6 -15
  167. package/dist/lib/output/renderer.d.ts +14 -13
  168. package/dist/lib/output/renderer.js +129 -185
  169. package/dist/lib/output/theme.d.ts +9 -5
  170. package/dist/lib/output/theme.js +14 -62
  171. package/dist/lib/output/themes/MarkedPlugin.d.ts +8 -9
  172. package/dist/lib/output/themes/MarkedPlugin.js +152 -117
  173. package/dist/lib/output/themes/default/DefaultTheme.d.ts +17 -29
  174. package/dist/lib/output/themes/default/DefaultTheme.js +334 -310
  175. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +63 -48
  176. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +119 -95
  177. package/dist/lib/output/themes/default/Slugger.d.ts +13 -0
  178. package/dist/lib/output/themes/default/Slugger.js +46 -0
  179. package/dist/lib/output/themes/default/layouts/default.d.ts +5 -5
  180. package/dist/lib/output/themes/default/layouts/default.js +47 -36
  181. package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +2 -2
  182. package/dist/lib/output/themes/default/partials/anchor-icon.js +4 -7
  183. package/dist/lib/output/themes/default/partials/breadcrumb.d.ts +3 -3
  184. package/dist/lib/output/themes/default/partials/breadcrumb.js +4 -8
  185. package/dist/lib/output/themes/default/partials/comment.d.ts +6 -4
  186. package/dist/lib/output/themes/default/partials/comment.js +52 -29
  187. package/dist/lib/output/themes/default/partials/footer.d.ts +2 -2
  188. package/dist/lib/output/themes/default/partials/footer.js +11 -14
  189. package/dist/lib/output/themes/default/partials/header.d.ts +4 -4
  190. package/dist/lib/output/themes/default/partials/header.js +9 -13
  191. package/dist/lib/output/themes/default/partials/hierarchy.d.ts +3 -3
  192. package/dist/lib/output/themes/default/partials/hierarchy.js +9 -12
  193. package/dist/lib/output/themes/default/partials/icon.d.ts +4 -4
  194. package/dist/lib/output/themes/default/partials/icon.js +78 -73
  195. package/dist/lib/output/themes/default/partials/index.d.ts +3 -3
  196. package/dist/lib/output/themes/default/partials/index.js +19 -22
  197. package/dist/lib/output/themes/default/partials/member.d.ts +3 -3
  198. package/dist/lib/output/themes/default/partials/member.declaration.d.ts +3 -3
  199. package/dist/lib/output/themes/default/partials/member.declaration.js +18 -61
  200. package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +3 -3
  201. package/dist/lib/output/themes/default/partials/member.getterSetter.js +10 -26
  202. package/dist/lib/output/themes/default/partials/member.js +19 -24
  203. package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +3 -3
  204. package/dist/lib/output/themes/default/partials/member.signature.body.js +17 -21
  205. package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +4 -7
  206. package/dist/lib/output/themes/default/partials/member.signature.title.js +8 -35
  207. package/dist/lib/output/themes/default/partials/member.signatures.d.ts +3 -3
  208. package/dist/lib/output/themes/default/partials/member.signatures.js +9 -13
  209. package/dist/lib/output/themes/default/partials/member.sources.d.ts +3 -3
  210. package/dist/lib/output/themes/default/partials/member.sources.js +13 -17
  211. package/dist/lib/output/themes/default/partials/members.d.ts +3 -3
  212. package/dist/lib/output/themes/default/partials/members.js +10 -42
  213. package/dist/lib/output/themes/default/partials/moduleReflection.d.ts +5 -0
  214. package/dist/lib/output/themes/default/partials/moduleReflection.js +62 -0
  215. package/dist/lib/output/themes/default/partials/navigation.d.ts +4 -4
  216. package/dist/lib/output/themes/default/partials/navigation.js +51 -62
  217. package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +3 -3
  218. package/dist/lib/output/themes/default/partials/reflectionPreview.js +12 -15
  219. package/dist/lib/output/themes/default/partials/toolbar.d.ts +4 -4
  220. package/dist/lib/output/themes/default/partials/toolbar.js +16 -20
  221. package/dist/lib/output/themes/default/partials/type.d.ts +4 -6
  222. package/dist/lib/output/themes/default/partials/type.js +8 -388
  223. package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +3 -3
  224. package/dist/lib/output/themes/default/partials/typeAndParent.js +11 -15
  225. package/dist/lib/output/themes/default/partials/typeDetails.d.ts +8 -0
  226. package/dist/lib/output/themes/default/partials/typeDetails.js +221 -0
  227. package/dist/lib/output/themes/default/partials/typeParameters.d.ts +3 -3
  228. package/dist/lib/output/themes/default/partials/typeParameters.js +14 -17
  229. package/dist/lib/output/themes/default/templates/document.d.ts +4 -4
  230. package/dist/lib/output/themes/default/templates/document.js +3 -7
  231. package/dist/lib/output/themes/default/templates/hierarchy.d.ts +4 -4
  232. package/dist/lib/output/themes/default/templates/hierarchy.js +10 -13
  233. package/dist/lib/output/themes/default/templates/index.d.ts +4 -4
  234. package/dist/lib/output/themes/default/templates/index.js +3 -7
  235. package/dist/lib/output/themes/default/templates/reflection.d.ts +4 -4
  236. package/dist/lib/output/themes/default/templates/reflection.js +31 -34
  237. package/dist/lib/output/themes/lib.d.ts +17 -3
  238. package/dist/lib/output/themes/lib.js +110 -49
  239. package/dist/lib/serialization/components.d.ts +2 -5
  240. package/dist/lib/serialization/components.js +1 -2
  241. package/dist/lib/serialization/deserializer.d.ts +21 -7
  242. package/dist/lib/serialization/deserializer.js +138 -123
  243. package/dist/lib/serialization/events.d.ts +2 -2
  244. package/dist/lib/serialization/events.js +6 -5
  245. package/dist/lib/serialization/index.d.ts +5 -5
  246. package/dist/lib/serialization/index.js +4 -33
  247. package/dist/lib/serialization/schema.d.ts +8 -2
  248. package/dist/lib/serialization/schema.js +2 -2
  249. package/dist/lib/serialization/serializer.d.ts +11 -5
  250. package/dist/lib/serialization/serializer.js +32 -25
  251. package/dist/lib/utils/array.d.ts +3 -0
  252. package/dist/lib/utils/array.js +26 -27
  253. package/dist/lib/utils/component.d.ts +2 -44
  254. package/dist/lib/utils/component.js +10 -102
  255. package/dist/lib/utils/entry-point.d.ts +3 -4
  256. package/dist/lib/utils/entry-point.js +114 -85
  257. package/dist/lib/utils/enum.js +6 -14
  258. package/dist/lib/utils/events.js +6 -12
  259. package/dist/lib/utils/fs.js +50 -91
  260. package/dist/lib/utils/general.d.ts +2 -1
  261. package/dist/lib/utils/general.js +50 -40
  262. package/dist/lib/utils/highlighter.js +30 -57
  263. package/dist/lib/utils/hooks.js +7 -13
  264. package/dist/lib/utils/html-entities.d.ts +8926 -0
  265. package/dist/lib/utils/html-entities.js +2329 -0
  266. package/dist/lib/utils/html.d.ts +8 -0
  267. package/dist/lib/utils/html.js +81 -34
  268. package/dist/lib/utils/index.d.ts +22 -22
  269. package/dist/lib/utils/index.js +20 -91
  270. package/dist/lib/utils/jsx.d.ts +12 -5
  271. package/dist/lib/utils/jsx.elements.js +1 -4
  272. package/dist/lib/utils/jsx.js +53 -20
  273. package/dist/lib/utils/loggers.d.ts +3 -3
  274. package/dist/lib/utils/loggers.js +36 -46
  275. package/dist/lib/utils/map.js +6 -13
  276. package/dist/lib/utils/minimalSourceFile.js +5 -7
  277. package/dist/lib/utils/options/declaration.d.ts +33 -7
  278. package/dist/lib/utils/options/declaration.js +20 -22
  279. package/dist/lib/utils/options/defaults.d.ts +3 -2
  280. package/dist/lib/utils/options/defaults.js +18 -38
  281. package/dist/lib/utils/options/help.d.ts +2 -2
  282. package/dist/lib/utils/options/help.js +7 -10
  283. package/dist/lib/utils/options/index.d.ts +6 -6
  284. package/dist/lib/utils/options/index.js +4 -18
  285. package/dist/lib/utils/options/options.d.ts +8 -5
  286. package/dist/lib/utils/options/options.js +47 -71
  287. package/dist/lib/utils/options/readers/arguments.d.ts +2 -2
  288. package/dist/lib/utils/options/readers/arguments.js +15 -17
  289. package/dist/lib/utils/options/readers/index.d.ts +4 -4
  290. package/dist/lib/utils/options/readers/index.js +4 -11
  291. package/dist/lib/utils/options/readers/package-json.d.ts +3 -3
  292. package/dist/lib/utils/options/readers/package-json.js +15 -21
  293. package/dist/lib/utils/options/readers/tsconfig.d.ts +2 -2
  294. package/dist/lib/utils/options/readers/tsconfig.js +54 -63
  295. package/dist/lib/utils/options/readers/typedoc.d.ts +3 -3
  296. package/dist/lib/utils/options/readers/typedoc.js +44 -76
  297. package/dist/lib/utils/options/sources/index.d.ts +1 -1
  298. package/dist/lib/utils/options/sources/index.js +1 -5
  299. package/dist/lib/utils/options/sources/typedoc.d.ts +1 -1
  300. package/dist/lib/utils/options/sources/typedoc.js +220 -196
  301. package/dist/lib/utils/options/tsdoc-defaults.d.ts +3 -3
  302. package/dist/lib/utils/options/tsdoc-defaults.js +16 -12
  303. package/dist/lib/utils/package-manifest.d.ts +1 -1
  304. package/dist/lib/utils/package-manifest.js +15 -19
  305. package/dist/lib/utils/paths.js +9 -15
  306. package/dist/lib/utils/perf.js +6 -11
  307. package/dist/lib/utils/plugins.d.ts +1 -1
  308. package/dist/lib/utils/plugins.js +7 -10
  309. package/dist/lib/utils/reflections.d.ts +1 -1
  310. package/dist/lib/utils/reflections.js +9 -12
  311. package/dist/lib/utils/set.js +2 -6
  312. package/dist/lib/utils/sort.d.ts +3 -3
  313. package/dist/lib/utils/sort.js +20 -24
  314. package/dist/lib/utils/tsconfig.d.ts +1 -1
  315. package/dist/lib/utils/tsconfig.js +13 -21
  316. package/dist/lib/utils/tsutils.d.ts +1 -1
  317. package/dist/lib/utils/tsutils.js +3 -30
  318. package/dist/lib/utils/validation.js +6 -12
  319. package/dist/lib/validation/documentation.d.ts +2 -2
  320. package/dist/lib/validation/documentation.js +26 -29
  321. package/dist/lib/validation/exports.d.ts +2 -2
  322. package/dist/lib/validation/exports.js +9 -11
  323. package/dist/lib/validation/links.d.ts +2 -2
  324. package/dist/lib/validation/links.js +4 -7
  325. package/dist/lib/validation/unusedMergeModuleWith.d.ts +3 -0
  326. package/dist/lib/validation/unusedMergeModuleWith.js +11 -0
  327. package/package.json +14 -11
  328. package/static/main.js +4 -4
  329. package/static/style.css +91 -2
  330. package/tsdoc.json +30 -0
  331. package/dist/lib/output/themes/default/partials/member.reference.d.ts +0 -4
  332. package/dist/lib/output/themes/default/partials/member.reference.js +0 -30
  333. package/dist/lib/output/themes/default/partials/parameter.d.ts +0 -4
  334. package/dist/lib/output/themes/default/partials/parameter.js +0 -79
  335. package/dist/lib/utils/html-entities.json +0 -2326
@@ -1,67 +1,66 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultTheme = exports.Slugger = void 0;
4
- const theme_1 = require("../../theme");
5
- const models_1 = require("../../../models");
6
- const UrlMapping_1 = require("../../models/UrlMapping");
7
- const DefaultThemeRenderContext_1 = require("./DefaultThemeRenderContext");
8
- const utils_1 = require("../../../utils");
9
- const lib_1 = require("../lib");
10
- const icon_1 = require("./partials/icon");
11
- /**
12
- * Responsible for getting a unique anchor for elements within a page.
13
- */
14
- class Slugger {
15
- constructor() {
16
- this.seen = new Map();
17
- }
18
- serialize(value) {
19
- // Extracted from marked@4.3.0
20
- return (value
21
- .toLowerCase()
22
- .trim()
23
- // remove html tags
24
- .replace(/<[!/a-z].*?>/gi, "")
25
- // remove unwanted chars
26
- .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "")
27
- .replace(/\s/g, "-"));
28
- }
29
- slug(value) {
30
- const originalSlug = this.serialize(value);
31
- let slug = originalSlug;
32
- let count = 0;
33
- if (this.seen.has(slug)) {
34
- count = this.seen.get(originalSlug);
35
- do {
36
- count++;
37
- slug = `${originalSlug}-${count}`;
38
- } while (this.seen.has(slug));
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] = _;
39
23
  }
40
- this.seen.set(originalSlug, count);
41
- this.seen.set(slug, 0);
42
- return slug;
43
- }
44
- }
45
- exports.Slugger = Slugger;
46
- /**
47
- * Default theme implementation of TypeDoc. If a theme does not provide a custom
48
- * {@link Theme} implementation, this theme class will be used.
49
- */
50
- class DefaultTheme extends theme_1.Theme {
51
- getRenderContext(pageEvent) {
52
- return new DefaultThemeRenderContext_1.DefaultThemeRenderContext(this, pageEvent, this.application.options);
53
24
  }
54
- getReflectionClasses(reflection) {
55
- const filters = this.application.options.getValue("visibilityFilters");
56
- return getReflectionClasses(reflection, filters);
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);
57
32
  }
58
- /**
59
- * Create a new DefaultTheme instance.
60
- *
61
- * @param renderer The renderer this theme is attached to.
62
- */
63
- constructor(renderer) {
64
- super(renderer);
33
+ return useValue ? value : void 0;
34
+ };
35
+ 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";
38
+ import { DefaultThemeRenderContext } from "./DefaultThemeRenderContext.js";
39
+ import { filterMap, JSX, Option } from "../../../utils/index.js";
40
+ import { classNames, getDisplayName, getHierarchyRoots, toStyleClass } from "../lib.js";
41
+ import { icons } 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);
65
64
  /**
66
65
  * The icons which will actually be rendered. The source of truth lives on the theme, and
67
66
  * the {@link DefaultThemeRenderContext.icons} member will produce references to these.
@@ -75,324 +74,349 @@ class DefaultTheme extends theme_1.Theme {
75
74
  * the icons used within the page, however TypeDoc currently assumes that all icons are svg
76
75
  * elements, so custom themes must also use svg elements.
77
76
  */
78
- this.icons = { ...icon_1.icons };
79
- this.documentTemplate = (pageEvent) => {
77
+ icons = { ...icons };
78
+ getRenderContext(pageEvent) {
79
+ return new DefaultThemeRenderContext(this, pageEvent, this.application.options);
80
+ }
81
+ documentTemplate = (pageEvent) => {
80
82
  return this.getRenderContext(pageEvent).documentTemplate(pageEvent);
81
83
  };
82
- this.reflectionTemplate = (pageEvent) => {
84
+ reflectionTemplate = (pageEvent) => {
83
85
  return this.getRenderContext(pageEvent).reflectionTemplate(pageEvent);
84
86
  };
85
- this.indexTemplate = (pageEvent) => {
87
+ indexTemplate = (pageEvent) => {
86
88
  return this.getRenderContext(pageEvent).indexTemplate(pageEvent);
87
89
  };
88
- this.hierarchyTemplate = (pageEvent) => {
90
+ hierarchyTemplate = (pageEvent) => {
89
91
  return this.getRenderContext(pageEvent).hierarchyTemplate(pageEvent);
90
92
  };
91
- this.defaultLayoutTemplate = (pageEvent, template) => {
93
+ defaultLayoutTemplate = (pageEvent, template) => {
92
94
  return this.getRenderContext(pageEvent).defaultLayout(template, pageEvent);
93
95
  };
96
+ getReflectionClasses(reflection) {
97
+ const filters = this.application.options.getValue("visibilityFilters");
98
+ return getReflectionClasses(reflection, filters);
99
+ }
94
100
  /**
95
101
  * Mappings of reflections kinds to templates used by this theme.
96
102
  */
97
- this.mappings = [
103
+ mappings = [
98
104
  {
99
- kind: [models_1.ReflectionKind.Class],
105
+ kind: [ReflectionKind.Class],
100
106
  directory: "classes",
101
107
  template: this.reflectionTemplate,
102
108
  },
103
109
  {
104
- kind: [models_1.ReflectionKind.Interface],
110
+ kind: [ReflectionKind.Interface],
105
111
  directory: "interfaces",
106
112
  template: this.reflectionTemplate,
107
113
  },
108
114
  {
109
- kind: [models_1.ReflectionKind.Enum],
115
+ kind: [ReflectionKind.Enum],
110
116
  directory: "enums",
111
117
  template: this.reflectionTemplate,
112
118
  },
113
119
  {
114
- kind: [models_1.ReflectionKind.Namespace, models_1.ReflectionKind.Module],
120
+ kind: [ReflectionKind.Namespace, ReflectionKind.Module],
115
121
  directory: "modules",
116
122
  template: this.reflectionTemplate,
117
123
  },
118
124
  {
119
- kind: [models_1.ReflectionKind.TypeAlias],
125
+ kind: [ReflectionKind.TypeAlias],
120
126
  directory: "types",
121
127
  template: this.reflectionTemplate,
122
128
  },
123
129
  {
124
- kind: [models_1.ReflectionKind.Function],
130
+ kind: [ReflectionKind.Function],
125
131
  directory: "functions",
126
132
  template: this.reflectionTemplate,
127
133
  },
128
134
  {
129
- kind: [models_1.ReflectionKind.Variable],
135
+ kind: [ReflectionKind.Variable],
130
136
  directory: "variables",
131
137
  template: this.reflectionTemplate,
132
138
  },
133
139
  {
134
- kind: [models_1.ReflectionKind.Document],
140
+ kind: [ReflectionKind.Document],
135
141
  directory: "documents",
136
142
  template: this.documentTemplate,
137
143
  },
138
144
  ];
139
- this.sluggers = new Map();
140
- this.markedPlugin = renderer.getComponent("marked");
141
- }
142
- /**
143
- * Map the models of the given project to the desired output files.
144
- *
145
- * @param project The project whose urls should be generated.
146
- * @returns A list of {@link UrlMapping} instances defining which models
147
- * should be rendered to which files.
148
- */
149
- getUrls(project) {
150
- const urls = [];
151
- this.sluggers.set(project, new Slugger());
152
- if (!project.readme?.length) {
153
- project.url = "index.html";
154
- urls.push(new UrlMapping_1.UrlMapping("index.html", project, this.reflectionTemplate));
155
- }
156
- else {
157
- project.url = "modules.html";
158
- urls.push(new UrlMapping_1.UrlMapping("modules.html", project, this.reflectionTemplate));
159
- urls.push(new UrlMapping_1.UrlMapping("index.html", project, this.indexTemplate));
160
- }
161
- if ((0, lib_1.getHierarchyRoots)(project).length) {
162
- urls.push(new UrlMapping_1.UrlMapping("hierarchy.html", project, this.hierarchyTemplate));
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.markedPlugin = renderer.markedPlugin;
163
154
  }
164
- project.childrenIncludingDocuments?.forEach((child) => this.buildUrls(child, urls));
165
- return urls;
166
- }
167
- /**
168
- * Return a url for the given reflection.
169
- *
170
- * @param reflection The reflection the url should be generated for.
171
- * @param relative The parent reflection the url generation should stop on.
172
- * @param separator The separator used to generate the url.
173
- * @returns The generated url.
174
- */
175
- static getUrl(reflection, relative, separator = ".") {
176
- let url = reflection.getAlias();
177
- if (reflection.parent && reflection.parent !== relative && !(reflection.parent instanceof models_1.ProjectReflection)) {
178
- url = DefaultTheme.getUrl(reflection.parent, relative, separator) + separator + url;
155
+ /**
156
+ * Map the models of the given project to the desired output files.
157
+ *
158
+ * @param project The project whose urls should be generated.
159
+ * @returns A list of {@link UrlMapping} instances defining which models
160
+ * should be rendered to which files.
161
+ */
162
+ getUrls(project) {
163
+ this.usedFileNames = new Set();
164
+ const urls = [];
165
+ this.setSlugger(project, new Slugger(this.sluggerConfiguration));
166
+ if (!project.readme?.length) {
167
+ project.url = "index.html";
168
+ urls.push(new UrlMapping("index.html", project, this.reflectionTemplate));
169
+ }
170
+ else {
171
+ project.url = "modules.html";
172
+ urls.push(new UrlMapping("modules.html", project, this.reflectionTemplate));
173
+ urls.push(new UrlMapping("index.html", project, this.indexTemplate));
174
+ }
175
+ if (getHierarchyRoots(project).length) {
176
+ urls.push(new UrlMapping("hierarchy.html", project, this.hierarchyTemplate));
177
+ }
178
+ project.childrenIncludingDocuments?.forEach((child) => this.buildUrls(child, urls));
179
+ return urls;
179
180
  }
180
- return url;
181
- }
182
- /**
183
- * Return the template mapping for the given reflection.
184
- *
185
- * @param reflection The reflection whose mapping should be resolved.
186
- * @returns The found mapping or undefined if no mapping could be found.
187
- */
188
- getMapping(reflection) {
189
- return this.mappings.find((mapping) => reflection.kindOf(mapping.kind));
190
- }
191
- /**
192
- * Build the url for the the given reflection and all of its children.
193
- *
194
- * @param reflection The reflection the url should be created for.
195
- * @param urls The array the url should be appended to.
196
- * @returns The altered urls array.
197
- */
198
- buildUrls(reflection, urls) {
199
- const mapping = this.getMapping(reflection);
200
- if (mapping) {
201
- if (!reflection.url || !DefaultTheme.URL_PREFIX.test(reflection.url)) {
202
- const url = [mapping.directory, DefaultTheme.getUrl(reflection) + ".html"].join("/");
203
- urls.push(new UrlMapping_1.UrlMapping(url, reflection, mapping.template));
204
- this.sluggers.set(reflection, new Slugger());
205
- reflection.url = url;
206
- reflection.hasOwnDocument = true;
181
+ /**
182
+ * @param reflection The reflection the url should be generated for.
183
+ */
184
+ getFileName(reflection) {
185
+ const parts = [createNormalizedUrl(reflection.name)];
186
+ while (reflection.parent && !reflection.parent.isProject()) {
187
+ reflection = reflection.parent;
188
+ parts.unshift(createNormalizedUrl(reflection.name));
207
189
  }
208
- reflection.traverse((child) => {
209
- if (child.isDeclaration() || child.isDocument()) {
210
- this.buildUrls(child, urls);
190
+ const baseName = parts.join(".");
191
+ const lowerBaseName = baseName.toLocaleLowerCase();
192
+ if (this.usedFileNames.has(lowerBaseName)) {
193
+ let index = 1;
194
+ while (this.usedFileNames.has(`${lowerBaseName}-${index}`)) {
195
+ ++index;
211
196
  }
212
- else {
213
- DefaultTheme.applyAnchorUrl(child, reflection);
197
+ this.usedFileNames.add(`${lowerBaseName}-${index}`);
198
+ return `${baseName}-${index}.html`;
199
+ }
200
+ this.usedFileNames.add(lowerBaseName);
201
+ return `${baseName}.html`;
202
+ }
203
+ /**
204
+ * Return the template mapping for the given reflection.
205
+ *
206
+ * @param reflection The reflection whose mapping should be resolved.
207
+ * @returns The found mapping or undefined if no mapping could be found.
208
+ */
209
+ getMapping(reflection) {
210
+ return this.mappings.find((mapping) => reflection.kindOf(mapping.kind));
211
+ }
212
+ /**
213
+ * Build the url for the the given reflection and all of its children.
214
+ *
215
+ * @param reflection The reflection the url should be created for.
216
+ * @param urls The array the url should be appended to.
217
+ * @returns The altered urls array.
218
+ */
219
+ buildUrls(reflection, urls) {
220
+ const mapping = this.getMapping(reflection);
221
+ if (mapping) {
222
+ if (!reflection.url || !DefaultTheme.URL_PREFIX.test(reflection.url)) {
223
+ const url = [mapping.directory, this.getFileName(reflection)].join("/");
224
+ urls.push(new UrlMapping(url, reflection, mapping.template));
225
+ this.setSlugger(reflection, new Slugger(this.sluggerConfiguration));
226
+ reflection.url = url;
227
+ reflection.hasOwnDocument = true;
214
228
  }
215
- return true;
216
- });
229
+ reflection.traverse((child) => {
230
+ if (child.isDeclaration() || child.isDocument()) {
231
+ this.buildUrls(child, urls);
232
+ }
233
+ else {
234
+ this.applyAnchorUrl(child, reflection);
235
+ }
236
+ return true;
237
+ });
238
+ }
239
+ else if (reflection.parent) {
240
+ this.applyAnchorUrl(reflection, reflection.parent);
241
+ }
242
+ return urls;
217
243
  }
218
- else if (reflection.parent) {
219
- DefaultTheme.applyAnchorUrl(reflection, reflection.parent);
244
+ render(page, template) {
245
+ const templateOutput = this.defaultLayoutTemplate(page, template);
246
+ return "<!DOCTYPE html>" + JSX.renderElement(templateOutput) + "\n";
220
247
  }
221
- return urls;
222
- }
223
- render(page, template) {
224
- const templateOutput = this.defaultLayoutTemplate(page, template);
225
- return "<!DOCTYPE html>" + utils_1.JSX.renderElement(templateOutput) + "\n";
226
- }
227
- /**
228
- * If implementing a custom theme, it is recommended to override {@link buildNavigation} instead.
229
- */
230
- getNavigation(project) {
231
- // This is ok because currently TypeDoc wipes out the theme after each render.
232
- // Might need to change in the future, but it's fine for now.
233
- if (this._navigationCache) {
234
- return this._navigationCache;
248
+ _navigationCache;
249
+ /**
250
+ * If implementing a custom theme, it is recommended to override {@link buildNavigation} instead.
251
+ */
252
+ getNavigation(project) {
253
+ // This is ok because currently TypeDoc wipes out the theme after each render.
254
+ // Might need to change in the future, but it's fine for now.
255
+ if (this._navigationCache) {
256
+ return this._navigationCache;
257
+ }
258
+ return (this._navigationCache = this.buildNavigation(project));
235
259
  }
236
- return (this._navigationCache = this.buildNavigation(project));
237
- }
238
- buildNavigation(project) {
239
- // eslint-disable-next-line @typescript-eslint/no-this-alias
240
- const theme = this;
241
- const opts = this.application.options.getValue("navigation");
242
- const leaves = this.application.options.getValue("navigationLeaves");
243
- return getNavigationElements(project) || [];
244
- function toNavigation(element) {
245
- const children = getNavigationElements(element);
246
- if (element instanceof models_1.ReflectionCategory || element instanceof models_1.ReflectionGroup) {
247
- if (!children?.length) {
260
+ buildNavigation(project) {
261
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
262
+ const theme = this;
263
+ const opts = this.application.options.getValue("navigation");
264
+ const leaves = this.application.options.getValue("navigationLeaves");
265
+ return getNavigationElements(project) || [];
266
+ function toNavigation(element) {
267
+ if (opts.excludeReferences && element instanceof ReferenceReflection) {
248
268
  return;
249
269
  }
270
+ const children = getNavigationElements(element);
271
+ if (element instanceof ReflectionCategory || element instanceof ReflectionGroup) {
272
+ if (!children?.length) {
273
+ return;
274
+ }
275
+ return {
276
+ text: element.title,
277
+ children,
278
+ };
279
+ }
250
280
  return {
251
- text: element.title,
252
- children,
281
+ text: getDisplayName(element),
282
+ path: element.url,
283
+ kind: element.kind & ReflectionKind.Project ? undefined : element.kind,
284
+ class: classNames({ deprecated: element.isDeprecated() }, theme.getReflectionClasses(element)),
285
+ children: children?.length ? children : undefined,
253
286
  };
254
287
  }
255
- if (opts.excludeReferences && element instanceof models_1.ReferenceReflection) {
256
- return;
257
- }
258
- return {
259
- text: (0, lib_1.getDisplayName)(element),
260
- path: element.url,
261
- kind: element.kind,
262
- class: (0, lib_1.classNames)({ deprecated: element.isDeprecated() }, theme.getReflectionClasses(element)),
263
- children: children?.length ? children : undefined,
264
- };
265
- }
266
- function getNavigationElements(parent) {
267
- if (parent instanceof models_1.ReflectionCategory) {
268
- return (0, utils_1.filterMap)(parent.children, toNavigation);
269
- }
270
- if (parent instanceof models_1.ReflectionGroup) {
271
- if (shouldShowCategories(parent.owningReflection, opts) && parent.categories) {
272
- return (0, utils_1.filterMap)(parent.categories, toNavigation);
288
+ function getNavigationElements(parent) {
289
+ if (parent instanceof ReflectionCategory) {
290
+ return filterMap(parent.children, toNavigation);
273
291
  }
274
- return (0, utils_1.filterMap)(parent.children, toNavigation);
275
- }
276
- if (leaves.includes(parent.getFullName())) {
277
- return;
278
- }
279
- if (!parent.kindOf(models_1.ReflectionKind.MayContainDocuments)) {
280
- return;
281
- }
282
- if (parent.isDocument()) {
283
- return (0, utils_1.filterMap)(parent.children, toNavigation);
284
- }
285
- if (!parent.kindOf(models_1.ReflectionKind.SomeModule | models_1.ReflectionKind.Project)) {
286
- // Tricky: Non-module children don't show up in the navigation pane,
287
- // but any documents added by them should.
288
- return (0, utils_1.filterMap)(parent.documents, toNavigation);
289
- }
290
- if (parent.categories && shouldShowCategories(parent, opts)) {
291
- return filterMapWithNoneCollection(parent.categories);
292
- }
293
- if (parent.groups && shouldShowGroups(parent, opts)) {
294
- return filterMapWithNoneCollection(parent.groups);
295
- }
296
- if (opts.includeFolders && parent.childrenIncludingDocuments?.some((child) => child.name.includes("/"))) {
297
- return deriveModuleFolders(parent.childrenIncludingDocuments);
292
+ if (parent instanceof ReflectionGroup) {
293
+ if (shouldShowCategories(parent.owningReflection, opts) && parent.categories) {
294
+ return filterMap(parent.categories, toNavigation);
295
+ }
296
+ return filterMap(parent.children, toNavigation);
297
+ }
298
+ if (leaves.includes(parent.getFullName())) {
299
+ return;
300
+ }
301
+ if (!parent.kindOf(ReflectionKind.MayContainDocuments)) {
302
+ return;
303
+ }
304
+ if (parent.isDocument()) {
305
+ return filterMap(parent.children, toNavigation);
306
+ }
307
+ if (!parent.kindOf(ReflectionKind.SomeModule | ReflectionKind.Project)) {
308
+ // Tricky: Non-module children don't show up in the navigation pane,
309
+ // but any documents added by them should.
310
+ return filterMap(parent.documents, toNavigation);
311
+ }
312
+ if (parent.categories && shouldShowCategories(parent, opts)) {
313
+ return filterMapWithNoneCollection(parent.categories);
314
+ }
315
+ if (parent.groups && shouldShowGroups(parent, opts)) {
316
+ return filterMapWithNoneCollection(parent.groups);
317
+ }
318
+ if (opts.includeFolders && parent.childrenIncludingDocuments?.some((child) => child.name.includes("/"))) {
319
+ return deriveModuleFolders(parent.childrenIncludingDocuments);
320
+ }
321
+ return filterMap(parent.childrenIncludingDocuments, toNavigation);
298
322
  }
299
- return (0, utils_1.filterMap)(parent.childrenIncludingDocuments, toNavigation);
300
- }
301
- function filterMapWithNoneCollection(reflection) {
302
- const none = reflection.find((x) => x.title.toLocaleLowerCase() === "none");
303
- const others = reflection.filter((x) => x.title.toLocaleLowerCase() !== "none");
304
- const mappedOthers = (0, utils_1.filterMap)(others, toNavigation);
305
- if (none) {
306
- const noneMappedChildren = (0, utils_1.filterMap)(none.children, toNavigation);
307
- return [...noneMappedChildren, ...mappedOthers];
323
+ function filterMapWithNoneCollection(reflection) {
324
+ const none = reflection.find((x) => x.title.toLocaleLowerCase() === "none");
325
+ const others = reflection.filter((x) => x.title.toLocaleLowerCase() !== "none");
326
+ const mappedOthers = filterMap(others, toNavigation);
327
+ if (none) {
328
+ const noneMappedChildren = filterMap(none.children, toNavigation);
329
+ return [...noneMappedChildren, ...mappedOthers];
330
+ }
331
+ return mappedOthers;
308
332
  }
309
- return mappedOthers;
310
- }
311
- function deriveModuleFolders(children) {
312
- const result = [];
313
- const resolveOrCreateParents = (path, root = result) => {
314
- if (path.length > 1) {
315
- const inner = root.find((el) => el.text === path[0]);
316
- if (inner) {
317
- inner.children ||= [];
318
- return resolveOrCreateParents(path.slice(1), inner.children);
333
+ function deriveModuleFolders(children) {
334
+ const result = [];
335
+ const resolveOrCreateParents = (path, root = result) => {
336
+ if (path.length > 1) {
337
+ const inner = root.find((el) => el.text === path[0]);
338
+ if (inner) {
339
+ inner.children ||= [];
340
+ return resolveOrCreateParents(path.slice(1), inner.children);
341
+ }
342
+ else {
343
+ root.push({
344
+ text: path[0],
345
+ children: [],
346
+ });
347
+ return resolveOrCreateParents(path.slice(1), root[root.length - 1].children);
348
+ }
319
349
  }
320
- else {
321
- root.push({
322
- text: path[0],
323
- children: [],
324
- });
325
- return resolveOrCreateParents(path.slice(1), root[root.length - 1].children);
350
+ return root;
351
+ };
352
+ // Note: This might end up putting a module within another module if we document
353
+ // both foo/index.ts and foo/bar.ts.
354
+ for (const child of children.filter((c) => c.hasOwnDocument)) {
355
+ const nav = toNavigation(child);
356
+ if (nav) {
357
+ const parts = child.name.split("/");
358
+ const collection = resolveOrCreateParents(parts);
359
+ nav.text = parts[parts.length - 1];
360
+ collection.push(nav);
326
361
  }
327
362
  }
328
- return root;
329
- };
330
- // Note: This might end up putting a module within another module if we document
331
- // both foo/index.ts and foo/bar.ts.
332
- for (const child of children.filter((c) => c.hasOwnDocument)) {
333
- const nav = toNavigation(child);
334
- if (nav) {
335
- const parts = child.name.split("/");
336
- const collection = resolveOrCreateParents(parts);
337
- nav.text = parts[parts.length - 1];
338
- collection.push(nav);
363
+ // Now merge single-possible-paths together so we don't have folders in our navigation
364
+ // which contain only another single folder.
365
+ if (opts.compactFolders) {
366
+ const queue = [...result];
367
+ while (queue.length) {
368
+ const review = queue.shift();
369
+ queue.push(...(review.children || []));
370
+ if (review.kind || review.path)
371
+ continue;
372
+ if (review.children?.length === 1) {
373
+ const copyFrom = review.children[0];
374
+ const fullName = `${review.text}/${copyFrom.text}`;
375
+ delete review.children;
376
+ Object.assign(review, copyFrom);
377
+ review.text = fullName;
378
+ queue.push(review);
379
+ }
380
+ }
339
381
  }
382
+ return result;
383
+ }
384
+ }
385
+ /**
386
+ * Generate an anchor url for the given reflection and all of its children.
387
+ *
388
+ * @param reflection The reflection an anchor url should be created for.
389
+ * @param container The nearest reflection having an own document.
390
+ */
391
+ applyAnchorUrl(reflection, container) {
392
+ if (!(reflection instanceof DeclarationReflection) &&
393
+ !(reflection instanceof SignatureReflection) &&
394
+ !(reflection instanceof TypeParameterReflection)) {
395
+ return;
340
396
  }
341
- // Now merge single-possible-paths together so we don't have folders in our navigation
342
- // which contain only another single folder.
343
- if (opts.compactFolders) {
344
- const queue = [...result];
345
- while (queue.length) {
346
- const review = queue.shift();
347
- queue.push(...(review.children || []));
348
- if (review.kind || review.path)
349
- continue;
350
- if (review.children?.length === 1) {
351
- const copyFrom = review.children[0];
352
- const fullName = `${review.text}/${copyFrom.text}`;
353
- delete review.children;
354
- Object.assign(review, copyFrom);
355
- review.text = fullName;
356
- queue.push(review);
397
+ if (!reflection.url || !DefaultTheme.URL_PREFIX.test(reflection.url)) {
398
+ let refl = reflection;
399
+ const parts = [refl.name];
400
+ while (refl.parent && refl.parent !== container && !(reflection.parent instanceof ProjectReflection)) {
401
+ refl = refl.parent;
402
+ // Avoid duplicate names for signatures
403
+ if (parts[0] !== refl.name) {
404
+ parts.unshift(refl.name);
357
405
  }
358
406
  }
407
+ const anchor = this.getSlugger(reflection).slug(parts.join("."));
408
+ reflection.url = container.url + "#" + anchor;
409
+ reflection.anchor = anchor;
410
+ reflection.hasOwnDocument = false;
359
411
  }
360
- return result;
361
- }
362
- }
363
- getSlugger(reflection) {
364
- if (this.sluggers.has(reflection)) {
365
- return this.sluggers.get(reflection);
366
- }
367
- // A slugger should always be defined at least for the project
368
- return this.getSlugger(reflection.parent);
369
- }
370
- /**
371
- * Generate an anchor url for the given reflection and all of its children.
372
- *
373
- * @param reflection The reflection an anchor url should be created for.
374
- * @param container The nearest reflection having an own document.
375
- */
376
- static applyAnchorUrl(reflection, container) {
377
- if (!(reflection instanceof models_1.DeclarationReflection) &&
378
- !(reflection instanceof models_1.SignatureReflection) &&
379
- !(reflection instanceof models_1.TypeParameterReflection)) {
380
- return;
381
- }
382
- if (!reflection.url || !DefaultTheme.URL_PREFIX.test(reflection.url)) {
383
- const anchor = DefaultTheme.getUrl(reflection, container, ".");
384
- reflection.url = container.url + "#" + anchor;
385
- reflection.anchor = anchor;
386
- reflection.hasOwnDocument = false;
412
+ reflection.traverse((child) => {
413
+ this.applyAnchorUrl(child, container);
414
+ return true;
415
+ });
387
416
  }
388
- reflection.traverse((child) => {
389
- DefaultTheme.applyAnchorUrl(child, container);
390
- return true;
391
- });
392
- }
393
- }
394
- exports.DefaultTheme = DefaultTheme;
395
- DefaultTheme.URL_PREFIX = /^(http|ftp)s?:\/\//;
417
+ };
418
+ })();
419
+ export { DefaultTheme };
396
420
  function getReflectionClasses(reflection, filters) {
397
421
  const classes = [];
398
422
  // Filter classes should match up with the settings function in
@@ -421,12 +445,12 @@ function getReflectionClasses(reflection, filters) {
421
445
  else if (key.startsWith("@")) {
422
446
  if (key === "@deprecated") {
423
447
  if (reflection.isDeprecated()) {
424
- classes.push((0, lib_1.toStyleClass)(`tsd-is-${key.substring(1)}`));
448
+ classes.push(toStyleClass(`tsd-is-${key.substring(1)}`));
425
449
  }
426
450
  }
427
451
  else if (reflection.comment?.hasModifier(key) ||
428
452
  reflection.comment?.getTag(key)) {
429
- classes.push((0, lib_1.toStyleClass)(`tsd-is-${key.substring(1)}`));
453
+ classes.push(toStyleClass(`tsd-is-${key.substring(1)}`));
430
454
  }
431
455
  }
432
456
  }