schema.d.ts 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /**
  2. * Creates a new Angular component. Components are the basic building blocks of Angular
  3. * applications. Each component consists of a TypeScript class, an HTML template, and an
  4. * optional CSS stylesheet. Use this schematic to generate a new component in your project.
  5. */
  6. export type Schema = {
  7. /**
  8. * Configures the change detection strategy for the component.
  9. */
  10. changeDetection?: ChangeDetection;
  11. /**
  12. * Adds `:host { display: block; }` to the component's stylesheet, ensuring the component
  13. * renders as a block-level element. This is useful for layout purposes.
  14. */
  15. displayBlock?: boolean;
  16. /**
  17. * Automatically export the component from the specified NgModule, making it accessible to
  18. * other modules in the application.
  19. */
  20. export?: boolean;
  21. /**
  22. * Use a default export for the component in its TypeScript file instead of a named export.
  23. */
  24. exportDefault?: boolean;
  25. /**
  26. * Create the component files directly in the project's `src/app` directory instead of
  27. * creating a new folder for them.
  28. */
  29. flat?: boolean;
  30. /**
  31. * Include the component's styles directly in the `component.ts` file. By default, a
  32. * separate stylesheet file (e.g., `my-component.component.css`) is created.
  33. */
  34. inlineStyle?: boolean;
  35. /**
  36. * Include the component's HTML template directly in the `component.ts` file. By default, a
  37. * separate template file (e.g., `my-component.component.html`) is created.
  38. */
  39. inlineTemplate?: boolean;
  40. /**
  41. * Specify the NgModule where the component should be declared. If not provided, the CLI
  42. * will attempt to find the closest NgModule in the component's path.
  43. */
  44. module?: string;
  45. /**
  46. * The name for the new component. This will be used to create the component's class,
  47. * template, and stylesheet files. For example, if you provide `my-component`, the files
  48. * will be named `my-component.component.ts`, `my-component.component.html`, and
  49. * `my-component.component.css`.
  50. */
  51. name: string;
  52. /**
  53. * The path where the component files should be created, relative to the current workspace.
  54. * If not provided, a folder with the same name as the component will be created in the
  55. * project's `src/app` directory.
  56. */
  57. path?: string;
  58. /**
  59. * A prefix to be added to the component's selector. For example, if the prefix is `app` and
  60. * the component name is `my-component`, the selector will be `app-my-component`.
  61. */
  62. prefix?: string;
  63. /**
  64. * The name of the project where the component should be added. If not specified, the CLI
  65. * will determine the project from the current directory.
  66. */
  67. project: string;
  68. /**
  69. * The HTML selector to use for this component. If not provided, a selector will be
  70. * generated based on the component name (e.g., `app-my-component`).
  71. */
  72. selector?: string;
  73. /**
  74. * Do not automatically import the new component into its closest NgModule.
  75. */
  76. skipImport?: boolean;
  77. /**
  78. * Skip the generation of an HTML selector for the component.
  79. */
  80. skipSelector?: boolean;
  81. /**
  82. * Skip the generation of unit test files `spec.ts`.
  83. */
  84. skipTests?: boolean;
  85. /**
  86. * Generate a standalone component. Standalone components are self-contained and don't need
  87. * to be declared in an NgModule. They can be used independently or imported directly into
  88. * other standalone components.
  89. */
  90. standalone?: boolean;
  91. /**
  92. * Specify the type of stylesheet to be created for the component, or `none` to skip
  93. * creating a stylesheet.
  94. */
  95. style?: Style;
  96. /**
  97. * Append a custom type to the component's filename. For example, if you set the type to
  98. * `container`, the file will be named `my-component.container.ts`.
  99. */
  100. type?: string;
  101. /**
  102. * Sets the view encapsulation mode for the component. This determines how the component's
  103. * styles are scoped and applied.
  104. */
  105. viewEncapsulation?: ViewEncapsulation;
  106. };
  107. /**
  108. * Configures the change detection strategy for the component.
  109. */
  110. export declare enum ChangeDetection {
  111. Default = "Default",
  112. OnPush = "OnPush"
  113. }
  114. /**
  115. * Specify the type of stylesheet to be created for the component, or `none` to skip
  116. * creating a stylesheet.
  117. */
  118. export declare enum Style {
  119. Css = "css",
  120. Less = "less",
  121. None = "none",
  122. Sass = "sass",
  123. Scss = "scss"
  124. }
  125. /**
  126. * Sets the view encapsulation mode for the component. This determines how the component's
  127. * styles are scoped and applied.
  128. */
  129. export declare enum ViewEncapsulation {
  130. Emulated = "Emulated",
  131. None = "None",
  132. ShadowDom = "ShadowDom"
  133. }