typedoc 0.25.2 → 0.25.4

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.js +9 -2
  2. package/dist/lib/converter/comments/declarationReference.js +14 -14
  3. package/dist/lib/converter/comments/discovery.js +3 -1
  4. package/dist/lib/converter/comments/parser.js +56 -13
  5. package/dist/lib/converter/factories/index-signature.js +1 -0
  6. package/dist/lib/converter/plugins/TypePlugin.js +4 -1
  7. package/dist/lib/converter/symbols.js +24 -14
  8. package/dist/lib/converter/types.js +15 -13
  9. package/dist/lib/converter/utils/repository.js +4 -4
  10. package/dist/lib/converter/utils/symbols.js +5 -0
  11. package/dist/lib/models/reflections/ReflectionSymbolId.d.ts +9 -0
  12. package/dist/lib/models/reflections/ReflectionSymbolId.js +28 -11
  13. package/dist/lib/models/reflections/abstract.js +257 -200
  14. package/dist/lib/models/types.js +21 -21
  15. package/dist/lib/output/themes/MarkedPlugin.js +16 -9
  16. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +14 -3
  17. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +10 -0
  18. package/dist/lib/output/themes/default/partials/comment.js +8 -3
  19. package/dist/lib/output/themes/default/partials/footer.js +1 -1
  20. package/dist/lib/output/themes/default/partials/member.signatures.js +2 -1
  21. package/dist/lib/output/themes/default/partials/member.sources.js +25 -11
  22. package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +4 -0
  23. package/dist/lib/output/themes/default/partials/reflectionPreview.js +21 -0
  24. package/dist/lib/output/themes/default/partials/type.d.ts +3 -1
  25. package/dist/lib/output/themes/default/partials/type.js +27 -24
  26. package/dist/lib/output/themes/default/templates/reflection.js +2 -1
  27. package/dist/lib/utils/general.d.ts +1 -0
  28. package/dist/lib/utils/general.js +11 -1
  29. package/dist/lib/utils/jsx.js +4 -3
  30. package/dist/lib/utils/options/declaration.d.ts +1 -0
  31. package/dist/lib/utils/options/declaration.js +2 -2
  32. package/dist/lib/utils/options/options.js +6 -5
  33. package/dist/lib/utils/options/sources/typedoc.js +20 -15
  34. package/dist/lib/utils/sort.d.ts +1 -1
  35. package/dist/lib/utils/sort.js +4 -0
  36. package/package.json +6 -4
  37. package/static/style.css +11 -0
@@ -23,6 +23,7 @@ const members_1 = require("./partials/members");
23
23
  const members_group_1 = require("./partials/members.group");
24
24
  const navigation_1 = require("./partials/navigation");
25
25
  const parameter_1 = require("./partials/parameter");
26
+ const reflectionPreview_1 = require("./partials/reflectionPreview");
26
27
  const toolbar_1 = require("./partials/toolbar");
27
28
  const type_1 = require("./partials/type");
28
29
  const typeAndParent_1 = require("./partials/typeAndParent");
@@ -59,6 +60,15 @@ class DefaultThemeRenderContext {
59
60
  this.reflectionTemplate = bind(reflection_1.reflectionTemplate, this);
60
61
  this.indexTemplate = bind(templates_1.indexTemplate, this);
61
62
  this.defaultLayout = bind(default_1.defaultLayout, this);
63
+ /**
64
+ * Rendered just after the description for a reflection.
65
+ * This can be used to render a shortened type display of a reflection that the
66
+ * rest of the page expands on.
67
+ *
68
+ * Note: Will not be called for variables/type aliases, as they are summarized
69
+ * by their type declaration, which is already rendered by {@link DefaultThemeRenderContext.memberDeclaration}
70
+ */
71
+ this.reflectionPreview = bind(reflectionPreview_1.reflectionPreview, this);
62
72
  this.analytics = bind(analytics_1.analytics, this);
63
73
  this.breadcrumb = bind(breadcrumb_1.breadcrumb, this);
64
74
  this.commentSummary = bind(comment_1.commentSummary, this);
@@ -18,9 +18,14 @@ function commentTags({ markdown }, props) {
18
18
  const tags = props.kindOf(models_1.ReflectionKind.SomeSignature)
19
19
  ? props.comment.blockTags.filter((tag) => tag.tag !== "@returns")
20
20
  : props.comment.blockTags;
21
- return (utils_1.JSX.createElement("div", { class: "tsd-comment tsd-typography" }, tags.map((item) => (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
22
- utils_1.JSX.createElement("h4", null, (0, lib_1.camelToTitleCase)(item.tag.substring(1))),
23
- utils_1.JSX.createElement(utils_1.Raw, { html: markdown(item.content) }))))));
21
+ return (utils_1.JSX.createElement("div", { class: "tsd-comment tsd-typography" }, tags.map((item) => {
22
+ const name = item.name
23
+ ? `${(0, lib_1.camelToTitleCase)(item.tag.substring(1))}: ${item.name}`
24
+ : (0, lib_1.camelToTitleCase)(item.tag.substring(1));
25
+ return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
26
+ utils_1.JSX.createElement("h4", null, name),
27
+ utils_1.JSX.createElement(utils_1.Raw, { html: markdown(item.content) })));
28
+ })));
24
29
  }
25
30
  exports.commentTags = commentTags;
26
31
  const flagsNotRendered = ["@showCategories", "@showGroups", "@hideCategories", "@hideGroups"];
@@ -8,6 +8,6 @@ function footer(context) {
8
8
  return (utils_1.JSX.createElement("div", { class: "tsd-generator" },
9
9
  utils_1.JSX.createElement("p", null,
10
10
  "Generated using ",
11
- utils_1.JSX.createElement("a", { href: "https://typedoc.org/", rel: "noopener", target: "_blank" }, "TypeDoc"))));
11
+ utils_1.JSX.createElement("a", { href: "https://typedoc.org/", target: "_blank" }, "TypeDoc"))));
12
12
  }
13
13
  exports.footer = footer;
@@ -6,7 +6,8 @@ const anchor_icon_1 = require("./anchor-icon");
6
6
  const lib_1 = require("../../lib");
7
7
  const memberSignatures = (context, props) => (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
8
8
  utils_1.JSX.createElement("ul", { class: (0, lib_1.classNames)({ "tsd-signatures": true }, context.getReflectionClasses(props)) }, props.signatures?.map((item) => (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
9
- utils_1.JSX.createElement("li", { class: "tsd-signature tsd-anchor-link", id: item.anchor },
9
+ utils_1.JSX.createElement("li", { class: "tsd-signature tsd-anchor-link" },
10
+ utils_1.JSX.createElement("a", { id: item.anchor, class: "tsd-anchor" }),
10
11
  context.memberSignatureTitle(item),
11
12
  (0, anchor_icon_1.anchorIcon)(context, item.anchor)),
12
13
  utils_1.JSX.createElement("li", { class: "tsd-description" }, context.memberSignatureBody(item))))))));
@@ -2,6 +2,29 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.memberSources = void 0;
4
4
  const utils_1 = require("../../../../utils");
5
+ function sourceLink(context, item) {
6
+ if (!item.url) {
7
+ return (utils_1.JSX.createElement("li", null,
8
+ "Defined in ",
9
+ item.fileName,
10
+ ":",
11
+ item.line));
12
+ }
13
+ if (context.options.getValue("sourceLinkExternal")) {
14
+ return (utils_1.JSX.createElement("li", null,
15
+ "Defined in ",
16
+ utils_1.JSX.createElement("a", { href: item.url, class: "external", target: "_blank" },
17
+ item.fileName,
18
+ ":",
19
+ item.line)));
20
+ }
21
+ return (utils_1.JSX.createElement("li", null,
22
+ "Defined in ",
23
+ utils_1.JSX.createElement("a", { href: item.url },
24
+ item.fileName,
25
+ ":",
26
+ item.line)));
27
+ }
5
28
  const memberSources = (context, props) => {
6
29
  const sources = [];
7
30
  if (props.implementationOf) {
@@ -19,17 +42,8 @@ const memberSources = (context, props) => {
19
42
  "Overrides ",
20
43
  context.typeAndParent(props.overwrites)));
21
44
  }
22
- if (props.sources) {
23
- sources.push(utils_1.JSX.createElement("ul", null, props.sources.map((item) => item.url ? (utils_1.JSX.createElement("li", null,
24
- "Defined in ",
25
- utils_1.JSX.createElement("a", { href: item.url },
26
- item.fileName,
27
- ":",
28
- item.line))) : (utils_1.JSX.createElement("li", null,
29
- "Defined in ",
30
- item.fileName,
31
- ":",
32
- item.line)))));
45
+ if (props.sources?.length) {
46
+ sources.push(utils_1.JSX.createElement("ul", null, props.sources.map((item) => sourceLink(context, item))));
33
47
  }
34
48
  if (sources.length === 0) {
35
49
  return utils_1.JSX.createElement(utils_1.JSX.Fragment, null);
@@ -0,0 +1,4 @@
1
+ import { type Reflection } from "../../../../models";
2
+ import { JSX } from "../../../../utils";
3
+ import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
4
+ export declare function reflectionPreview(context: DefaultThemeRenderContext, props: Reflection): JSX.Element | undefined;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reflectionPreview = void 0;
4
+ const models_1 = require("../../../../models");
5
+ const utils_1 = require("../../../../utils");
6
+ const lib_1 = require("../../lib");
7
+ function reflectionPreview(context, props) {
8
+ if (!(props instanceof models_1.DeclarationReflection))
9
+ return;
10
+ // Each property of the interface will have a member rendered later on the page describing it, so generate
11
+ // a type-like object with links to each member.
12
+ if (props.kindOf(models_1.ReflectionKind.Interface)) {
13
+ return (utils_1.JSX.createElement("div", { class: "tsd-signature" },
14
+ utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "interface "),
15
+ utils_1.JSX.createElement("span", { class: (0, lib_1.getKindClass)(props) },
16
+ props.name,
17
+ " "),
18
+ context.type(new models_1.ReflectionType(props), { topLevelLinks: true })));
19
+ }
20
+ }
21
+ exports.reflectionPreview = reflectionPreview;
@@ -2,4 +2,6 @@ import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
2
2
  import { Type } from "../../../../models";
3
3
  import { JSX } from "../../../../utils";
4
4
  export declare function validateStateIsClean(page: string): void;
5
- export declare function type(context: DefaultThemeRenderContext, type: Type | undefined): JSX.Element;
5
+ export declare function type(context: DefaultThemeRenderContext, type: Type | undefined, options?: {
6
+ topLevelLinks: boolean;
7
+ }): JSX.Element;
@@ -74,7 +74,7 @@ const typeRenderers = {
74
74
  indentationDepth++;
75
75
  const parts = [
76
76
  renderType(context, type.checkType, models_1.TypeContext.conditionalCheck),
77
- utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, " extends "),
77
+ utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, " extends "),
78
78
  renderType(context, type.extendsType, models_1.TypeContext.conditionalExtends),
79
79
  utils_1.JSX.createElement("br", null),
80
80
  includeIndentation(),
@@ -107,11 +107,11 @@ const typeRenderers = {
107
107
  },
108
108
  inferred(context, type) {
109
109
  return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
110
- utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "infer "),
110
+ utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "infer "),
111
111
  " ",
112
112
  utils_1.JSX.createElement("span", { class: "tsd-kind-type-parameter" }, type.name),
113
113
  type.constraint && (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
114
- utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, " extends "),
114
+ utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, " extends "),
115
115
  renderType(context, type.constraint, models_1.TypeContext.inferredConstraint)))));
116
116
  },
117
117
  intersection(context, type) {
@@ -128,15 +128,17 @@ const typeRenderers = {
128
128
  const parts = [utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "{"), utils_1.JSX.createElement("br", null), includeIndentation()];
129
129
  switch (type.readonlyModifier) {
130
130
  case "+":
131
- parts.push(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "readonly "));
131
+ parts.push(utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "readonly "));
132
132
  break;
133
133
  case "-":
134
- parts.push(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "-readonly "));
134
+ parts.push(utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
135
+ utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "-"),
136
+ utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "readonly ")));
135
137
  break;
136
138
  }
137
- parts.push(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "["), utils_1.JSX.createElement("span", { class: "tsd-kind-type-parameter" }, type.parameter), utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, " in "), renderType(context, type.parameterType, models_1.TypeContext.mappedParameter));
139
+ parts.push(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "["), utils_1.JSX.createElement("span", { class: "tsd-kind-type-parameter" }, type.parameter), utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, " in "), renderType(context, type.parameterType, models_1.TypeContext.mappedParameter));
138
140
  if (type.nameType) {
139
- parts.push(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, " as "), renderType(context, type.nameType, models_1.TypeContext.mappedName));
141
+ parts.push(utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, " as "), renderType(context, type.nameType, models_1.TypeContext.mappedName));
140
142
  }
141
143
  parts.push(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "]"));
142
144
  switch (type.optionalModifier) {
@@ -170,15 +172,15 @@ const typeRenderers = {
170
172
  },
171
173
  predicate(context, type) {
172
174
  return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
173
- !!type.asserts && utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "asserts "),
175
+ !!type.asserts && utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "asserts "),
174
176
  utils_1.JSX.createElement("span", { class: "tsd-kind-parameter" }, type.name),
175
177
  !!type.targetType && (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
176
- utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, " is "),
178
+ utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, " is "),
177
179
  renderType(context, type.targetType, models_1.TypeContext.predicateTarget)))));
178
180
  },
179
181
  query(context, type) {
180
182
  return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
181
- utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "typeof "),
183
+ utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "typeof "),
182
184
  renderType(context, type.queryType, models_1.TypeContext.queryTypeTarget)));
183
185
  },
184
186
  reference(context, type) {
@@ -211,30 +213,31 @@ const typeRenderers = {
211
213
  }
212
214
  return name;
213
215
  },
214
- reflection(context, type) {
216
+ reflection(context, type, { topLevelLinks }) {
215
217
  const members = [];
216
218
  const children = type.declaration.children || [];
217
219
  indentationDepth++;
220
+ const renderName = (named) => topLevelLinks ? (utils_1.JSX.createElement("a", { class: (0, lib_1.getKindClass)(named), href: context.urlTo(named) }, named.name)) : (utils_1.JSX.createElement("span", { class: (0, lib_1.getKindClass)(named) }, named.name));
218
221
  for (const item of children) {
219
222
  if (item.getSignature && item.setSignature) {
220
223
  members.push(utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
221
- utils_1.JSX.createElement("span", { class: (0, lib_1.getKindClass)(item) }, item.name),
224
+ renderName(item),
222
225
  utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, ": "),
223
226
  renderType(context, item.getSignature.type, models_1.TypeContext.none)));
224
227
  continue;
225
228
  }
226
229
  if (item.getSignature) {
227
230
  members.push(utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
228
- utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "get "),
229
- utils_1.JSX.createElement("span", { class: (0, lib_1.getKindClass)(item.getSignature) }, item.name),
231
+ utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "get "),
232
+ renderName(item.getSignature),
230
233
  utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "(): "),
231
234
  renderType(context, item.getSignature.type, models_1.TypeContext.none)));
232
235
  continue;
233
236
  }
234
237
  if (item.setSignature) {
235
238
  members.push(utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
236
- utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "set "),
237
- utils_1.JSX.createElement("span", { class: (0, lib_1.getKindClass)(item.setSignature) }, item.name),
239
+ utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "set "),
240
+ renderName(item.setSignature),
238
241
  utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "("),
239
242
  item.setSignature.parameters?.map((item) => (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
240
243
  item.name,
@@ -246,17 +249,17 @@ const typeRenderers = {
246
249
  if (item.signatures) {
247
250
  for (const sig of item.signatures) {
248
251
  members.push(utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
249
- utils_1.JSX.createElement("span", { class: (0, lib_1.getKindClass)(sig) }, item.name),
252
+ renderName(sig),
250
253
  item.flags.isOptional && utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "?"),
251
254
  context.memberSignatureTitle(sig, {
252
255
  hideName: true,
253
- arrowStyle: true,
256
+ arrowStyle: false,
254
257
  })));
255
258
  }
256
259
  continue;
257
260
  }
258
261
  members.push(utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
259
- utils_1.JSX.createElement("span", { class: (0, lib_1.getKindClass)(item) }, item.name),
262
+ renderName(item),
260
263
  utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, item.flags.isOptional ? "?: " : ": "),
261
264
  renderType(context, item.type, models_1.TypeContext.none)));
262
265
  }
@@ -331,7 +334,7 @@ const typeRenderers = {
331
334
  },
332
335
  typeOperator(context, type) {
333
336
  return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
334
- utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" },
337
+ utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" },
335
338
  type.operator,
336
339
  " "),
337
340
  renderType(context, type.target, models_1.TypeContext.typeOperatorTarget)));
@@ -343,12 +346,12 @@ const typeRenderers = {
343
346
  return utils_1.JSX.createElement(utils_1.JSX.Fragment, null, type.name);
344
347
  },
345
348
  };
346
- function renderType(context, type, where) {
349
+ function renderType(context, type, where, options = { topLevelLinks: false }) {
347
350
  if (!type) {
348
351
  return utils_1.JSX.createElement("span", { class: "tsd-signature-type" }, "any");
349
352
  }
350
353
  const renderFn = typeRenderers[type.type];
351
- const rendered = renderFn(context, type);
354
+ const rendered = renderFn(context, type, options);
352
355
  if (type.needsParenthesis(where)) {
353
356
  return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
354
357
  utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "("),
@@ -357,7 +360,7 @@ function renderType(context, type, where) {
357
360
  }
358
361
  return rendered;
359
362
  }
360
- function type(context, type) {
361
- return renderType(context, type, models_1.TypeContext.none);
363
+ function type(context, type, options = { topLevelLinks: false }) {
364
+ return renderType(context, type, models_1.TypeContext.none, options);
362
365
  }
363
366
  exports.type = type;
@@ -5,7 +5,7 @@ const lib_1 = require("../../lib");
5
5
  const models_1 = require("../../../../models");
6
6
  const utils_1 = require("../../../../utils");
7
7
  function reflectionTemplate(context, props) {
8
- if ([models_1.ReflectionKind.TypeAlias, models_1.ReflectionKind.Variable].includes(props.model.kind) &&
8
+ if (props.model.kindOf(models_1.ReflectionKind.TypeAlias | models_1.ReflectionKind.Variable) &&
9
9
  props.model instanceof models_1.DeclarationReflection) {
10
10
  return context.memberDeclaration(props.model);
11
11
  }
@@ -17,6 +17,7 @@ function reflectionTemplate(context, props) {
17
17
  props.model.kind === models_1.ReflectionKind.Module &&
18
18
  props.model.readme?.length && (utils_1.JSX.createElement("section", { class: "tsd-panel tsd-typography" },
19
19
  utils_1.JSX.createElement(utils_1.Raw, { html: context.markdown(props.model.readme) }))),
20
+ context.reflectionPreview(props.model),
20
21
  (0, lib_1.hasTypeParameters)(props.model) && utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
21
22
  " ",
22
23
  context.typeParameters(props.model.typeParameters),
@@ -38,6 +38,7 @@ export type Chars<T extends string> = T extends `${infer C}${infer R}` ? C | Cha
38
38
  * Utility to help type checking ensure that there is no uncovered case.
39
39
  */
40
40
  export declare function assertNever(x: never): never;
41
+ export declare function NonEnumerable(_cls: unknown, context: ClassFieldDecoratorContext): void;
41
42
  export declare function hasBeenLoadedMultipleTimes(): boolean;
42
43
  export declare function getLoadedPaths(): string[];
43
44
  export {};
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getLoadedPaths = exports.hasBeenLoadedMultipleTimes = exports.assertNever = void 0;
26
+ exports.getLoadedPaths = exports.hasBeenLoadedMultipleTimes = exports.NonEnumerable = exports.assertNever = void 0;
27
27
  const path_1 = require("path");
28
28
  const Util = __importStar(require("util"));
29
29
  /**
@@ -33,6 +33,16 @@ function assertNever(x) {
33
33
  throw new Error(`Expected handling to cover all possible cases, but it didn't cover: ${Util.inspect(x)}`);
34
34
  }
35
35
  exports.assertNever = assertNever;
36
+ function NonEnumerable(_cls, context) {
37
+ context.addInitializer(function () {
38
+ Object.defineProperty(this, context.name, {
39
+ enumerable: false,
40
+ configurable: true,
41
+ writable: true,
42
+ });
43
+ });
44
+ }
45
+ exports.NonEnumerable = NonEnumerable;
36
46
  /**
37
47
  * This is a hack to make it possible to detect and warn about installation setups
38
48
  * which result in TypeDoc being installed multiple times. If TypeDoc has been loaded
@@ -89,7 +89,7 @@ const renderElement = function renderElement(element) {
89
89
  }
90
90
  let html = "";
91
91
  if (tag !== jsx_elements_1.JsxFragment) {
92
- if (blockElements.has(tag) && renderPretty) {
92
+ if (blockElements.has(tag) && renderPretty && html) {
93
93
  html += "\n";
94
94
  }
95
95
  html += "<";
@@ -106,8 +106,9 @@ const renderElement = function renderElement(element) {
106
106
  else {
107
107
  html += " ";
108
108
  html += key;
109
- html += "=";
110
- html += JSON.stringify(val);
109
+ html += '="';
110
+ html += (typeof val === "string" ? val : JSON.stringify(val)).replaceAll('"', "&quot;");
111
+ html += '"';
111
112
  }
112
113
  }
113
114
  }
@@ -76,6 +76,7 @@ export interface TypeDocOptionMap {
76
76
  includeVersion: boolean;
77
77
  disableSources: boolean;
78
78
  sourceLinkTemplate: string;
79
+ sourceLinkExternal: boolean;
79
80
  disableGit: boolean;
80
81
  gitRevision: string;
81
82
  gitRemote: string;
@@ -4,8 +4,8 @@ exports.getDefaultValue = exports.convert = exports.ParameterType = exports.Para
4
4
  const path_1 = require("path");
5
5
  /** @enum */
6
6
  exports.EmitStrategy = {
7
- both: "both",
8
- docs: "docs",
7
+ both: "both", // Emit both documentation and JS
8
+ docs: "docs", // Emit documentation, but not JS (default)
9
9
  none: "none", // Emit nothing, just convert and run validation
10
10
  };
11
11
  /**
@@ -46,6 +46,7 @@ class Options {
46
46
  options.packageDir = packageDir;
47
47
  options._readers = this._readers.filter((reader) => reader.supportsPackages);
48
48
  options._declarations = new Map(this._declarations);
49
+ options.reset();
49
50
  return options;
50
51
  }
51
52
  /**
@@ -85,7 +86,7 @@ class Options {
85
86
  if (name != null) {
86
87
  const declaration = this.getDeclaration(name);
87
88
  if (!declaration) {
88
- throw new Error("Cannot reset an option which has not been declared.");
89
+ throw new Error(`Cannot reset an option (${name}) which has not been declared.`);
89
90
  }
90
91
  this._values[declaration.name] = (0, declaration_2.getDefaultValue)(declaration);
91
92
  this._setOptions.delete(declaration.name);
@@ -137,7 +138,7 @@ class Options {
137
138
  }
138
139
  isSet(name) {
139
140
  if (!this._declarations.has(name)) {
140
- throw new Error("Tried to check if an undefined option was set");
141
+ throw new Error(`Tried to check if an undefined option (${name}) was set`);
141
142
  }
142
143
  return this._setOptions.has(name);
143
144
  }
@@ -157,7 +158,7 @@ class Options {
157
158
  }
158
159
  setValue(name, value, configPath) {
159
160
  if (this.isFrozen()) {
160
- throw new Error("Tried to modify an option value after options have been frozen.");
161
+ throw new Error(`Tried to modify an option (${name}) value after options have been frozen.`);
161
162
  }
162
163
  const declaration = this.getDeclaration(name);
163
164
  if (!declaration) {
@@ -212,7 +213,7 @@ class Options {
212
213
  */
213
214
  setCompilerOptions(fileNames, options, projectReferences) {
214
215
  if (this.isFrozen()) {
215
- throw new Error("Tried to modify an option value after options have been sealed.");
216
+ throw new Error("Tried to modify compiler options after options have been frozen.");
216
217
  }
217
218
  // We do this here instead of in the tsconfig reader so that API consumers which
218
219
  // supply a program to `Converter.convert` instead of letting TypeDoc create one
@@ -264,7 +265,7 @@ function Option(name) {
264
265
  return value;
265
266
  },
266
267
  set(_value) {
267
- throw new Error("Options may not be set via the Option decorator");
268
+ throw new Error(`Options may not be set via the Option decorator when setting ${name}`);
268
269
  },
269
270
  };
270
271
  };
@@ -292,6 +292,24 @@ function addTypeDocOptions(options) {
292
292
  help: "Disable setting the source of a reflection when documenting it.",
293
293
  type: declaration_1.ParameterType.Boolean,
294
294
  });
295
+ options.addDeclaration({
296
+ name: "sourceLinkTemplate",
297
+ help: "Specify a link template to be used when generating source urls. If not set, will be automatically created using the git remote. Supports {path}, {line}, {gitRevision} placeholders.",
298
+ });
299
+ options.addDeclaration({
300
+ name: "gitRevision",
301
+ help: "Use specified revision instead of the last revision for linking to GitHub/Bitbucket source files. Has no effect if disableSources is set.",
302
+ });
303
+ options.addDeclaration({
304
+ name: "gitRemote",
305
+ help: "Use the specified remote for linking to GitHub/Bitbucket source files. Has no effect if disableGit or disableSources is set.",
306
+ defaultValue: "origin",
307
+ });
308
+ options.addDeclaration({
309
+ name: "disableGit",
310
+ help: "Assume that all can be linked to with the sourceLinkTemplate, sourceLinkTemplate must be set if this is enabled. {path} will be rooted at basePath",
311
+ type: declaration_1.ParameterType.Boolean,
312
+ });
295
313
  options.addDeclaration({
296
314
  name: "basePath",
297
315
  help: "Specifies the base path to be used when displaying file paths.",
@@ -329,23 +347,10 @@ function addTypeDocOptions(options) {
329
347
  help: "Set the CNAME file text, it's useful for custom domains on GitHub Pages.",
330
348
  });
331
349
  options.addDeclaration({
332
- name: "sourceLinkTemplate",
333
- help: "Specify a link template to be used when generating source urls. If not set, will be automatically created using the git remote. Supports {path}, {line}, {gitRevision} placeholders.",
334
- });
335
- options.addDeclaration({
336
- name: "disableGit",
337
- help: "Assume that all can be linked to with the sourceLinkTemplate, sourceLinkTemplate must be set if this is enabled. {path} will be rooted at basePath",
350
+ name: "sourceLinkExternal",
351
+ help: "Specifies that source links should be treated as external links to be opened in a new tab.",
338
352
  type: declaration_1.ParameterType.Boolean,
339
353
  });
340
- options.addDeclaration({
341
- name: "gitRevision",
342
- help: "Use specified revision instead of the last revision for linking to GitHub/Bitbucket source files. Has no effect if disableSources is set.",
343
- });
344
- options.addDeclaration({
345
- name: "gitRemote",
346
- help: "Use the specified remote for linking to GitHub/Bitbucket source files. Has no effect if disableGit or disableSources is set.",
347
- defaultValue: "origin",
348
- });
349
354
  options.addDeclaration({
350
355
  name: "githubPages",
351
356
  help: "Generate a .nojekyll file to prevent 404 errors in GitHub Pages. Defaults to `true`.",
@@ -4,6 +4,6 @@
4
4
  */
5
5
  import type { DeclarationReflection } from "../models/reflections/declaration";
6
6
  import type { Options } from "./options";
7
- export declare const SORT_STRATEGIES: readonly ["source-order", "alphabetical", "enum-value-ascending", "enum-value-descending", "enum-member-source-order", "static-first", "instance-first", "visibility", "required-first", "kind"];
7
+ export declare const SORT_STRATEGIES: readonly ["source-order", "alphabetical", "enum-value-ascending", "enum-value-descending", "enum-member-source-order", "static-first", "instance-first", "visibility", "required-first", "kind", "external-last"];
8
8
  export type SortStrategy = (typeof SORT_STRATEGIES)[number];
9
9
  export declare function getSortFunction(opts: Options): (reflections: DeclarationReflection[]) => void;
@@ -18,6 +18,7 @@ exports.SORT_STRATEGIES = [
18
18
  "visibility",
19
19
  "required-first",
20
20
  "kind",
21
+ "external-last",
21
22
  ];
22
23
  const defaultKindSortOrder = [
23
24
  kind_1.ReflectionKind.Reference,
@@ -120,6 +121,9 @@ const sorts = {
120
121
  kind(a, b, { kindSortOrder }) {
121
122
  return kindSortOrder.indexOf(a.kind) < kindSortOrder.indexOf(b.kind);
122
123
  },
124
+ "external-last"(a, b) {
125
+ return !a.flags.isExternal && b.flags.isExternal;
126
+ },
123
127
  };
124
128
  function getSortFunction(opts) {
125
129
  const kindSortOrder = opts
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.25.2",
4
+ "version": "0.25.4",
5
5
  "homepage": "https://typedoc.org",
6
6
  "exports": {
7
7
  ".": "./dist/index.js",
@@ -30,7 +30,7 @@
30
30
  "shiki": "^0.14.1"
31
31
  },
32
32
  "peerDependencies": {
33
- "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x"
33
+ "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/lunr": "^2.3.5",
@@ -47,7 +47,7 @@
47
47
  "prettier": "3.0.3",
48
48
  "puppeteer": "^13.5.2",
49
49
  "ts-node": "^10.9.1",
50
- "typescript": "5.2.2"
50
+ "typescript": "5.3.2"
51
51
  },
52
52
  "files": [
53
53
  "/bin",
@@ -64,7 +64,9 @@
64
64
  "test": "mocha --config .config/mocha.fast.json",
65
65
  "test:cov": "c8 mocha --config .config/mocha.fast.json",
66
66
  "doc:c": "node bin/typedoc --tsconfig src/test/converter/tsconfig.json",
67
- "doc:c2": "node --inspect-brk bin/typedoc --tsconfig src/test/converter2/tsconfig.json",
67
+ "doc:c2": "node bin/typedoc --tsconfig src/test/converter2/tsconfig.json",
68
+ "doc:c2d": "node --inspect-brk bin/typedoc --tsconfig src/test/converter2/tsconfig.json",
69
+ "example": "cd example && node ../bin/typedoc",
68
70
  "test:full": "c8 mocha --config .config/mocha.full.json",
69
71
  "test:visual": "ts-node ./src/test/capture-screenshots.ts && ./scripts/compare_screenshots.sh",
70
72
  "test:visual:accept": "node scripts/accept_visual_regression.js",
package/static/style.css CHANGED
@@ -11,6 +11,7 @@
11
11
  --light-color-text-aside: #6e6e6e;
12
12
  --light-color-link: #1f70c2;
13
13
 
14
+ --light-color-ts-keyword: #056bd6;
14
15
  --light-color-ts-project: #b111c9;
15
16
  --light-color-ts-module: var(--light-color-ts-project);
16
17
  --light-color-ts-namespace: var(--light-color-ts-project);
@@ -50,6 +51,7 @@
50
51
  --dark-color-text-aside: #dddddd;
51
52
  --dark-color-link: #00aff4;
52
53
 
54
+ --dark-color-ts-keyword: #3399ff;
53
55
  --dark-color-ts-project: #e358ff;
54
56
  --dark-color-ts-module: var(--dark-color-ts-project);
55
57
  --dark-color-ts-namespace: var(--dark-color-ts-project);
@@ -91,6 +93,7 @@
91
93
  --color-text-aside: var(--light-color-text-aside);
92
94
  --color-link: var(--light-color-link);
93
95
 
96
+ --color-ts-keyword: var(--light-color-ts-keyword);
94
97
  --color-ts-module: var(--light-color-ts-module);
95
98
  --color-ts-namespace: var(--light-color-ts-namespace);
96
99
  --color-ts-enum: var(--light-color-ts-enum);
@@ -132,6 +135,7 @@
132
135
  --color-text-aside: var(--dark-color-text-aside);
133
136
  --color-link: var(--dark-color-link);
134
137
 
138
+ --color-ts-keyword: var(--dark-color-ts-keyword);
135
139
  --color-ts-module: var(--dark-color-ts-module);
136
140
  --color-ts-namespace: var(--dark-color-ts-namespace);
137
141
  --color-ts-enum: var(--dark-color-ts-enum);
@@ -180,6 +184,7 @@ body {
180
184
  --color-text-aside: var(--light-color-text-aside);
181
185
  --color-link: var(--light-color-link);
182
186
 
187
+ --color-ts-keyword: var(--light-color-ts-keyword);
183
188
  --color-ts-module: var(--light-color-ts-module);
184
189
  --color-ts-namespace: var(--light-color-ts-namespace);
185
190
  --color-ts-enum: var(--light-color-ts-enum);
@@ -219,6 +224,7 @@ body {
219
224
  --color-text-aside: var(--dark-color-text-aside);
220
225
  --color-link: var(--dark-color-link);
221
226
 
227
+ --color-ts-keyword: var(--dark-color-ts-keyword);
222
228
  --color-ts-module: var(--dark-color-ts-module);
223
229
  --color-ts-namespace: var(--dark-color-ts-namespace);
224
230
  --color-ts-enum: var(--dark-color-ts-enum);
@@ -984,6 +990,11 @@ a.tsd-index-link {
984
990
  overflow-x: auto;
985
991
  }
986
992
 
993
+ .tsd-signature-keyword {
994
+ color: var(--color-ts-keyword);
995
+ font-weight: normal;
996
+ }
997
+
987
998
  .tsd-signature-symbol {
988
999
  color: var(--color-text-aside);
989
1000
  font-weight: normal;