@spartan-ng/cli 0.0.1-alpha.323

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 (282) hide show
  1. package/README.md +11 -0
  2. package/executors.json +3 -0
  3. package/generators.json +26 -0
  4. package/package.json +22 -0
  5. package/src/generators/base/generator.d.ts +4 -0
  6. package/src/generators/base/generator.js +36 -0
  7. package/src/generators/base/generator.js.map +1 -0
  8. package/src/generators/base/lib/build-dependency-array.d.ts +7 -0
  9. package/src/generators/base/lib/build-dependency-array.js +53 -0
  10. package/src/generators/base/lib/build-dependency-array.js.map +1 -0
  11. package/src/generators/base/lib/get-target-library-directory.d.ts +3 -0
  12. package/src/generators/base/lib/get-target-library-directory.js +12 -0
  13. package/src/generators/base/lib/get-target-library-directory.js.map +1 -0
  14. package/src/generators/base/lib/initialize-angular-library.d.ts +3 -0
  15. package/src/generators/base/lib/initialize-angular-library.js +25 -0
  16. package/src/generators/base/lib/initialize-angular-library.js.map +1 -0
  17. package/src/generators/base/schema.d.ts +11 -0
  18. package/src/generators/base/schema.json +17 -0
  19. package/src/generators/base/versions.d.ts +23 -0
  20. package/src/generators/base/versions.js +31 -0
  21. package/src/generators/base/versions.js.map +1 -0
  22. package/src/generators/theme/compat.d.ts +2 -0
  23. package/src/generators/theme/compat.js +6 -0
  24. package/src/generators/theme/compat.js.map +1 -0
  25. package/src/generators/theme/generator.d.ts +2 -0
  26. package/src/generators/theme/generator.js +59 -0
  27. package/src/generators/theme/generator.js.map +1 -0
  28. package/src/generators/theme/libs/add-theme-to-application-styles.d.ts +11 -0
  29. package/src/generators/theme/libs/add-theme-to-application-styles.js +65 -0
  30. package/src/generators/theme/libs/add-theme-to-application-styles.js.map +1 -0
  31. package/src/generators/theme/libs/supported-theme-generator-map.d.ts +17 -0
  32. package/src/generators/theme/libs/supported-theme-generator-map.js +560 -0
  33. package/src/generators/theme/libs/supported-theme-generator-map.js.map +1 -0
  34. package/src/generators/theme/schema.json +7 -0
  35. package/src/generators/ui/compat.d.ts +5 -0
  36. package/src/generators/ui/compat.js +7 -0
  37. package/src/generators/ui/compat.js.map +1 -0
  38. package/src/generators/ui/generator.d.ts +5 -0
  39. package/src/generators/ui/generator.js +123 -0
  40. package/src/generators/ui/generator.js.map +1 -0
  41. package/src/generators/ui/libs/ui-accordion-helm/files/index.ts.template +27 -0
  42. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-content.directive.ts.template +85 -0
  43. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-icon.component.ts.template +28 -0
  44. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-item.directive.ts.template +23 -0
  45. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion-trigger.directive.ts.template +39 -0
  46. package/src/generators/ui/libs/ui-accordion-helm/files/lib/hlm-accordion.directive.ts.template +23 -0
  47. package/src/generators/ui/libs/ui-accordion-helm/generator.d.ts +3 -0
  48. package/src/generators/ui/libs/ui-accordion-helm/generator.js +12 -0
  49. package/src/generators/ui/libs/ui-accordion-helm/generator.js.map +1 -0
  50. package/src/generators/ui/libs/ui-alert-dialog-helm/files/index.ts.template +39 -0
  51. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-action-button.directive.ts.template +9 -0
  52. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-cancel-button.directive.ts.template +31 -0
  53. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-close.directive.ts.template +26 -0
  54. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-content.directive.ts.template +35 -0
  55. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-description.directive.ts.template +23 -0
  56. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-footer.component.ts.template +26 -0
  57. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-header.component.ts.template +26 -0
  58. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-overlay.directive.ts.template +33 -0
  59. package/src/generators/ui/libs/ui-alert-dialog-helm/files/lib/hlm-alert-dialog-title.directive.ts.template +23 -0
  60. package/src/generators/ui/libs/ui-alert-dialog-helm/generator.d.ts +3 -0
  61. package/src/generators/ui/libs/ui-alert-dialog-helm/generator.js +12 -0
  62. package/src/generators/ui/libs/ui-alert-dialog-helm/generator.js.map +1 -0
  63. package/src/generators/ui/libs/ui-alert-helm/files/index.ts.template +24 -0
  64. package/src/generators/ui/libs/ui-alert-helm/files/lib/hlm-alert-description.directive.ts.template +29 -0
  65. package/src/generators/ui/libs/ui-alert-helm/files/lib/hlm-alert-icon.directive.ts.template +15 -0
  66. package/src/generators/ui/libs/ui-alert-helm/files/lib/hlm-alert-title.directive.ts.template +29 -0
  67. package/src/generators/ui/libs/ui-alert-helm/files/lib/hlm-alert.directive.ts.template +48 -0
  68. package/src/generators/ui/libs/ui-alert-helm/generator.d.ts +3 -0
  69. package/src/generators/ui/libs/ui-alert-helm/generator.js +12 -0
  70. package/src/generators/ui/libs/ui-alert-helm/generator.js.map +1 -0
  71. package/src/generators/ui/libs/ui-aspect-ratio-helm/files/index.ts.template +10 -0
  72. package/src/generators/ui/libs/ui-aspect-ratio-helm/files/lib/helm-aspect-ratio.directive.spec.ts.template +73 -0
  73. package/src/generators/ui/libs/ui-aspect-ratio-helm/files/lib/helm-aspect-ratio.directive.ts.template +53 -0
  74. package/src/generators/ui/libs/ui-aspect-ratio-helm/generator.d.ts +3 -0
  75. package/src/generators/ui/libs/ui-aspect-ratio-helm/generator.js +12 -0
  76. package/src/generators/ui/libs/ui-aspect-ratio-helm/generator.js.map +1 -0
  77. package/src/generators/ui/libs/ui-avatar-helm/files/index.ts.template +17 -0
  78. package/src/generators/ui/libs/ui-avatar-helm/files/lib/fallback/hlm-avatar-fallback.directive.spec.ts.template +70 -0
  79. package/src/generators/ui/libs/ui-avatar-helm/files/lib/fallback/hlm-avatar-fallback.directive.ts.template +40 -0
  80. package/src/generators/ui/libs/ui-avatar-helm/files/lib/fallback/index.ts.template +1 -0
  81. package/src/generators/ui/libs/ui-avatar-helm/files/lib/hlm-avatar.component.spec.ts.template +61 -0
  82. package/src/generators/ui/libs/ui-avatar-helm/files/lib/hlm-avatar.component.ts.template +58 -0
  83. package/src/generators/ui/libs/ui-avatar-helm/files/lib/image/hlm-avatar-image.directive.spec.ts.template +44 -0
  84. package/src/generators/ui/libs/ui-avatar-helm/files/lib/image/hlm-avatar-image.directive.ts.template +28 -0
  85. package/src/generators/ui/libs/ui-avatar-helm/files/lib/image/index.ts.template +1 -0
  86. package/src/generators/ui/libs/ui-avatar-helm/generator.d.ts +3 -0
  87. package/src/generators/ui/libs/ui-avatar-helm/generator.js +12 -0
  88. package/src/generators/ui/libs/ui-avatar-helm/generator.js.map +1 -0
  89. package/src/generators/ui/libs/ui-badge-helm/files/index.ts.template +10 -0
  90. package/src/generators/ui/libs/ui-badge-helm/files/lib/hlm-badge.directive.ts.template +73 -0
  91. package/src/generators/ui/libs/ui-badge-helm/generator.d.ts +3 -0
  92. package/src/generators/ui/libs/ui-badge-helm/generator.js +12 -0
  93. package/src/generators/ui/libs/ui-badge-helm/generator.js.map +1 -0
  94. package/src/generators/ui/libs/ui-button-helm/files/.DS_Store.template +0 -0
  95. package/src/generators/ui/libs/ui-button-helm/files/index.ts.template +10 -0
  96. package/src/generators/ui/libs/ui-button-helm/files/lib/hlm-button.directive.ts.template +63 -0
  97. package/src/generators/ui/libs/ui-button-helm/generator.d.ts +3 -0
  98. package/src/generators/ui/libs/ui-button-helm/generator.js +12 -0
  99. package/src/generators/ui/libs/ui-button-helm/generator.js.map +1 -0
  100. package/src/generators/ui/libs/ui-card-helm/files/index.ts.template +30 -0
  101. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-content.directive.ts.template +30 -0
  102. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-description.directive.ts.template +30 -0
  103. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-footer.directive.ts.template +43 -0
  104. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-header.directive.ts.template +43 -0
  105. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card-title.directive.ts.template +30 -0
  106. package/src/generators/ui/libs/ui-card-helm/files/lib/hlm-card.directive.ts.template +33 -0
  107. package/src/generators/ui/libs/ui-card-helm/generator.d.ts +3 -0
  108. package/src/generators/ui/libs/ui-card-helm/generator.js +12 -0
  109. package/src/generators/ui/libs/ui-card-helm/generator.js.map +1 -0
  110. package/src/generators/ui/libs/ui-command-helm/files/index.ts.template +49 -0
  111. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-dialog-close-button.directive.ts.template +30 -0
  112. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-dialog.directive.ts.template +39 -0
  113. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-empty.directive.ts.template +23 -0
  114. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-group.directive.ts.template +28 -0
  115. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-input-wrapper.component.ts.template +27 -0
  116. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-input.directive.ts.template +26 -0
  117. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-item-icon.directive.ts.template +30 -0
  118. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-item.directive.ts.template +33 -0
  119. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-list.directive.ts.template +23 -0
  120. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-loader.directive.ts.template +7 -0
  121. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-separator.directive.ts.template +10 -0
  122. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command-shortcut.component.ts.template +26 -0
  123. package/src/generators/ui/libs/ui-command-helm/files/lib/hlm-command.directive.ts.template +26 -0
  124. package/src/generators/ui/libs/ui-command-helm/generator.d.ts +3 -0
  125. package/src/generators/ui/libs/ui-command-helm/generator.js +12 -0
  126. package/src/generators/ui/libs/ui-command-helm/generator.js.map +1 -0
  127. package/src/generators/ui/libs/ui-dialog-helm/files/.DS_Store.template +0 -0
  128. package/src/generators/ui/libs/ui-dialog-helm/files/index.ts.template +33 -0
  129. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-close.directive.ts.template +26 -0
  130. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-content.directive.ts.template +37 -0
  131. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-description.directive.ts.template +23 -0
  132. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-footer.component.ts.template +26 -0
  133. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-header.component.ts.template +26 -0
  134. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-overlay.directive.ts.template +33 -0
  135. package/src/generators/ui/libs/ui-dialog-helm/files/lib/hlm-dialog-title.directive.ts.template +23 -0
  136. package/src/generators/ui/libs/ui-dialog-helm/generator.d.ts +3 -0
  137. package/src/generators/ui/libs/ui-dialog-helm/generator.js +12 -0
  138. package/src/generators/ui/libs/ui-dialog-helm/generator.js.map +1 -0
  139. package/src/generators/ui/libs/ui-hover-card-helm/files/index.ts.template +12 -0
  140. package/src/generators/ui/libs/ui-hover-card-helm/files/lib/hlm-hover-card-content.directive.ts.template +44 -0
  141. package/src/generators/ui/libs/ui-hover-card-helm/generator.d.ts +3 -0
  142. package/src/generators/ui/libs/ui-hover-card-helm/generator.js +12 -0
  143. package/src/generators/ui/libs/ui-hover-card-helm/generator.js.map +1 -0
  144. package/src/generators/ui/libs/ui-icon-helm/files/index.ts.template +13 -0
  145. package/src/generators/ui/libs/ui-icon-helm/files/lib/hlm-icon.component.spec.ts.template +64 -0
  146. package/src/generators/ui/libs/ui-icon-helm/files/lib/hlm-icon.component.ts.template +96 -0
  147. package/src/generators/ui/libs/ui-icon-helm/generator.d.ts +3 -0
  148. package/src/generators/ui/libs/ui-icon-helm/generator.js +12 -0
  149. package/src/generators/ui/libs/ui-icon-helm/generator.js.map +1 -0
  150. package/src/generators/ui/libs/ui-input-helm/files/index.ts.template +12 -0
  151. package/src/generators/ui/libs/ui-input-helm/files/lib/hlm-input-error.directive.ts.template +30 -0
  152. package/src/generators/ui/libs/ui-input-helm/files/lib/hlm-input.directive.ts.template +57 -0
  153. package/src/generators/ui/libs/ui-input-helm/generator.d.ts +3 -0
  154. package/src/generators/ui/libs/ui-input-helm/generator.js +12 -0
  155. package/src/generators/ui/libs/ui-input-helm/generator.js.map +1 -0
  156. package/src/generators/ui/libs/ui-label-helm/files/index.ts.template +10 -0
  157. package/src/generators/ui/libs/ui-label-helm/files/lib/hlm-label.directive.ts.template +56 -0
  158. package/src/generators/ui/libs/ui-label-helm/generator.d.ts +3 -0
  159. package/src/generators/ui/libs/ui-label-helm/generator.js +12 -0
  160. package/src/generators/ui/libs/ui-label-helm/generator.js.map +1 -0
  161. package/src/generators/ui/libs/ui-menu-helm/files/index.ts.template +62 -0
  162. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-bar-item.directive.ts.template +26 -0
  163. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-bar.directive.ts.template +23 -0
  164. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-check.component.ts.template +30 -0
  165. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-icon.directive.ts.template +30 -0
  166. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-radio.component.ts.template +30 -0
  167. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item-sub-indicator.component.ts.template +30 -0
  168. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-item.directive.ts.template +33 -0
  169. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-label.component.ts.template +32 -0
  170. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-separator.component.ts.template +24 -0
  171. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu-shortcut.component.ts.template +26 -0
  172. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-menu.directive.ts.template +46 -0
  173. package/src/generators/ui/libs/ui-menu-helm/files/lib/hlm-sub-menu.directive.ts.template +26 -0
  174. package/src/generators/ui/libs/ui-menu-helm/generator.d.ts +3 -0
  175. package/src/generators/ui/libs/ui-menu-helm/generator.js +12 -0
  176. package/src/generators/ui/libs/ui-menu-helm/generator.js.map +1 -0
  177. package/src/generators/ui/libs/ui-popover-helm/files/index.ts.template +15 -0
  178. package/src/generators/ui/libs/ui-popover-helm/files/lib/hlm-popover-close.directive.ts.template +26 -0
  179. package/src/generators/ui/libs/ui-popover-helm/files/lib/hlm-popover-content.directive.ts.template +37 -0
  180. package/src/generators/ui/libs/ui-popover-helm/generator.d.ts +3 -0
  181. package/src/generators/ui/libs/ui-popover-helm/generator.js +12 -0
  182. package/src/generators/ui/libs/ui-popover-helm/generator.js.map +1 -0
  183. package/src/generators/ui/libs/ui-progress-helm/files/index.ts.template +15 -0
  184. package/src/generators/ui/libs/ui-progress-helm/files/lib/hlm-progress-indicator.directive.ts.template +44 -0
  185. package/src/generators/ui/libs/ui-progress-helm/files/lib/hlm-progress.directive.ts.template +23 -0
  186. package/src/generators/ui/libs/ui-progress-helm/generator.d.ts +3 -0
  187. package/src/generators/ui/libs/ui-progress-helm/generator.js +12 -0
  188. package/src/generators/ui/libs/ui-progress-helm/generator.js.map +1 -0
  189. package/src/generators/ui/libs/ui-radio-group-helm/files/index.ts.template +17 -0
  190. package/src/generators/ui/libs/ui-radio-group-helm/files/lib/hlm-radio-group.directive.ts.template +23 -0
  191. package/src/generators/ui/libs/ui-radio-group-helm/files/lib/hlm-radio-indicator.component.ts.template +32 -0
  192. package/src/generators/ui/libs/ui-radio-group-helm/files/lib/hlm-radio.directive.ts.template +23 -0
  193. package/src/generators/ui/libs/ui-radio-group-helm/generator.d.ts +3 -0
  194. package/src/generators/ui/libs/ui-radio-group-helm/generator.js +12 -0
  195. package/src/generators/ui/libs/ui-radio-group-helm/generator.js.map +1 -0
  196. package/src/generators/ui/libs/ui-scroll-area-helm/files/index.ts.template +10 -0
  197. package/src/generators/ui/libs/ui-scroll-area-helm/files/lib/hlm-scroll-area.component.ts.template +78 -0
  198. package/src/generators/ui/libs/ui-scroll-area-helm/generator.d.ts +3 -0
  199. package/src/generators/ui/libs/ui-scroll-area-helm/generator.js +12 -0
  200. package/src/generators/ui/libs/ui-scroll-area-helm/generator.js.map +1 -0
  201. package/src/generators/ui/libs/ui-separator-helm/files/index.ts.template +10 -0
  202. package/src/generators/ui/libs/ui-separator-helm/files/lib/hlm-separator.directive.ts.template +34 -0
  203. package/src/generators/ui/libs/ui-separator-helm/generator.d.ts +3 -0
  204. package/src/generators/ui/libs/ui-separator-helm/generator.js +12 -0
  205. package/src/generators/ui/libs/ui-separator-helm/generator.js.map +1 -0
  206. package/src/generators/ui/libs/ui-sheet-helm/files/index.ts.template +31 -0
  207. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-close.directive.ts.template +26 -0
  208. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-content.directive.ts.template +55 -0
  209. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-description.directive.ts.template +23 -0
  210. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-footer.component.ts.template +26 -0
  211. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-header.component.ts.template +26 -0
  212. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-overlay.directive.ts.template +33 -0
  213. package/src/generators/ui/libs/ui-sheet-helm/files/lib/hlm-sheet-title.directive.ts.template +23 -0
  214. package/src/generators/ui/libs/ui-sheet-helm/generator.d.ts +3 -0
  215. package/src/generators/ui/libs/ui-sheet-helm/generator.js +12 -0
  216. package/src/generators/ui/libs/ui-sheet-helm/generator.js.map +1 -0
  217. package/src/generators/ui/libs/ui-skeleton-helm/files/index.ts.template +10 -0
  218. package/src/generators/ui/libs/ui-skeleton-helm/files/lib/hlm-skeleton.component.ts.template +24 -0
  219. package/src/generators/ui/libs/ui-skeleton-helm/generator.d.ts +3 -0
  220. package/src/generators/ui/libs/ui-skeleton-helm/generator.js +12 -0
  221. package/src/generators/ui/libs/ui-skeleton-helm/generator.js.map +1 -0
  222. package/src/generators/ui/libs/ui-spinner-helm/files/index.ts.template +10 -0
  223. package/src/generators/ui/libs/ui-spinner-helm/files/lib/hlm-spinner.component.ts.template +62 -0
  224. package/src/generators/ui/libs/ui-spinner-helm/generator.d.ts +3 -0
  225. package/src/generators/ui/libs/ui-spinner-helm/generator.js +12 -0
  226. package/src/generators/ui/libs/ui-spinner-helm/generator.js.map +1 -0
  227. package/src/generators/ui/libs/ui-switch-helm/files/index.ts.template +14 -0
  228. package/src/generators/ui/libs/ui-switch-helm/files/lib/hlm-switch-thumb.directive.ts.template +26 -0
  229. package/src/generators/ui/libs/ui-switch-helm/files/lib/hlm-switch.directive.ts.template +26 -0
  230. package/src/generators/ui/libs/ui-switch-helm/generator.d.ts +3 -0
  231. package/src/generators/ui/libs/ui-switch-helm/generator.js +12 -0
  232. package/src/generators/ui/libs/ui-switch-helm/generator.js.map +1 -0
  233. package/src/generators/ui/libs/ui-table-helm/files/index.ts.template +27 -0
  234. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-table.component.ts.template +30 -0
  235. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-table.directive.ts.template +17 -0
  236. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-td.component.ts.template +37 -0
  237. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-th.component.ts.template +40 -0
  238. package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-trow.component.ts.template +33 -0
  239. package/src/generators/ui/libs/ui-table-helm/generator.d.ts +3 -0
  240. package/src/generators/ui/libs/ui-table-helm/generator.js +12 -0
  241. package/src/generators/ui/libs/ui-table-helm/generator.js.map +1 -0
  242. package/src/generators/ui/libs/ui-tabs-helm/files/index.ts.template +17 -0
  243. package/src/generators/ui/libs/ui-tabs-helm/files/lib/hlm-tabs-content.directive.ts.template +26 -0
  244. package/src/generators/ui/libs/ui-tabs-helm/files/lib/hlm-tabs-list.directive.ts.template +43 -0
  245. package/src/generators/ui/libs/ui-tabs-helm/files/lib/hlm-tabs-trigger.directive.ts.template +26 -0
  246. package/src/generators/ui/libs/ui-tabs-helm/generator.d.ts +3 -0
  247. package/src/generators/ui/libs/ui-tabs-helm/generator.js +12 -0
  248. package/src/generators/ui/libs/ui-tabs-helm/generator.js.map +1 -0
  249. package/src/generators/ui/libs/ui-toggle-helm/files/index.ts.template +17 -0
  250. package/src/generators/ui/libs/ui-toggle-helm/files/lib/hlm-toggle-group.directive.ts.template +26 -0
  251. package/src/generators/ui/libs/ui-toggle-helm/files/lib/hlm-toggle.directive.ts.template +58 -0
  252. package/src/generators/ui/libs/ui-toggle-helm/generator.d.ts +3 -0
  253. package/src/generators/ui/libs/ui-toggle-helm/generator.js +12 -0
  254. package/src/generators/ui/libs/ui-toggle-helm/generator.js.map +1 -0
  255. package/src/generators/ui/libs/ui-typography-helm/files/index.ts.template +12 -0
  256. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-blockquote.directive.ts.template +25 -0
  257. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-code.directive.ts.template +25 -0
  258. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-h1.directive.ts.template +25 -0
  259. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-h2.directive.ts.template +26 -0
  260. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-h3.directive.ts.template +25 -0
  261. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-h4.directive.ts.template +25 -0
  262. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-large.directive.ts.template +25 -0
  263. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-lead.directive.ts.template +25 -0
  264. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-muted.directive.ts.template +25 -0
  265. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-p.directive.ts.template +25 -0
  266. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-small.directive.ts.template +25 -0
  267. package/src/generators/ui/libs/ui-typography-helm/files/lib/hlm-ul.directive.ts.template +25 -0
  268. package/src/generators/ui/libs/ui-typography-helm/generator.d.ts +3 -0
  269. package/src/generators/ui/libs/ui-typography-helm/generator.js +12 -0
  270. package/src/generators/ui/libs/ui-typography-helm/generator.js.map +1 -0
  271. package/src/generators/ui/schema.d.ts +7 -0
  272. package/src/generators/ui/schema.json +26 -0
  273. package/src/generators/ui/supported-ui-libraries.json +246 -0
  274. package/src/index.d.ts +0 -0
  275. package/src/index.js +1 -0
  276. package/src/index.js.map +1 -0
  277. package/src/utils/get-project-names.d.ts +5 -0
  278. package/src/utils/get-project-names.js +16 -0
  279. package/src/utils/get-project-names.js.map +1 -0
  280. package/src/utils/version-utils.d.ts +2 -0
  281. package/src/utils/version-utils.js +20 -0
  282. package/src/utils/version-utils.js.map +1 -0
@@ -0,0 +1,23 @@
1
+ import { Directive, Input, computed, signal } from '@angular/core';
2
+ import { hlm } from '@spartan-ng/ui-core';
3
+ import { ClassValue } from 'clsx';
4
+
5
+ @Directive({
6
+ selector: '[hlmAlertDialogTitle],[brnAlertDialogTitle][hlm]',
7
+ standalone: true,
8
+ host: {
9
+ '[class]': '_computedClass()',
10
+ },
11
+ })
12
+ export class HlmAlertDialogTitleDirective {
13
+ private readonly _userCls = signal<ClassValue>('');
14
+ @Input()
15
+ set class(userCls: ClassValue) {
16
+ this._userCls.set(userCls);
17
+ }
18
+
19
+ protected _computedClass = computed(() => this._generateClass());
20
+ private _generateClass() {
21
+ return hlm('text-lg font-semibold', this._userCls());
22
+ }
23
+ }
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { HlmBaseGeneratorSchema } from '../../../base/schema';
3
+ export declare function generator(tree: Tree, options: HlmBaseGeneratorSchema): Promise<import("@nx/devkit").GeneratorCallback>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const generator_1 = require("../../../base/generator");
6
+ function generator(tree, options) {
7
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
+ return yield (0, generator_1.default)(tree, Object.assign(Object.assign({}, options), { primitiveName: 'alertdialog', internalName: 'ui-alert-dialog-helm', publicName: 'ui-alertdialog-helm' }));
9
+ });
10
+ }
11
+ exports.generator = generator;
12
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../../libs/cli/src/generators/ui/libs/ui-alert-dialog-helm/generator.ts"],"names":[],"mappings":";;;;AACA,uDAAuD;AAGvD,SAAsB,SAAS,CAAC,IAAU,EAAE,OAA+B;;QAC1E,OAAO,MAAM,IAAA,mBAAgB,EAAC,IAAI,kCAC9B,OAAO,KACV,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,sBAAsB,EACpC,UAAU,EAAE,qBAAqB,IAChC,CAAC;IACJ,CAAC;CAAA;AAPD,8BAOC"}
@@ -0,0 +1,24 @@
1
+ import { NgModule } from '@angular/core';
2
+
3
+ import { HlmAlertDescriptionDirective } from './lib/hlm-alert-description.directive';
4
+ import { HlmAlertIconDirective } from './lib/hlm-alert-icon.directive';
5
+ import { HlmAlertTitleDirective } from './lib/hlm-alert-title.directive';
6
+ import { HlmAlertDirective } from './lib/hlm-alert.directive';
7
+
8
+ export * from './lib/hlm-alert-description.directive';
9
+ export * from './lib/hlm-alert-icon.directive';
10
+ export * from './lib/hlm-alert-title.directive';
11
+ export * from './lib/hlm-alert.directive';
12
+
13
+ export const HlmAlertImports = [
14
+ HlmAlertDirective,
15
+ HlmAlertTitleDirective,
16
+ HlmAlertDescriptionDirective,
17
+ HlmAlertIconDirective,
18
+ ] as const;
19
+
20
+ @NgModule({
21
+ imports: [...HlmAlertImports],
22
+ exports: [...HlmAlertImports],
23
+ })
24
+ export class HlmAlertModule {}
@@ -0,0 +1,29 @@
1
+ import { Directive, Input, computed, signal } from '@angular/core';
2
+ import { hlm } from '@spartan-ng/ui-core';
3
+ import { VariantProps, cva } from 'class-variance-authority';
4
+ import { ClassValue } from 'clsx';
5
+
6
+ const alertDescriptionVariants = cva('text-sm [&_p]:leading-relaxed', {
7
+ variants: {},
8
+ });
9
+ export type AlertDescriptionVariants = VariantProps<typeof alertDescriptionVariants>;
10
+
11
+ @Directive({
12
+ selector: '[hlmAlertDesc],[hlmAlertDescription]',
13
+ standalone: true,
14
+ host: {
15
+ '[class]': '_computedClass()',
16
+ },
17
+ })
18
+ export class HlmAlertDescriptionDirective {
19
+ private readonly _userCls = signal<ClassValue>('');
20
+ @Input()
21
+ set class(userCls: ClassValue) {
22
+ this._userCls.set(userCls);
23
+ }
24
+
25
+ protected _computedClass = computed(() => this._generateClass());
26
+ private _generateClass() {
27
+ return hlm(alertDescriptionVariants(), this._userCls());
28
+ }
29
+ }
@@ -0,0 +1,15 @@
1
+ import { Directive, inject } from '@angular/core';
2
+ import { HlmIconComponent } from '@spartan-ng/ui-icon-helm';
3
+
4
+ @Directive({
5
+ selector: '[hlmAlertIcon]',
6
+ standalone: true,
7
+ })
8
+ export class HlmAlertIconDirective {
9
+ private _icon = inject(HlmIconComponent, { host: true, optional: true });
10
+
11
+ constructor() {
12
+ if (!this._icon) return;
13
+ this._icon.size = 'sm';
14
+ }
15
+ }
@@ -0,0 +1,29 @@
1
+ import { Directive, Input, computed, signal } from '@angular/core';
2
+ import { hlm } from '@spartan-ng/ui-core';
3
+ import { VariantProps, cva } from 'class-variance-authority';
4
+ import { ClassValue } from 'clsx';
5
+
6
+ const alertTitleVariants = cva('mb-1 font-medium leading-none tracking-tight', {
7
+ variants: {},
8
+ });
9
+ export type AlertTitleVariants = VariantProps<typeof alertTitleVariants>;
10
+
11
+ @Directive({
12
+ selector: '[hlmAlertTitle]',
13
+ standalone: true,
14
+ host: {
15
+ '[class]': '_computedClass()',
16
+ },
17
+ })
18
+ export class HlmAlertTitleDirective {
19
+ private readonly _userCls = signal<ClassValue>('');
20
+ @Input()
21
+ set class(userCls: ClassValue) {
22
+ this._userCls.set(userCls);
23
+ }
24
+
25
+ protected _computedClass = computed(() => this._generateClass());
26
+ private _generateClass() {
27
+ return hlm(alertTitleVariants(), this._userCls());
28
+ }
29
+ }
@@ -0,0 +1,48 @@
1
+ import { Directive, Input, computed, signal } from '@angular/core';
2
+ import { hlm } from '@spartan-ng/ui-core';
3
+ import { VariantProps, cva } from 'class-variance-authority';
4
+ import { ClassValue } from 'clsx';
5
+
6
+ const alertVariants = cva(
7
+ 'relative w-full rounded-lg border border-border p-4 [&>[hlmAlertIcon]]:absolute [&>[hlmAlertIcon]]:text-foreground [&>[hlmAlertIcon]]:left-4 [&>[hlmAlertIcon]]:top-4 [&>[hlmAlertIcon]+div]:translate-y-[-3px] [&>[hlmAlertIcon]~*]:pl-7',
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: 'bg-background text-foreground',
12
+ destructive:
13
+ 'text-destructive border-destructive/50 dark:border-destructive [&>[hlmAlertIcon]]:text-destructive text-destructive',
14
+ },
15
+ },
16
+ defaultVariants: {
17
+ variant: 'default',
18
+ },
19
+ },
20
+ );
21
+ export type AlertVariants = VariantProps<typeof alertVariants>;
22
+
23
+ @Directive({
24
+ selector: '[hlmAlert]',
25
+ standalone: true,
26
+ host: {
27
+ role: 'alert',
28
+ '[class]': '_computedClass()',
29
+ },
30
+ })
31
+ export class HlmAlertDirective {
32
+ private readonly _userCls = signal<ClassValue>('');
33
+ @Input()
34
+ set class(userCls: ClassValue) {
35
+ this._userCls.set(userCls);
36
+ }
37
+
38
+ private readonly _variant = signal<AlertVariants['variant']>('default');
39
+ @Input()
40
+ set variant(variant: AlertVariants['variant']) {
41
+ this._variant.set(variant);
42
+ }
43
+
44
+ protected _computedClass = computed(() => this._generateClass());
45
+ private _generateClass() {
46
+ return hlm(alertVariants({ variant: this._variant() }), this._userCls());
47
+ }
48
+ }
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { HlmBaseGeneratorSchema } from '../../../base/schema';
3
+ export declare function generator(tree: Tree, options: HlmBaseGeneratorSchema): Promise<import("@nx/devkit").GeneratorCallback>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const generator_1 = require("../../../base/generator");
6
+ function generator(tree, options) {
7
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
+ return yield (0, generator_1.default)(tree, Object.assign(Object.assign({}, options), { primitiveName: 'alert', internalName: 'ui-alert-helm', publicName: 'ui-alert-helm' }));
9
+ });
10
+ }
11
+ exports.generator = generator;
12
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../../libs/cli/src/generators/ui/libs/ui-alert-helm/generator.ts"],"names":[],"mappings":";;;;AACA,uDAAuD;AAGvD,SAAsB,SAAS,CAAC,IAAU,EAAE,OAA+B;;QAC1E,OAAO,MAAM,IAAA,mBAAgB,EAAC,IAAI,kCAC9B,OAAO,KACV,aAAa,EAAE,OAAO,EACtB,YAAY,EAAE,eAAe,EAC7B,UAAU,EAAE,eAAe,IAC1B,CAAC;IACJ,CAAC;CAAA;AAPD,8BAOC"}
@@ -0,0 +1,10 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { HlmAspectRatioDirective } from './lib/helm-aspect-ratio.directive';
3
+
4
+ export * from './lib/helm-aspect-ratio.directive';
5
+
6
+ @NgModule({
7
+ imports: [HlmAspectRatioDirective],
8
+ exports: [HlmAspectRatioDirective],
9
+ })
10
+ export class HlmAspectRatioModule {}
@@ -0,0 +1,73 @@
1
+ import { Component } from '@angular/core';
2
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
3
+ import { HlmAspectRatioDirective } from './helm-aspect-ratio.directive';
4
+
5
+ @Component({
6
+ selector: 'hlm-mock',
7
+ standalone: true,
8
+ imports: [HlmAspectRatioDirective],
9
+ template: `
10
+ <div [hlmAspectRatio]="ratio">
11
+ <img
12
+ src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAApgAAAKYB3X3/OAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAANCSURBVEiJtZZPbBtFFMZ/M7ubXdtdb1xSFyeilBapySVU8h8OoFaooFSqiihIVIpQBKci6KEg9Q6H9kovIHoCIVQJJCKE1ENFjnAgcaSGC6rEnxBwA04Tx43t2FnvDAfjkNibxgHxnWb2e/u992bee7tCa00YFsffekFY+nUzFtjW0LrvjRXrCDIAaPLlW0nHL0SsZtVoaF98mLrx3pdhOqLtYPHChahZcYYO7KvPFxvRl5XPp1sN3adWiD1ZAqD6XYK1b/dvE5IWryTt2udLFedwc1+9kLp+vbbpoDh+6TklxBeAi9TL0taeWpdmZzQDry0AcO+jQ12RyohqqoYoo8RDwJrU+qXkjWtfi8Xxt58BdQuwQs9qC/afLwCw8tnQbqYAPsgxE1S6F3EAIXux2oQFKm0ihMsOF71dHYx+f3NND68ghCu1YIoePPQN1pGRABkJ6Bus96CutRZMydTl+TvuiRW1m3n0eDl0vRPcEysqdXn+jsQPsrHMquGeXEaY4Yk4wxWcY5V/9scqOMOVUFthatyTy8QyqwZ+kDURKoMWxNKr2EeqVKcTNOajqKoBgOE28U4tdQl5p5bwCw7BWquaZSzAPlwjlithJtp3pTImSqQRrb2Z8PHGigD4RZuNX6JYj6wj7O4TFLbCO/Mn/m8R+h6rYSUb3ekokRY6f/YukArN979jcW+V/S8g0eT/N3VN3kTqWbQ428m9/8k0P/1aIhF36PccEl6EhOcAUCrXKZXXWS3XKd2vc/TRBG9O5ELC17MmWubD2nKhUKZa26Ba2+D3P+4/MNCFwg59oWVeYhkzgN/JDR8deKBoD7Y+ljEjGZ0sosXVTvbc6RHirr2reNy1OXd6pJsQ+gqjk8VWFYmHrwBzW/n+uMPFiRwHB2I7ih8ciHFxIkd/3Omk5tCDV1t+2nNu5sxxpDFNx+huNhVT3/zMDz8usXC3ddaHBj1GHj/As08fwTS7Kt1HBTmyN29vdwAw+/wbwLVOJ3uAD1wi/dUH7Qei66PfyuRj4Ik9is+hglfbkbfR3cnZm7chlUWLdwmprtCohX4HUtlOcQjLYCu+fzGJH2QRKvP3UNz8bWk1qMxjGTOMThZ3kvgLI5AzFfo379UAAAAASUVORK5CYII="
13
+ />
14
+ </div>
15
+ `,
16
+ })
17
+ class MockComponent {
18
+ ratio: number | undefined = 16 / 9;
19
+ }
20
+
21
+ describe('HelmAspectRatioDirective', () => {
22
+ let component: MockComponent;
23
+ let fixture: ComponentFixture<MockComponent>;
24
+
25
+ beforeEach(() => {
26
+ fixture = TestBed.createComponent(MockComponent);
27
+ component = fixture.componentInstance;
28
+ });
29
+
30
+ it('should compile', () => {
31
+ expect(component).toBeTruthy();
32
+ });
33
+
34
+ it('should show the image', () => {
35
+ fixture.detectChanges();
36
+ const img = fixture.nativeElement.querySelector('img');
37
+ expect(img).toBeTruthy();
38
+ });
39
+
40
+ it('should have the correct aspect ratio', () => {
41
+ fixture.detectChanges();
42
+ const div = fixture.nativeElement.querySelector('div');
43
+ expect(div.style.paddingBottom).toEqual(100 / (component.ratio || 1) + '%');
44
+ });
45
+
46
+ it('should default to an aspect ratio of 1', () => {
47
+ component.ratio = undefined;
48
+ fixture.detectChanges();
49
+ const div = fixture.nativeElement.querySelector('div');
50
+ expect(div.style.paddingBottom).toEqual('100%');
51
+ });
52
+
53
+ it('should fallback to an aspect ratio of 1 if the ratio is 0', () => {
54
+ component.ratio = 0;
55
+ fixture.detectChanges();
56
+ const div = fixture.nativeElement.querySelector('div');
57
+ expect(div.style.paddingBottom).toEqual('100%');
58
+ });
59
+
60
+ it('should fallback to an aspect ratio of 1 if the ratio is negative', () => {
61
+ component.ratio = -1;
62
+ fixture.detectChanges();
63
+ const div = fixture.nativeElement.querySelector('div');
64
+ expect(div.style.paddingBottom).toEqual('100%');
65
+ });
66
+
67
+ it('should add the correct styles to the image', () => {
68
+ fixture.detectChanges();
69
+
70
+ const img = fixture.nativeElement.querySelector('img') as HTMLImageElement;
71
+ expect(img.classList.toString()).toBe('absolute w-full h-full object-cover');
72
+ });
73
+ });
@@ -0,0 +1,53 @@
1
+ import { coerceNumberProperty, NumberInput } from '@angular/cdk/coercion';
2
+ import { AfterViewInit, computed, Directive, ElementRef, inject, Input, signal } from '@angular/core';
3
+ import { hlm } from '@spartan-ng/ui-core';
4
+ import { ClassValue } from 'clsx';
5
+
6
+ const parseDividedString = (value: NumberInput): NumberInput => {
7
+ if (typeof value !== 'string' || !value.includes('/')) return value;
8
+ return value
9
+ .split('/')
10
+ .map((v) => parseInt(v, 10))
11
+ .reduce((a, b) => a / b);
12
+ };
13
+
14
+ @Directive({
15
+ selector: '[hlmAspectRatio]',
16
+ standalone: true,
17
+ host: {
18
+ '[class]': '_computedClass()',
19
+ '[style.padding-bottom]': '_computedPaddingBottom()',
20
+ },
21
+ })
22
+ export class HlmAspectRatioDirective implements AfterViewInit {
23
+ private readonly _ratio = signal(1);
24
+ private readonly _el: HTMLElement = inject(ElementRef).nativeElement;
25
+
26
+ @Input()
27
+ set hlmAspectRatio(value: NumberInput) {
28
+ const coerced = coerceNumberProperty(parseDividedString(value));
29
+ this._ratio.set(coerced <= 0 ? 1 : coerced);
30
+ }
31
+ protected _computedPaddingBottom = computed(() => {
32
+ return `${100 / this._ratio()}%`;
33
+ });
34
+
35
+ private readonly _userCls = signal<ClassValue>('');
36
+ @Input()
37
+ set class(userCls: ClassValue) {
38
+ this._userCls.set(userCls);
39
+ }
40
+
41
+ protected _computedClass = computed(() => this._generateClass());
42
+ private _generateClass() {
43
+ return hlm(`relative w-full`, this._userCls());
44
+ }
45
+
46
+ ngAfterViewInit() {
47
+ // support delayed addition of image to dom
48
+ const child = this._el.firstElementChild;
49
+ if (child) {
50
+ child.classList.add('absolute', 'w-full', 'h-full', 'object-cover');
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { HlmBaseGeneratorSchema } from '../../../base/schema';
3
+ export declare function generator(tree: Tree, options: HlmBaseGeneratorSchema): Promise<import("@nx/devkit").GeneratorCallback>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const generator_1 = require("../../../base/generator");
6
+ function generator(tree, options) {
7
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
+ return yield (0, generator_1.default)(tree, Object.assign(Object.assign({}, options), { primitiveName: 'aspectratio', internalName: 'ui-aspect-ratio-helm', publicName: 'ui-aspectratio-helm' }));
9
+ });
10
+ }
11
+ exports.generator = generator;
12
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../../libs/cli/src/generators/ui/libs/ui-aspect-ratio-helm/generator.ts"],"names":[],"mappings":";;;;AACA,uDAAuD;AAGvD,SAAsB,SAAS,CAAC,IAAU,EAAE,OAA+B;;QAC1E,OAAO,MAAM,IAAA,mBAAgB,EAAC,IAAI,kCAC9B,OAAO,KACV,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,sBAAsB,EACpC,UAAU,EAAE,qBAAqB,IAChC,CAAC;IACJ,CAAC;CAAA;AAPD,8BAOC"}
@@ -0,0 +1,17 @@
1
+ import { NgModule } from '@angular/core';
2
+
3
+ import { HlmAvatarFallbackDirective } from './lib/fallback';
4
+ import { HlmAvatarComponent } from './lib/hlm-avatar.component';
5
+ import { HlmAvatarImageDirective } from './lib/image';
6
+
7
+ export * from './lib/fallback';
8
+ export * from './lib/hlm-avatar.component';
9
+ export * from './lib/image';
10
+
11
+ export const HlmAvatarImports = [HlmAvatarFallbackDirective, HlmAvatarImageDirective, HlmAvatarComponent] as const;
12
+
13
+ @NgModule({
14
+ imports: [...HlmAvatarImports],
15
+ exports: [...HlmAvatarImports],
16
+ })
17
+ export class HlmAvatarModule {}
@@ -0,0 +1,70 @@
1
+ import { Component, PLATFORM_ID } from '@angular/core';
2
+ import { ComponentFixture, TestBed, fakeAsync } from '@angular/core/testing';
3
+ import { hexColorFor, isBright } from '@spartan-ng/ui-avatar-brain';
4
+ import { HlmAvatarFallbackDirective } from './hlm-avatar-fallback.directive';
5
+
6
+ @Component({
7
+ selector: 'hlm-mock',
8
+ standalone: true,
9
+ imports: [HlmAvatarFallbackDirective],
10
+ template: `
11
+ <span hlmAvatarFallback [class]="userCls" [autoColor]="autoColor">fallback2</span>
12
+ `,
13
+ })
14
+ class HlmMockComponent {
15
+ userCls = '';
16
+ autoColor = false;
17
+ }
18
+
19
+ describe('HlmAvatarFallbackDirective', () => {
20
+ let component: HlmMockComponent;
21
+ let fixture: ComponentFixture<HlmMockComponent>;
22
+
23
+ beforeEach(() => {
24
+ fixture = TestBed.overrideProvider(PLATFORM_ID, { useValue: 'browser' }).createComponent(HlmMockComponent);
25
+ component = fixture.componentInstance;
26
+ });
27
+
28
+ it('should compile', () => {
29
+ expect(component).toBeTruthy();
30
+ });
31
+
32
+ it('should contain the default classes if no inputs are provided', () => {
33
+ fixture.detectChanges();
34
+ expect(fixture.nativeElement.querySelector('span').className).toBe(
35
+ 'bg-muted flex h-full items-center justify-center rounded-full w-full',
36
+ );
37
+ });
38
+
39
+ it('should add any user defined classes', async () => {
40
+ component.userCls = 'test-class';
41
+
42
+ fixture.detectChanges();
43
+ expect(fixture.nativeElement.querySelector('span').className).toContain('test-class');
44
+ });
45
+ it('should merge bg-destructive correctly when set as user defined class, therefore removing bg-muted', async () => {
46
+ component.userCls = 'bg-destructive ';
47
+
48
+ fixture.detectChanges();
49
+ expect(fixture.nativeElement.querySelector('span').className).toContain('bg-destructive');
50
+ });
51
+
52
+ describe('autoColor', () => {
53
+ beforeEach(() => {
54
+ component.autoColor = true;
55
+ fixture.detectChanges();
56
+ });
57
+
58
+ it('should remove the bg-muted class from the component', fakeAsync(() => {
59
+ fixture.detectChanges();
60
+ expect(fixture.nativeElement.querySelector('span').className).not.toContain('bg-muted');
61
+ }));
62
+
63
+ it('should remove add a text color class and hex backgroundColor style depending on its content', () => {
64
+ const hex = hexColorFor('fallback2');
65
+ const textCls = isBright(hex) ? 'text-black' : 'text-white';
66
+ expect(fixture.nativeElement.querySelector('span').className).toContain(textCls);
67
+ expect(fixture.nativeElement.querySelector('span').style.backgroundColor).toBe('rgb(144, 53, 149)');
68
+ });
69
+ });
70
+ });
@@ -0,0 +1,40 @@
1
+ import { computed, Directive, inject } from '@angular/core';
2
+ import { BrnAvatarFallbackDirective, hexColorFor, isBright } from '@spartan-ng/ui-avatar-brain';
3
+ import { hlm } from '@spartan-ng/ui-core';
4
+
5
+ @Directive({
6
+ selector: '[hlmAvatarFallback]',
7
+ standalone: true,
8
+ exportAs: 'avatarFallback',
9
+ hostDirectives: [
10
+ {
11
+ directive: BrnAvatarFallbackDirective,
12
+ inputs: ['class:class', 'autoColor:autoColor'],
13
+ },
14
+ ],
15
+ host: {
16
+ '[class]': '_computedClass()',
17
+ '[style.backgroundColor]': "_hex() || ''",
18
+ },
19
+ })
20
+ export class HlmAvatarFallbackDirective {
21
+ private readonly _brn = inject(BrnAvatarFallbackDirective);
22
+ private readonly _hex = computed(() => {
23
+ if (!this._brn.useAutoColor() || !this._brn.getTextContent()) return;
24
+ return hexColorFor(this._brn.getTextContent());
25
+ });
26
+
27
+ private readonly _autoColorTextCls = computed(() => {
28
+ const hex = this._hex();
29
+ if (!hex) return;
30
+ return `${isBright(hex) ? 'text-black' : 'text-white'}`;
31
+ });
32
+
33
+ protected readonly _computedClass = computed(() => {
34
+ return hlm(
35
+ 'flex h-full w-full items-center justify-center rounded-full',
36
+ this._autoColorTextCls() ?? 'bg-muted',
37
+ this._brn?.userCls(),
38
+ );
39
+ });
40
+ }
@@ -0,0 +1 @@
1
+ export * from './hlm-avatar-fallback.directive';
@@ -0,0 +1,61 @@
1
+ import { Component } from '@angular/core';
2
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
3
+ import { BrnAvatarFallbackDirective, BrnAvatarImageDirective } from '@spartan-ng/ui-avatar-brain';
4
+ import { HlmAvatarComponent } from './hlm-avatar.component';
5
+
6
+ @Component({
7
+ selector: 'hlm-mock',
8
+ imports: [BrnAvatarImageDirective, BrnAvatarFallbackDirective, HlmAvatarComponent],
9
+ template: `
10
+ <hlm-avatar id="fallbackOnly">
11
+ <span brnAvatarFallback>fallback</span>
12
+ </hlm-avatar>
13
+ `,
14
+ standalone: true,
15
+ })
16
+ class MockComponent {}
17
+
18
+ describe('HlmAvatarComponent', () => {
19
+ let component: HlmAvatarComponent;
20
+ let fixture: ComponentFixture<HlmAvatarComponent>;
21
+
22
+ beforeEach(() => {
23
+ fixture = TestBed.createComponent(HlmAvatarComponent);
24
+ component = fixture.componentInstance;
25
+ });
26
+
27
+ it('should compile', () => {
28
+ expect(component).toBeTruthy();
29
+ });
30
+
31
+ it('should add the default classes if no inputs are provided', () => {
32
+ fixture.detectChanges();
33
+ expect(fixture.nativeElement.className).toBe('flex h-10 overflow-hidden relative rounded-full shrink-0 w-10');
34
+ });
35
+
36
+ it('should add any user defined classes', () => {
37
+ component.class = 'test-class';
38
+ fixture.detectChanges();
39
+ expect(fixture.nativeElement.className).toContain('test-class');
40
+ });
41
+
42
+ it('should change the size when the variant is changed', () => {
43
+ component.variant = 'small';
44
+ fixture.detectChanges();
45
+ expect(fixture.nativeElement.className).toContain('h-6');
46
+ expect(fixture.nativeElement.className).toContain('w-6');
47
+ expect(fixture.nativeElement.className).toContain('text-xs');
48
+
49
+ component.variant = 'large';
50
+ fixture.detectChanges();
51
+ expect(fixture.nativeElement.className).toContain('h-14');
52
+ expect(fixture.nativeElement.className).toContain('w-14');
53
+ expect(fixture.nativeElement.className).toContain('text-lg');
54
+ });
55
+
56
+ it('should support brn directives', () => {
57
+ const mockFixture = TestBed.createComponent(MockComponent);
58
+ mockFixture.detectChanges();
59
+ expect(mockFixture.nativeElement.querySelector('span').textContent).toBe('fallback');
60
+ });
61
+ });
@@ -0,0 +1,58 @@
1
+ import { NgIf } from '@angular/common';
2
+ import { ChangeDetectionStrategy, Component, computed, Input, signal, ViewEncapsulation } from '@angular/core';
3
+ import { BrnAvatarComponent } from '@spartan-ng/ui-avatar-brain';
4
+ import { hlm } from '@spartan-ng/ui-core';
5
+ import { cva, VariantProps } from 'class-variance-authority';
6
+ import { ClassValue } from 'clsx';
7
+
8
+ const avatarVariants = cva('relative flex shrink-0 overflow-hidden rounded-full', {
9
+ variants: {
10
+ variant: {
11
+ small: 'h-6 w-6 text-xs',
12
+ medium: 'h-10 w-10',
13
+ large: 'h-14 w-14 text-lg',
14
+ },
15
+ },
16
+ defaultVariants: {
17
+ variant: 'medium',
18
+ },
19
+ });
20
+
21
+ type AvatarVariants = VariantProps<typeof avatarVariants>;
22
+
23
+ @Component({
24
+ selector: 'hlm-avatar',
25
+ changeDetection: ChangeDetectionStrategy.OnPush,
26
+ encapsulation: ViewEncapsulation.None,
27
+ imports: [NgIf],
28
+ standalone: true,
29
+ template: `
30
+ <ng-container *ngIf="image?.canShow(); else fallback">
31
+ <ng-content select="[hlmAvatarImage],[brnAvatarImage]" />
32
+ </ng-container>
33
+ <ng-template #fallback>
34
+ <ng-content select="[hlmAvatarFallback],[brnAvatarFallback]" />
35
+ </ng-template>
36
+ `,
37
+ host: {
38
+ '[class]': '_computedClass()',
39
+ },
40
+ })
41
+ export class HlmAvatarComponent extends BrnAvatarComponent {
42
+ private readonly _userCls = signal<ClassValue>('');
43
+ @Input()
44
+ set class(userCls: ClassValue) {
45
+ this._userCls.set(userCls);
46
+ }
47
+
48
+ private readonly _variant = signal<AvatarVariants['variant']>('medium');
49
+ @Input()
50
+ set variant(variant: AvatarVariants['variant']) {
51
+ this._variant.set(variant);
52
+ }
53
+
54
+ protected _computedClass = computed(() => this._generateClass());
55
+ private _generateClass() {
56
+ return hlm(avatarVariants({ variant: this._variant() }), this._userCls());
57
+ }
58
+ }