typedoc 0.28.0-beta.1 → 0.28.0-beta.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 (61) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/lib/converter/context.d.ts +16 -6
  3. package/dist/lib/converter/context.js +39 -3
  4. package/dist/lib/converter/factories/signature.js +1 -1
  5. package/dist/lib/converter/factories/symbol-id.js +1 -0
  6. package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +1 -1
  7. package/dist/lib/converter/plugins/SourcePlugin.js +1 -1
  8. package/dist/lib/converter/symbols.js +14 -4
  9. package/dist/lib/converter/types.js +16 -21
  10. package/dist/lib/models/ContainerReflection.d.ts +2 -2
  11. package/dist/lib/models/ContainerReflection.js +28 -4
  12. package/dist/lib/models/ProjectReflection.d.ts +1 -1
  13. package/dist/lib/models/ProjectReflection.js +1 -1
  14. package/dist/lib/models/ReflectionSymbolId.d.ts +10 -0
  15. package/dist/lib/models/ReflectionSymbolId.js +10 -0
  16. package/dist/lib/output/formatter.d.ts +1 -0
  17. package/dist/lib/output/formatter.js +3 -0
  18. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +4 -0
  19. package/dist/lib/output/renderer.d.ts +0 -5
  20. package/dist/lib/output/renderer.js +3 -40
  21. package/dist/lib/output/theme.d.ts +9 -1
  22. package/dist/lib/output/theme.js +8 -0
  23. package/dist/lib/output/themes/MarkedPlugin.js +2 -2
  24. package/dist/lib/output/themes/default/DefaultTheme.d.ts +11 -5
  25. package/dist/lib/output/themes/default/DefaultTheme.js +275 -208
  26. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +47 -40
  27. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +9 -0
  28. package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +1 -2
  29. package/dist/lib/output/themes/default/partials/anchor-icon.js +2 -9
  30. package/dist/lib/output/themes/default/partials/breadcrumb.js +2 -2
  31. package/dist/lib/output/themes/default/partials/comment.js +2 -3
  32. package/dist/lib/output/themes/default/partials/index.js +4 -6
  33. package/dist/lib/output/themes/default/partials/member.declaration.js +1 -1
  34. package/dist/lib/output/themes/default/partials/member.js +3 -5
  35. package/dist/lib/output/themes/default/partials/member.signature.body.js +2 -2
  36. package/dist/lib/output/themes/default/partials/member.signatures.js +2 -3
  37. package/dist/lib/output/themes/default/partials/members.js +2 -4
  38. package/dist/lib/output/themes/default/partials/moduleReflection.js +6 -10
  39. package/dist/lib/output/themes/default/partials/navigation.js +5 -7
  40. package/dist/lib/output/themes/default/partials/reflectionPreview.js +8 -0
  41. package/dist/lib/output/themes/default/partials/typeDetails.d.ts +5 -5
  42. package/dist/lib/output/themes/default/partials/typeDetails.js +99 -53
  43. package/dist/lib/output/themes/default/partials/typeParameters.js +2 -3
  44. package/dist/lib/output/themes/default/templates/hierarchy.js +3 -5
  45. package/dist/lib/output/themes/default/templates/reflection.js +7 -3
  46. package/dist/lib/output/themes/lib.js +8 -4
  47. package/dist/lib/utils/highlighter.d.ts +1 -0
  48. package/dist/lib/utils/highlighter.js +16 -2
  49. package/dist/lib/utils/index.d.ts +1 -0
  50. package/dist/lib/utils/index.js +1 -0
  51. package/dist/lib/utils/options/defaults.js +2 -0
  52. package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
  53. package/dist/lib/utils/options/tsdoc-defaults.js +4 -0
  54. package/dist/lib/utils-common/jsx.elements.d.ts +16 -0
  55. package/dist/lib/utils-common/path.js +4 -1
  56. package/package.json +1 -1
  57. package/static/main.js +4 -4
  58. package/static/style.css +24 -17
  59. package/tsdoc.json +16 -0
  60. package/dist/lib/converter/factories/types.d.ts +0 -4
  61. package/dist/lib/converter/factories/types.js +0 -13
@@ -1,57 +1,98 @@
1
- import { ReflectionKind, } from "../../../../models/index.js";
2
- import { i18n, JSX } from "#utils";
1
+ import { Comment, Reflection, ReflectionKind, } from "../../../../models/index.js";
2
+ import { assert, i18n, JSX } from "#utils";
3
3
  import { classNames, getKindClass } from "../../lib.js";
4
- import { anchorLinkIfPresent } from "./anchor-icon.js";
5
- const isUsefulVisitor = {
6
- array(type) {
7
- return renderingTypeDetailsIsUseful(type.elementType);
8
- },
9
- intersection(type) {
10
- return type.types.some(renderingTypeDetailsIsUseful);
11
- },
12
- union(type) {
13
- return !!type.elementSummaries || type.types.some(renderingTypeDetailsIsUseful);
14
- },
15
- reflection(type) {
16
- return renderingChildIsUseful(type.declaration);
17
- },
18
- reference(type) {
19
- return shouldExpandReference(type);
20
- },
21
- };
22
- function renderingTypeDetailsIsUseful(type) {
4
+ import { anchorTargetIfPresent } from "./anchor-icon.js";
5
+ function renderingTypeDetailsIsUseful(container, type) {
6
+ const isUsefulVisitor = {
7
+ array(type) {
8
+ return renderingTypeDetailsIsUseful(container, type.elementType);
9
+ },
10
+ intersection(type) {
11
+ return type.types.some(t => renderingTypeDetailsIsUseful(container, t));
12
+ },
13
+ union(type) {
14
+ return !!type.elementSummaries || type.types.some(t => renderingTypeDetailsIsUseful(container, t));
15
+ },
16
+ reflection(type) {
17
+ return renderingChildIsUseful(type.declaration);
18
+ },
19
+ reference(type) {
20
+ return shouldExpandReference(container, type);
21
+ },
22
+ };
23
23
  return type.visit(isUsefulVisitor) ?? false;
24
24
  }
25
- export function typeDeclaration(context, type) {
26
- if (renderingTypeDetailsIsUseful(type)) {
25
+ export function typeDeclaration(context, reflectionOwningType, type) {
26
+ assert(reflectionOwningType instanceof Reflection, "typeDeclaration(reflectionOwningType, type) called incorrectly");
27
+ if (renderingTypeDetailsIsUseful(reflectionOwningType, type)) {
27
28
  return (JSX.createElement("div", { class: "tsd-type-declaration" },
28
29
  JSX.createElement("h4", null, i18n.theme_type_declaration()),
29
- context.typeDetails(type, true)));
30
+ context.typeDetails(reflectionOwningType, type, true)));
30
31
  }
31
32
  return null;
32
33
  }
34
+ const expandTypeCache = new WeakMap();
35
+ function getExpandTypeInfo(refl) {
36
+ const cache = expandTypeCache.get(refl);
37
+ if (cache)
38
+ return cache;
39
+ const expandType = new Set();
40
+ const preventExpand = new Set();
41
+ if (!refl.isProject()) {
42
+ const info = getExpandTypeInfo(refl.parent);
43
+ for (const item of info.expandType) {
44
+ expandType.add(item);
45
+ }
46
+ for (const item of info.preventExpand) {
47
+ preventExpand.add(item);
48
+ }
49
+ }
50
+ for (const tag of refl.comment?.blockTags || []) {
51
+ if (tag.tag === "@expandType") {
52
+ const name = Comment.combineDisplayParts(tag.content);
53
+ expandType.add(name);
54
+ preventExpand.delete(name);
55
+ }
56
+ else if (tag.tag === "@preventExpand") {
57
+ const name = Comment.combineDisplayParts(tag.content);
58
+ preventExpand.add(name);
59
+ expandType.delete(name);
60
+ }
61
+ }
62
+ expandTypeCache.set(refl, { expandType, preventExpand });
63
+ return { expandType, preventExpand };
64
+ }
33
65
  const expanded = new Set();
34
- function shouldExpandReference(reference) {
66
+ function shouldExpandReference(container, reference) {
35
67
  const target = reference.reflection;
36
- if (reference.highlightedProperties) {
37
- return !target || expanded.has(target) === false;
68
+ if (!target) {
69
+ // If it doesn't exist, expand only if there are specific properties
70
+ // which the user annotated. Assume they know what they're doing.
71
+ return reference.highlightedProperties !== undefined;
38
72
  }
39
- if (!target?.kindOf(ReflectionKind.TypeAlias | ReflectionKind.Interface))
73
+ // Prevent expansion of non-types
74
+ if (!target.kindOf(ReflectionKind.TypeAlias | ReflectionKind.Interface))
40
75
  return false;
41
- if (!target.comment?.hasModifier("@expand"))
76
+ // Prevent recursive expand
77
+ if (expanded.has(target))
42
78
  return false;
43
- return expanded.has(target) === false;
79
+ const info = getExpandTypeInfo(container);
80
+ // Expand if the user explicitly requested it with @param or @expand
81
+ if (reference.highlightedProperties || target.comment?.hasModifier("@expand") || info.expandType.has(target.name)) {
82
+ return !info.preventExpand.has(target.name);
83
+ }
84
+ return false;
44
85
  }
45
- export function typeDetails(context, type, renderAnchors) {
46
- return typeDetailsImpl(context, type, renderAnchors);
86
+ export function typeDetails(context, reflectionOwningType, type, renderAnchors) {
87
+ return typeDetailsImpl(context, reflectionOwningType, type, renderAnchors);
47
88
  }
48
- export function typeDetailsImpl(context, type, renderAnchors, highlighted) {
89
+ export function typeDetailsImpl(context, reflectionOwningType, type, renderAnchors, highlighted) {
49
90
  const result = type.visit({
50
91
  array(type) {
51
- return context.typeDetails(type.elementType, renderAnchors);
92
+ return context.typeDetails(reflectionOwningType, type.elementType, renderAnchors);
52
93
  },
53
94
  intersection(type) {
54
- return type.types.map((t) => context.typeDetails(t, renderAnchors));
95
+ return type.types.map((t) => context.typeDetails(reflectionOwningType, t, renderAnchors));
55
96
  },
56
97
  union(type) {
57
98
  const result = [];
@@ -59,7 +100,7 @@ export function typeDetailsImpl(context, type, renderAnchors, highlighted) {
59
100
  result.push(JSX.createElement("li", null,
60
101
  context.type(type.types[i]),
61
102
  context.displayParts(type.elementSummaries?.[i]),
62
- context.typeDetailsIfUseful(type.types[i])));
103
+ context.typeDetailsIfUseful(reflectionOwningType, type.types[i])));
63
104
  }
64
105
  return JSX.createElement("ul", null, result);
65
106
  },
@@ -71,7 +112,7 @@ export function typeDetailsImpl(context, type, renderAnchors, highlighted) {
71
112
  return declarationDetails(context, declaration, renderAnchors);
72
113
  },
73
114
  reference(reference) {
74
- if (shouldExpandReference(reference)) {
115
+ if (shouldExpandReference(reflectionOwningType, reference)) {
75
116
  const target = reference.reflection;
76
117
  if (!target?.isDeclaration()) {
77
118
  return highlightedPropertyDetails(context, reference.highlightedProperties);
@@ -79,7 +120,7 @@ export function typeDetailsImpl(context, type, renderAnchors, highlighted) {
79
120
  // Ensure we don't go into an infinite loop here
80
121
  expanded.add(target);
81
122
  const details = target.type
82
- ? context.typeDetails(target.type, renderAnchors)
123
+ ? context.typeDetails(reflectionOwningType, target.type, renderAnchors)
83
124
  : declarationDetails(context, target, renderAnchors);
84
125
  expanded.delete(target);
85
126
  return details;
@@ -92,9 +133,10 @@ export function typeDetailsImpl(context, type, renderAnchors, highlighted) {
92
133
  }
93
134
  return result;
94
135
  }
95
- export function typeDetailsIfUseful(context, type) {
96
- if (type && renderingTypeDetailsIsUseful(type)) {
97
- return context.typeDetails(type, false);
136
+ export function typeDetailsIfUseful(context, reflectionOwningType, type) {
137
+ assert(reflectionOwningType instanceof Reflection, "typeDetailsIfUseful(reflectionOwningType, type) called incorrectly");
138
+ if (type && renderingTypeDetailsIsUseful(reflectionOwningType, type)) {
139
+ return context.typeDetails(reflectionOwningType, type, false);
98
140
  }
99
141
  }
100
142
  function highlightedPropertyDetails(context, highlighted) {
@@ -134,14 +176,13 @@ function declarationDetails(context, declaration, renderAnchors) {
134
176
  function renderChild(context, child, renderAnchors, highlight) {
135
177
  if (child.signatures) {
136
178
  return (JSX.createElement("li", { class: "tsd-parameter" },
137
- JSX.createElement("h5", null,
179
+ JSX.createElement("h5", { id: anchorTargetIfPresent(context, child) },
138
180
  !!child.flags.isRest && JSX.createElement("span", { class: "tsd-signature-symbol" }, "..."),
139
181
  JSX.createElement("span", { class: getKindClass(child) }, child.name),
140
- anchorLinkIfPresent(context, child),
141
182
  JSX.createElement("span", { class: "tsd-signature-symbol" },
142
183
  !!child.flags.isOptional && "?",
143
184
  ":"),
144
- "function"),
185
+ " function"),
145
186
  context.memberSignatures(child)));
146
187
  }
147
188
  function highlightOrComment(refl) {
@@ -155,11 +196,10 @@ function renderChild(context, child, renderAnchors, highlight) {
155
196
  // standard type
156
197
  if (child.type) {
157
198
  return (JSX.createElement("li", { class: "tsd-parameter" },
158
- JSX.createElement("h5", null,
199
+ JSX.createElement("h5", { id: anchorTargetIfPresent(context, child) },
159
200
  context.reflectionFlags(child),
160
201
  !!child.flags.isRest && JSX.createElement("span", { class: "tsd-signature-symbol" }, "..."),
161
202
  JSX.createElement("span", { class: getKindClass(child) }, child.name),
162
- anchorLinkIfPresent(context, child),
163
203
  JSX.createElement("span", { class: "tsd-signature-symbol" },
164
204
  !!child.flags.isOptional && "?",
165
205
  ": "),
@@ -170,43 +210,49 @@ function renderChild(context, child, renderAnchors, highlight) {
170
210
  // getter/setter
171
211
  return (JSX.createElement(JSX.Fragment, null,
172
212
  child.getSignature && (JSX.createElement("li", { class: "tsd-parameter" },
173
- JSX.createElement("h5", null,
213
+ JSX.createElement("h5", { id: anchorTargetIfPresent(context, child) },
174
214
  context.reflectionFlags(child.getSignature),
175
215
  JSX.createElement("span", { class: "tsd-signature-keyword" }, "get"),
216
+ " ",
176
217
  JSX.createElement("span", { class: getKindClass(child) }, child.name),
177
- anchorLinkIfPresent(context, child),
178
218
  JSX.createElement("span", { class: "tsd-signature-symbol" }, "():"),
219
+ " ",
179
220
  context.type(child.getSignature.type)),
180
221
  highlightOrComment(child.getSignature))),
181
222
  child.setSignature && (JSX.createElement("li", { class: "tsd-parameter" },
182
- JSX.createElement("h5", null,
223
+ JSX.createElement("h5", { id: !child.getSignature ? anchorTargetIfPresent(context, child) : undefined },
183
224
  context.reflectionFlags(child.setSignature),
184
225
  JSX.createElement("span", { class: "tsd-signature-keyword" }, "set"),
226
+ " ",
185
227
  JSX.createElement("span", { class: getKindClass(child) }, child.name),
186
- !child.getSignature && anchorLinkIfPresent(context, child),
187
228
  JSX.createElement("span", { class: "tsd-signature-symbol" }, "("),
188
229
  child.setSignature.parameters?.map((item) => (JSX.createElement(JSX.Fragment, null,
189
230
  item.name,
190
231
  JSX.createElement("span", { class: "tsd-signature-symbol" }, ":"),
232
+ " ",
191
233
  context.type(item.type)))),
192
234
  JSX.createElement("span", { class: "tsd-signature-symbol" }, "):"),
235
+ " ",
193
236
  context.type(child.setSignature.type)),
194
237
  highlightOrComment(child.setSignature)))));
195
238
  }
196
239
  function renderIndexSignature(context, index) {
197
240
  return (JSX.createElement("li", { class: "tsd-parameter-index-signature" },
198
241
  JSX.createElement("h5", null,
199
- index.flags.isReadonly && JSX.createElement("span", { class: "tsd-signature-keyword" }, "readonly"),
242
+ index.flags.isReadonly && (JSX.createElement(JSX.Fragment, null,
243
+ JSX.createElement("span", { class: "tsd-signature-keyword" }, "readonly"),
244
+ " ")),
200
245
  JSX.createElement("span", { class: "tsd-signature-symbol" }, "["),
201
246
  index.parameters.map((item) => (JSX.createElement(JSX.Fragment, null,
202
247
  JSX.createElement("span", { class: getKindClass(item) }, item.name),
203
248
  ": ",
204
249
  context.type(item.type)))),
205
- JSX.createElement("span", { class: "tsd-signature-symbol" }, "]: "),
250
+ JSX.createElement("span", { class: "tsd-signature-symbol" }, "]:"),
251
+ " ",
206
252
  context.type(index.type)),
207
253
  context.commentSummary(index),
208
254
  context.commentTags(index),
209
- context.typeDeclaration(index.type)));
255
+ context.typeDeclaration(index, index.type)));
210
256
  }
211
257
  function renderingChildIsUseful(refl) {
212
258
  // Object types directly under a variable/type alias will always be considered useful.
@@ -1,12 +1,11 @@
1
1
  import { i18n, JSX } from "#utils";
2
- import { anchorLinkIfPresent } from "./anchor-icon.js";
2
+ import { anchorTargetIfPresent } from "./anchor-icon.js";
3
3
  export function typeParameters(context, typeParameters) {
4
4
  return (JSX.createElement(JSX.Fragment, null,
5
5
  JSX.createElement("section", { class: "tsd-panel" },
6
6
  JSX.createElement("h4", null, i18n.kind_plural_type_parameter()),
7
7
  JSX.createElement("ul", { class: "tsd-type-parameter-list" }, typeParameters.map((item) => (JSX.createElement("li", null,
8
- JSX.createElement("span", null,
9
- anchorLinkIfPresent(context, item),
8
+ JSX.createElement("span", { id: anchorTargetIfPresent(context, item) },
10
9
  item.flags.isConst && (JSX.createElement(JSX.Fragment, null,
11
10
  JSX.createElement("span", { class: "tsd-signature-keyword" }, "const"),
12
11
  " ")),
@@ -1,11 +1,10 @@
1
1
  import { i18n, JSX } from "#utils";
2
2
  import { getHierarchyRoots } from "../../lib.js";
3
- import { anchorLink } from "../partials/anchor-icon.js";
4
3
  function fullHierarchy(context, root, seen) {
5
4
  if (seen.has(root)) {
6
5
  return (JSX.createElement("li", { "data-refl": root.id },
7
6
  JSX.createElement("a", { href: context.urlTo(root) },
8
- context.icons[root.kind](),
7
+ context.reflectionIcon(root),
9
8
  root.name)));
10
9
  }
11
10
  seen.add(root);
@@ -18,10 +17,9 @@ function fullHierarchy(context, root, seen) {
18
17
  // Note: We don't use root.anchor for the anchor, because those are built on a per page basis.
19
18
  // And classes/interfaces get their own page, so all the anchors will be empty anyways.
20
19
  // Full name should be safe here, since this list only includes classes/interfaces.
21
- return (JSX.createElement("li", { "data-refl": root.id },
22
- anchorLink(root.getFullName()),
20
+ return (JSX.createElement("li", { "data-refl": root.id, id: root.getFullName() },
23
21
  JSX.createElement("a", { href: context.urlTo(root) },
24
- context.icons[root.kind](),
22
+ context.reflectionIcon(root),
25
23
  root.name),
26
24
  children.length && JSX.createElement("ul", null, children)));
27
25
  }
@@ -3,7 +3,8 @@ import { DeclarationReflection, ReflectionKind, } from "../../../../models/index
3
3
  import { i18n, JSX } from "#utils";
4
4
  export function reflectionTemplate(context, props) {
5
5
  if (props.model.kindOf(ReflectionKind.TypeAlias | ReflectionKind.Variable) &&
6
- props.model instanceof DeclarationReflection) {
6
+ props.model instanceof DeclarationReflection &&
7
+ props.model.type) {
7
8
  return context.memberDeclaration(props.model);
8
9
  }
9
10
  if (props.model.kindOf(ReflectionKind.ExportContainer) &&
@@ -35,15 +36,18 @@ export function reflectionTemplate(context, props) {
35
36
  function renderIndexSignature(context, index) {
36
37
  return (JSX.createElement("li", { class: classNames({ "tsd-index-signature": true }, context.getReflectionClasses(index)) },
37
38
  JSX.createElement("div", { class: "tsd-signature" },
38
- index.flags.isReadonly && JSX.createElement("span", { class: "tsd-signature-keyword" }, "readonly"),
39
+ index.flags.isReadonly && (JSX.createElement(JSX.Fragment, null,
40
+ JSX.createElement("span", { class: "tsd-signature-keyword" }, "readonly"),
41
+ " ")),
39
42
  JSX.createElement("span", { class: "tsd-signature-symbol" }, "["),
40
43
  index.parameters.map((item) => (JSX.createElement(JSX.Fragment, null,
41
44
  JSX.createElement("span", { class: getKindClass(item) }, item.name),
42
45
  ": ",
43
46
  context.type(item.type)))),
44
47
  JSX.createElement("span", { class: "tsd-signature-symbol" }, "]:"),
48
+ " ",
45
49
  context.type(index.type)),
46
50
  context.commentSummary(index),
47
51
  context.commentTags(index),
48
- context.typeDetailsIfUseful(index.type)));
52
+ context.typeDetailsIfUseful(index, index.type)));
49
53
  }
@@ -75,19 +75,23 @@ export function renderTypeParametersSignature(context, typeParameters) {
75
75
  return (JSX.createElement(JSX.Fragment, null,
76
76
  JSX.createElement("span", { class: "tsd-signature-symbol" }, "<"),
77
77
  join(JSX.createElement("span", { class: "tsd-signature-symbol" }, ", "), typeParameters, (item) => (JSX.createElement(JSX.Fragment, null,
78
- item.flags.isConst && JSX.createElement("span", { class: "tsd-signature-keyword" }, "const"),
79
- item.varianceModifier ? `${item.varianceModifier} ` : "",
78
+ (item.flags.isConst || item.varianceModifier) && (JSX.createElement("span", { class: "tsd-signature-keyword" },
79
+ item.flags.isConst && "const ",
80
+ item.varianceModifier && `${item.varianceModifier} `)),
80
81
  JSX.createElement("a", { class: "tsd-signature-type tsd-kind-type-parameter", href: context.urlTo(item) }, item.name)))),
81
82
  JSX.createElement("span", { class: "tsd-signature-symbol" }, ">")));
82
83
  }
83
84
  return (JSX.createElement(JSX.Fragment, null,
84
85
  JSX.createElement("span", { class: "tsd-signature-symbol" }, "<"),
85
86
  join(JSX.createElement("span", { class: "tsd-signature-symbol" }, ", "), typeParameters, (item) => (JSX.createElement(JSX.Fragment, null,
86
- item.flags.isConst && "const ",
87
- item.varianceModifier ? `${item.varianceModifier} ` : "",
87
+ (item.flags.isConst || item.varianceModifier) && (JSX.createElement("span", { class: "tsd-signature-keyword" },
88
+ item.flags.isConst && "const ",
89
+ item.varianceModifier && `${item.varianceModifier} `)),
88
90
  JSX.createElement("span", { class: "tsd-signature-type tsd-kind-type-parameter" }, item.name),
89
91
  !!item.type && (JSX.createElement(JSX.Fragment, null,
92
+ " ",
90
93
  JSX.createElement("span", { class: "tsd-signature-keyword" }, "extends"),
94
+ " ",
91
95
  context.type(item.type)))))),
92
96
  JSX.createElement("span", { class: "tsd-signature-symbol" }, ">")));
93
97
  }
@@ -1,4 +1,5 @@
1
1
  import * as shiki from "@gerrit0/mini-shiki";
2
+ export declare function loadTestHighlighter(): void;
2
3
  export declare function loadHighlighter(lightTheme: shiki.BundledTheme, darkTheme: shiki.BundledTheme, langs: shiki.BundledLanguage[], ignoredLangs: string[] | undefined): Promise<void>;
3
4
  export declare function isSupportedLanguage(lang: string): boolean;
4
5
  export declare function getSupportedLanguages(): string[];
@@ -14,7 +14,7 @@ const supportedLanguages = unique([
14
14
  ...shiki.bundledLanguagesInfo.map((lang) => lang.id),
15
15
  ]).sort();
16
16
  const supportedThemes = Object.keys(shiki.bundledThemes);
17
- class DoubleHighlighter {
17
+ class ShikiHighlighter {
18
18
  highlighter;
19
19
  light;
20
20
  dark;
@@ -89,9 +89,23 @@ class DoubleHighlighter {
89
89
  return scheme;
90
90
  }
91
91
  }
92
+ class TestHighlighter {
93
+ supports() {
94
+ return true;
95
+ }
96
+ highlight(code) {
97
+ return code;
98
+ }
99
+ getStyles() {
100
+ return "";
101
+ }
102
+ }
92
103
  let shikiEngine;
93
104
  let highlighter;
94
105
  let ignoredLanguages;
106
+ export function loadTestHighlighter() {
107
+ highlighter = new TestHighlighter();
108
+ }
95
109
  export async function loadHighlighter(lightTheme, darkTheme, langs, ignoredLangs) {
96
110
  if (highlighter)
97
111
  return;
@@ -105,7 +119,7 @@ export async function loadHighlighter(lightTheme, darkTheme, langs, ignoredLangs
105
119
  themes: [shiki.bundledThemes[lightTheme], shiki.bundledThemes[darkTheme]],
106
120
  langs: langs.map((lang) => shiki.bundledLanguages[lang]),
107
121
  });
108
- highlighter = new DoubleHighlighter(hl, lightTheme, darkTheme);
122
+ highlighter = new ShikiHighlighter(hl, lightTheme, darkTheme);
109
123
  }
110
124
  export function isSupportedLanguage(lang) {
111
125
  return ignoredLanguages?.includes(lang) || getSupportedLanguages().includes(lang);
@@ -9,6 +9,7 @@ export { loadPlugins } from "./plugins.js";
9
9
  export { getSortFunction } from "./sort.js";
10
10
  export type { SortStrategy } from "./sort.js";
11
11
  export * from "./entry-point.js";
12
+ export * from "./highlighter.js";
12
13
  export * from "./html.js";
13
14
  export * from "./tsconfig.js";
14
15
  export * from "./tsutils.js";
@@ -7,6 +7,7 @@ export * from "./paths.js";
7
7
  export { loadPlugins } from "./plugins.js";
8
8
  export { getSortFunction } from "./sort.js";
9
9
  export * from "./entry-point.js";
10
+ export * from "./highlighter.js";
10
11
  export * from "./html.js";
11
12
  export * from "./tsconfig.js";
12
13
  export * from "./tsutils.js";
@@ -42,6 +42,8 @@ export const notRenderedTags = [
42
42
  "@hideCategories",
43
43
  "@hideGroups",
44
44
  "@expand",
45
+ "@preventExpand",
46
+ "@expandType",
45
47
  "@summary",
46
48
  "@group",
47
49
  "@groupDescription",
@@ -1,5 +1,5 @@
1
1
  export declare const tsdocBlockTags: readonly ["@defaultValue", "@deprecated", "@example", "@param", "@privateRemarks", "@remarks", "@returns", "@see", "@throws", "@typeParam"];
2
- export declare const blockTags: readonly ["@defaultValue", "@deprecated", "@example", "@param", "@privateRemarks", "@remarks", "@returns", "@see", "@throws", "@typeParam", "@author", "@callback", "@category", "@categoryDescription", "@default", "@document", "@extends", "@augments", "@yields", "@group", "@groupDescription", "@import", "@inheritDoc", "@jsx", "@license", "@module", "@mergeModuleWith", "@prop", "@property", "@return", "@satisfies", "@since", "@template", "@type", "@typedef", "@summary"];
2
+ export declare const blockTags: readonly ["@defaultValue", "@deprecated", "@example", "@param", "@privateRemarks", "@remarks", "@returns", "@see", "@throws", "@typeParam", "@author", "@callback", "@category", "@categoryDescription", "@default", "@document", "@extends", "@augments", "@yields", "@group", "@groupDescription", "@import", "@inheritDoc", "@jsx", "@license", "@module", "@mergeModuleWith", "@prop", "@property", "@return", "@satisfies", "@since", "@template", "@type", "@typedef", "@summary", "@preventInline", "@inlineType", "@preventExpand", "@expandType"];
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"];
@@ -39,6 +39,10 @@ export const blockTags = [
39
39
  "@type",
40
40
  "@typedef",
41
41
  "@summary",
42
+ "@preventInline",
43
+ "@inlineType",
44
+ "@preventExpand",
45
+ "@expandType",
42
46
  ];
43
47
  export const tsdocInlineTags = ["@link", "@inheritDoc", "@label"];
44
48
  export const inlineTags = [
@@ -122,6 +122,7 @@ export interface IntrinsicElements {
122
122
  line: JsxLineElementProps;
123
123
  use: JsxUseElementProps;
124
124
  text: JsxTextElementProps;
125
+ image: JsxImageElementProps;
125
126
  }
126
127
  export declare function JsxFragment(): never;
127
128
  export type JsxComponent<P> = (props: P) => JsxElement | null | undefined;
@@ -930,3 +931,18 @@ export interface JsxTextElementProps extends JsxSvgCoreProps, JsxSvgStyleProps,
930
931
  x?: string | number;
931
932
  y?: string | number;
932
933
  }
934
+ /**
935
+ * Properties permitted on the `<image>` element.
936
+ *
937
+ * Reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/image
938
+ */
939
+ export interface JsxImageElementProps extends JsxSvgCoreProps {
940
+ x?: string | number;
941
+ y?: string | number;
942
+ width?: string | number;
943
+ height?: string | number;
944
+ href: string;
945
+ preserveAspectRatio?: string;
946
+ crossorigin?: "anonymous" | "use-credentials";
947
+ decoding?: "async" | "sync" | "auto";
948
+ }
@@ -78,7 +78,10 @@ export var NormalizedPathUtils;
78
78
  const parts = path.split("/");
79
79
  let canRemoveDotDot = false;
80
80
  for (let i = 0; i < parts.length; /* inside loop */) {
81
- if (parts[i] == "..") {
81
+ if (parts[i] == "." && i + 1 != parts.length) {
82
+ parts.splice(i, 1);
83
+ }
84
+ else if (parts[i] == "..") {
82
85
  if (canRemoveDotDot) {
83
86
  if (i - 1 === 0 && /\w:/i.test(parts[0])) {
84
87
  parts.splice(i, 1);
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.0-beta.1",
4
+ "version": "0.28.0-beta.2",
5
5
  "homepage": "https://typedoc.org",
6
6
  "type": "module",
7
7
  "exports": {