@skyux/docs-tools 9.0.0-alpha.1 → 9.0.0-alpha.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.
@@ -2195,6 +2195,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.8", ngImpor
2195
2195
  }]
2196
2196
  }], ctorParameters: function () { return [{ type: i1$4.Title }]; } });
2197
2197
 
2198
+ /**
2199
+ * This enum comes from:
2200
+ * https://github.com/TypeStrong/typedoc/blob/v0.24.8/src/lib/models/reflections/kind.ts
2201
+ * The enum is up to date as of version `0.24.8`.
2202
+ */
2203
+ var TypeDocKind;
2204
+ (function (TypeDocKind) {
2205
+ TypeDocKind[TypeDocKind["Project"] = 1] = "Project";
2206
+ TypeDocKind[TypeDocKind["Module"] = 2] = "Module";
2207
+ TypeDocKind[TypeDocKind["Namespace"] = 4] = "Namespace";
2208
+ TypeDocKind[TypeDocKind["Enum"] = 8] = "Enum";
2209
+ TypeDocKind[TypeDocKind["EnumMember"] = 16] = "EnumMember";
2210
+ TypeDocKind[TypeDocKind["Variable"] = 32] = "Variable";
2211
+ TypeDocKind[TypeDocKind["Function"] = 64] = "Function";
2212
+ TypeDocKind[TypeDocKind["Class"] = 128] = "Class";
2213
+ TypeDocKind[TypeDocKind["Interface"] = 256] = "Interface";
2214
+ TypeDocKind[TypeDocKind["Constructor"] = 512] = "Constructor";
2215
+ TypeDocKind[TypeDocKind["Property"] = 1024] = "Property";
2216
+ TypeDocKind[TypeDocKind["Method"] = 2048] = "Method";
2217
+ TypeDocKind[TypeDocKind["CallSignature"] = 4096] = "CallSignature";
2218
+ TypeDocKind[TypeDocKind["IndexSignature"] = 8192] = "IndexSignature";
2219
+ TypeDocKind[TypeDocKind["ConstructorSignature"] = 16384] = "ConstructorSignature";
2220
+ TypeDocKind[TypeDocKind["Parameter"] = 32768] = "Parameter";
2221
+ TypeDocKind[TypeDocKind["TypeLiteral"] = 65536] = "TypeLiteral";
2222
+ TypeDocKind[TypeDocKind["TypeParameter"] = 131072] = "TypeParameter";
2223
+ TypeDocKind[TypeDocKind["Accessor"] = 262144] = "Accessor";
2224
+ TypeDocKind[TypeDocKind["GetSignature"] = 524288] = "GetSignature";
2225
+ TypeDocKind[TypeDocKind["SetSignature"] = 1048576] = "SetSignature";
2226
+ /** @deprecated will be removed in v0.25, not used */
2227
+ TypeDocKind[TypeDocKind["ObjectLiteral"] = 2097152] = "ObjectLiteral";
2228
+ TypeDocKind[TypeDocKind["TypeAlias"] = 4194304] = "TypeAlias";
2229
+ TypeDocKind[TypeDocKind["Reference"] = 8388608] = "Reference";
2230
+ })(TypeDocKind || (TypeDocKind = {}));
2231
+
2198
2232
  /**
2199
2233
  * Converts TypeDoc types into SKY UX docs-tools types, to be supplied to the various definitions components.
2200
2234
  */
@@ -2311,10 +2345,11 @@ class SkyDocsTypeDocAdapterService {
2311
2345
  const definitions = entry.children
2312
2346
  .filter((child) =>
2313
2347
  // We only want properties (both with or without a getter/setter)
2314
- child.kindString === 'Property' || child.kindString === 'Accessor')
2348
+ child.kind === TypeDocKind.Property ||
2349
+ child.kind === TypeDocKind.Accessor)
2315
2350
  .filter((child) =>
2316
2351
  // We only want accessors that don't have a setter if they are not inputs
2317
- child.kindString !== 'Accessor' ||
2352
+ child.kind !== TypeDocKind.Accessor ||
2318
2353
  child.setSignature ||
2319
2354
  this.getDecorator(child)?.name !== 'Input')
2320
2355
  .map((child) => {
@@ -2325,7 +2360,7 @@ class SkyDocsTypeDocAdapterService {
2325
2360
  };
2326
2361
  let defaultValue;
2327
2362
  /* Ensure we are properly capturing definitions which use a getter/setter. Final check is a sanity check */
2328
- if (child.kindString === 'Accessor' &&
2363
+ if (child.kind === TypeDocKind.Accessor &&
2329
2364
  !child.comment?.summary
2330
2365
  ?.map((item) => item.text)
2331
2366
  .join('')
@@ -2353,7 +2388,7 @@ class SkyDocsTypeDocAdapterService {
2353
2388
  }
2354
2389
  else {
2355
2390
  let tags;
2356
- if (child.kindString === 'Property' &&
2391
+ if (child.kind === TypeDocKind.Property &&
2357
2392
  !child.comment?.summary
2358
2393
  ?.map((item) => item.text)
2359
2394
  .join('')
@@ -2378,9 +2413,9 @@ class SkyDocsTypeDocAdapterService {
2378
2413
  definition.decorator = decorator;
2379
2414
  }
2380
2415
  if (!definition.description) {
2381
- const constructor = entry.children.find((child) => child.kindString === 'Constructor');
2416
+ const constructor = entry.children.find((child) => child.kind === TypeDocKind.Constructor);
2382
2417
  if (constructor) {
2383
- const signature = constructor.signatures.find((signature) => signature.kindString === 'Constructor signature');
2418
+ const signature = constructor.signatures.find((signature) => signature.kind === TypeDocKind.ConstructorSignature);
2384
2419
  /* Sanity check */
2385
2420
  /* istanbul ignore else */
2386
2421
  if (signature) {
@@ -2401,7 +2436,7 @@ class SkyDocsTypeDocAdapterService {
2401
2436
  return [];
2402
2437
  }
2403
2438
  const methods = entry.children
2404
- .filter((child) => child.kindString === 'Method' && /^ng/.test(child.name) === false)
2439
+ .filter((child) => child.kind === TypeDocKind.Method && /^ng/.test(child.name) === false)
2405
2440
  .map((child) => {
2406
2441
  const definition = {
2407
2442
  name: this.getPropertyName(child),
@@ -2427,7 +2462,7 @@ class SkyDocsTypeDocAdapterService {
2427
2462
  }
2428
2463
  const definitions = entry.children?.map((child) => {
2429
2464
  let tags;
2430
- if (child.kindString === 'Method' && child.signatures.length > 0) {
2465
+ if (child.kind === TypeDocKind.Method && child.signatures.length > 0) {
2431
2466
  tags = this.getCommentTags(child.signatures[0].comment);
2432
2467
  }
2433
2468
  else if (child.type.type === 'reflection' &&
@@ -2477,14 +2512,14 @@ class SkyDocsTypeDocAdapterService {
2477
2512
  }
2478
2513
  getTypeDefinition(child) {
2479
2514
  let definition;
2480
- const kindString = child.kindString;
2481
- switch (kindString) {
2482
- case 'Accessor':
2515
+ const kind = child.kind;
2516
+ switch (kind) {
2517
+ case TypeDocKind.Accessor:
2483
2518
  if (child.setSignature) {
2484
2519
  return this.getTypeDefinition(child.setSignature.parameters[0]);
2485
2520
  }
2486
2521
  return this.getTypeDefinition(child.getSignature);
2487
- case 'Method':
2522
+ case TypeDocKind.Method:
2488
2523
  definition = {
2489
2524
  callSignature: this.getCallSignatureDefinition(child.signatures[0], this.getCommentTags(child.comment)),
2490
2525
  name: child.signatures[0].name,
@@ -2805,7 +2840,7 @@ class SkyDocsTypeDefinitionsService {
2805
2840
  }
2806
2841
  typeDefinitions.forEach((item) => {
2807
2842
  const decorator = item.decorators && item.decorators[0]?.name;
2808
- const kindString = item.kindString;
2843
+ const kind = item.kind;
2809
2844
  switch (decorator) {
2810
2845
  case 'Component':
2811
2846
  types.components.push(this.adapter.toDirectiveDefinition(item));
@@ -2824,17 +2859,17 @@ class SkyDocsTypeDefinitionsService {
2824
2859
  break;
2825
2860
  default:
2826
2861
  /*tslint:disable-next-line:switch-default*/
2827
- switch (kindString) {
2828
- case 'Class':
2862
+ switch (kind) {
2863
+ case TypeDocKind.Class:
2829
2864
  types.classes.push(this.adapter.toClassDefinition(item));
2830
2865
  break;
2831
- case 'Interface':
2866
+ case TypeDocKind.Interface:
2832
2867
  types.interfaces.push(this.adapter.toInterfaceDefinition(item));
2833
2868
  break;
2834
- case 'Enumeration':
2869
+ case TypeDocKind.Enum:
2835
2870
  types.enumerations.push(this.adapter.toEnumerationDefinition(item));
2836
2871
  break;
2837
- case 'Type alias':
2872
+ case TypeDocKind.TypeAlias:
2838
2873
  types.typeAliases.push(this.adapter.toTypeAliasDefinition(item));
2839
2874
  break;
2840
2875
  }