@ng-doc/builder 15.1.1 → 15.3.1

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 (101) hide show
  1. package/engine/.cache/apps/ng-doc/src/app/docs/content/api-templating/ng-doc.page.js +40 -8
  2. package/engine/.cache/apps/ng-doc/src/app/docs/content/guides/demo/ng-doc.page.js +51 -0
  3. package/engine/.cache/apps/ng-doc/src/app/docs/content/guides/ng-doc.category.js +41 -0
  4. package/engine/.cache/apps/ng-doc/src/app/docs/content/guides/playground/ng-doc.page.js +50 -0
  5. package/engine/.cache/apps/ng-doc/src/app/docs/content/guides/templating/ng-doc.page.js +51 -0
  6. package/engine/.cache/apps/ng-doc/src/app/docs/content/keywords/ng-doc.page.js +40 -8
  7. package/engine/.cache/apps/ng-doc/src/app/docs/content/ng-doc.category.js +28 -5
  8. package/engine/.cache/apps/ng-doc/src/app/docs/customization/layout/ng-doc.page.js +42 -0
  9. package/engine/.cache/apps/ng-doc/src/app/docs/customization/ng-doc.category.js +28 -5
  10. package/engine/.cache/apps/ng-doc/src/app/docs/customization/themes/ng-doc.page.js +40 -8
  11. package/engine/.cache/apps/ng-doc/src/app/docs/customization/type-controls/ng-doc.page.js +43 -0
  12. package/engine/.cache/apps/ng-doc/src/app/docs/develop/ng-doc.page.js +39 -10
  13. package/engine/.cache/apps/ng-doc/src/app/docs/entities/api/ng-doc.page.js +40 -8
  14. package/engine/.cache/apps/ng-doc/src/app/docs/entities/category/ng-doc.page.js +40 -8
  15. package/engine/.cache/apps/ng-doc/src/app/docs/entities/dependencies/ng-doc.page.js +40 -8
  16. package/engine/.cache/apps/ng-doc/src/app/docs/entities/ng-doc.category.js +28 -5
  17. package/engine/.cache/apps/ng-doc/src/app/docs/entities/page/ng-doc.page.js +43 -11
  18. package/engine/.cache/apps/ng-doc/src/app/docs/getting-started/configuration/ng-doc.page.js +39 -8
  19. package/engine/.cache/apps/ng-doc/src/app/docs/getting-started/installation/ng-doc.page.js +39 -8
  20. package/engine/.cache/apps/ng-doc/src/app/docs/getting-started/ng-doc.category.js +29 -6
  21. package/engine/.cache/apps/ng-doc/src/app/docs/getting-started/roadmap/ng-doc.page.js +39 -8
  22. package/engine/.cache/apps/ng-doc/src/app/docs/getting-started/what-is-ng-doc/ng-doc.page.js +38 -7
  23. package/engine/.cache/apps/ng-doc/src/app/docs/ng-doc.api.js +50 -27
  24. package/engine/actions/playground.action.d.ts +2 -2
  25. package/engine/actions/playground.action.js +12 -11
  26. package/engine/actions/playground.action.js.map +1 -1
  27. package/engine/builder.d.ts +2 -2
  28. package/engine/builder.js +20 -8
  29. package/engine/builder.js.map +1 -1
  30. package/engine/entities/abstractions/file.entity.js.map +1 -1
  31. package/engine/entities/abstractions/import.cjs +9 -0
  32. package/engine/entities/abstractions/source-file.entity.d.ts +4 -0
  33. package/engine/entities/abstractions/source-file.entity.js +4 -0
  34. package/engine/entities/abstractions/source-file.entity.js.map +1 -1
  35. package/engine/entities/api.entity.d.ts +1 -0
  36. package/engine/entities/api.entity.js +2 -1
  37. package/engine/entities/api.entity.js.map +1 -1
  38. package/engine/entities/category.entity.d.ts +1 -0
  39. package/engine/entities/category.entity.js +4 -0
  40. package/engine/entities/category.entity.js.map +1 -1
  41. package/engine/entities/dependencies.entity.d.ts +13 -3
  42. package/engine/entities/dependencies.entity.js +61 -63
  43. package/engine/entities/dependencies.entity.js.map +1 -1
  44. package/engine/entities/index.d.ts +0 -1
  45. package/engine/entities/index.js +0 -1
  46. package/engine/entities/index.js.map +1 -1
  47. package/engine/entities/page.entity.d.ts +1 -4
  48. package/engine/entities/page.entity.js +7 -15
  49. package/engine/entities/page.entity.js.map +1 -1
  50. package/engine/template-filters.d.ts +2 -1
  51. package/engine/template-filters.js +8 -1
  52. package/engine/template-filters.js.map +1 -1
  53. package/engine/variables.d.ts +0 -2
  54. package/engine/variables.js +1 -3
  55. package/engine/variables.js.map +1 -1
  56. package/helpers/build-assets.js +2 -0
  57. package/helpers/build-assets.js.map +1 -1
  58. package/helpers/entity-type.d.ts +5 -4
  59. package/helpers/entity-type.js +10 -9
  60. package/helpers/entity-type.js.map +1 -1
  61. package/helpers/get-component-asset.d.ts +10 -0
  62. package/helpers/get-component-asset.js +60 -0
  63. package/helpers/get-component-asset.js.map +1 -0
  64. package/helpers/get-demo-class-declarations.d.ts +6 -0
  65. package/helpers/get-demo-class-declarations.js +26 -0
  66. package/helpers/get-demo-class-declarations.js.map +1 -0
  67. package/helpers/get-entity-constructor.js +0 -3
  68. package/helpers/get-entity-constructor.js.map +1 -1
  69. package/helpers/get-playground-by-id.d.ts +7 -0
  70. package/helpers/get-playground-by-id.js +21 -0
  71. package/helpers/get-playground-by-id.js.map +1 -0
  72. package/helpers/get-playground-properties.d.ts +25 -0
  73. package/helpers/get-playground-properties.js +114 -0
  74. package/helpers/get-playground-properties.js.map +1 -0
  75. package/helpers/index.d.ts +4 -1
  76. package/helpers/index.js +4 -1
  77. package/helpers/index.js.map +1 -1
  78. package/package.json +3 -2
  79. package/templates/page.module.ts.nunj +9 -3
  80. package/templates/playgrounds.ts.nunj +70 -0
  81. package/types/component-asset.d.ts +2 -0
  82. package/types/component-asset.js +3 -0
  83. package/types/component-asset.js.map +1 -0
  84. package/types/index.d.ts +1 -0
  85. package/types/index.js +1 -0
  86. package/types/index.js.map +1 -1
  87. package/engine/.cache/apps/ng-doc/src/app/docs/content/guidelines/demo/demos/button-demo/button-demo.component.js +0 -28
  88. package/engine/.cache/apps/ng-doc/src/app/docs/content/guidelines/demo/demos/button-inline-demo/button-inline-demo.component.js +0 -30
  89. package/engine/.cache/apps/ng-doc/src/app/docs/content/guidelines/demo/ng-doc.dependencies.js +0 -12
  90. package/engine/.cache/apps/ng-doc/src/app/docs/content/guidelines/demo/ng-doc.module.js +0 -27
  91. package/engine/.cache/apps/ng-doc/src/app/docs/content/guidelines/demo/ng-doc.page.js +0 -11
  92. package/engine/.cache/apps/ng-doc/src/app/docs/content/guidelines/ng-doc.category.js +0 -9
  93. package/engine/.cache/apps/ng-doc/src/app/docs/content/guidelines/templating/ng-doc.page.js +0 -11
  94. package/engine/.cache/apps/ng-doc/src/app/docs/develop/custom-data.js +0 -6
  95. package/engine/.cache/ng-doc.buildinfo.json +0 -1
  96. package/engine/entities/playground.entity.d.ts +0 -16
  97. package/engine/entities/playground.entity.js +0 -65
  98. package/engine/entities/playground.entity.js.map +0 -1
  99. package/helpers/declaration-to-playground.d.ts +0 -7
  100. package/helpers/declaration-to-playground.js +0 -33
  101. package/helpers/declaration-to-playground.js.map +0 -1
@@ -1,19 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TEMPLATES_PATH = exports.CACHE_PATH = exports.PLAYGROUND_PATTERN = exports.API_PATTERN = exports.PAGE_DEPENDENCY_PATTERN = exports.CATEGORY_PATTERN = exports.PAGE_PATTERN = exports.RENDERED_PAGE_NAME = exports.PLAYGROUND_NAME = exports.API_NAME = exports.PAGE_DEPENDENCIES_NAME = exports.CATEGORY_NAME = exports.PAGE_NAME = void 0;
3
+ exports.TEMPLATES_PATH = exports.CACHE_PATH = exports.API_PATTERN = exports.PAGE_DEPENDENCY_PATTERN = exports.CATEGORY_PATTERN = exports.PAGE_PATTERN = exports.RENDERED_PAGE_NAME = exports.API_NAME = exports.PAGE_DEPENDENCIES_NAME = exports.CATEGORY_NAME = exports.PAGE_NAME = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const path = tslib_1.__importStar(require("path"));
6
6
  exports.PAGE_NAME = 'ng-doc.page.ts';
7
7
  exports.CATEGORY_NAME = 'ng-doc.category.ts';
8
8
  exports.PAGE_DEPENDENCIES_NAME = 'ng-doc.dependencies.ts';
9
9
  exports.API_NAME = 'ng-doc.api.ts';
10
- exports.PLAYGROUND_NAME = 'ng-doc.playground.ts';
11
10
  exports.RENDERED_PAGE_NAME = 'index.html';
12
11
  exports.PAGE_PATTERN = `**/${exports.PAGE_NAME}`;
13
12
  exports.CATEGORY_PATTERN = `**/${exports.CATEGORY_NAME}`;
14
13
  exports.PAGE_DEPENDENCY_PATTERN = `**/${exports.PAGE_DEPENDENCIES_NAME}`;
15
14
  exports.API_PATTERN = `**/${exports.API_NAME}`;
16
- exports.PLAYGROUND_PATTERN = `**/${exports.PLAYGROUND_NAME}`;
17
15
  exports.CACHE_PATH = path.join(__dirname, '.cache');
18
16
  exports.TEMPLATES_PATH = path.join(__dirname, '../templates');
19
17
  //# sourceMappingURL=variables.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"variables.js","sourceRoot":"","sources":["../../../../libs/builder/engine/variables.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AAEhB,QAAA,SAAS,GAAW,gBAAgB,CAAC;AACrC,QAAA,aAAa,GAAW,oBAAoB,CAAC;AAC7C,QAAA,sBAAsB,GAAW,wBAAwB,CAAC;AAC1D,QAAA,QAAQ,GAAW,eAAe,CAAC;AACnC,QAAA,eAAe,GAAW,sBAAsB,CAAC;AACjD,QAAA,kBAAkB,GAAW,YAAY,CAAC;AAE1C,QAAA,YAAY,GAAW,MAAM,iBAAS,EAAE,CAAC;AACzC,QAAA,gBAAgB,GAAW,MAAM,qBAAa,EAAE,CAAC;AACjD,QAAA,uBAAuB,GAAW,MAAM,8BAAsB,EAAE,CAAC;AACjE,QAAA,WAAW,GAAW,MAAM,gBAAQ,EAAE,CAAC;AACvC,QAAA,kBAAkB,GAAW,MAAM,uBAAe,EAAE,CAAC;AACrD,QAAA,UAAU,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AACpD,QAAA,cAAc,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"variables.js","sourceRoot":"","sources":["../../../../libs/builder/engine/variables.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AAEhB,QAAA,SAAS,GAAW,gBAAgB,CAAC;AACrC,QAAA,aAAa,GAAW,oBAAoB,CAAC;AAC7C,QAAA,sBAAsB,GAAW,wBAAwB,CAAC;AAC1D,QAAA,QAAQ,GAAW,eAAe,CAAC;AACnC,QAAA,kBAAkB,GAAW,YAAY,CAAC;AAE1C,QAAA,YAAY,GAAW,MAAM,iBAAS,EAAE,CAAC;AACzC,QAAA,gBAAgB,GAAW,MAAM,qBAAa,EAAE,CAAC;AACjD,QAAA,uBAAuB,GAAW,MAAM,8BAAsB,EAAE,CAAC;AACjE,QAAA,WAAW,GAAW,MAAM,gBAAQ,EAAE,CAAC;AACvC,QAAA,UAAU,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AACpD,QAAA,cAAc,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC"}
@@ -18,6 +18,8 @@ function buildAssets(filePath, styleType) {
18
18
  const fileContent = fs.readFileSync(filePath, 'utf8').trim();
19
19
  const snippets = (0, process_snippets_1.processSnippets)(fileContent);
20
20
  const codeType = (0, code_type_from_ext_1.codeTypeFromExt)(filePath);
21
+ // If the file contains snippets, we return an asset for each snippet,
22
+ // otherwise we return a single file as an asset.
21
23
  if (snippets.length) {
22
24
  return snippets.map((snippet) => ({
23
25
  title: snippet.name,
@@ -1 +1 @@
1
- {"version":3,"file":"build-assets.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/build-assets.ts"],"names":[],"mappings":";;;;AACA,+CAAyB;AAIzB,6DAAqD;AACrD,yDAAmD;AACnD,+CAAyC;AAEzC;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,QAAgB,EAAE,SAAyB;IACtE,IAAI;QACH,MAAM,WAAW,GAAW,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QACrE,MAAM,QAAQ,GAAmB,IAAA,kCAAe,EAAC,WAAW,CAAC,CAAC;QAC9D,MAAM,QAAQ,GAAkB,IAAA,oCAAe,EAAC,QAAQ,CAAC,CAAC;QAE1D,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
1
+ import { NgDocApiEntity, NgDocApiPageEntity, NgDocApiScopeEntity, NgDocCategoryEntity, NgDocDependenciesEntity, NgDocPageEntity } from '../engine';
2
+ import { NgDocFileEntity } from '../engine/entities/abstractions/file.entity';
2
3
  import { NgDocNavigationEntity } from '../engine/entities/abstractions/navigation.entity';
3
4
  import { NgDocRouteEntity } from '../engine/entities/abstractions/route.entity';
4
5
  import { Constructable } from '../types';
@@ -21,17 +22,17 @@ export declare function isCategoryEntity(page: InstanceType<Constructable>): pag
21
22
  *
22
23
  * @param page
23
24
  */
24
- export declare function isPlaygroundEntity(page: InstanceType<Constructable>): page is NgDocPlaygroundEntity;
25
+ export declare function isNavigationEntity(page: InstanceType<Constructable>): page is NgDocNavigationEntity<unknown>;
25
26
  /**
26
27
  *
27
28
  * @param page
28
29
  */
29
- export declare function isNavigationEntity(page: InstanceType<Constructable>): page is NgDocNavigationEntity<unknown>;
30
+ export declare function isApiEntity(page: InstanceType<Constructable>): page is NgDocApiEntity;
30
31
  /**
31
32
  *
32
33
  * @param page
33
34
  */
34
- export declare function isApiEntity(page: InstanceType<Constructable>): page is NgDocApiEntity;
35
+ export declare function isFileEntity<T>(page: InstanceType<Constructable>): page is NgDocFileEntity<T>;
35
36
  /**
36
37
  *
37
38
  * @param page
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isRouteEntity = exports.isApiScopeEntity = exports.isApiPageEntity = exports.isApiEntity = exports.isNavigationEntity = exports.isPlaygroundEntity = exports.isCategoryEntity = exports.isDependencyEntity = exports.isPageEntity = void 0;
3
+ exports.isRouteEntity = exports.isApiScopeEntity = exports.isApiPageEntity = exports.isFileEntity = exports.isApiEntity = exports.isNavigationEntity = exports.isCategoryEntity = exports.isDependencyEntity = exports.isPageEntity = void 0;
4
4
  const engine_1 = require("../engine");
5
+ const file_entity_1 = require("../engine/entities/abstractions/file.entity");
5
6
  const navigation_entity_1 = require("../engine/entities/abstractions/navigation.entity");
6
7
  const route_entity_1 = require("../engine/entities/abstractions/route.entity");
7
8
  /**
@@ -28,14 +29,6 @@ function isCategoryEntity(page) {
28
29
  return page instanceof engine_1.NgDocCategoryEntity;
29
30
  }
30
31
  exports.isCategoryEntity = isCategoryEntity;
31
- /**
32
- *
33
- * @param page
34
- */
35
- function isPlaygroundEntity(page) {
36
- return page instanceof engine_1.NgDocPlaygroundEntity;
37
- }
38
- exports.isPlaygroundEntity = isPlaygroundEntity;
39
32
  /**
40
33
  *
41
34
  * @param page
@@ -52,6 +45,14 @@ function isApiEntity(page) {
52
45
  return page instanceof engine_1.NgDocApiEntity;
53
46
  }
54
47
  exports.isApiEntity = isApiEntity;
48
+ /**
49
+ *
50
+ * @param page
51
+ */
52
+ function isFileEntity(page) {
53
+ return page instanceof file_entity_1.NgDocFileEntity;
54
+ }
55
+ exports.isFileEntity = isFileEntity;
55
56
  /**
56
57
  *
57
58
  * @param page
@@ -1 +1 @@
1
- {"version":3,"file":"entity-type.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/entity-type.ts"],"names":[],"mappings":";;;AAAA,sCAQmB;AACnB,yFAAwF;AACxF,+EAA8E;AAG9E;;;GAGG;AACH,SAAgB,YAAY,CAAC,IAAiC;IAC7D,OAAO,IAAI,YAAY,wBAAe,CAAC;AACxC,CAAC;AAFD,oCAEC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,UAAuC;IACzE,OAAO,UAAU,YAAY,gCAAuB,CAAC;AACtD,CAAC;AAFD,gDAEC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,IAAiC;IACjE,OAAO,IAAI,YAAY,4BAAmB,CAAC;AAC5C,CAAC;AAFD,4CAEC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,IAAiC;IACnE,OAAO,IAAI,YAAY,8BAAqB,CAAC;AAC9C,CAAC;AAFD,gDAEC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,IAAiC;IACnE,OAAO,IAAI,YAAY,yCAAqB,CAAC;AAC9C,CAAC;AAFD,gDAEC;AAED;;;GAGG;AACH,SAAgB,WAAW,CAAC,IAAiC;IAC5D,OAAO,IAAI,YAAY,uBAAc,CAAC;AACvC,CAAC;AAFD,kCAEC;AAED;;;GAGG;AACH,SAAgB,eAAe,CAAC,IAAiC;IAChE,OAAO,IAAI,YAAY,2BAAkB,CAAC;AAC3C,CAAC;AAFD,0CAEC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,IAAiC;IACjE,OAAO,IAAI,YAAY,4BAAmB,CAAC;AAC5C,CAAC;AAFD,4CAEC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,IAAiC;IAC9D,OAAO,IAAI,YAAY,+BAAgB,CAAC;AACzC,CAAC;AAFD,sCAEC"}
1
+ {"version":3,"file":"entity-type.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/entity-type.ts"],"names":[],"mappings":";;;AAAA,sCAOmB;AACnB,6EAA4E;AAC5E,yFAAwF;AACxF,+EAA8E;AAG9E;;;GAGG;AACH,SAAgB,YAAY,CAAC,IAAiC;IAC7D,OAAO,IAAI,YAAY,wBAAe,CAAC;AACxC,CAAC;AAFD,oCAEC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,UAAuC;IACzE,OAAO,UAAU,YAAY,gCAAuB,CAAC;AACtD,CAAC;AAFD,gDAEC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,IAAiC;IACjE,OAAO,IAAI,YAAY,4BAAmB,CAAC;AAC5C,CAAC;AAFD,4CAEC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,IAAiC;IACnE,OAAO,IAAI,YAAY,yCAAqB,CAAC;AAC9C,CAAC;AAFD,gDAEC;AAED;;;GAGG;AACH,SAAgB,WAAW,CAAC,IAAiC;IAC5D,OAAO,IAAI,YAAY,uBAAc,CAAC;AACvC,CAAC;AAFD,kCAEC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAI,IAAiC;IAChE,OAAO,IAAI,YAAY,6BAAe,CAAC;AACxC,CAAC;AAFD,oCAEC;AAED;;;GAGG;AACH,SAAgB,eAAe,CAAC,IAAiC;IAChE,OAAO,IAAI,YAAY,2BAAkB,CAAC;AAC3C,CAAC;AAFD,0CAEC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,IAAiC;IACjE,OAAO,IAAI,YAAY,4BAAmB,CAAC;AAC5C,CAAC;AAFD,4CAEC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,IAAiC;IAC9D,OAAO,IAAI,YAAY,+BAAgB,CAAC;AACzC,CAAC;AAFD,sCAEC"}
@@ -0,0 +1,10 @@
1
+ import { NgDocStyleType } from '@ng-doc/core';
2
+ import { ClassDeclaration } from 'ts-morph';
3
+ import { NgDocComponentAsset } from '../types';
4
+ /**
5
+ *
6
+ * @param classDeclaration
7
+ * @param inlineStyleLang
8
+ * @param outDir
9
+ */
10
+ export declare function getComponentAsset(classDeclaration: ClassDeclaration, inlineStyleLang: NgDocStyleType, outDir: string): NgDocComponentAsset;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getComponentAsset = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const builder_1 = require("@ng-doc/builder");
6
+ const core_1 = require("@ng-doc/core");
7
+ const path = tslib_1.__importStar(require("path"));
8
+ const ts_morph_1 = require("ts-morph");
9
+ const component_decorator_resolver_1 = require("../resolvers/component-decorator.resolver");
10
+ const build_assets_1 = require("./build-assets");
11
+ const format_code_1 = require("./format-code");
12
+ /**
13
+ *
14
+ * @param classDeclaration
15
+ * @param inlineStyleLang
16
+ * @param outDir
17
+ */
18
+ function getComponentAsset(classDeclaration, inlineStyleLang, outDir) {
19
+ var _a;
20
+ const decorator = classDeclaration.getDecorator('Component');
21
+ const decoratorArgument = decorator === null || decorator === void 0 ? void 0 : decorator.getArguments()[0];
22
+ if (ts_morph_1.Node.isObjectLiteralExpression(decoratorArgument)) {
23
+ const decoratorData = (0, component_decorator_resolver_1.componentDecoratorResolver)(decoratorArgument);
24
+ const filePath = classDeclaration.getSourceFile().getFilePath();
25
+ const fileDir = path.dirname(filePath);
26
+ const assets = [
27
+ // Add assets for the component file
28
+ ...(0, build_assets_1.buildAssets)(filePath, inlineStyleLang),
29
+ // Add assets for the template file if it exists
30
+ ...(decoratorData.templateUrl
31
+ ? (0, build_assets_1.buildAssets)(path.join(fileDir, decoratorData.templateUrl), inlineStyleLang)
32
+ : []),
33
+ // Add assets for the style files if they exist
34
+ ...(0, core_1.asArray)(decoratorData.styleUrls)
35
+ .map((styleUrl) => (0, build_assets_1.buildAssets)(path.join(fileDir, styleUrl), inlineStyleLang))
36
+ .flat(),
37
+ ];
38
+ return {
39
+ [(_a = classDeclaration.getName()) !== null && _a !== void 0 ? _a : '']: assets.map((asset) => {
40
+ const code = (0, format_code_1.formatCode)(asset.output, asset.type);
41
+ return {
42
+ ...asset,
43
+ code,
44
+ output: new builder_1.NgDocRenderer()
45
+ .renderSync('./code.html.nunj', {
46
+ context: {
47
+ code,
48
+ lang: asset.type,
49
+ },
50
+ })
51
+ .trim(),
52
+ outputPath: path.join(outDir, `${asset.name}.html`),
53
+ };
54
+ }),
55
+ };
56
+ }
57
+ return {};
58
+ }
59
+ exports.getComponentAsset = getComponentAsset;
60
+ //# sourceMappingURL=get-component-asset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-component-asset.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/get-component-asset.ts"],"names":[],"mappings":";;;;AACA,6CAA8C;AAC9C,uCAAqD;AACrD,mDAA6B;AAC7B,uCAA2D;AAG3D,4FAAqF;AAErF,iDAA2C;AAC3C,+CAAyC;AAEzC;;;;;GAKG;AACH,SAAgB,iBAAiB,CAChC,gBAAkC,EAClC,eAA+B,EAC/B,MAAc;;IAEd,MAAM,SAAS,GAA0B,gBAAgB,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IACpF,MAAM,iBAAiB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BAC/B,OAAO,EAAE;4BACR,IAAI;4BACJ,IAAI,EAAE,KAAK,CAAC,IAAI;yBAChB;qBACD,CAAC;yBACD,IAAI,EAAE;oBACR,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,OAAO,CAAC;iBACnD,CAAC;YACH,CAAC,CAAC;SACF,CAAC;KACF;IAED,OAAO,EAAE,CAAC;AACX,CAAC;AAhDD,8CAgDC"}
@@ -0,0 +1,6 @@
1
+ import { ClassDeclaration, ObjectLiteralExpression } from 'ts-morph';
2
+ /**
3
+ *
4
+ * @param objectExpression
5
+ */
6
+ export declare function getDemoClassDeclarations(objectExpression: ObjectLiteralExpression): ClassDeclaration[];
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDemoClassDeclarations = void 0;
4
+ const core_1 = require("@ng-doc/core");
5
+ const ts_morph_1 = require("ts-morph");
6
+ /**
7
+ *
8
+ * @param objectExpression
9
+ */
10
+ function getDemoClassDeclarations(objectExpression) {
11
+ const demoProperty = objectExpression.getProperty('demo');
12
+ if (demoProperty &&
13
+ (ts_morph_1.Node.isPropertyAssignment(demoProperty) || ts_morph_1.Node.isShorthandPropertyAssignment(demoProperty))) {
14
+ const initializer = demoProperty.getInitializer();
15
+ if (initializer && initializer instanceof ts_morph_1.ObjectLiteralExpression) {
16
+ return initializer
17
+ .getProperties()
18
+ .map((property) => { var _a; return (_a = property.getType().getSymbol()) === null || _a === void 0 ? void 0 : _a.getValueDeclaration(); })
19
+ .filter(core_1.isPresent)
20
+ .filter(ts_morph_1.Node.isClassDeclaration);
21
+ }
22
+ }
23
+ return [];
24
+ }
25
+ exports.getDemoClassDeclarations = getDemoClassDeclarations;
26
+ //# sourceMappingURL=get-demo-class-declarations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-demo-class-declarations.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/get-demo-class-declarations.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,uCAA+G;AAE/G;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,gBAAyC;IACjF,MAAM,YAAY,GAAyC,gBAAgB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAEhG,IACC,YAAY;QACZ,CAAC,eAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,IAAI,eAAI,CAAC,6BAA6B,CAAC,YAAY,CAAC,CAAC,EAC5F;QACD,MAAM,WAAW,GAA2B,YAAY,CAAC,cAAc,EAAE,CAAC;QAE1E,IAAI,WAAW,IAAI,WAAW,YAAY,kCAAuB,EAAE;YAClE,OAAO,WAAW;iBAChB,aAAa,EAAE;iBACf,GAAG,CAAC,CAAC,QAAkC,EAAE,EAAE,WAAC,OAAA,MAAA,QAAQ,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,0CAAE,mBAAmB,EAAE,CAAA,EAAA,CAAC;iBAClG,MAAM,CAAC,gBAAS,CAAC;iBACjB,MAAM,CAAC,eAAI,CAAC,kBAAkB,CAAC,CAAC;SAClC;KACD;IAED,OAAO,EAAE,CAAC;AACX,CAAC;AAnBD,4DAmBC"}
@@ -21,9 +21,6 @@ function getEntityConstructor(path) {
21
21
  else if ((0, minimatch_1.default)(path, engine_1.API_PATTERN)) {
22
22
  return engine_1.NgDocApiEntity;
23
23
  }
24
- else if ((0, minimatch_1.default)(path, engine_1.PLAYGROUND_PATTERN)) {
25
- return engine_1.NgDocPlaygroundEntity;
26
- }
27
24
  else {
28
25
  throw new Error(`Unknown entity type for path: ${path}`);
29
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get-entity-constructor.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/get-entity-constructor.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAGlC,sCAWmB;AAGnB;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,IAAY;IAChD,IAAI,IAAA,mBAAS,EAAC,IAAI,EAAE,qBAAY,CAAC,EAAE;QAClC,OAAO,wBAAe,CAAC;KACvB;SAAM,IAAI,IAAA,mBAAS,EAAC,IAAI,EAAE,yBAAgB,CAAC,EAAE;QAC7C,OAAO,4BAAmB,CAAC;KAC3B;SAAM,IAAI,IAAA,mBAAS,EAAC,IAAI,EAAE,gCAAuB,CAAC,EAAE;QACpD,OAAO,gCAAuB,CAAC;KAC/B;SAAM,IAAI,IAAA,mBAAS,EAAC,IAAI,EAAE,oBAAW,CAAC,EAAE;QACxC,OAAO,uBAAc,CAAC;KACtB;SAAM,IAAI,IAAA,mBAAS,EAAC,IAAI,EAAE,2BAAkB,CAAC,EAAE;QAC/C,OAAO,8BAAqB,CAAC;KAC7B;SAAM;QACN,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,EAAE,CAAC,CAAC;KACzD;AACF,CAAC;AAdD,oDAcC"}
1
+ {"version":3,"file":"get-entity-constructor.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/get-entity-constructor.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAGlC,sCASmB;AAGnB;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,IAAY;IAChD,IAAI,IAAA,mBAAS,EAAC,IAAI,EAAE,qBAAY,CAAC,EAAE;QAClC,OAAO,wBAAe,CAAC;KACvB;SAAM,IAAI,IAAA,mBAAS,EAAC,IAAI,EAAE,yBAAgB,CAAC,EAAE;QAC7C,OAAO,4BAAmB,CAAC;KAC3B;SAAM,IAAI,IAAA,mBAAS,EAAC,IAAI,EAAE,gCAAuB,CAAC,EAAE;QACpD,OAAO,gCAAuB,CAAC;KAC/B;SAAM,IAAI,IAAA,mBAAS,EAAC,IAAI,EAAE,oBAAW,CAAC,EAAE;QACxC,OAAO,uBAAc,CAAC;KACtB;SAAM;QACN,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,EAAE,CAAC,CAAC;KACzD;AACF,CAAC;AAZD,oDAYC"}
@@ -0,0 +1,7 @@
1
+ import { ObjectLiteralExpression } from 'ts-morph';
2
+ /**
3
+ *
4
+ * @param expression
5
+ * @param playgroundId
6
+ */
7
+ export declare function getPlaygroundById(expression: ObjectLiteralExpression, playgroundId: string): ObjectLiteralExpression | undefined;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPlaygroundById = void 0;
4
+ const ts_morph_1 = require("ts-morph");
5
+ /**
6
+ *
7
+ * @param expression
8
+ * @param playgroundId
9
+ */
10
+ function getPlaygroundById(expression, playgroundId) {
11
+ const playgroundExpression = expression.getProperty(playgroundId);
12
+ if (ts_morph_1.Node.isPropertyAssignment(playgroundExpression)) {
13
+ const playgroundInitializer = playgroundExpression.getInitializer();
14
+ if (ts_morph_1.Node.isObjectLiteralExpression(playgroundInitializer)) {
15
+ return playgroundInitializer;
16
+ }
17
+ }
18
+ return undefined;
19
+ }
20
+ exports.getPlaygroundById = getPlaygroundById;
21
+ //# sourceMappingURL=get-playground-by-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-playground-by-id.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/get-playground-by-id.ts"],"names":[],"mappings":";;;AAAA,uCAA6F;AAE7F;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,UAAmC,EAAE,YAAoB;IAC1F,MAAM,oBAAoB,GAAyC,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAExG,IAAI,eAAI,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,EAAE;QACpD,MAAM,qBAAqB,GAA2B,oBAAoB,CAAC,cAAc,EAAE,CAAC;QAE5F,IAAI,eAAI,CAAC,yBAAyB,CAAC,qBAAqB,CAAC,EAAE;YAC1D,OAAO,qBAAqB,CAAC;SAC7B;KACD;IAED,OAAO,SAAS,CAAA;AACjB,CAAC;AAZD,8CAYC"}
@@ -0,0 +1,25 @@
1
+ import { NgDocPlaygroundProperties } from '@ng-doc/core';
2
+ import { ClassDeclaration, ObjectLiteralExpression } from 'ts-morph';
3
+ /**
4
+ *
5
+ * @param expression
6
+ * @param playgroundId
7
+ */
8
+ export declare function getTargetForPlayground(expression: ObjectLiteralExpression, playgroundId: string): ClassDeclaration | undefined;
9
+ /**
10
+ *
11
+ * @param expression
12
+ * @param playgroundId
13
+ */
14
+ export declare function getTemplateForPlayground(expression: ObjectLiteralExpression, playgroundId: string): string;
15
+ /**
16
+ *
17
+ * @param expression
18
+ * @param playgroundId
19
+ */
20
+ export declare function getContentForPlayground(expression: ObjectLiteralExpression, playgroundId: string): Record<string, string>;
21
+ /**
22
+ *
23
+ * @param declaration
24
+ */
25
+ export declare function getPlaygroundClassProperties(declaration: ClassDeclaration): NgDocPlaygroundProperties;
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPlaygroundClassProperties = exports.getContentForPlayground = exports.getTemplateForPlayground = exports.getTargetForPlayground = void 0;
4
+ const ts_morph_1 = require("ts-morph");
5
+ const get_playground_by_id_1 = require("./get-playground-by-id");
6
+ const typescript_1 = require("./typescript");
7
+ /**
8
+ *
9
+ * @param expression
10
+ * @param playgroundId
11
+ */
12
+ function getTargetForPlayground(expression, playgroundId) {
13
+ var _a, _b;
14
+ const playground = (0, get_playground_by_id_1.getPlaygroundById)(expression, playgroundId);
15
+ if (playground) {
16
+ const target = playground.getProperty('target');
17
+ if (ts_morph_1.Node.isPropertyAssignment(target)) {
18
+ const targetInitializer = target.getInitializer();
19
+ if (ts_morph_1.Node.isIdentifier(targetInitializer)) {
20
+ const declaration = (_b = (_a = targetInitializer.getType()) === null || _a === void 0 ? void 0 : _a.getSymbol()) === null || _b === void 0 ? void 0 : _b.getDeclarations()[0];
21
+ if (ts_morph_1.Node.isClassDeclaration(declaration)) {
22
+ return declaration;
23
+ }
24
+ }
25
+ }
26
+ }
27
+ return undefined;
28
+ }
29
+ exports.getTargetForPlayground = getTargetForPlayground;
30
+ /**
31
+ *
32
+ * @param expression
33
+ * @param playgroundId
34
+ */
35
+ function getTemplateForPlayground(expression, playgroundId) {
36
+ const playground = (0, get_playground_by_id_1.getPlaygroundById)(expression, playgroundId);
37
+ if (playground) {
38
+ const template = playground.getProperty('template');
39
+ if (ts_morph_1.Node.isPropertyAssignment(template)) {
40
+ const templateInitializer = template.getInitializer();
41
+ if (ts_morph_1.Node.isStringLiteral(templateInitializer) ||
42
+ ts_morph_1.Node.isNoSubstitutionTemplateLiteral(templateInitializer)) {
43
+ return templateInitializer.getLiteralValue();
44
+ }
45
+ }
46
+ }
47
+ return '';
48
+ }
49
+ exports.getTemplateForPlayground = getTemplateForPlayground;
50
+ /**
51
+ *
52
+ * @param expression
53
+ * @param playgroundId
54
+ */
55
+ function getContentForPlayground(expression, playgroundId) {
56
+ const playground = (0, get_playground_by_id_1.getPlaygroundById)(expression, playgroundId);
57
+ if (playground) {
58
+ const content = playground.getProperty('content');
59
+ if (ts_morph_1.Node.isPropertyAssignment(content)) {
60
+ const contentInitializer = content.getInitializer();
61
+ if (ts_morph_1.Node.isObjectLiteralExpression(contentInitializer)) {
62
+ return contentInitializer
63
+ .getProperties()
64
+ .reduce((content, property) => {
65
+ if (ts_morph_1.Node.isPropertyAssignment(property)) {
66
+ const initializer = property.getInitializer();
67
+ if (ts_morph_1.Node.isObjectLiteralExpression(initializer)) {
68
+ const templateProperty = initializer.getProperty('template');
69
+ if (ts_morph_1.Node.isPropertyAssignment(templateProperty)) {
70
+ const templateInitializer = templateProperty.getInitializer();
71
+ if (ts_morph_1.Node.isStringLiteral(templateInitializer) ||
72
+ ts_morph_1.Node.isNoSubstitutionTemplateLiteral(templateInitializer)) {
73
+ content[property.getName()] = templateInitializer.getLiteralValue();
74
+ }
75
+ }
76
+ }
77
+ }
78
+ return content;
79
+ }, {});
80
+ }
81
+ }
82
+ }
83
+ return {};
84
+ }
85
+ exports.getContentForPlayground = getContentForPlayground;
86
+ /**
87
+ *
88
+ * @param declaration
89
+ */
90
+ function getPlaygroundClassProperties(declaration) {
91
+ return declaration
92
+ .getProperties()
93
+ .filter((property) => !!property.getDecorator('Input'))
94
+ .reduce((properties, property) => {
95
+ var _a, _b, _c, _d;
96
+ const inputName = (_c = (_b = (_a = property
97
+ .getDecorator('Input')) === null || _a === void 0 ? void 0 : _a.getArguments()[0]) === null || _b === void 0 ? void 0 : _b.getText().replace(/^["']|['"]$/g, '')) !== null && _c !== void 0 ? _c : property.getName();
98
+ properties[property.getName()] = {
99
+ name: inputName,
100
+ type: (0, typescript_1.displayType)(property.getType()),
101
+ default: (_d = property.getInitializer()) === null || _d === void 0 ? void 0 : _d.getText(),
102
+ description: property
103
+ .getJsDocs()
104
+ .reduce((comment, doc) => `${comment}\n${doc.getCommentText()}`.trim(), ''),
105
+ options: property
106
+ .getType()
107
+ .getUnionTypes()
108
+ .map((type) => (0, typescript_1.displayType)(type)),
109
+ };
110
+ return properties;
111
+ }, {});
112
+ }
113
+ exports.getPlaygroundClassProperties = getPlaygroundClassProperties;
114
+ //# sourceMappingURL=get-playground-properties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-playground-properties.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/get-playground-properties.ts"],"names":[],"mappings":";;;AACA,uCASkB;AAElB,iEAAyD;AACzD,6CAAyC;AAEzC;;;;GAIG;AACH,SAAgB,sBAAsB,CACrC,UAAmC,EACnC,YAAoB;;IAEpB,MAAM,UAAU,GAAwC,IAAA,wCAAiB,EAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAEpG,IAAI,UAAU,EAAE;QACf,MAAM,MAAM,GAAyC,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAEtF,IAAI,eAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE;YACtC,MAAM,iBAAiB,GAA2B,MAAM,CAAC,cAAc,EAAE,CAAC;YAE1E,IAAI,eAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,EAAE;gBACzC,MAAM,WAAW,GAAqB,MAAA,MAAA,iBAAiB,CAAC,OAAO,EA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AAC,OAAO,EAAE,CAAC,GAAG;YAChC,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,IAAA,wBAAW,EAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACrC,OAAO,EAAE,MAAA,QAAQ,CAAC,cAAc,EAAE,0CAAE,OAAO,EAAE;YAC7C,WAAW,EAAE,QAAQ;iBACnB,SAAS,EAAE;iBACX,MAAM,CAAC,CAAC,OAAe,EAAE,GAAU,EAAE,EAAE,CAAC,GAAG,OAAO,KAAK,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC;YAC3F,OAAO,EAAE,QAAQ;iBACf,OAAO,EAAE;iBACT,aAAa,EAAE;iBACf,GAAG,CAAC,CAAC,IAAU,EAAE,EAAE,CAAC,IAAA,wBAAW,EAAC,IAAI,CAAC,CAAC;SACxC,CAAC;QAEF,OAAO,UAAU,CAAC;IACnB,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AA3BD,oEA2BC"}
@@ -2,7 +2,6 @@ export * from './build-assets';
2
2
  export * from './code-type-from-ext';
3
3
  export * from './create-builder-context';
4
4
  export * from './declaration-folder-name';
5
- export * from './declaration-to-playground';
6
5
  export * from './emit-built-output';
7
6
  export * from './entity-type';
8
7
  export * from './extract-docs';
@@ -12,10 +11,14 @@ export * from './filter-useless-members';
12
11
  export * from './find-closest-file';
13
12
  export * from './format-code';
14
13
  export * from './generate-api-entities';
14
+ export * from './get-component-asset';
15
15
  export * from './get-declaration-type';
16
+ export * from './get-demo-class-declarations';
16
17
  export * from './get-entity-constructor';
17
18
  export * from './get-keyword-type-from-entity';
18
19
  export * from './get-kind-type';
20
+ export * from './get-playground-by-id';
21
+ export * from './get-playground-properties';
19
22
  export * from './is-not-excluded-path';
20
23
  export * from './is-supported-declaration';
21
24
  export * from './marked';
package/helpers/index.js CHANGED
@@ -5,7 +5,6 @@ tslib_1.__exportStar(require("./build-assets"), exports);
5
5
  tslib_1.__exportStar(require("./code-type-from-ext"), exports);
6
6
  tslib_1.__exportStar(require("./create-builder-context"), exports);
7
7
  tslib_1.__exportStar(require("./declaration-folder-name"), exports);
8
- tslib_1.__exportStar(require("./declaration-to-playground"), exports);
9
8
  tslib_1.__exportStar(require("./emit-built-output"), exports);
10
9
  tslib_1.__exportStar(require("./entity-type"), exports);
11
10
  tslib_1.__exportStar(require("./extract-docs"), exports);
@@ -15,10 +14,14 @@ tslib_1.__exportStar(require("./filter-useless-members"), exports);
15
14
  tslib_1.__exportStar(require("./find-closest-file"), exports);
16
15
  tslib_1.__exportStar(require("./format-code"), exports);
17
16
  tslib_1.__exportStar(require("./generate-api-entities"), exports);
17
+ tslib_1.__exportStar(require("./get-component-asset"), exports);
18
18
  tslib_1.__exportStar(require("./get-declaration-type"), exports);
19
+ tslib_1.__exportStar(require("./get-demo-class-declarations"), exports);
19
20
  tslib_1.__exportStar(require("./get-entity-constructor"), exports);
20
21
  tslib_1.__exportStar(require("./get-keyword-type-from-entity"), exports);
21
22
  tslib_1.__exportStar(require("./get-kind-type"), exports);
23
+ tslib_1.__exportStar(require("./get-playground-by-id"), exports);
24
+ tslib_1.__exportStar(require("./get-playground-properties"), exports);
22
25
  tslib_1.__exportStar(require("./is-not-excluded-path"), exports);
23
26
  tslib_1.__exportStar(require("./is-supported-declaration"), exports);
24
27
  tslib_1.__exportStar(require("./marked"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,+DAAqC;AACrC,mEAAyC;AACzC,oEAA0C;AAC1C,sEAA4C;AAC5C,8DAAoC;AACpC,wDAA8B;AAC9B,yDAA+B;AAC/B,gEAAsC;AACtC,8DAAoC;AACpC,mEAAyC;AACzC,8DAAoC;AACpC,wDAA8B;AAC9B,kEAAwC;AACxC,iEAAuC;AACvC,mEAAyC;AACzC,yEAA+C;AAC/C,0DAAgC;AAChC,iEAAuC;AACvC,qEAA2C;AAC3C,mDAAyB;AACzB,qDAA2B;AAC3B,2DAAiC;AACjC,6DAAmC;AACnC,yDAA+B;AAC/B,0DAAgC;AAChC,6DAAmC;AACnC,sDAA4B;AAC5B,kDAAwB;AACxB,uDAA6B;AAC7B,wDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,+DAAqC;AACrC,mEAAyC;AACzC,oEAA0C;AAC1C,8DAAoC;AACpC,wDAA8B;AAC9B,yDAA+B;AAC/B,gEAAsC;AACtC,8DAAoC;AACpC,mEAAyC;AACzC,8DAAoC;AACpC,wDAA8B;AAC9B,kEAAwC;AACxC,gEAAsC;AACtC,iEAAuC;AACvC,wEAA8C;AAC9C,mEAAyC;AACzC,yEAA+C;AAC/C,0DAAgC;AAChC,iEAAuC;AACvC,sEAA4C;AAC5C,iEAAuC;AACvC,qEAA2C;AAC3C,mDAAyB;AACzB,qDAA2B;AAC3B,2DAAiC;AACjC,6DAAmC;AACnC,yDAA+B;AAC/B,0DAAgC;AAChC,6DAAmC;AACnC,sDAA4B;AAC5B,kDAAwB;AACxB,uDAA6B;AAC7B,wDAA8B"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@ng-doc/builder",
3
- "version": "15.1.1",
3
+ "version": "15.3.1",
4
4
  "type": "commonjs",
5
5
  "builders": "./builders.json",
6
6
  "schematics": "./schematics/collection.json",
7
7
  "dependencies": {
8
- "@ng-doc/core": "15.1.1",
8
+ "@ng-doc/core": "15.3.1",
9
9
  "@angular-devkit/architect": ">=0.1500.0",
10
10
  "chokidar": "^3.5.3",
11
11
  "minimatch": "^5.1.0",
@@ -24,6 +24,7 @@
24
24
  "rehype-slug": "^4.0.0",
25
25
  "highlight.js": "^11.5.1",
26
26
  "raw-loader": "^4.0.2",
27
+ "esbuild": "^0.17.8",
27
28
  "@microsoft/tsdoc": "^0.14.2"
28
29
  },
29
30
  "publishConfig": {
@@ -3,9 +3,11 @@ import {Component, NgModule, Type, ChangeDetectionStrategy} from '@angular/core'
3
3
  import {RouterModule} from '@angular/router';
4
4
  import {CommonModule} from '@angular/common';
5
5
  import {NgDocPageModule, NgDocRootPage, NgDocDemoAssets} from '@ng-doc/app';
6
+ import {NgDocDependencies} from '@ng-doc/core';
6
7
  import pageContent from '!!raw-loader!{{ page.builtPagePath }}';
7
8
  {%- if page.pageDependencies %}
8
9
  // noinspection ES6UnusedImports
10
+ import {PlaygroundsModule} from './playgrounds';
9
11
  import pageDependencies from '{{ page.pageDependencies.importPath }}';
10
12
  {%- endif %}
11
13
  {%- if page.componentsAssets %}
@@ -20,17 +22,20 @@ import demoAssets from '{{ page.componentsAssets }}';
20
22
  providers: [{provide: NgDocRootPage, useExisting: DynamicComponent}],
21
23
  })
22
24
  export class DynamicComponent extends NgDocRootPage {
25
+ readonly pageContent: string = pageContent;
26
+
23
27
  {%- if page.editSourceFileUrl %}
24
28
  readonly editSourceFileUrl: string = '{{ page.editSourceFileUrl }}';
25
29
  {%- endif %}
30
+
26
31
  {%- if page.viewSourceFileUrl %}
27
32
  readonly viewSourceFileUrl: string = '{{ page.viewSourceFileUrl }}';
28
33
  {%- endif %}
29
- readonly pageContent: string = pageContent;
34
+
30
35
  {%- if page.pageDependencies %}
31
- readonly demo: Record<string, Type<unknown>> | undefined = pageDependencies.demo;
32
- readonly module: Type<unknown> | undefined = pageDependencies.module;
36
+ readonly dependencies?: NgDocDependencies = pageDependencies;
33
37
  {%- endif %}
38
+
34
39
  {%- if page.componentsAssets %}
35
40
  readonly demoAssets: NgDocDemoAssets = demoAssets;
36
41
  {%- endif %}
@@ -47,6 +52,7 @@ export class DynamicComponent extends NgDocRootPage {
47
52
  NgDocPageModule,
48
53
  {%- if page.pageDependencies %}
49
54
  pageDependencies.module,
55
+ PlaygroundsModule,
50
56
  {%- endif %}
51
57
  RouterModule.forChild([{
52
58
  path: '',
@@ -0,0 +1,70 @@
1
+ // @ts-nocheck
2
+ import {NgModule, Component, ViewChild, Type, ViewContainerRef} from '@angular/core';
3
+ import {NgDocBasePlayground, providePlaygroundDemo} from '@ng-doc/app';
4
+ // noinspection ES6UnusedImports
5
+ import pageDependencies from '{{ dependencies.importPath }}'; import {CommonModule} from '@angular/common';
6
+
7
+ {% set components = [] -%}
8
+ {%- set index = 1 %}
9
+
10
+ {%- for id in dependencies.playgroundIds -%}
11
+ {%- set playgrounds = dependencies.getPlaygroundsExpression() %}
12
+ {%- set target = playgrounds | getTargetForPlayground(id) %}
13
+ {%- set template = playgrounds | getTemplateForPlayground(id) %}
14
+ {%- set content = playgrounds | getContentForPlayground(id) %}
15
+
16
+ {%- if target %}
17
+ {%- set selectors = target | extractSelectors %}
18
+
19
+ {%- for selector in selectors %}
20
+ {%- set comp = {id: id, name: 'PlaygroundComponent' + index, selector: selector } %}
21
+ {%- set components = (components.push(comp), components) %}
22
+
23
+ @Component({
24
+ template: `
25
+ {{template | buildPlaygroundDemoTemplate(selector, content) }}
26
+ `,
27
+ })
28
+ export class {{ comp.name }} extends NgDocBasePlayground {
29
+ static readonly selector: string = '{{ comp.selector }}';
30
+
31
+ @ViewChild(pageDependencies.playgrounds['{{ id }}'].target, {static: true})
32
+ readonly playground?: Type<unknown>;
33
+
34
+ @ViewChild(pageDependencies.playgrounds['{{ id }}'].target, {static: true, read: ViewContainerRef})
35
+ readonly viewContainerRef: ViewContainerRef;
36
+
37
+ data: any = pageDependencies.playgrounds['{{ id }}'].data;
38
+
39
+ constructor() {
40
+ super();
41
+ }
42
+ }
43
+ {%- set index = index + 1 -%}
44
+ {%- endfor %}
45
+ {%- endif %}
46
+ {%- endfor %}
47
+
48
+ @NgModule({
49
+ imports: [
50
+ CommonModule,
51
+ pageDependencies.module,
52
+ ],
53
+ declarations: [
54
+ {%- for comp in components %}
55
+ {{ comp.name }},
56
+ {%- endfor %}
57
+ ],
58
+ providers: [
59
+ {%- for comp in components %}
60
+ providePlaygroundDemo('{{ comp.id }}', {{ comp.name }}),
61
+ {%- endfor %}
62
+ ],
63
+ exports: [
64
+ {%- for comp in components %}
65
+ {{ comp.name }},
66
+ {%- endfor %}
67
+ ],
68
+ })
69
+ export class PlaygroundsModule {
70
+ }
@@ -0,0 +1,2 @@
1
+ import { NgDocAsset } from '../interfaces';
2
+ export declare type NgDocComponentAsset = Record<string, NgDocAsset[]>;