typedoc 0.28.1 → 0.28.2

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 (37) hide show
  1. package/dist/lib/application.d.ts +2 -2
  2. package/dist/lib/application.js +6 -4
  3. package/dist/lib/converter/comments/index.js +6 -1
  4. package/dist/lib/converter/converter.d.ts +1 -1
  5. package/dist/lib/converter/converter.js +1 -1
  6. package/dist/lib/converter/factories/signature.d.ts +1 -0
  7. package/dist/lib/converter/factories/signature.js +28 -5
  8. package/dist/lib/converter/plugins/CategoryPlugin.js +1 -1
  9. package/dist/lib/converter/plugins/GroupPlugin.js +3 -0
  10. package/dist/lib/converter/symbols.js +4 -1
  11. package/dist/lib/converter/types.js +22 -10
  12. package/dist/lib/internationalization/locales/zh.cjs +6 -0
  13. package/dist/lib/internationalization/locales/zh.d.cts +6 -0
  14. package/dist/lib/models/types.js +9 -9
  15. package/dist/lib/output/renderer.d.ts +5 -1
  16. package/dist/lib/output/renderer.js +9 -1
  17. package/dist/lib/output/router.js +17 -5
  18. package/dist/lib/output/themes/MarkedPlugin.js +1 -1
  19. package/dist/lib/output/themes/default/partials/index.js +5 -13
  20. package/dist/lib/output/themes/default/partials/members.js +9 -6
  21. package/dist/lib/output/themes/default/partials/moduleReflection.js +15 -8
  22. package/dist/lib/output/themes/default/partials/navigation.js +13 -5
  23. package/dist/lib/output/themes/lib.d.ts +3 -2
  24. package/dist/lib/output/themes/lib.js +22 -15
  25. package/dist/lib/serialization/deserializer.d.ts +1 -1
  26. package/dist/lib/serialization/deserializer.js +1 -1
  27. package/dist/lib/serialization/serializer.d.ts +1 -1
  28. package/dist/lib/serialization/serializer.js +1 -1
  29. package/dist/lib/utils/entry-point.js +5 -3
  30. package/dist/lib/utils/options/defaults.js +2 -0
  31. package/dist/lib/utils/options/options.d.ts +1 -1
  32. package/dist/lib/utils/options/options.js +1 -1
  33. package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
  34. package/dist/lib/utils/options/tsdoc-defaults.js +1 -0
  35. package/package.json +10 -10
  36. package/static/style.css +4 -4
  37. package/tsdoc.json +5 -0
@@ -34,7 +34,7 @@ export interface ApplicationEvents {
34
34
  * Access to an Application instance can be retrieved with {@link Application.bootstrap} or
35
35
  * {@link Application.bootstrapWithPlugins}. It can not be constructed manually.
36
36
  *
37
- * @group Common
37
+ * @group None
38
38
  * @summary Root level class which contains most useful behavior.
39
39
  */
40
40
  export declare class Application extends AbstractComponent<Application, ApplicationEvents> {
@@ -109,7 +109,7 @@ export declare class Application extends AbstractComponent<Application, Applicat
109
109
  * @example
110
110
  * Initialize the application with pretty-printing output disabled.
111
111
  * ```ts
112
- * const app = Application.bootstrap({ pretty: false });
112
+ * const app = await Application.bootstrap({ pretty: false });
113
113
  * ```
114
114
  *
115
115
  * @param options Options to set during initialization
@@ -95,7 +95,7 @@ const DEFAULT_READERS = [
95
95
  * Access to an Application instance can be retrieved with {@link Application.bootstrap} or
96
96
  * {@link Application.bootstrapWithPlugins}. It can not be constructed manually.
97
97
  *
98
- * @group Common
98
+ * @group None
99
99
  * @summary Root level class which contains most useful behavior.
100
100
  */
101
101
  let Application = (() => {
@@ -236,7 +236,7 @@ let Application = (() => {
236
236
  * @example
237
237
  * Initialize the application with pretty-printing output disabled.
238
238
  * ```ts
239
- * const app = Application.bootstrap({ pretty: false });
239
+ * const app = await Application.bootstrap({ pretty: false });
240
240
  * ```
241
241
  *
242
242
  * @param options Options to set during initialization
@@ -673,10 +673,12 @@ let Application = (() => {
673
673
  const entryPoints = this.entryPoints.flatMap((entry) => {
674
674
  const result = glob(entry, rootDir);
675
675
  if (result.length === 0) {
676
- this.logger.warn(i18n.entrypoint_did_not_match_files_0(nicePath(entry)));
676
+ // #2918 - do not pass entry through nicePath here in case it contains
677
+ // windows path separators which should cause additional warnings.
678
+ this.logger.warn(i18n.entrypoint_did_not_match_files_0(entry));
677
679
  }
678
680
  else if (result.length !== 1) {
679
- this.logger.verbose(`Expanded ${nicePath(entry)} to:\n\t${result
681
+ this.logger.verbose(`Expanded ${entry} to:\n\t${result
680
682
  .map(nicePath)
681
683
  .join("\n\t")}`);
682
684
  }
@@ -172,7 +172,12 @@ export function getJsDocComment(declaration, config, logger, checker, files) {
172
172
  }
173
173
  const tag = comment.getIdentifiedTag(name, `@${declaration.tagName.text}`);
174
174
  if (!tag) {
175
- logger.error(i18n.failed_to_find_jsdoc_tag_for_name_0(name), declaration);
175
+ // If this is a template tag with multiple declarations, we warned already if there
176
+ // was a comment attached. If there wasn't, then don't error about failing to find
177
+ // a tag because this is unsupported.
178
+ if (!ts.isJSDocTemplateTag(declaration)) {
179
+ logger.error(i18n.failed_to_find_jsdoc_tag_for_name_0(name), declaration);
180
+ }
176
181
  }
177
182
  else {
178
183
  const result = new Comment(Comment.cloneDisplayParts(tag.content));
@@ -36,7 +36,7 @@ export interface ConverterEvents {
36
36
  /**
37
37
  * Compiles source files using TypeScript and converts compiler symbols to reflections.
38
38
  *
39
- * @group Common
39
+ * @group None
40
40
  * @summary Responsible for converting TypeScript symbols into {@link Reflection}s and {@link Type}s.
41
41
  */
42
42
  export declare class Converter extends AbstractComponent<Application, ConverterEvents> {
@@ -62,7 +62,7 @@ import { MergeModuleWithPlugin } from "./plugins/MergeModuleWithPlugin.js";
62
62
  /**
63
63
  * Compiles source files using TypeScript and converts compiler symbols to reflections.
64
64
  *
65
- * @group Common
65
+ * @group None
66
66
  * @summary Responsible for converting TypeScript symbols into {@link Reflection}s and {@link Type}s.
67
67
  */
68
68
  let Converter = (() => {
@@ -7,6 +7,7 @@ export declare function createSignature(context: Context, kind: ReflectionKind.C
7
7
  */
8
8
  export declare function createConstructSignatureWithType(context: Context, signature: ts.Signature, classType: Reflection): void;
9
9
  export declare function convertParameterNodes(context: Context, sigRef: SignatureReflection, parameters: readonly (ts.JSDocParameterTag | ts.ParameterDeclaration)[]): ParameterReflection[];
10
+ export declare function convertTypeParameters(context: Context, parent: Reflection, parameters: readonly ts.TypeParameter[] | undefined): TypeParameterReflection[] | undefined;
10
11
  export declare function convertTypeParameterNodes(context: Context, parameters: readonly ts.TypeParameterDeclaration[] | undefined): TypeParameterReflection[] | undefined;
11
12
  export declare function createTypeParamReflection(param: ts.TypeParameterDeclaration, context: Context): TypeParameterReflection;
12
13
  export declare function convertTemplateParameterNodes(context: Context, nodes: readonly ts.JSDocTemplateTag[] | undefined): TypeParameterReflection[] | undefined;
@@ -82,8 +82,22 @@ export function createConstructSignatureWithType(context, signature, classType)
82
82
  const sigRefCtx = context.withScope(sigRef);
83
83
  if (declaration) {
84
84
  sigRef.comment = context.getSignatureComment(declaration);
85
+ if (sigRef.comment?.discoveryId === context.scope.parent?.comment?.discoveryId) {
86
+ delete sigRef.comment;
87
+ }
85
88
  }
86
- sigRef.typeParameters = convertTypeParameters(sigRefCtx, sigRef, signature.typeParameters);
89
+ const parameterSymbols = signature.thisParameter
90
+ ? [signature.thisParameter, ...signature.parameters]
91
+ : [...signature.parameters];
92
+ // Prevent a `this` parameter from appearing on constructor signature
93
+ // as TS disallows them on regular classes.
94
+ if (parameterSymbols[0]?.name === "this") {
95
+ parameterSymbols.shift();
96
+ }
97
+ sigRef.parameters = convertParameters(sigRefCtx, sigRef, parameterSymbols, declaration?.parameters);
98
+ sigRef.parameters = convertParameters(sigRefCtx, sigRef, parameterSymbols, undefined);
99
+ // Do NOT convert type parameters here, they go on the class itself in the @class case
100
+ // See #2914.
87
101
  sigRef.type = ReferenceType.createResolvedReference(context.scope.parent.name, classType, context.project);
88
102
  context.registerReflection(sigRef, undefined);
89
103
  context.scope.signatures ??= [];
@@ -203,7 +217,7 @@ function checkForDestructuredParameterDefaults(param, decl) {
203
217
  }
204
218
  }
205
219
  }
206
- function convertTypeParameters(context, parent, parameters) {
220
+ export function convertTypeParameters(context, parent, parameters) {
207
221
  return parameters?.map((param) => {
208
222
  const constraintT = param.getConstraint();
209
223
  const defaultT = param.getDefault();
@@ -236,9 +250,18 @@ export function convertTypeParameterNodes(context, parameters) {
236
250
  export function createTypeParamReflection(param, context) {
237
251
  const paramRefl = new TypeParameterReflection(param.name.text, context.scope, getVariance(param.modifiers));
238
252
  const paramScope = context.withScope(paramRefl);
239
- paramRefl.type = param.constraint
240
- ? context.converter.convertType(paramScope, param.constraint)
241
- : void 0;
253
+ if (ts.isJSDocTemplateTag(param.parent)) {
254
+ // With a @template tag, the constraint applies only to the
255
+ // first type parameter declared.
256
+ if (param.parent.typeParameters[0].name.text === param.name.text && param.parent.constraint) {
257
+ paramRefl.type = context.converter.convertType(paramScope, param.parent.constraint);
258
+ }
259
+ }
260
+ else {
261
+ paramRefl.type = param.constraint
262
+ ? context.converter.convertType(paramScope, param.constraint)
263
+ : void 0;
264
+ }
242
265
  paramRefl.default = param.default
243
266
  ? context.converter.convertType(paramScope, param.default)
244
267
  : void 0;
@@ -121,7 +121,7 @@ let CategoryPlugin = (() => {
121
121
  }
122
122
  }
123
123
  categorize(obj) {
124
- if (this.categorizeByGroup) {
124
+ if (this.categorizeByGroup && obj.groups) {
125
125
  this.groupCategorize(obj);
126
126
  }
127
127
  else {
@@ -150,6 +150,9 @@ let GroupPlugin = (() => {
150
150
  this.sortFunction(reflection.documents);
151
151
  this.sortFunction(reflection.childrenIncludingDocuments);
152
152
  }
153
+ if (reflection.comment?.hasModifier("@disableGroups")) {
154
+ return;
155
+ }
153
156
  reflection.groups = this.getReflectionGroups(reflection, reflection.childrenIncludingDocuments);
154
157
  }
155
158
  }
@@ -4,7 +4,7 @@ import { DeclarationReflection, IntrinsicType, LiteralType, ReferenceReflection,
4
4
  import { getEnumFlags, hasAllFlags, hasAnyFlag, i18n, removeFlag } from "#utils";
5
5
  import { convertDefaultValue } from "./convert-expression.js";
6
6
  import { convertIndexSignatures } from "./factories/index-signature.js";
7
- import { createConstructSignatureWithType, createSignature, createTypeParamReflection } from "./factories/signature.js";
7
+ import { convertTypeParameters, createConstructSignatureWithType, createSignature, createTypeParamReflection, } from "./factories/signature.js";
8
8
  import { convertJsDocAlias, convertJsDocCallback } from "./jsdoc.js";
9
9
  import { getHeritageTypes } from "./utils/nodes.js";
10
10
  import { removeUndefined } from "./utils/reflections.js";
@@ -702,6 +702,9 @@ function convertSymbolAsClass(context, symbol, exportSymbol) {
702
702
  for (const sig of ctors) {
703
703
  createConstructSignatureWithType(constructContext, sig, reflection);
704
704
  }
705
+ // Take the type parameters from the first constructor signature and use
706
+ // them as the type parameters for the class, #2914
707
+ reflection.typeParameters = convertTypeParameters(rc, reflection, ctors[0].getTypeParameters());
705
708
  const instType = ctors[0].getReturnType();
706
709
  convertSymbols(rc, instType.getProperties());
707
710
  for (const sig of instType.getCallSignatures()) {
@@ -440,11 +440,7 @@ const referenceConverter = {
440
440
  // in the type we just retrieved from node.typeName.
441
441
  if (!node.typeArguments &&
442
442
  context.shouldInline(symbol, name)) {
443
- // typeLiteralConverter doesn't use the node, so we can get away with lying here.
444
- // This might not actually be safe, it appears that it is in the relatively small
445
- // amount of testing I've done with it, but I wouldn't be surprised if someone manages
446
- // to find a crash.
447
- return typeLiteralConverter.convertType(context, type, null, undefined);
443
+ return convertTypeInlined(context, type);
448
444
  }
449
445
  const ref = context.createSymbolReference(context.resolveAliasedSymbol(symbol), context, name);
450
446
  ref.typeArguments = node.typeArguments?.map((type) => convertType(context, type));
@@ -470,11 +466,7 @@ const referenceConverter = {
470
466
  name = node.typeName.right.text;
471
467
  }
472
468
  if (context.shouldInline(symbol, name)) {
473
- // typeLiteralConverter doesn't use the node, so we can get away with lying here.
474
- // This might not actually be safe, it appears that it is in the relatively small
475
- // amount of testing I've done with it, but I wouldn't be surprised if someone manages
476
- // to find a crash.
477
- return typeLiteralConverter.convertType(context, type, null, undefined);
469
+ return convertTypeInlined(context, type);
478
470
  }
479
471
  const ref = context.createSymbolReference(context.resolveAliasedSymbol(symbol), context, name);
480
472
  if (type.flags & ts.TypeFlags.Substitution) {
@@ -785,3 +777,23 @@ function normalizeUnion(types) {
785
777
  types.splice(Math.min(trueIndex, falseIndex), 1, new IntrinsicType("boolean"));
786
778
  }
787
779
  }
780
+ function convertTypeInlined(context, type) {
781
+ if (type.isUnion()) {
782
+ const types = type.types.map(type => convertType(context, type));
783
+ return new UnionType(types);
784
+ }
785
+ if (type.isIntersection()) {
786
+ const types = type.types.map(type => convertType(context, type));
787
+ return new IntersectionType(types);
788
+ }
789
+ if (type.isLiteral()) {
790
+ return new LiteralType(typeof type.value === "object"
791
+ ? BigInt(type.value.base10Value) * (type.value.negative ? -1n : 1n)
792
+ : type.value);
793
+ }
794
+ if (context.checker.isArrayType(type)) {
795
+ const elementType = convertType(context, context.checker.getTypeArguments(type)[0]);
796
+ return new ArrayType(elementType);
797
+ }
798
+ return typeLiteralConverter.convertType(context, type);
799
+ }
@@ -18,6 +18,7 @@ module.exports = localeUtils.buildIncompleteTranslation({
18
18
  no_entry_points_for_packages: "没有为包模式提供入口点,无法生成文档",
19
19
  failed_to_find_packages: "找不到任何软件包,请确保您至少提供了一个包含 package.json 的目录作为入口点",
20
20
  nested_packages_unsupported_0: "位于 {0} 的项目已将 entryPointStrategy 设置为包,但不支持嵌套包",
21
+ package_option_0_should_be_specified_at_root: "由 packageOptions 设置的选项 {0} 仅在根级别有效",
21
22
  previous_error_occurred_when_reading_options_for_0: "读取 {0} 处的包的选项时发生上一个错误",
22
23
  converting_project_at_0: "正在转换 {0} 处的项目",
23
24
  failed_to_convert_packages: "无法转换一个或多个包,结果将不会合并在一起",
@@ -435,6 +436,10 @@ module.exports = localeUtils.buildIncompleteTranslation({
435
436
  tag_type: "类型",
436
437
  tag_typedef: "类型定义",
437
438
  tag_summary: "概述",
439
+ tag_preventInline: "取消内联",
440
+ tag_inlineType: "内联类型",
441
+ tag_preventExpand: "取消扩展",
442
+ tag_expandType: "扩展类型",
438
443
  // Inline tags
439
444
  tag_link: "链接",
440
445
  tag_label: "标记",
@@ -467,6 +472,7 @@ module.exports = localeUtils.buildIncompleteTranslation({
467
472
  tag_inline: "内联",
468
473
  tag_interface: "接口",
469
474
  tag_namespace: "命名空间",
475
+ tag_function: "函数",
470
476
  tag_overload: "重载",
471
477
  tag_private: "私有成员",
472
478
  tag_protected: "受保护成员",
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  no_entry_points_for_packages: string;
14
14
  failed_to_find_packages: string;
15
15
  nested_packages_unsupported_0: "位于 {0} 的项目已将 entryPointStrategy 设置为包,但不支持嵌套包";
16
+ package_option_0_should_be_specified_at_root: "由 packageOptions 设置的选项 {0} 仅在根级别有效";
16
17
  previous_error_occurred_when_reading_options_for_0: "读取 {0} 处的包的选项时发生上一个错误";
17
18
  converting_project_at_0: "正在转换 {0} 处的项目";
18
19
  failed_to_convert_packages: string;
@@ -400,6 +401,10 @@ declare const _default: {
400
401
  tag_type: string;
401
402
  tag_typedef: string;
402
403
  tag_summary: string;
404
+ tag_preventInline: string;
405
+ tag_inlineType: string;
406
+ tag_preventExpand: string;
407
+ tag_expandType: string;
403
408
  tag_link: string;
404
409
  tag_label: string;
405
410
  tag_linkcode: string;
@@ -430,6 +435,7 @@ declare const _default: {
430
435
  tag_inline: string;
431
436
  tag_interface: string;
432
437
  tag_namespace: string;
438
+ tag_function: string;
433
439
  tag_overload: string;
434
440
  tag_private: string;
435
441
  tag_protected: string;
@@ -899,17 +899,17 @@ export class ReflectionType extends Type {
899
899
  }
900
900
  getTypeString() {
901
901
  const parts = [];
902
- const sigs = this.declaration.getAllSignatures();
902
+ const sigs = this.declaration.getNonIndexSignatures();
903
903
  for (const sig of sigs) {
904
904
  parts.push(sigStr(sig, ": "));
905
905
  }
906
- if (this.declaration.children) {
907
- for (const p of this.declaration.children) {
908
- parts.push(`${p.name}${propertySep(p)} ${typeStr(p.type)}`);
909
- }
910
- return `{ ${parts.join("; ")} }`;
906
+ for (const p of this.declaration.children || []) {
907
+ parts.push(`${p.name}${propertySep(p)} ${typeStr(p.type)}`);
908
+ }
909
+ for (const s of this.declaration.indexSignatures || []) {
910
+ parts.push(sigStr(s, ": ", "[]"));
911
911
  }
912
- if (sigs.length === 1) {
912
+ if (sigs.length === 1 && parts.length === 1) {
913
913
  return sigStr(sigs[0], " => ");
914
914
  }
915
915
  if (parts.length === 0) {
@@ -1238,7 +1238,7 @@ function propertySep(refl) {
1238
1238
  function typeStr(type) {
1239
1239
  return type?.toString() ?? "any";
1240
1240
  }
1241
- function sigStr(sig, sep) {
1241
+ function sigStr(sig, sep, brackets = "()") {
1242
1242
  const params = joinArray(sig.parameters, ", ", (p) => `${p.name}${propertySep(p)} ${typeStr(p.type)}`);
1243
- return `(${params})${sep}${typeStr(sig.type)}`;
1243
+ return `${brackets[0]}${params}${brackets[1]}${sep}${typeStr(sig.type)}`;
1244
1244
  }
@@ -115,7 +115,7 @@ export interface RendererEvents {
115
115
  * an instance of {@link IndexEvent}.
116
116
  *
117
117
  * @summary Writes HTML output from TypeDoc's models
118
- * @group Common
118
+ * @group None
119
119
  */
120
120
  export declare class Renderer extends AbstractComponent<Application, RendererEvents> {
121
121
  private routers;
@@ -189,12 +189,16 @@ export declare class Renderer extends AbstractComponent<Application, RendererEve
189
189
  * @param theme
190
190
  */
191
191
  defineTheme(name: string, theme: new (renderer: Renderer) => Theme): void;
192
+ /** @internal intended for test usage only */
193
+ removeTheme(name: string): void;
192
194
  /**
193
195
  * Define a new router that can be used to determine the output structure.
194
196
  * @param name
195
197
  * @param router
196
198
  */
197
199
  defineRouter(name: string, router: new (app: Application) => Router): void;
200
+ /** @internal intended for test usage only */
201
+ removeRouter(name: string): void;
198
202
  /**
199
203
  * Render the given project reflection to the specified output directory.
200
204
  *
@@ -79,7 +79,7 @@ import { CategoryRouter, GroupRouter, KindDirRouter, KindRouter, StructureDirRou
79
79
  * an instance of {@link IndexEvent}.
80
80
  *
81
81
  * @summary Writes HTML output from TypeDoc's models
82
- * @group Common
82
+ * @group None
83
83
  */
84
84
  let Renderer = (() => {
85
85
  let _classSuper = AbstractComponent;
@@ -231,6 +231,10 @@ let Renderer = (() => {
231
231
  }
232
232
  this.themes.set(name, theme);
233
233
  }
234
+ /** @internal intended for test usage only */
235
+ removeTheme(name) {
236
+ this.themes.delete(name);
237
+ }
234
238
  /**
235
239
  * Define a new router that can be used to determine the output structure.
236
240
  * @param name
@@ -242,6 +246,10 @@ let Renderer = (() => {
242
246
  }
243
247
  this.routers.set(name, router);
244
248
  }
249
+ /** @internal intended for test usage only */
250
+ removeRouter(name) {
251
+ this.routers.delete(name);
252
+ }
245
253
  /**
246
254
  * Render the given project reflection to the specified output directory.
247
255
  *
@@ -166,6 +166,16 @@ let BaseRouter = (() => {
166
166
  // an own document.
167
167
  from = from.parent;
168
168
  }
169
+ let toPage = to;
170
+ while (!this.hasOwnDocument(toPage)) {
171
+ toPage = toPage.parent;
172
+ }
173
+ // We unfortunately have to special case ProjectReflection as it is
174
+ // the model used twice for rendering. This should be changed in a
175
+ // future version to remove this hackery.
176
+ if (from === toPage && !(to instanceof ProjectReflection)) {
177
+ return to === toPage ? "" : `#${this.getAnchor(to)}`;
178
+ }
169
179
  const fromUrl = this.getFullUrl(from);
170
180
  const toUrl = this.getFullUrl(to);
171
181
  let equal = true;
@@ -181,12 +191,14 @@ let BaseRouter = (() => {
181
191
  }
182
192
  }
183
193
  }
184
- if (equal && !(to instanceof ProjectReflection)) {
185
- if (fromUrl === toUrl) {
186
- return "";
187
- }
188
- return `#${this.getAnchor(to)}`;
194
+ // If equal is still set, we're going to a page either in
195
+ // the same directory as this page, or a lower directory,
196
+ // don't bother going up directories just to come back down.
197
+ if (equal) {
198
+ return toUrl.substring(start);
189
199
  }
200
+ // Otherwise, go up until we get to the common directory
201
+ // and then back down to the target path.
190
202
  return "../".repeat(slashes) + toUrl.substring(start);
191
203
  }
192
204
  baseRelativeUrl(from, target) {
@@ -177,7 +177,7 @@ let MarkedPlugin = (() => {
177
177
  let url;
178
178
  let kindClass;
179
179
  if (typeof part.target === "string") {
180
- url = part.target;
180
+ url = part.target === "#" ? undefined : part.target;
181
181
  }
182
182
  else if ("id" in part.target) {
183
183
  // No point in trying to resolve a ReflectionSymbolId at this point, we've already
@@ -1,8 +1,8 @@
1
- import { classNames, renderName } from "../../lib.js";
1
+ import { classNames, getMemberSections, isNoneSection, renderName } from "../../lib.js";
2
2
  import { i18n, JSX } from "#utils";
3
- function renderCategory({ urlTo, reflectionIcon, getReflectionClasses, markdown }, item, prependName = "") {
3
+ function renderSection({ urlTo, reflectionIcon, getReflectionClasses, markdown }, item) {
4
4
  return (JSX.createElement("section", { class: "tsd-index-section" },
5
- JSX.createElement("h3", { class: "tsd-index-heading" }, prependName ? `${prependName} - ${item.title}` : item.title),
5
+ !isNoneSection(item) && JSX.createElement("h3", { class: "tsd-index-heading" }, item.title),
6
6
  item.description && (JSX.createElement("div", { class: "tsd-comment tsd-typography" },
7
7
  JSX.createElement(JSX.Raw, { html: markdown(item.description) }))),
8
8
  JSX.createElement("div", { class: "tsd-index-list" }, item.children.map((item) => (JSX.createElement(JSX.Fragment, null,
@@ -12,15 +12,7 @@ function renderCategory({ urlTo, reflectionIcon, getReflectionClasses, markdown
12
12
  "\n"))))));
13
13
  }
14
14
  export function index(context, props) {
15
- let content = [];
16
- if (props.categories?.length) {
17
- content = props.categories.map((item) => renderCategory(context, item));
18
- }
19
- else if (props.groups?.length) {
20
- content = props.groups.flatMap((item) => item.categories
21
- ? item.categories.map((item2) => renderCategory(context, item2, item.title))
22
- : renderCategory(context, item));
23
- }
15
+ const sections = getMemberSections(props);
24
16
  return (JSX.createElement(JSX.Fragment, null,
25
17
  JSX.createElement("section", { class: "tsd-panel-group tsd-index-group" },
26
18
  JSX.createElement("section", { class: "tsd-panel tsd-index-panel" },
@@ -28,5 +20,5 @@ export function index(context, props) {
28
20
  JSX.createElement("summary", { class: "tsd-accordion-summary tsd-index-summary" },
29
21
  context.icons.chevronSmall(),
30
22
  JSX.createElement("h5", { class: "tsd-index-heading uppercase" }, i18n.theme_index())),
31
- JSX.createElement("div", { class: "tsd-accordion-details" }, content))))));
23
+ JSX.createElement("div", { class: "tsd-accordion-details" }, sections.map(s => renderSection(context, s))))))));
32
24
  }
@@ -1,14 +1,17 @@
1
1
  import { JSX } from "#utils";
2
2
  import {} from "../../../../models/index.js";
3
- import { getMemberSections } from "../../lib.js";
3
+ import { getMemberSections, isNoneSection } from "../../lib.js";
4
4
  export function members(context, props) {
5
5
  const sections = getMemberSections(props, (child) => !context.router.hasOwnDocument(child));
6
- return (JSX.createElement(JSX.Fragment, null, sections.map(({ title, children }) => {
7
- context.page.startNewSection(title);
6
+ return (JSX.createElement(JSX.Fragment, null, sections.map((section) => {
7
+ if (isNoneSection(section)) {
8
+ return (JSX.createElement("section", { class: "tsd-panel-group tsd-member-group" }, section.children.map((item) => context.member(item))));
9
+ }
10
+ context.page.startNewSection(section.title);
8
11
  return (JSX.createElement("details", { class: "tsd-panel-group tsd-member-group tsd-accordion", open: true },
9
- JSX.createElement("summary", { class: "tsd-accordion-summary", "data-key": "section-" + title },
12
+ JSX.createElement("summary", { class: "tsd-accordion-summary", "data-key": "section-" + section.title },
10
13
  context.icons.chevronDown(),
11
- JSX.createElement("h2", null, title)),
12
- JSX.createElement("section", null, children.map((item) => context.member(item)))));
14
+ JSX.createElement("h2", null, section.title)),
15
+ JSX.createElement("section", null, section.children.map((item) => context.member(item)))));
13
16
  })));
14
17
  }
@@ -1,6 +1,6 @@
1
1
  import { ReferenceReflection, ReflectionKind, } from "../../../../models/index.js";
2
2
  import { JSX } from "#utils";
3
- import { classNames, getDisplayName, getMemberSections, getUniquePath, join } from "../../lib.js";
3
+ import { classNames, getDisplayName, getMemberSections, getUniquePath, isNoneSection, join } from "../../lib.js";
4
4
  import { anchorIcon } from "./anchor-icon.js";
5
5
  export function moduleReflection(context, mod) {
6
6
  const sections = getMemberSections(mod);
@@ -10,15 +10,22 @@ export function moduleReflection(context, mod) {
10
10
  context.commentTags(mod))),
11
11
  mod.isDeclaration() && mod.kind === ReflectionKind.Module && mod.readme?.length && (JSX.createElement("section", { class: "tsd-panel tsd-typography" },
12
12
  JSX.createElement(JSX.Raw, { html: context.markdown(mod.readme) }))),
13
- sections.map(({ title, children, description }) => {
14
- context.page.startNewSection(title);
13
+ sections.map((section) => {
14
+ if (!isNoneSection(section)) {
15
+ context.page.startNewSection(section.title);
16
+ }
17
+ const content = (JSX.createElement(JSX.Fragment, null,
18
+ section.description && (JSX.createElement("div", { class: "tsd-comment tsd-typography" },
19
+ JSX.createElement(JSX.Raw, { html: context.markdown(section.description) }))),
20
+ JSX.createElement("dl", { class: "tsd-member-summaries" }, section.children.map((item) => context.moduleMemberSummary(item)))));
21
+ if (isNoneSection(section)) {
22
+ return (JSX.createElement("section", { class: "tsd-panel-group tsd-member-group" }, content));
23
+ }
15
24
  return (JSX.createElement("details", { class: "tsd-panel-group tsd-member-group tsd-accordion", open: true },
16
- JSX.createElement("summary", { class: "tsd-accordion-summary", "data-key": "section-" + title },
25
+ JSX.createElement("summary", { class: "tsd-accordion-summary", "data-key": "section-" + section.title },
17
26
  context.icons.chevronDown(),
18
- JSX.createElement("h2", null, title)),
19
- description && (JSX.createElement("div", { class: "tsd-comment tsd-typography" },
20
- JSX.createElement(JSX.Raw, { html: context.markdown(description) }))),
21
- JSX.createElement("dl", { class: "tsd-member-summaries" }, children.map((item) => context.moduleMemberSummary(item)))));
27
+ JSX.createElement("h2", null, section.title)),
28
+ content));
22
29
  })));
23
30
  }
24
31
  export function moduleMemberSummary(context, member) {
@@ -87,12 +87,20 @@ function buildSectionNavigation(context, headings) {
87
87
  const built = (JSX.createElement("ul", null, level.map((l) => JSX.createElement("li", null, l))));
88
88
  levels[levels.length - 1].push(built);
89
89
  }
90
+ function getInferredHeadingLevel(heading) {
91
+ if (heading.level) {
92
+ // Regular heading
93
+ return heading.level + 2;
94
+ }
95
+ if (heading.kind) {
96
+ // Reflection
97
+ return 2;
98
+ }
99
+ // Group/category
100
+ return 1;
101
+ }
90
102
  for (const heading of headings) {
91
- const inferredLevel = heading.level
92
- ? heading.level + 2 // regular heading
93
- : heading.kind
94
- ? 2 // reflection
95
- : 1; // group/category
103
+ const inferredLevel = getInferredHeadingLevel(heading);
96
104
  while (inferredLevel < levels.length) {
97
105
  finalizeLevel(false);
98
106
  }
@@ -25,12 +25,13 @@ export declare function renderTypeParametersSignature(context: DefaultThemeRende
25
25
  */
26
26
  export declare function renderName(refl: Reflection): JSX.Element | (string | JSX.Element)[];
27
27
  export declare function getHierarchyRoots(project: ProjectReflection): DeclarationReflection[];
28
- export interface MemberSections {
28
+ export declare function isNoneSection(section: MemberSection): boolean;
29
+ export interface MemberSection {
29
30
  title: string;
30
31
  description?: CommentDisplayPart[];
31
32
  children: Array<DocumentReflection | DeclarationReflection>;
32
33
  }
33
- export declare function getMemberSections(parent: ContainerReflection, childFilter?: (refl: Reflection) => boolean): MemberSections[];
34
+ export declare function getMemberSections(parent: ContainerReflection, childFilter?: (refl: Reflection) => boolean): MemberSection[];
34
35
  /**
35
36
  * Returns a (hopefully) globally unique path for the given reflection.
36
37
  *
@@ -70,17 +70,6 @@ export function hasTypeParameters(reflection) {
70
70
  export function renderTypeParametersSignature(context, typeParameters) {
71
71
  if (!typeParameters || typeParameters.length === 0)
72
72
  return JSX.createElement(JSX.Fragment, null);
73
- const hideParamTypes = false; // context.options.getValue("hideTypesInSignatureTitle");
74
- if (hideParamTypes) {
75
- return (JSX.createElement(JSX.Fragment, null,
76
- JSX.createElement("span", { class: "tsd-signature-symbol" }, "<"),
77
- join(JSX.createElement("span", { class: "tsd-signature-symbol" }, ", "), typeParameters, (item) => (JSX.createElement(JSX.Fragment, null,
78
- (item.flags.isConst || item.varianceModifier) && (JSX.createElement("span", { class: "tsd-signature-keyword" },
79
- item.flags.isConst && "const ",
80
- item.varianceModifier && `${item.varianceModifier} `)),
81
- JSX.createElement("a", { class: "tsd-signature-type tsd-kind-type-parameter", href: context.urlTo(item) }, item.name)))),
82
- JSX.createElement("span", { class: "tsd-signature-symbol" }, ">")));
83
- }
84
73
  return (JSX.createElement(JSX.Fragment, null,
85
74
  JSX.createElement("span", { class: "tsd-signature-symbol" }, "<"),
86
75
  join(JSX.createElement("span", { class: "tsd-signature-symbol" }, ", "), typeParameters, (item) => (JSX.createElement(JSX.Fragment, null,
@@ -135,6 +124,18 @@ export function getHierarchyRoots(project) {
135
124
  rootsCache.set(project, result);
136
125
  return result;
137
126
  }
127
+ export function isNoneSection(section) {
128
+ return section.title.toLocaleLowerCase() === "none";
129
+ }
130
+ function sortNoneSectionFirst(a, b) {
131
+ if (isNoneSection(a)) {
132
+ return -1;
133
+ }
134
+ if (isNoneSection(b)) {
135
+ return 1;
136
+ }
137
+ return 0;
138
+ }
138
139
  export function getMemberSections(parent, childFilter = () => true) {
139
140
  if (parent.categories?.length) {
140
141
  return filterMap(parent.categories, (cat) => {
@@ -146,17 +147,17 @@ export function getMemberSections(parent, childFilter = () => true) {
146
147
  description: cat.description,
147
148
  children,
148
149
  };
149
- });
150
+ }).sort(sortNoneSectionFirst);
150
151
  }
151
152
  if (parent.groups?.length) {
152
153
  return parent.groups.flatMap((group) => {
153
154
  if (group.categories?.length) {
154
- return filterMap(group.categories, (cat) => {
155
+ return filterMap(group.categories.slice().sort(sortNoneSectionFirst), (cat) => {
155
156
  const children = cat.children.filter(childFilter);
156
157
  if (!children.length)
157
158
  return;
158
159
  return {
159
- title: `${group.title} - ${cat.title}`,
160
+ title: isNoneSection(cat) ? group.title : `${group.title} - ${cat.title}`,
160
161
  description: cat.description,
161
162
  children,
162
163
  };
@@ -170,7 +171,13 @@ export function getMemberSections(parent, childFilter = () => true) {
170
171
  description: group.description,
171
172
  children,
172
173
  };
173
- });
174
+ }).sort(sortNoneSectionFirst);
175
+ }
176
+ if (parent.children?.length) {
177
+ return [{
178
+ title: "none",
179
+ children: parent.children || [],
180
+ }];
174
181
  }
175
182
  return [];
176
183
  }
@@ -12,7 +12,7 @@ export interface Deserializable<T> {
12
12
  /**
13
13
  * Deserializes TypeDoc's JSON output back to {@link Reflection} instances.
14
14
  *
15
- * @group Common
15
+ * @group None
16
16
  * @summary Deserializes TypeDoc's JSON output
17
17
  */
18
18
  export declare class Deserializer {
@@ -5,7 +5,7 @@ const supportedSchemaVersions = [JSONOutput.SCHEMA_VERSION];
5
5
  /**
6
6
  * Deserializes TypeDoc's JSON output back to {@link Reflection} instances.
7
7
  *
8
- * @group Common
8
+ * @group None
9
9
  * @summary Deserializes TypeDoc's JSON output
10
10
  */
11
11
  export class Deserializer {
@@ -10,7 +10,7 @@ export interface SerializerEvents {
10
10
  /**
11
11
  * Serializes TypeDoc's models to JSON
12
12
  *
13
- * @group Common
13
+ * @group None
14
14
  * @summary Serializes TypeDoc's models to JSON
15
15
  */
16
16
  export declare class Serializer extends EventDispatcher<SerializerEvents> {
@@ -3,7 +3,7 @@ import { EventDispatcher, insertPrioritySorted, removeIfPresent } from "#utils";
3
3
  /**
4
4
  * Serializes TypeDoc's models to JSON
5
5
  *
6
- * @group Common
6
+ * @group None
7
7
  * @summary Serializes TypeDoc's models to JSON
8
8
  */
9
9
  export class Serializer extends EventDispatcher {
@@ -228,16 +228,18 @@ function expandGlobs(globs, exclude, logger) {
228
228
  });
229
229
  const filtered = result.filter((file) => file === entry || !excludePatterns.matchesAny(file));
230
230
  if (result.length === 0) {
231
- logger.warn(i18n.glob_0_did_not_match_any_files(nicePath(entry)));
231
+ // #2918 - do not pass entry through nicePath here in case it contains
232
+ // windows path separators which should cause additional warnings.
233
+ logger.warn(i18n.glob_0_did_not_match_any_files(entry));
232
234
  if (entry.includes("\\") && !entry.includes("/")) {
233
235
  logger.info(i18n.glob_should_use_posix_slash());
234
236
  }
235
237
  }
236
238
  else if (filtered.length === 0) {
237
- logger.warn(i18n.entry_point_0_did_not_match_any_files_after_exclude(nicePath(entry)));
239
+ logger.warn(i18n.entry_point_0_did_not_match_any_files_after_exclude(entry));
238
240
  }
239
241
  else if (filtered.length !== 1) {
240
- logger.verbose(`Expanded ${nicePath(entry)} to:\n\t${filtered
242
+ logger.verbose(`Expanded ${entry} to:\n\t${filtered
241
243
  .map(nicePath)
242
244
  .join("\n\t")}`);
243
245
  }
@@ -27,6 +27,7 @@ export const excludeTags = [
27
27
  "@satisfies",
28
28
  "@overload",
29
29
  "@inline",
30
+ "@inlineType",
30
31
  ];
31
32
  export const blockTags = TagDefaults.blockTags;
32
33
  export const inlineTags = TagDefaults.inlineTags;
@@ -41,6 +42,7 @@ export const notRenderedTags = [
41
42
  "@showGroups",
42
43
  "@hideCategories",
43
44
  "@hideGroups",
45
+ "@disableGroups",
44
46
  "@expand",
45
47
  "@preventExpand",
46
48
  "@expandType",
@@ -60,7 +60,7 @@ export interface OptionsReader {
60
60
  * 4. argv (300) - Read argv again since any options set there should override those set in config
61
61
  * files.
62
62
  *
63
- * @group Common
63
+ * @group None
64
64
  * @summary Contains all of TypeDoc's option declarations & values
65
65
  */
66
66
  export declare class Options {
@@ -26,7 +26,7 @@ const optionSnapshots = new WeakMap();
26
26
  * 4. argv (300) - Read argv again since any options set there should override those set in config
27
27
  * files.
28
28
  *
29
- * @group Common
29
+ * @group None
30
30
  * @summary Contains all of TypeDoc's option declarations & values
31
31
  */
32
32
  export class Options {
@@ -3,4 +3,4 @@ export declare const blockTags: readonly ["@defaultValue", "@deprecated", "@exam
3
3
  export declare const tsdocInlineTags: readonly ["@link", "@inheritDoc", "@label"];
4
4
  export declare const inlineTags: readonly ["@link", "@inheritDoc", "@label", "@linkcode", "@linkplain", "@include", "@includeCode"];
5
5
  export declare const tsdocModifierTags: readonly ["@alpha", "@beta", "@eventProperty", "@experimental", "@internal", "@override", "@packageDocumentation", "@public", "@readonly", "@sealed", "@virtual"];
6
- export declare const modifierTags: readonly ["@alpha", "@beta", "@eventProperty", "@experimental", "@internal", "@override", "@packageDocumentation", "@public", "@readonly", "@sealed", "@virtual", "@abstract", "@class", "@enum", "@event", "@expand", "@hidden", "@hideCategories", "@hideconstructor", "@hideGroups", "@ignore", "@inline", "@interface", "@namespace", "@function", "@overload", "@private", "@protected", "@showCategories", "@showGroups", "@useDeclaredType", "@primaryExport"];
6
+ export declare const modifierTags: readonly ["@alpha", "@beta", "@eventProperty", "@experimental", "@internal", "@override", "@packageDocumentation", "@public", "@readonly", "@sealed", "@virtual", "@abstract", "@class", "@disableGroups", "@enum", "@event", "@expand", "@hidden", "@hideCategories", "@hideconstructor", "@hideGroups", "@ignore", "@inline", "@interface", "@namespace", "@function", "@overload", "@private", "@protected", "@showCategories", "@showGroups", "@useDeclaredType", "@primaryExport"];
@@ -69,6 +69,7 @@ export const modifierTags = [
69
69
  ...tsdocModifierTags,
70
70
  "@abstract",
71
71
  "@class",
72
+ "@disableGroups",
72
73
  "@enum",
73
74
  "@event",
74
75
  "@expand",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "typedoc",
3
3
  "description": "Create api documentation for TypeScript projects.",
4
- "version": "0.28.1",
4
+ "version": "0.28.2",
5
5
  "homepage": "https://typedoc.org",
6
6
  "type": "module",
7
7
  "exports": {
@@ -31,32 +31,32 @@
31
31
  "pnpm": ">= 10"
32
32
  },
33
33
  "dependencies": {
34
- "@gerrit0/mini-shiki": "^3.2.1",
34
+ "@gerrit0/mini-shiki": "^3.2.2",
35
35
  "lunr": "^2.3.9",
36
36
  "markdown-it": "^14.1.0",
37
37
  "minimatch": "^9.0.5",
38
- "yaml": "^2.7.0 "
38
+ "yaml": "^2.7.1"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "typescript": "5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x || 5.8.x"
42
42
  },
43
43
  "devDependencies": {
44
- "@eslint/js": "^9.22.0",
44
+ "@eslint/js": "^9.24.0",
45
45
  "@types/lunr": "^2.3.7",
46
46
  "@types/markdown-it": "^14.1.2",
47
47
  "@types/mocha": "^10.0.10",
48
48
  "@types/node": "18",
49
49
  "@typestrong/fs-fixture-builder": "github:TypeStrong/fs-fixture-builder#34113409e3a171e68ce5e2b55461ef5c35591cfe",
50
50
  "c8": "^10.1.3",
51
- "dprint": "^0.49.0",
52
- "esbuild": "^0.25.1",
53
- "eslint": "^9.22.0",
51
+ "dprint": "^0.49.1",
52
+ "esbuild": "^0.25.2",
53
+ "eslint": "^9.24.0",
54
54
  "mocha": "^11.1.0",
55
- "puppeteer": "^24.4.0",
55
+ "puppeteer": "^24.6.0",
56
56
  "semver": "^7.7.1",
57
57
  "tsx": "^4.19.3",
58
- "typescript": "5.8.2",
59
- "typescript-eslint": "^8.26.1"
58
+ "typescript": "5.8.3",
59
+ "typescript-eslint": "^8.29.0"
60
60
  },
61
61
  "files": [
62
62
  "/bin",
package/static/style.css CHANGED
@@ -1004,14 +1004,14 @@
1004
1004
  margin-left: -1.5rem;
1005
1005
  }
1006
1006
 
1007
- .tsd-page-navigation-section {
1008
- margin-left: 10px;
1009
- }
1010
1007
  .tsd-page-navigation-section > summary {
1011
1008
  padding: 0.25rem;
1012
1009
  }
1010
+ .tsd-page-navigation-section > summary > svg {
1011
+ margin-right: 0.25rem;
1012
+ }
1013
1013
  .tsd-page-navigation-section > div {
1014
- margin-left: 20px;
1014
+ margin-left: 30px;
1015
1015
  }
1016
1016
  .tsd-page-navigation ul {
1017
1017
  padding-left: 1.75rem;
package/tsdoc.json CHANGED
@@ -49,6 +49,11 @@
49
49
  "syntaxKind": "block",
50
50
  "allowMultiple": true
51
51
  },
52
+ {
53
+ "tagName": "@disableGroups",
54
+ "syntaxKind": "modifier",
55
+ "allowMultiple": false
56
+ },
52
57
  {
53
58
  "tagName": "@category",
54
59
  "syntaxKind": "block",